From 68fe672b2f6f4eb91e0c4449b9414a615253ddf4 Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Mon, 14 Oct 2019 15:31:01 +0800 Subject: [PATCH 001/800] translated --- ...0180706 Building a Messenger App- OAuth.md | 94 +++++++++---------- 1 file changed, 46 insertions(+), 48 deletions(-) rename {sources => translated}/tech/20180706 Building a Messenger App- OAuth.md (64%) diff --git a/sources/tech/20180706 Building a Messenger App- OAuth.md b/translated/tech/20180706 Building a Messenger App- OAuth.md similarity index 64% rename from sources/tech/20180706 Building a Messenger App- OAuth.md rename to translated/tech/20180706 Building a Messenger App- OAuth.md index 36732e9795..10153263be 100644 --- a/sources/tech/20180706 Building a Messenger App- OAuth.md +++ b/translated/tech/20180706 Building a Messenger App- OAuth.md @@ -1,28 +1,28 @@ -[#]: collector: (lujun9972) -[#]: translator: (PsiACE) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Building a Messenger App: OAuth) -[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-oauth/) -[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) +[#]: collector: "lujun9972" +[#]: translator: "PsiACE" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Building a Messenger App: OAuth" +[#]: via: "https://nicolasparada.netlify.com/posts/go-messenger-oauth/" +[#]: author: "Nicolás Parada https://nicolasparada.netlify.com/" -Building a Messenger App: OAuth +构建一个即时消息应用(二):OAuth ====== -[Previous part: Schema][1]. +[上一篇:模式](https://linux.cn/article-11396-1.html),[原文][1]。 -In this post we start the backend by adding social login. +在这篇帖子中,我们将会通过为应用添加社交登录功能进入后端开发。 -This is how it works: the user click on a link that redirects him to the GitHub authorization page. The user grant access to his info and get redirected back logged in. The next time he tries to login, he won’t be asked to grant permission, it is remembered so the login flow is as fast as a single click. +它的工作方式十分简单:用户点击链接,然后重定向到 GitHub 授权页面。当用户授予我们对他的个人信息的访问权限之后,就会重定向回登录页面。下一次尝试登录时,系统将不会再次请求授权,也就是说,我们的应用已经记住了他。这使得登录流程看起来就像单击一样快。 -Internally, the history is more complex tho. First we need the register a new [OAuth app on GitHub][2]. +如果考虑内部实现的话,过程将会比较复杂。首先,我们需要注册一个新的 [GitHub OAuth 应用][2]。 -The important part is the callback URL. Set it to `http://localhost:3000/api/oauth/github/callback`. On development we are on localhost, so when you ship the app to production, register a new app with the correct callback URL. +比较重要的是回调 URL。我们将它设置为 `http://localhost:3000/api/oauth/github/callback`。这是因为,在开发过程中,我们总是在本地主机上工作。一旦你要将应用交付生产,请使用正确的回调 URL 注册一个新的应用。 -This will give you a client id and a secret key. Don’t share them with anyone 👀 +注册以后,你将会收到客户端 id 和安全密钥。安全起见,请不要与任何人分享他们 👀 -With that off of the way, lets start to write some code. Create a `main.go` file: +顺便让我们开始写一些代码吧。现在,创建一个 `main.go` 文件: ``` package main @@ -139,7 +139,7 @@ func intEnv(key string, fallbackValue int) int { } ``` -Install dependencies: +安装依赖项: ``` go get -u github.com/gorilla/securecookie @@ -151,28 +151,26 @@ go get -u github.com/matryer/way go get -u golang.org/x/oauth2 ``` -We use a `.env` file to save secret keys and other configurations. Create it with at least this content: +我们将会使用 `.env` 文件来保存密钥和其他配置。请创建这个文件,并保证里面至少包含以下内容: ``` GITHUB_CLIENT_ID=your_github_client_id GITHUB_CLIENT_SECRET=your_github_client_secret ``` -The other enviroment variables we use are: +我们还要用到的其他环境变量有: - * `PORT`: The port in which the server runs. Defaults to `3000`. - * `ORIGIN`: Your domain. Defaults to `http://localhost:3000/`. The port can also be extracted from this. - * `DATABASE_URL`: The Cockroach address. Defaults to `postgresql://root@127.0.0.1:26257/messenger?sslmode=disable`. - * `HASH_KEY`: Key to sign cookies. Yeah, we’ll use signed cookies for security. - * `JWT_KEY`: Key to sign JSON web tokens. + * `PORT`:服务器运行的端口,默认值是 `3000`。 + * `ORIGIN`:你的域名,默认值是 `http://localhost:3000/`。端口也可以在这里指定。 + * `DATABASE_URL`:Cockroach 数据库的地址。默认值是 `postgresql://root@127.0.0.1:26257/messenger?sslmode=disable`。 + * `HASH_KEY`:用于为 cookies 签名的密钥。没错,我们会使用已签名的 cookies 来确保安全。 + * `JWT_KEY`:用于签署 JSON 网络令牌的密钥。 +因为代码中已经设定了默认值,所以你也不用把它们写到 `.env` 文件中。 +在读取配置并连接到数据库之后,我们会创建一个 OAuth 配置。我们会使用 origin 来构建回调 URL(就和我们在 GitHub 页面上注册的一样)。我们的范围设置为 “read:user”。这会允许我们读取公开的用户信息,我们只是需要他的用户名和头像。然后我们会初始化 cookie 和 JWT 签名器。定义一些端点并启动服务器。 -Because they have default values, your don’t need to write them on the `.env` file. - -After reading the configuration and connecting to the database, we create an OAuth config. We use the origin to build the callback URL (the same we registered on the github page). And we set the scope to “read:user”. This will give us permission to read the public user info. That’s because we just need his username and avatar. Then we initialize the cookie and JWT signers. Define some endpoints and start the server. - -Before implementing those HTTP handlers lets write a couple functions to send HTTP responses. +在实现 HTTP 处理程序之前,让我们编写一些函数来发送 HTTP 响应。 ``` func respond(w http.ResponseWriter, v interface{}, statusCode int) { @@ -192,11 +190,11 @@ func respondError(w http.ResponseWriter, err error) { } ``` -The first one is to send JSON and the second one logs the error to the console and return a `500 Internal Server Error` error. +第一个用来发送 JSON,而第二个将错误记录到控制台并返回一个 `500 Internal Server Error` 错误信息。 -### OAuth Start +### OAuth 开始 -So, the user clicks on a link that says “Access with GitHub”… That link points the this endpoint `/api/oauth/github` that will redirect the user to github. +所以,用户点击写着 “Access with GitHub” 的链接。该链接指向 `/api/oauth/github`,这将会把用户重定向到 github。 ``` func githubOAuthStart(w http.ResponseWriter, r *http.Request) { @@ -222,11 +220,11 @@ func githubOAuthStart(w http.ResponseWriter, r *http.Request) { } ``` -OAuth2 uses a mechanism to prevent CSRF attacks so it requires a “state”. We use nanoid to create a random string and use that as state. We save it as a cookie too. +OAuth2 使用一种机制来防止 CSRF 攻击,因此它需要一个「状态」 "state"。我们使用 nanoid 来创建一个随机字符串并用它作为状态。我们也把它保存为一个 cookie。 -### OAuth Callback +### OAuth 回调 -Once the user grant access to his info on the GitHub page, he will be redirected to this endpoint. The URL will come with the state and a code on the query string `/api/oauth/github/callback?state=&code=` +一旦用户授权我们访问他的个人信息,他将会被重定向到这个端点。这个 URL 将会在查询字符串上包含状态(state)和授权码(code) `/api/oauth/github/callback?state=&code=` ``` const jwtLifetime = time.Hour * 24 * 14 @@ -341,19 +339,19 @@ func githubOAuthCallback(w http.ResponseWriter, r *http.Request) { } ``` -First we try to decode the cookie with the state we saved before. And compare it with the state that comes in the query string. In case they don’t match, we return a `418 I'm teapot` error. +首先,我们会尝试使用之前保存的状态对 cookie 进行解码。并将其与查询字符串中的状态进行比较。如果它们不匹配,我们会返回一个 `418 I'm teapot`(未知来源)错误。 -Then we exchange the code for a token. This token is used to create an HTTP client to make requests to the GitHub API. So we do a GET request to `https://api.github.com/user`. This endpoint will give us the current authenticated user info in JSON format. We decode it to get the user ID, login (username) and avatar URL. +接着,我们使用授权码生成一个令牌。这个令牌被用于创建 HTTP 客户端来向 GitHub API 发出请求。所以最终我们向 `https://api.github.com/user` 发送了一个 GET 请求。这个端点将会以 JSON 格式向我们提供当前经过身份验证的用户信息。我们将会解码这些内容,来获取用户 ID,登录名(用户名)和头像 URL。 -Then we try to find a user with that GitHub ID on the database. If none is found, we create one using that data. +然后我们将会尝试在数据库上找到具有该 GitHub ID 的用户。如果没有找到,那么我们就会使用该数据创建一个新的。 -Then, with the newly created user, we issue a JSON web token with the user ID as Subject and redirect to the frontend with the token, along side the expiration date in the query string. +之后,对于新创建的用户,我们会发出一个用户 ID 为主题的 JSON 网络令牌,并使用该令牌重定向到前端,查询字符串中一并包含该令牌的到期日(the expiration date)。 -The web app will be for another post, but the URL you are being redirected is `/callback?token=&expires_at=`. There we’ll have some JavaScript to extract the token and expiration date from the URL and do a GET request to `/api/auth_user` with the token in the `Authorization` header in the form of `Bearer token_here` to get the authenticated user and save it to localStorage. +这一 Web 应用也会被用在其他帖子,但是重定向的链接会是 `/callback?token=&expires_at=`。在那里,我们将会利用 JavaScript 从 URL 中获取令牌和到期日,并通过 `Authorization` 标头中的令牌以`Bearer token_here` 的形式对 `/ api / auth_user` 进行GET请求,来获取已认证的身份用户并将其保存到 localStorage。 -### Guard Middleware +### 保护中间件 -To get the current authenticated user we use a middleware. That’s because in future posts we’ll have more endpoints that requires authentication, and a middleware allow us to share functionality. +为了获取当前已经过身份验证的用户,我们使用了中间件。这是因为在接下来的文章中,我们会有很多需要身份认证的端点,而中间件将会允许我们共享这一功能。 ``` type ContextKey struct { @@ -388,9 +386,9 @@ func guard(handler http.HandlerFunc) http.HandlerFunc { } ``` -First we try to read the token from the `Authorization` header or a `token` in the URL query string. If none found, we return a `401 Unauthorized` error. Then we decode the claims in the token and use the Subject as the current authenticated user ID. +首先,我们尝试从 `Authorization` 标头或者是 URL 查询字符串中的 `token` 字段中读取令牌。如果没有找到,我们需要返回 `401 Unauthorized`(未授权)错误。然后我们将会对令牌中的申明进行解码,并使用该主题作为当前已经过身份验证的用户 ID。 -Now, we can wrap any `http.handlerFunc` that needs authentication with this middleware and we’ll have the authenticated user ID in the context. +现在,我们可以用这一中间件来封装任何需要授权的 `http.handlerFunc`,并且在处理函数的上下文中具有已经过身份验证的用户 ID。 ``` var guarded = guard(func(w http.ResponseWriter, r *http.Request) { @@ -398,7 +396,7 @@ var guarded = guard(func(w http.ResponseWriter, r *http.Request) { }) ``` -### Get Authenticated User +### 获取认证用户 ``` func getAuthUser(w http.ResponseWriter, r *http.Request) { @@ -422,13 +420,13 @@ func getAuthUser(w http.ResponseWriter, r *http.Request) { } ``` -We use the guard middleware to get the current authenticated user id and do a query to the database. +我们使用保护中间件来获取当前经过身份认证的用户 ID 并查询数据库。 * * * -That will cover the OAuth process on the backend. In the next part we’ll see how to start conversations with other users. +这一部分涵盖了后端的 OAuth 流程。在下一篇帖子中,我们将会看到如何开始与其他用户的对话。 -[Souce Code][3] +[源代码][3] -------------------------------------------------------------------------------- From 52a0e731f5c6283c85ad5887faec2d9d50579a27 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 15 Oct 2019 22:31:12 +0800 Subject: [PATCH 002/800] PART 1 --- ...iters can get work done better with Git.md | 94 +++++++++---------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/sources/tech/20190404 How writers can get work done better with Git.md b/sources/tech/20190404 How writers can get work done better with Git.md index 5d6f670bad..1d77a87842 100644 --- a/sources/tech/20190404 How writers can get work done better with Git.md +++ b/sources/tech/20190404 How writers can get work done better with Git.md @@ -7,72 +7,72 @@ [#]: via: (https://opensource.com/article/19/4/write-git) [#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/noreplyhttps://opensource.com/users/seth) -How writers can get work done better with Git +用 Git 帮助写作者更好地完成工作 ====== -If you're a writer, you could probably benefit from using Git. Learn how -in our series about little-known uses of Git. + +> 如果你是一名写作者,你也能从使用 Git 中受益。在我们的系列文章中了解有关 Git 鲜为人知的用法。 + ![Writing Hand][1] -[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at ways writers can use Git to get work done. +[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 -### Git for writers +今天我们来看看写作者如何使用 Git 更好的地完成工作。 -Some people write fiction; others write academic papers, poetry, screenplays, technical manuals, or articles about open source. Many do a little of each. The common thread is that if you're a writer, you could probably benefit from using Git. While Git is famously a highly technical tool used by computer programmers, it's ideal for the modern author, and this article will demonstrate how it can change the way you write—and why you'd want it to. +### 写作者的 Git -Before talking about Git, though, it's important to talk about what _copy_ (or _content_ , for the digital age) really is, and why it's different from your delivery _medium_. It's the 21 st century, and the tool of choice for most writers is a computer. While computers are deceptively good at combining processes like copy editing and layout, writers are (re)discovering that separating content from style is a good idea, after all. That means you should be writing on a computer like it's a typewriter, not a word processor. In computer lingo, that means writing in _plaintext_. +有些人写小说,也有人撰写学术论文、诗歌、剧本、技术手册或有关开源的文章。许多人都在做一点各种写作。相同的是,如果你是一名写作者,则或许能从使用 Git 中受益。尽管 Git 是著名的计算机程序员所使用的高度技术性工具,但它也是现代写作者的理想之选,本文将向你演示如何改变你的书写方式以及为什么要这么做的原因。 -### Writing in plaintext +但是,在谈论 Git 之前,重要的是先谈谈“副本”(或者叫“内容”,对于数字时代而言)到底是什么,以及为什么它与你的交付*媒介*不同。这是 21 世纪,大多数写作者选择的工具是计算机。尽管计算机看似擅长将副本的编辑和布局等过程结合在一起,但写作者还是(重新)发现将内容与样式分开是一个好主意。这意味着你应该在计算机上像在打字机上而不是在文字处理器中进行书写。以计算机术语而言,这意味着以*纯文本*形式写作。 -It used to be a safe assumption that you knew what market you were writing for. You wrote content for a book, or a website, or a software manual. These days, though, the market's flattened: you might decide to use content you write for a website in a printed book project, and the printed book might release an EPUB version later. And in the case of digital editions of your content, the person reading your content is in ultimate control: they may read your words on the website where you published them, or they might click on Firefox's excellent [Reader View][3], or they might print to physical paper, or they could dump the web page to a text file with Lynx, or they may not see your content at all because they use a screen reader. +### 以纯文本写作 -It makes sense to write your words as words, leaving the delivery to the publishers. Even if you are also your own publisher, treating your words as a kind of source code for your writing is a smarter and more efficient way to work, because when it comes time to publish, you can use the same source (your plaintext) to generate output appropriate to your target (PDF for print, EPUB for e-books, HTML for websites, and so on). +这个假设曾经是毫无疑问的:你知道自己的写作所要针对的市场,你可以为书籍、网站或软件手册等不同市场编写内容。但是,近来各种市场趋于扁平化:你可能决定在纸质书中使用为网站编写的内容,并且纸质书可能会在以后发布 EPUB 版本。对于你的内容的数字版本,读者才是最终控制者:他们可以在你发布内容的网站上阅读你的文字,也可以点击 Firefox 出色的[阅读视图][3],还可能会打印到纸张上,或者可能会使用 Lynx 将网页转储到文本文件中,甚至可能因为使用屏幕阅读器而根本看不到你的内容。 -Writing in plaintext not only means you don't have to worry about layout or how your text is styled, but you also no longer require specialized tools. Anything that can produce text becomes a valid "word processor" for you, whether it's a basic notepad app on your mobile or tablet, the text editor that came bundled with your computer, or a free editor you download from the internet. You can write on practically any device, no matter where you are or what you're doing, and the text you produce integrates perfectly with your project, no modification required. +你只需要逐字写下你的内容,而将交付工作留给发布者。即使你是自己发布,将字词作为写作作品的一种源代码也是一种更聪明、更有效的工作方式,因为在发布时,你可以使用相同的源(你的纯文本)生成适合你的目标输出(用于打印的 PDF、用于电子书的 EPUB、用于网站的 HTML 等)。 -And, conveniently, Git specializes in managing plaintext. +用纯文本编写不仅意味着你不必担心布局或文本样式,而且也不再需要专门的工具。无论是手机或平板电脑上的基本记事本应用程序、计算机附带的文本编辑器,还是从互联网上下载的免费编辑器,任何能够产生文本内容的工具对你而言都是有效的“文字处理器”。无论你身在何处或在做什么,几乎可以在任何设备上书写,并且所生成的文本可以与你的项目完美集成,而无需进行任何修改。 -### The Atom editor +而且,Git 专门用来管理纯文本。 -When you write in plaintext, a word processor is overkill. Using a text editor is easier because text editors don't try to "helpfully" restructure your input. It lets you type the words in your head onto the screen, no interference. Better still, text editors are often designed around a plugin architecture, such that the application itself is woefully basic (it edits text), but you can build an environment around it to meet your every need. +### Atom 编辑器 -A great example of this design philosophy is the [Atom][4] editor. It's a cross-platform text editor with built-in Git integration. If you're new to working in plaintext and new to Git, Atom is the easiest way to get started. +当你以纯文本形式书写时,文字处理程序会显得过于庞大。使用文本编辑器更容易,因为文本编辑器不会尝试“有效地”重组输入内容。它使你可以将脑海中的单词输入到屏幕中,而不会受到干扰。更好的是,文本编辑器通常是围绕插件体系结构设计的,这样应用程序本身就很基础(它用来编辑文本),但是你可以围绕它构建一个环境来满足你的各种需求。 -#### Install Git and Atom +[Atom][4] 编辑器就是这种设计理念的一个很好的例子。这是一个具有内置 Git 集成的跨平台文本编辑器。如果你不熟悉纯文本格式,也不熟悉 Git,那么 Atom 是最简单的入门方法。 -First, make sure you have Git installed on your system. If you run Linux or BSD, Git is available in your software repository or ports tree. The command you use will vary depending on your distribution; on Fedora, for instance: +#### 安装 Git 和 Atom +首先,请确保你的系统上已安装 Git。如果运行 Linux 或 BSD,则 Git 在软件存储库或 ports 树中可用。你使用的命令将根据你的发行版而有所不同。例如在 Fedora 上: ``` -`$ sudo dnf install git` +$ sudo dnf install git ``` -You can also download and install Git for [Mac][5] and [Windows][6]. +你也可以下载并安装适用于 [Mac][5] 和 [Windows][6] 的 Git。 -You won't need to use Git directly, because Atom serves as your Git interface. Installing Atom is the next step. - -If you're on Linux, install Atom from your software repository through your software installer or the appropriate command, such as: +你不需要直接使用 Git,因为 Atom 会充当你的 Git 界面。下一步是安装 Atom。 +如果你使用的是 Linux,请通过软件安装程序或适当的命令从软件存储库中安装 Atom,例如: ``` -`$ sudo dnf install atom` +$ sudo dnf install atom ``` -Atom does not currently build on BSD. However, there are very good alternatives available, such as [GNU Emacs][7]. For Mac and Windows users, you can find installers on the [Atom website][4]. +Atom 当前没有在 BSD 上构建。但是,有很好的替代方法,例如 [GNU Emacs][7]。对于 Mac 和 Windows 用户,可以在 [Atom 网站][4]上找到安装程序。 -Once your installs are done, launch the Atom editor. +安装完成后,启动 Atom 编辑器。 -#### A quick tour +#### 快速指导 -If you're going to live in plaintext and Git, you need to get comfortable with your editor. Atom's user interface may be more dynamic than what you are used to. You can think of it more like Firefox or Chrome than as a word processor, in fact, because it has tabs and panels that can be opened and closed as they are needed, and it even has add-ons that you can install and configure. It's not practical to try to cover all of Atom's many features, but you can at least get familiar with what's possible. +如果要使用纯文本和 Git,则需要适应你的编辑器。Atom 的用户界面可能比你习惯的更加动态。实际上,你可以将它视为 Firefox 或 Chrome,而不是文字处理程序,因为它具有可以根据需要打开和关闭的选项卡和面板,甚至还可以安装和配置附件。尝试全部掌握 Atom 如许之多的功能是不切实际的,但是你至少可以知道有什么功能。 -When Atom opens, it displays a welcome screen. If nothing else, this screen is a good introduction to Atom's tabbed interface. You can close the welcome screens by clicking the "close" icons on the tabs at the top of the Atom window and create a new file using **File > New File**. +当 Atom 打开时,它将显示一个欢迎屏幕。如果不出意外,此屏幕很好地介绍了 Atom 的选项卡式界面。你可以通过单击 Atom 窗口顶部选项卡上的“关闭”图标来关闭欢迎屏幕,并使用“文件 > 新建文件”创建一个新文件。 -Working in plaintext is a little different than working in a word processor, so here are some tips for writing content in a way that a human can connect with and that Git and computers can parse, track, and convert. +使用纯文本格式与使用文字处理程序有点不同,因此这里有一些技巧,以人可以连接的方式编写内容,并且 Git 和计算机可以解析,跟踪和转换。 -#### Write in Markdown - -These days, when people talk about plaintext, mostly they mean Markdown. Markdown is more of a style than a format, meaning that it intends to provide a predictable structure to your text so computers can detect natural patterns and convert the text intelligently. Markdown has many definitions, but the best technical definition and cheatsheet is on [CommonMark's website][8]. +#### 用 Markdown 书写 +如今,当人们谈论纯文本时,大多是指 Markdown。Markdown 与其说是格式,不如说是样式,这意味着它旨在为文本提供可预测的结构,以便计算机可以检测自然的模式并智能地转换文本。Markdown 有很多定义,但是最好的技术定义和备忘单在 [CommonMark 的网站][8]上。 ``` # Chapter 1 @@ -83,41 +83,41 @@ And it can even reference an image. ![An image will render here.](drawing.jpg) ``` -As you can tell from the example, Markdown isn't meant to read or feel like code, but it can be treated as code. If you follow the expectations of Markdown defined by CommonMark, then you can reliably convert, with just one click of a button, your writing from Markdown to .docx, .epub, .html, MediaWiki, .odt, .pdf, .rtf, and a dozen other formats _without_ loss of formatting. +从示例中可以看出,Markdown 读起来感觉不像代码,但可以将其视为代码。如果你遵循 CommonMark 定义的 Markdown 规范,那么一键就可以可靠地将 Markdown 的文字转换为 .docx、.epub、.html、MediaWiki、.odt、.pdf、.rtf 和各种其他的格式,而*不会*失去格式。 -You can think of Markdown a little like a word processor's styles. If you've ever written for a publisher with a set of styles that govern what chapter titles and section headings look like, this is basically the same thing, except that instead of selecting a style from a drop-down menu, you're adding little notations to your text. These notations look natural to any modern reader who's used to "txt speak," but are swapped out with fancy text stylings when the text is rendered. It is, in fact, what word processors secretly do behind the scenes. The word processor shows bold text, but if you could see the code generated to make your text bold, it would be a lot like Markdown (actually it's the far more complex XML). With Markdown, that barrier is removed, which looks scarier on the one hand, but on the other hand, you can write Markdown on literally anything that generates text without losing any formatting information. +你可以认为 Markdown 有点像文字处理程序的样式。如果你曾经为出版社撰写过一套样式来控制章节标题和章节标题的样式,那基本上就是一回事,除了不是从下拉菜单中选择样式以外,你要给你的文字添加一些小记号。对于任何习惯“以文字交谈”的现代阅读者来说,这些表示法都是很自然的,但是在呈现文本时,它们会被精美的文本样式替换掉。实际上,这是文字处理程序在后台秘密进行的操作。文字处理器显示粗体文本,但是如果你可以看到使文本变为粗体的生成代码,则它与 Markdown 很像(实际上,它是更复杂的 XML)。使用 Markdown 可以消除这种代码和样式之间的阻隔,一方面看起来更可怕,但另一方面,你可以在几乎所有可以生成文本的东西上书写 Markdown 而不会丢失任何格式信息。 -The popular file extension for Markdown files is .md. If you're on a platform that doesn't know what a .md file is, you can associate the extension to Atom manually or else just use the universal .txt extension. The file extension doesn't change the nature of the file; it just changes how your computer decides what to do with it. Atom and some platforms are smart enough to know that a file is plaintext no matter what extension you give it. +Markdown 文件流行d 文件扩展名是 .md。如果你使用的平台不知道 .md 文件是什么,则可以手动将扩展名与 Atom 关联,或者仅使用通用的 .txt 扩展名。文件扩展名不会更改文件的性质。它只会改变你的计算机决定如何处理它的方式。Atom 和某些平台足够聪明,可以知道该文件是纯文本格式,无论你给它以什么扩展名。 -#### Live preview +#### 实时预览 -Atom features the **Markdown Preview** plugin, which shows you both the plain Markdown you're writing and the way it will (commonly) render. +Atom 具有 “Markdown 预览” 插件,该插件可以向你显示正在编写的纯文本 Markdown 及其(通常)呈现的方式。 ![Atom's preview screen][9] -To activate this preview pane, select **Packages > Markdown Preview > Toggle Preview** or press **Ctrl+Shift+M**. +要激活此预览窗格,请选择“包 > Markdown 预览 > 切换预览” 或按 `Ctrl + Shift + M`。 -This view provides you with the best of both worlds. You get to write without the burden of styling your text, but you also get to see a common example of what your text will look like, at least in a typical digital format. Of course, the point is that you can't control how your text is ultimately rendered, so don't be tempted to adjust your Markdown to force your render preview to look a certain way. +此视图为你提供了两全其美的方法。无需承担为你的文本添加样式的负担,就可以写作,而你也可以看到一个通用的示例外观,至少是以典型的数字化格式显示了文本的外观。当然,关键是你无法控制文本的最终呈现方式,因此不要试图调整 Markdown 来强制以某种方式显示呈现的预览。 -#### One sentence per line +#### 每行一句话 -Your high school writing teacher doesn't ever have to see your Markdown. +你的高中写作老师不会看你的 Markdown。 -It won't come naturally at first, but maintaining one sentence per line makes more sense in the digital world. Markdown ignores single line breaks (when you've pressed the Return or Enter key) and only creates a new paragraph after a single blank line. +一开始它并那么自然,但是在数字世界中,保持每行一个句子更有意义。Markdown 忽略单个换行符(当你按下 Return 或 Enter 键时),并且只在单个空行之后才会创建一个新段落。 ![Writing in Atom][10] -The advantage of writing one sentence per line is that your work is easier to track. That is, if you've changed one word at the start of a paragraph, then it's easy for Atom, Git, or any application to highlight that change in a meaningful way if the change is limited to one line rather than one word in a long paragraph. In other words, a change to one sentence should only affect that sentence, not the whole paragraph. +每行写一个句子的好处是你的工作更容易跟踪。也就是说,如果你在段落的开头更改了一个单词,那么如果更改仅限于一行而不是一个长的段落中的一个单词,那么 Atom、Git 或任何应用程序很容易以有意义的方式突出显示该更改。换句话说,对一个句子的更改只会影响该句子,而不会影响整个段落。 -You might be thinking, "many word processors track changes, too, and they can highlight a single word that's changed." But those revision trackers are bound to the interface of that word processor, which means you can't look through revisions without being in front of that word processor. In a plaintext workflow, you can review revisions in plaintext, which means you can make or approve edits no matter what you have on hand, as long as that device can deal with plaintext (and most of them can). +你可能会想:“许多文字处理器也可以跟踪更改,它们可以突出显示已更改的单个单词。”但是这些修订跟踪器绑定到该字处理器的界面上,这意味着你必须先打开该字处理器才能浏览修订。在纯文本工作流程中,你可以以纯文本形式查看修订,这意味着无论手头有什么,只要该设备可以处理纯文本(大多数都可以),就可以进行编辑或批准编辑。 -Writers admittedly don't usually think in terms of line numbers, but it's a useful tool for computers, and ultimately a great reference point in general. Atom numbers the lines of your text document by default. A _line_ is only a line once you have pressed the Enter or Return key. +诚然,写作者通常不会考虑行号,但它对于计算机有用,并且通常是一个很好的参考点。默认情况下,Atom 为文本文档的行进行编号。按下 Enter 键或 Return 键后,一*行*就是一行。 ![Writing in Atom][11] -If a line has a dot instead of a number, that means it's part of the previous line wrapped for you because it couldn't fit on your screen. +如果一行中有一个点而不是一个数字,则表示它是上一行折叠的一部分,因为它不超出了你的屏幕。 -#### Theme it +#### 主题 If you're a visual person, you might be very particular about the way your writing environment looks. Even if you are writing in plain Markdown, it doesn't mean you have to write in a programmer's font or in a dark window that makes you look like a coder. The simplest way to modify what Atom looks like is to use [theme packages][12]. It's conventional for theme designers to differentiate dark themes from light themes, so you can search with the keyword Dark or Light, depending on what you want. From 46620f781e30eb81e7ea89e395b9636613b32668 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 16 Oct 2019 09:49:50 +0800 Subject: [PATCH 003/800] PART 2 --- ...iters can get work done better with Git.md | 40 ++++++++++--------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/sources/tech/20190404 How writers can get work done better with Git.md b/sources/tech/20190404 How writers can get work done better with Git.md index 1d77a87842..7274389eaf 100644 --- a/sources/tech/20190404 How writers can get work done better with Git.md +++ b/sources/tech/20190404 How writers can get work done better with Git.md @@ -119,43 +119,47 @@ Atom 具有 “Markdown 预览” 插件,该插件可以向你显示正在编 #### 主题 -If you're a visual person, you might be very particular about the way your writing environment looks. Even if you are writing in plain Markdown, it doesn't mean you have to write in a programmer's font or in a dark window that makes you look like a coder. The simplest way to modify what Atom looks like is to use [theme packages][12]. It's conventional for theme designers to differentiate dark themes from light themes, so you can search with the keyword Dark or Light, depending on what you want. +如果你是一个在意视觉形象的人,那么你可能会非常注重自己的写作环境。即使你使用普通的 Markdown 进行编写,也并不意味着你必须使用程序员的字体或在使你看起来像码农的黑窗口中进行书写。修改 Atom 外观的最简单方法是使用[主题包][12]。主题设计人员通常将深色主题与浅色主题区分开,因此你可以根据需要使用关键字“Dark”或“Light”进行搜索。 -To install a theme, select **Edit > Preferences**. This opens a new tab in the Atom interface. Yes, tabs are used for your working documents _and_ for configuration and control panels. In the **Settings** tab, click on the **Install** category. +要安装主题,请选择“编辑 > 首选项”。这将在 Atom 界面中打开一个新标签页。是的,标签页可以用于处理文档*和*用于配置及控制面板。在“设置”标签页中,单击“安装”类别。 -In the **Install** panel, search for the name of the theme you want to install. Click the **Themes** button on the right of the search field to search only for themes. Once you've found your theme, click its **Install** button. +在“安装”面板中,搜索要安装的主题的名称。单击搜索字段右侧的“主题”按钮,以仅搜索主题。找到主题后,单击其“安装”按钮。 ![Atom's themes][13] -To use a theme you've installed or to customize a theme to your preference, navigate to the **Themes** category in your **Settings** tab. Pick the theme you want to use from the drop-down menu. The changes take place immediately, so you can see exactly how the theme affects your environment. +要使用已安装的主题或根据喜好自定义主题,请导航至“设置”标签页中的“主题”类别中。从下拉菜单中选择要使用的主题。更改会立即进行,因此你可以准确了解主题如何影响您的环境。 -You can also change your working font in the **Editor** category of the **Settings** tab. Atom defaults to monospace fonts, which are generally preferred by programmers. But you can use any font on your system, whether it's serif or sans or gothic or cursive. Whatever you want to spend your day staring at, it's entirely up to you. +你也可以在“设置”标签的“编辑器”类别中更改工作字体。Atom 默认采用等宽字体,程序员通常首选这种字体。但是你可以使用系统上的任何字体,无论是衬线字体、无衬线字体、哥特式字体还是草书字体。无论你想整天盯着什么字体都行。 -On a related note, by default Atom draws a vertical marker down its screen as a guide for people writing code. Programmers often don't want to write long lines of code, so this vertical line is a reminder to them to simplify things. The vertical line is meaningless to writers, though, and you can remove it by disabling the **wrap-guide** package. +作为相关说明,默认情况下,Atom 会在其屏幕上绘制一条垂直线,以提示编写代码的人员。程序员通常不想编写太长的代码行,因此这条垂直线会提醒他们不要写太长的代码行。不过,这条竖线对写作者而言毫无意义,你可以通过禁用 “wrap-guide” 包将其删除。 -To disable the **wrap-guide** package, select the **Packages** category in the **Settings** tab and search for **wrap-guide**. When you've found the package, click its **Disable** button. +要禁用 “wrap-guide” 软件包,请在“设置”标签中选择“折行”类别,然后搜索 “wrap-guide”。找到该程序包后,单击其“禁用”按钮。 -#### Dynamic structure +#### 动态结构 -When creating a long document, I find that writing one chapter per file makes more sense than writing an entire book in a single file. Furthermore, I don't name my chapters in the obvious syntax **chapter-1.md** or **1.example.md** , but by chapter titles or keywords, such as **example.md**. To provide myself guidance in the future about how the book is meant to be assembled, I maintain a file called **toc.md** (for "Table of Contents") where I list the (current) order of my chapters. +创建长文档时,我发现每个文件写一个章节比在一个文件中写整本书更有意义。此外,我不会以明显的语法 ` chapter-1.md` 或 `1.example.md` 来命名我的章节,而是以章节标题或关键词(例如 `example.md`)命名。为了将来为自己提供有关如何编写本书的指导,我维护了一个名为 `toc.md` (用于“目录”)的文件,其中列出了各章的(当前)顺序。 -I do this because, no matter how convinced I am that chapter 6 just couldn't possibly happen before chapter 1, there's rarely a time that I don't swap the order of one or two chapters or sections before I'm finished with a book. I find that keeping it dynamic from the start helps me avoid renaming confusion, and it also helps me treat the material less rigidly. +我这样做是因为,无论我多么相信第 6 章都不可能出现在第 1 章之前,但在我完成整本书之前,几乎不大可能出现我不会交换一两个章节的顺序。我发现从一开始就保持动态变化可以帮助我避免重命名混乱,也可以帮助我避免僵化的结构。 -### Git in Atom +### 在 Atom 中使用 Git -Two things every writer has in common is that they're writing for keeps and their writing is a journey. You don't sit down to write and finish with a final draft; by definition, you have a first draft. And that draft goes through revisions, each of which you carefully save in duplicate and triplicate just in case one of your files turns up corrupted. Eventually, you get to what you call a final draft, but more than likely you'll be going back to it one day, either to resurrect the good parts or to fix the bad. +每位写作者的共同点是两件事:他们为流传而写作,而他们的写作是一段旅程。你无需坐下来写作就完成最终稿件。顾名思义,你有一个初稿。该草稿会经过修订,你会仔细地将每个修订保存一式两份或三份,以防万一你的文件损坏了。最终,你得到了所谓的最终草案,但很有可能你有一天还会回到这份最终草案,要么恢复好的部分要么修改坏的部分。 -The most exciting feature in Atom is its strong Git integration. Without ever leaving Atom, you can interact with all of the major features of Git, tracking and updating your project, rolling back changes you don't like, integrating changes from a collaborator, and more. The best way to learn it is to step through it, so here's how to use Git within the Atom interface from the beginning to the end of a writing project. +Atom 最令人兴奋的功能是其强大的 Git 集成。无需离开 Atom,你就可以与 Git 的所有主要功能进行交互,跟踪和更新项目、回滚你不喜欢的更改、集成来自协作者的更改等等。最好的学习方法就是逐步学习,因此这是从写作项目开始到结束在 Atom 界面中使用 Git 的方法。 -First thing first: Reveal the Git panel by selecting **View > Toggle Git Tab**. This causes a new tab to open on the right side of Atom's interface. There's not much to see yet, so just keep it open for now. +第一件事:通过选择 “视图 > 切换 Git 标签页” 来显示 Git 面板。这将在 Atom 界面的右侧打开一个新标签页。现在没什么可看的,所以暂时保持打开状态就行。 -#### Starting a Git project +#### 建立一个 Git 项目 -You can think of Git as being bound to a folder. Any folder outside a Git directory doesn't know about Git, and Git doesn't know about it. Folders and files within a Git directory are ignored until you grant Git permission to keep track of them. +你可以将 Git 视为它被绑定到文件夹。Git 目录之外的任何文件夹都不知道 Git,而 Git 也不知道外面。Git 目录中的文件夹和文件将被忽略,直到你授予 Git 权限来跟踪它们为止。 -You can create a Git project by creating a new project folder in Atom. Select **File > Add Project Folder** and create a new folder on your system. The folder you create appears in the left **Project Panel** of your Atom window. +你可以通过在 Atom 中创建新的项目文件夹来创建 Git 项目。选择 “文件 > 添加项目文件夹”,然后在系统上创建一个新文件夹。你创建的文件夹将出现在 Atom 窗口的左侧“项目面板”中。 -#### Git add +#### Git 添加文件 + +右键单击你的新项目文件夹,然后选择“新建文件”以在项目文件夹中创建一个新文件。如果你要导入文件到新项目中,请右键单击该文件夹,然后选择“在文件管理器中显示”,以在系统的文件查看器中打开该文件夹(Linux 上为 Dolphin 或 Nautilus,Mac 上为 Finder,在 Windows 上是 Explorer),然后拖放文件到你的项目文件夹。 + +在Atom中打开一个项目文件(您创建的空文件或导入的文件)后,单击** Git **标签中的** Create Repository **按钮。在弹出的对话框中,单击** Init **以将您的项目目录初始化为本地Git存储库。 Git将**。git **目录(在系统的文件管理器中不可见,但在Atom中对您可见)添加到项目文件夹中。不要被这个愚弄了:**。git **目录是Git管理的,而不是您管理的,因此您通常会远离它。但是在Atom中看到它可以很好地提醒您您正在Git积极管理的项目中工作。换句话说,当您看到**。git **目录时,修订历史记录可用。 Right-click on your new project folder and select **New File** to create a new file in your project folder. If you have files you want to import into your new project, right-click on the folder and select **Show in File Manager** to open the folder in your system's file viewer (Dolphin or Nautilus on Linux, Finder on Mac, Explorer on Windows), and then drag-and-drop your files. From 74b275a97615259cc790b994a42530f55d4dec4c Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Oct 2019 08:53:27 +0800 Subject: [PATCH 004/800] translatng --- ...ntial Accessories for Intel NUC Mini PC.md | 118 ------------------ ...ntial Accessories for Intel NUC Mini PC.md | 118 ++++++++++++++++++ 2 files changed, 118 insertions(+), 118 deletions(-) delete mode 100644 sources/tech/20190925 Essential Accessories for Intel NUC Mini PC.md create mode 100644 translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md diff --git a/sources/tech/20190925 Essential Accessories for Intel NUC Mini PC.md b/sources/tech/20190925 Essential Accessories for Intel NUC Mini PC.md deleted file mode 100644 index c9bae586e4..0000000000 --- a/sources/tech/20190925 Essential Accessories for Intel NUC Mini PC.md +++ /dev/null @@ -1,118 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Essential Accessories for Intel NUC Mini PC) -[#]: via: (https://itsfoss.com/intel-nuc-essential-accessories/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Essential Accessories for Intel NUC Mini PC -====== - -I bought a [barebone Intel NUC mini PC][1] a few weeks back. I [installed Linux on it][2] and I am totally enjoying it. This tiny fanless gadget replaces that bulky CPU of the desktop computer. - -Intel NUC mostly comes in barebone format which means it doesn’t have any RAM, hard disk and obviously no operating system. Many [Linux-based mini PCs][3] customize the Intel NUC and sell them to end users by adding disk, RAM and operating systems. - -Needless to say that it doesn’t come with keyboard, mouse or screen just like most other desktop computers out there. - -[Intel NUC][4] is an excellent device and if you are looking to buy a desktop computer, I highly recommend it. And if you are considering to get Intel NUC, here are a few accessories you should have in order to start using the NUC as your computer. - -### Essential Intel NUC accessories - -![][5] - -_The Amazon links in the article are affiliate links. Please read our [affiliate policy][6]._ - -#### The peripheral devices: monitor, keyboard and mouse - -This is a no-brainer. You need to have a screen, keyboard and mouse to use a computer. You’ll need a monitor with HDMI connection and USB or wireless keyboard-mouse. If you have these things already, you are good to go. - -If you are looking for recommendations, I suggest LG IPS LED monitor. I have two of them in 22 inch model and I am happy with the sharp visuals it provides. - -These monitors have a simple stand that doesn’t move. If you want a monitor that can move up and down and rotate in portrait mode, try [HP EliteDisplay monitors][7]. - -![HP EliteDisplay Monitor][8] - -I connect all three monitors at the same time in a multi-monitor setup. One monitor connects to the given HDMI port. Two monitors connect to thunderbolt port via a [thunderbolt to HDMI splitter from Club 3D][9]. - -You may also opt for the ultrawide monitors. I don’t have a personal experience with them. - -#### A/C power cord - -This will be a surprise for you When you get your NUC, you’ll notice that though it has power adapter, it’s not complete with the plug. - -![][10] - -Since different countries have different plug points, Intel decided to simply drop it from the NUC kit. I am using the power cord of an old dead laptop but if you don’t have one, chances are that you may have to get one for yourself. - -#### RAM - -Intel NUC has two RAM slots and it can support up to 32 GB of RAM. Since I have the core i3 processor, I opted from [8GB DDR4 RAM from Crucial][11] that costs around $33. - -![][12] - -8 GB RAM is fine for most cases but if you have core i7 processor, you may opt for a [16 GB RAM][13] one that costs almost $67. You can double it up and get the maximum 32 GB. The choice is all yours. - -#### Hard disk [Important] - -Intel NUC supports both 2.5 drive and M.2 SSD and you can use both at the same time to get more storage. - -The 2.5 inches slot can hold both SSD and HDD. I strongly recommend to opt for SSD because it’s way faster than HDD. A [480 GB 2.5][14] costs $60. Which is a fair price in my opinion. - -![][15] - -The 2.5″ drive is limited with the standard SATA interface speed of 6Gb/sec. The M.2 slot could be faster depending upon whether you are choosing a NVMe SSD or not. The NVMe (non volatile memory express) SSDs are up to 4 times faster than the normal SSDs (also called SATA SSD). But they may also be slightly more expensive than SATA M2 SSD. - -While buying the M.2 SSD, check the product image. It should be mentioned on the image of the disk itself whether it’s a NVMe or SATA SSD. [Samsung EVO is a cost effective NVMe M.2 SSD][16] that you may consider. - -![Make sure that your are buying the faster NVMe M2 SSD][17] - -A SATA SSD in both M.2 slot and 2.5″ slot has the same speed. This is why if you don’t want to opt for the expensive NVMe SSD, I suggest you go for the 2.5″ SATA SSD and keep the M.2 slot free for future upgrades. - -#### Other supporting accessories - -You’ll need HDMI cable to connect your monitor. If you are buying a new monitor, you should usually get a cable with it. - -You may need a screw driver if you are going to use the M.2 slot. Intel NUC is an excellent device and you can unscrew the bottom panel just by rotating the four pods simply by your hands. You’ll have to open the device in order to place the RAM and disk. - -![Intel NUC with Security Cable | Image Credit Intel][18] - -NUC also has the antitheft key lock hole that you can use with security cables. Keeping computers secure with cables is a recommended security practices in a business environment. Investing a [few dollars in the security cable][19] could save you hundreds of dollars. - -**What accessories do you use?** - -That’s the Intel NUC accessories I use and I suggest. How about you? If you own a NUC, what accessories you use and recommend to other NUC users? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/intel-nuc-essential-accessories/ - -作者:[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.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW (barebone Intel NUC mini PC) -[2]: https://itsfoss.com/install-linux-on-intel-nuc/ -[3]: https://itsfoss.com/linux-based-mini-pc/ -[4]: https://www.intel.in/content/www/in/en/products/boards-kits/nuc.html -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/intel-nuc-accessories.png?ssl=1 -[6]: https://itsfoss.com/affiliate-policy/ -[7]: https://www.amazon.com/HP-EliteDisplay-21-5-Inch-1FH45AA-ABA/dp/B075L4VKQF?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B075L4VKQF (HP EliteDisplay monitors) -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/hp-elitedisplay-monitor.png?ssl=1 -[9]: https://www.amazon.com/Club3D-CSV-1546-USB-C-Multi-Monitor-Splitter/dp/B06Y2FX13G?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B06Y2FX13G (thunderbolt to HDMI splitter from Club 3D) -[10]: https://itsfoss.com/wp-content/uploads/2019/09/ac-power-cord-3-pongs.webp -[11]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 (8GB DDR4 RAM from Crucial) -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/crucial-ram.jpg?ssl=1 -[13]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B019FRBHZ0?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B019FRBHZ0 (16 GB RAM) -[14]: https://www.amazon.com/Green-480GB-Internal-SSD-WDS480G2G0A/dp/B01M3POPK3?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M3POPK3 (480 GB 2.5) -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/wd-green-ssd.png?ssl=1 -[16]: https://www.amazon.com/Samsung-970-EVO-500GB-MZ-V7E500BW/dp/B07BN4NJ2J?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07BN4NJ2J (Samsung EVO is a cost effective NVMe M.2 SSD) -[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/samsung-evo-nvme.jpg?ssl=1 -[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/intel-nuc-security-cable.jpg?ssl=1 -[19]: https://www.amazon.com/Kensington-Combination-Laptops-Devices-K64673AM/dp/B005J7Y99W?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B005J7Y99W (few dollars in the security cable) diff --git a/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md b/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md new file mode 100644 index 0000000000..56655d2ee3 --- /dev/null +++ b/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Essential Accessories for Intel NUC Mini PC) +[#]: via: (https://itsfoss.com/intel-nuc-essential-accessories/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Intel NUC 迷你 PC 的基本配件 +====== + +几周前,我买了一台 [Intel NUC 迷你 PC][1]。我[在上面安装了 Linux][2],我非常享受。这个小巧的无风扇机器取代了台式机那庞大的 CPU。 + +Intel NUC 通常采用准系统形式,这意味着它没有任何内存、硬盘,也显然没有操作系统。许多[基于 Linux 的微型 PC][3] 定制化 Intel NUC 并添加磁盘、RAM 和操作系统将它出售给终端用户。 + +不用说,它不像大多数其他台式机那样带有键盘,鼠标或屏幕。 + +[Intel NUC][4] 是一款出色的设备,如果你要购买台式机,我强烈建议你购买它。如果你正在考虑购买 Intel NUC,你需要买一些配件,以便开始使用它。 + +### 基本的 Intel NUC 配件 + +![][5] + +_文章中的 Amazon 链接是联盟链接。请阅读我们的[联盟政策][6]。_ + +#### 外围设备:显示器、键盘和鼠标 + +这很容易想到。你需要具有屏幕、键盘和鼠标才能使用计算机。你需要一台有 HDMI 连接的显示器和一个 USB 或无线键盘鼠标。如果你已经有了这些东西,那你可以继续。 + +如果你正在寻求建议,我建议购买 LG IPS LED 显示器。我有两台 22 英寸的型号,我对它提供的清晰视觉效果感到满意。 + +这些显示器有一个简单的固定支架。如果要使显示器可以上下移动并纵向旋转,请尝试使用 [HP EliteDisplay 显示器][7]。 + +![HP EliteDisplay Monitor][8] + +我在多屏设置中同时连接了三台显示器。一台显示器连接到指定的 HDMI 端口。两台显示器通过[Club 3D 的 Thunderbolt 转 HDMI 分配器][9]连接到 Thunderbolt 端口。 + +你也可以选择超宽显示器。我对此没有亲身经历。 + +#### 交流电源线 + +当你拿到 NUC 时,你会惊讶地发现,尽管它有电源适配器,但它并没有插头。 + +![][10] + +由于不同国家/地区的插头不同,因此英特尔决定将其从 NUC 套件中删除。我使用的是旧笔记本的电源线,但是如果你没有笔记本的电源线,那么很可能你需要自己准备一个。 + +#### 内存 + +Intel NUC 有两个内存插槽,最多可支持 32GB 内存。由于我的是 i3 核心处理器,因此我选择了 [Crucial 的 8GB DDR4 内存][11],价格约为 $33。 + +![][12] + +8 GB 内存在大多数情况下都没问题,但是如果你的是 i7 核心处理器,那么可以选择 [16GB 内存][13],价格约为 $67。你可以加倍,以获得最大 32GB。选择全在于你。 + +#### 硬盘(重要) + +Intel NUC 同时支持 2.5 英寸驱动器和 M.2 SSD,因此你可以同时使用两者以获得更多存储空间。 + +2.5 英寸插槽可同时容纳 SSD 和 HDD。我强烈建议选择 SSD,因为它比 HDD 快得多。[480GB 2.5寸][14]的价格是 $60。我认为这是一个合理的价格。 + +![][15] + +2.5 英寸驱动器的标准 SATA 口速度为 6Gb/秒。根据你是否选择 NVMe SSD,M.2 插槽可能会更快。 NVMe(非易失性内存主机控制器接口规范)SSD 的速度比普通 SSD(也称为 SATA SSD)快 4 倍。但是它们可能也比 SATA M2 SSD 贵一些。 + +当购买 M.2 SSD 时,请检查产品图片。无论是 NVMe 还是 SATA SSD,都应在磁盘本身的图片中提到。你可以考虑使用[经济的三星 EVO NVMe M.2 SSD][16]。 + +![Make sure that your are buying the faster NVMe M2 SSD][17] + +M.2 插槽和 2.5 英寸插槽中的 SATA SSD 具有相同的速度。这就是为什么如果你不想选择昂贵的 NVMe SSD,建议你选择 2.5 英寸 SATA SSD,并保留 M.2 插​​槽供以后升级。 + +#### 其他配套配件 + +你需要使用 HDMI 线缆连接显示器。如果你要购买新显示器,通常应会有一根线缆。 + +如果要使用 M.2 插槽,那么可能需要螺丝刀。Intel NUC 是一款出色的设备,你只需用手旋转四个脚即可拧开底部面板。你必须打开设备才能放置内存和磁盘。 + +![Intel NUC with Security Cable | Image Credit Intel][18] + +NUC 还有防盗孔,可与防盗绳一起使用。在业务环境中,建议使用防盗绳保护计算机安全。购买[防盗绳几美元][19]便可节省数百美元。 + +**你使用什么配件?** + +这些即使我在使用和建议使用的 Intel NUC 配件。你呢?如果你有一台 NUC,你会使用哪些配件并推荐给其他 NUC 用户? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/intel-nuc-essential-accessories/ + +作者:[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://www.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW (barebone Intel NUC mini PC) +[2]: https://itsfoss.com/install-linux-on-intel-nuc/ +[3]: https://itsfoss.com/linux-based-mini-pc/ +[4]: https://www.intel.in/content/www/in/en/products/boards-kits/nuc.html +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/intel-nuc-accessories.png?ssl=1 +[6]: https://itsfoss.com/affiliate-policy/ +[7]: https://www.amazon.com/HP-EliteDisplay-21-5-Inch-1FH45AA-ABA/dp/B075L4VKQF?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B075L4VKQF (HP EliteDisplay monitors) +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/hp-elitedisplay-monitor.png?ssl=1 +[9]: https://www.amazon.com/Club3D-CSV-1546-USB-C-Multi-Monitor-Splitter/dp/B06Y2FX13G?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B06Y2FX13G (thunderbolt to HDMI splitter from Club 3D) +[10]: https://itsfoss.com/wp-content/uploads/2019/09/ac-power-cord-3-pongs.webp +[11]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 (8GB DDR4 RAM from Crucial) +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/crucial-ram.jpg?ssl=1 +[13]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B019FRBHZ0?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B019FRBHZ0 (16 GB RAM) +[14]: https://www.amazon.com/Green-480GB-Internal-SSD-WDS480G2G0A/dp/B01M3POPK3?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M3POPK3 (480 GB 2.5) +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/wd-green-ssd.png?ssl=1 +[16]: https://www.amazon.com/Samsung-970-EVO-500GB-MZ-V7E500BW/dp/B07BN4NJ2J?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07BN4NJ2J (Samsung EVO is a cost effective NVMe M.2 SSD) +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/samsung-evo-nvme.jpg?ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/intel-nuc-security-cable.jpg?ssl=1 +[19]: https://www.amazon.com/Kensington-Combination-Laptops-Devices-K64673AM/dp/B005J7Y99W?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B005J7Y99W (few dollars in the security cable) From edcd4a8fa05f4fe14237c1651435a00a7a539080 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Oct 2019 08:56:15 +0800 Subject: [PATCH 005/800] translating --- .../talk/20191012 How the oil and gas industry exploits IoT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191012 How the oil and gas industry exploits IoT.md b/sources/talk/20191012 How the oil and gas industry exploits IoT.md index d78a6ad967..a912e5355b 100644 --- a/sources/talk/20191012 How the oil and gas industry exploits IoT.md +++ b/sources/talk/20191012 How the oil and gas industry exploits IoT.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 80309286dccfb2bcac6ac93962ff32ed3402eebf Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Oct 2019 08:59:49 +0800 Subject: [PATCH 006/800] Revert "translating" This reverts commit edcd4a8fa05f4fe14237c1651435a00a7a539080. --- .../talk/20191012 How the oil and gas industry exploits IoT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191012 How the oil and gas industry exploits IoT.md b/sources/talk/20191012 How the oil and gas industry exploits IoT.md index a912e5355b..d78a6ad967 100644 --- a/sources/talk/20191012 How the oil and gas industry exploits IoT.md +++ b/sources/talk/20191012 How the oil and gas industry exploits IoT.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (geekpi) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b40646a9d9c9c900056c388f8c28943ab2eef61b Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 17 Oct 2019 09:01:55 +0800 Subject: [PATCH 007/800] translating --- ...ript to Delete Files-Folders Older Than -X- Days in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md b/sources/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md index e434842803..cb606aa1c7 100644 --- a/sources/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md +++ b/sources/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f4ca93e97d7306992f1025285041e263357b8f3b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 09:44:30 +0800 Subject: [PATCH 008/800] PRF @Morisun029 --- ...utation testing is the evolution of TDD.md | 154 +++++++----------- 1 file changed, 61 insertions(+), 93 deletions(-) diff --git a/translated/tech/20190809 Mutation testing is the evolution of TDD.md b/translated/tech/20190809 Mutation testing is the evolution of TDD.md index 0e9d514746..d37b588e90 100644 --- a/translated/tech/20190809 Mutation testing is the evolution of TDD.md +++ b/translated/tech/20190809 Mutation testing is the evolution of TDD.md @@ -1,97 +1,87 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Mutation testing is the evolution of TDD) [#]: via: (https://opensource.com/article/19/8/mutation-testing-evolution-tdd) [#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) -变异测试是 TDD 的演变 +变异测试是测试驱动开发(TDD)的演变 ====== -测试驱动开发技术是根据大自然的运作规律创建的,变异测试自然成为 DevOps 发展的下一步。 + +> 测试驱动开发技术是根据大自然的运作规律创建的,变异测试自然成为 DevOps 演变的下一步。 + ![Ants and a leaf making the word "open"][1] -在 "[故障是无懈可击的开发运维中的一个特点][2]," 我讨论了故障以征求反馈的机制在交付优质产品过程中所起到的重要作用。 敏捷DevOps团队就是用故障来指导他们并推动开发进程的。 [测试驱动开发(TDD)][3] 是任何敏捷 DevOps 团队评估产品交付的[必要条件][4]。 以故障为中心的 TDD 方法仅在与可量化的测试配合使用时才有效。 +在 “[故障是无懈可击的开发运维中的一个特点][2]”,我讨论了故障在通过征求反馈来交付优质产品的过程中所起到的重要作用。敏捷 DevOps 团队就是用故障来指导他们并推动开发进程的。[测试驱动开发][3]Test-driven development(TDD)是任何敏捷 DevOps 团队评估产品交付的[必要条件][4]。以故障为中心的 TDD 方法仅在与可量化的测试配合使用时才有效。 TDD 方法仿照大自然是如何运作的以及自然界在进化博弈中是如何产生赢家和输家为模型而建立的。 - ### 自然选择 ![查尔斯·达尔文][5] -1859年, [查尔斯·达尔文][6] 在他的[物种起源][7]_一书中提出了进化论学说。 达尔文的论点是,自然变异是由生物个体的自发突变和环境压力共同造成的。 环境压力淘汰了适应性较差的生物体,而有利于其他适应性强的生物的发展。 每个生物体的染色体都会发生变异,而这些自发的变异会携带给下一代(后代)。 然后在自然选择下测试新出现的变异性-当下存在的环境压力是由变异性的环境条件所导致的。 +1859 年,[查尔斯·达尔文][6]Charles Darwin在他的《[物种起源][7]On the Origin of Species》一书中提出了进化论学说。达尔文的论点是,自然变异是由生物个体的自发突变和环境压力共同造成的。环境压力淘汰了适应性较差的生物体,而有利于其他适应性强的生物的发展。每个生物体的染色体都会发生变异,而这些自发的变异会携带给下一代(后代)。然后在自然选择下测试新出现的变异性 —— 当下存在的环境压力是由变异性的环境条件所导致的。 这张简图说明了调整适应环境条件的过程。 ![环境压力对鱼类的影响][8] -图1. 不同的环境压力导致自然选择下的不同结果。图片截图来源于[理查德•道金斯的一个视频][9]。 +*图1. 不同的环境压力导致自然选择下的不同结果。图片截图来源于[理查德·道金斯的一个视频][9]。* -该图显示了一群生活在自己栖息地的鱼。 栖息地各不相同(海底或河床底部的砾石颜色有深有浅),每条鱼长的也各不相同(鱼身图案和颜色也有深有浅)。 +该图显示了一群生活在自己栖息地的鱼。栖息地各不相同(海底或河床底部的砾石颜色有深有浅),每条鱼长的也各不相同(鱼身图案和颜色也有深有浅)。 -这张图还显示了两种情况(即环境压力的两种变化):: +这张图还显示了两种情况(即环境压力的两种变化): 1. 捕食者在场 - - 2. 捕食者不在场 +在第一种情况下,在砾石颜色衬托下容易凸显出来的鱼被捕食者捕获的风险更高。当砾石颜色较深时,浅色鱼的数量会更少一些。反之亦然,当砾石颜色较浅时,深色鱼的数量会更少。 -在第一种情况下,在砾石颜色衬托下容易凸显出来的鱼被捕食者捕获的风险更高。 当砾石颜色较深时,浅色鱼的数量会更少一些。 反之亦然-当砾石颜色较浅时,深色鱼的数量会更少。 - -在第二种情况下,鱼完全放松下来进行交配。 在没有捕食者和没有交配仪式的情况下,可以预料到相反的结果:在砾石背景下显眼的鱼会有更大的机会被选来交配并将其特性传递给后代。 - +在第二种情况下,鱼完全放松下来进行交配。在没有捕食者和没有交配仪式的情况下,可以预料到相反的结果:在砾石背景下显眼的鱼会有更大的机会被选来交配并将其特性传递给后代。 ### 选择标准 +变异性在进行选择时,绝不是任意的、反复无常的、异想天开的或随机的。选择过程中的决定性因素通常是可以度量的。该决定性因素通常称为测试或目标。 -变异性在进行选择时,绝不是任意的,反复无常的,异想天开的或随机的。选择过程中的决定性因素通常是可以度量的。 该决定性因素通常称为测试或目标。 +一个简单的数学例子可以说明这一决策过程。(在该示例中,这种选择不是由自然选择决定的,而是由人为选择决定。)假设有人要求你构建一个小函数,该函数将接受一个正数,然后计算该数的平方根。你将怎么做? -一个简单的数学例子可以说明这一决策过程。 (在该示例中,这种选择不是由自然选择决定的,而是由人为选择决定。)假设有人要求您构建一个小函数,该函数将选用一个正数,然后计算该数的平方根。你将怎么做? +敏捷 DevOps 团队的方法是快速验证失败。谦虚一点,先承认自己并不真的知道如何开发该函数。这时,你所知道的就是如何描述你想做的事情。从技术上讲,你已准备好进行单元测试。 -敏捷 DevOps 团队的方法是快速验证失败。 谦虚一点,承认自己真的不知道如何开发该功能。 这时,你所知道的就是如何描述你想做的事情。 从技术上讲,你已准备好进行单元测试。 - -“单元测试”描述了你的具体期望结果是什么。 它可以简单地表述为“给定数字16,我希望平方根函数返回数字4”。 您可能知道16的平方根是4。但是,你不知道一些较大数字(例如533)的平方根。 +“单元测试unit test”描述了你的具体期望结果是什么。它可以简单地表述为“给定数字 16,我希望平方根函数返回数字 4”。你可能知道 16 的平方根是 4。但是,你不知道一些较大数字(例如 533)的平方根。 但至少,你已经制定了选择标准,即你的测试或你的期望值。 - - ### 进行故障测试 -[.NET Core][10] 平台可以实现该测试。.NET 通常使用 xUnit.net 作为单元测试框架。(要遵循编码示例,请安装 .NET Core 和 xUnit.net。) +[.NET Core][10] 平台可以演示该测试。.NET 通常使用 xUnit.net 作为单元测试框架。(要跟随进行这个代码示例,请安装 .NET Core 和 xUnit.net。) -打开命令行并创建一个文件夹,在该文件夹实现平方根解决方案。 例如,输入: +打开命令行并创建一个文件夹,在该文件夹实现平方根解决方案。例如,输入: ``` -`mkdir square_root` +mkdir square_root ``` -再输入: - +再输入: ``` -`cd square_root` +cd square_root ``` -为单元测试创建一个单独的文件夹: - +为单元测试创建一个单独的文件夹: ``` -`mkdir unit_tests` +mkdir unit_tests ``` -进入 **unit_tests** 文件夹下(**cd unit_tests**) ,初始化xUnit 框架: - +进入 `unit_tests` 文件夹下(`cd unit_tests`),初始化 xUnit 框架: ``` -`dotnet new xunit` +dotnet new xunit ``` -现在,将文件夹移动到 **square_root** 下, 创建 **app** 文件夹: - +现在,转到 `square_root` 下, 创建 `app` 文件夹: ``` mkdir app @@ -100,18 +90,15 @@ cd app 如果有必要的话,为你的代码创建一个脚手架: - ``` -`dotnet new classlib` +dotnet new classlib ``` 现在打开你最喜欢的编辑器开始编码! -在你的代码编辑器中,导航到 **unit_tests** 文件夹,打开 **UnitTest1.cs**。 -将 **UnitTest1.cs** 中自动生成的代码替换为: - - +在你的代码编辑器中,导航到 `unit_tests` 文件夹,打开 `UnitTest1.cs`。 +将 `UnitTest1.cs` 中自动生成的代码替换为: ``` using System; @@ -133,14 +120,11 @@ namespace unit_tests{ } ``` +该单元测试描述了变量的**期望值**应该为 4。下一行描述了**实际值**。建议通过将输入值发送到称为`calculator` 的组件来计算**实际值**。对该组件的描述是通过接收数值来处理`CalculateSquareRoot` 信息。该组件尚未开发。但这并不重要,我们在此只是描述期望值。 -该单元测试描述了变量的**期望值**应该为4。下一行描述了**实际值**。 建议通过将输入值发送到称为**calculator** 的组件来计算**实际值**。对该组件的描述是通过接收数值来处理**CalculateSquareRoot**信息。 该组件尚未开发。 但这并不重要,我们在此只是描述期望值。 - -最后,描述了触发消息发送时发生的情况。 此时,判断**期望值** 是否等于**实际值**。 如果是,则测试通过,目标达成。 如果**期望值** 不等于**实际值**,则测试失败。 - -接下来,要实现称为**calculator**的组件,在 **app** 文件夹中创建一个新文件,并将其命名为**Calculator.cs**。 要实现计算平方根的功能,请在此新文件中添加以下代码: - +最后,描述了触发消息发送时发生的情况。此时,判断**期望值**是否等于**实际值**。如果是,则测试通过,目标达成。如果**期望值**不等于**实际值**,则测试失败。 +接下来,要实现称为 `calculator` 的组件,在 `app` 文件夹中创建一个新文件,并将其命名为`Calculator.cs`。要实现计算平方根的函数,请在此新文件中添加以下代码: ``` namespace app { @@ -153,51 +137,44 @@ namespace app { } ``` -Before you can test this implementation, you need to instruct the unit test how to find this new component (**Calculator**). Navigate to the **unit_tests** folder and open the **unit_tests.csproj** file. Add the following line in the **<ItemGroup>** code block: -在测试之前,你需要通知单元测试如何找到该新组件(**Calculator**)。 导航至**unit_tests** 文件夹,打开**unit_tests.csproj**文件。 在 **<ItemGroup>** 代码块中添加以下代码: +在测试之前,你需要通知单元测试如何找到该新组件(`Calculator`)。导航至 `unit_tests` 文件夹,打开 `unit_tests.csproj` 文件。在 `` 代码块中添加以下代码: ``` -`` + ``` -保存 **unit_test.csproj** 文件。现在,你可以运行第一个测试了。 - -切换到命令行,进入 **unit_tests** 文件夹。 运行以下命令: +保存 `unit_test.csproj` 文件。现在,你可以运行第一个测试了。 +切换到命令行,进入 `unit_tests` 文件夹。运行以下命令: ``` -`dotnet test` +dotnet test ``` 运行单元测试,会输出以下内容: ![单元测试失败后xUnit的输出结果][12] -图2. 单元测试失败后xUnit的输出结果 +*图2. 单元测试失败后 xUnit 的输出结果* +正如你所看到的,单元测试失败了。期望将数字 16 发送到 `calculator` 组件后会输出数字 4,但是输出(`Actual`)的是 16。 -正如你所看到的,单元测试失败了。 期望将数字16发送到**calculator** 组件后会输出数字4,但是输出(**实际值**)的是16。 -恭喜你! 创建了第一个故障。 单元测试为你提供了强有力的反馈机制,敦促你修复故障。 - +恭喜你!创建了第一个故障。单元测试为你提供了强有力的反馈机制,敦促你修复故障。 ### 修复故障 +要修复故障,你必须要改进 `bestGuess`。当下,`bestGuess` 仅获取函数接收的数字并返回。这不够好。 - -要修复故障,你必须要改进 **bestGuess**。 当下,**bestGuess** 仅获取函数接收的数字并返回。 这不够好。 -但是,如何找到一种计算平方根值的方法呢? 我有一个主意-看一下大自然母亲是如何解决问题的。 - +但是,如何找到一种计算平方根值的方法呢? 我有一个主意 —— 看一下大自然母亲是如何解决问题的。 ### 效仿大自然的迭代 +在第一次(也是唯一的)尝试中要得出正确值是非常难的(几乎不可能)。你必须允许自己进行多次尝试猜测,以增加解决问题的机会。允许多次尝试的一种方法是进行迭代。 -在第一次(也是唯一的)尝试中要得出正确值是非常难的(几乎不可能)。 你必须允许自己进行多次尝试猜测,以增加解决问题的机会。 允许多次尝试的一种方法是进行迭代。 - -要迭代,就要将 **bestGuess**值存储在 **previousGuess** 变量中,转换**bestGuess**的值,然后比较两个值之间的差。 如果差为0,则说明问题已解决。 否则,继续迭代。 +要迭代,就要将 `bestGuess` 值存储在 `previousGuess` 变量中,转换 `bestGuess` 的值,然后比较两个值之间的差。如果差为 0,则说明问题已解决。否则,继续迭代。 这是生成任何正数的平方根的函数体: - ``` double bestGuess = number; double previousGuess; @@ -210,75 +187,66 @@ do { return bestGuess; ``` -该循环(迭代)将bestGuess值集中到设想的解决方案。 现在,你精心设计的单元测试通过了! +该循环(迭代)将 `bestGuess` 值集中到设想的解决方案。现在,你精心设计的单元测试通过了! ![单元测试通过了][13] -图 3. 单元测试通过了。 +*图 3. 单元测试通过了。* ### 迭代解决了问题 -正如大自然母亲解决问题的方法,在本练习中,迭代解决了问题。 增量方法与逐步改进相结合是获得满意解决方案的有效方法。 该示例中的决定性因素是具有可衡量的目标和测试。 一旦有了这些,就可以继续迭代直到达到目标。 - +正如大自然母亲解决问题的方法,在本练习中,迭代解决了问题。增量方法与逐步改进相结合是获得满意解决方案的有效方法。该示例中的决定性因素是具有可衡量的目标和测试。一旦有了这些,就可以继续迭代直到达到目标。 ### 关键点! -好的,这是一个有趣的试验,但是更有趣的发现来自于使用这种新创建的解决方案。 到目前为止,**bestGuess** 从开始一直把函数接收到的数字作为输入参数。 如果更改**bestGuess**的初始值会怎样? +好的,这是一个有趣的试验,但是更有趣的发现来自于使用这种新创建的解决方案。到目前为止,`bestGuess` 从开始一直把函数接收到的数字作为输入参数。如果更改 `bestGuess` 的初始值会怎样? -为了测试这一点,你可以测试几种情况。 首先,在迭代多次尝试计算25的平方根时,要逐步细化观察结果: +为了测试这一点,你可以测试几种情况。 首先,在迭代多次尝试计算 25 的平方根时,要逐步细化观察结果: +![25 平方根的迭代编码][14] +*图 4. 通过迭代来计算 25 的平方根。* -![25平方根的迭代编码][14] - -图 4. 通过迭代来计算25的平方根。 - -以25作为 **bestGuess** 的初始值,该函数需要八次迭代才能计算出25的平方根。但是,如果在设计 **bestGuess** 初始值上犯下荒谬的错误,那将怎么办? 尝试第二次,那100万可能是25的平方根吗? 在这种明显错误的情况下会发生什么? 你写的功能是否能够处理这种低级错误。 +以 25 作为 `bestGuess` 的初始值,该函数需要八次迭代才能计算出 25 的平方根。但是,如果在设计 `bestGuess` 初始值上犯下荒谬的错误,那将怎么办? 尝试第二次,那 100 万可能是 25 的平方根吗? 在这种明显错误的情况下会发生什么?你写的函数是否能够处理这种低级错误。 直接来吧。回到测试中来,这次以一百万开始: ![逐步求精法][15] -图 5. 在计算25的平方根时,运用逐步求精法,以100万作为**bestGuess**的初始值。 +*图 5. 在计算 25 的平方根时,运用逐步求精法,以 100 万作为 bestGuess 的初始值。* -哇! 以一个荒谬的数字开始,迭代次数仅增加了两倍(从八次迭代到23次)。 增长幅度没有你直觉中预期的那么大。 +哇! 以一个荒谬的数字开始,迭代次数仅增加了两倍(从八次迭代到 23 次)。增长幅度没有你直觉中预期的那么大。 ### 故事的寓意 啊哈! 当你意识到,迭代不仅能够保证解决问题,而且与你的解决方案的初始猜测值是好是坏也没有关系。 不论你最初理解得多么不正确,迭代过程以及可衡量的测试/目标,都可以使你走上正确的道路并得到解决方案。 -图4和5显示了陡峭而戏剧性的燃尽图。 一个非常错误得开始,迭代很快就产生了一个绝对正确的解决方案。 +图 4 和 5 显示了陡峭而戏剧性的燃尽图。一个非常错误的开始,迭代很快就产生了一个绝对正确的解决方案。 简而言之,这种神奇的方法就是敏捷 DevOps 的本质。 - ### 回到一些更深层次的观察 +敏捷 DevOps 的实践源于人们对所生活的世界的认知。我们生活的世界存在不确定性、不完整性以及充满太多的困惑。从科学/哲学的角度来看,这些特征得到了[海森堡的不确定性原理][16]Heisenberg's Uncertainty Principle(涵盖不确定性部分),[维特根斯坦的逻辑论哲学][17]Wittgenstein's Tractatus Logico-Philosophicus(歧义性部分),[哥德尔的不完全性定理][18]Gödel's incompleteness theorems(不完全性方面)以及[热力学第二定律][19]Second Law of Thermodynamics(无情的熵引起的混乱)的充分证明和支持。 - -敏捷DevOps的实践源于人们对所生活的世界的认知。我们生活的世界存在不确定性,不完整性以及充满太多的困惑。 从科学/哲学的角度来看,这些特征得到了[海森堡的不确定性原理][16] (涵盖不确定性部分), [维特根斯坦的逻辑论哲学][17] (歧义性部分), [哥德尔的不完全性定理][18] (不完全性方面), 以及[热力学第二定律][19] (无情的熵引起的混乱)的充分证明和支持。 - -简而言之,无论你多么努力,在尝试解决任何问题时都无法获得完整的信息。 因此,放下傲慢的姿态,采取更为谦虚的方法来解决问题对我们会更有帮助。 谦卑会给为你带来巨大的回报,这个回报不仅是你期望的一个解决方案,还会有它的副产品。 - +简而言之,无论你多么努力,在尝试解决任何问题时都无法获得完整的信息。因此,放下傲慢的姿态,采取更为谦虚的方法来解决问题对我们会更有帮助。谦卑会给为你带来巨大的回报,这个回报不仅是你期望的一个解决方案,还会有它的副产品。 ### 总结 -大自然在不停地运作,这是一个持续不断的过程。 大自然没有总体规划。 一切都是对先前发生的事情的回应。 反馈循环是非常紧密的,明显的进步/倒退都是逐步实现的。大自然中随处可见,任何事物的都在以一种或多种形式逐步完善。 +大自然在不停地运作,这是一个持续不断的过程。大自然没有总体规划。一切都是对先前发生的事情的回应。 反馈循环是非常紧密的,明显的进步/倒退都是逐步实现的。大自然中随处可见,任何事物的都在以一种或多种形式逐步完善。 -敏捷 DevOps 是工程模型逐渐成熟的一个非常有趣的结果。 DevOps 基于这样的认识,即你所拥有的信息总是不完整的,因此你最好谨慎进行。 获得可衡量的测试(例如,假设,可测量的期望结果),进行简单的尝试,大多数情况下可能失败,然后收集反馈,修复故障并继续测试。 除了同意每个步骤都必须要有可衡量的假设/测试之外,没有其他方法。 +敏捷 DevOps 是工程模型逐渐成熟的一个非常有趣的结果。DevOps 基于这样的认识,即你所拥有的信息总是不完整的,因此你最好谨慎进行。获得可衡量的测试(例如,假设、可测量的期望结果),进行简单的尝试,大多数情况下可能失败,然后收集反馈,修复故障并继续测试。除了同意每个步骤都必须要有可衡量的假设/测试之外,没有其他方法。 在本系列的下一篇文章中,我将仔细研究变异测试是如何提供及时反馈来推动实现结果的。 - - -------------------------------------------------------------------------------- via: https://opensource.com/article/19/8/mutation-testing-evolution-tdd 作者:[Alex Bunardzic][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2832c93f1975d6e8c6c1016b27daef01a8c7b934 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 09:45:40 +0800 Subject: [PATCH 009/800] PUB @Morisun029 https://linux.cn/article-11468-1.html --- .../20190809 Mutation testing is the evolution of TDD.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190809 Mutation testing is the evolution of TDD.md (99%) diff --git a/translated/tech/20190809 Mutation testing is the evolution of TDD.md b/published/20190809 Mutation testing is the evolution of TDD.md similarity index 99% rename from translated/tech/20190809 Mutation testing is the evolution of TDD.md rename to published/20190809 Mutation testing is the evolution of TDD.md index d37b588e90..475673d8b5 100644 --- a/translated/tech/20190809 Mutation testing is the evolution of TDD.md +++ b/published/20190809 Mutation testing is the evolution of TDD.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11468-1.html) [#]: subject: (Mutation testing is the evolution of TDD) [#]: via: (https://opensource.com/article/19/8/mutation-testing-evolution-tdd) [#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) From f6268760c5a2f421fd71f4d7aa8507109b77f3bf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 12:11:38 +0800 Subject: [PATCH 010/800] PRF @geekpi --- ...e and process files with find and xargs.md | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/translated/tech/20191009 Command line quick tips- Locate and process files with find and xargs.md b/translated/tech/20191009 Command line quick tips- Locate and process files with find and xargs.md index c06d43fae8..9aa020fa0f 100644 --- a/translated/tech/20191009 Command line quick tips- Locate and process files with find and xargs.md +++ b/translated/tech/20191009 Command line quick tips- Locate and process files with find and xargs.md @@ -1,50 +1,50 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Command line quick tips: Locate and process files with find and xargs) [#]: via: (https://fedoramagazine.org/command-line-quick-tips-locate-and-process-files-with-find-and-xargs/) [#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) -命令行提示:使用 find 和 xargs 查找和处理文件 +命令行技巧:使用 find 和 xargs 查找和处理文件 ====== ![][1] -**find** 是日常工具箱中功能更强大,更灵活的命令行程序之一。它如它名字所暗示的:查找符合你指定条件的文件和目录。借助 **-exec** 或 **-delete** 之类的参数,你可以让它对找到的文件进行操作。 +`find` 是日常工具箱中功能强大、灵活的命令行程序之一。它如它名字所暗示的:查找符合你指定条件的文件和目录。借助 `-exec` 或 `-delete` 之类的参数,你可以让它对找到的文件进行操作。 -在[命令行提示][2]系列的这一期中,你将会看到 **find** 命令的介绍,并学习如何使用内置命令或使用 **xargs** 命令处理文件。 +在[命令行提示][2]系列的这一期中,你将会看到 `find` 命令的介绍,并学习如何使用内置命令或使用 `xargs` 命令处理文件。 ### 查找文件 -**find** 至少要加上查找的路径。例如,此命令将查找(并打印)系统上的每个文件: +`find` 至少要加上查找的路径。例如,此命令将查找(并打印)系统上的每个文件: ``` find / ``` -由于所有东西都是文件,因此你会看到大量的输出。这可能无法帮助你找到所需的内容。你可以更改路径参数缩小范围,但这实际上并没有比使用 **ls** 命令更好。因此,你需要考虑要查找的内容。 +由于一切皆文件,因此你会看到大量的输出。这可能无法帮助你找到所需的内容。你可以更改路径参数缩小范围,但这实际上并没有比使用 `ls` 命令更好。因此,你需要考虑要查找的内容。 -也许你想在家目录中查找所有 JPEG 文件。 **-name** 参数允许你将结果限制为与给定模式匹配的文件。 +也许你想在家目录中查找所有 JPEG 文件。 `-name` 参数允许你将结果限制为与给定模式匹配的文件。 ``` find ~ -name '*jpg' ``` -但是等等!如果其中一些扩展名是大写怎么办? **-iname** 类似于 **-name**,但不区分大小写: +但是等等!如果其中一些扩展名是大写怎么办? `-iname` 类似于 `-name`,但不区分大小写: ``` find ~ -iname '*jpg' ``` -很好!但是 8.3 命名方案出自 1985 年。某些图片的扩展名可能是 .jpeg。幸运的是,我们可以将模式使用“或”(**-o**)进行组合。括号会被转义,以便是 **find** 命令而不是 shell 程序尝试解释它们。 +很好!但是 8.3 命名方案出自 1985 年。某些图片的扩展名可能是 .jpeg。幸运的是,我们可以将模式使用“或”(`-o`)进行组合。括号需要转义,以便使 `find` 命令而不是 shell 程序尝试解释它们。 ``` find ~ \( -iname 'jpeg' -o -iname 'jpg' \) ``` -更进一步。如果你有一些以 jpg 结尾的目录怎么办? (为什么你将目录命名为 **bucketofjpg** 而不是 **pictures**。)我们可以加上 **-type** 参数来仅查找文件: +更进一步。如果你有一些以 `jpg` 结尾的目录怎么办?(我不懂你为什么将目录命名为 `bucketofjpg` 而不是 `pictures`?)我们可以加上 `-type` 参数来仅查找文件: ``` find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f @@ -56,7 +56,7 @@ find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type d ``` -最近你拍摄了很多照片,因此使用 **-mtime**(修改时间)将范围缩小到最近一周修改过的文件。 **-7** 表示 7 天或更短时间内修改的所有文件。 +最近你拍摄了很多照片,因此使用 `-mtime`(修改时间)将范围缩小到最近一周修改过的文件。 `-7` 表示 7 天或更短时间内修改的所有文件。 ``` find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f -mtime -7 @@ -64,24 +64,19 @@ find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f -mtime -7 ### 使用 xargs 进行操作 -**xargs** 命令从标准输入流中获取参数,并基于它们执行命令。继续使用上一节中的示例,假设你要将上周修改过的家目录中的所有 JPEG 文件复制到 U 盘,以便插到电子相册上。假设你已经将 U 盘挂载到 _/media/photo_display_。 +`xargs` 命令从标准输入流中获取参数,并基于它们执行命令。继续使用上一节中的示例,假设你要将上周修改过的家目录中的所有 JPEG 文件复制到 U 盘,以便插到电子相册上。假设你已经将 U 盘挂载到 `/media/photo_display`。 ``` find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f -mtime -7 -print0 | xargs -0 cp -t /media/photo_display ``` -**find**命令与以前的版本略有不同。**-print0** 命令让输出有一些更改:它不使用换行符,而是添加了一个空字符。**xargs** 的 **-0**(零)选项可调整解析以达到预期效果。这很重要,不然对包含空格、引号或其他特殊字符的文件名执行操作可能无法按预期进行。对文件采取任何操作时,都应使用这些选项。 +这里的 `find` 命令与以前的版本略有不同。`-print0` 命令让输出有一些更改:它不使用换行符,而是添加了一个 `null` 字符。`xargs` 的 `-0`(零)选项可调整解析以达到预期效果。这很重要,不然对包含空格、引号或其他特殊字符的文件名执行操作可能无法按预期进行。对文件采取任何操作时,都应使用这些选项。 - -**cp**的 **-t** 参数很重要,因为 **cp** 通常要求目的地址在最后。你可以不使用 **xargs** 而使用 **find** 的 **-exec** 执行此操作,但是 **xargs** 的方式会更快,尤其是对于大量文件,因为它会单次调用 **cp**。 +`cp` 命令的 `-t` 参数很重要,因为 `cp` 通常要求目的地址在最后。你可以不使用 `xargs` 而使用 `find` 的 `-exec` 执行此操作,但是 `xargs` 的方式会更快,尤其是对于大量文件,因为它会单次调用 `cp`。 ### 了解更多 -这篇文章仅是 **find** 可以做的事情的表面。 **find** 支持基于权限、所有者、访问时间等的测试。它甚至可以将搜索路径中的文件与其他文件进行比较。将测试与布尔逻辑相结合,可以为你提供惊人的灵活性,以精确地找到你要查找的文件。使用内置命令或管道传递给 **xargs**,你可以快速处理大量文件。 - -_这篇文章的部分内容先前已发布在 [Opensource.com][3]。_ _ 照片由 [_Warren Wong_][4] 在 [Unsplash] [5] 上发表。_ - - +这篇文章仅仅是 `find` 可以做的事情的表面。 `find` 支持基于权限、所有者、访问时间等的测试。它甚至可以将搜索路径中的文件与其他文件进行比较。将测试与布尔逻辑相结合,可以为你提供惊人的灵活性,以精确地找到你要查找的文件。使用内置命令或管道传递给 `xargs`,你可以快速处理大量文件。 -------------------------------------------------------------------------------- @@ -90,7 +85,7 @@ via: https://fedoramagazine.org/command-line-quick-tips-locate-and-process-files 作者:[Ben Cotton][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 2f2d737ca7fb66d04bcc0d2cd13159d51cdce160 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 12:12:05 +0800 Subject: [PATCH 011/800] PUB @geekpi https://linux.cn/article-11469-1.html --- ...uick tips- Locate and process files with find and xargs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191009 Command line quick tips- Locate and process files with find and xargs.md (98%) diff --git a/translated/tech/20191009 Command line quick tips- Locate and process files with find and xargs.md b/published/20191009 Command line quick tips- Locate and process files with find and xargs.md similarity index 98% rename from translated/tech/20191009 Command line quick tips- Locate and process files with find and xargs.md rename to published/20191009 Command line quick tips- Locate and process files with find and xargs.md index 9aa020fa0f..038a61aaa6 100644 --- a/translated/tech/20191009 Command line quick tips- Locate and process files with find and xargs.md +++ b/published/20191009 Command line quick tips- Locate and process files with find and xargs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11469-1.html) [#]: subject: (Command line quick tips: Locate and process files with find and xargs) [#]: via: (https://fedoramagazine.org/command-line-quick-tips-locate-and-process-files-with-find-and-xargs/) [#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) From eb0ffa885cc6c7c9fee137322c506ed7852b5d6e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 12:51:55 +0800 Subject: [PATCH 012/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @singledo 还需要加强翻译质量,翻译完应该审读一下。另外,标点符号,请用中文的。 --- ... Zip File in Linux -Beginner-s Tutorial.md | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/translated/tech/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md b/translated/tech/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md index 2d8cb2f944..b1f79d4b27 100644 --- a/translated/tech/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md +++ b/translated/tech/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md @@ -1,48 +1,44 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) +[#]: translator: (singledo) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Unzip a Zip File in Linux [Beginner’s Tutorial]) [#]: via: (https://itsfoss.com/unzip-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -如何在 linux 下解压 Zip 文件 +新手教程:如何在 Linux 下解压 Zip 文件 ====== -_**摘要: 将会向你展示如何在 ubuntu 和其他 linux 发行版本上解压文件 . 终端和图形界面的方法都会被讨论 **_ +> 本文将会向你展示如何在 Ubuntu 和其他 Linux 发行版本上解压文件。终端和图形界面的方法都会讨论。 -[Zip][1] 是一种最普通 , 最流行的方法来创建压缩存档文件 . 它也是一种古老的文件归档文件格式,创建于 1989 年 . 自从它被广泛的使用 , 你会经常遇见 zip 文件 . +[Zip][1] 是一种创建压缩存档文件的最普通、最流行的方法。它也是一种古老的文件归档文件格式,这种格式创建于 1989 年。由于它的广泛使用,你会经常遇见 zip 文件。 -在更早的一份教程 , 我展示了 [how to zip a folder in Linux][2] . 在这篇快速教程中 , 对于初学者我会展示如何在 linux 上解压文件 . +在更早的一份教程里,我介绍了[如何在 Linux 上用 zip 压缩一个文件夹][2]。在这篇面向初学者的快速教程中,我会介绍如何在 Linux 上解压文件。 -**先决条件: 检查你是否安装了 unzip** +先决条件:检查你是否安装了 `unzip`。 -为了解压 zip 归档文件 , 你必须解压安装包到你的系统 . 大多数现代的的 linux 发行版本提供解压 zip 文件的原生支持 . 校验它来避免以后出现坏的惊喜 . +为了解压 zip 归档文件,你必须在你的系统上安装了 unzip 软件包。大多数现代的的 Linux 发行版本提供了解压 zip 文件的支持,但是对这些 zip 文件进行校验以避免以后出现损坏总是没有坏处的。 -以 [Unbutu][3] 和 [Debian][4] 为基础的发行版本 , 你能够使用下面的命令来安装 unzip. 如果你已经安装了, 你会被告知已经被安装 . +在基于 [Unbutu][3] 和 [Debian][4] 的发行版上,你能够使用下面的命令来安装 `unzip`。如果你已经安装了,你会被告知已经被安装。 ``` sudo apt install unzip ``` -一旦你能够确认你的系统中安装了 unzip, 你就可以通过 unzip 来解压 zip 归档文件. - -你也能够使用命令行或者图形工具来达到目的, 我会向你展示两种方法. - - * [Unzip files in Linux terminal][5] - * [Unzip files in Ubuntu via GUI][6] +一旦你能够确认你的系统中安装了 `unzip`,你就可以通过 `unzip` 来解压 zip 归档文件。 +你也能够使用命令行或者图形工具来达到目的,我会向你展示两种方法: ### 使用命令行解压文件 -在 linux 下使用 unzip 命令是非常简单. 当你向解压 zip 文件, 用下面的命令: +在 Linux 下使用 `unzip` 命令是非常简单的。在你放 zip 文件的目录,用下面的命令: ``` unzip zipped_file.zip ``` -你可以给 zip 文件提供解压路径而不是当前所在路径 . 你会在终端输出中看到提取的文件: +你可以给 zip 文件提供解压路径而不是解压到当前所在路径。你会在终端输出中看到提取的文件: ``` unzip metallic-container.zip -d my_zip @@ -52,19 +48,19 @@ Archive: metallic-container.zip inflating: my_zip/License premium.txt ``` -上面的命令有一个小问题. 它会提取 zip 文件中所有的内容到现在的文件夹 . 你会在当前文件夹下留下一堆没有组织的文件, 这不是一件很好的事情. +上面的命令有一个小问题。它会提取 zip 文件中所有的内容到现在的文件夹。你会在当前文件夹下留下一堆没有组织的文件,这不是一件很好的事情。 #### 解压到文件夹下 -在 linux 命令行下, 对于把文件解压到一个文件夹下是一个好的做法. 这种方式下, 所有的提取文件都会被存储到你所指定的文件夹下. 如果文件夹不存在, 文件夹会被创建. +在 Linux 命令行下,对于把文件解压到一个文件夹下是一个好的做法。这种方式下,所有的提取文件都会被存储到你所指定的文件夹下。如果文件夹不存在,会创建该文件夹。 ``` unzip zipped_file.zip -d unzipped_directory ``` -现在 zipped_file.zip 中所有的内容都会被提取到 unzipped_directory 中. +现在 `zipped_file.zip` 中所有的内容都会被提取到 `unzipped_directory` 中。 -从我们讨论好的做法, 另一个注意点, 我们可以查看压缩文件中的内容而不用真实的解压 . +由于我们在讨论好的做法,这里有另一个注意点,我们可以查看压缩文件中的内容而不用实际解压。 #### 查看压缩文件中的内容而不解压压缩文件 @@ -72,7 +68,8 @@ unzip zipped_file.zip -d unzipped_directory unzip -l zipped_file.zip ``` -下面是命令的输出: +下面是该命令的输出: + ``` unzip -l metallic-container.zip Archive: metallic-container.zip @@ -85,20 +82,21 @@ Archive: metallic-container.zip 6578588 3 files ``` -在 linux 下, 这里还有些其他的 unzip 的用法, 你对在 linux 下使用解压文件有了足够的知识. +在 Linux 下,还有些 `unzip` 的其它用法,但我想你现在已经对在 Linux 下使用解压文件有了足够的了解。 ### 使用图形界面来解压文件 - 如果你使用桌面版 linux , 那你就不必总是使用终端. 在图形化的界面下,我们又要如何解压文件呢? 我使用 [GNOME desktop][7]. 和其他的桌面版 linux 发行版本相同 . - 打开文件管理器,然后跳转到压缩文件所在的文件夹下. 点击鼠标右键, 你会在弹出的窗口中看到 "extract here",选择它. +如果你使用桌面版 Linux,那你就不必总是使用终端。在图形化的界面下,我们又要如何解压文件呢? 我使用的是 [GNOME 桌面][7],不过其它桌面版 Linux 发行版也大致相同。 + +打开文件管理器,然后跳转到 zip 文件所在的文件夹下。在文件上点击鼠标右键,你会在弹出的窗口中看到 “提取到这里”,选择它。 ![Unzip File in Ubuntu][8] -与 unzip 命令不同, 提取选项会创建一个和压缩文件名相同的文件夹,并且把压缩文件中的所有内容存储到创建的文件夹下. 相对于 unzip 命令的默认行为是将压缩文件提取到当前所在的文件下,图形界面的解压对于我来说是一件非常好的事情. +与 `unzip` 命令不同,这个提取选项会创建一个和压缩文件名相同的文件夹(LCTT 译注:文件夹没有 `.zip` 扩展名),并且把压缩文件中的所有内容存储到创建的文件夹下。相对于 `unzip` 命令的默认行为是将压缩文件提取到当前所在的文件下,图形界面的解压对于我来说是一件非常好的事情。 -这里还有一个选项 "extract to", 你可以悬着特定的文件夹来存储提取文件. +这里还有一个选项“提取到……”,你可以选择特定的文件夹来存储提取的文件。 -你现在知道如何在 linux 解压文件. 你也许对学习有兴趣 [using 7zip in Linux][9] . +你现在知道如何在 Linux 解压文件了。你也许还对学习[在 Linux 下使用 7zip][9] 感兴趣? -------------------------------------------------------------------------------- @@ -107,7 +105,7 @@ via: https://itsfoss.com/unzip-linux/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[octopus](https://github.com/singledo) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3f085b436758635a4bdd60f11033e731dd74e1c6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 12:52:42 +0800 Subject: [PATCH 013/800] PUB @singledo https://linux.cn/article-11470-1.html --- ...1 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md (98%) diff --git a/translated/tech/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md b/published/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md similarity index 98% rename from translated/tech/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md rename to published/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md index b1f79d4b27..a40d412a74 100644 --- a/translated/tech/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md +++ b/published/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (singledo) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11470-1.html) [#]: subject: (How to Unzip a Zip File in Linux [Beginner’s Tutorial]) [#]: via: (https://itsfoss.com/unzip-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From c76981b84b98b8882f4485418dee5a0f66caa3bc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 22:52:31 +0800 Subject: [PATCH 014/800] TSL --- ...iters can get work done better with Git.md | 79 ++++++++----------- 1 file changed, 35 insertions(+), 44 deletions(-) rename {sources => translated}/tech/20190404 How writers can get work done better with Git.md (67%) diff --git a/sources/tech/20190404 How writers can get work done better with Git.md b/translated/tech/20190404 How writers can get work done better with Git.md similarity index 67% rename from sources/tech/20190404 How writers can get work done better with Git.md rename to translated/tech/20190404 How writers can get work done better with Git.md index 7274389eaf..213c63bba9 100644 --- a/sources/tech/20190404 How writers can get work done better with Git.md +++ b/translated/tech/20190404 How writers can get work done better with Git.md @@ -159,85 +159,76 @@ Atom 最令人兴奋的功能是其强大的 Git 集成。无需离开 Atom, 右键单击你的新项目文件夹,然后选择“新建文件”以在项目文件夹中创建一个新文件。如果你要导入文件到新项目中,请右键单击该文件夹,然后选择“在文件管理器中显示”,以在系统的文件查看器中打开该文件夹(Linux 上为 Dolphin 或 Nautilus,Mac 上为 Finder,在 Windows 上是 Explorer),然后拖放文件到你的项目文件夹。 -在Atom中打开一个项目文件(您创建的空文件或导入的文件)后,单击** Git **标签中的** Create Repository **按钮。在弹出的对话框中,单击** Init **以将您的项目目录初始化为本地Git存储库。 Git将**。git **目录(在系统的文件管理器中不可见,但在Atom中对您可见)添加到项目文件夹中。不要被这个愚弄了:**。git **目录是Git管理的,而不是您管理的,因此您通常会远离它。但是在Atom中看到它可以很好地提醒您您正在Git积极管理的项目中工作。换句话说,当您看到**。git **目录时,修订历史记录可用。 +在 Atom 中打开一个项目文件(你创建的空文件或导入的文件)后,单击 Git 标签中的 “创建存储库Create Repository” 按钮。在弹出的对话框中,单击 “初始化Init” 以将你的项目目录初始化为本地 Git 存储库。 Git 会将 `.git` 目录(在系统的文件管理器中不可见,但在 Atom 中可见)添加到项目文件夹中。不要被这个愚弄了:`.git` 目录是 Git 管理的,而不是由你管理的,因此你一般不要动它。但是在 Atom 中看到它可以很好地提醒你正在由 Git 管理的项目中工作。换句话说,当你看到 `.git` 目录时,就有了修订历史记录。 -Right-click on your new project folder and select **New File** to create a new file in your project folder. If you have files you want to import into your new project, right-click on the folder and select **Show in File Manager** to open the folder in your system's file viewer (Dolphin or Nautilus on Linux, Finder on Mac, Explorer on Windows), and then drag-and-drop your files. +在你的空文件中,写一些东西。你是写作者,所以输入一些单词就行。你可以随意输入任何一组单词,但要记住上面的写作技巧。 -With a project file (either the empty one you created or one you've imported) open in Atom, click the **Create Repository** button in the **Git** tab. In the pop-up dialog box, click **Init** to initialize your project directory as a local Git repository. Git adds a **.git** directory (invisible in your system's file manager, but visible to you in Atom) to your project folder. Don't be fooled by this: The **.git** directory is for Git to manage, not you, so you'll generally stay out of it. But seeing it in Atom is a good reminder that you're working in a project actively managed by Git; in other words, revision history is available when you see a **.git** directory. +按 `Ctrl + S` 保存文件,该文件将显示在 Git 标签的 “未暂存的改变Unstaged Changes” 部分中。这意味着该文件存在于你的项目文件夹中,但尚未提交给 Git 管理。通过单击 Git 选项卡右上方的 “暂存全部Stage All” 按钮,允许 Git 跟踪这些文件。如果你使用过带有修订历史记录的文字处理器,则可以将此步骤视为允许 Git记录更改。 -In your empty file, write some stuff. You're a writer, so type some words. It can be any set of words you please, but remember the writing tips above. +#### Git 提交 -Press **Ctrl+S** to save your file and it will appear in the **Unstaged Changes** section of the **Git** tab. That means the file exists in your project folder but has not yet been committed over to Git's purview. Allow Git to keep track of your file by clicking on the **Stage All** button in the top-right of the **Git** tab. If you've used a word processor with revision history, you can think of this step as permitting Git to record changes. +你的文件现在已暂存。这意味着 Git 知道该文件存在,并且知道自上次 Git 知道该文件以来,该文件已被更改。 -#### Git commit +Git 的提交commit会将你的文件发送到 Git 的内部和永久存档中。如果你习惯于文字处理程序,这就类似于给一个修订版命名。要创建一个提交,请在 Git 选项卡底部的“提交Commit”消息框中输入一些描述性文本。你可能会感到含糊不清或随意写点什么,但如果你想在将来知道进行修订的原因,那么输入一些有用的信息会更有用。 -Your file is now staged. All that means is Git is aware that the file exists and is aware that it has been changed since the last time Git was made aware of it. +第一次提交时,必须创建一个分支branch。Git 分支有点像另外一个空间,它允许你从一个时间轴切换到另一个时间轴,以进行你可能想要或可能不想要永久保留的更改。如果最终喜欢该更改,则可以将一个实验分支合并到另一个实验分支,从而统一项目的不同版本。这是一个高级过程,不需要先学会,但是你仍然需要一个活动分支,因此你必须为首次提交创建一个分支。 -A Git commit sends your file into Git's internal and eternal archives. If you're used to word processors, this is similar to naming a revision. To create a commit, enter some descriptive text in the **Commit** message box at the bottom of the **Git** tab. You can be vague or cheeky, but it's more useful if you enter useful information for your future self so that you know why the revision was made. - -The first time you make a commit, you must create a branch. Git branches are a little like alternate realities, allowing you to switch from one timeline to another to make changes that you may or may not want to keep forever. If you end up liking the changes, you can merge one experimental branch into another, thereby unifying different versions of your project. It's an advanced process that's not worth learning upfront, but you still need an active branch, so you have to create one for your first commit. - -Click on the **Branch** icon at the very bottom of the **Git** tab to create a new branch. +单击 Git 选项卡最底部的“分支Branch”图标,以创建新的分支。 ![Creating a branch][14] -It's customary to name your first branch **master**. You don't have to; you can name it **firstdraft** or whatever you like, but adhering to the local customs can sometimes make talking about Git (and looking up answers to questions) a little easier because you'll know that when someone mentions **master** , they really mean **master** and not **firstdraft** or whatever you called your branch. +通常将第一个分支命名为 `master`,但不是必须如此;你可以将其命名为 `firstdraft` 或任何你喜欢的名称,但是遵守当地习俗有时会使谈论 Git(和查找问题的答案)变得容易一些,因为你会知道有人提到 “master” 时,它们的真正意思是“主干”而不是“初稿”或你给分支起的什么名字。 -On some versions of Atom, the UI may not update to reflect that you've created a new branch. Don't worry; the branch will be created (and the UI updated) once you make your commit. Press the **Commit** button, whether it reads **Create detached commit** or **Commit to master**. +在某些版本的 Atom 上,UI 也许不会更新以反映你已经创建的新分支。不用担心,做了提交之后,它会创建分支(并更新 UI)。按下 “提交Commit” 按钮,无论它显示的是 “创建脱离的提交Create detached commit” 还是 “提交到主干Commit to master。 -Once you've made a commit, the state of your file is preserved forever in Git's memory. +提交后,文件的状态将永久保留在 Git 的记忆之中。 -#### History and Git diff +#### 历史记录和 Git 差异 -A natural question is how often you should make a commit. There's no one right answer to that. Saving a file with **Ctrl+S** and committing to Git are two separate processes, so you will continue to do both. You'll probably want to make commits whenever you feel like you've done something significant or are about to try out a crazy new idea that you may want to back out of. +一个自然而然的问题是你应该多久做一次提交。这并没有正确的答案。使用 `Ctrl + S` 保存文件并提交到 Git 是两个单独的过程,因此你会一直做这两个过程。每当你觉得自己已经做了重要的事情或打算尝试一个可能要被干掉的疯狂的新想法时,你可能都会想要做个提交。 -To get a feel for what impact a commit has on your workflow, remove some text from your test document and add some text to the top and bottom. Make another commit. Do this a few times until you have a small history at the bottom of your **Git** tab, then click on a commit to view it in Atom. +要了解提交对工作流程的影响,请从测试文档中删除一些文本,然后在顶部和底部添加一些文本。再次提交。 这样做几次,直到你在 Git 标签的底部有了一小段历史记录,然后单击其中一个提交以在 Atom 中查看它。 ![Viewing differences][15] -When viewing a past commit, you see three elements: +查看过去的提交时,你会看到三种元素: - 1. Text in green was added to a document when the commit was made. - 2. Text in red was removed from the document when the commit was made. - 3. All other text was untouched. +1. 绿色文本是该提交中已被添加到文档中的内容。 +2. 红色文本是该提交中已从文档中删除的内容。 +3. 其他所有文字均未做更改。 +#### 远程备份 +使用 Git 的优点之一是,按照设计,它是分布式的,这意味着你可以将工作提交到本地存储库,并将所做的更改推送到任意数量的服务器上进行备份。你还可以从这些服务器中拉取更改,以便你碰巧正在使用的任何设备始终具有最新更改。 -#### Remote backup +为此,你必须在 Git 服务器上拥有一个帐户。有几种免费的托管服务,其中包括 GitHub,这个公司开发了 Atom,但奇怪的是 GitHub 不是开源的;而 GitLab 是开源的。相比私有的,我更喜欢开源,在本示例中,我将使用 GitLab。 -One of the advantages of using Git is that, by design, it is distributed, meaning you can commit your work to your local repository and push your changes out to any number of servers for backup. You can also pull changes in from those servers so that whatever device you happen to be working on always has the latest changes. +如果你还没有 GitLab 帐户,请注册一个帐户并开始一个新项目。项目名称不必与 Atom 中的项目文件夹匹配,但是如果匹配,则可能更有意义。你可以将项目保留为私有,在这种情况下,只有你和任何一个你给予了明确权限的人可以访问它,或者,如果你希望该项目可供任何互联网上偶然发现它的人使用,则可以将其公开。 -For this to work, you must have an account on a Git server. There are several free hosting services out there, including GitHub, the company that produces Atom but oddly is not open source, and GitLab, which is open source. Preferring open source to proprietary, I'll use GitLab in this example. +不要将 README 文件添加到项目中。 -If you don't already have a GitLab account, sign up for one and start a new project. The project name doesn't have to match your project folder in Atom, but it probably makes sense if it does. You can leave your project private, in which case only you and anyone you give explicit permissions to can access it, or you can make it public if you want it to be available to anyone on the internet who stumbles upon it. +创建项目后,这个文件将为你提供有关如何设置存储库的说明。如果你决定在终端中或通过单独的 GUI 使用 Git,这是非常有用的信息,但是 Atom 的工作流程则有所不同。 -Do not add a README to the project. - -Once the project is created, it provides you with instructions on how to set up the repository. This is great information if you decide to use Git in a terminal or with a separate GUI, but Atom's workflow is different. - -Click the **Clone** button in the top-right of the GitLab interface. This reveals the address you must use to access the Git repository. Copy the **SSH** address (not the **https** address). - -In Atom, click on your project's **.git** directory and open the **config**. Add these configuration lines to the file, adjusting the **seth/example.git** part of the **url** value to match your unique address. - -* * * +单击 GitLab 界面右上方的 “克隆Clone” 按钮。这显示了访问 Git 存储库必须使用的地址。复制 “SSH” 地址(而不是 “https” 地址)。 +在 Atom 中,点击项目的 `.git` 目录,然后打开 `config` 文件。将下面这些配置行添加到该文件中,调整 `url` 值的 `seth/example.git` 部分以匹配你自己独有的地址。 ``` [remote "origin"] -url = [git@gitlab.com][16]:seth/example.git -fetch = +refs/heads/*:refs/remotes/origin/* + url = git@gitlab.com:seth/example.git + fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] -remote = origin -merge = refs/heads/master + remote = origin + merge = refs/heads/master ``` -At the bottom of the **Git** tab, a new button has appeared, labeled **Fetch**. Since your server is brand new and therefore has no data for you to fetch, right-click on the button and select **Push**. This pushes your changes to your Gitlab account, and now your project is backed up on a Git server. +在 Git 标签的底部,出现了一个新按钮,标记为 “提取Fetch”。由于你的服务器是全新的服务器,因此没有可供你提取的数据,因此请右键单击该按钮,然后选择“推送Push”。这会将你的更改推送到你的 GitLab 帐户,现在你的项目已备份到 Git 服务器上。 -Pushing changes to a server is something you can do after each commit. It provides immediate offsite backup and, since the amount of data is usually minimal, it's practically as fast as a local save. +你可以在每次提交后将更改推送到服务器。它提供了立即的异地备份,并且由于数据量通常很少,因此它几乎与本地保存一样快。 -### Writing and Git +### 撰写而 Git -Git is a complex system, useful for more than just revision tracking and backups. It enables asynchronous collaboration and encourages experimentation. This article has covered the basics, but there are many more articles—and entire books—on Git and how to use it to make your work more efficient, more resilient, and more dynamic. It all starts with using Git for small tasks. The more you use it, the more questions you'll find yourself asking, and eventually the more tricks you'll learn. +Git 是一个复杂的系统,不仅对修订跟踪和备份有用。它还支持异步协作并鼓励实验。本文介绍了一些基础知识,但还有更多关于 Git 的文章和整本的书,以及如何使用它使你的工作更高效、更具弹性和更具活力。 从使用 Git 完成小任务开始,使用的次数越多,你会发现自己提出的问题就越多,最终你将学到的技巧越多。 -------------------------------------------------------------------------------- @@ -245,7 +236,7 @@ via: https://opensource.com/article/19/4/write-git 作者:[Seth Kenlon][a] 选题:[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/) 荣誉推出 From 9eab4019b83b10107306f5a37c69e0c4a03ed577 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 23:38:17 +0800 Subject: [PATCH 015/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @algzjh 恭喜你完成了第一篇翻译贡献!翻译的很用心。 --- ... Source Alternatives to Adobe Photoshop.md | 50 ++++++++----------- 1 file changed, 21 insertions(+), 29 deletions(-) diff --git a/translated/tech/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md b/translated/tech/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md index ceb0d242cc..620419048c 100644 --- a/translated/tech/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md +++ b/translated/tech/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md @@ -1,16 +1,16 @@ [#]: collector: (lujun9972) [#]: translator: (algzjh) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 Free and Open Source Alternatives to Adobe Photoshop) [#]: via: (https://itsfoss.com/open-source-photoshop-alternatives/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Adobe Photoshop 的 4 种免费开源替代品 +Adobe Photoshop 的 4 种自由开源替代品 ====== -_**想寻找免费的 Photoshop 替代品? 这里有一些最好的免费开源软件,你可以用它们来代替 Adobe Photoshop。**_ +> 想寻找免费的 Photoshop 替代品?这里有一些最好的自由开源软件,你可以用它们来代替 Adobe Photoshop。 Adobe Photoshop 是一个可用于 Windows 和 macOS 的高级图像编辑和设计工具。毫无疑问,几乎每个人都知道它。其十分受欢迎。在 Linux 上,你可以在虚拟机中使用 Windows 或[通过 Wine][1] 来使用 Photoshop,但这并不是一种理想的体验。 @@ -18,40 +18,38 @@ Adobe Photoshop 是一个可用于 Windows 和 macOS 的高级图像编辑和设 请注意 Photoshop 不仅仅是一个图片编辑器。摄影师、数码艺术家、专业编辑使用它用于各种用途。此处的替代软件可能不具备 Photoshop 的所有功能,但你可以将它们用于在 Photoshop 中完成的各种任务。 -### 适用于 Linux, Windows 和 macOS 的 Adobe Photoshop 的开源替代品 +### 适用于 Linux、Windows 和 macOS 的 Adobe Photoshop 的开源替代品 ![][2] 最初,我想只关注 Linux 中的 Photoshop 替代品,但为什么要把这个列表局限于 Linux 呢?其他操作系统用户也可使用开源软件。 -_**如果你正在使用 Linux,则所有提到的软件都应该可以在你的发行版的存储库中找到。你可以使用软件中心或包管理器进行安装。**_ +**如果你正在使用 Linux,则所有提到的软件都应该可以在你的发行版的存储库中找到。你可以使用软件中心或包管理器进行安装。** 对于其他平台,请查看官方项目网站以获取安装文件。 -_该列表没有特定的排名顺序_. +*该列表没有特定的排名顺序* -#### 1\. GIMP: 真正的 Photoshop 替代品 +#### 1、GIMP:真正的 Photoshop 替代品 ![][3] 主要特点: * 可定制的界面 - * 数字修饰 + * 数字级修饰 * 照片增强(使用变换工具) * 支持广泛的硬件(压敏平板、音乐数字接口等) * 几乎支持所有主要的图像文件 * 支持图层管理 - - -**可用平台:** Linux, Windows 和 macOS +可用平台:Linux、Windows 和 macOS [GIMP][4] 是我处理任何事情的必备工具,无论任务多么基础/高级。也许,这是你在 Linux 下最接近 Photoshop 的替代品。除此之外,它还是一个开源和免费的解决方案,适合希望在 Linux 上创作伟大作品的艺术家。 -它具有任何类型的图像处理所必需的所有功能。当然,还有图层管理支持。根据你的经验水平,利用率会有所不同。因此,如果你想充分利用它,则应阅读 [文档][5] 并遵循 [官方教程][6]. +它具有任何类型的图像处理所必需的所有功能。当然,还有图层管理支持。根据你的经验水平,利用率会有所不同。因此,如果你想充分利用它,则应阅读 [文档][5] 并遵循 [官方教程][6]。 -#### 2\. Krita +#### 2、Krita ![][7] @@ -61,15 +59,13 @@ _该列表没有特定的排名顺序_. * 转换工具 * 丰富的笔刷/绘图工具 +可用平台:Linux、Windows 和 macOS - -**可用平台:** Linux, Windows 和 macOS - -[Krita][8] 是一个令人印象深刻的数字绘画开源工具。图层管理支持和转换工具的存在使它成为 Photoshop 的基本编辑任务的替代品之一。 +[Krita][8] 是一个令人印象深刻的开源的数字绘画工具。图层管理支持和转换工具的存在使它成为 Photoshop 的基本编辑任务的替代品之一。 如果你喜欢素描/绘图,这将对你很有帮助。 -#### 3\. Darktable +#### 3、Darktable ![][9] @@ -79,15 +75,13 @@ _该列表没有特定的排名顺序_. * 支持多种图像格式 * 多个带有混合运算符的图像操作模块 - - -**可用平台:** Linux, Windows 和 macOS +可用平台:Linux、Windows 和 macOS [Darktable][10] 是一个由摄影师制作的开源摄影工作流应用程序。它可以让你在数据库中管理你的数码底片。从你的收藏中,显影 RAW 格式的图像并使用可用的工具对其进行增强。 从基本的图像编辑工具到支持混合运算符的多个图像模块,你将在探索中发现许多。 -#### 4\. Inkscape +#### 4、Inkscape ![][11] @@ -96,18 +90,16 @@ _该列表没有特定的排名顺序_. * 创建对象的工具(最适合绘图/素描) * 支持图层管理 * 用于图像处理的转换工具 - * 颜色选择器(RGB,HSL,CMYK,色轮,CMS) + * 颜色选择器(RGB、HSL、CMYK、色轮、CMS) * 支持所有主要文件格式 +可用平台:Linux、Windows 和 macOS - -**可用平台:** Linux, Windows 和 macOS - -[Inkscape][12] 是一个非常流行的开源矢量图形编辑器,许多专业人士都使用它。它提供了灵活的设计工具,可帮助你创建/操作漂亮的艺术作品。从技术上说,它是 Adobe Illustrator 的直接替代品,但它也提供了一些技巧,可以帮助你将其作为 Photoshop 的替代品。 +[Inkscape][12] 是一个非常流行的开源矢量图形编辑器,许多专业人士都使用它。它提供了灵活的设计工具,可帮助你创作漂亮的艺术作品。从技术上说,它是 Adobe Illustrator 的直接替代品,但它也提供了一些技巧,可以帮助你将其作为 Photoshop 的替代品。 与 GIMP 的官方资源类似,你可以利用 [Inkscape 的教程][13] 来最大程度地利用它。 -**在你看来,真正的 Photoshop 替代品是什么?** +### 在你看来,真正的 Photoshop 替代品是什么? 很难提供与 Adobe Photoshop 完全相同的功能。然而,如果你遵循官方文档和资源,则可以使用上述 Photoshop 替代品做很多很棒的事情。 @@ -122,7 +114,7 @@ via: https://itsfoss.com/open-source-photoshop-alternatives/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[algzjh](https://github.com/algzjh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b8c8e5205f315624d1ba5ad1a95c526393123cac Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 17 Oct 2019 23:39:44 +0800 Subject: [PATCH 016/800] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @algzjh 本文首发地址: https://linux.cn/article-11474-1.html 你的 LCTT 专页地址:https://linux.cn/lctt/algzjh 请注册以领取 LCCN:https://lctt.linux.cn/ --- ... 4 Free and Open Source Alternatives to Adobe Photoshop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md (98%) diff --git a/translated/tech/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md b/published/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md similarity index 98% rename from translated/tech/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md rename to published/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md index 620419048c..447b694c3a 100644 --- a/translated/tech/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md +++ b/published/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (algzjh) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11474-1.html) [#]: subject: (4 Free and Open Source Alternatives to Adobe Photoshop) [#]: via: (https://itsfoss.com/open-source-photoshop-alternatives/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 51554952800cb1dcd4c2d2524c9afd72f32709eb Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 18 Oct 2019 07:28:34 +0800 Subject: [PATCH 017/800] translating --- .../20191013 Object-Oriented Programming and Essential State.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191013 Object-Oriented Programming and Essential State.md b/sources/tech/20191013 Object-Oriented Programming and Essential State.md index 325a4c1f92..b51c726cdd 100644 --- a/sources/tech/20191013 Object-Oriented Programming and Essential State.md +++ b/sources/tech/20191013 Object-Oriented Programming and Essential State.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 64624c055886a473a8e59c9daf08b5507cf70f6b Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Fri, 18 Oct 2019 02:10:02 +0200 Subject: [PATCH 018/800] Update 20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ...5 Use GameHub to Manage All Your Linux Games in One Place.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index 747408db02..5fb1f5d7ef 100644 --- a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wenwensnow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 96f42d7d07240c8a89c5e63ec0df8e5706622d6f Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Fri, 18 Oct 2019 10:10:02 +0800 Subject: [PATCH 019/800] translating --- ...90805 How to Install and Configure PostgreSQL on Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md index 8b9677ba83..a34e64c4a6 100644 --- a/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md +++ b/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lnrCoder) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -243,7 +243,7 @@ via: https://itsfoss.com/install-postgresql-ubuntu/ 作者:[Sergiu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lnrCoder](https://github.com/lnrCoder) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b64273816fe84feb13226cd3ec5bdd35f623dbd6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 11:30:04 +0800 Subject: [PATCH 020/800] APL --- sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md b/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md index 8e49d71a71..10f7a25d23 100644 --- a/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md +++ b/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use sshuttle to build a poor man’s VPN) From 00fab308a26bb6709f393fd5d9ee53835126c1db Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 18 Oct 2019 11:48:14 +0800 Subject: [PATCH 021/800] Revert "APL:20191014 Use sshuttle to build a poor man s VPN" --- sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md b/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md index 10f7a25d23..8e49d71a71 100644 --- a/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md +++ b/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: (wxy) +[#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use sshuttle to build a poor man’s VPN) From c91ade69078e6241c13e9442959c8ee9b3879b25 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 11:55:02 +0800 Subject: [PATCH 022/800] APL --- ...tion Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md b/sources/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md index 353f26db5b..df309499e8 100644 --- a/sources/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md +++ b/sources/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fb236a9597da93a556dbb1ef3a2f430315ee1415 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 12:41:01 +0800 Subject: [PATCH 023/800] TSL --- ...aro 18.1 (KDE Edition) with Screenshots.md | 222 ------------------ ...aro 18.1 (KDE Edition) with Screenshots.md | 218 +++++++++++++++++ 2 files changed, 218 insertions(+), 222 deletions(-) delete mode 100644 sources/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md create mode 100644 translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md diff --git a/sources/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md b/sources/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md deleted file mode 100644 index df309499e8..0000000000 --- a/sources/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md +++ /dev/null @@ -1,222 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots) -[#]: via: (https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/) -[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) - -Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots -====== - -Within a year of releasing **Manjaro 18.0** (**Illyria**), the team has come out with their next big release with **Manjaro 18.1**, codenamed “**Juhraya**“. The team also have come up with an official announcement saying that Juhraya comes packed with a lot of improvements and bug fixes. - -### New Features in Manjaro 18.1 - -Some of the new features and enhancements in Manjaro 18.1 are listed below: - - * Option to choose between LibreOffice or Free Office - * New Matcha theme for Xfce edition - * Redesigned messaging system in KDE edition - * Support for Snap and FlatPak packages using “bhau” tool - - - -### Minimum System Requirements for Manjaro 18.1 - - * 1 GB RAM - * One GHz Processor - * Around 30 GB Hard disk space - * Internet Connection - * Bootable Media (USB/DVD) - - - -### Step by Step Guide to Install Manjaro 18.1 (KDE Edition) - -To start installing Manjaro 18.1 (KDE Edition) in your system, please follow the steps outline below: - -### Step 1) Download Manjaro 18.1 ISO - -Before installing, you need to download the latest copy of Manjaro 18.1 from its official download page located **[here][1]**. Since we are seeing about the KDE version, we chose to install the KDE version. But the installation process is the same for all desktop environments including Xfce, KDE and Gnome editions. - -### Step 2) Create a USB Bootable Disk - -Once you have successfully downloaded the ISO file from Manjaro downloads page, it is time to create an USB disk. Copy the downloaded ISO file in a USB disk and create a bootable disk. Make sure to change your boot settings to boot using a USB and restart your system - -### Step 3) Manjaro Live Installation Environment - -When the system restarts, it will automatically detect the USB drive and starts booting into the Manjaro Live Installation Screen. - -[![Boot-Manjaro-18-1-kde-installation][2]][3] - -Next use the arrow keys to choose “**Boot: Manjaro x86_64 kde**” and hit enter to launch the Manjaro Installer. - -### Step 4) Choose Launch Installer - -Next the Manjaro installer will be launched and If you are connected to the internet, Manjaro will automatically detect your location and time zone. Click “**Launch Installer**” start installing Manjaro 18.1 KDE edition in your system. - -[![Choose-Launch-Installaer-Manjaro18-1-kde][2]][4] - -### Step 5) Choose Your Language - -Next the installer will take you to choose your preferred language. - -[![Choose-Language-Manjaro18-1-Kde-Installation][2]][5] - -Select your desired language and click “Next” - -### Step 6) Choose Your time zone and region - -In the next screen, select your desired time zone and region and click “Next” to continue - -[![Select-Location-During-Manjaro18-1-KDE-Installation][2]][6] - -### Step 7) Choose Keyboard layout - -In the next screen, select your preferred keyboard layout and click “Next” to continue. - -[![Select-Keyboard-Layout-Manjaro18-1-kde-installation][2]][7] - -### Step 8) Choose Partition Type - -This is a very critical step in the installation process. It will allow you to choose between: - - * Erase Disk - * Manual Partitioning - * Install Alongside - * Replace a Partition - - - -If you are installing Manjaro 18.1 in a VM (Virtual Machine), then you won’t be able to see the last 2 options. - -If you are new to Manjaro Linux then I would suggest you should go with first option (**Erase Disk**), it will automatically create required partitions for you. If you want to create custom partitions then choose the second option “**Manual Partitioning**“, as its name suggests it will allow us to create our own custom partitions. - -In this tutorial I will be creating custom partitions by selecting “Manual Partitioning” option, - -[![Manual-Partition-Manjaro18-1-KDE][2]][8] - -Choose the second option and click “Next” to continue. - -As we can see i have 40 GB hard disk, so I will create following partitions on it, - - * /boot       –  2GB (ext4 file system) - * /               –  10 GB (ext4 file system) - * /home     –  22 GB (ext4 file system) - * /opt         –  4 GB (ext4 file system) - * Swap       –  2 GB - - - -When we click on Next in above window, we will get the following screen, choose to create a ‘**new partition table**‘, - -[![Create-Partition-Table-Manjaro18-1-Installation][2]][9] - -Click on Ok, - -Now choose the free space and then click on ‘**create**‘ to setup the first partition as /boot of size 2 GB, - -[![boot-partition-manjaro-18-1-installation][2]][10] - -Click on OK to proceed with further, in the next window choose again free space and then click on create  to setup second partition as / of size 10 GB, - -[![slash-root-partition-manjaro18-1-installation][2]][11] - -Similarly create next partition as /home of size 22 GB, - -[![home-partition-manjaro18-1-installation][2]][12] - -As of now we have created three partitions as primary, now create next partition as extended, - -[![Extended-Partition-Manjaro18-1-installation][2]][13] - -Click on OK to proceed further, - -Create /opt and Swap partition of size 5 GB and 2 GB respectively as logical partitions - -[![opt-partition-manjaro-18-1-installation][2]][14] - -[![swap-partition-manjaro18-1-installation][2]][15] - -Once are done with all the partitions creation, click on Next - -[![choose-next-after-partition-creation][2]][16] - -### Step 9) Provide User Information - -In the next screen, you need to provide the user information including your name, username, password, computer name etc. - -[![User-creation-details-manjaro18-1-installation][2]][17] - -Click “Next” to continue with the installation after providing all the information. - -In the next screen you will be prompted to choose the office suite, so make a choice that suits to your installation, - -[![Office-Suite-Selection-Manjaro18-1][2]][18] - -Click on Next to proceed further, - -### Step 10) Summary Information - -Before the actual installation is done, the installer will show you all the details you’ve chosen including the language, time zone, keyboard layout and partitioning information etc. Click “**Install**” to proceed with the installation process. - -[![Summary-manjaro18-1-installation][2]][19] - -### Step 11) Install Manjaro 18.1 KDE Edition - -Now the actual installation process begins and once it gets completed, restart the system to login to Manjaro 18.1 KDE edition , - -[![Manjaro18-1-Installation-Progress][2]][20] - -[![Restart-Manjaro-18-1-after-installation][2]][21] - -### Step:12) Login after successful installation - -After the restart we will get the following login screen, use the user’s credentials that we created during the installation - -[![Login-screen-after-manjaro-18-1-installation][2]][22] - -Click on Login, - -[![KDE-Desktop-Screen-Manjaro-18-1][2]][23] - -That’s it! You’ve successfully installed Manjaro 18.1 KDE edition in your system and explore all the exciting features. Please post your feedback and suggestions in the comments section below. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/ - -作者:[Pradeep Kumar][a] -选题:[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/pradeep/ -[b]: https://github.com/lujun9972 -[1]: https://manjaro.org/download/official/kde/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Boot-Manjaro-18-1-kde-installation.jpg -[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Launch-Installaer-Manjaro18-1-kde.jpg -[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Language-Manjaro18-1-Kde-Installation.jpg -[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Location-During-Manjaro18-1-KDE-Installation.jpg -[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Keyboard-Layout-Manjaro18-1-kde-installation.jpg -[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manual-Partition-Manjaro18-1-KDE.jpg -[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Create-Partition-Table-Manjaro18-1-Installation.jpg -[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/boot-partition-manjaro-18-1-installation.jpg -[11]: https://www.linuxtechi.com/wp-content/uploads/2019/09/slash-root-partition-manjaro18-1-installation.jpg -[12]: https://www.linuxtechi.com/wp-content/uploads/2019/09/home-partition-manjaro18-1-installation.jpg -[13]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Extended-Partition-Manjaro18-1-installation.jpg -[14]: https://www.linuxtechi.com/wp-content/uploads/2019/09/opt-partition-manjaro-18-1-installation.jpg -[15]: https://www.linuxtechi.com/wp-content/uploads/2019/09/swap-partition-manjaro18-1-installation.jpg -[16]: https://www.linuxtechi.com/wp-content/uploads/2019/09/choose-next-after-partition-creation.jpg -[17]: https://www.linuxtechi.com/wp-content/uploads/2019/09/User-creation-details-manjaro18-1-installation.jpg -[18]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Office-Suite-Selection-Manjaro18-1.jpg -[19]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Summary-manjaro18-1-installation.jpg -[20]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manjaro18-1-Installation-Progress.jpg -[21]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Restart-Manjaro-18-1-after-installation.jpg -[22]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Login-screen-after-manjaro-18-1-installation.jpg -[23]: https://www.linuxtechi.com/wp-content/uploads/2019/09/KDE-Desktop-Screen-Manjaro-18-1.jpg diff --git a/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md b/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md new file mode 100644 index 0000000000..5b389addd3 --- /dev/null +++ b/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md @@ -0,0 +1,218 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots) +[#]: via: (https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +Manjaro 18.1(KDE)安装图解 +====== + +在 Manjaro 18.0(Illyria)发布一年之际,该团队发布了他们的下一个重要版本,即 Manjaro 18.1,代号为 “Juhraya”。该团队还发布了一份官方声明,称 Juhraya 包含了许多改进和错误修复。 + +### Manjaro 18.1 中的新功能 + +以下列出了 Manjaro 18.1 中的一些新功能和增强功能: + +* 可以在 LibreOffice 或 Free Office 之间选择 +* Xfce 版的新 Matcha 主题 +* 在 KDE 版本中重新设计了消息传递系统 +* 使用 bhau 工具支持 Snap 和 FlatPak 软件包 + +### 最小系统需求 + +* 1 GB RAM +* 1 GHz 处理器 +* 大约 30 GB 硬盘空间 +* 互联网连接 +* 启动介质(USB/DVD) + +### 安装 Manjaro 18.1(KDE 版)的分步指南 + +要在系统中开始安装 Manjaro 18.1(KDE 版),请遵循以下步骤: + +#### 步骤 1) 下载 Manjaro 18.1 ISO + +在安装之前,你需要从位于 [这里] [1] 的官方下载页面下载 Manjaro 18.1 的最新副本。由于我们这里介绍的是 KDE 版本,因此我们选择 KDE 版本。但是对于所有桌面环境(包括 Xfce、KDE 和 Gnome 版本),安装过程都是相同的。 + +#### 步骤 2) 创建 USB 启动盘 + +从 Manjaro 下载页面成功下载 ISO 文件后,就可以创建 USB 磁盘了。将下载的 ISO 文件复制到 USB 磁盘中,然后创建可引导磁盘。确保将你的引导设置更改为使用 USB 引导并重新启动系统。 + +#### 步骤 3) Manjaro Live 版安装环境 + +系统重新启动时,它将自动检测到 USB 驱动器并开始启动进入 Manjaro Live 版安装屏幕。 + +![Boot-Manjaro-18-1-kde-installation][3] + +接下来,使用箭头键选择 “启动:Manjaro x86\_64 kdeBoot: Manjaro x86\_64 kde”,然后按回车键以启动 Manjaro 安装程序。 + +#### 安装 4) 选择启动安装程序 + +接下来,将启动 Manjaro 安装程序,如果你已连接到互联网,Manjaro 将自动检测你的位置和时区。单击 “启动安装程序Launch Installer”,开始在系统中安装 Manjaro 18.1 KDE 版本。 + +![Choose-Launch-Installaer-Manjaro18-1-kde][4] + +#### 步骤 5) 选择语言 + +接下来,安装程序将带你选择你的首选语言。 + +![Choose-Language-Manjaro18-1-Kde-Installation][5] + +选择你想要的语言,然后单击“下一步Next”。 + +#### 步骤 6) 选择时区和区域 + +在下一个屏幕中,选择所需的时区和区域,然后单击“下一步Next”继续。 + +![Select-Location-During-Manjaro18-1-KDE-Installation][6] + +#### 步骤 7) 选择键盘布局 + +在下一个屏幕中,选择你喜欢的键盘布局,然后单击“下一步Next”继续。 + +![Select-Keyboard-Layout-Manjaro18-1-kde-installation][7] + +#### 步骤 8) 选择分区类型 + +这是安装过程中非常关键的一步。 它将允许你选择: + +* 擦除磁盘 +* 手动分区 +* 并存安装 +* 替换分区 + +如果要在 VM(虚拟机)中安装 Manjaro 18.1,则将看不到最后两个选项。 + +如果你不熟悉 Manjaro Linux,那么我建议你使用第一个选项(擦除磁盘Erase Disk),它将为你自动创建所需的分区。如果要创建自定义分区,则选择第二个选项“手动分区Manual Partitioning”,顾名思义,它将允许我们创建自己的自定义分区。 + +在本教程中,我将通过选择“手动分区Manual Partitioning”选项来创建自定义分区: + +![Manual-Partition-Manjaro18-1-KDE][8] + +选择第二个选项,然后单击“下一步Next”继续。 + +如我们所见,我有 40 GB 硬盘,因此我将在其上创建以下分区, + +* `/boot`       –  2GB(ext4) +* `/`           –  10 GB(ext4) +* `/home`      –  22 GB(ext4) +* `/opt`       –  4 GB(ext4) +* 交换分区Swap     –  2 GB + +当我们在上方窗口中单击“下一步Next”时,将显示以下屏幕,选择创建“新分区表new partition table”: + +![Create-Partition-Table-Manjaro18-1-Installation][9] + +点击“确定OK”。 + +现在选择可用空间,然后单击“创建create”以将第一个分区设置为大小为 2 GB 的 `/boot`, + +点击“确定OK”。 + +现在选择可用空间,然后单击“创建create”以将第一个分区设置为大小为 2 GB 的 `/boot`: + +![boot-partition-manjaro-18-1-installation][10] + +单击“确定OK”以继续操作,在下一个窗口中再次选择可用空间,然后单击“创建create”以将第二个分区设置为 `/`,大小为 10 GB: + +![slash-root-partition-manjaro18-1-installation][11] + +同样,将下一个分区创建为大小为 22 GB 的 `/home`: + +![home-partition-manjaro18-1-installation][12] + +到目前为止,我们已经创建了三个分区作为主分区,现在创建下一个分区作为扩展分区: + +![Extended-Partition-Manjaro18-1-installation][13] + +单击“确定OK”以继续。 + +创建大小分别为 5 GB 和 2 GB 的 `/opt` 和交换分区作为逻辑分区。 + +![opt-partition-manjaro-18-1-installation][14] + +![swap-partition-manjaro18-1-installation][15] + +完成所有分区的创建后,单击“下一步Next”: + +![choose-next-after-partition-creation][16] + +#### 步骤 9) 提供用户信息 + +在下一个屏幕中,你需要提供用户信息,包括你的姓名、用户名、密码、计算机名等: + +![User-creation-details-manjaro18-1-installation][17] + +提供所有信息后,单击“下一步Next”继续安装。 + +在下一个屏幕中,系统将提示你选择办公套件,因此请做出适合你的选择: + +![Office-Suite-Selection-Manjaro18-1][18] + +单击“下一步Next”以继续。 + +#### 步骤 10) 摘要信息 + +在完成实际安装之前,安装程序将向你显示你选择的所有详细信息,包括语言、时区、键盘布局和分区信息等。单击“安装Install”以继续进行安装过程。 + +![Summary-manjaro18-1-installation][19] + +#### 步骤 11) 进行安装 + +现在,实际的安装过程开始,一旦完成,请重新启动系统以登录到 Manjaro 18.1 KDE 版: + +![Manjaro18-1-Installation-Progress][20] + +![Restart-Manjaro-18-1-after-installation][21] + +#### 步骤 12) 安装成功后登录 + +重新启动后,我们将看到以下登录屏幕,使用我们在安装过程中创建的用户凭据登录: + +![Login-screen-after-manjaro-18-1-installation][22] + +点击“登录Login。 + +![KDE-Desktop-Screen-Manjaro-18-1][23] + +就是这样!你已经在系统中成功安装了 Manjaro 18.1 KDE 版,并探索了所有令人兴奋的功能。请在下面的评论部分中发表你的反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/ + +作者:[Pradeep Kumar][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.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://manjaro.org/download/official/kde/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Boot-Manjaro-18-1-kde-installation.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Launch-Installaer-Manjaro18-1-kde.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Choose-Language-Manjaro18-1-Kde-Installation.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Location-During-Manjaro18-1-KDE-Installation.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Select-Keyboard-Layout-Manjaro18-1-kde-installation.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manual-Partition-Manjaro18-1-KDE.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Create-Partition-Table-Manjaro18-1-Installation.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/09/boot-partition-manjaro-18-1-installation.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/09/slash-root-partition-manjaro18-1-installation.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/09/home-partition-manjaro18-1-installation.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Extended-Partition-Manjaro18-1-installation.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/09/opt-partition-manjaro-18-1-installation.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/09/swap-partition-manjaro18-1-installation.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/09/choose-next-after-partition-creation.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/09/User-creation-details-manjaro18-1-installation.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Office-Suite-Selection-Manjaro18-1.jpg +[19]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Summary-manjaro18-1-installation.jpg +[20]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Manjaro18-1-Installation-Progress.jpg +[21]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Restart-Manjaro-18-1-after-installation.jpg +[22]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Login-screen-after-manjaro-18-1-installation.jpg +[23]: https://www.linuxtechi.com/wp-content/uploads/2019/09/KDE-Desktop-Screen-Manjaro-18-1.jpg From 488aea4892beea68c6aa4a2d4d0d567edf36c28c Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 18 Oct 2019 13:08:50 +0800 Subject: [PATCH 024/800] translated --- ... Use sshuttle to build a poor man-s VPN.md | 81 ------------------- ... Use sshuttle to build a poor man-s VPN.md | 81 +++++++++++++++++++ 2 files changed, 81 insertions(+), 81 deletions(-) delete mode 100644 sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md create mode 100644 translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md diff --git a/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md b/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md deleted file mode 100644 index 8e49d71a71..0000000000 --- a/sources/tech/20191014 Use sshuttle to build a poor man-s VPN.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use sshuttle to build a poor man’s VPN) -[#]: via: (https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/) -[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) - -Use sshuttle to build a poor man’s VPN -====== - -![][1] - -Nowadays, business networks often use a VPN (virtual private network) for [secure communications with workers][2]. However, the protocols used can sometimes make performance slow. If you can reach reach a host on the remote network with SSH, you could set up port forwarding. But this can be painful, especially if you need to work with many hosts on that network. Enter **sshuttle** — which lets you set up a quick and dirty VPN with just SSH access. Read on for more information on how to use it. - -The sshuttle application was designed for exactly the kind of scenario described above. The only requirement on the remote side is that the host must have Python available. This is because sshuttle constructs and runs some Python source code to help transmit data. - -### Installing sshuttle - -The sshuttle application is packaged in the official repositories, so it’s easy to install. Open a terminal and use the following command [with sudo][3]: - -``` -$ sudo dnf install sshuttle -``` - -Once installed, you may find the manual page interesting: - -``` -$ man sshuttle -``` - -### Setting up the VPN - -The simplest case is just to forward all traffic to the remote network. This isn’t necessarily a crazy idea, especially if you’re not on a trusted local network like your own home. Use the _-r_ switch with the SSH username and the remote host name: - -``` -$ sshuttle -r username@remotehost 0.0.0.0/0 -``` - -However, you may want to restrict the VPN to specific subnets rather than all network traffic. (A complete discussion of subnets is outside the scope of this article, but you can read more [here on Wikipedia][4].) Let’s say your office internally uses the reserved Class A subnet 10.0.0.0 and the reserved Class B subnet 172.16.0.0. The command above becomes: - -``` -$ sshuttle -r username@remotehost 10.0.0.0/8 172.16.0.0/16 -``` - -This works great for working with hosts on the remote network by IP address. But what if your office is a large network with lots of hosts? Names are probably much more convenient — maybe even required. Never fear, sshuttle can also forward DNS queries to the office with the _–dns_ switch: - -``` -$ sshuttle --dns -r username@remotehost 10.0.0.0/8 172.16.0.0/16 -``` - -To run sshuttle like a daemon, add the _-D_ switch. This also will send log information to the systemd journal via its syslog compatibility. - -Depending on the capabilities of your system and the remote system, you can use sshuttle for an IPv6 based VPN. You can also set up configuration files and integrate it with your system startup if desired. If you want to read even more about sshuttle and how it works, [check out the official documentation][5]. For a look at the code, [head over to the GitHub page][6]. - -* * * - -_Photo by _[_Kurt Cotoaga_][7]_ on _[_Unsplash_][8]_._ - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/ - -作者:[Paul W. Frields][a] -选题:[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/pfrields/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/sshuttle-816x345.jpg -[2]: https://en.wikipedia.org/wiki/Virtual_private_network -[3]: https://fedoramagazine.org/howto-use-sudo/ -[4]: https://en.wikipedia.org/wiki/Subnetwork -[5]: https://sshuttle.readthedocs.io/en/stable/index.html -[6]: https://github.com/sshuttle/sshuttle -[7]: https://unsplash.com/@kydroon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText -[8]: https://unsplash.com/s/photos/shuttle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md b/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md new file mode 100644 index 0000000000..8da9fa3391 --- /dev/null +++ b/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use sshuttle to build a poor man’s VPN) +[#]: via: (https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +使用 shuttle 构建一个穷人的 VPN +====== + +![][1] + +如今,企业网络经常使用 VPN(虚拟专用网络)[来保证员工通信安全][2]。但是,使用的协议有时会降低性能。如果你可以使用 SSH 连接远程主机,那么你可以设置端口转发。但这可能会很痛苦,尤其是在你需要与该网络上的许多主机一起使用的情况下。试试 **sshuttle**,它可以通过 SSH 访问来设置快速简易的 VPN。请继续阅读以获取有关如何使用它的更多信息。 + +sshuttle 正是针对上述情况而设计的。远程端的唯一要求是主机必须有可用的 Python。这是因为 sshuttle 会构造并运行一些 Python 代码来帮助传输数据。 + +### 安装 sshuttle + +sshuttle 被打包在官方仓库中,因此很容易安装。打开一个终端,并使用[使用 sudo][3] 运行以下命令: + +``` +$ sudo dnf install sshuttle +``` + +安装后,你可能会发现手册页很有趣: + +``` +$ man sshuttle +``` + +### 设置 VPN + +最简单的情况就是将所有流量转发到远程网络。这不一定是一个疯狂的想法,尤其是如果你不在自己家里这样的受信任的本地网络中。将 _-r_ 选项与 SSH 用户名和远程主机名一起使用: + +``` +$ sshuttle -r username@remotehost 0.0.0.0/0 +``` + +但是,你可能希望将 VPN 限制为特定子网,而不是所有网络流量。 (有关子网的完整讨论超出了本文的范围,但是你可以在 [Wikipedia][4] 上阅读更多内容。)假设你的办公室内部使用了预留的 A 类子网 10.0.0.0 和预留的 B 类子网 172.16.0.0。上面的命令变为: + +``` +$ sshuttle -r username@remotehost 10.0.0.0/8 172.16.0.0/16 +``` + +这非常适合通过 IP 地址访问远程网络的主机。但是,如果你的办公室是一个拥有大量主机的大型网络,该怎么办?名称可能更方便,甚至是必须的。不用担心,sshuttle 还可以使用 _–dns_ 选项转发 DNS 查询: + +``` +$ sshuttle --dns -r username@remotehost 10.0.0.0/8 172.16.0.0/16 +``` + +要使 sshuttle 已守护进程运行,请加上 _-D_ 选项。它会以 syslog 兼容的日志格式发送到 systemd 日志中。 + +根据本地和远程系统的功能,可以将 shuttle 用于基于 IPv6 的 VPN。如果需要,你还可以设置配置文件并将其与系统启动集成。如果你想阅读更多有关 sshuttle 及其工作方式的信息,请[查看官方文档][5]。要查看代码,请[进入 GitHub 页面][6]。 + +* * * + +_由 _[_Kurt Cotoaga_][7]_ 拍摄并发表在 _[_Unsplash_][8]_ 上。_ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/ + +作者:[Paul W. Frields][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/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/sshuttle-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Virtual_private_network +[3]: https://fedoramagazine.org/howto-use-sudo/ +[4]: https://en.wikipedia.org/wiki/Subnetwork +[5]: https://sshuttle.readthedocs.io/en/stable/index.html +[6]: https://github.com/sshuttle/sshuttle +[7]: https://unsplash.com/@kydroon?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[8]: https://unsplash.com/s/photos/shuttle?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From 6cefb50a6e591f3207f313ead2e9e841ff6f9de9 Mon Sep 17 00:00:00 2001 From: amwps290 Date: Fri, 18 Oct 2019 16:36:30 +0800 Subject: [PATCH 025/800] Delete 20190830 How to Install Linux on Intel NUC.md --- ...90830 How to Install Linux on Intel NUC.md | 191 ------------------ 1 file changed, 191 deletions(-) delete mode 100644 sources/tech/20190830 How to Install Linux on Intel NUC.md diff --git a/sources/tech/20190830 How to Install Linux on Intel NUC.md b/sources/tech/20190830 How to Install Linux on Intel NUC.md deleted file mode 100644 index c5d4726a40..0000000000 --- a/sources/tech/20190830 How to Install Linux on Intel NUC.md +++ /dev/null @@ -1,191 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (amwps290) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install Linux on Intel NUC) -[#]: via: (https://itsfoss.com/install-linux-on-intel-nuc/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -How to Install Linux on Intel NUC -====== - -The previous week, I got myself an [Intel NUC][1]. Though it is a tiny device, it is equivalent to a full-fledged desktop CPU. Most of the [Linux-based mini PCs][2] are actually built on top of the Intel NUC devices. - -I got the ‘barebone’ NUC with 8th generation Core i3 processor. Barebone means that the device has no RAM, no hard disk and obviously, no operating system. I added an [8GB RAM from Crucial][3] (around $33) and a [240 GB Western Digital SSD][4] (around $45). - -Altogether, I had a desktop PC ready in under $400. I already have a screen and keyboard-mouse pair so I am not counting them in the expense. - -![A brand new Intel NUC NUC8i3BEH at my desk with Raspberry Pi 4 lurking behind][5] - -The main reason why I got Intel NUC is that I want to test and review various Linux distributions on real hardware. I have a [Raspberry Pi 4][6] which works as an entry-level desktop but it’s an [ARM][7] device and thus there are only a handful of Linux distributions available for Raspberry Pi. - -_The Amazon links in the article are affiliate links. Please read our [affiliate policy][8]._ - -### Installing Linux on Intel NUC - -I started with Ubuntu 18.04 LTS version because that’s what I had available at the moment. You can follow this tutorial for other distributions as well. The steps should remain the same at least till the partition step which is the most important one in the entire procedure. - -#### Step 1: Create a live Linux USB - -Download Ubuntu 18.04 from its website. Use another computer to [create a live Ubuntu USB][9]. You can use a tool like [Rufus][10] or [Etcher][11]. On Ubuntu, you can use the default Startup Disk Creator tool. - -#### Step 2: Make sure the boot order is correct - -Insert your USB and power on the NUC. As soon as you see the Intel NUC written on the screen, press F2 to go to BIOS settings. - -![BIOS Settings in Intel NUC][12] - -In here, just make sure that boot order is set to boot from USB first. If not, change the boot order. - -If you had to make any changes, press F10 to save and exit. Else, use Esc to exit the BIOS. - -#### Step 3: Making the correct partition to install Linux - -Now when it boots again, you’ll see the familiar Grub screen that allows you to try Ubuntu live or install it. Choose to install it. - -[][13] - -Suggested read  3 Ways to Check Linux Kernel Version in Command Line - -First few installation steps are simple. You choose the keyboard layout, and the network connection (if any) and other simple steps. - -![Choose the keyboard layout while installing Ubuntu Linux][14] - -You may go with the normal installation that has a handful of useful applications installed by default. - -![][15] - -The interesting screen comes next. You have two options: - - * **Erase disk and install Ubuntu**: Simplest option that will install Ubuntu on the entire disk. If you want to use only one operating system on the Intel NUC, choose this option and Ubuntu will take care of the rest. - * **Something Else**: This is the advanced option if you want to take control of things. In my case, I want to install multiple Linux distribution on the same SSD. So I am opting for this advanced option. - - - -![][16] - -_**If you opt for “Erase disk and install Ubuntu”, click continue and go to the step 4.**_ - -If you are going with the advanced option, follow the rest of the step 3. - -Select the SSD disk and click on New Partition Table. - -![][17] - -It will show you a warning. Just hit Continue. - -![][18] - -Now you’ll see a free space of the size of your SSD disk. My idea is to create an EFI System Partition for the EFI boot loader, a root partition and a home partition. I am not creating a [swap partition][19]. Ubuntu creates a swap file on its own and if the need be, I can extend the swap by creating additional swap files. - -I’ll leave almost 200 GB of free space on the disk so that I could install other Linux distributions here. You can utilize all of it for your home partitions. Keeping separate root and home partitions help you when you want to save reinstall the system - -Select the free space and click on the plus sign to add a partition. - -![][20] - -Usually 100 MB is sufficient for the EFI but some distributions may need more space so I am going with 500 MB of EFI partition. - -![][21] - -Next, I am using 20 GB of root space. If you are going to use only one distributions, you can increase it to 40 GB easily. - -Root is where the system files are kept. Your program cache and installed applications keep some files under the root directory. I recommend [reading about the Linux filesystem hierarchy][22] to get more knowledge on this topic. - -[][23] - -Suggested read  Share Folders On Local Network Between Ubuntu And Windows - -Provide the size, choose Ext4 file system and use / as the mount point. - -![][24] - -The next is to create a home partition. Again, if you want to use only one Linux distribution, go for the remaining free space. Else, choose a suitable disk space for the Home partition. - -Home is where your personal documents, pictures, music, download and other files are stored. - -![][25] - -Now that you have created EFI, root and home partitions, you are ready to install Ubuntu Linux. Hit the Install Now button. - -![][26] - -It will give you a warning about the new changes being written to the disk. Hit continue. - -![][27] - -#### Step 4: Installing Ubuntu Linux - -Things are pretty straightforward from here onward. Choose your time zone right now or change it later. - -![][28] - -On the next screen, choose a username, hostname and the password. - -![][29] - -It’s a wait an watch game for next 7-8 minutes. - -![][30] - -Once the installation is over, you’ll be prompted for a restart. - -![][31] - -When you restart, you should remove the live USB otherwise you’ll boot into the installation media again. - -That’s all you need to do to install Linux on an Intel NUC device. Quite frankly, you can use the same procedure on any other system. - -**Intel NUC and Linux: how do you use it?** - -I am loving the Intel NUC. It doesn’t take space on the desk and yet it is powerful enough to replace the regular bulky desktop CPU. You can easily upgrade it to 32GB of RAM. You can install two SSD on it. Altogether, it provides some scope of configuration and upgrade. - -If you are looking to buy a desktop computer, I highly recommend [Intel NUC][1] mini PC. If you are not comfortable installing the OS on your own, you can [buy one of the Linux-based mini PCs][2]. - -Do you own an Intel NUC? How’s your experience with it? Do you have any tips to share it with us? Do leave a comment below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-linux-on-intel-nuc/ - -作者:[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.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW (Intel NUC) -[2]: https://itsfoss.com/linux-based-mini-pc/ -[3]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 (8GB RAM from Crucial) -[4]: https://www.amazon.com/Western-Digital-240GB-Internal-WDS240G1G0B/dp/B01M9B2VB7?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M9B2VB7 (240 GB Western Digital SSD) -[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/intel-nuc.jpg?resize=800%2C600&ssl=1 -[6]: https://itsfoss.com/raspberry-pi-4/ -[7]: https://en.wikipedia.org/wiki/ARM_architecture -[8]: https://itsfoss.com/affiliate-policy/ -[9]: https://itsfoss.com/create-live-usb-of-ubuntu-in-windows/ -[10]: https://rufus.ie/ -[11]: https://www.balena.io/etcher/ -[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/boot-screen-nuc.jpg?ssl=1 -[13]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ -[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-1_tutorial.jpg?ssl=1 -[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-2_tutorial.jpg?ssl=1 -[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-3_tutorial.jpg?ssl=1 -[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-4_tutorial.jpg?ssl=1 -[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-5_tutorial.jpg?ssl=1 -[19]: https://itsfoss.com/swap-size/ -[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-6_tutorial.jpg?ssl=1 -[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-7_tutorial.jpg?ssl=1 -[22]: https://linuxhandbook.com/linux-directory-structure/ -[23]: https://itsfoss.com/share-folders-local-network-ubuntu-windows/ -[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-8_tutorial.jpg?ssl=1 -[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-9_tutorial.jpg?ssl=1 -[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-10_tutorial.jpg?ssl=1 -[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-11_tutorial.jpg?ssl=1 -[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-12_tutorial.jpg?ssl=1 -[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-13_tutorial.jpg?ssl=1 -[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?ssl=1 -[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-15_tutorial.jpg?ssl=1 From 492c914e29a4775b5eda3635cd0984c4ad2e94c3 Mon Sep 17 00:00:00 2001 From: amwps290 Date: Fri, 18 Oct 2019 16:44:38 +0800 Subject: [PATCH 026/800] Create 20190830 How to Install Linux on Intel NUC.md --- ...90830 How to Install Linux on Intel NUC.md | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 translated/tech/20190830 How to Install Linux on Intel NUC.md diff --git a/translated/tech/20190830 How to Install Linux on Intel NUC.md b/translated/tech/20190830 How to Install Linux on Intel NUC.md new file mode 100644 index 0000000000..9a7589bfc4 --- /dev/null +++ b/translated/tech/20190830 How to Install Linux on Intel NUC.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: (amwps290) +[#]: reviewer: () +[#]: publisher: () +[#]: url: () +[#]: subject: "How to Install Linux on Intel NUC" +[#]: via: "https://itsfoss.com/install-linux-on-intel-nuc/" +[#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" + +在 Intel NUC 上安装 Linux +====== + +在上一周,我给我自己买了一台 [InteL NUC][1]。虽然它是如此之小,但它与成熟的桌面型电脑差别甚小。实际上,大部分的[基于 Linux 的微型 PC][2] 都是基于 Intel NUC 构建的。 + +我买了第 8 代 Core i3 处理器的“准系统” NUC。 准系统意味着该设备没有 RAM,没有硬盘,显然也没有操作系统。我加了一个 [Crucial 的 8 GB 的内存条][3](大约 33 美元)和一个 [240GB 的西数的固态硬盘][4](大约 45 美元)。 + +现在,我已经有了一台不到 400 美元的电脑。因为我已经有了一个电脑屏幕和键鼠套装,所以我没有把它们计算在内。 + +![A brand new Intel NUC NUC8i3BEH at my desk with Raspberry Pi 4 lurking behind][5] + +我买这个 Intel NUC 的主要原因就是我想在实体机上测试各种各样的 Linux 发行版。我已经有一个 [Raspberry Pi 4][6] 设备作为一个入门级的桌面系统,但它是一个 [ARM][7] 设备,因此,只有少数 Linux 发行版可用于 Raspberry Pi 上。 + +这个文章里的亚马逊链接是会员连接。请参阅我们的[会员政策][8]。 + +### 在 NUC 上安装 Linux + +现在我准备安装 Ubuntu 18.04 长期支持版,因为我现在就有这个系统的安装文件。你也可以按照这个教程安装其他的发行版。在最重要的分区之前,前边的步骤都大致相同。 + +### 第一步:创建一个 USB 启动盘 +你可以在 Ubuntu 官网下载它的安装文件。使用另一个电脑去[创建一个 USB 启动盘][9]。你可以使用像 [Rufus][10] 和 [Etcher][11] 这样的软件。在 Ubuntu上,您可以使用默认的 Startup Disk Creator 工具。 + +### 第二步:确认启动顺序的正确性 + +将你的 USB 启动盘插入到你的电脑并开机。一旦你看到 “Intel NUC” 字样出现在你的屏幕上,快速的按下 F2 进入到 BIOS 设置中。 + +![BIOS Settings in Intel NUC][12] + +在这里,仅仅确认你的第一启动项是你的 USB 设备 。如果不是,切换启动顺序。 + +如果你修改了一些选项,按 F10 保存退出,否则直接按下 ESC 退出 BIOS 设置。 + +#### 第三步:正确分区,安装 Linux + +现在当机器重启的时候,你就可以看到熟悉的 Grub 界面,可以让你试用或者安装 Ubuntu。现在我们选择安装它。 + +[][13] + +建议你看一下如何在命令行中查看 Linux 内核版本。 + +开始的几个安装步骤非常简单,选择键盘的布局,是否连接网络还有一些其他简单的设置。 + +![Choose the keyboard layout while installing Ubuntu Linux][14] + +您可能会使用常规安装,默认情况下会安装一些有用的应用程序。 + +![][15] + +接下来的内容非常有趣。 您有两种选择: + +* **擦除磁盘并安装 Ubuntu**:最简单的选项,它将在整个磁盘上安装 Ubuntu。 如果您只想在 Intel NUC 上使用一个操作系统,请选择此选项,Ubuntu 将负责剩余的工作。 + +* **其他选项**:这是一个控制所有事的高级选项。 就我而言,我想在同一 SSD 上安装多个 Linux 发行版。 因此,我选择了此高级选项。 + + +![][16] + +_**如果你选择了擦除并安装 Ubuntu,点击继续,直接跳到第四步,**_ + +如果你选择了高级选项,请按照下面的第三步进行操作。 + +选择固态硬盘,然后点击新的分区表 + +![][17] + +它会给你显示一个警告。直接点击继续。 + +![][18] + +现在你就可以看到你 SSD 磁盘里的空闲空间。我的想法是为 EFI bootloader 创建一个 EFI 系统分区。一个根(root)分区,一个主目录(home)分区。这里我并没有创建[交换分区][19]。Ubuntu 会根据自己的需要来创建交换分区。我也可以通过创建新的交换文件来扩展交换分区。 + +我将在磁盘上保留近 200 GB 的可用空间,以便可以在此处安装其他 Linux 发行版。 您可以将其全部用于主目录分区。 保留单独的根分区和主分区可以在您需要保存时帮助您重新安装系统 + +选择可用空间,然后单击加号以添加分区。 + +![][20] + + + +一般来说,100MB 足够 EFI 的使用,但是某些发行版可能需要更多空间,因此我要使用 500MB 的 EFI 分区。 + +![][21] + +接下来,我将使用 20GB 的根分区。 如果你只使用一个发行版,则可以随意地将其增加到 40GB。 + +Root 目录是系统文件存放的地方。你的程序缓存和你安装的程序将会有一些文件放在这个目录下边。我建议你可以阅读一下[ Linux 文件系统层次结构][22]来了解更多相关内容。 + +[][23] + +建议你阅读一下如何在 Ubuntu 和 Windows 之间共享文件 + +填入分区的大小,选择 Ext4 文件系统,选择 / 作为挂载点。 + +![][24] + +接下来是创建一个主目录分区,我再说一下,如果你仅仅想使用一个 Linux 发行版。那就把剩余的空间都使用完吧。为主目录分区选择一个合适的大小。 + +主目录是你个人的文件,比如文档,图片,音乐,下载和一些其他的文件存储的地方。 + +![][25] + +既然你创建好了 EFI 分区,根分区,主目录分区,那你就可以点击安装按钮安装系统了。 + +![][26] + +他将会提示你新的改变将会被写入到磁盘,点击继续。 + +![][27] + +#### 第四步:安装 Ubuntu +事情到了这就非常明了了。现在选择你的分区或者以后选择也可以。 + +![][28] + +接下来,输入你的用户名,主机名以及密码。 + +![][29] + +看 7-8 分钟的动画就可以安装完成了。 + +![][30] + +一旦安装完成,你就可以重新启动了。 + +![][31] + +当你重启的时候,你必须要移除你的 USB 设备,否则你将会再次进入安装系统的界面。 + +这就是在 Intel NUC 设备上安装 Linux 所需要做的一切。 坦白说,您可以在其他任何系统上使用相同的过程。 + +**Intel NUC 和 Linux 在一起:如何使用它?** + +我非常喜欢 Intel NUC。它不占用太多的桌面空间,而且有足够的能力去取代传统的桌面型电脑。你可以将它的内存升级到 32GB。你也可以安装两个 SSD 硬盘。总之,它提供了一些配置和升级范围。 + +如果你想购买一个桌面型的电脑,我非常推荐你购买使用 [Intel NUC][1] 迷你主机。如果你不想自己安装系统,那么你可以购买一个[基于 Linux 的已经安装好的系统迷你主机][2]。 + + +你是否已经有了一个 Intel NUC?有一些什么相关的经验?你有什么相关的意见与我们分享吗?可以在下面评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-linux-on-intel-nuc/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[amwps290](https://github.com/amwps290) +校对:[校对者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.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW "Intel NUC" +[2]: https://itsfoss.com/linux-based-mini-pc/ +[3]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 "8GB RAM from Crucial" +[4]: https://www.amazon.com/Western-Digital-240GB-Internal-WDS240G1G0B/dp/B01M9B2VB7?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01M9B2VB7 "240 GB Western Digital SSD" +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/intel-nuc.jpg?resize=800%2C600&ssl=1 +[6]: https://itsfoss.com/raspberry-pi-4/ +[7]: https://en.wikipedia.org/wiki/ARM_architecture +[8]: https://itsfoss.com/affiliate-policy/ +[9]: https://itsfoss.com/create-live-usb-of-ubuntu-in-windows/ +[10]: https://rufus.ie/ +[11]: https://www.balena.io/etcher/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/boot-screen-nuc.jpg?ssl=1 +[13]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-1_tutorial.jpg?ssl=1 +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-2_tutorial.jpg?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-3_tutorial.jpg?ssl=1 +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-4_tutorial.jpg?ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-5_tutorial.jpg?ssl=1 +[19]: https://itsfoss.com/swap-size/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-6_tutorial.jpg?ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-7_tutorial.jpg?ssl=1 +[22]: https://linuxhandbook.com/linux-directory-structure/ +[23]: https://itsfoss.com/share-folders-local-network-ubuntu-windows/ +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-8_tutorial.jpg?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-9_tutorial.jpg?ssl=1 +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-10_tutorial.jpg?ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-11_tutorial.jpg?ssl=1 +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-12_tutorial.jpg?ssl=1 +[29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-13_tutorial.jpg?ssl=1 +[30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?ssl=1 +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-15_tutorial.jpg?ssl=1 From 567b0c2d1b21ff6110a536211514641d09ed082f Mon Sep 17 00:00:00 2001 From: laingke Date: Fri, 18 Oct 2019 18:00:00 +0800 Subject: [PATCH 027/800] 20190614-what-java-constructor translating --- sources/tech/20190614 What is a Java constructor.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20190614 What is a Java constructor.md b/sources/tech/20190614 What is a Java constructor.md index 66cd30110d..0c4a9cbf16 100644 --- a/sources/tech/20190614 What is a Java constructor.md +++ b/sources/tech/20190614 What is a Java constructor.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -138,7 +138,7 @@ via: https://opensource.com/article/19/6/what-java-constructor 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2994c9baf2fe94f36244894f8dcd5188a2b8749c Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Fri, 18 Oct 2019 18:24:35 +0800 Subject: [PATCH 028/800] translated --- ...tall and Configure PostgreSQL on Ubuntu.md | 267 ------------------ ...tall and Configure PostgreSQL on Ubuntu.md | 263 +++++++++++++++++ 2 files changed, 263 insertions(+), 267 deletions(-) delete mode 100644 sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md create mode 100644 translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md diff --git a/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md deleted file mode 100644 index a34e64c4a6..0000000000 --- a/sources/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md +++ /dev/null @@ -1,267 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lnrCoder) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu) -[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How to Install and Configure PostgreSQL on Ubuntu -====== - -_**In this tutorial, you’ll learn how to install and use the open source database PostgreSQL on Ubuntu Linux.**_ - -[PostgreSQL][1] (or Postgres) is a powerful, free and open-source relational database management system ([RDBMS][2]) that has a strong reputation for reliability, feature robustness, and performance. It is designed to handle various tasks, of any size. It is cross-platform, and the default database for [macOS Server][3]. - -PostgreSQL might just be the right tool for you if you’re a fan of a simple to use SQL database manager. It supports SQL standards and offers additional features, while also being heavily extendable by the user as the user can add data types, functions, and do many more things. - -Earlier I discussed [installing MySQL on Ubuntu][4]. In this article, I’ll show you how to install and configure PostgreSQL, so that you are ready to use it to suit whatever your needs may be. - -![][5] - -### Installing PostgreSQL on Ubuntu - -PostgreSQL is available in Ubuntu main repository. However, like many other development tools, it may not be the latest version. - -First check the PostgreSQL version available in [Ubuntu repositories][6] using this [apt command][7] in the terminal: - -``` -apt show postgresql -``` - -In my Ubuntu 18.04, it showed that the available version of PostgreSQL is version 10 (10+190 means version 10) whereas PostgreSQL version 11 is already released. - -``` -Package: postgresql -Version: 10+190 -Priority: optional -Section: database -Source: postgresql-common (190) -Origin: Ubuntu -``` - -Based on this information, you can make your mind whether you want to install the version available from Ubuntu or you want to get the latest released version of PostgreSQL. - -I’ll show both methods to you. - -#### Method 1: Install PostgreSQL from Ubuntu repositories - -In the terminal, use the following command to install PostgreSQL - -``` -sudo apt update -sudo apt install postgresql postgresql-contrib -``` - -Enter your password when asked and you should have it installed in a few seconds/minutes depending on your internet speed. Speaking of that, feel free to check various [network bandwidth in Ubuntu][8]. - -What is postgresql-contrib? - -The postgresql-contrib or the contrib package consists some additional utilities and functionalities that are not part of the core PostgreSQL package. In most cases, it’s good to have the contrib package installed along with the PostgreSQL core. - -[][9] - -Suggested read  Fix gvfsd-smb-browse Taking 100% CPU In Ubuntu 16.04 - -#### Method 2: Installing the latest version 11 of PostgreSQL in Ubuntu - -To install PostgreSQL 11, you need to add the official PostgreSQL repository in your sources.list, add its certificate and then install it from there. - -Don’t worry, it’s not complicated. Just follow these steps. - -Add the GPG key first: - -``` -wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - -``` - -Now add the repository with the below command. If you are using Linux Mint, you’ll have to manually replace the `lsb_release -cs` the Ubuntu version your Mint release is based on. - -``` -sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' -``` - -Everything is ready now. Install PostgreSQL with the following commands: - -``` -sudo apt update -sudo apt install postgresql postgresql-contrib -``` - -PostgreSQL GUI application - -You may also install a GUI application (pgAdmin) for managing PostgreSQL databases: - -_sudo apt install pgadmin4_ - -### Configuring PostgreSQL - -You can check if **PostgreSQL** is running by executing: - -``` -service postgresql status -``` - -Via the **service** command you can also **start**, **stop** or **restart** **postgresql**. Typing in **service postgresql** and pressing **Enter** should output all options. Now, onto the users. - -By default, PostgreSQL creates a special user postgres that has all rights. To actually use PostgreSQL, you must first log in to that account: - -``` -sudo su postgres -``` - -Your prompt should change to something similar to: - -``` -[email protected]:/home/ubuntu$ -``` - -Now, run the **PostgreSQL Shell** with the utility **psql**: - -``` -psql -``` - -You should be prompted with: - -``` -postgress=# -``` - -You can type in **\q** to **quit** and **\?** for **help**. - -To see all existing tables, enter: - -``` -\l -``` - -The output will look similar to this (Hit the key **q** to exit this view): - -![PostgreSQL Tables][10] - -With **\du** you can display the **PostgreSQL users**: - -![PostgreSQLUsers][11] - -You can change the password of any user (including **postgres**) with: - -``` -ALTER USER postgres WITH PASSWORD 'my_password'; -``` - -**Note:** _Replace **postgres** with the name of the user and **my_password** with the wanted password._ Also, don’t forget the **;** (**semicolumn**) after every statement. - -It is recommended that you create another user (it is bad practice to use the default **postgres** user). To do so, use the command: - -``` -CREATE USER my_user WITH PASSWORD 'my_password'; -``` - -If you run **\du**, you will see, however, that **my_user** has no attributes yet. Let’s add **Superuser** to it: - -``` -ALTER USER my_user WITH SUPERUSER; -``` - -You can **remove users** with: - -``` -DROP USER my_user; -``` - -To **log in** as another user, quit the prompt (**\q**) and then use the command: - -``` -psql -U my_user -``` - -You can connect directly to a database with the **-d** flag: - -``` -psql -U my_user -d my_db -``` - -You should call the PostgreSQL user the same as another existing user. For example, my use is **ubuntu**. To log in, from the terminal I use: - -``` -psql -U ubuntu -d postgres -``` - -**Note:** _You must specify a database (by default it will try connecting you to the database named the same as the user you are logged in as)._ - -If you have a the error: - -``` -psql: FATAL: Peer authentication failed for user "my_user" -``` - -Make sure you are logging as the correct user and edit **/etc/postgresql/11/main/pg_hba.conf** with administrator rights: - -``` -sudo vim /etc/postgresql/11/main/pg_hba.conf -``` - -**Note:** _Replace **11** with your version (e.g. **10**)._ - -Here, replace the line: - -``` -local all postgres peer -``` - -With: - -``` -local all postgres md5 -``` - -Then restart **PostgreSQL**: - -``` -sudo service postgresql restart -``` - -Using **PostgreSQL** is the same as using any other **SQL** type database. I won’t go into the specific commands, since this article is about getting you started with a working setup. However, here is a [very useful gist][12] to reference! Also, the man page (**man psql**) and the [documentation][13] are very helpful. - -[][14] - -Suggested read  [How To] Share And Sync Any Folder With Dropbox in Ubuntu - -**Wrapping Up** - -Reading this article has hopefully guided you through the process of installing and preparing PostgreSQL on an Ubuntu system. If you are new to SQL, you should read this article to know the [basic SQL commands][15]: - -[Basic SQL Commands][15] - -If you have any issues or questions, please feel free to ask in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-postgresql-ubuntu/ - -作者:[Sergiu][a] -选题:[lujun9972][b] -译者:[lnrCoder](https://github.com/lnrCoder) -校对:[校对者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://www.postgresql.org/ -[2]: https://www.codecademy.com/articles/what-is-rdbms-sql -[3]: https://www.apple.com/in/macos/server/ -[4]: https://itsfoss.com/install-mysql-ubuntu/ -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-postgresql-ubuntu.png?resize=800%2C450&ssl=1 -[6]: https://itsfoss.com/ubuntu-repositories/ -[7]: https://itsfoss.com/apt-command-guide/ -[8]: https://itsfoss.com/network-speed-monitor-linux/ -[9]: https://itsfoss.com/fix-gvfsd-smb-high-cpu-ubuntu/ -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_tables.png?fit=800%2C303&ssl=1 -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_users.png?fit=800%2C244&ssl=1 -[12]: https://gist.github.com/Kartones/dd3ff5ec5ea238d4c546 -[13]: https://www.postgresql.org/docs/manuals/ -[14]: https://itsfoss.com/sync-any-folder-with-dropbox/ -[15]: https://itsfoss.com/basic-sql-commands/ diff --git a/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md new file mode 100644 index 0000000000..3da0f81114 --- /dev/null +++ b/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md @@ -0,0 +1,263 @@ +[#]: collector: (lujun9972) +[#]: translator: (lnrCoder) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu) +[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu 上安装和配置 PostgreSQL +====== + +_**本教程中,你将学习如何在 Ubuntu Linux 上安装和使用开源数据库 PostgreSQL。**_ + +[PostgreSQL][1] (又名 Postgres) 是一个功能强大的,免费的开源关系型数据库管理系统 ([RDBMS][2]) 其 在可靠性、稳定性、性能方面获得了业内极高的声誉 。它旨在处理各种规模的任务。它是跨平台的,而且是 [macOS Server][3] 的默认数据库。 + +如果你喜欢简单易用的 SQL 数据库管理器,那么 PostgreSQL 将是一个正确的选择。PostgreSQL 对标准的 SQL 兼容的同时提供了额外的附加特性,同时还可以被用户大量扩展,用户可以添加数据类型、函数并执行更多的操作。 + +之前我曾论述过 [在 Ubuntu 上安装 MySQL][4]。在本文中,我将向你展示如何安装和配置 PostgreSQL,以便你随时可以使用它来满足你的任何需求。 + +![][5] + +### 在 Ubuntu 上安装 PostgreSQL + +PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其他开发工具一样,它可能不是最新版本。 + +首先在终端中使用 [apt 命令][7] 检查 [Ubuntu 存储库][6] 中可用的 PostgreSQL 版本: + +``` +apt show postgresql +``` + +在我的 Ubuntu 18.04 中,它显示 PostgreSQL 的可用版本是 10 (10+190 表示版本 10) 而 PostgreSQL 版本 11 已经发布。 + +``` +Package: postgresql +Version: 10+190 +Priority: optional +Section: database +Source: postgresql-common (190) +Origin: Ubuntu +``` + +根据这些信息,你可以自主决定是安装 Ubuntu 提供的版本还是还是获取 PostgreSQL 的最新发行版。 + +我将向你介绍这两种方法: + +#### 方法一:通过 Ubuntu 存储库安装 PostgreSQL + +在终端中,使用以下命令安装 PostgreSQL + +``` +sudo apt update +sudo apt install postgresql postgresql-contrib +``` + +根据提示输入你的密码,依据于你的网速情况,程序将在几秒到几分钟安装完成。 说到这一点 ,随时检查 [Ubuntu 中的各种网络带宽][8]。 + +什么是 postgresql-contrib? + +postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核心包的实用工具和功能。在大多数情况下,最好将 contrib 包与 PostgreSQL 核心一起安装。 + +推荐阅读 [解决 gvfsd-smb-browser 在 Ubuntu 16.04 中占用 100% CPU][9] + +#### 方法二:在 Ubuntu 中安装最新版本的 PostgreSQL 11 + +要安装 PostgreSQL 11, 你需要在 sources.list 中添加官方 PostgreSQL 存储库和证书,然后从那里安装它。 + +不用担心,这并不复杂。 只需按照以下步骤。 + +首先添加 GPG 密钥: + +``` +wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - +``` + +现在,使用以下命令添加存储库。如果你使用的是 Linux Mint,则必须手动替换你的 Mint 所基于的 Ubuntu 版本号 + +``` +sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' +``` + +现在一切就绪。使用以下命令安装 PostgreSQL: + +``` +sudo apt update +sudo apt install postgresql postgresql-contrib +``` + +PostgreSQL GUI 应用程序 + +你也可以安装用于管理 PostgreSQL 数据库的 GUI 应用程序 (pgAdmin): + +_sudo apt install pgadmin4_ + +### PostgreSQL 配置 + +你可以通过执行以下命令来检查 **PostgreSQL** 是否正在运行: + +``` +service postgresql status +``` + +通过 **service** 命令,你可以 **启动**, **关闭** 或 **重启** **postgresql**。输入 **service postgresql** 并按 **回车** 将列出所有选项。现在,登录用户。 + +默认情况下,PostgreSQL 会创建一个拥有所权限的特殊用户 postgres 。要实际使用 PostgreSQL,你必须先登录该账户: + +``` +sudo su postgres +``` + +你的提示应更改为类似于以下的内容: + +``` +postgres@ubuntu-VirtualBox:/home/ubuntu$ +``` + +现在,使用 **psql** 来启动 **PostgreSQL Shell** : + +``` +psql +``` + +你应该会收到如下提示: + +``` +postgress=# +``` + +你可以输入 **\q** 以**退出**,输入 **\?** 获取**帮助**。 + +要查看现有的所有表,输入如下命令: + +``` +\l +``` + +输出内容类似于下图所示 (单击 **q** 键退出该视图): + +![PostgreSQL Tables][10] + +使用 **\du** 命令,你可以查看 **PostgreSQL 用户**: + +![PostgreSQLUsers][11] + +你可以使用以下命令更改任何用户(包括 postgres)的密码: + +``` +ALTER USER postgres WITH PASSWORD 'my_password'; +``` + +**注意:** _将 **postgres** 替换为用户名 **my_password** 替换为所需要的密码。_ 另外,不要忘记每条命令后面的 **;** (分号)。 + +建议你另外创建一个用户(不建议使用默认的 **postgres** 用户)。为此,请使用一下命令: + +``` +CREATE USER my_user WITH PASSWORD 'my_password'; +``` + +运行 **\du**,你将看到该用户,但是,**my_user** 用户没有任何的属性。来让我们将它添加到**超级用户**: + +``` +ALTER USER my_user WITH SUPERUSER; +``` + +你可以使用以下命令 **删除用户** : + +``` +DROP USER my_user; +``` + +要使用其他用户登录,使用 **\q** 命令退出,然后使用以下命令登录: + +``` +psql -U my_user +``` + +你可以使用 **-d** 参数直接连接数据库: + +``` +psql -U my_user -d my_db +``` + +你可以使用其他已存在的用户调用 PostgreSQL。例如,我使用 **ubuntu**。要登录,从终端执行以下命名: + +``` +psql -U ubuntu -d postgres +``` + +**注意:** _你必须指定一个数据库(默认情况下,它将尝试将你连接到与登录的用户名相同的数据库)。_ + +如果遇到如下错误: + +``` +psql: FATAL: Peer authentication failed for user "my_user" +``` + +确保以正确的用户身份登录,并使用管理员权限编辑 **/etc/postgresql/11/main/pg_hba.conf** + +``` +sudo vim /etc/postgresql/11/main/pg_hba.conf +``` + +**注意:** _用你的版本替换 **11** (例如 **10**)._ + +对如下所示的一行进行替换: + +``` +local all postgres peer +``` + +替换为: + +``` +local all postgres md5 +``` + +然后重启 **PostgreSQL**: + +``` +sudo service postgresql restart +``` + +使用 **PostgreSQL** 与使用其他 **SQL** 类型的数据库相同。由于本文旨在帮助你进行初步的设置,因此不涉及具体的命令。不过,这里有个 [非常有用的要点][12] 可供参考! 另外, 手册 (**man psql**) 和 [文档][13] 也非常有用。 + +建议阅读 [如何][14] 在 Ubuntu 中与 Dropbox 共享和同步任何文件夹。 + +**总结** + +阅读本文有望指导你完成在 Ubuntu 系统上安装和准备 PostgreSQL 的过程。如果你不熟悉 SQL,你应该阅读 [基本的 SQL 命令][15] + +[基本的 SQL 命令][15] + +如果您有任何问题或疑惑,请随时在评论部分提出。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-postgresql-ubuntu/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[lnrCoder](https://github.com/lnrCoder) +校对:[校对者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://www.postgresql.org/ +[2]: https://www.codecademy.com/articles/what-is-rdbms-sql +[3]: https://www.apple.com/in/macos/server/ +[4]: https://itsfoss.com/install-mysql-ubuntu/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-postgresql-ubuntu.png?resize=800%2C450&ssl=1 +[6]: https://itsfoss.com/ubuntu-repositories/ +[7]: https://itsfoss.com/apt-command-guide/ +[8]: https://itsfoss.com/network-speed-monitor-linux/ +[9]: https://itsfoss.com/fix-gvfsd-smb-high-cpu-ubuntu/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_tables.png?fit=800%2C303&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/07/postgresql_users.png?fit=800%2C244&ssl=1 +[12]: https://gist.github.com/Kartones/dd3ff5ec5ea238d4c546 +[13]: https://www.postgresql.org/docs/manuals/ +[14]: https://itsfoss.com/sync-any-folder-with-dropbox/ +[15]: https://itsfoss.com/basic-sql-commands/ From cb52871f6205d15cd7c8d7558f0acfbc8ce62549 Mon Sep 17 00:00:00 2001 From: laingke Date: Fri, 18 Oct 2019 19:42:08 +0800 Subject: [PATCH 029/800] 20190614-what-java-constructor translated --- .../20190614 What is a Java constructor.md | 158 ------------------ .../20190614 What is a Java constructor.md | 156 +++++++++++++++++ 2 files changed, 156 insertions(+), 158 deletions(-) delete mode 100644 sources/tech/20190614 What is a Java constructor.md create mode 100644 translated/tech/20190614 What is a Java constructor.md diff --git a/sources/tech/20190614 What is a Java constructor.md b/sources/tech/20190614 What is a Java constructor.md deleted file mode 100644 index 0c4a9cbf16..0000000000 --- a/sources/tech/20190614 What is a Java constructor.md +++ /dev/null @@ -1,158 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (laingke) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is a Java constructor?) -[#]: via: (https://opensource.com/article/19/6/what-java-constructor) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/ashleykoree) - -What is a Java constructor? -====== -Constructors are powerful components of programming. Use them to unlock -the full potential of Java. -![][1] - -Java is (disputably) the undisputed heavyweight in open source, cross-platform programming. While there are many [great][2] [cross-platform][2] [frameworks][3], few are as unified and direct as [Java][4]. - -Of course, Java is also a pretty complex language with subtleties and conventions all its own. One of the most common questions about Java relates to **constructors** : What are they and what are they used for? - -Put succinctly: a constructor is an action performed upon the creation of a new **object** in Java. When your Java application creates an instance of a class you have written, it checks for a constructor. If a constructor exists, Java runs the code in the constructor while creating the instance. That's a lot of technical terms crammed into a few sentences, but it becomes clearer when you see it in action, so make sure you have [Java installed][5] and get ready for a demo. - -### Life without constructors - -If you're writing Java code, you're already using constructors, even though you may not know it. All classes in Java have a constructor because even if you haven't created one, Java does it for you when the code is compiled. For the sake of demonstration, though, ignore the hidden constructor that Java provides (because a default constructor adds no extra features), and take a look at life without an explicit constructor. - -Suppose you're writing a simple Java dice-roller application because you want to produce a pseudo-random number for a game. - -First, you might create your dice class to represent a physical die. Knowing that you play a lot of [Dungeons and Dragons][6], you decide to create a 20-sided die. In this sample code, the variable **dice** is the integer 20, representing the maximum possible die roll (a 20-sided die cannot roll more than 20). The variable **roll** is a placeholder for what will eventually be a random number, and **rand** serves as the random seed. - - -``` -import java.util.Random; - -public class DiceRoller { -private int dice = 20; -private int roll; -private [Random][7] rand = new [Random][7](); -``` - -Next, create a function in the **DiceRoller** class to execute the steps the computer must take to emulate a die roll: Take an integer from **rand** and assign it to the **roll** variable, add 1 to account for the fact that Java starts counting at 0 but a 20-sided die has no 0 value, then print the results. - - -``` -public void Roller() { -roll = rand.nextInt(dice); -roll += 1; -[System][8].out.println (roll); -} -``` - -Finally, spawn an instance of the **DiceRoller** class and invoke its primary function, **Roller** : - - -``` -// main loop -public static void main ([String][9][] args) { -[System][8].out.printf("You rolled a "); - -DiceRoller App = new DiceRoller(); -App.Roller(); -} -} -``` - -As long as you have a Java development environment installed (such as [OpenJDK][10]), you can run your application from a terminal: - - -``` -$ java dice.java -You rolled a 12 -``` - -In this example, there is no explicit constructor. It's a perfectly valid and legal Java application, but it's a little limited. For instance, if you set your game of Dungeons and Dragons aside for the evening to play some Yahtzee, you would need 6-sided dice. In this simple example, it wouldn't be that much trouble to change the code, but that's not a realistic option in complex code. One way you could solve this problem is with a constructor. - -### Constructors in action - -The **DiceRoller** class in this example project represents a virtual dice factory: When it's called, it creates a virtual die that is then "rolled." However, by writing a custom constructor, you can make your Dice Roller application ask what kind of die you'd like to emulate. - -Most of the code is the same, with the exception of a constructor accepting some number of sides. This number doesn't exist yet, but it will be created later. - - -``` -import java.util.Random; - -public class DiceRoller { -private int dice; -private int roll; -private [Random][7] rand = new [Random][7](); - -// constructor -public DiceRoller(int sides) { -dice = sides; -} -``` - -The function emulating a roll remains unchanged: - - -``` -public void Roller() { -roll = rand.nextInt(dice); -roll += 1; -[System][8].out.println (roll); -} -``` - -The main block of code feeds whatever arguments you provide when running the application. Were this a complex application, you would parse the arguments carefully and check for unexpected results, but for this sample, the only precaution taken is converting the argument string to an integer type: - - -``` -public static void main ([String][9][] args) { -[System][8].out.printf("You rolled a "); -DiceRoller App = new DiceRoller( [Integer][11].parseInt(args[0]) ); -App.Roller(); -} -} -``` - -Launch the application and provide the number of sides you want your die to have: - - -``` -$ java dice.java 20 -You rolled a 10 -$ java dice.java 6 -You rolled a 2 -$ java dice.java 100 -You rolled a 44 -``` - -The constructor has accepted your input, so when the class instance is created, it is created with the **sides** variable set to whatever number the user dictates. - -Constructors are powerful components of programming. Practice using them to unlock the full potential of Java. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/what-java-constructor - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth/users/ashleykoree -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/build_structure_tech_program_code_construction.png?itok=nVsiLuag -[2]: https://opensource.com/resources/python -[3]: https://opensource.com/article/17/4/pyqt-versus-wxpython -[4]: https://opensource.com/resources/java -[5]: https://openjdk.java.net/install/index.html -[6]: https://opensource.com/article/19/5/free-rpg-day -[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random -[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system -[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string -[10]: https://openjdk.java.net/ -[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer diff --git a/translated/tech/20190614 What is a Java constructor.md b/translated/tech/20190614 What is a Java constructor.md new file mode 100644 index 0000000000..42ac00bc2c --- /dev/null +++ b/translated/tech/20190614 What is a Java constructor.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is a Java constructor?) +[#]: via: (https://opensource.com/article/19/6/what-java-constructor) +[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/ashleykoree) + +Java 构造器是什么? +====== +构造器是编程的强大组件。使用它们来释放 Java 的全部潜力。 +![][1] + +在开源、跨平台编程领域,Java 无疑是无可争议的重量级语言。尽管有许多[伟大的][2][跨平台][2][框架][3],但很少有像 [Java][4] 那样统一和直接的。 + +当然,Java 还是一种非常复杂的语言,具有自己的微妙之处和约定。Java 中与**构造器**有关的最常见问题之一是:它们是什么,它们的作用是什么? + +简而言之:构造器是在 Java 中创建新**对象**时执行的操作。当 Java 应用程序创建你编写的类的实例时,它将检查构造器。如果存在构造器,则 Java 在创建实例时将运行构造器中的代码。这几句话中包含了大量的技术术语,但是当你看到它的实际应用时就会更加清楚,所以请确保你已经[安装了 Java][5] 并准备好进行演示。 + +### 没有使用构造器的开发日常 + +如果你正在编写 Java 代码,那么你已经在使用构造器了,即使你可能不知道它。Java 中的所有类都有一个构造器,因为即使你没有创建构造器,Java 也会在编译代码时为你完成。但是,为了进行演示,请忽略 Java 提供的隐藏构造器(因为默认构造器不添加任何额外的功能),并观察没有显式构造器的情况。 + +假设你正在编写一个简单的 Java 掷骰子应用程序,因为你想为游戏生成一个伪随机数。 + +首先,你可以创建 dice 类来表示一个骰子。知道你玩了很久[《龙与地下城》][6],你决定创建一个 20 面的骰子。在这个示例代码中,变量 **dice** 是整数 20,表示可能的最大掷骰数(一个 20 边骰子的掷骰数不能超过 20)。变量 **roll** 是最终的随机数的占位符,**rand** 用作随机数种子。 + + +``` +import java.util.Random; + +public class DiceRoller { +private int dice = 20; +private int roll; +private [Random][7] rand = new [Random][7](); +``` + +接下来,在 **DiceRoller** 类中创建一个函数,以执行计算机模拟模子滚动所必须采取的步骤:从 **rand** 中获取一个整数并将其分配给 **roll**变量,考虑到 Java 从 0 开始计数但 20 面的骰子没有 0 值的情况,**roll** 再加 1 ,然后打印结果。 + + +``` +public void Roller() { +roll = rand.nextInt(dice); +roll += 1; +[System][8].out.println (roll); +} +``` + +最后,产生 **DiceRoller** 类的实例并调用其关键函数 **Roller**: + +``` +// main loop +public static void main ([String][9][] args) { +[System][8].out.printf("You rolled a "); + +DiceRoller App = new DiceRoller(); +App.Roller(); +} +} +``` + +只要你安装了 Java 开发环境(如 [OpenJDK][10]),你就可以在终端上运行你的应用程序: + + +``` +$ java dice.java +You rolled a 12 +``` + +在本例中,没有显式构造器。这是一个非常有效和合法的 Java 应用程序,但是它有一点局限性。例如,如果你把游戏《龙与地下城》放在一边,晚上去玩一些《快艇骰子》,你将需要六面骰子。在这个简单的例子中,更改代码不会有太多的麻烦,但是在复杂的代码中这不是一个现实的选择。解决这个问题的一种方法是使用构造器。 + +### 构造函数的作用 + +这个示例项目中的 **DiceRoller** 类表示一个虚拟骰子工厂:当它被调用时,它创建一个虚拟骰子,然后进行“滚动”。然而,通过编写一个自定义构造器,你可以让掷骰子的应用程序询问你希望模拟哪种类型的骰子。 + +大部分代码都是一样的,除了构造器接受一个表示边的数字参数。这个数字还不存在,但稍后将创建它。 + + +``` +import java.util.Random; + +public class DiceRoller { +private int dice; +private int roll; +private [Random][7] rand = new [Random][7](); + +// 构造器 +public DiceRoller(int sides) { +dice = sides; +} +``` + +模拟滚动的功能保持不变: + + +``` +public void Roller() { +roll = rand.nextInt(dice); +roll += 1; +[System][8].out.println (roll); +} +``` + +代码的主要部分提供运行应用程序时提供的任何参数。这的确会是一个复杂的应用程序,你需要仔细解析参数并检查意外结果,但对于这个例子,唯一的预防措施是将参数字符串转换成整数类型。 + + +``` +public static void main ([String][9][] args) { +[System][8].out.printf("You rolled a "); +DiceRoller App = new DiceRoller( [Integer][11].parseInt(args[0]) ); +App.Roller(); +} +} +``` + +启动这个应用程序,并提供你希望骰子具有的面数: + + +``` +$ java dice.java 20 +You rolled a 10 +$ java dice.java 6 +You rolled a 2 +$ java dice.java 100 +You rolled a 44 +``` + +构造器已接受你的输入,因此在创建类实例时,会将 **sides** 变量设置为用户指定的任何数字。 + +构造器是编程的功能强大的组件。练习用它们来解开了 Java 的全部潜力。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/what-java-constructor + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth/users/ashleykoree +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/build_structure_tech_program_code_construction.png?itok=nVsiLuag +[2]: https://opensource.com/resources/python +[3]: https://opensource.com/article/17/4/pyqt-versus-wxpython +[4]: https://opensource.com/resources/java +[5]: https://openjdk.java.net/install/index.html +[6]: https://opensource.com/article/19/5/free-rpg-day +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+random +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[10]: https://openjdk.java.net/ +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer From 632987591d290f6699244988f22fd15bac519d46 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 21:06:26 +0800 Subject: [PATCH 030/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @geekpi VPN 这个名词是禁用词,只能替换一下…… --- ... Use sshuttle to build a poor man-s VPN.md | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md b/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md index 8da9fa3391..f9596d8337 100644 --- a/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md +++ b/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md @@ -1,62 +1,60 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use sshuttle to build a poor man’s VPN) [#]: via: (https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/) [#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) -使用 shuttle 构建一个穷人的 VPN +使用 shuttle 构建一个穷人的虚拟专网 ====== ![][1] -如今,企业网络经常使用 VPN(虚拟专用网络)[来保证员工通信安全][2]。但是,使用的协议有时会降低性能。如果你可以使用 SSH 连接远程主机,那么你可以设置端口转发。但这可能会很痛苦,尤其是在你需要与该网络上的许多主机一起使用的情况下。试试 **sshuttle**,它可以通过 SSH 访问来设置快速简易的 VPN。请继续阅读以获取有关如何使用它的更多信息。 +如今,企业网络经常使用“虚拟专用网络”[来保证员工通信安全][2]。但是,使用的协议有时会降低性能。如果你可以使用 SSH 连接远程主机,那么你可以设置端口转发。但这可能会很痛苦,尤其是在你需要与该网络上的许多主机一起使用的情况下。试试 `sshuttle`,它可以通过 SSH 访问来设置快速简易的虚拟专网。请继续阅读以获取有关如何使用它的更多信息。 -sshuttle 正是针对上述情况而设计的。远程端的唯一要求是主机必须有可用的 Python。这是因为 sshuttle 会构造并运行一些 Python 代码来帮助传输数据。 +`sshuttle` 正是针对上述情况而设计的。远程端的唯一要求是主机必须有可用的 Python。这是因为 `sshuttle` 会构造并运行一些 Python 代码来帮助传输数据。 ### 安装 sshuttle -sshuttle 被打包在官方仓库中,因此很容易安装。打开一个终端,并使用[使用 sudo][3] 运行以下命令: +`sshuttle` 被打包在官方仓库中,因此很容易安装。打开一个终端,并[使用 sudo][3] 来运行以下命令: ``` $ sudo dnf install sshuttle ``` -安装后,你可能会发现手册页很有趣: +安装后,你可以在手机页中找到相关信息: ``` $ man sshuttle ``` -### 设置 VPN +### 设置虚拟专网 -最简单的情况就是将所有流量转发到远程网络。这不一定是一个疯狂的想法,尤其是如果你不在自己家里这样的受信任的本地网络中。将 _-r_ 选项与 SSH 用户名和远程主机名一起使用: +最简单的情况就是将所有流量转发到远程网络。这不一定是一个疯狂的想法,尤其是如果你不在自己家里这样的受信任的本地网络中。将 `-r` 选项与 SSH 用户名和远程主机名一起使用: ``` $ sshuttle -r username@remotehost 0.0.0.0/0 ``` -但是,你可能希望将 VPN 限制为特定子网,而不是所有网络流量。 (有关子网的完整讨论超出了本文的范围,但是你可以在 [Wikipedia][4] 上阅读更多内容。)假设你的办公室内部使用了预留的 A 类子网 10.0.0.0 和预留的 B 类子网 172.16.0.0。上面的命令变为: +但是,你可能希望将该虚拟专网限制为特定子网,而不是所有网络流量。(有关子网的完整讨论超出了本文的范围,但是你可以在[维基百科][4]上阅读更多内容。)假设你的办公室内部使用了预留的 A 类子网 10.0.0.0 和预留的 B 类子网 172.16.0.0。上面的命令变为: ``` $ sshuttle -r username@remotehost 10.0.0.0/8 172.16.0.0/16 ``` -这非常适合通过 IP 地址访问远程网络的主机。但是,如果你的办公室是一个拥有大量主机的大型网络,该怎么办?名称可能更方便,甚至是必须的。不用担心,sshuttle 还可以使用 _–dns_ 选项转发 DNS 查询: +这非常适合通过 IP 地址访问远程网络的主机。但是,如果你的办公室是一个拥有大量主机的大型网络,该怎么办?名称可能更方便,甚至是必须的。不用担心,`sshuttle` 还可以使用 `–dns` 选项转发 DNS 查询: ``` $ sshuttle --dns -r username@remotehost 10.0.0.0/8 172.16.0.0/16 ``` -要使 sshuttle 已守护进程运行,请加上 _-D_ 选项。它会以 syslog 兼容的日志格式发送到 systemd 日志中。 +要使 `sshuttle` 以守护进程方式运行,请加上 `-D` 选项。它会以 syslog 兼容的日志格式发送到 systemd 日志中。 -根据本地和远程系统的功能,可以将 shuttle 用于基于 IPv6 的 VPN。如果需要,你还可以设置配置文件并将其与系统启动集成。如果你想阅读更多有关 sshuttle 及其工作方式的信息,请[查看官方文档][5]。要查看代码,请[进入 GitHub 页面][6]。 +根据本地和远程系统的功能,可以将 `sshuttle` 用于基于 IPv6 的虚拟专网。如果需要,你还可以设置配置文件并将其与系统启动集成。如果你想阅读更多有关 `sshuttle` 及其工作方式的信息,请[查看官方文档][5]。要查看代码,请[进入 GitHub 页面][6]。 -* * * - -_由 _[_Kurt Cotoaga_][7]_ 拍摄并发表在 _[_Unsplash_][8]_ 上。_ +*题图由 [Kurt Cotoaga][7] 拍摄并发表在 [Unsplash][8] 上。* -------------------------------------------------------------------------------- @@ -65,7 +63,7 @@ via: https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/ 作者:[Paul W. Frields][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 4046b9537062f9c7c7fab1feb3ab836baf361673 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 21:06:50 +0800 Subject: [PATCH 031/800] PUB @geekpi https://linux.cn/article-11476-1.html --- .../20191014 Use sshuttle to build a poor man-s VPN.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191014 Use sshuttle to build a poor man-s VPN.md (98%) diff --git a/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md b/published/20191014 Use sshuttle to build a poor man-s VPN.md similarity index 98% rename from translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md rename to published/20191014 Use sshuttle to build a poor man-s VPN.md index f9596d8337..a5395a5405 100644 --- a/translated/tech/20191014 Use sshuttle to build a poor man-s VPN.md +++ b/published/20191014 Use sshuttle to build a poor man-s VPN.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11476-1.html) [#]: subject: (Use sshuttle to build a poor man’s VPN) [#]: via: (https://fedoramagazine.org/use-sshuttle-to-build-a-poor-mans-vpn/) [#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) From 6901f3bae7b18de9041580b319ba0f297ccee3b5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 22:13:02 +0800 Subject: [PATCH 032/800] PRF @amwps290 --- ...90830 How to Install Linux on Intel NUC.md | 94 +++++++++---------- 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/translated/tech/20190830 How to Install Linux on Intel NUC.md b/translated/tech/20190830 How to Install Linux on Intel NUC.md index 9a7589bfc4..1f38174933 100644 --- a/translated/tech/20190830 How to Install Linux on Intel NUC.md +++ b/translated/tech/20190830 How to Install Linux on Intel NUC.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (amwps290) -[#]: reviewer: () -[#]: publisher: () -[#]: url: () +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) [#]: subject: "How to Install Linux on Intel NUC" [#]: via: "https://itsfoss.com/install-linux-on-intel-nuc/" [#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" @@ -10,122 +10,114 @@ 在 Intel NUC 上安装 Linux ====== -在上一周,我给我自己买了一台 [InteL NUC][1]。虽然它是如此之小,但它与成熟的桌面型电脑差别甚小。实际上,大部分的[基于 Linux 的微型 PC][2] 都是基于 Intel NUC 构建的。 +![](https://img.linux.net.cn/data/attachment/album/201910/18/221221pw3hbbi3bbbbprr4.jpg) -我买了第 8 代 Core i3 处理器的“准系统” NUC。 准系统意味着该设备没有 RAM,没有硬盘,显然也没有操作系统。我加了一个 [Crucial 的 8 GB 的内存条][3](大约 33 美元)和一个 [240GB 的西数的固态硬盘][4](大约 45 美元)。 +在上周,我买了一台 [InteL NUC][1]。虽然它是如此之小,但它与成熟的桌面型电脑差别甚小。实际上,大部分的[基于 Linux 的微型 PC][2] 都是基于 Intel NUC 构建的。 + +我买了第 8 代 Core i3 处理器的“准系统barebone” NUC。准系统意味着该设备没有 RAM、没有硬盘,显然也没有操作系统。我添加了一个 [Crucial 的 8 GB 内存条][3](大约 33 美元)和一个 [240 GB 的西数的固态硬盘][4](大约 45 美元)。 现在,我已经有了一台不到 400 美元的电脑。因为我已经有了一个电脑屏幕和键鼠套装,所以我没有把它们计算在内。 -![A brand new Intel NUC NUC8i3BEH at my desk with Raspberry Pi 4 lurking behind][5] +![在我的办公桌上放着一个崭新的英特尔 NUC NUC8i3BEH,后面有树莓派 4][5] -我买这个 Intel NUC 的主要原因就是我想在实体机上测试各种各样的 Linux 发行版。我已经有一个 [Raspberry Pi 4][6] 设备作为一个入门级的桌面系统,但它是一个 [ARM][7] 设备,因此,只有少数 Linux 发行版可用于 Raspberry Pi 上。 +我买这个 Intel NUC 的主要原因就是我想在实体机上测试各种各样的 Linux 发行版。我已经有一个 [树莓派 4][6] 设备作为一个入门级的桌面系统,但它是一个 [ARM][7] 设备,因此,只有少数 Linux 发行版可用于树莓派上。(LCTT 译注:新发布的 Ubuntu 19.10 支持树莓派 4B) -这个文章里的亚马逊链接是会员连接。请参阅我们的[会员政策][8]。 +*这个文章里的亚马逊链接是(原文的)受益连接。请参阅我们的[受益政策][8]。* ### 在 NUC 上安装 Linux 现在我准备安装 Ubuntu 18.04 长期支持版,因为我现在就有这个系统的安装文件。你也可以按照这个教程安装其他的发行版。在最重要的分区之前,前边的步骤都大致相同。 -### 第一步:创建一个 USB 启动盘 -你可以在 Ubuntu 官网下载它的安装文件。使用另一个电脑去[创建一个 USB 启动盘][9]。你可以使用像 [Rufus][10] 和 [Etcher][11] 这样的软件。在 Ubuntu上,您可以使用默认的 Startup Disk Creator 工具。 +#### 第一步:创建一个 USB 启动盘 -### 第二步:确认启动顺序的正确性 +你可以在 Ubuntu 官网下载它的安装文件。使用另一个电脑去[创建一个 USB 启动盘][9]。你可以使用像 [Rufus][10] 和 [Etcher][11] 这样的软件。在 Ubuntu上,你可以使用默认的启动盘创建工具。 -将你的 USB 启动盘插入到你的电脑并开机。一旦你看到 “Intel NUC” 字样出现在你的屏幕上,快速的按下 F2 进入到 BIOS 设置中。 +#### 第二步:确认启动顺序是正确的 -![BIOS Settings in Intel NUC][12] +将你的 USB 启动盘插入到你的电脑并开机。一旦你看到 “Intel NUC” 字样出现在你的屏幕上,快速的按下 `F2` 键进入到 BIOS 设置中。 -在这里,仅仅确认你的第一启动项是你的 USB 设备 。如果不是,切换启动顺序。 +![Intel NUC 的 BIOS 设置][12] -如果你修改了一些选项,按 F10 保存退出,否则直接按下 ESC 退出 BIOS 设置。 +在这里,只是确认一下你的第一启动项是你的 USB 设备。如果不是,切换启动顺序。 -#### 第三步:正确分区,安装 Linux +如果你修改了一些选项,按 `F10` 键保存退出,否则直接按下 `ESC` 键退出 BIOS 设置。 + +#### 第三步:正确分区,安装 Linux 现在当机器重启的时候,你就可以看到熟悉的 Grub 界面,可以让你试用或者安装 Ubuntu。现在我们选择安装它。 -[][13] - -建议你看一下如何在命令行中查看 Linux 内核版本。 - 开始的几个安装步骤非常简单,选择键盘的布局,是否连接网络还有一些其他简单的设置。 -![Choose the keyboard layout while installing Ubuntu Linux][14] +![在安装 Ubuntu Linux 时选择键盘布局][14] -您可能会使用常规安装,默认情况下会安装一些有用的应用程序。 +你可能会使用常规安装,默认情况下会安装一些有用的应用程序。 ![][15] -接下来的内容非常有趣。 您有两种选择: - -* **擦除磁盘并安装 Ubuntu**:最简单的选项,它将在整个磁盘上安装 Ubuntu。 如果您只想在 Intel NUC 上使用一个操作系统,请选择此选项,Ubuntu 将负责剩余的工作。 - -* **其他选项**:这是一个控制所有事的高级选项。 就我而言,我想在同一 SSD 上安装多个 Linux 发行版。 因此,我选择了此高级选项。 +接下来的是要注意的部分。你有两种选择: +* “擦除磁盘并安装 UbuntuErase disk and install Ubuntu”:最简单的选项,它将在整个磁盘上安装 Ubuntu。如果你只想在 Intel NUC 上使用一个操作系统,请选择此选项,Ubuntu 将负责剩余的工作。 +* “其他选项Something else”:这是一个控制所有选择的高级选项。就我而言,我想在同一 SSD 上安装多个 Linux 发行版。因此,我选择了此高级选项。 ![][16] -_**如果你选择了擦除并安装 Ubuntu,点击继续,直接跳到第四步,**_ +**如果你选择了“擦除磁盘并安装 UbuntuErase disk and install Ubuntu”,点击“继续Continue”,直接跳到第四步,** -如果你选择了高级选项,请按照下面的第三步进行操作。 +如果你选择了高级选项,请按照下面剩下的部分进行操作。 -选择固态硬盘,然后点击新的分区表 +选择固态硬盘,然后点击“新建分区表New Partition Table”。 ![][17] -它会给你显示一个警告。直接点击继续。 +它会给你显示一个警告。直接点击“继续Continue”。 ![][18] -现在你就可以看到你 SSD 磁盘里的空闲空间。我的想法是为 EFI bootloader 创建一个 EFI 系统分区。一个根(root)分区,一个主目录(home)分区。这里我并没有创建[交换分区][19]。Ubuntu 会根据自己的需要来创建交换分区。我也可以通过创建新的交换文件来扩展交换分区。 +现在你就可以看到你 SSD 磁盘里的空闲空间。我的想法是为 EFI bootloader 创建一个 EFI 系统分区。一个根(`/`)分区,一个主目录(`/home`)分区。这里我并没有创建[交换分区][19]。Ubuntu 会根据自己的需要来创建交换分区。我也可以通过[创建新的交换文件][32]来扩展交换分区。 -我将在磁盘上保留近 200 GB 的可用空间,以便可以在此处安装其他 Linux 发行版。 您可以将其全部用于主目录分区。 保留单独的根分区和主分区可以在您需要保存时帮助您重新安装系统 +我将在磁盘上保留近 200 GB 的可用空间,以便可以在此处安装其他 Linux 发行版。你可以将其全部用于主目录分区。保留单独的根分区和主目录分区可以在你需要重新安装系统时帮你保存里面的数据。 选择可用空间,然后单击加号以添加分区。 ![][20] - - 一般来说,100MB 足够 EFI 的使用,但是某些发行版可能需要更多空间,因此我要使用 500MB 的 EFI 分区。 ![][21] -接下来,我将使用 20GB 的根分区。 如果你只使用一个发行版,则可以随意地将其增加到 40GB。 +接下来,我将使用 20GB 的根分区。如果你只使用一个发行版,则可以随意地将其增加到 40GB。 -Root 目录是系统文件存放的地方。你的程序缓存和你安装的程序将会有一些文件放在这个目录下边。我建议你可以阅读一下[ Linux 文件系统层次结构][22]来了解更多相关内容。 +根目录(`/`)是系统文件存放的地方。你的程序缓存和你安装的程序将会有一些文件放在这个目录下边。我建议你可以阅读一下 [Linux 文件系统层次结构][22]来了解更多相关内容。 -[][23] - -建议你阅读一下如何在 Ubuntu 和 Windows 之间共享文件 - -填入分区的大小,选择 Ext4 文件系统,选择 / 作为挂载点。 +填入分区的大小,选择 Ext4 文件系统,选择 `/` 作为挂载点。 ![][24] 接下来是创建一个主目录分区,我再说一下,如果你仅仅想使用一个 Linux 发行版。那就把剩余的空间都使用完吧。为主目录分区选择一个合适的大小。 -主目录是你个人的文件,比如文档,图片,音乐,下载和一些其他的文件存储的地方。 +主目录是你个人的文件,比如文档、图片、音乐、下载和一些其他的文件存储的地方。 ![][25] -既然你创建好了 EFI 分区,根分区,主目录分区,那你就可以点击安装按钮安装系统了。 +既然你创建好了 EFI 分区、根分区、主目录分区,那你就可以点击“现在安装Install Now”按钮安装系统了。 ![][26] -他将会提示你新的改变将会被写入到磁盘,点击继续。 +它将会提示你新的改变将会被写入到磁盘,点击“继续Continue”。 ![][27] #### 第四步:安装 Ubuntu + 事情到了这就非常明了了。现在选择你的分区或者以后选择也可以。 ![][28] -接下来,输入你的用户名,主机名以及密码。 +接下来,输入你的用户名、主机名以及密码。 ![][29] -看 7-8 分钟的动画就可以安装完成了。 +看 7-8 分钟的幻灯片就可以安装完成了。 ![][30] @@ -135,15 +127,14 @@ Root 目录是系统文件存放的地方。你的程序缓存和你安装的程 当你重启的时候,你必须要移除你的 USB 设备,否则你将会再次进入安装系统的界面。 -这就是在 Intel NUC 设备上安装 Linux 所需要做的一切。 坦白说,您可以在其他任何系统上使用相同的过程。 +这就是在 Intel NUC 设备上安装 Linux 所需要做的一切。坦白说,你可以在其他任何系统上使用相同的过程。 -**Intel NUC 和 Linux 在一起:如何使用它?** +### Intel NUC 和 Linux 在一起:如何使用它? 我非常喜欢 Intel NUC。它不占用太多的桌面空间,而且有足够的能力去取代传统的桌面型电脑。你可以将它的内存升级到 32GB。你也可以安装两个 SSD 硬盘。总之,它提供了一些配置和升级范围。 如果你想购买一个桌面型的电脑,我非常推荐你购买使用 [Intel NUC][1] 迷你主机。如果你不想自己安装系统,那么你可以购买一个[基于 Linux 的已经安装好的系统迷你主机][2]。 - 你是否已经有了一个 Intel NUC?有一些什么相关的经验?你有什么相关的意见与我们分享吗?可以在下面评论。 -------------------------------------------------------------------------------- @@ -153,7 +144,7 @@ via: https://itsfoss.com/install-linux-on-intel-nuc/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[amwps290](https://github.com/amwps290) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -190,3 +181,4 @@ via: https://itsfoss.com/install-linux-on-intel-nuc/ [29]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-13_tutorial.jpg?ssl=1 [30]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-14_tutorial.jpg?ssl=1 [31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/install-ubuntu-linux-on-intel-nuc-15_tutorial.jpg?ssl=1 +[32]: https://itsfoss.com/create-swap-file-linux/ From 20672f34ce76157c8a2bc567fb611a23d579f60d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 22:15:56 +0800 Subject: [PATCH 033/800] PUB @amwps290 https://linux.cn/article-11477-1.html --- .../20190830 How to Install Linux on Intel NUC.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190830 How to Install Linux on Intel NUC.md (99%) diff --git a/translated/tech/20190830 How to Install Linux on Intel NUC.md b/published/20190830 How to Install Linux on Intel NUC.md similarity index 99% rename from translated/tech/20190830 How to Install Linux on Intel NUC.md rename to published/20190830 How to Install Linux on Intel NUC.md index 1f38174933..d460dfccb0 100644 --- a/translated/tech/20190830 How to Install Linux on Intel NUC.md +++ b/published/20190830 How to Install Linux on Intel NUC.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (amwps290) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11477-1.html) [#]: subject: "How to Install Linux on Intel NUC" [#]: via: "https://itsfoss.com/install-linux-on-intel-nuc/" [#]: author: "Abhishek Prakash https://itsfoss.com/author/abhishek/" From 79e71b6fa7f98e2aaaa6002b6d6d89039f139a05 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 23:05:31 +0800 Subject: [PATCH 034/800] PRF @laingke --- .../20190614 What is a Java constructor.md | 101 +++++++++--------- 1 file changed, 48 insertions(+), 53 deletions(-) diff --git a/translated/tech/20190614 What is a Java constructor.md b/translated/tech/20190614 What is a Java constructor.md index 42ac00bc2c..bd298e2124 100644 --- a/translated/tech/20190614 What is a Java constructor.md +++ b/translated/tech/20190614 What is a Java constructor.md @@ -1,68 +1,68 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What is a Java constructor?) [#]: via: (https://opensource.com/article/19/6/what-java-constructor) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/ashleykoree) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) -Java 构造器是什么? +什么是 Java 构造器? ====== -构造器是编程的强大组件。使用它们来释放 Java 的全部潜力。 -![][1] -在开源、跨平台编程领域,Java 无疑是无可争议的重量级语言。尽管有许多[伟大的][2][跨平台][2][框架][3],但很少有像 [Java][4] 那样统一和直接的。 +> 构造器是编程的强大组件。使用它们来释放 Java 的全部潜力。 -当然,Java 还是一种非常复杂的语言,具有自己的微妙之处和约定。Java 中与**构造器**有关的最常见问题之一是:它们是什么,它们的作用是什么? +![](https://img.linux.net.cn/data/attachment/album/201910/18/230523hdx7sy804xdtxybb.jpg) -简而言之:构造器是在 Java 中创建新**对象**时执行的操作。当 Java 应用程序创建你编写的类的实例时,它将检查构造器。如果存在构造器,则 Java 在创建实例时将运行构造器中的代码。这几句话中包含了大量的技术术语,但是当你看到它的实际应用时就会更加清楚,所以请确保你已经[安装了 Java][5] 并准备好进行演示。 +在开源、跨平台编程领域,Java 无疑(?)是无可争议的重量级语言。尽管有许多[伟大的跨平台][2][框架][3],但很少有像 [Java][4] 那样统一和直接的。 + +当然,Java 也是一种非常复杂的语言,具有自己的微妙之处和惯例。Java 中与构造器 constructor有关的最常见问题之一是:它们是什么,它们的作用是什么? + +简而言之:构造器是在 Java 中创建新对象object时执行的操作。当 Java 应用程序创建一个你编写的类的实例时,它将检查构造器。如果(该类)存在构造器,则 Java 在创建实例时将运行构造器中的代码。这几句话中包含了大量的技术术语,但是当你看到它的实际应用时就会更加清楚,所以请确保你已经[安装了 Java][5] 并准备好进行演示。 ### 没有使用构造器的开发日常 -如果你正在编写 Java 代码,那么你已经在使用构造器了,即使你可能不知道它。Java 中的所有类都有一个构造器,因为即使你没有创建构造器,Java 也会在编译代码时为你完成。但是,为了进行演示,请忽略 Java 提供的隐藏构造器(因为默认构造器不添加任何额外的功能),并观察没有显式构造器的情况。 +如果你正在编写 Java 代码,那么你已经在使用构造器了,即使你可能不知道它。Java 中的所有类都有一个构造器,因为即使你没有创建构造器,Java 也会在编译代码时为你生成一个。但是,为了进行演示,请忽略 Java 提供的隐藏构造器(因为默认构造器不添加任何额外的功能),并观察没有显式构造器的情况。 假设你正在编写一个简单的 Java 掷骰子应用程序,因为你想为游戏生成一个伪随机数。 -首先,你可以创建 dice 类来表示一个骰子。知道你玩了很久[《龙与地下城》][6],你决定创建一个 20 面的骰子。在这个示例代码中,变量 **dice** 是整数 20,表示可能的最大掷骰数(一个 20 边骰子的掷骰数不能超过 20)。变量 **roll** 是最终的随机数的占位符,**rand** 用作随机数种子。 - +首先,你可以创建骰子类来表示一个骰子。你玩了很久[《龙与地下城》][6],所以你决定创建一个 20 面的骰子。在这个示例代码中,变量 `dice` 是整数 20,表示可能的最大掷骰数(一个 20 边骰子的掷骰数不能超过 20)。变量 `roll` 是最终的随机数的占位符,`rand` 用作随机数种子。 ``` import java.util.Random; public class DiceRoller { -private int dice = 20; -private int roll; -private [Random][7] rand = new [Random][7](); + private int dice = 20; + private int roll; + private Random rand = new Random(); ``` -接下来,在 **DiceRoller** 类中创建一个函数,以执行计算机模拟模子滚动所必须采取的步骤:从 **rand** 中获取一个整数并将其分配给 **roll**变量,考虑到 Java 从 0 开始计数但 20 面的骰子没有 0 值的情况,**roll** 再加 1 ,然后打印结果。 - +接下来,在 `DiceRoller` 类中创建一个函数,以执行计算机模拟模子滚动所必须采取的步骤:从 `rand` 中获取一个整数并将其分配给 `roll`变量,考虑到 Java 从 0 开始计数但 20 面的骰子没有 0 值的情况,`roll` 再加 1 ,然后打印结果。 ``` -public void Roller() { -roll = rand.nextInt(dice); -roll += 1; -[System][8].out.println (roll); -} +import java.util.Random; + +public class DiceRoller { + private int dice = 20; + private int roll; + private Random rand = new Random(); ``` -最后,产生 **DiceRoller** 类的实例并调用其关键函数 **Roller**: +最后,产生 `DiceRoller` 类的实例并调用其关键函数 `Roller`: ``` // main loop -public static void main ([String][9][] args) { -[System][8].out.printf("You rolled a "); +public static void main (String[] args) { + System.out.printf("You rolled a "); -DiceRoller App = new DiceRoller(); -App.Roller(); -} + DiceRoller App = new DiceRoller(); + App.Roller(); + } } ``` 只要你安装了 Java 开发环境(如 [OpenJDK][10]),你就可以在终端上运行你的应用程序: - ``` $ java dice.java You rolled a 12 @@ -72,51 +72,46 @@ You rolled a 12 ### 构造函数的作用 -这个示例项目中的 **DiceRoller** 类表示一个虚拟骰子工厂:当它被调用时,它创建一个虚拟骰子,然后进行“滚动”。然而,通过编写一个自定义构造器,你可以让掷骰子的应用程序询问你希望模拟哪种类型的骰子。 - -大部分代码都是一样的,除了构造器接受一个表示边的数字参数。这个数字还不存在,但稍后将创建它。 +这个示例项目中的 `DiceRoller` 类表示一个虚拟骰子工厂:当它被调用时,它创建一个虚拟骰子,然后进行“滚动”。然而,通过编写一个自定义构造器,你可以让掷骰子的应用程序询问你希望模拟哪种类型的骰子。 +大部分代码都是一样的,除了构造器接受一个表示面数的数字参数。这个数字还不存在,但稍后将创建它。 ``` import java.util.Random; public class DiceRoller { -private int dice; -private int roll; -private [Random][7] rand = new [Random][7](); + private int dice; + private int roll; + private Random rand = new Random(); -// 构造器 -public DiceRoller(int sides) { -dice = sides; -} + // constructor + public DiceRoller(int sides) { + dice = sides; + } ``` -模拟滚动的功能保持不变: - +模拟滚动的函数保持不变: ``` public void Roller() { -roll = rand.nextInt(dice); -roll += 1; -[System][8].out.println (roll); + roll = rand.nextInt(dice); + roll += 1; + System.out.println (roll); } ``` 代码的主要部分提供运行应用程序时提供的任何参数。这的确会是一个复杂的应用程序,你需要仔细解析参数并检查意外结果,但对于这个例子,唯一的预防措施是将参数字符串转换成整数类型。 - ``` -public static void main ([String][9][] args) { -[System][8].out.printf("You rolled a "); -DiceRoller App = new DiceRoller( [Integer][11].parseInt(args[0]) ); -App.Roller(); -} +public static void main (String[] args) { + System.out.printf("You rolled a "); + DiceRoller App = new DiceRoller( Integer.parseInt(args[0]) ); + App.Roller(); } ``` 启动这个应用程序,并提供你希望骰子具有的面数: - ``` $ java dice.java 20 You rolled a 10 @@ -126,7 +121,7 @@ $ java dice.java 100 You rolled a 44 ``` -构造器已接受你的输入,因此在创建类实例时,会将 **sides** 变量设置为用户指定的任何数字。 +构造器已接受你的输入,因此在创建类实例时,会将 `sides` 变量设置为用户指定的任何数字。 构造器是编程的功能强大的组件。练习用它们来解开了 Java 的全部潜力。 @@ -137,11 +132,11 @@ via: https://opensource.com/article/19/6/what-java-constructor 作者:[Seth Kenlon][a] 选题:[lujun9972][b] 译者:[laingke](https://github.com/laingke) -校对:[校对者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/seth/users/ashleykoree +[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/build_structure_tech_program_code_construction.png?itok=nVsiLuag [2]: https://opensource.com/resources/python From 4d8bfacda5b382f0658319f2d7841cd90f0f093d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 23:06:20 +0800 Subject: [PATCH 035/800] PUB @laingke https://linux.cn/article-11478-1.html --- translated/tech/20190614 What is a Java constructor.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/translated/tech/20190614 What is a Java constructor.md b/translated/tech/20190614 What is a Java constructor.md index bd298e2124..62d40ceeeb 100644 --- a/translated/tech/20190614 What is a Java constructor.md +++ b/translated/tech/20190614 What is a Java constructor.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11478-1.html) [#]: subject: (What is a Java constructor?) [#]: via: (https://opensource.com/article/19/6/what-java-constructor) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 4d70a5a4030ebed0e09c9be3d9fea8bdfd11719d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 18 Oct 2019 23:34:48 +0800 Subject: [PATCH 036/800] PUB @laingke https://linux.cn/article-11478-1.html --- .../tech => published}/20190614 What is a Java constructor.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20190614 What is a Java constructor.md (100%) diff --git a/translated/tech/20190614 What is a Java constructor.md b/published/20190614 What is a Java constructor.md similarity index 100% rename from translated/tech/20190614 What is a Java constructor.md rename to published/20190614 What is a Java constructor.md From cceddc6e7a8c34f6ee85ec13ccb4d60f9b7d5f37 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sat, 19 Oct 2019 00:05:25 +0800 Subject: [PATCH 037/800] translated --- ...ing by example- How to leverage failure.md | 195 ----------------- ...ing by example- How to leverage failure.md | 205 ++++++++++++++++++ 2 files changed, 205 insertions(+), 195 deletions(-) delete mode 100644 sources/tech/20190923 Mutation testing by example- How to leverage failure.md create mode 100644 translated/tech/20190923 Mutation testing by example- How to leverage failure.md diff --git a/sources/tech/20190923 Mutation testing by example- How to leverage failure.md b/sources/tech/20190923 Mutation testing by example- How to leverage failure.md deleted file mode 100644 index f86183f798..0000000000 --- a/sources/tech/20190923 Mutation testing by example- How to leverage failure.md +++ /dev/null @@ -1,195 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Mutation testing by example: How to leverage failure) -[#]: via: (https://opensource.com/article/19/9/mutation-testing-example-tdd) -[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) - -Mutation testing by example: How to leverage failure -====== -Use planned failure to ensure your code meets expected outcomes and -follow along with the .NET xUnit.net testing framework. -![failure sign at a party, celebrating failure][1] - -In my article _[Mutation testing is the evolution of TDD][2]_, I exposed the power of iteration to guarantee a solution when a measurable test is available. In that article, an iterative approach helped to determine how to implement code that calculates the square root of a given number. - -I also demonstrated that the most effective method is to find a measurable goal or test, then start iterating with best guesses. The first guess at the correct answer will most likely fail, as expected, so the failed guess needs to be refined. The refined guess must be validated against the measurable goal or test. Based on the result, the guess is either validated or must be further refined. - -In this model, the only way to learn how to reach the solution is to fail repeatedly. It sounds counterintuitive, but amazingly, it works. - -Following in the footsteps of that analysis, this article examines the best way to use a DevOps approach when building a solution containing some dependencies. The first step is to write a test that can be expected to fail. - -### The problem with dependencies is that you can't depend on them - -The problem with dependencies, as Michael Nygard wittily expresses in _[Architecture without an end state][3]_, is a huge topic better left for another article. Here, you'll look into potential pitfalls that dependencies tend to bring to a project and how to leverage test-driven development (TDD) to avoid those pitfalls. - -First, pose a real-life challenge, then see how it can be solved using TDD. - -### Who let the cat out? - -![Cat standing on a roof][4] - -In Agile development environments, it's helpful to start building the solution by defining the desired outcomes. Typically, the desired outcomes are described in a [_user story_][5]: - -> _Using my home automation system (HAS), -> I want to control when the cat can go outside, -> because I want to keep the cat safe overnight._ - -Now that you have a user story, you need to elaborate on it by providing some functional requirements (that is, by specifying the _acceptance criteria_). Start with the simplest of scenarios described in pseudo-code: - -> _Scenario #1: Disable cat trap door during nighttime_ -> -> * Given that the clock detects that it is nighttime -> * When the clock notifies the HAS -> * Then HAS disables the Internet of Things (IoT)-capable cat trap door -> - - -### Decompose the system - -The system you are building (the HAS) needs to be _decomposed_–broken down to its dependencies–before you can start working on it. The first thing you must do is identify any dependencies (if you're lucky, your system has no dependencies, which would make it easy to build, but then it arguably wouldn't be a very useful system). - -From the simple scenario above, you can see that the desired business outcome (automatically controlling a cat door) depends on detecting nighttime. This dependency hinges upon the clock. But the clock is not capable of determining whether it is daylight or nighttime. It's up to you to supply that logic. - -Another dependency in the system you're building is the ability to automatically access the cat door and enable or disable it. That dependency most likely hinges upon an API provided by the IoT-capable cat door. - -### Fail fast toward dependency management - -To satisfy one dependency, we will build the logic that determines whether the current time is daylight or nighttime. In the spirit of TDD, we will start with a small failure. - -Refer to my [previous article][2] for detailed instructions on how to set the development environment and scaffolds required for this exercise. We will be reusing the same NET environment and relying on the [xUnit.net][6] framework. - -Next, create a new project called HAS (for "home automation system") and create a file called **UnitTest1.cs**. In this file, write the first failing unit test. In this unit test, describe your expectations. For example, when the system runs, if the time is 7pm, then the component responsible for deciding whether it's daylight or nighttime returns the value "Nighttime." - -Here is the unit test that describes that expectation: - - -``` -using System; -using Xunit; - -namespace unittest -{ -   public class UnitTest1 -   { -       DayOrNightUtility dayOrNightUtility = [new][7] DayOrNightUtility(); - -       [Fact] -       public void Given7pmReturnNighttime() -       { -           var expected = "Nighttime"; -           var actual = dayOrNightUtility.GetDayOrNight(); -           Assert.Equal(expected, actual); -       } -   } -} -``` - -By this point, you may be familiar with the shape and form of a unit test. A quick refresher: describe the expectation by giving the unit test a descriptive name, **Given7pmReturnNighttime**, in this example. Then in the body of the unit test, a variable named **expected** is created, and it is assigned the expected value (in this case, the value "Nighttime"). Following that, a variable named **actual** is assigned the actual value (available after the component or service processes the time of day). - -Finally, it checks whether the expectation has been met by asserting that the expected and actual values are equal: **Assert.Equal(expected, actual)**. - -You can also see in the above listing a component or service called **dayOrNightUtility**. This module is capable of receiving the message **GetDayOrNight** and is supposed to return the value of the type **string**. - -Again, in the spirit of TDD, the component or service being described hasn't been built yet (it is merely being described with the intention to prescribe it later). Building it is driven by the described expectations. - -Create a new file in the **app** folder and give it the name **DayOrNightUtility.cs**. Add the following C# code to that file and save it: - - -``` -using System; - -namespace app { -   public class DayOrNightUtility { -       public string GetDayOrNight() { -           string dayOrNight = "Undetermined"; -           return dayOrNight; -       } -   } -} -``` - -Now go to the command line, change directory to the **unittests** folder, and run the test: - - -``` -[Xunit.net 00:00:02.33] unittest.UnitTest1.Given7pmReturnNighttime [FAIL] -Failed unittest.UnitTest1.Given7pmReturnNighttime -[...] -``` - -Congratulations, you have written the first failing unit test. The unit test was expecting **DayOrNightUtility** to return string value "Nighttime" but instead, it received the string value "Undetermined." - -### Fix the failing unit test - -A quick and dirty way to fix the failing test is to replace the value "Undetermined" with the value "Nighttime" and save the change: - - -``` -using System; - -namespace app { -   public class DayOrNightUtility { -       public string GetDayOrNight() { -           string dayOrNight = "Nighttime"; -           return dayOrNight; -       } -   } -} -``` - -Now when we run the test, it passes: - - -``` -Starting test execution, please wait... - -Total tests: 1. Passed: 1. Failed: 0. Skipped: 0. -Test Run Successful. -Test execution time: 2.6470 Seconds -``` - -However, hardcoding the values is basically cheating, so it's better to endow **DayOrNightUtility** with some intelligence. Modify the **GetDayOrNight** method to include some time-calculation logic: - - -``` -public string GetDayOrNight() { -    string dayOrNight = "Daylight"; -    DateTime time = new DateTime(); -    if(time.Hour < 7) { -        dayOrNight = "Nighttime"; -    } -    return dayOrNight; -} -``` - -The method now gets the current time from the system and compares the **Hour** value to see if it is less than 7am. If it is, the logic transforms the **dayOrNight** string value from "Daylight" to "Nighttime." The unit test now passes. - -### The start of a test-driven solution - -We now have the beginnings of a base case unit test and a viable solution for our time dependency. There are more than a few more cases to work through.  - -In the next article, I'll demonstrate how to test for daylight hours and how to leverage failure along the way. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/9/mutation-testing-example-tdd - -作者:[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/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) -[2]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd -[3]: https://www.infoq.com/presentations/Architecture-Without-an-End-State/ -[4]: https://opensource.com/sites/default/files/uploads/cat.png (Cat standing on a roof) -[5]: https://www.agilealliance.org/glossary/user-stories -[6]: https://xunit.net/ -[7]: http://www.google.com/search?q=new+msdn.microsoft.com diff --git a/translated/tech/20190923 Mutation testing by example- How to leverage failure.md b/translated/tech/20190923 Mutation testing by example- How to leverage failure.md new file mode 100644 index 0000000000..115b7f05bf --- /dev/null +++ b/translated/tech/20190923 Mutation testing by example- How to leverage failure.md @@ -0,0 +1,205 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mutation testing by example: How to leverage failure) +[#]: via: (https://opensource.com/article/19/9/mutation-testing-example-tdd) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +变异测试:如何利用故障? +====== +使用事先设计好的故障以确保你的代码达到预期的结果,并遵循 .NET xUnit.net 测试框架来进行测试。 +![failure sign at a party, celebrating failure][1] + +[在变异测试是TDD的演变][2]一文中, 我谈到了迭代的力量。在可度量的测试中,迭代能够保证找到问题的解决方案。 在那篇文章中,我们讨论了迭代法帮助确定实现计算给定数字平方根的代码。 + +我还演示了最有效的方法是找到可衡量的目标或测试,然后以最佳猜测值开始迭代。 正如所预期的,第一次测试通常会失败。因此,必须根据可衡量的目标或测试对失败的代码进行完善。 根据运行结果,对测试值进行验证或进一步加以完善。 +在此模型中,学习获得解决方案的唯一方法是反复失败。 这听起来有悖常理,但它确实有效。 + +按照这种分析,本文探讨了在构建包含某些依赖项的解决方案时使用 DevOps 的最佳方法。 第一步是编写一个预期结果失败的用例。 + + +### 依赖性问题是你不能依赖它们 + +正如迈克尔•尼加德(Michael Nygard)在_[Architecture without an end state][3]_,表达的那样,依赖问题是一个很大的话题,最好留到另一篇文章中讨论。 在这里,你将会看到依赖项给项目带来的一些潜在问题,以及 +如何利用测试驱动开发(TDD)来避免这些陷阱。 + +首先,找到现实生活中的一个挑战,然后看看如何使用TDD解决它。 + +### 谁让猫出来? + +![一只猫站在屋顶][4] + + +在敏捷开发环境中,通过定义期望结果开始构建解决方案会很有帮助。 通常,在 [用户故事][5]中描述期望结果: + + +>我想使用我家的自动化系统(HAS)来控制猫何时可以出门,因为我想保证它在夜间的安全。 + + +现在你已经有了一个用户故事,你需要通过提供一些功能要求(即指定验收标准)来对其进行详细说明。 从伪代码中描述的最简单的场景开始: + +> 场景1:在夜间关闭猫门 +> +> * 用时钟监测到晚上时间 +> * 时钟通知 HAS 系统 +> * HAS 关闭支持物联网(IoT)的猫门 +> + + +### 分解系统 + + +开始构建之前,你需要将正在构建的系统(HAS)进行分解(分解为依赖项)。 你必须要做的第一件事是识别任何依赖项(如果幸运的话,你的系统没有依赖项,这将会更容易,但是,这样的系统可以说不是非常有用)。 + +从上面的简单场景中,你可以看到所需的业务成果(自动控制猫门)取决于对夜间情况监测。 这种依赖性取决于时钟。 但是时钟是无法区分白天和夜晚的。 需要你来提供这种逻辑。 + +正在构建的系统中的另一个依赖项是能够自动访问猫门并启用或关闭它。 该依赖项很可能取决于具有 IoT 功能的猫门提供的API。 + + + +### 依赖管理面临快速失败 + +为了满足一个依赖项,我们将构建确定当前时间是白天还是晚上的逻辑。 本着TDD的精神,我们将从一个小小的失败开始。 + + +有关如何设置此练习所需的开发环境和脚手架的详细说明,请参阅我的[上一篇文章][2]。 我们将重用相同的 NET 环境和 [xUnit.net][6] 框架。 + + +接下来,创建一个名为 HAS(“家庭自动化系统”)的新项目,创建一个名为**UnitTest1.cs**的文件。 在该文件中,编写第一个失败的单元测试。 在此单元测试中,描述你的期望结果。 例如,当系统运行时,如果时间是晚上7点,负责确定是白天还是夜晚的组件将返回值“ Nighttime”。 + +这是描述期望值的单元测试: + + +``` +using System; +using Xunit; + +namespace unittest +{ + public class UnitTest1 + { + DayOrNightUtility dayOrNightUtility = [new][7] DayOrNightUtility(); + + [Fact] + public void Given7pmReturnNighttime() + { + var expected = "Nighttime"; + var actual = dayOrNightUtility.GetDayOrNight(); + Assert.Equal(expected, actual); + } + } +} +``` + + +至此,你可能已经熟悉了单元测试的结构。 快速复习:在此示例中,通过给单元测试一个描述性名称**Given7pmReturnNighttime** 来描述期望结果。 然后,在单元测试的主体中,创建一个名为**expected** 的变量,并为该变量指定期望值(在该示例中,值为“ Nighttime”)。 然后,为实际变量指定一个 **actual**(在组件或服务处理一天中的时间之后可用)。 + +最后,通过断言期望值和实际值是否相等来检查是否满足期望结果:**Assert.Equal(expected, actual)**。 + + +你还可以在上面的列表中看到名为**dayOrNightUtility** 的组件或服务。 该模块能够接收消息**GetDayOrNight**,并且返回**string** 类型的值。 + + +同样,本着TDD的精神,描述的组件或服务还尚未构建(仅为了后面说明在此进行描述)。 构建这些是由所描述的期望结果来驱动的。 + +在 **app** 文件夹中创建一个新文件,并将其命名为**DayOrNightUtility.cs**。 将以下 C# 代码添加到该文件中并保存: + + +``` +using System; + +namespace app { + public class DayOrNightUtility { + public string GetDayOrNight() { + string dayOrNight = "Undetermined"; + return dayOrNight; + } + } +} +``` + + +现在转到命令行,将目录更改为**unittests**文件夹,然后运行: + +``` +[Xunit.net 00:00:02.33] unittest.UnitTest1.Given7pmReturnNighttime [FAIL] +Failed unittest.UnitTest1.Given7pmReturnNighttime +[...] +``` + +恭喜,你已经完成了第一个失败的单元测试。 单元测试的期望结果是**DayOrNightUtility**方法返回字符串“ Nighttime”,但相反,它返回是“ Undetermined”。 + +### 修复失败的单元测试 + + +修复失败的测试的一种快速而粗略的方法是将值“ Undetermined”替换为值“ Nighttime”并保存更改: + +``` +using System; + +namespace app { + public class DayOrNightUtility { + public string GetDayOrNight() { + string dayOrNight = "Nighttime"; + return dayOrNight; + } + } +} +``` + +现在运行时,成功了。 + +``` +Starting test execution, please wait... + +Total tests: 1. Passed: 1. Failed: 0. Skipped: 0. +Test Run Successful. +Test execution time: 2.6470 Seconds +``` + +但是,对值进行硬编码基本上是在作弊,最好为**DayOrNightUtility** 方法赋予一些智能。 修改**GetDayOrNight**方法以包括一些时间计算逻辑: + + +``` +public string GetDayOrNight() { + string dayOrNight = "Daylight"; + DateTime time = new DateTime(); + if(time.Hour < 7) { + dayOrNight = "Nighttime"; + } + return dayOrNight; +} +``` + + +该方法现在从系统获取当前时间,并与 **Hour**比较,查看其是否小于上午7点。 如果小于,则处理逻辑将 **dayOrNight**字符串值从“ Daylight”转换为“ Nighttime”。 现在,单元测试通过。 + + +### 测试驱动解决方案的开始 + +现在,我们已经开始了基本的单元测试,并为我们的时间依赖项提供了可行的解决方案。 后面还有更多的测试案例需要执行。 + +在下一篇文章中,我将演示如何对白天时间进行测试以及如何在整个过程中利用故障。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/mutation-testing-example-tdd + +作者:[Alex Bunardzic][a] +选题:[lujun9972][b] +译者:[Morisun029](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/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) +[2]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd +[3]: https://www.infoq.com/presentations/Architecture-Without-an-End-State/ +[4]: https://opensource.com/sites/default/files/uploads/cat.png (Cat standing on a roof) +[5]: https://www.agilealliance.org/glossary/user-stories +[6]: https://xunit.net/ +[7]: http://www.google.com/search?q=new+msdn.microsoft.com From 12f1d95ba861f50797816cb8f0f1ab52f0d16a91 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 00:55:20 +0800 Subject: [PATCH 038/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191018=20How=20?= =?UTF-8?q?to=20Configure=20Rsyslog=20Server=20in=20CentOS=208=20/=20RHEL?= =?UTF-8?q?=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md --- ...ure Rsyslog Server in CentOS 8 - RHEL 8.md | 210 ++++++++++++++++++ 1 file changed, 210 insertions(+) create mode 100644 sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md diff --git a/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md b/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..80bcc96a51 --- /dev/null +++ b/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md @@ -0,0 +1,210 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Configure Rsyslog Server in CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to Configure Rsyslog Server in CentOS 8 / RHEL 8 +====== + +**Rsyslog** is a free and opensource logging utility that exists by default on  **CentOS** 8 and **RHEL** 8 systems. It provides an easy and effective way of **centralizing logs** from client nodes to a single central server. The centralization of logs is beneficial in two ways. First,  it simplifies viewing of logs as the Systems administrator can view all the logs of remote servers from a central point without logging into every client system to check the logs. This is greatly beneficial if there are several servers that need to be monitored and secondly, in the event that a remote client suffers a crash, you need not worry about losing the logs because all the logs will be saved on the **central rsyslog server**. Rsyslog has replaced syslog which only supported **UDP** protocol. It extends the basic syslog protocol with superior features such as support for both **UDP** and **TCP** protocols in transporting logs, augmented filtering abilities, and flexible configuration options. That said, let’s explore how to configure the Rsyslog server in CentOS 8 / RHEL 8 systems. + +[![configure-rsyslog-centos8-rhel8][1]][2] + +### Prerequisites + +We are going to have the following lab setup to test the centralized logging process: + + * **Rsyslog server**       CentOS 8 Minimal    IP address: 10.128.0.47 + * **Client system**         RHEL 8 Minimal      IP address: 10.128.0.48 + + + +From the setup above, we will demonstrate how you can set up the Rsyslog server and later configure the client system to ship logs to the Rsyslog server for monitoring. + +Let’s get started! + +### Configuring the Rsyslog Server on CentOS 8 + +By default, Rsyslog comes installed on CentOS 8 / RHEL 8 servers. To verify the status of Rsyslog, log in via SSH and issue the command: + +``` +$ systemctl status rsyslog +``` + +Sample Output + +![rsyslog-service-status-centos8][1] + +If rsyslog is not present for whatever reason, you can install it using the command: + +``` +$ sudo yum install rsyslog +``` + +Next, you need to modify a few settings in the Rsyslog configuration file. Open the configuration file. + +``` +$ sudo vim /etc/rsyslog.conf +``` + +Scroll and uncomment the lines shown below to allow reception of logs via UDP protocol + +``` +module(load="imudp") # needs to be done just once +input(type="imudp" port="514") +``` + +![rsyslog-conf-centos8-rhel8][1] + +Similarly, if you prefer to enable TCP rsyslog reception uncomment the lines: + +``` +module(load="imtcp") # needs to be done just once +input(type="imtcp" port="514") +``` + +![rsyslog-conf-tcp-centos8-rhel8][1] + +Save and exit the configuration file. + +To receive the logs from the client system,  we need to open Rsyslog default port 514 on the firewall. To achieve this, run + +``` +# sudo firewall-cmd --add-port=514/tcp --zone=public --permanent +``` + +Next, reload the firewall to save the changes + +``` +# sudo firewall-cmd --reload +``` + +Sample Output + +![firewall-ports-rsyslog-centos8][1] + +Next, restart Rsyslog server + +``` +$ sudo systemctl restart rsyslog +``` + +To enable Rsyslog on boot, run beneath command + +``` +$ sudo systemctl enable rsyslog +``` + +To confirm that the Rsyslog server is listening on port 514, use the netstat command as follows: + +``` +$ sudo netstat -pnltu +``` + +Sample Output + +![netstat-rsyslog-port-centos8][1] + +Perfect! we have successfully configured our Rsyslog server to receive logs from the client system. + +To view log messages in real-time run the command: + +``` +$ tail -f /var/log/messages +``` + +Let’s now configure the client system. + +### Configuring the client system on RHEL 8 + +Like the Rsyslog server, log in and check if the rsyslog daemon is running by issuing the command: + +``` +$ sudo systemctl status rsyslog +``` + +Sample Output + +![client-rsyslog-service-rhel8][1] + +Next, proceed to open the rsyslog configuration file + +``` +$ sudo vim /etc/rsyslog.conf +``` + +At the end of the file, append the following line + +``` +*.* @10.128.0.47:514 # Use @ for UDP protocol +*.* @@10.128.0.47:514 # Use @@ for TCP protocol +``` + +Save and exit the configuration file. Just like the Rsyslog Server, open port 514 which is the default Rsyslog port on the firewall + +``` +$ sudo firewall-cmd --add-port=514/tcp --zone=public --permanent +``` + +Next, reload the firewall to save the changes + +``` +$ sudo firewall-cmd --reload +``` + +Next,  restart the rsyslog service + +``` +$ sudo systemctl restart rsyslog +``` + +To enable Rsyslog on boot, run following command + +``` +$ sudo systemctl enable rsyslog +``` + +### Testing the logging operation + +Having successfully set up and configured Rsyslog Server and client system, it’s time to verify of your configuration is working as intended. + +On the client system issue the command: + +``` +# logger "Hello guys! This is our first log" +``` + +Now head out to the Rsyslog server and run the command below to check the logs messages in real-time + +``` +# tail -f /var/log/messages +``` + +The output from the command run on the client system should register on the Rsyslog server’s log messages to imply that the  Rsyslog server is now receiving logs from the client system. + +![centralize-logs-rsyslogs-centos8][1] + +And that’s it, guys! We have successfully setup the Rsyslog server to receive log messages from a client system. + +Read Also: **[How to Setup Multi Node Elastic Stack Cluster on RHEL 8 / CentOS 8][3]** + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/ + +作者:[James Kiarie][a] +选题:[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/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/configure-rsyslog-centos8-rhel8.jpg +[3]: https://www.linuxtechi.com/setup-multinode-elastic-stack-cluster-rhel8-centos8/ From 932efafc02dc2d258b1c96b3bbde03bef8ed61d5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:08:01 +0800 Subject: [PATCH 039/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191018=20How=20?= =?UTF-8?q?to=20use=20Protobuf=20for=20data=20interchange?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191018 How to use Protobuf for data interchange.md --- ...ow to use Protobuf for data interchange.md | 516 ++++++++++++++++++ 1 file changed, 516 insertions(+) create mode 100644 sources/tech/20191018 How to use Protobuf for data interchange.md diff --git a/sources/tech/20191018 How to use Protobuf for data interchange.md b/sources/tech/20191018 How to use Protobuf for data interchange.md new file mode 100644 index 0000000000..4de9e2120a --- /dev/null +++ b/sources/tech/20191018 How to use Protobuf for data interchange.md @@ -0,0 +1,516 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Protobuf for data interchange) +[#]: via: (https://opensource.com/article/19/10/protobuf-data-interchange) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +How to use Protobuf for data interchange +====== +Protobuf encoding increases efficiency when exchanging data between +applications written in different languages and running on different +platforms. +![metrics and data shown on a computer screen][1] + +Protocol buffers ([Protobufs][2]), like XML and JSON, allow applications, which may be written in different languages and running on different platforms, to exchange data. For example, a sending application written in Go could encode a Go-specific sales order in Protobuf, which a receiver written in Java then could decode to get a Java-specific representation of the received order. Here is a sketch of the architecture over a network connection: + + +``` +`Go sales order--->Pbuf-encode--->network--->Pbuf-decode--->Java sales order` +``` + +Protobuf encoding, in contrast to its XML and JSON counterparts, is binary rather than text, which can complicate debugging. However, as the code examples in this article confirm, the Protobuf encoding is significantly more efficient in size than either XML or JSON encoding. + +Protobuf is efficient in another way. At the implementation level, Protobuf and other encoding systems serialize and deserialize structured data. Serialization transforms a language-specific data structure into a bytestream, and deserialization is the inverse operation that transforms a bytestream back into a language-specific data structure. Serialization and deserialization may become the bottleneck in data interchange because these operations are CPU-intensive. Efficient serialization and deserialization is another Protobuf design goal. + +Recent encoding technologies, such as Protobuf and FlatBuffers, derive from the [DCE/RPC][3] (Distributed Computing Environment/Remote Procedure Call) initiative of the early 1990s. Like DCE/RPC, Protobuf contributes to both the [IDL][4] (interface definition language) and the encoding layer in data interchange. + +This article will look at these two layers then provide code examples in Go and Java to flesh out Protobuf details and show that Protobuf is easy to use. + +### Protobuf as an IDL and encoding layer + +DCE/RPC, like Protobuf, is designed to be language- and platform-neutral. The appropriate libraries and utilities allow any language and platform to play in the DCE/RPC arena. Furthermore, the DCE/RPC architecture is elegant. An IDL document is the contract between the remote procedure on the one side and callers on the other side. Protobuf, too, centers on an IDL document. + +An IDL document is text and, in DCE/RPC, uses basic C syntax along with syntactic extensions for metadata (square brackets) and a few new keywords such as **interface**. Here is an example: + + +``` +[uuid (2d6ead46-05e3-11ca-7dd1-426909beabcd), version(1.0)] +interface echo { +   const long int ECHO_SIZE = 512; +   void echo( +      [in]          handle_t h, +      [in, string]  idl_char from_client[ ], +      [out, string] idl_char from_service[ECHO_SIZE] +   ); +} +``` + +This IDL document declares a procedure named **echo**, which takes three arguments: the **[in]** arguments of type **handle_t** (implementation pointer) and **idl_char** (array of ASCII characters) are passed to the remote procedure, whereas the **[out]** argument (also a string) is passed back from the procedure. In this example, the **echo** procedure does not explicitly return a value (the **void** to the left of **echo**) but could do so. A return value, together with one or more **[out]** arguments, allows the remote procedure to return arbitrarily many values. The next section introduces a Protobuf IDL, which differs in syntax but likewise serves as a contract in data interchange. + +The IDL document, in both DCE/RPC and Protobuf, is the input to utilities that create the infrastructure code for exchanging data: + + +``` +`IDL document--->DCE/PRC or Protobuf utilities--->support code for data interchange` +``` + +As relatively straightforward text, the IDL is likewise human-readable documentation about the specifics of the data interchange—in particular, the number of data items exchanged and the data type of each item. + +Protobuf can used in a modern RPC system such as [gRPC][5]; but Protobuf on its own provides only the IDL layer and the encoding layer for messages passed from a sender to a receiver. Protobuf encoding, like the DCE/RPC original, is binary but more efficient. + +At present, XML and JSON encodings still dominate in data interchange through technologies such as web services, which make use of in-place infrastructure such as web servers, transport protocols (e.g., TCP, HTTP), and standard libraries and utilities for processing XML and JSON documents. Moreover, database systems of various flavors can store XML and JSON documents, and even legacy relational systems readily generate XML encodings of query results. Every general-purpose programming language now has libraries that support XML and JSON. What, then, recommends a return to a _binary_ encoding system such as Protobuf? + +Consider the negative decimal value **-128**. In the 2's complement binary representation, which dominates across systems and languages, this value can be stored in a single 8-bit byte: 10000000. The text encoding of this integer value in XML or JSON requires multiple bytes. For example, UTF-8 encoding requires four bytes for the string, literally **-128**, which is one byte per character (in hex, the values are 0x2d, 0x31, 0x32, and 0x38). XML and JSON also add markup characters, such as angle brackets and braces, to the mix. Details about Protobuf encoding are forthcoming, but the point of interest now is a general one: Text encodings tend to be significantly less compact than binary ones. + +### A code example in Go using Protobuf + +My code examples focus on Protobuf rather than RPC. Here is an overview of the first example: + + * The IDL file named _dataitem.proto_ defines a Protobuf **message** with six fields of different types: integer values with different ranges, floating-point values of a fixed size, and strings of two different lengths. + * The Protobuf compiler uses the IDL file to generate a Go-specific version (and, later, a Java-specific version) of the Protobuf **message** together with supporting functions. + * A Go app populates the native Go data structure with randomly generated values and then serializes the result to a local file. For comparison, XML and JSON encodings also are serialized to local files. + * As a test, the Go application reconstructs an instance of its native data structure by deserializing the contents of the Protobuf file. + * As a language-neutrality test, the Java application also deserializes the contents of the Protobuf file to get an instance of a native data structure. + + + +This IDL file and two Go and one Java source files are available as a ZIP file on [my website][6]. + +The all-important Protobuf IDL document is shown below. The document is stored in the file _dataitem.proto_, with the customary _.proto_ extension. + +#### Example 1. Protobuf IDL document + + +``` +syntax = "proto3"; + +package main; + +message DataItem { +  int64  oddA  = 1; +  int64  evenA = 2; +  int32  oddB  = 3; +  int32  evenB = 4; +  float  small = 5; +  float  big   = 6; +  string short = 7; +  string long  = 8; +} +``` + +The IDL uses the current proto3 rather than the earlier proto2 syntax. The package name (in this case, **main**) is optional but customary; it is used to avoid name conflicts. The structured **message** contains eight fields, each of which has a Protobuf data type (e.g., **int64**, **string**), a name (e.g., **oddA**, **short**), and a numeric tag (aka key) after the equals sign **=**. The tags, which are 1 through 8 in this example, are unique integer identifiers that determine the order in which the fields are serialized. + +Protobuf messages can be nested to arbitrary levels, and one message can be the field type in the other. Here's an example that uses the **DataItem** message as a field type: + + +``` +message DataItems { +  repeated DataItem item = 1; +} +``` + +A single **DataItems** message consists of repeated (none or more) **DataItem** messages. + +Protobuf also supports enumerated types for clarity: + + +``` +enum PartnershipStatus { +  reserved "FREE", "CONSTRAINED", "OTHER"; +} +``` + +The **reserved** qualifier ensures that the numeric values used to implement the three symbolic names cannot be reused. + +To generate a language-specific version of one or more declared Protobuf **message** structures, the IDL file containing these is passed to the _protoc_ compiler (available in the [Protobuf GitHub repository][7]). For the Go code, the supporting Protobuf library can be installed in the usual way (with **%** as the command-line prompt): + + +``` +`% go get github.com/golang/protobuf/proto` +``` + +The command to compile the Protobuf IDL file _dataitem.proto_ into Go source code is: + + +``` +`% protoc --go_out=. dataitem.proto` +``` + +The flag **\--go_out** directs the compiler to generate Go source code; there are similar flags for other languages. The result, in this case, is a file named _dataitem.pb.go_, which is small enough that the essentials can be copied into a Go application. Here are the essentials from the generated code: + + +``` +var _ = proto.Marshal + +type DataItem struct { +   OddA  int64   `protobuf:"varint,1,opt,name=oddA" json:"oddA,omitempty"` +   EvenA int64   `protobuf:"varint,2,opt,name=evenA" json:"evenA,omitempty"` +   OddB  int32   `protobuf:"varint,3,opt,name=oddB" json:"oddB,omitempty"` +   EvenB int32   `protobuf:"varint,4,opt,name=evenB" json:"evenB,omitempty"` +   Small float32 `protobuf:"fixed32,5,opt,name=small" json:"small,omitempty"` +   Big   float32 `protobuf:"fixed32,6,opt,name=big" json:"big,omitempty"` +   Short string  `protobuf:"bytes,7,opt,name=short" json:"short,omitempty"` +   Long  string  `protobuf:"bytes,8,opt,name=long" json:"long,omitempty"` +} + +func (m *DataItem) Reset()         { *m = DataItem{} } +func (m *DataItem) String() string { return proto.CompactTextString(m) } +func (*DataItem) ProtoMessage()    {} +func init() {} +``` + +The compiler-generated code has a Go structure **DataItem**, which exports the Go fields—the names are now capitalized—that match the names declared in the Protobuf IDL. The structure fields have standard Go data types: **int32**, **int64**, **float32**, and **string**. At the end of each field line, as a string, is metadata that describes the Protobuf types, gives the numeric tags from the Protobuf IDL document, and provides information about JSON, which is discussed later. + +There are also functions; the most important is **proto.Marshal** for serializing an instance of the **DataItem** structure into Protobuf format. The helper functions include **Reset**, which clears a **DataItem** structure, and **String**, which produces a one-line string representation of a **DataItem**. + +The metadata that describes Protobuf encoding deserves a closer look before analyzing the Go program in more detail. + +### Protobuf encoding + +A Protobuf message is structured as a collection of key/value pairs, with the numeric tag as the key and the corresponding field as the value. The field names, such as **oddA** and **small**, are for human readability, but the _protoc_ compiler does use the field names in generating language-specific counterparts. For example, the **oddA** and **small** names in the Protobuf IDL become the fields **OddA** and **Small**, respectively, in the Go structure. + +The keys and their values both get encoded, but with an important difference: some numeric values have a fixed-size encoding of 32 or 64 bits, whereas others (including the **message** tags) are _varint_ encoded—the number of bits depends on the integer's absolute value. For example, the integer values 1 through 15 require 8 bits to encode in _varint_, whereas the values 16 through 2047 require 16 bits. The _varint_ encoding, similar in spirit (but not in detail) to UTF-8 encoding, favors small integer values over large ones. (For a detailed analysis, see the Protobuf [encoding guide][8].) The upshot is that a Protobuf **message** should have small integer values in fields, if possible, and as few keys as possible, but one key per field is unavoidable. + +Table 1 below gives the gist of Protobuf encoding: + +**Table 1. Protobuf data types** + +Encoding | Sample types | Length +---|---|--- +varint | int32, uint32, int64 | Variable length +fixed | fixed32, float, double | Fixed 32-bit or 64-bit length +byte sequence | string, bytes | Sequence length + +Integer types that are not explicitly **fixed** are _varint_ encoded; hence, in a _varint_ type such as **uint32** (**u** for unsigned), the number 32 describes the integer's range (in this case, 0 to 232 \- 1) rather than its bit size, which differs depending on the value. For fixed types such as **fixed32** or **double**, by contrast, the Protobuf encoding requires 32 and 64 bits, respectively. Strings in Protobuf are byte sequences; hence, the size of the field encoding is the length of the byte sequence. + +Another efficiency deserves mention. Recall the earlier example in which a **DataItems** message consists of repeated **DataItem** instances: + + +``` +message DataItems { +  repeated DataItem item = 1; +} +``` + +The **repeated** means that the **DataItem** instances are _packed_: the collection has a single tag, in this case, 1. A **DataItems** message with repeated **DataItem** instances is thus more efficient than a message with multiple but separate **DataItem** fields, each of which would require a tag of its own. + +With this background in mind, let's return to the Go program. + +### The dataItem program in detail + +The _dataItem_ program creates a **DataItem** instance and populates the fields with randomly generated values of the appropriate types. Go has a **rand** package with functions for generating pseudo-random integer and floating-point values, and my **randString** function generates pseudo-random strings of specified lengths from a character set. The design goal is to have a **DataItem** instance with field values of different types and bit sizes. For example, the **OddA** and **EvenA** values are 64-bit non-negative integer values of odd and even parity, respectively; but the **OddB** and **EvenB** variants are 32 bits in size and hold small integer values between 0 and 2047. The random floating-point values are 32 bits in size, and the strings are 16 (**Short**) and 32 (**Long**) characters in length. Here is the code segment that populates the **DataItem** structure with random values: + + +``` +// variable-length integers +n1 := rand.Int63()        // bigger integer +if (n1 & 1) == 0 { n1++ } // ensure it's odd +... +n3 := rand.Int31() % UpperBound // smaller integer +if (n3 & 1) == 0 { n3++ }       // ensure it's odd + +// fixed-length floats +... +t1 := rand.Float32() +t2 := rand.Float32() +... +// strings +str1 := randString(StrShort) +str2 := randString(StrLong) + +// the message +dataItem := &DataItem { +   OddA:  n1, +   EvenA: n2, +   OddB:  n3, +   EvenB: n4, +   Big:   f1, +   Small: f2, +   Short: str1, +   Long:  str2, +} +``` + +Once created and populated with values, the **DataItem** instance is encoded in XML, JSON, and Protobuf, with each encoding written to a local file: + + +``` +func encodeAndserialize(dataItem *DataItem) { +   bytes, _ := xml.MarshalIndent(dataItem, "", " ")  // Xml to dataitem.xml +   ioutil.WriteFile(XmlFile, bytes, 0644)            // 0644 is file access permissions + +   bytes, _ = json.MarshalIndent(dataItem, "", " ")  // Json to dataitem.json +   ioutil.WriteFile(JsonFile, bytes, 0644) + +   bytes, _ = proto.Marshal(dataItem)                // Protobuf to dataitem.pbuf +   ioutil.WriteFile(PbufFile, bytes, 0644) +} +``` + +The three serializing functions use the term _marshal_, which is roughly synonymous with _serialize_. As the code indicates, each of the three **Marshal** functions returns an array of bytes, which then are written to a file. (Possible errors are ignored for simplicity.) On a sample run, the file sizes were: + + +``` +dataitem.xml:  262 bytes +dataitem.json: 212 bytes +dataitem.pbuf:  88 bytes +``` + +The Protobuf encoding is significantly smaller than the other two. The XML and JSON serializations could be reduced slightly in size by eliminating indentation characters, in this case, blanks and newlines. + +Below is the _dataitem.json_ file resulting eventually from the **json.MarshalIndent** call, with added comments starting with **##**: + + +``` +{ + "oddA":  4744002665212642479,                ## 64-bit >= 0 + "evenA": 2395006495604861128,                ## ditto + "oddB":  57,                                 ## 32-bit >= 0 but < 2048 + "evenB": 468,                                ## ditto + "small": 0.7562016,                          ## 32-bit floating-point + "big":   0.85202795,                         ## ditto + "short": "ClH1oDaTtoX$HBN5",                 ## 16 random chars + "long":  "xId0rD3Cri%3Wt%^QjcFLJgyXBu9^DZI"  ## 32 random chars +} +``` + +Although the serialized data goes into local files, the same approach would be used to write the data to the output stream of a network connection. + +### Testing serialization/deserialization + +The Go program next runs an elementary test by deserializing the bytes, which were written earlier to the _dataitem.pbuf_ file, into a **DataItem** instance. Here is the code segment, with the error-checking parts removed: + + +``` +filebytes, err := ioutil.ReadFile(PbufFile) // get the bytes from the file +... +testItem.Reset()                            // clear the DataItem structure +err = proto.Unmarshal(filebytes, testItem)  // deserialize into a DataItem instance +``` + +The **proto.Unmarshal** function for deserializing Protbuf is the inverse of the **proto.Marshal** function. The original **DataItem** and the deserialized clone are printed to confirm an exact match: + + +``` +Original: +2041519981506242154 3041486079683013705 1192 1879 +0.572123 0.326855 +boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& + +Deserialized: +2041519981506242154 3041486079683013705 1192 1879 +0.572123 0.326855 +boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& +``` + +### A Protobuf client in Java + +The example in Java is to confirm Protobuf's language neutrality. The original IDL file could be used to generate the Java support code, which involves nested classes. To suppress warnings, however, a slight addition can be made. Here is the revision, which specifies a **DataMsg** as the name for the outer class, with the inner class automatically named **DataItem** after the Protobuf message: + + +``` +syntax = "proto3"; + +package main; + +option java_outer_classname = "DataMsg"; + +message DataItem { +... +``` + +With this change in place, the _protoc_ compilation is the same as before, except the desired output is now Java rather than Go: + + +``` +`% protoc --java_out=. dataitem.proto` +``` + +The resulting source file (in a subdirectory named _main_) is _DataMsg.java_ and about 1,120 lines in length: Java is not terse. Compiling and then running the Java code requires a JAR file with the library support for Protobuf. This file is available in the [Maven repository][9]. + +With the pieces in place, my test code is relatively short (and available in the ZIP file as _Main.java_): + + +``` +package main; +import java.io.FileInputStream; + +public class Main { +   public static void main(String[] args) { +      String path = "dataitem.pbuf";  // from the Go program's serialization +      try { +         DataMsg.DataItem deserial = +           DataMsg.DataItem.newBuilder().mergeFrom(new FileInputStream(path)).build(); + +         System.out.println(deserial.getOddA()); // 64-bit odd +         System.out.println(deserial.getLong()); // 32-character string +      } +      catch(Exception e) { System.err.println(e); } +    } +} +``` + +Production-grade testing would be far more thorough, of course, but even this preliminary test confirms the language-neutrality of Protobuf: the _dataitem.pbuf_ file results from the Go program's serialization of a Go **DataItem**, and the bytes in this file are deserialized to produce a **DataItem** instance in Java. The output from the Java test is the same as that from the Go test. + +### Wrapping up with the numPairs program + +Let's end with an example that highlights Protobuf efficiency but also underscores the cost involved in any encoding technology. Consider this Protobuf IDL file: + + +``` +syntax = "proto3"; +package main; + +message NumPairs { +  repeated NumPair pair = 1; +} + +message NumPair { +  int32 odd = 1; +  int32 even = 2; +} +``` + +A **NumPair** message consists of two **int32** values together with an integer tag for each field. A **NumPairs** message is a sequence of embedded **NumPair** messages. + +The _numPairs_ program in Go (below) creates 2 million **NumPair** instances, with each appended to the **NumPairs** message. This message can be serialized and deserialized in the usual way. + +#### Example 2. The numPairs program + + +``` +package main + +import ( +   "math/rand" +   "time" +   "encoding/xml" +   "encoding/json" +   "io/ioutil" +   "github.com/golang/protobuf/proto" +) + +// protoc-generated code: start +var _ = proto.Marshal +type NumPairs struct { +   Pair []*NumPair `protobuf:"bytes,1,rep,name=pair" json:"pair,omitempty"` +} + +func (m *NumPairs) Reset()         { *m = NumPairs{} } +func (m *NumPairs) String() string { return proto.CompactTextString(m) } +func (*NumPairs) ProtoMessage()    {} +func (m *NumPairs) GetPair() []*NumPair { +   if m != nil { return m.Pair } +   return nil +} + +type NumPair struct { +   Odd  int32 `protobuf:"varint,1,opt,name=odd" json:"odd,omitempty"` +   Even int32 `protobuf:"varint,2,opt,name=even" json:"even,omitempty"` +} + +func (m *NumPair) Reset()         { *m = NumPair{} } +func (m *NumPair) String() string { return proto.CompactTextString(m) } +func (*NumPair) ProtoMessage()    {} +func init() {} +// protoc-generated code: finish + +var numPairsStruct NumPairs +var numPairs = &numPairsStruct + +func encodeAndserialize() { +   // XML encoding +   filename := "./pairs.xml" +   bytes, _ := xml.MarshalIndent(numPairs, "", " ") +   ioutil.WriteFile(filename, bytes, 0644) + +   // JSON encoding +   filename = "./pairs.json" +   bytes, _ = json.MarshalIndent(numPairs, "", " ") +   ioutil.WriteFile(filename, bytes, 0644) + +   // ProtoBuf encoding +   filename = "./pairs.pbuf" +   bytes, _ = proto.Marshal(numPairs) +   ioutil.WriteFile(filename, bytes, 0644) +} + +const HowMany = 200 * 100  * 100 // two million + +func main() { +   rand.Seed(time.Now().UnixNano()) + +   // uncomment the modulus operations to get the more efficient version +   for i := 0; i < HowMany; i++ { +      n1 := rand.Int31() // % 2047 +      if (n1 & 1) == 0 { n1++ } // ensure it's odd +      n2 := rand.Int31() // % 2047 +      if (n2 & 1) == 1 { n2++ } // ensure it's even + +      next := &NumPair { +                 Odd:  n1, +                 Even: n2, +              } +      numPairs.Pair = append(numPairs.Pair, next) +   } +   encodeAndserialize() +} +``` + +The randomly generated odd and even values in each **NumPair** range from zero to 2 billion and change. In terms of raw rather than encoded data, the integers generated in the Go program add up to 16MB: two integers per **NumPair** for a total of 4 million integers in all, and each value is four bytes in size. + +For comparison, the table below has entries for the XML, JSON, and Protobuf encodings of the 2 million **NumPair** instances in the sample **NumsPairs** message. The raw data is included, as well. Because the _numPairs_ program generates random values, output differs across sample runs but is close to the sizes shown in the table. + +**Table 2. Encoding overhead for 16MB of integers** + +Encoding | File | Byte size | Pbuf/other ratio +---|---|---|--- +None | pairs.raw | 16MB | 169% +Protobuf | pairs.pbuf | 27MB | — +JSON | pairs.json | 100MB | 27% +XML | pairs.xml | 126MB | 21% + +As expected, Protobuf shines next to XML and JSON. The Protobuf encoding is about a quarter of the JSON one and about a fifth of the XML one. But the raw data make clear that Protobuf incurs the overhead of encoding: the serialized Protobuf message is 11MB larger than the raw data. Any encoding, including Protobuf, involves structuring the data, which unavoidably adds bytes. + +Each of the serialized 2 million **NumPair** instances involves _four_ integer values: one apiece for the **Even** and **Odd** fields in the Go structure, and one tag per each field in the Protobuf encoding. As raw rather than encoded data, this would come to 16 bytes per instance, and there are 2 million instances in the sample **NumPairs** message. But the Protobuf tags, like the **int32** values in the **NumPair** fields, use _varint_ encoding and, therefore, vary in byte length; in particular, small integer values (which include the tags, in this case) require fewer than four bytes to encode. + +If the _numPairs_ program is revised so that the two **NumPair** fields hold values less than 2048, which have encodings of either one or two bytes, then the Protobuf encoding drops from 27MB to 16MB—the very size of the raw data. The table below summarizes the new encoding sizes from a sample run. + +**Table 3. Encoding with 16MB of integers < 2048** + +Encoding | File | Byte size | Pbuf/other ratio +---|---|---|--- +None | pairs.raw | 16MB | 100% +Protobuf | pairs.pbuf | 16MB | — +JSON | pairs.json | 77MB | 21% +XML | pairs.xml | 103MB | 15% + +In summary, the modified _numPairs_ program, with field values less than 2048, reduces the four-byte size for each integer value in the raw data. But the Protobuf encoding still requires tags, which add bytes to the Protobuf message. Protobuf encoding does have a cost in message size, but this cost can be reduced by the _varint_ factor if relatively small integer values, whether in fields or keys, are being encoded. + +For moderately sized messages consisting of structured data with mixed types—and relatively small integer values—Protobuf has a clear advantage over options such as XML and JSON. In other cases, the data may not be suited for Protobuf encoding. For example, if two applications need to share a huge set of text records or large integer values, then compression rather than encoding technology may be the way to go. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/protobuf-data-interchange + +作者:[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/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://developers.google.com/protocol-buffers/ +[3]: https://en.wikipedia.org/wiki/DCE/RPC +[4]: https://en.wikipedia.org/wiki/Interface_description_language +[5]: https://grpc.io/ +[6]: http://condor.depaul.edu/mkalin +[7]: https://github.com/protocolbuffers/protobuf +[8]: https://developers.google.com/protocol-buffers/docs/encoding +[9]: https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java From c1bfccea2306f5375d93e7499052b4dfd8fe54db Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:13:19 +0800 Subject: [PATCH 040/800] add done: 20191018 How to use Protobuf for data interchange.md --- ...Perceiving Python programming paradigms.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20191018 Perceiving Python programming paradigms.md diff --git a/sources/tech/20191018 Perceiving Python programming paradigms.md b/sources/tech/20191018 Perceiving Python programming paradigms.md new file mode 100644 index 0000000000..9a0027d61d --- /dev/null +++ b/sources/tech/20191018 Perceiving Python programming paradigms.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Perceiving Python programming paradigms) +[#]: via: (https://opensource.com/article/19/10/python-programming-paradigms) +[#]: author: (Jigyasa Grover https://opensource.com/users/jigyasa-grover) + +Perceiving Python programming paradigms +====== +Python supports imperative, functional, procedural, and object-oriented +programming; here are tips on choosing the right one for a specific use +case. +![A python with a package.][1] + +Early each year, TIOBE announces its Programming Language of The Year. When its latest annual [TIOBE index][2] report came out, I was not at all surprised to see [Python again winning the title][3], which was based on capturing the most search engine ranking points (especially on Google, Bing, Yahoo, Wikipedia, Amazon, YouTube, and Baidu) in 2018. + +![Python data from TIOBE Index][4] + +Adding weight to TIOBE's findings, earlier this year, nearly 90,000 developers took Stack Overflow's annual [Developer Survey][5], which is the largest and most comprehensive survey of people who code around the world. The main takeaway from this year's results was: + +> "Python, the fastest-growing major programming language, has risen in the ranks of programming languages in our survey yet again, edging out Java this year and standing as the second most loved language (behind Rust)." + +Ever since I started programming and exploring different languages, I have seen admiration for Python soaring high. Since 2003, it has consistently been among the top 10 most popular programming languages. As TIOBE's report stated: + +> "It is the most frequently taught first language at universities nowadays, it is number one in the statistical domain, number one in AI programming, number one in scripting and number one in writing system tests. Besides this, Python is also leading in web programming and scientific computing (just to name some other domains). In summary, Python is everywhere." + +There are several reasons for Python's rapid rise, bloom, and dominance in multiple domains, including web development, scientific computing, testing, data science, machine learning, and more. The reasons include its readable and maintainable code; extensive support for third-party integrations and libraries; modular, dynamic, and portable structure; flexible programming; learning ease and support; user-friendly data structures; productivity and speed; and, most important, community support. The diverse application of Python is a result of its combined features, which give it an edge over other languages. + +But in my opinion, the comparative simplicity of its syntax and the staggering flexibility it provides developers coming from many other languages win the cake. Very few languages can match Python's ability to conform to a developer's coding style rather than forcing him or her to code in a particular way. Python lets more advanced developers use the style they feel is best suited to solve a particular problem. + +While working with Python, you are like a snake charmer. This allows you to take advantage of Python's promise to offer a non-conforming environment for developers to code in the style best suited for a particular situation and to make the code more readable, testable, and coherent. + +## Python programming paradigms + +Python supports four main [programming paradigms][6]: imperative, functional, procedural, and object-oriented. Whether you agree that they are valid or even useful, Python strives to make all four available and working. Before we dive in to see which programming paradigm is most suitable for specific use cases, it is a good time to do a quick review of them. + +### Imperative programming paradigm + +The [imperative programming paradigm][7] uses the imperative mood of natural language to express directions. It executes commands in a step-by-step manner, just like a series of verbal commands. Following the "how-to-solve" approach, it makes direct changes to the state of the program; hence it is also called the stateful programming model. Using the imperative programming paradigm, you can quickly write very simple yet elegant code, and it is super-handy for tasks that involve data manipulation. Owing to its comparatively slower and sequential execution strategy, it cannot be used for complex or parallel computations. + +[![Linus Torvalds quote][8]][9] + +Consider this example task, where the goal is to take a list of characters and concatenate it to form a string. A way to do it in an imperative programming style would be something like: + + +``` +>>> sample_characters = ['p','y','t','h','o','n'] +>>> sample_string = '' +>>> sample_string +'' +>>> sample_string = sample_string + sample_characters[0] +>>> sample_string +'p' +>>> sample_string = sample_string + sample_characters[1] +>>> sample_string +'py' +>>> sample_string = sample_string + sample_characters[2] +>>> sample_string +'pyt' +>>> sample_string = sample_string + sample_characters[3] +>>> sample_string +'pyth' +>>> sample_string = sample_string + sample_characters[4] +>>> sample_string +'pytho' +>>> sample_string = sample_string + sample_characters[5] +>>> sample_string +'python' +>>> +``` + +Here, the variable **sample_string** is also like a state of the program that is getting changed after executing the series of commands, and it can be easily extracted to track the progress of the program. The same can be done using a **for** loop (also considered imperative programming) in a shorter version of the above code: + + +``` +>>> sample_characters = ['p','y','t','h','o','n'] +>>> sample_string = '' +>>> sample_string +>>> for c in sample_characters: +...    sample_string = sample_string + c +...    print(sample_string) +... +p +py +pyt +pyth +pytho +python +>>> +``` + +### Functional programming paradigm + +The [functional programming paradigm][10] treats program computation as the evaluation of mathematical functions based on [lambda calculus][11]. Lambda calculus is a formal system in mathematical logic for expressing computation based on function abstraction and application using variable binding and substitution. It follows the "what-to-solve" approach—that is, it expresses logic without describing its control flow—hence it is also classified as the declarative programming model. + +The functional programming paradigm promotes stateless functions, but it's important to note that Python's implementation of functional programming deviates from standard implementation. Python is said to be an _impure_ functional language because it is possible to maintain state and create side effects if you are not careful. That said, functional programming is handy for parallel processing and is super-efficient for tasks requiring recursion and concurrent execution. + + +``` +>>> sample_characters = ['p','y','t','h','o','n'] +>>> import functools +>>> sample_string = functools.reduce(lambda s,c: s + c, sample_characters) +>>> sample_string +'python' +>>> +``` + +Using the same example, the functional way of concatenating a list of characters to form a string would be the same as above. Since the computation happens in a single line, there is no explicit way to obtain the state of the program with **sample_string** and track the progress. The functional programming implementation of this example is fascinating, as it reduces the lines of code and simply does its job in a single line, with the exception of using the **functools** module and the **reduce** method. The three keywords—**functools**, **reduce**, and **lambda**—are defined as follows: + + * **functools** is a module for higher-order functions and provides for functions that act on or return other functions. It encourages writing reusable code, as it is easier to replicate existing functions with some arguments already passed and create a new version of a function in a well-documented manner. + * **reduce** is a method that applies a function of two arguments cumulatively to the items in sequence, from left to right, to reduce the sequence to a single value. For example: [code] >>> sample_list = [1,2,3,4,5] +>>> import functools +>>> sum = functools.reduce(lambda x,y: x + y, sample_list) +>>> sum +15 +>>> ((((1+2)+3)+4)+5) +15 +>>> +``` + * **lambda functions** are small, anonymized (i.e., nameless) functions that can take any number of arguments but spit out only one value. They are useful when they are used as an argu \ No newline at end of file From 27316934f7215d3d79a4b65b0ccf0e1c36e0b503 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:32:57 +0800 Subject: [PATCH 041/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191017=20Intro?= =?UTF-8?q?=20to=20the=20Linux=20useradd=20command?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191017 Intro to the Linux useradd command.md --- ...1017 Intro to the Linux useradd command.md | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 sources/tech/20191017 Intro to the Linux useradd command.md diff --git a/sources/tech/20191017 Intro to the Linux useradd command.md b/sources/tech/20191017 Intro to the Linux useradd command.md new file mode 100644 index 0000000000..b2befd4650 --- /dev/null +++ b/sources/tech/20191017 Intro to the Linux useradd command.md @@ -0,0 +1,218 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Intro to the Linux useradd command) +[#]: via: (https://opensource.com/article/19/10/linux-useradd-command) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +Intro to the Linux useradd command +====== +Add users (and customize their accounts as needed) with the useradd +command. +![people in different locations who are part of the same team][1] + +Adding a user is one of the most fundamental exercises on any computer system; this article focuses on how to do it on a Linux system. + +Before getting started, I want to mention three fundamentals to keep in mind. First, like with most operating systems, Linux users need an account to be able to log in. This article specifically covers local accounts, not network accounts such as LDAP. Second, accounts have both a name (called a username) and a number (called a user ID). Third, users are typically placed into a group. Groups also have a name and group ID. + +As you'd expect, Linux includes a command-line utility for adding users; it's called **useradd**. You may also find the command **adduser**. Many distributions have added this symbolic link to the **useradd** command as a matter of convenience. + + +``` +$ file `which adduser` +/usr/sbin/adduser: symbolic link to useradd +``` + +Let's take a look at **useradd**. + +> Note: The defaults described in this article reflect those in Red Hat Enterprise Linux 8.0. You may find subtle differences in these files and certain defaults on other Linux distributions or other Unix operating systems such as FreeBSD or Solaris. + +### Default behavior + +The basic usage of **useradd** is quite simple: A user can be added just by providing their username. + + +``` +`$ sudo useradd sonny` +``` + +In this example, the **useradd** command creates an account called _sonny_. A group with the same name is also created, and _sonny_ is placed in it to be used as the primary group. There are other parameters, such as language and shell, that are applied according to defaults and values set in the configuration files **/etc/default/useradd** and **/etc/login.defs**. This is generally sufficient for a single, personal system or a small, one-server business environment. + +While the two files above govern the behavior of **useradd**, user information is stored in other files found in the **/etc** directory, which I will refer to throughout this article. + +File | Description | Fields (bold—set by useradd) +---|---|--- +passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** +shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused +group | Stores group details | **groupname**:unused:**gid**:**members** + +### Customizable behavior + +The command line allows customization for times when an administrator needs finer control, such as to specify a user's ID number. + +#### User and group ID numbers + +By default, **useradd** tries to use the same number for the user ID (UID) and primary group ID (GID), but there are no guarantees. Although it's not necessary for the UID and GID to match, it's easier for administrators to manage them when they do. + +I have just the scenario to explain. Suppose I add another account, this time for Timmy. Comparing the two users, _sonny_ and _timmy_, shows that both users and their respective primary groups were created by using the **getent** command. + + +``` +$ getent passwd sonny timmy +sonny❌1001:1002:Sonny:/home/sonny:/bin/bash +timmy❌1002:1003::/home/timmy:/bin/bash + +$ getent group sonny timmy +sonny❌1002: +timmy❌1003: +``` + +Unfortunately, neither users' UID nor primary GID match. This is because the default behavior is to assign the next available UID to the user and then attempt to assign the same number to the primary group. However, if that number is already used, the next available GID is assigned to the group. To explain what happened, I hypothesize that a group with GID 1001 already exists and enter a command to confirm. + + +``` +$ getent group 1001 +book❌1001:alan +``` + +The group _book_ with the ID _1001_ has caused the GIDs to be off by one. This is an example where a system administrator would need to take more control of the user-creation process. To resolve this issue, I must first determine the next available user and group ID that will match. The commands **getent group** and **getent passwd** will be helpful in determining the next available number. This number can be passed with the **-u** argument. + + +``` +$ sudo useradd -u 1004 bobby + +$ getent passwd bobby; getent group bobby +bobby❌1004:1004::/home/bobby:/bin/bash +bobby❌1004: +``` + +Another good reason to specify the ID is for users that will be accessing files on a remote system using the Network File System (NFS). NFS is easier to administer when all client and server systems have the same ID configured for a given user. I cover this in a bit more detail in my article on [using autofs to mount NFS shares][2]. + +### More customization + +Very often though, other account parameters need to be specified for a user. Here are brief examples of the most common customizations you may need to use. + +#### Comment + +The comment option is a plain-text field for providing a short description or other information using the **-c** argument. + + +``` +$ sudo useradd -c "Bailey is cool" bailey +$ getent passwd bailey +bailey❌1011:1011:Bailey is cool:/home/bailey:/bin/bash +``` + +#### Groups + +A user can be assigned one primary group and multiple secondary groups. The **-g** argument specifies the name or GID of the primary group. If it's not specified, **useradd** creates a primary group with the user's same name (as demonstrated above). The **-G** (uppercase) argument is used to pass a comma-separated list of groups that the user will be placed into; these are known as secondary groups. + + +``` +$ sudo useradd -G tgroup,fgroup,libvirt milly +$ id milly +uid=1012(milly) gid=1012(milly) groups=1012(milly),981(libvirt),4000(fgroup),3000(tgroup) +``` + +#### Home directory + +The default behavior of **useradd** is to create the user's home directory in **/home**. However, different aspects of the home directory can be overridden with the following arguments. The **-b** sets another directory where user homes can be placed. For example, **/home2** instead of the default **/home**. + + +``` +$ sudo useradd -b /home2 vicky +$ getent passwd vicky +vicky❌1013:1013::/home2/vicky:/bin/bash +``` + +The **-d** lets you specify a home directory with a different name from the user. + + +``` +$ sudo useradd -d /home/ben jerry +$ getent passwd jerry +jerry❌1014:1014::/home/ben:/bin/bash +``` + +#### The skeleton directory + +The **-k** instructs the new user's new home directory to be populated with any files in the **/etc/skel** directory. These are usually shell configuration files, but they can be anything that a system administrator would like to make available to all new users. + +#### Shell + +The **-s** argument can be used to specify the shell. The default is used if nothing else is specified. For example, in the following, shell **bash** is defined in the default configuration file, but Wally has requested **zsh**. + + +``` +$ grep SHELL /etc/default/useradd +SHELL=/bin/bash + +$ sudo useradd -s /usr/bin/zsh wally +$ getent passwd wally +wally❌1004:1004::/home/wally:/usr/bin/zsh +``` + +#### Security + +Security is an essential part of user management, so there are several options available with the **useradd** command. A user account can be given an expiration date, in the form YYYY-MM-DD, using the **-e** argument. + + +``` +$ sudo useradd -e 20191231 sammy +$ sudo getent shadow sammy +sammy:!!:18171:0:99999:7::20191231: +``` + +An account can also be disabled automatically if the password expires. The **-f** argument will set the number of days after the password expires before the account is disabled. Zero is immediate. + + +``` +$ sudo useradd -f 30 willy +$ sudo getent shadow willy +willy:!!:18171:0:99999:7:30:: +``` + +### A real-world example + +In practice, several of these arguments may be used when creating a new user account. For example, if I need to create an account for Perry, I might use the following command: + + +``` +$ sudo useradd -u 1020 -c "Perry Example" \ +-G tgroup -b /home2 \ +-s /usr/bin/zsh \ +-e 20201201 -f 5 perry +``` + +Refer to the sections above to understand each option. Verify the results with: + + +``` +$ getent passwd perry; getent group perry; getent shadow perry; id perry +perry❌1020:1020:Perry Example:/home2/perry:/usr/bin/zsh +perry❌1020: +perry:!!:18171:0:99999:7:5:20201201: +uid=1020(perry) gid=1020(perry) groups=1020(perry),3000(tgroup) +``` + +### Some final advice + +The **useradd** command is a "must-know" for any Unix (not just Linux) administrator. It is important to understand all of its options since user creation is something that you want to get right the first time. This means having a well-thought-out naming convention that includes a dedicated UID/GID range reserved for your users across your enterprise, not just on a single system—particularly when you're working in a growing organization. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/linux-useradd-command + +作者:[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/connection_people_team_collaboration.png?itok=0_vQT8xV (people in different locations who are part of the same team) +[2]: https://opensource.com/article/18/6/using-autofs-mount-nfs-shares From e99c4fe87585d141621450266cd781343d2ae937 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:41:16 +0800 Subject: [PATCH 042/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191017=20How=20?= =?UTF-8?q?to=20type=20emoji=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191017 How to type emoji on Linux.md --- .../20191017 How to type emoji on Linux.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20191017 How to type emoji on Linux.md diff --git a/sources/tech/20191017 How to type emoji on Linux.md b/sources/tech/20191017 How to type emoji on Linux.md new file mode 100644 index 0000000000..ff85c55938 --- /dev/null +++ b/sources/tech/20191017 How to type emoji on Linux.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to type emoji on Linux) +[#]: via: (https://opensource.com/article/19/10/how-type-emoji-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to type emoji on Linux +====== +The GNOME desktop makes it easy to use emoji in your communications. +![A cat under a keyboard.][1] + +Emoji are those fanciful pictograms that snuck into the Unicode character space. They're all the rage online, and people use them for all kinds of surprising things, from signifying reactions on social media to serving as visual labels for important file names. There are many ways to enter Unicode characters on Linux, but the GNOME desktop makes it easy to find and type an emoji. + +![Emoji in Emacs][2] + +### Requirements + +For this easy method, you must be running Linux with the [GNOME][3] desktop. + +You must also have an emoji font installed. There are many to choose from, so do a search for _emoji_ using your favorite software installer application or package manager. + +For example, on Fedora: + + +``` +$ sudo dnf search emoji +emoji-picker.noarch : An emoji selection tool +unicode-emoji.noarch : Unicode Emoji Data Files +eosrei-emojione-fonts.noarch : A color emoji font +twitter-twemoji-fonts.noarch : Twitter Emoji for everyone +google-android-emoji-fonts.noarch : Android Emoji font released by Google +google-noto-emoji-fonts.noarch : Google “Noto Emoji” Black-and-White emoji font +google-noto-emoji-color-fonts.noarch : Google “Noto Color Emoji” colored emoji font +[...] +``` + +On Ubuntu or Debian, use **apt search** instead. + +I'm using [Google Noto Color Emoji][4] in this article. + +### Get set up + +To get set up, launch GNOME's Settings application. + + 1. In Settings, click the **Region & Language** category in the left column. + 2. Click the plus symbol (**+**) under the **Input Sources** heading to bring up the **Add an Input Source** panel. + + + +![Add a new input source][5] + + 3. In the **Add an Input Source** panel, click the hamburger menu at the bottom of the input list. + + + +![Add an Input Source panel][6] + + 4. Scroll to the bottom of the list and select **Other**. + 5. In the **Other** list, find **Other (Typing Booster)**. (You can type **boost** in the search field at the bottom to filter the list.) + + + +![Find Other \(Typing Booster\) in inputs][7] + + 6. Click the **Add** button in the top-right corner of the panel to add the input source to GNOME. + + + +Once you've done that, you can close the Settings window. + +#### Switch to Typing Booster + +You now have a new icon in the top-right of your GNOME desktop. By default, it's set to the two-letter abbreviation of your language (**en** for English, **eo** for Esperanto, **es** for Español, and so on). If you press the **Super** key (the key with a Linux penguin, Windows logo, or Mac Command symbol) and the **Spacebar** together on your keyboard, you will switch input sources from your default source to the next on your input list. In this example, you only have two input sources: your default language and Typing Booster. + +Try pressing **Super**+**Spacebar** together and watch the input name and icon change. + +#### Configure Typing Booster + +With the Typing Booster input method active, click the input sources icon in the top-right of your screen, select **Unicode symbols and emoji predictions**, and set it to **On**. + +![Set Unicode symbols and emoji predictions to On][8] + +This makes Typing Booster dedicated to typing emoji, which isn't all Typing Booster is good for, but in the context of this article it's exactly what is needed. + +### Type emoji + +With Typing Booster still active, open a text editor like Gedit, a web browser, or anything that you know understands Unicode characters, and type "_thumbs up_." As you type, Typing Booster searches for matching emoji names. + +![Typing Booster searching for emojis][9] + +To leave emoji mode, press **Super**+**Spacebar** again, and your input source goes back to your default language. + +### Switch the switcher + +If the **Super**+**Spacebar** keyboard shortcut is not natural for you, then you can change it to a different combination. In GNOME Settings, navigate to **Devices** and select **Keyboard**. + +In the top bar of the **Keyboard** window, search for **Input** to filter the list. Set **Switch to next input source** to a key combination of your choice. + +![Changing keystroke combination in GNOME settings][10] + +### Unicode input + +The fact is, keyboards were designed for a 26-letter (or thereabouts) alphabet along with as many numerals and symbols. ASCII has more characters than what you find on a typical keyboard, to say nothing of the millions of characters within Unicode. If you want to type Unicode characters into a modern Linux application but don't want to switch to Typing Booster, then you can use the Unicode input shortcut. + + 1. With your default language active, open a text editor like Gedit, a web browser, or any application you know accepts Unicode. + 2. Press **Ctrl**+**Shift**+**U** on your keyboard to enter Unicode entry mode. Release the keys. + 3. You are currently in Unicode entry mode, so type a number of a Unicode symbol. For instance, try **1F44D** for a 👍 symbol, or **2620** for a ☠ symbol. To get the number code of a Unicode symbol, you can search the internet or refer to the [Unicode specification][11]. + + + +### Pragmatic emoji-ism + +Emoji are fun and expressive. They can make your text unique to you. They can also be utilitarian. Because emoji are Unicode characters, they can be used anywhere a font can be used, and they can be used the same way any alphabetic character can be used. For instance, if you want to mark a series of files with a special symbol, you can add an emoji to the name, and you can filter by that emoji in Search. + +![Labeling a file with emoji][12] + +Use emoji all you want because Linux is a Unicode-friendly environment, and it's getting friendlier with every release. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-type-emoji-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/osdc-lead_cat-keyboard.png?itok=fuNmiGV- (A cat under a keyboard.) +[2]: https://opensource.com/sites/default/files/uploads/emacs-emoji.jpg (Emoji in Emacs) +[3]: https://www.gnome.org/ +[4]: https://www.google.com/get/noto/help/emoji/ +[5]: https://opensource.com/sites/default/files/uploads/gnome-setting-region-add.png (Add a new input source) +[6]: https://opensource.com/sites/default/files/uploads/gnome-setting-input-list.png (Add an Input Source panel) +[7]: https://opensource.com/sites/default/files/uploads/gnome-setting-input-other-typing-booster.png (Find Other (Typing Booster) in inputs) +[8]: https://opensource.com/sites/default/files/uploads/emoji-input-on.jpg (Set Unicode symbols and emoji predictions to On) +[9]: https://opensource.com/sites/default/files/uploads/emoji-input.jpg (Typing Booster searching for emojis) +[10]: https://opensource.com/sites/default/files/uploads/gnome-setting-keyboard-switch-input.jpg (Changing keystroke combination in GNOME settings) +[11]: http://unicode.org/emoji/charts/full-emoji-list.html +[12]: https://opensource.com/sites/default/files/uploads/file-label.png (Labeling a file with emoji) From 4c999465964cb6ff5f1cb5fe4f6493b508422195 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:42:29 +0800 Subject: [PATCH 043/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191017=20Measur?= =?UTF-8?q?ing=20the=20business=20value=20of=20open=20source=20communities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191017 Measuring the business value of open source communities.md --- ...siness value of open source communities.md | 117 ++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 sources/tech/20191017 Measuring the business value of open source communities.md diff --git a/sources/tech/20191017 Measuring the business value of open source communities.md b/sources/tech/20191017 Measuring the business value of open source communities.md new file mode 100644 index 0000000000..d270340f91 --- /dev/null +++ b/sources/tech/20191017 Measuring the business value of open source communities.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Measuring the business value of open source communities) +[#]: via: (https://opensource.com/article/19/10/measuring-business-value-open-source) +[#]: author: (Jon Lawrence https://opensource.com/users/the3rdlaw) + +Measuring the business value of open source communities +====== +Corporate constituencies are interested in finding out the business +value of open source communities. Find out how to answer key questions +with the right metrics. +![Lots of people in a crowd.][1] + +In _[Measuring the health of open source communities][2]_, I covered some of the key questions and metrics that we’ve explored as part of the [CHAOSS project][3] as they relate to project founders, maintainers, and contributors. In this article, we focus on open source corporate constituents (such as open source program offices, business risk and legal teams, human resources, and others) and end users. + +Where the bulk of the metrics for core project teams are quantitative, for the remaining constituents our metrics must reflect a much broader range of interests, and address many more qualitative measures. From the metrics collection standpoint, much of the data collection for qualitative measures is much more manual and subjective, but it is nonetheless within the scope CHAOSS hopes to be able to address as the project matures. + +While people on the business side of things do sometimes care about the metrics in use by the project itself, there are only two fundamental questions that corporate constituencies have. The first is about _value_: "Will this choice help our business make more money sooner?" The second is about _risk_: "Will this choice hurt our business’s chances of making money?" + +Those questions can come in many different iterations across disciplines, from human resources to legal counsel and executive offices. But, at the end of the day, having answers that are based on data can make open source engagement more efficient, effective, and less risky. + +Once again, the information below is structured in a Goal-Question-Metric format: + + * Open source program offices (OSPOs) + * As an OSPO leader, I care about prioritizing our resources toward healthy communities: + * How [active][4] is the community? +**Metric:** [Code development][5] \- The number of commits and pull requests, review time for new code commits and pull requests, code reviews and merges, the number of accepted vs. rejected pull requests, and the frequency of new version releases. +**Metric:** [Issue resolution][6] \- The number of new issues, closed issues, the ratio of new vs. closed issues, and the average open time per issue. +**Metric:** Social - Social media mention counts, social media sentiment analysis, the activity of community blog, and news releases (_future release_). + * What is the [value][7] of our contributions to the project? (This is an area in active development.) +**Metric:** Time value - Time saved for training developers on new technologies, and time saved maintaining custom development once the improvements are upstreamed. +**Metric:** Dollar value - How much would it have cost to maintain changes and custom solutions internally, versus contributing upstream and ensuring compatibility with future community releases + * What is the value of contributions to the project by other contributors and organizations? +**Metric:** Time value - Time to market, new community-developed features released, and support for the project by the community versus the company. +**Metric:** Dollar value - How much would it cost to internally rebuild the features provided by the community, and what is the opportunity cost of lagging behind innovations in open source projects? + * Downstream value: How many other projects list our project as a dependency? +**Metric:** The value of the ecosystem that is around a project. + * How many forks of our project have there been? +**Metric:** Are core developers more active in the mainline or a fork? +**Metric:** Are the forks contributing back to the mainline, or developing in new directions? + * Engineering leadership + * As an approving architect, I care most about good design patterns that introduce a minimum of technical debt. +**Metric:** [Test Coverage][8] \- What percentage of the code is tested? +**Metric:** What is the percentage of code undergoing code reviews? +**Metric:** Does the project follow [Core][9] [Infrastructure][9] [Initiative (CII) Best Practices][9]? + * As an engineering executive, I care most about minimizing time-to-market and bugs, and maximizing platform stability and reliability. +**Metric:** The defect resolution velocity. +**Metric:** The defect density. +**Metric:** The feature development velocity. + * I also want social proofs that give me a level of comfort. +**Metric:** Sentiment analysis of social media related to the project. +**Metric:** Count of white papers. +**Metric:** Code Stability - Project version numbers and the frequency of new releases. + + + +There is also the issue of legal counsel. This goal statement is: "As legal counsel, I care most about minimizing our company’s chances of getting sued." The question is: "What kind of license does the software have, and what obligations do we have under the license?" + +The metrics involved here are: + + * **Metric:** [License Count][10] \- How many different licenses are declared in a given project? + * **Metric:** [License Declaration][11] \- What kinds of licenses are declared in a given project? + * **Metric:** [License Coverage][12] \- How much of a given codebase is covered by the declared license? + + + +Lastly, there are further goals our project is considering to measure the impact of corporate open source policy as it relates to talent acquisition and retention. The goal for human resource managers is: "As an HR manager, I want to attract and retain the best talent I can." The questions and metrics are as follows: + + * What impact do our open source policies have on talent acquisition? +**Metric:** Talent acquisition - Measure over time how many candidates report that it’s important to them that they get to work with open source technologies. + * What impact do our open source policies have on talent retention? +**Metric:** Talent retention - Measure how much employee churn can be reduced because of people being able to work with or use open source technologies. + * What is the impact on training employees who can learn from engaging in open source projects? +**Metric:** Talent development - Measure over time the importance to employees of being able to use open source tech effectively. + * How does allowing employees to work in a community outside of the company impact job satisfaction? +**Metric:** Talent satisfaction - Measure over time the importance to employees of being able to contribute to open source tech. +**Source:** Internal surveys. +**Source:** Exit interviews. Did our policies around open source technologies at all influence your decision to leave? + + + +### Wrapping up + +It is still the early days of building a platform for bringing together these disparate data sources. The CHAOSS core of [Augur][13] and [GrimoireLab][14] currently supports over two dozen sources, and I’m excited to see what lies ahead for this project. + +As the CHAOSS frameworks mature, I’m optimistic that teams and projects that implement these types of measurement will be able to make better real-world decisions that result in healthier and more productive software development lifecycles. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/measuring-business-value-open-source + +作者:[Jon Lawrence][a] +选题:[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/the3rdlaw +[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://opensource.com/article/19/8/measure-project +[3]: https://github.com/chaoss/ +[4]: https://github.com/chaoss/wg-evolution/blob/master/focus_areas/community_growth.md +[5]: https://github.com/chaoss/wg-evolution#metrics +[6]: https://github.com/chaoss/wg-evolution/blob/master/focus_areas/issue_resolution.md +[7]: https://github.com/chaoss/wg-value +[8]: https://chaoss.community/metric-test-coverage/ +[9]: https://github.com/coreinfrastructure/best-practices-badge +[10]: https://github.com/chaoss/wg-risk/blob/master/metrics/License_Count.md +[11]: https://github.com/chaoss/wg-risk/blob/master/metrics/License_Declared.md +[12]: https://github.com/chaoss/wg-risk/blob/master/metrics/License_Coverage.md +[13]: https://github.com/chaoss/augur +[14]: https://github.com/chaoss/grimoirelab From 4dce4735ff97ff137fc98252caf6ca5a5b981dd0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:46:03 +0800 Subject: [PATCH 044/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191017=20Pennsy?= =?UTF-8?q?lvania=20school=20district=20tackles=20network=20modernization?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191017 Pennsylvania school district tackles network modernization.md --- ... district tackles network modernization.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/talk/20191017 Pennsylvania school district tackles network modernization.md diff --git a/sources/talk/20191017 Pennsylvania school district tackles network modernization.md b/sources/talk/20191017 Pennsylvania school district tackles network modernization.md new file mode 100644 index 0000000000..aac55035c6 --- /dev/null +++ b/sources/talk/20191017 Pennsylvania school district tackles network modernization.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pennsylvania school district tackles network modernization) +[#]: via: (https://www.networkworld.com/article/3445976/pennsylvania-school-district-tackles-network-modernization.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Pennsylvania school district tackles network modernization +====== +NASD upgrades its campus core to be the foundation for digital learning. +Wenjie Dong / Getty Images + +Success in business and education today starts with infrastructure modernization. In fact, my research has found that digitally-forward organizations spend more than twice what their non-digital counterparts spend on evolving their IT infrastructure. However, most of the focus from IT has been on upgrading the application and compute infrastructure with little thought given to a critical ingredient – the network. Organizations can only be as agile as the least agile component of their infrastructure, and for most companies, that’s the network. + +### Manual processes plague network reliability + +Legacy networks have outlived their useful life. The existing three+ tier architecture was designed for an era when network traffic was considered “best-effort,” where there was no way to guarantee performance or reserve bandwidth, and delivered non-mission-critical applications. Employees and educators ran applications locally, and the majority of critical data resided on workstations. + +Today, everything has changed. Applications have moved to the cloud, workers are constantly on the go, and companies are connecting things to business networks at an unprecedented rate. One could argue that, for most organizations, the network is the business. Consider what’s happened in our personal lives. People stream content, communicate using video, shop online, and rely on the network for almost every aspect of their lives. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The same thing is happening to digital organizations. Companies today must support the needs of applications that are becomingly increasingly dynamic and distributed. An unavailable or poorly performing network means the organization comes to a screeching halt. + +Yet network engineering teams working with legacy networks can’t keep up with demands; the rigid and manual processes required to hard-code configuration are slow and error-prone. In fact, ZK Research found that the largest cause of downtime with legacy networks is from human errors. + +Given the importance of the network, this kind of madness must stop. Businesses will never be able to harness the potential of digital transformation without modernizing the network. + +What’s required is a network that is more dynamic and intelligent, one that simplifies operations via automation. This can lead to better control and faster error detection, diagnosis and resolution. These buzzwords have been tossed around by many vendors and customers as the vision of where we are headed – yet it's been difficult to find actual customer deployments. + +### NASD modernizes wired and wireless network to support digital curriculum + +The Nazareth Area School District (NASD).recently went through a network modernization project. + +The Eastern Pennsylvania school district, which has roughly 4,800 students, has a bold vision: to inspire students to be innovative, collaborative and constructive members of the community who embrace the tenets of diversity, value, education and honesty. NASD aims to accomplish its vision by helping students build a strong worth ethic and sense of responsibility and by challenging them to be leaders and good global citizens. + +To support its goals, NASD set out to completely revamp the way it teaches. The district embraced a number of modern technologies that would foster immersive learning and collaboration. + +There's a heavy emphasis on science, technology, engineering, arts and mathematics (STEAM), which drives more focus on coding, robotics, and virtual and augmented reality. For example, the teachers are using Google Expeditions VR Classroom kits to integrate VR into the classroom. In addition, NASD has converted many of its classrooms into “affinity rooms” where students can work together on different projects in the areas of VR, AR, robotics, stop motion photography, and other advanced technologies. + +NASD understood that modernizing education requires a modernized network. If new tools and applications don’t perform as expected, it can hurt the learning process as students sit around waiting while network problems are solved. The district knew it needed to upgrade its network to one that was more intelligent, reliable and easier to diagnose. + +NASD chose Aruba, a Hewlett Packard Enterprise company, to be its wired and wireless networking supplier. + +In my opinion, the decision to upgrade the wired and wireless networks at the same time is a smart one. Many organizations put in a new Wi-Fi network only to find the wired backbone can’t support the traffic or doesn’t have the necessary reliability. + +The high-availability switches are running the new ArubaOS-CX operating system designed for the digital transformation era. The network devices are configured through a centralized graphical interface and not a command line interface (CLI), and they have an onboard Network Analytics Engine to reduce the complexity of running the network. + +NASD selected two Aruba 8320 switches to be the core of its network, to provide “utility-grade networking” that is always on and always available, much like power. + +“By running two switches in tandem, we would gain a fully redundant network that made failovers, whether planned or unplanned, completely undetectable by our users,” said Mike Fahey, senior application and network administrator at NASD. + +### Wanted: utility-grade Wi-Fi + +Utility-grade Wi-Fi was a must for NASD as almost all of the new learning tools connect via Wi-Fi only. The school system had been using two Wi-Fi vendors, neither of which performed well and required long troubleshooting periods. + +The Nazareth IT staff initially replaced the most problematic APs with Aruba APs. As this happened, Michael Uelses, director of IT, said that the teachers noticed a marked difference in Wi-Fi performance. Now, the entire school has standardized on Aruba’s gigabit Wi-Fi and has expanded it to outdoor locations. This has enabled the school to expand its security strategy and new emergency preparedness application to include playgrounds, parking lots and other outdoor areas where Wi-Fi previously did not reach. + +Supporting gigabit Wi-Fi required upgrading the backbone network to 10 Gigabit, which the Aruba 8320 switches support. The switches can also be upgraded to high speeds, up to 100 Gigabit, if the need arises. NASD is planning to expand the use of bandwidth-hungry apps such as VR to immerse students in subjects including biology and engineering. The option to upgrade the switches gives NASD the confidence it has made the right network choices for the future. + +What NASD is doing should be a message to all schools. Digital tools are here to stay and can change the way students learn. Success with digital education requires a rock-solid wired and wireless network to deliver utility-like services that are always on so students can always be learning. + +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/3445976/pennsylvania-school-district-tackles-network-modernization.html + +作者:[Zeus Kerravala][a] +选题:[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/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From b6285493745a050a653501048a4b3258a2fb94ca Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:48:04 +0800 Subject: [PATCH 045/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191017=20Using?= =?UTF-8?q?=20multitail=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191017 Using multitail on Linux.md --- .../tech/20191017 Using multitail on Linux.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sources/tech/20191017 Using multitail on Linux.md diff --git a/sources/tech/20191017 Using multitail on Linux.md b/sources/tech/20191017 Using multitail on Linux.md new file mode 100644 index 0000000000..b89ef375d2 --- /dev/null +++ b/sources/tech/20191017 Using multitail on Linux.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using multitail on Linux) +[#]: via: (https://www.networkworld.com/article/3445228/using-multitail-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Using multitail on Linux +====== + +[Glen Bowman][1] [(CC BY-SA 2.0)][2] + +The **multitail** command can be very helpful whenever you want to watch activity on a number of files at the same time – especially log files. It works like a multi-windowed **tail -f** command. That is, it displays the bottoms of files and new lines as they are being added. While easy to use in general, **multitail** does provide some command-line and interactive options that you should be aware of before you start to use it routinely. + +### Basic multitail-ing + +The simplest use of **multitail** is to list the names of the files that you wish to watch on the command line. This command splits the screen horizontally (i.e., top and bottom), displaying the bottom of each of the files along with updates. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +``` +$ multitail /var/log/syslog /var/log/dmesg +``` + +The display will be split like this: + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` ++-----------------------+ +| | +| | ++-----------------------| +| | +| | ++-----------------------+ +``` + +The lines displayed from each of the files would be followed by a single line per file that includes the assigned file number (starting with 00), the file name, the file size, and the date and time the most recent content was added. Each of the files will be allotted half the space available regardless of its size or activity. For example: + +``` +content lines from my1.log +more content +more lines + +00] my1.log 59KB - 2019/10/14 12:12:09 +content lines from my2.log +more content +more lines + +01] my2.log 120KB - 2019/10/14 14:22:29 +``` + +Note that **multitail** will not complain if you ask it to display non-text files or files that you have no permission to view; you just won't see the contents. + +You can also use wild cards to specify the files that you want to watch: + +``` +$ multitail my*.log +``` + +One thing to keep in mind is that **multitail** is going to split the screen evenly. If you specify too many files, you will see only a few lines from each and you will only see the first seven or so of the requested files if you list too many unless you take extra steps to view the later files (see the scrolling option described below). The exact result depends on the how many lines are available in your terminal window. + +Press **q** to quit **multitail** and return to your normal screen view. + +### Dividing the screen + +**Multitail** will split your terminal window vertically (i.e., left and right) if you prefer. For this, use the **-s** option. If you specify three files, the right side of your screen will be divided horizontally as well. With four, you'll have four equal-sized windows. + +``` ++-----------+-----------+ +-----------+-----------+ +-----------+-----------+ +| | | | | | | | | +| | | | | | | | | +| | | | +-----------+ +-----------+-----------+ +| | | | | | | | | +| | | | | | | | | ++-----------+-----------+ +-----------+-----------+ +-----------+-----------+ + 2 files 3 files 4 files +``` + +Use **multitail -s 3 file1 file2 file3** if you want to split the screen into three columns. + +``` ++-------+-------+-------+ +| | | | +| | | | +| | | | +| | | | +| | | | ++-------+-------+-------+ + 3 files with -s 3 +``` + +### Scrolling + +You can scroll up and down through displayed files, but you need to press **b** to bring up a selection menu and then use the up and arrow buttons to select the file you wish to scroll through. Then press the **enter** key. You can then scroll through the lines in an enlarged area, again using the up and down arrows. Press **q** when you're done to go back to the normal view. + +### Getting Help + +Pressing **h** in **multitail** will open a help menu describing some of the basic operations, though the man page provides quite a bit more information and is worth perusing if you want to learn even more about using this tool. + +**Multitail** will not likely be installed on your system by default, but using **apt-get** or **yum** should get you to an easy install. The tool provides a lot of functionality, but with its character-based display, window borders will just be strings of **q**'s and **x**'s. It's a very handy when you need to keep an eye on file updates. + +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/3445228/using-multitail-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://www.flickr.com/photos/glenbowman/7992498919/in/photolist-dbgDtv-gHfRRz-5uRM4v-gHgFnz-6sPqTZ-5uaP7H-USFPqD-pbtRUe-fiKiYn-nmgWL2-pQNepR-q68p8d-dDsUxw-dbgFKG-nmgE6m-DHyqM-nCKA4L-2d7uFqH-Kbqzk-8EwKg-8Vy72g-2X3NSN-78Bv84-buKWXF-aeM4ok-yhweWf-4vwpyX-9hu8nq-9zCoti-v5nzP5-23fL48r-24y6pGS-JhWDof-6zF75k-24y6nHS-9hr19c-Gueh6G-Guei7u-GuegFy-24y6oX5-26qu5iX-wKrnMW-Gueikf-24y6oYh-27y4wwA-x4z19F-x57yP4-24BY6gc-24y6nPo-QGwbkf +[2]: https://creativecommons.org/licenses/by-sa/2.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 1ba9fceedbade2be8e255adc00d82b7415318be9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:50:50 +0800 Subject: [PATCH 046/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191017=20Data?= =?UTF-8?q?=20center=20liquid-cooling=20to=20gain=20momentum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191017 Data center liquid-cooling to gain momentum.md --- ... center liquid-cooling to gain momentum.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/talk/20191017 Data center liquid-cooling to gain momentum.md diff --git a/sources/talk/20191017 Data center liquid-cooling to gain momentum.md b/sources/talk/20191017 Data center liquid-cooling to gain momentum.md new file mode 100644 index 0000000000..fb1ea1cdac --- /dev/null +++ b/sources/talk/20191017 Data center liquid-cooling to gain momentum.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data center liquid-cooling to gain momentum) +[#]: via: (https://www.networkworld.com/article/3446027/data-center-liquid-cooling-to-gain-momentum.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Data center liquid-cooling to gain momentum +====== +The serious number-crunching demands of AI, IoT and big data - and the heat they generate - may mean air cooling is on its way out. +artisteer / Getty Images + +Concern over escalating energy costs is among reasons liquid-cooling solutions could gain traction in the [data center][1]. + +Schneider Electric, a major energy-management specialist, this month announced refreshed impetus to a collaboration conceived in 2014 with [liquid-cooling specialist Iceotope][2]. Now, [technology solutions company Avnet has been brought into that collaboration][3]. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +The three companies will develop chassis-level immersive liquid cooling for data centers, Schneider Electric says in a [press release][5]. Liquid-cooling systems submerge server components in a dielectric fluid as opposed to air-cooled systems which create ambient cooled air. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +One reason for the shift: “Compute-intensive applications like AI and [IoT][7] are driving the need for better chip performance,” Kevin Brown, CTO and SVP of Innovation, Secure Power, Schneider Electric, is quoted as saying. + +“Liquid Cooling [is] more efficient and less costly for power-dense applications,” the company explains. That’s in part because the use of Graphical Processing Units (GPUs) is replacing some traditional processing, and is gaining ground. GPUs are better suited to data-mining-type applications than traditional processors. They parallel-process and are now used extensively in artificial intelligence compute environments and processor-hungry analytics churning big data. + +“This makes traditional data-center air-cooled architectures impractical, or costly and less efficient than liquid-cooled approaches.” Reasons liquid-cooling may become a new go-to cooling solution is also related to “space constraints, water usage restrictions and harsh IT environments,” [Schneider said in a white paper earlier this year][8]: + +As chip density increases, and the resulting rack-space that is required to hold the gear decreases, the need for traditional air-based cooling-equipment space keeps going up. So even as greater computing density decreases the space the equipment occupies, the space required for air-cooling it increases. The heat created is so great with GPUs that it stops being practical to air-cool. + +Additionally, as edge data centers become more important there’s an advantage to using IT that can be placed anywhere. “As the demand for IT deployments in urban areas, high rise buildings, and at the Edge increase, the need for placement in constrained locations will increase,” the paper says. In such scenarios, not requiring space for hot and cold aisles would be an advantage. + +Liquid cooling would allow for silent operation, too; there aren’t any fans and pumps making disruptive noise. + +Liquid cooling would also address restrictions on water useage that can affect the ability to use evaporative cooling and cooling towers to carry off heat generated by data centers. Direct-to-chip liquid-cooling systems of the kind the three companies want to concentrate their efforts on narrowly target the cooling at the server, not at the building level. + +In harsh environments such as factories and [industrial IoT][9] deployments, heat and air quality can hinder air-cooling systems. Liquid-cooling systems can be self-contained in sealed units, thus being protected from dust, for example. + +Interestingly, as serious computer gamers will know, liquid cooling isn’t a new technology, [Wendy Torell points out in a Schneider blog post][10] pitching the technology. “It’s been around for decades and has historically focused on mainframes, high-performance computing (HPC), and gaming applications,” she explains. “Demand for IoT, artificial intelligence, machine learning, big data analytics, and edge applications is once again bringing it into the limelight.” + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446027/data-center-liquid-cooling-to-gain-momentum.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://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: http://www.iceotope.com/about +[3]: https://www.avnet.com/wps/portal/us/about-avnet/overview/ +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.prnewswire.com/news-releases/schneider-electric-announces-partnership-with-avnet-and-iceotope-to-develop-liquid-cooled-data-center-solutions-300929586.html +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[8]: https://www.schneider-electric.us/en/download/search/liquid%20cooling/?langFilterDisabled=true +[9]: https://www.networkworld.com/article/3243928/what-is-the-industrial-iot-and-why-the-stakes-are-so-high.html +[10]: https://blog.se.com/datacenter/2019/07/11/not-just-about-chip-density-five-reasons-consider-liquid-cooling-data-center/ +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world From 6e1078280243fd2c23db9c72df39515875b90244 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 19 Oct 2019 01:55:02 +0800 Subject: [PATCH 047/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191016=20Linux?= =?UTF-8?q?=20sudo=20flaw=20can=20lead=20to=20unauthorized=20privileges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md --- ...law can lead to unauthorized privileges.md | 81 +++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md diff --git a/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md b/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md new file mode 100644 index 0000000000..5a6e7beaf3 --- /dev/null +++ b/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux sudo flaw can lead to unauthorized privileges) +[#]: via: (https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux sudo flaw can lead to unauthorized privileges +====== +Exploiting a newly discovered sudo flaw in Linux can enable certain users with to run commands as root despite restrictions against it. +Thinkstock + +A newly discovered and serious flaw in the [**sudo**][1] command can, if exploited, enable users to run commands as root in spite of the fact that the syntax of the  **/etc/sudoers** file specifically disallows them from doing so. + +Updating **sudo** to version 1.8.28 should address the problem, and Linux admins are encouraged to do so as soon as possible.  + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +How the flaw might be exploited depends on specific privileges granted in the **/etc/sudoers** file. A rule that allows a user to edit files as any user except root, for example, would actually allow that user to edit files as root as well. In this case, the flaw could lead to very serious problems. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +For a user to exploit the flaw, **a user** needs to be assigned privileges in the **/etc/sudoers **file that allow that user to run commands as some other users, and the flaw is limited to the command privileges that are assigned in this way.   + +This problem affects versions prior to 1.8.28. To check your sudo version, use this command: + +``` +$ sudo -V +Sudo version 1.8.27 <=== +Sudoers policy plugin version 1.8.27 +Sudoers file grammar version 46 +Sudoers I/O plugin version 1.8.27 +``` + +The vulnerability has been assigned [CVE-2019-14287][4] in the **Common Vulnerabilities and Exposures** database. The risk is that any user who has been given the ability to run even a single command as an arbitrary user may be able to escape the restrictions and run that command as root – even if the specified privilege is written to disallow running the command as root. + +The lines below are meant to give the user "jdoe" the ability to edit files with **vi** as any user except root (**!root** means "not root") and nemo the right to run the **id** command as any user except root: + +``` +# affected entries on host "dragonfly" +jdoe dragonfly = (ALL, !root) /usr/bin/vi +nemo dragonfly = (ALL, !root) /usr/bin/id +``` + +However, given the flaw, either of these users would be able to circumvent the restriction and edit files or run the **id** command as root as well. + +The flaw can be exploited by an attacker to run commands as root by specifying the user ID "-1" or "4294967295."   + +The response of "1" demonstrates that the command is being run as root (showing root's user ID). + +Joe Vennix from Apple Information Security both found and analyzed the problem. + +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/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.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/article/3236499/some-tricks-for-using-sudo.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-14287 +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 73f8afda8a8a471cd1a323a1ae5eeb707d865ee1 Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Sat, 19 Oct 2019 11:19:54 +0800 Subject: [PATCH 048/800] translating --- .../20180207 23 open source audio-visual production tools.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180207 23 open source audio-visual production tools.md b/sources/tech/20180207 23 open source audio-visual production tools.md index fd196200ce..b6b748ec39 100644 --- a/sources/tech/20180207 23 open source audio-visual production tools.md +++ b/sources/tech/20180207 23 open source audio-visual production tools.md @@ -1,3 +1,4 @@ +luming translating 23 open source audio-visual production tools ====== From b088727e259a864cbd5b8d82decc0969ed7fd458 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Sat, 19 Oct 2019 12:02:01 +0800 Subject: [PATCH 049/800] translated by hopefully2333 translated by hopefully2333 --- ...essionals can become security champions.md | 112 ------------------ ...essionals can become security champions.md | 111 +++++++++++++++++ 2 files changed, 111 insertions(+), 112 deletions(-) delete mode 100644 sources/talk/20190924 How DevOps professionals can become security champions.md create mode 100644 translated/talk/20190924 How DevOps professionals can become security champions.md diff --git a/sources/talk/20190924 How DevOps professionals can become security champions.md b/sources/talk/20190924 How DevOps professionals can become security champions.md deleted file mode 100644 index ed1769cf4c..0000000000 --- a/sources/talk/20190924 How DevOps professionals can become security champions.md +++ /dev/null @@ -1,112 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hopefully2333) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How DevOps professionals can become security champions) -[#]: via: (https://opensource.com/article/19/9/devops-security-champions) -[#]: author: (Jessica Repka https://opensource.com/users/jrepkahttps://opensource.com/users/jrepkahttps://opensource.com/users/patrickhousleyhttps://opensource.com/users/mehulrajputhttps://opensource.com/users/alanfdosshttps://opensource.com/users/marcobravo) - -How DevOps professionals can become security champions -====== -Breaking down silos and becoming a champion for security will help you, -your career, and your organization. -![A lock on the side of a building][1] - -Security is a misunderstood element in DevOps. Some see it as outside of DevOps' purview, while others find it important (and overlooked) enough to recommend moving to [DevSecOps][2]. No matter your perspective on where it belongs, it's clear that security affects everyone. - -Each year, the [statistics on hacking][3] become more alarming. For example, there's a hacker attack every 39 seconds, which can lead to stolen records, identities, and proprietary projects you're writing for your company. It can take months (and possibly forever) for your security team to discover the who, what, where, or when behind a hack. - -What are operations professionals to do about these dire problems? I say it is time for us to become part of the solution by becoming security champions. - -### Silos and turf wars - -Over my years of working side-by-side with my local IT security (ITSEC) teams, I've noticed a great many things. A big one is that tension is very common between DevOps and security. This tension almost always stems from the security team's efforts to protect against vulnerabilities (e.g., by setting rules or disabling things) that interrupt DevOps' work and hinder their ability to deploy apps quickly. - -You've seen it, I've seen it, everyone you meet in the field has at least one story about it. A small set of grudges turns into a burned bridge that takes time to repair—or the groups begin a small turf war, and the resulting silos make achieving DevOps unlikely. - -### Get a new perspective - -To try to break down these silos and end the turf wars, I talk to at least one person on each security team to learn about the ins and outs of daily security operations in our organization. I started doing this out of general curiosity, but I've continued because it always gives me a valuable new perspective. For example, I've learned that for every deployment that's stopped due to failed security, the ITSEC team is feverishly trying to patch 10 other problems it sees. Their brashness and quickness to react are due to the limited time they have to fix something before it becomes a large problem. - -Consider the immense amount of knowledge it takes to find, analyze, and undo what has been done. Or to figure out what the DevOps team is doing—without background information—then replicate and test it. And to do all of this with their usual greatly understaffed security team. - -This is the daily life of your security team, and your DevOps team is not seeing it. ITSEC's daily work can mean overtime hours and overwork to make sure that the company, its teams, and the proprietary work its teams are producing are secure. - -### Ways to be a security champion - -This is where being your own security champion can help. This means—for everything you work on—you must take a good, hard look at all the ways someone could log into it and what could be taken from it. - -Help your security team help you. Introduce tools into your pipelines to integrate what you know will work with what they will know will work. Start with small things, such as reading up on Common Vulnerabilities and Exposures (CVEs) and adding scanning functions to your [CI/CD][4] pipelines. For everything you build, there is an open source scanning tool, and adding small open source tools (such as the ones below) can go the extra mile in the long run. - -**Container scanning tools:** - - * [Anchore Engine][5] - * [Clair][6] - * [Vuls][7] - * [OpenSCAP][8] - - - -**Code scanning tools:** - - * [OWASP SonarQube][9] - * [Find Security Bugs][10] - * [Google Hacking Diggity Project][11] - - - -**Kubernetes security tools:** - - * [Project Calico][12] - * [Kube-hunter][13] - * [NeuVector][14] - - - -### Keep your DevOps hat on - -Learning about new technology and how to create new things with it is part of the job if you're in a DevOps-related role. Security is no different. Here's my list of ways to keep up to date on the security front while keeping your DevOps hat on. - - * Read one article each week about something related to security in whatever you're working on. - * Look at the [CVE][15] website weekly to see what's new. - * Try doing a hackathon. Some companies do this once a month; check out the [Beginner Hack 1.0][16] site if yours doesn't and you'd like to learn more. - * Try to attend at least one security conference a year with a member of your security team to see things from their side. - - - -### Be a champion for good - -There are several reasons you should become your own security champion. The first and foremost is to further your knowledge and advance your career. The second reason is to help other teams, foster new relationships, and break down the silos that harm your organization. Creating friendships across your organization has multiple benefits, including setting a good example of bridging teams and encouraging people to work together. You will also foster sharing knowledge throughout the organization and provide everyone with a new lease on security and greater internal cooperation. - -Overall, being a security champion will lead you to be a champion for good across your organization. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/9/devops-security-champions - -作者:[Jessica Repka][a] -选题:[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/jrepkahttps://opensource.com/users/jrepkahttps://opensource.com/users/patrickhousleyhttps://opensource.com/users/mehulrajputhttps://opensource.com/users/alanfdosshttps://opensource.com/users/marcobravo -[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://opensource.com/article/19/1/what-devsecops -[3]: https://hostingtribunal.com/blog/hacking-statistics/ -[4]: https://opensource.com/article/18/8/what-cicd -[5]: https://github.com/anchore/anchore-engine -[6]: https://github.com/coreos/clair -[7]: https://vuls.io/ -[8]: https://www.open-scap.org/ -[9]: https://github.com/OWASP/sonarqube -[10]: https://find-sec-bugs.github.io/ -[11]: https://resources.bishopfox.com/resources/tools/google-hacking-diggity/ -[12]: https://www.projectcalico.org/ -[13]: https://github.com/aquasecurity/kube-hunter -[14]: https://github.com/neuvector/neuvector-helm -[15]: https://cve.mitre.org/ -[16]: https://www.hackerearth.com/challenges/hackathon/beginner-hack-10/ diff --git a/translated/talk/20190924 How DevOps professionals can become security champions.md b/translated/talk/20190924 How DevOps professionals can become security champions.md new file mode 100644 index 0000000000..84155a0517 --- /dev/null +++ b/translated/talk/20190924 How DevOps professionals can become security champions.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (hopefully2333) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How DevOps professionals can become security champions) +[#]: via: (https://opensource.com/article/19/9/devops-security-champions) +[#]: author: (Jessica Repka https://opensource.com/users/jrepkahttps://opensource.com/users/jrepkahttps://opensource.com/users/patrickhousleyhttps://opensource.com/users/mehulrajputhttps://opensource.com/users/alanfdosshttps://opensource.com/users/marcobravo) + +DevOps 专业人员如何成为网络安全拥护者 +====== +打破信息孤岛,成为网络安全的拥护者,这对你、对你的职业、对你的公司都会有所帮助。 +![A lock on the side of a building][1] + +安全是 DevOps 中一个被误解了的部分,一些人认为它不在 DevOps 的范围内,而另一些人认为它太过重要(并且被忽视),建议改为使用 DevSecOps。无论你同意哪一方的观点,网络安全都会影响到我们每一个人,这是很明显的事实。 + +每年, [黑客行为的统计数据][3] 都会更加令人震惊。例如, 每 39 秒就有一次黑客行为发生,这可能会导致你为公司写的记录、身份和专有项目被盗。你的安全团队可能需要花上几个月(也可能是永远找不到)才能发现这次黑客行为背后是谁,目的是什么,人在哪,什么时候黑进来的。 + +运营专家面对这些棘手问题应该如何是好?呐我说,现在是时候成为网络安全的拥护者,变为解决方案的一部分了。 + +### 孤岛势力范围的战争 + +在我和我本地的 IT 安全(ITSEC)团队一起肩并肩战斗的岁月里,我注意到了很多事情。一个很大的问题是,安全团队和 DevOps 之间关系紧张,这种情况非常普遍。这种紧张关系几乎都是来源于安全团队为了保护系统、防范漏洞所作出的努力(例如,设置访问控制或者禁用某些东西),这些努力会中断 DevOps 的工作并阻碍他们快速部署应用程序。 + +你也看到了,我也看到了,你在现场碰见的每一个人都有至少一个和它有关的故事。一小撮的怨恨最终烧毁了信任的桥梁,要么是花费一段时间修复,要么就是两个团体之间开始一场小型的地盘争夺战,这个结果会使 DevOps 实现起来更加艰难。 + +### 一种新观点 + +为了打破这些孤岛并结束势力战争,我在每个安全团队中都选了至少一个人来交谈,了解我们组织日常安全运营里的来龙去脉。我开始做这件事是出于好奇,但我持续做这件事是因为它总是能带给我一些有价值的、新的观点。例如,我了解到,对于每个因为失败的安全性而被停止的部署,安全团队都在疯狂地尝试修复 10 个他们看见的其他问题。他们反应的莽撞和尖锐是因为他们必须在有限的时间里修复这些问题,不然这些问题就会变成一个大问题。 + +考虑到发现、识别和撤销已完成操作所需的大量知识,或者指出 DevOps 团队正在做什么-没有背景信息-然后复制并测试它。所有的这些通常都要由人手配备非常不足的安全团队完成。 + +这就是你的安全团队的日常生活,并且你的 DevOps 团队看不到这些。ITSEC 的日常工作意味着超时加班和过度劳累,以确保公司,公司的团队,团队里工作的所有人能够安全地工作。 + +### 成为安全拥护者的方法 + +这些是你成为你的安全团队的拥护者之后可以帮到它们的。这意味着-对于你做的所有操作-你必须仔细、认真地查看所有能够让其他人登录的方式,以及他们能够从中获得什么。 + +帮助你的安全团队就是在帮助你自己。将工具添加到你的工作流程里,以此将你知道的要干的活和他们知道的要干的活结合到一起。从小事入手,例如阅读公共漏洞披露(CVEs),并将扫描模块添加到你的 CI/CD 流程里。对于你写的所有代码,都会有一个开源扫描工具,添加小型开源工具(例如下面列出来的)在长远看来是可以让项目更好的。 + +**容器扫描工具:** + + * [Anchore Engine][5] + * [Clair][6] + * [Vuls][7] + * [OpenSCAP][8] + + + +**代码扫描工具:** + + * [OWASP SonarQube][9] + * [Find Security Bugs][10] + * [Google Hacking Diggity Project][11] + + + +**Kubernetes 安全工具:** + + * [Project Calico][12] + * [Kube-hunter][13] + * [NeuVector][14] + + + +### 保持你的 DevOps 态度 + +如果你的工作角色是和 DevOps 相关的,那么学习新技术和如何运用这项新技术创造新事物就是你工作的一部分。安全也是一样。我在 DevOps 安全方面保持到最新,下面是我的方法的列表。 + + * 每周阅读一篇你工作的方向里和安全相关的文章. + * 每周查看 [CVE][15] 官方网站,了解出现了什么新漏洞. + * 尝试做一次黑客马拉松。一些公司每个月都要这样做一次;如果你觉得还不够、想了解更多,可以访问 Beginner Hack 1.0 网站。 + * 每年至少一次和那你的安全团队的成员一起参加安全会议,从他们的角度来看事情。 + + + +### 成为拥护者是为了变得更好 + +你应该成为你的安全的拥护者,下面是我们列出来的几个理由。首先是增长你的知识,帮助你的职业发展。第二是帮助其他的团队,培养新的关系,打破对你的组织有害的孤岛。在你的整个组织内建立由很多好处,包括设置沟通团队的典范,并鼓励人们一起工作。你同样能促进在整个组织中分享知识,并给每个人提供一个在安全方面更好的内部合作的新契机。 + +总的来说,成为一个网络安全的拥护者会让你成为你整个组织的拥护者。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/devops-security-champions + +作者:[Jessica Repka][a] +选题:[lujun9972][b] +译者:[hopefully2333](https://github.com/hopefully2333) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepkahttps://opensource.com/users/jrepkahttps://opensource.com/users/patrickhousleyhttps://opensource.com/users/mehulrajputhttps://opensource.com/users/alanfdosshttps://opensource.com/users/marcobravo +[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://opensource.com/article/19/1/what-devsecops +[3]: https://hostingtribunal.com/blog/hacking-statistics/ +[4]: https://opensource.com/article/18/8/what-cicd +[5]: https://github.com/anchore/anchore-engine +[6]: https://github.com/coreos/clair +[7]: https://vuls.io/ +[8]: https://www.open-scap.org/ +[9]: https://github.com/OWASP/sonarqube +[10]: https://find-sec-bugs.github.io/ +[11]: https://resources.bishopfox.com/resources/tools/google-hacking-diggity/ +[12]: https://www.projectcalico.org/ +[13]: https://github.com/aquasecurity/kube-hunter +[14]: https://github.com/neuvector/neuvector-helm +[15]: https://cve.mitre.org/ +[16]: https://www.hackerearth.com/challenges/hackathon/beginner-hack-10/ From c6c2423043f2e64bd4f4767c4d2e93d0e3831918 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 19 Oct 2019 21:35:35 +0800 Subject: [PATCH 050/800] Rename sources/tech/20191017 Measuring the business value of open source communities.md to sources/talk/20191017 Measuring the business value of open source communities.md --- ...017 Measuring the business value of open source communities.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191017 Measuring the business value of open source communities.md (100%) diff --git a/sources/tech/20191017 Measuring the business value of open source communities.md b/sources/talk/20191017 Measuring the business value of open source communities.md similarity index 100% rename from sources/tech/20191017 Measuring the business value of open source communities.md rename to sources/talk/20191017 Measuring the business value of open source communities.md From 504364f1a023144c753ffc4b31147ff21181fd1e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 19 Oct 2019 22:03:20 +0800 Subject: [PATCH 051/800] =?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...troduces SSDs it claims will -never die.md | 58 -------------- ...le Distributed Data Processing at Scale.md | 61 --------------- ... XE security flaws you should patch now.md | 65 ---------------- ...es Developer Program and Grant in India.md | 51 ------------ ...91002 Fedora projects for Hacktoberfest.md | 77 ------------------- 5 files changed, 312 deletions(-) delete mode 100644 sources/news/20190921 Samsung introduces SSDs it claims will -never die.md delete mode 100644 sources/news/20190924 Global Tech Giants Form Presto Foundation to Tackle Distributed Data Processing at Scale.md delete mode 100644 sources/news/20190926 Cisco- 13 IOS, IOS XE security flaws you should patch now.md delete mode 100644 sources/news/20190926 MG Motor Announces Developer Program and Grant in India.md delete mode 100644 sources/news/20191002 Fedora projects for Hacktoberfest.md diff --git a/sources/news/20190921 Samsung introduces SSDs it claims will -never die.md b/sources/news/20190921 Samsung introduces SSDs it claims will -never die.md deleted file mode 100644 index 09c1a52d7a..0000000000 --- a/sources/news/20190921 Samsung introduces SSDs it claims will -never die.md +++ /dev/null @@ -1,58 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Samsung introduces SSDs it claims will 'never die') -[#]: via: (https://www.networkworld.com/article/3440026/samsung-introduces-ssds-it-claims-will-never-die.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Samsung introduces SSDs it claims will 'never die' -====== -New fail-in-place technology in Samsung's SSDs will allow the chips to gracefully recover from chip failure. -Samsung - -[Solid-state drives][1] (SSDs) operate by writing to cells within the chip, and after so many writes, the cell eventually dies off and can no longer be written to. For that reason, SSDs have more actual capacity than listed. A 1TB drive, for example, has about 1.2TB of capacity, and as chips die off from repeated writes, new ones are brought online to keep the 1TB capacity. - -But that's for gradual wear. Sometimes SSDs just up and die completely, and without warning after a whole chip fails, not just a few cells. So Samsung is trying to address that with a new generation of SSD memory chips with a technology it calls fail-in-place (FIP). - -**Also read: [Inside Hyperconvergence: Combining compute, storage and networking][2]** - -FIP technology allows a drive to cope with a failure by working around the dead chip and allowing the SSD to keep operating and just not using the bad chip. You will have less storage, but in all likelihood that drive will be replaced anyway, so this helps prevent data loss. - -FIP also scans the data for any damage before copying it to the remaining NAND, which would be the first time I've ever seen a SSD with built-in data recovery. - -### Built-in virtualization and machine learning technology - -The new Samsung SSDs come with two other software innovations. The first is built-in virtualization technology, which allows a single SSD to be divided up into up to 64 smaller drives for a virtual environment. - -The second is V-NAND machine learning technology, which helps to "accurately predict and verify cell characteristics, as well as detect any variation among circuit patterns through big data analytics," as Samsung put it. Doing so means much higher levels of performance from the drive. - -As you can imagine, this technology is aimed at enterprises and large-scale data centers, not consumers. All told, Samsung is launching 19 models of these new SSDs called under the names PM1733 and PM1735. - -**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][3] ]** - -The PM1733 line features six models in a 2.5-inch U.2 form factor, offering storage capacity of between 960GB and 15.63TB, as well as four HHHL card-type drives with capacity ranging from 1.92TB to 30.72TB of storage. Each drive is guaranteed for one drive writes per day (DWPD) for five years. In other words, the warranty is good for writing the equivalent of the drive's total capacity once per day every day for five years. - -The PM1735 drives have lower capacity, maxing out at 12.8TB, but they are far more durable, guaranteeing three DWPD for five years. Both drives support PCI Express 4, which has double the throughput of the widely used PCI Express 3. The PM1735 offers nearly 14 times the sequential performance of a SATA-based SSD, with 8GB/s for read operations and 3.8GB/s for 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/3440026/samsung-introduces-ssds-it-claims-will-never-die.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/3326058/what-is-an-ssd.html -[2]: https://www.idginsiderpro.com/article/3409019/inside-hyperconvergence-combining-compute-storage-and-networking.html -[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20190924 Global Tech Giants Form Presto Foundation to Tackle Distributed Data Processing at Scale.md b/sources/news/20190924 Global Tech Giants Form Presto Foundation to Tackle Distributed Data Processing at Scale.md deleted file mode 100644 index f2525fa198..0000000000 --- a/sources/news/20190924 Global Tech Giants Form Presto Foundation to Tackle Distributed Data Processing at Scale.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Global Tech Giants Form Presto Foundation to Tackle Distributed Data Processing at Scale) -[#]: via: (https://opensourceforu.com/2019/09/global-tech-giants-form-presto-foundation-to-tackle-distributed-data-processing-at-scale/) -[#]: author: (Longjam Dineshwori https://opensourceforu.com/author/dineshwori-longjam/) - -Global Tech Giants Form Presto Foundation to Tackle Distributed Data Processing at Scale -====== - - * _**The Foundation aims to make the database search engine “the fastest and most reliable SQL engine for massively distributed data processing.”**_ - * _**Presto’s architecture allows users to query a variety of data sources and move at scale and speed.**_ - - - -![Facebook][1] - -Facebook, Uber, Twitter and Alibaba have joined hands to form a foundation to help Presto, a database search engine and processing tool, scale and diversify its community. - -Under Presto will be now hosted under the Linux Foundation, the U.S.-based non-profit organization announced on Monday. - -The newly established Presto Foundation will operate under a community governance model with representation from each of the founding members. It aims to make the engine “the fastest and most reliable SQL engine for massively distributed data processing.” - -“The Linux Foundation is excited to work with the Presto community, collaborating to solve the increasing problem of massive distributed data processing at internet scale,” said Michael Dolan, VP of Strategic Programs at the Linux Foundation.” - -**Presto can run on large clusters of machines** - -Presto was developed at Facebook in 2012 as a high-performance distributed SQL query engine for large scale data analytics. Presto’s architecture allows users to query a variety of data sources such as Hadoop, S3, Alluxio, MySQL, PostgreSQL, Kafka, MongoDB and move at scale and speed. - -It can query data where it is stored without needing to move the data to a separate system. Its in-memory and distributed query processing results in query latencies of seconds to minutes. - -“Presto has been designed for high performance exabyte-scale data processing on a large number of machines. Its flexible design allows processing data from a wide variety of data sources. From day one Presto has been designed with efficiency, scalability and reliability in mind, and it has been improved over the years to take on additional use cases at Facebook, such as batch and other application specific interactive use cases,” said Nezih Yigitbasi, Engineering Manager of Presto at Facebook. - -Presto is being used by over a thousand Facebook employees for running several million queries and processing petabytes of data per day, according to Kathy Kam, Head of Open Source at Facebook. - -**Expanding community for the benefit of all** - -Facebook released the source code of Presto to developers in 2013 in the hope that other companies would help to drive the future direction of the project. - -“It turns out many other companies were interested and so under The Linux Foundation, we believe the project can engage others and grow the community for the benefit of all,” said Kathy Kam. - -Uber’s data platform architecture uses Presto to extract critical insights from aggregated data. “Uber is honoured to partner with the Linux Foundation and major contributors from the tech community to bring the Presto Foundation to life. Our goal is to help create an open and collaborative community in which Presto developers can thrive,” asserted Brian Hsieh, Head of Open Source at Uber. - -Liang Lin, Senior Director of Alibaba OLAP products, believes that the collaboration would eventually benefit the community as well as Alibaba and its customers. - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/09/global-tech-giants-form-presto-foundation-to-tackle-distributed-data-processing-at-scale/ - -作者:[Longjam Dineshwori][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensourceforu.com/author/dineshwori-longjam/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2016/06/Facebook-Like.jpg?resize=350%2C213&ssl=1 diff --git a/sources/news/20190926 Cisco- 13 IOS, IOS XE security flaws you should patch now.md b/sources/news/20190926 Cisco- 13 IOS, IOS XE security flaws you should patch now.md deleted file mode 100644 index 5867ac6848..0000000000 --- a/sources/news/20190926 Cisco- 13 IOS, IOS XE security flaws you should patch now.md +++ /dev/null @@ -1,65 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco: 13 IOS, IOS XE security flaws you should patch now) -[#]: via: (https://www.networkworld.com/article/3441221/cisco-13-ios-ios-xe-security-flaws-you-should-patch-now.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco: 13 IOS, IOS XE security flaws you should patch now -====== -Cisco says vulnerabilities in IOS/IOS XE could cause DOS situation; warns on Traceroute setting -Woolzian / Getty Images - -Cisco this week warned its IOS and IOS XE customers of 13 vulnerabilities in the operating system software they should patch as soon as possible. - -All of the vulnerabilities – revealed in the company’s semiannual [IOS and IOS XE Software Security Advisory Bundle][1] – have a security impact rating (SIR) of "high". Successful exploitation of the vulnerabilities could allow an attacker to gain unauthorized access to, conduct a command injection attack on, or cause a denial of service (DoS) condition on an affected device, Cisco stated.  - -["How to determine if Wi-Fi 6 is right for you"][2] - -Two of the vulnerabilities affect both Cisco IOS Software and Cisco IOS XE Software. Two others affect Cisco IOS Software, and eight of the vulnerabilities affect Cisco IOS XE Software. The final one affects the Cisco IOx application environment. Cisco has confirmed that none of the vulnerabilities affect Cisco IOS XR Software or Cisco NX-OS Software.  Cisco [has released software updates][3] that address these problems. - -Some of the worst exposures include: - - * A [vulnerability in the IOx application environment][4] for Cisco IOS Software could let an authenticated, remote attacker gain unauthorized access to the Guest Operating System (Guest OS) running on an affected device. The vulnerability is due to incorrect role-based access control (RBAC) evaluation when a low-privileged user requests access to a Guest OS that should be restricted to administrative accounts. An attacker could exploit this vulnerability by authenticating to the Guest OS by using the low-privileged-user credentials. An exploit could allow the attacker to gain unauthorized access to the Guest OS as a root.This vulnerability affects Cisco 800 Series Industrial Integrated Services Routers and Cisco 1000 Series Connected Grid Routers (CGR 1000) that are running a vulnerable release of Cisco IOS Software with Guest OS installed.  While Cisco did not rate this vulnerability as critical, it did have a Common Vulnerability Scoring System (CVSS) of 9.9 out of 10.  Cisco recommends disabling the guest feature until a proper fix is installed. - * An exposure in the [Ident protocol handler of Cisco IOS and IOS XE][5] software could allow a remote attacker to cause an affected device to reload. The problem exists because the affected software incorrectly handles memory structures, leading to a NULL pointer dereference, Cisco stated. An attacker could exploit this vulnerability by opening a TCP connection to specific ports and sending traffic over that connection. A successful exploit could let the attacker cause the affected device to reload, resulting in a denial of service (DoS) condition. This vulnerability affects Cisco devices that are running a vulnerable release of Cisco IOS or IOS XE Software and that are configured to respond to Ident protocol requests. - * A vulnerability in the [common Session Initiation Protocol (SIP) library][6] of Cisco IOS and IOS XE Software could let an unauthenticated, remote attacker trigger a reload of an affected device, resulting in a denial of service (DoS). The vulnerability is due to insufficient sanity checks on an internal data structure. An attacker could exploit this vulnerability by sending a sequence of malicious SIP messages to an affected device. An exploit could allow the attacker to cause a NULL pointer dereference, resulting in a crash of the _iosd_ This triggers a reload of the device, Cisco stated. - * A [vulnerability in the ingress packet-processing][7] function of Cisco IOS Software for Cisco Catalyst 4000 Series Switches could let an aggressor cause a denial of service (DoS). The vulnerability is due to improper resource allocation when processing TCP packets directed to the device on specific Cisco Catalyst 4000 switches. An attacker could exploit this vulnerability by sending crafted TCP streams to an affected device. A successful exploit could cause the affected device to run out of buffer resources, impairing operations of control-plane and management-plane protocols, resulting in a DoS condition. This vulnerability can be triggered only by traffic that is destined to an affected device and cannot be exploited using traffic that transits an affected device Cisco stated. - - - -In addition to the warnings, Cisco also [issued an advisory][8] for users to deal with problems in its IOS and IOS XE  Layer 2 (L2) traceroute utility program.  The traceroute identifies the L2 path that a packet takes from a source device to a destination device. - -Cisco said that by design, the L2 traceroute server does not require authentication, but it allows certain information about an affected device to be read, including Hostname, hardware model, configured interfaces, IP addresses and other details.  Reading this information from multiple switches in the network could allow an attacker to build a complete L2 topology map of that network. - -Depending on whether the L2 traceroute feature is used in the environment and whether the Cisco IOS or IOS XE Software release supports the CLI commands to implement the respective option, Cisco said there are several ways to secure the L2 traceroute server: disable it, restrict access to it through infrastructure access control lists (iACLs), restrict access through control plane policing (CoPP), and upgrade to a software release that disables the server by default. - -**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][9] ]** - -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/3441221/cisco-13-ios-ios-xe-security-flaws-you-should-patch-now.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://tools.cisco.com/security/center/viewErp.x?alertId=ERP-72547 -[2]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html -[3]: https://tools.cisco.com/security/center/softwarechecker.x -[4]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190925-ios-gos-auth -[5]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190925-identd-dos -[6]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190925-sip-dos -[7]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190925-cat4000-tcp-dos -[8]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190925-l2-traceroute -[9]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[10]: https://www.facebook.com/NetworkWorld/ -[11]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20190926 MG Motor Announces Developer Program and Grant in India.md b/sources/news/20190926 MG Motor Announces Developer Program and Grant in India.md deleted file mode 100644 index 2f88770e2a..0000000000 --- a/sources/news/20190926 MG Motor Announces Developer Program and Grant in India.md +++ /dev/null @@ -1,51 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (MG Motor Announces Developer Program and Grant in India) -[#]: via: (https://opensourceforu.com/2019/09/mg-motor-announces-developer-program-and-grant-in-india/) -[#]: author: (Mukul Yudhveer Singh https://opensourceforu.com/author/mukul-kumar/) - -MG Motor Announces Developer Program and Grant in India -====== - -[![][1]][2] - - * _**Launched in partnership with Adobe, Cognizant, SAP, Airtel, TomTom and Unlimit**_ - * _**Initiative provides developers to build innovative mobility applications and experiences**_ - - - -![][3]MG Motor India has today announced the introduction of its MG Developer Program and Grant. Launched in collaboration with leading technology companies such as SAP, Cognizant, Adobe, Airtel, TomTom and Unlimit, the initiative is aimed at incentivizing Indian innovators and developers to build futuristic mobility applications and experiences. The program also brings in TiE Delhi NCR as the ecosystem partner. - -Rajeev Chaba, president & MD, MG Motor India said, “The automobile industry is currently witnessing sweeping transformations in the space of connected, electric and shared mobility. MG aims to take this revolution forward with its focus on attaining technological leadership in the automotive industry. We have partnered with leading tech giants to enable start-ups to build innovative applications that would enable unique experiences for customers across the entire automotive ecosystem. More partners are likely to join the program in due course.” - -The company is encouraging developers to send in their ideas to the MG India Team. During the program, selected ideas will get access to resources from the likes of Airtel, SAP, Adobe, Unlimit and Cognizant. - -**Grants ranging up to Rs 25 lakhs (2.5 million) for start-ups and innovators** - -As part of the MG Developer Program & Grant, MG Motor India will provide innovators with an unparalleled opportunity to secure mentorship and funding from industry leaders. Shortlisted ideas will receive specialized, high-level mentoring and networking opportunities to assist with the practical development of the solution, business plan and modelling, testing facilities, go-to-market strategy, etc. Winning ideas will also have access to a grant, the amount of which will be decided by the jury, on a case-to-case basis. - -The MG Developer Program & Grant will initially focus on driving innovation in the following verticals: electric vehicles and components, batteries and management,  harging infrastructure, connected mobility, voice recognition, AI & ML, navigation technologies, customer experiences, car buying experiences, and autonomous vehicles. - -“The MG Developer & Grant Program is the latest in a series of initiatives as part of our commitment to innovation as a core organizational pillar. The program will ensure proper mentoring from over 20 industry leaders for start-ups, laying a foundation for them to excel in the future and trigger a stream of newer Internet Car use-cases that will, in turn, drive adoption of new technologies within the Indian automotive ecosystem. It has been our commitment in the market and Innovation is our key pillar,” added Chaba. - -The program will award grants ranging from INR5 lakhs to INR25 Lakhs. The program will be open to both external developers – including students, innovators, inventors, startups and other tech companies – and internal employee teams at MG Motor and its program partners. - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/09/mg-motor-announces-developer-program-and-grant-in-india/ - -作者:[Mukul Yudhveer Singh][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensourceforu.com/author/mukul-kumar/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/MG-Developer-program.png?resize=660%2C440&ssl=1 (MG Developer program) -[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/MG-Developer-program.png?fit=660%2C440&ssl=1 -[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/MG-Developer-program.png?resize=350%2C233&ssl=1 diff --git a/sources/news/20191002 Fedora projects for Hacktoberfest.md b/sources/news/20191002 Fedora projects for Hacktoberfest.md deleted file mode 100644 index b8a5874b53..0000000000 --- a/sources/news/20191002 Fedora projects for Hacktoberfest.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fedora projects for Hacktoberfest) -[#]: via: (https://fedoramagazine.org/fedora-projects-for-hacktoberfest/) -[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) - -Fedora projects for Hacktoberfest -====== - -![][1] - -It’s October! That means its time for the annual [Hacktoberfest][2] presented by DigitalOcean and DEV. Hacktoberfest is a month-long event that encourages contributions to open source software projects. Participants who [register][3] and submit at least four pull requests to GitHub-hosted repositories during the month of October will receive a free t-shirt. - -In a recent Fedora Magazine article, I listed some areas where would-be contributors could [get started contributing to Fedora][4]. In this article, I highlight some specific projects that provide an opportunity to help Fedora while you participate in Hacktoberfest. - -### Fedora infrastructure - - * [Bodhi][5] — When a package maintainer builds a new version of a software package to fix bugs or add new features, it doesn’t go out to users right away. First it spends time in the updates-testing repository where in can receive some real-world usage. Bodhi manages the flow of updates from the testing repository into the updates repository and provides a web interface for testers to provide feedback. - * [the-new-hotness][6] — This project listens to [release-monitoring.org][7] (which is also on [GitHub][8]) and opens a Bugzilla issue when a new upstream release is published. This allows package maintainers to be quickly informed of new upstream releases. - * [koschei][9] — koschei enables continuous integration for Fedora packages. It is software for running a service for scratch-rebuilding RPM packages in Koji instance when their build-dependencies change or after some time elapses. - * [MirrorManager2][10] — Distributing Fedora packages to a global user base requires a lot of bandwidth. Just like developing Fedora, distributing Fedora is a collaborative effort. MirrorManager2 tracks the hundreds of public and private mirrors and routes each user to the “best” one. - * [fedora-messaging][11] — Actions within the Fedora community—from source code commits to participating in IRC meetings to…lots of things—generate messages that can be used to perform automated tasks or send notifications. fedora-messaging is the tool set that makes sending and receiving these messages possible. - * [fedocal][12] — When is that meeting? Which IRC channel was it in again? Fedocal is the calendar system used by teams in the Fedora community to coordinate meetings. Not only is it a good Hacktoberfest project, it’s also [looking for a new maintainer][13] to adopt it. - - - -In addition to the projects above, the Fedora Infrastructure team has highlighted [good Hacktoberfest issues][14] across all of their GitHub projects. - -### Community projects - - * [bodhi-rs][15] — This project provides Rust bindings for Bodhi. - * [koji-rs][16] — Koji is the system used to build Fedora packages. Koji-rs provides bindings for Rust applications. - * [fedora-rs][17] — This project provides a Rust library for interacting with Fedora services like other languages like Python have. - * [feedback-pipeline][18] — One of the current Fedora Council objectives is [minimization][19]: work to reduce the installation and patching footprint of Fedora releases. feedback-pipeline is a tool developed by this team to generate reports of RPM sizes and dependencies. - - - -### And many more - -The projects above are only a small sample focused on software used to build Fedora. Many Fedora packages have upstreams hosted on GitHub—too many to list here. The best place to start is with a project that’s important to you. Any contributions you make help improve the entire open source ecosystem. If you’re looking for something in particular, the [Join Special Interest Group][20] can help. Happy hacking! - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/fedora-projects-for-hacktoberfest/ - -作者:[Ben Cotton][a] -选题:[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/bcotton/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/09/hacktoberfest-816x345.jpg -[2]: https://hacktoberfest.digitalocean.com/ -[3]: https://hacktoberfest.digitalocean.com/register -[4]: https://fedoramagazine.org/how-to-contribute-to-fedora/ -[5]: https://github.com/fedora-infra/bodhi -[6]: https://github.com/fedora-infra/the-new-hotness -[7]: https://release-monitoring.org/ -[8]: https://github.com/release-monitoring/anitya -[9]: https://github.com/fedora-infra/koschei -[10]: https://github.com/fedora-infra/mirrormanager2 -[11]: https://github.com/fedora-infra/fedora-messaging -[12]: https://github.com/fedora-infra/fedocal -[13]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/GH4N3HYJ4ARFRP666O6EQCHDIQMXVUJB/ -[14]: https://github.com/orgs/fedora-infra/projects/4 -[15]: https://github.com/ironthree/bodhi-rs -[16]: https://github.com/ironthree/koji-rs -[17]: https://github.com/ironthree/fedora-rs -[18]: https://github.com/minimization/feedback-pipeline -[19]: https://docs.fedoraproject.org/en-US/minimization/ -[20]: https://fedoraproject.org/wiki/SIGs/Join From 23bc8f09da733c0ef516875531816cbbad6b88d9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 19 Oct 2019 22:50:40 +0800 Subject: [PATCH 052/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lnrCoder 恭喜你完成了第一篇翻译! --- ...tall and Configure PostgreSQL on Ubuntu.md | 88 +++++++++---------- 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md index 3da0f81114..6d91dcedef 100644 --- a/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md +++ b/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install and Configure PostgreSQL on Ubuntu) @@ -10,19 +10,19 @@ 如何在 Ubuntu 上安装和配置 PostgreSQL ====== -_**本教程中,你将学习如何在 Ubuntu Linux 上安装和使用开源数据库 PostgreSQL。**_ +> 本教程中,你将学习如何在 Ubuntu Linux 上安装和使用开源数据库 PostgreSQL。 -[PostgreSQL][1] (又名 Postgres) 是一个功能强大的,免费的开源关系型数据库管理系统 ([RDBMS][2]) 其 在可靠性、稳定性、性能方面获得了业内极高的声誉 。它旨在处理各种规模的任务。它是跨平台的,而且是 [macOS Server][3] 的默认数据库。 +[PostgreSQL][1] (又名 Postgres) 是一个功能强大的自由开源的关系型数据库管理系统 ([RDBMS][2]) ,其在可靠性、稳定性、性能方面获得了业内极高的声誉。它旨在处理各种规模的任务。它是跨平台的,而且是 [macOS Server][3] 的默认数据库。 如果你喜欢简单易用的 SQL 数据库管理器,那么 PostgreSQL 将是一个正确的选择。PostgreSQL 对标准的 SQL 兼容的同时提供了额外的附加特性,同时还可以被用户大量扩展,用户可以添加数据类型、函数并执行更多的操作。 -之前我曾论述过 [在 Ubuntu 上安装 MySQL][4]。在本文中,我将向你展示如何安装和配置 PostgreSQL,以便你随时可以使用它来满足你的任何需求。 +之前我曾论述过 [在 Ubuntu 上安装 MySQL][4]。在本文中,我将向你展示如何安装和配置 PostgreSQL,以便你随时可以使用它来满足你的任何需求。 ![][5] ### 在 Ubuntu 上安装 PostgreSQL -PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其他开发工具一样,它可能不是最新版本。 +PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其它开发工具一样,它可能不是最新版本。 首先在终端中使用 [apt 命令][7] 检查 [Ubuntu 存储库][6] 中可用的 PostgreSQL 版本: @@ -30,7 +30,7 @@ PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其他开 apt show postgresql ``` -在我的 Ubuntu 18.04 中,它显示 PostgreSQL 的可用版本是 10 (10+190 表示版本 10) 而 PostgreSQL 版本 11 已经发布。 +在我的 Ubuntu 18.04 中,它显示 PostgreSQL 的可用版本是 10(10+190 表示版本 10)而 PostgreSQL 版本 11 已经发布。 ``` Package: postgresql @@ -47,24 +47,22 @@ Origin: Ubuntu #### 方法一:通过 Ubuntu 存储库安装 PostgreSQL -在终端中,使用以下命令安装 PostgreSQL +在终端中,使用以下命令安装 PostgreSQL: ``` sudo apt update sudo apt install postgresql postgresql-contrib ``` -根据提示输入你的密码,依据于你的网速情况,程序将在几秒到几分钟安装完成。 说到这一点 ,随时检查 [Ubuntu 中的各种网络带宽][8]。 +根据提示输入你的密码,依据于你的网速情况,程序将在几秒到几分钟安装完成。说到这一点,随时检查 [Ubuntu 中的各种网络带宽][8]。 -什么是 postgresql-contrib? +> 什么是 postgresql-contrib? -postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核心包的实用工具和功能。在大多数情况下,最好将 contrib 包与 PostgreSQL 核心一起安装。 - -推荐阅读 [解决 gvfsd-smb-browser 在 Ubuntu 16.04 中占用 100% CPU][9] +> postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核心包的实用工具和功能。在大多数情况下,最好将 contrib 包与 PostgreSQL 核心一起安装。 #### 方法二:在 Ubuntu 中安装最新版本的 PostgreSQL 11 -要安装 PostgreSQL 11, 你需要在 sources.list 中添加官方 PostgreSQL 存储库和证书,然后从那里安装它。 +要安装 PostgreSQL 11, 你需要在 `sources.list` 中添加官方 PostgreSQL 存储库和证书,然后从那里安装它。 不用担心,这并不复杂。 只需按照以下步骤。 @@ -74,7 +72,7 @@ postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核 wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - ``` -现在,使用以下命令添加存储库。如果你使用的是 Linux Mint,则必须手动替换你的 Mint 所基于的 Ubuntu 版本号 +现在,使用以下命令添加存储库。如果你使用的是 Linux Mint,则必须手动替换你的 Mint 所基于的 Ubuntu 版本号: ``` sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list' @@ -87,47 +85,47 @@ sudo apt update sudo apt install postgresql postgresql-contrib ``` -PostgreSQL GUI 应用程序 +> PostgreSQL GUI 应用程序 -你也可以安装用于管理 PostgreSQL 数据库的 GUI 应用程序 (pgAdmin): +> 你也可以安装用于管理 PostgreSQL 数据库的 GUI 应用程序(pgAdmin): -_sudo apt install pgadmin4_ +> `sudo apt install pgadmin4` ### PostgreSQL 配置 -你可以通过执行以下命令来检查 **PostgreSQL** 是否正在运行: +你可以通过执行以下命令来检查 PostgreSQL 是否正在运行: ``` service postgresql status ``` -通过 **service** 命令,你可以 **启动**, **关闭** 或 **重启** **postgresql**。输入 **service postgresql** 并按 **回车** 将列出所有选项。现在,登录用户。 +通过 `service` 命令,你可以启动、关闭或重启 `postgresql`。输入 `service postgresql` 并按回车将列出所有选项。现在,登录该用户。 -默认情况下,PostgreSQL 会创建一个拥有所权限的特殊用户 postgres 。要实际使用 PostgreSQL,你必须先登录该账户: +默认情况下,PostgreSQL 会创建一个拥有所权限的特殊用户 `postgres`。要实际使用 PostgreSQL,你必须先登录该账户: ``` sudo su postgres ``` -你的提示应更改为类似于以下的内容: +你的提示符会更改为类似于以下的内容: ``` postgres@ubuntu-VirtualBox:/home/ubuntu$ ``` -现在,使用 **psql** 来启动 **PostgreSQL Shell** : +现在,使用 `psql` 来启动 PostgreSQL Shell: ``` psql ``` -你应该会收到如下提示: +你应该会看到如下提示符: ``` postgress=# ``` -你可以输入 **\q** 以**退出**,输入 **\?** 获取**帮助**。 +你可以输入 `\q` 以退出,输入 `\?` 获取帮助。 要查看现有的所有表,输入如下命令: @@ -135,59 +133,59 @@ postgress=# \l ``` -输出内容类似于下图所示 (单击 **q** 键退出该视图): +输出内容类似于下图所示(单击 `q` 键退出该视图): ![PostgreSQL Tables][10] -使用 **\du** 命令,你可以查看 **PostgreSQL 用户**: +使用 `\du` 命令,你可以查看 PostgreSQL 用户: ![PostgreSQLUsers][11] -你可以使用以下命令更改任何用户(包括 postgres)的密码: +你可以使用以下命令更改任何用户(包括 `postgres`)的密码: ``` ALTER USER postgres WITH PASSWORD 'my_password'; ``` -**注意:** _将 **postgres** 替换为用户名 **my_password** 替换为所需要的密码。_ 另外,不要忘记每条命令后面的 **;** (分号)。 +**注意:**将 `postgres` 替换为你要更改的用户名,`my_password` 替换为所需要的密码。另外,不要忘记每条命令后面的 `;`(分号)。 -建议你另外创建一个用户(不建议使用默认的 **postgres** 用户)。为此,请使用一下命令: +建议你另外创建一个用户(不建议使用默认的 `postgres` 用户)。为此,请使用以下命令: ``` CREATE USER my_user WITH PASSWORD 'my_password'; ``` -运行 **\du**,你将看到该用户,但是,**my_user** 用户没有任何的属性。来让我们将它添加到**超级用户**: +运行 `\du`,你将看到该用户,但是,`my_user` 用户没有任何的属性。来让我们给它添加超级用户权限: ``` ALTER USER my_user WITH SUPERUSER; ``` -你可以使用以下命令 **删除用户** : +你可以使用以下命令删除用户: ``` DROP USER my_user; ``` -要使用其他用户登录,使用 **\q** 命令退出,然后使用以下命令登录: +要使用其他用户登录,使用 `\q` 命令退出,然后使用以下命令登录: ``` psql -U my_user ``` -你可以使用 **-d** 参数直接连接数据库: +你可以使用 `-d` 参数直接连接数据库: ``` psql -U my_user -d my_db ``` -你可以使用其他已存在的用户调用 PostgreSQL。例如,我使用 **ubuntu**。要登录,从终端执行以下命名: +你可以使用其他已存在的用户调用 PostgreSQL。例如,我使用 `ubuntu`。要登录,从终端执行以下命名: ``` psql -U ubuntu -d postgres ``` -**注意:** _你必须指定一个数据库(默认情况下,它将尝试将你连接到与登录的用户名相同的数据库)。_ +**注意:**你必须指定一个数据库(默认情况下,它将尝试将你连接到与登录的用户名相同的数据库)。 如果遇到如下错误: @@ -195,13 +193,13 @@ psql -U ubuntu -d postgres psql: FATAL: Peer authentication failed for user "my_user" ``` -确保以正确的用户身份登录,并使用管理员权限编辑 **/etc/postgresql/11/main/pg_hba.conf** +确保以正确的用户身份登录,并使用管理员权限编辑 `/etc/postgresql/11/main/pg_hba.conf`: ``` sudo vim /etc/postgresql/11/main/pg_hba.conf ``` -**注意:** _用你的版本替换 **11** (例如 **10**)._ +**注意:**用你的版本替换 `11`(例如 `10`)。 对如下所示的一行进行替换: @@ -215,23 +213,19 @@ local all postgres peer local all postgres md5 ``` -然后重启 **PostgreSQL**: +然后重启 PostgreSQL: ``` sudo service postgresql restart ``` -使用 **PostgreSQL** 与使用其他 **SQL** 类型的数据库相同。由于本文旨在帮助你进行初步的设置,因此不涉及具体的命令。不过,这里有个 [非常有用的要点][12] 可供参考! 另外, 手册 (**man psql**) 和 [文档][13] 也非常有用。 +使用 PostgreSQL 与使用其他 SQL 类型的数据库相同。由于本文旨在帮助你进行初步的设置,因此不涉及具体的命令。不过,这里有个 [非常有用的要点][12] 可供参考! 另外, 手册(`man psql`)和 [文档][13] 也非常有用。 -建议阅读 [如何][14] 在 Ubuntu 中与 Dropbox 共享和同步任何文件夹。 +### 总结 -**总结** +阅读本文有望指导你完成在 Ubuntu 系统上安装和准备 PostgreSQL 的过程。如果你不熟悉 SQL,你应该阅读 [基本的 SQL 命令][15]。 -阅读本文有望指导你完成在 Ubuntu 系统上安装和准备 PostgreSQL 的过程。如果你不熟悉 SQL,你应该阅读 [基本的 SQL 命令][15] - -[基本的 SQL 命令][15] - -如果您有任何问题或疑惑,请随时在评论部分提出。 +如果你有任何问题或疑惑,请随时在评论部分提出。 -------------------------------------------------------------------------------- @@ -240,7 +234,7 @@ via: https://itsfoss.com/install-postgresql-ubuntu/ 作者:[Sergiu][a] 选题:[lujun9972][b] 译者:[lnrCoder](https://github.com/lnrCoder) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e671b3759a323c00e1f86153862def7c88bcd055 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 19 Oct 2019 22:52:31 +0800 Subject: [PATCH 053/800] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lnrCoder 本文首发地址: https://linux.cn/article-11480-1.html 你的 LCTT 专页地址: https://linux.cn/lctt/lnrCoder 请注册以领取你的 LCCN : https://lctt.linux.cn/ --- ...90805 How to Install and Configure PostgreSQL on Ubuntu.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190805 How to Install and Configure PostgreSQL on Ubuntu.md (99%) diff --git a/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/published/20190805 How to Install and Configure PostgreSQL on Ubuntu.md similarity index 99% rename from translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md rename to published/20190805 How to Install and Configure PostgreSQL on Ubuntu.md index 6d91dcedef..e89257812d 100644 --- a/translated/tech/20190805 How to Install and Configure PostgreSQL on Ubuntu.md +++ b/published/20190805 How to Install and Configure PostgreSQL on Ubuntu.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11480-1.html) [#]: subject: (How to Install and Configure PostgreSQL on Ubuntu) [#]: via: (https://itsfoss.com/install-postgresql-ubuntu/) [#]: author: (Sergiu https://itsfoss.com/author/sergiu/) From 16cb6d0dfe8856f42ef5f736291af5cc41c04530 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 19 Oct 2019 23:23:37 +0800 Subject: [PATCH 054/800] PRF @geekpi --- ... 10 open source video players for Linux.md | 81 +++++++------------ 1 file changed, 31 insertions(+), 50 deletions(-) diff --git a/translated/talk/20191009 Top 10 open source video players for Linux.md b/translated/talk/20191009 Top 10 open source video players for Linux.md index 67eab29960..8735a7b408 100644 --- a/translated/talk/20191009 Top 10 open source video players for Linux.md +++ b/translated/talk/20191009 Top 10 open source video players for Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11481-1.html) [#]: subject: (Top 10 open source video players for Linux) [#]: via: (https://opensourceforu.com/2019/10/top-10-open-source-video-players-for-linux/) [#]: author: (Stella Aldridge https://opensourceforu.com/author/stella-aldridge/) @@ -10,15 +10,15 @@ Linux 中的十大开源视频播放器 ====== -[![][1]][2] +![][1] -_选择合适的视频播放器有助于确保你获得最佳的观看体验,并为你提供[创建视频网站][3]的工具。你甚至可以根据个人喜好自定义正在观看的视频。_ +> 选择合适的视频播放器有助于确保你获得最佳的观看体验,并为你提供[创建视频网站][3]的工具。你甚至可以根据个人喜好自定义正在观看的视频。 -因此,为了帮助你挑选适合你需求的最佳播放器,我们列出了 Linux 中十大开源播放器。 +因此,为了帮助你挑选适合你需求的最佳播放器,我们列出了 Linux 中的十大开源播放器。 让我们来看看: -**1\. XBMC – Kodi 媒体中心** +### 1、XBMC – Kodi 媒体中心 这是一个灵活的跨平台播放器,核心使用 C++ 编写,并提供 Python 脚本作为附加组件。使用 Kodi 的好处包括: @@ -28,11 +28,9 @@ _选择合适的视频播放器有助于确保你获得最佳的观看体验, * 有很多不错的附加组件,如视频和音频流插件、主题、屏幕保护程序等 * 它支持多种格式,如 MPEG-1、2、4、RealVideo、HVC、HEVC 等 +### 2、VLC 媒体播放器 - -**2\. VLC 媒体播放器** - -由于该播放器在一系列操作系统上具有令人印象深刻的功能和可用性,他在列表上是理所当然的。它使用 C、C++ 和 Objective C 编写,用户无需使用插件,这要归功于它对解码库的广泛支持。VLC 媒体播放器的优势包括: +由于该播放器在一系列操作系统上具有令人印象深刻的功能和可用性,它出现在列表上是理所当然的。它使用 C、C++ 和 Objective C 编写,用户无需使用插件,这要归功于它对解码库的广泛支持。VLC 媒体播放器的优势包括: * 在 Linux 上支持 DVD 播放器 * 能够播放 .iso 文件 @@ -40,54 +38,45 @@ _选择合适的视频播放器有助于确保你获得最佳的观看体验, * 可以直接从 U 盘或外部驱动器运行 * API 支持和浏览器支持(通过插件) - - -**3\. Bomi(CMPlayer)** +### 3、Bomi(CMPlayer) 这个灵活和强大的播放器被许多普通用户选择,它的优势有: - * 易于使用的图形用户界面 (GUI) + * 易于使用的图形用户界面(GUI) * 令人印象深刻的播放能力 - * 恢复播放的选项 + * 可以恢复播放 * 支持字幕,可以渲染多个字幕文件 +![][4] +### 4、Miro 音乐与视频播放器 -**[![][4]][5] -4\. Miro Music and Video Player** - -以前被称为 Democracy Player (DTV), Miro 由分享文化基金会(Participatory Culture Foundation)重新开发,是一个不错的跨平台音频视频播放器。令人印象深刻,因为: +以前被称为 Democracy Player(DTV),Miro 由参与文化基金会Participatory Culture Foundation重新开发,是一个不错的跨平台音频视频播放器。令人印象深刻,因为: * 支持一些高清音频和视频 * 提供超过 40 种语言版本 - * 可以播放多种文件格式,例如,QuickTime、WMV、MPEG 文件、音频视频接口 (AVI)、XVID + * 可以播放多种文件格式,例如,QuickTime、WMV、MPEG 文件、AVI、XVID * 一旦可用,可以自动通知用户并下载视频 +### 5、SMPlayer - -**5\. SMPlayer** - -这个跨平台的媒体播放器,只使用 C++ 的 Qt 库编写,它是一个强大的,多功能播放器。我们喜欢它,因为: +这个跨平台的媒体播放器,只使用 C++ 的 Qt 库编写,它是一个强大的多功能播放器。我们喜欢它,因为: * 有多语言选择 * 支持所有默认格式 - * 支持 EDL 文件,你可以配置从 Internet 获取的字幕 + * 支持 EDL 文件,你可以配置从互联网获取的字幕 * 可从互联网下载的各种皮肤 * 倍速播放 - - -**6\. MPV Player** +### 6、MPV 播放器 它用 C、Objective-C、Lua 和 Python 编写,免费、易于使用,并且有许多新功能,便于使用。主要加分是: * 可以编译为一个库,公开客户端 API,从而增强控制 * 允许媒体编码 - * 平滑运动 + * 平滑动画 - - -**7\. Deepin Movie** +### 7、Deepin Movie 此播放器是开源媒体播放器的一个极好的例子,它有很多优势,包括: @@ -95,45 +84,37 @@ _选择合适的视频播放器有助于确保你获得最佳的观看体验, * 各种格式的视频文件可以通过这个播放器轻松播放 * 流媒体功能能让用户享受许多在线视频资源 +### 8、Gnome 视频 +以前称为 Totem,这是 Gnome 桌面环境的播放器。 -**8\. Gnome Videos** - -以前称为 Totem,这是 Gnome 桌面环境选择的播放器。 -完全用 C 编写,使用 GStreamer 多媒体框架构建,另外的版本(>2.7.1)使用 xine 作为后端。它是很棒的,因为: +完全用 C 编写,使用 GStreamer 多媒体框架构建,高于 2.7.1 的版本使用 xine 作为后端。它是很棒的,因为: 它支持大量的格式,包括: - * Supports for direct video playback from Internet channels such as Apple * SHOUTcast、SMIL、M3U、Windows 媒体播放器格式等 * 你可以在播放过程中调整灯光设置,如亮度和对比度 * 加载 SubRip 字幕 * 支持从互联网频道(如 Apple)直接播放视频 - - -**9\. Xine Multimedia Player** +### 9、Xine 多媒体播放器 我们列表中用 C 编写的另外一个跨平台多媒体播放器。这是一个全能播放器,因为: - * 它支持物理媒体以及视频设备。3gp, Matroska(MKV)、 MOV, Mp4、音频格式, + * 它支持物理媒体以及视频设备。3gp、MKV、 MOV、Mp4、音频格式 * 网络协议,V4L、DVB 和 PVR 等 * 它可以手动校正音频和视频流的同步 +### 10、ExMPlayer - -**10\. ExMPlayer** - -最后单同样重要的一个,ExMPlayer 是一个惊人的、强大的 MPlayer 的 GUI 前端。它的优点包括: +最后但同样重要的一个,ExMPlayer 是一个惊人的、强大的 MPlayer 的 GUI 前端。它的优点包括: * 可以播放任何媒体格式 * 支持网络流和字幕 * 易于使用的音频转换器 * 高品质的音频提取,而不会影响音质 - - -上面的视频播放器在 Linux 上工作得很好。我们建议你尝试一下,选择一个最适合你的播放器。 +上面这些视频播放器在 Linux 上工作得很好。我们建议你尝试一下,选择一个最适合你的播放器。 -------------------------------------------------------------------------------- @@ -142,7 +123,7 @@ via: https://opensourceforu.com/2019/10/top-10-open-source-video-players-for-lin 作者:[Stella Aldridge][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 db547d0f5d951f3455263c0e3be70913e347b5e4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 19 Oct 2019 23:23:53 +0800 Subject: [PATCH 055/800] PUB @geekpi https://linux.cn/article-11481-1.html --- .../20191009 Top 10 open source video players for Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20191009 Top 10 open source video players for Linux.md (100%) diff --git a/translated/talk/20191009 Top 10 open source video players for Linux.md b/published/20191009 Top 10 open source video players for Linux.md similarity index 100% rename from translated/talk/20191009 Top 10 open source video players for Linux.md rename to published/20191009 Top 10 open source video players for Linux.md From b40eb56900e3319a4aca8eba3bcaabbf69e3183c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 20 Oct 2019 00:54:24 +0800 Subject: [PATCH 056/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191020=20Projec?= =?UTF-8?q?t=20Trident=20Ditches=20BSD=20for=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191020 Project Trident Ditches BSD for Linux.md --- ...0 Project Trident Ditches BSD for Linux.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20191020 Project Trident Ditches BSD for Linux.md diff --git a/sources/tech/20191020 Project Trident Ditches BSD for Linux.md b/sources/tech/20191020 Project Trident Ditches BSD for Linux.md new file mode 100644 index 0000000000..1197c440e2 --- /dev/null +++ b/sources/tech/20191020 Project Trident Ditches BSD for Linux.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Project Trident Ditches BSD for Linux) +[#]: via: (https://itsfoss.com/bsd-project-trident-linux/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Project Trident Ditches BSD for Linux +====== + +Recently a BSD distribution announced that it was going to rebase on Linux. Yep, you heard me correctly. Project Trident is moving to Void Linux. + +### What is Going on with Project Trident? + +Recently, Project Trident [announced][1] that they had been working behind the scenes to move away from FreeBSD. This is quite a surprising move (and an unprecedented one). + +According to a [later post][2], the move was motivated by long-standing issues with FreeBSD. These issues include “hardware compatibility, communications standards, or package availability continue to limit Project Trident users”. According to a conversation on [Telegram][3], FreeBSD has just updated its build of the Telegram client and it was nine release behind everyone else. + +The lead dev of Project Trident, [Ken Moore][4], is also the main developer of the Lumina Desktop. The [Lumina Desktop][5] has been on hold for a while because the [Project Trident][6] team had to do so much work just to keep their packages updated. (Once they complete the transition to Void Linux, Ken will start working on Lumina again.) + +After much searching and testing, the Project Trident team decided to use [Void Linux][7] as their new base. + +According to the Project Trident team, the move to Void Linux will have the [following benefits][2]: + + * Better GPU support + * Better sound card and streaming support + * Better wireless support + * Bluetooth support for the first time + * Up to date versions of applications + * Faster boot times + * Hybrid EFI/Legacy installation and boot support + + + +### Moving Plans + +![][8] + +Project Trident currently has two different versions available: Trident-stable and Trident-release. Trident-stable is based on FreeBSD 12 and will continue to get updates until January of 2020 with the ports repo being deleted in April of 2020. On the other hand, Trident-release (which is based on FreeBSD 13) will receive no further updates. That ports repo will be deleted in January of 2020. + +The first Void Linux-based releases should be available in January of 2020. Ken said that they might issue an alpha iso or two to show off their progress, but they would be for testing purposes only. + +Currently, Ken said that they are working to port all of their “in-house utilities over to work natively on Void Linux”. Void Linux does not support ZFS-on-root, which is a big part of the BSDs. However, Project Trident is planning to use their knowledge of ZFS to add support for it to Void. + +There will not be a migration path from the FreeBSD-based version to the Void-based version. If you are currently using Project Trident, you will need to backup your `/home/*` directory before performing a clean install of the new version. + +### Final Thoughts + +I’m looking forward to trying out the new Void Linux-based Project Trident. I have installed and used Void Linux in the past. I have also tried out [TrueOS][9] (the precursor of Project Trident). However, I could never get Project Trident to work on my laptop. + +When I was using Void Linux, I ran into two main issues: installing a desktop environment was a pain and the GUI package manager wasn’t that great. Project Trident plans to address these issues. Their original goal was to find an operating system that didn’t come with a desktop environment as default and their distro would add desktop support out-of-the-box. They won’t be able to port the AppCafe package manager to Void because it is a part of TrueOS’ SysAdm utility. They do plan to “develop a new graphical front-end to the XBPS package manager for Void Linux”. + +Interestingly, Void Linux was created by a former NetBSD developer. I asked Ken if that fact influenced their decision. He said, “Actually none! I liked the way that Void Linux was set up and that most/all of the utilities were either MIT or BSD licensed, but I never guessed that it was created by a former NetBSD developer. That definitely helps to explain why Void Linux “feels” more comfortable to me since I have been using FreeBSD exclusively for the last 7 or more years.” + +I’ve seen some people on the web speaking disparagingly of the move to Void Linux. They mentioned that the name changes (from PC-BSD to TrueOS to Project Trident) and the changes in architecture (from FreeBSD to TrueOS/FreeBSD to Void Linux) show that the developers don’t know what they are doing. On the other hand, I believe that Project Trident has finally found its niche where it will be able to grow and blossom. I will be watching the future of Project Trident with much anticipation. You will probably be reading a review of the new version when it is released. + +Have you ever used Project Trident? What is your favorite BSD? 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][10]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bsd-project-trident-linux/ + +作者:[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://project-trident.org/post/train_changes/ +[2]: https://project-trident.org/post/os_migration/ +[3]: https://t.me/ProjectTrident +[4]: https://github.com/beanpole135 +[5]: https://lumina-desktop.org/ +[6]: https://itsfoss.com/project-trident-interview/ +[7]: https://voidlinux.org/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/bsd-linux.jpg?resize=800%2C450&ssl=1 +[9]: https://itsfoss.com/trueos-bsd-review/ +[10]: https://reddit.com/r/linuxusersgroup From b4de29153f86543dd2065f0b926e31b582d32cea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 20 Oct 2019 00:55:16 +0800 Subject: [PATCH 057/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191019=20To=20s?= =?UTF-8?q?pace=20and=20beyond=20with=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191019 To space and beyond with open source.md --- ...19 To space and beyond with open source.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20191019 To space and beyond with open source.md diff --git a/sources/tech/20191019 To space and beyond with open source.md b/sources/tech/20191019 To space and beyond with open source.md new file mode 100644 index 0000000000..8bbb552e15 --- /dev/null +++ b/sources/tech/20191019 To space and beyond with open source.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (To space and beyond with open source) +[#]: via: (https://opensource.com/article/19/10/open-source-space-exploration) +[#]: author: (Jaouhari Youssef https://opensource.com/users/jaouhari) + +To space and beyond with open source +====== +Open source projects are helping to satisfy our curiosity about what +lies far beyond Earth's atmosphere. +![Person looking up at the stars][1] + +Carl Sagan once said, "The universe is a pretty big place. If it's just us, seems like an awful waste of space." In that vast desert of seeming nothingness hides some of the most mysterious and beautiful creations humankind ever has—or ever will—witness. + +Our ancient ancestors looked up into the night sky and dreamed about space, just as we do today. Starting with simple, naked-eye observations of the sky and progressing to create [space telescopes][2] that uncover far reaches of the universe, we've come a long way toward understanding and redefining the concepts of time, space, and matter. Our exploration has provided some answers to humanity's enduring questions about the existence of extraterrestrial life, about the finite or infinite nature and origin of the universe, and so much more. And we still have so much to discover. + +### Curiosity, a crucial component for space exploration + +The Cambridge Dictionary defines [curiosity][3] as "an eager wish to know or learn about something." It's curiosity that fuels our drive to acquire knowledge about outer space, but what drives our curiosity, our "eager wish," in the first place? + +I believe that our curiosity is driven by the desire to escape the unpleasant feeling of uncertainty that is triggered by acknowledging our lack of knowledge. The intrinsic reward that comes from escaping uncertainty pushes us to find a correct (or at least a less wrong) answer to whatever question is at hand. + +If we want space discovery to advance at a faster pace, we need more people to become aware of the rewards that are waiting for them when they make the effort and discover answers for their questions about the universe. Space discovery is admittedly not an easy task, because finding correct answers requires following rigorous methods on a long-term scale. + +Luckily, open source initiatives are emerging that make it easier for people to get started exploring and enjoying the beauty of outer space. + +### Two open source initiatives for space discovery + +#### OpenSpace Project + +One of the most beautiful tools for exploring space is [OpenSpace][4], an open source visualization tool of the entire known universe. It is an incredible way to visualize the environment of other planets, such as Mars and Jupiter, galaxies, and more. + +![The Moon visualized by the OpenSpace project][5] + +To enjoy a smooth experience from the OpenSpace simulation (e.g., a minimum 30fps), you need a powerful GPU; check the [GitHub repository][6] for more information. + +#### Libre Space Foundation + +The [Libre Space Foundation][7]'s mission is "to promote, advance, and develop libre (free and open source) technologies and knowledge for space." Among other things, the project is working to create an open source network of satellite ground stations that can communicate with satellites, spaceships, and space stations. It also supports the [UPSat project][8], which aspires to be the first completely open source satellite launched. + +### Advancing the human species + +I believe that the efforts made by these open source initiatives are contributing to the advancement of the human species in space. By increasing our interest in space, we are creating opportunities to upgrade our civilization's technological level, moving further up on the [Kardashev scale][9] and possibly becoming a multi-planetary species. Maybe one day, we will build a [Dyson sphere][10] around the sun to capture energy emissions, thereby harnessing an energy resource that exceeds any found on Earth and opening up a whole new world of possibilities. + +### Satisfy your curiosity + +Our solar system is only a tiny dot swimming in a universe of gems, and the outer space environment has never stopped amazing and intriguing us. + +If your curiosity is piqued and you want to learn more about outer space, check out [Kurzgesagt's][11] YouTube videos, which cover topics ranging from the origin of the universe to the strangest stars in a beautiful and concise manner. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/open-source-space-exploration + +作者:[Jaouhari Youssef][a] +选题:[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/jaouhari +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmos_person.jpg?itok=XUtz_LyY (Person looking up at the stars) +[2]: https://en.wikipedia.org/wiki/List_of_space_telescopes +[3]: https://dictionary.cambridge.org/us/dictionary/english/curiosity +[4]: https://www.openspaceproject.com/ +[5]: https://opensource.com/sites/default/files/uploads/moon.png (The Moon visualized by the OpenSpace project) +[6]: https://github.com/OpenSpace/OpenSpace +[7]: https://libre.space/ +[8]: https://upsat.gr/ +[9]: https://en.wikipedia.org/wiki/Kardashev_scale +[10]: https://en.wikipedia.org/wiki/Dyson_sphere +[11]: https://kurzgesagt.org/ From 3fb162fd6b70fb2e20f2009a549c1c48c6786218 Mon Sep 17 00:00:00 2001 From: way-ww <40491614+way-ww@users.noreply.github.com> Date: Sun, 20 Oct 2019 14:28:14 +0800 Subject: [PATCH 058/800] Delete 20191003 How to Run the Top Command in Batch Mode.md --- ...ow to Run the Top Command in Batch Mode.md | 335 ------------------ 1 file changed, 335 deletions(-) delete mode 100644 sources/tech/20191003 How to Run the Top Command in Batch Mode.md diff --git a/sources/tech/20191003 How to Run the Top Command in Batch Mode.md b/sources/tech/20191003 How to Run the Top Command in Batch Mode.md deleted file mode 100644 index 4516e08387..0000000000 --- a/sources/tech/20191003 How to Run the Top Command in Batch Mode.md +++ /dev/null @@ -1,335 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (way-ww) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Run the Top Command in Batch Mode) -[#]: via: (https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -How to Run the Top Command in Batch Mode -====== - -The **[Linux Top command][1]** is the best and most well known command that everyone uses to **[monitor Linux system performance][2]**. - -You probably already know most of the options available, except for a few options, and if I’m not wrong, “batch more” is one of the options. - -Most script writer and developers know this because this option is mainly used when writing the script. - -If you’re not sure about this, don’t worry we’re here to explain this. - -### What is “Batch Mode” in the Top Command - -The “Batch Mode” option allows you to send top command output to other programs or to a file. - -In this mode, top will not accept input and runs until the iterations limit you’ve set with the “-n” command-line option. - -If you want to fix any performance issues on the Linux server, you need to **[understand the top command output][3]** correctly. - -### 1) How to Run the Top Command in Batch Mode - -By default, the top command sort the results based on CPU usage, so when you run the below top command in batch mode, it does the same and prints the first 35 lines. - -``` -# top -bc | head -35 - -top - 06:41:14 up 8 days, 20:24, 1 user, load average: 0.87, 0.77, 0.81 -Tasks: 139 total, 1 running, 136 sleeping, 0 stopped, 2 zombie -%Cpu(s): 0.0 us, 3.2 sy, 0.0 ni, 96.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -KiB Mem : 3880940 total, 1595932 free, 886736 used, 1398272 buff/cache -KiB Swap: 1048572 total, 514640 free, 533932 used. 2648472 avail Mem - -PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND - 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.63 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 - 2 root 20 0 0 0 0 S 0.0 0.0 0:00.32 [kthreadd] - 3 root 20 0 0 0 0 S 0.0 0.0 0:28.10 [ksoftirqd/0] - 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H] - 7 root rt 0 0 0 0 S 0.0 0.0 0:33.96 [migration/0] - 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [rcu_bh] - 9 root 20 0 0 0 0 S 0.0 0.0 63:05.12 [rcu_sched] - 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [lru-add-drain] - 11 root rt 0 0 0 0 S 0.0 0.0 0:08.79 [watchdog/0] - 12 root rt 0 0 0 0 S 0.0 0.0 0:08.82 [watchdog/1] - 13 root rt 0 0 0 0 S 0.0 0.0 0:44.27 [migration/1] - 14 root 20 0 0 0 0 S 0.0 0.0 1:22.45 [ksoftirqd/1] - 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/1:0H] - 18 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [kdevtmpfs] - 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [netns] - 20 root 20 0 0 0 0 S 0.0 0.0 0:01.35 [khungtaskd] - 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.02 [writeback] - 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kintegrityd] - 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] - 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kblockd] - 25 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [md] - 26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [edac-poller] - 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] - 34 root 25 5 0 0 0 S 0.0 0.0 0:00.00 [ksmd] - 35 root 39 19 0 0 0 S 0.0 0.0 0:12.80 [khugepaged] - 36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [crypto] - 44 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kthrotld] - 46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kmpath_rdacd] -``` - -### 2) How to Run the Top Command in Batch Mode and Sort the Output Based on Memory Usage - -Run the below top command to sort the results based on memory usage in batch mode. - -``` -# top -bc -o +%MEM | head -n 20 - -top - 06:42:00 up 8 days, 20:25, 1 user, load average: 0.66, 0.74, 0.80 -Tasks: 146 total, 1 running, 145 sleeping, 0 stopped, 0 zombie -%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -KiB Mem : 3880940 total, 1422044 free, 1059176 used, 1399720 buff/cache -KiB Swap: 1048572 total, 514640 free, 533932 used. 2475984 avail Mem - - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND - 18105 mysql 20 0 1453900 156096 8816 S 0.0 4.0 2:12.98 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid - 1841 root 20 0 228980 107036 5360 S 0.0 2.8 0:05.56 /usr/local/cpanel/3rdparty/perl/528/bin/perl -T -w /usr/local/cpanel/3rdparty/bin/spamd --max-children=3 --max-spare=1 --allowed-ips=127.0.0.+ - 4301 root 20 0 230208 104608 1816 S 0.0 2.7 0:03.77 spamd child - 8139 nobody 20 0 257000 27108 3408 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start - 7961 nobody 20 0 256988 26912 3160 S 0.0 0.7 0:00.05 /usr/sbin/httpd -k start - 8190 nobody 20 0 256976 26812 3140 S 0.0 0.7 0:00.05 /usr/sbin/httpd -k start - 8353 nobody 20 0 256976 26812 3144 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start - 8629 nobody 20 0 256856 26736 3108 S 0.0 0.7 0:00.02 /usr/sbin/httpd -k start - 8636 nobody 20 0 256856 26712 3100 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start - 8611 nobody 20 0 256844 25764 2228 S 0.0 0.7 0:00.01 /usr/sbin/httpd -k start - 8451 nobody 20 0 256844 25760 2220 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start - 8610 nobody 20 0 256844 25748 2224 S 0.0 0.7 0:00.01 /usr/sbin/httpd -k start - 8632 nobody 20 0 256844 25744 2216 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start -``` - -**Details of the above command:** - - * **-b :** Batch mode operation - * **-c :** To print the absolute path of the running process - * **-o :** To specify fields for sorting processes - * **head :** Output the first part of files - * **-n :** To print the first “n” lines - - - -### 3) How to Run the Top Command in Batch Mode and Sort the Output Based on a Specific User Process - -If you want to sort results based on a specific user, run the below top command. - -``` -# top -bc -u mysql | head -n 10 - -top - 06:44:58 up 8 days, 20:27, 1 user, load average: 0.99, 0.87, 0.84 -Tasks: 140 total, 1 running, 137 sleeping, 0 stopped, 2 zombie -%Cpu(s): 13.3 us, 3.3 sy, 0.0 ni, 83.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -KiB Mem : 3880940 total, 1589832 free, 885648 used, 1405460 buff/cache -KiB Swap: 1048572 total, 514640 free, 533932 used. 2649412 avail Mem - - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND - 18105 mysql 20 0 1453900 156888 8816 S 0.0 4.0 2:16.42 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid -``` - -### 4) How to Run the Top Command in Batch Mode and Sort the Output Based on the Process Age - -Use the below top command to sort the results based on the age of the process in batch mode. It shows the total CPU time the task has used since it started. - -But if you want to check how long a process has been running on Linux, go to the following article. - - * **[Five Ways to Check How Long a Process Has Been Running in Linux][4]** - - - -``` -# top -bc -o TIME+ | head -n 20 - -top - 06:45:56 up 8 days, 20:28, 1 user, load average: 0.56, 0.77, 0.81 -Tasks: 148 total, 1 running, 146 sleeping, 0 stopped, 1 zombie -%Cpu(s): 0.0 us, 3.1 sy, 0.0 ni, 96.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -KiB Mem : 3880940 total, 1378664 free, 1094876 used, 1407400 buff/cache -KiB Swap: 1048572 total, 514640 free, 533932 used. 2440332 avail Mem - - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND - 9 root 20 0 0 0 0 S 0.0 0.0 63:05.70 [rcu_sched] - 272 root 20 0 0 0 0 S 0.0 0.0 16:12.13 [xfsaild/vda1] - 3882 root 20 0 229832 6212 1220 S 0.0 0.2 9:00.84 /usr/sbin/httpd -k start - 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.75 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 - 3761 root 20 0 68784 9820 2048 S 0.0 0.3 5:09.67 tailwatchd - 3529 root 20 0 404380 3472 2604 S 0.0 0.1 3:24.98 /usr/sbin/rsyslogd -n - 3520 root 20 0 574208 572 164 S 0.0 0.0 3:07.74 /usr/bin/python2 -Es /usr/sbin/tuned -l -P - 444 dbus 20 0 58444 1144 612 S 0.0 0.0 2:23.90 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation - 18105 mysql 20 0 1453900 157152 8816 S 0.0 4.0 2:17.29 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid - 249 root 0 -20 0 0 0 S 0.0 0.0 1:28.83 [kworker/0:1H] - 14 root 20 0 0 0 0 S 0.0 0.0 1:22.46 [ksoftirqd/1] - 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] - 342 root 20 0 39472 2940 2752 S 0.0 0.1 1:18.17 /usr/lib/systemd/systemd-journald -``` - -### 5) How to Run the Top Command in Batch Mode and Save the Output to a File - -If you want to share the output of the top command to someone for troubleshooting purposes, redirect the output to a file using the following command. - -``` -# top -bc | head -35 > top-report.txt - -# cat top-report.txt - -top - 06:47:11 up 8 days, 20:30, 1 user, load average: 0.67, 0.77, 0.81 -Tasks: 133 total, 4 running, 129 sleeping, 0 stopped, 0 zombie -%Cpu(s): 59.4 us, 12.5 sy, 0.0 ni, 28.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st -KiB Mem : 3880940 total, 1596268 free, 843284 used, 1441388 buff/cache -KiB Swap: 1048572 total, 514640 free, 533932 used. 2659084 avail Mem - - PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND - 9686 daygeekc 20 0 406132 62184 43448 R 94.1 1.6 0:00.34 /opt/cpanel/ea-php56/root/usr/bin/php-cgi - 9689 nobody 20 0 256588 24428 1184 S 5.9 0.6 0:00.01 /usr/sbin/httpd -k start - 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.79 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 - 2 root 20 0 0 0 0 S 0.0 0.0 0:00.32 [kthreadd] - 3 root 20 0 0 0 0 S 0.0 0.0 0:28.11 [ksoftirqd/0] - 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H] - 7 root rt 0 0 0 0 S 0.0 0.0 0:33.96 [migration/0] - 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [rcu_bh] - 9 root 20 0 0 0 0 R 0.0 0.0 63:05.82 [rcu_sched] - 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [lru-add-drain] - 11 root rt 0 0 0 0 S 0.0 0.0 0:08.79 [watchdog/0] - 12 root rt 0 0 0 0 S 0.0 0.0 0:08.82 [watchdog/1] - 13 root rt 0 0 0 0 S 0.0 0.0 0:44.28 [migration/1] - 14 root 20 0 0 0 0 S 0.0 0.0 1:22.46 [ksoftirqd/1] - 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/1:0H] - 18 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [kdevtmpfs] - 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [netns] - 20 root 20 0 0 0 0 S 0.0 0.0 0:01.35 [khungtaskd] - 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.02 [writeback] - 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kintegrityd] - 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] - 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kblockd] - 25 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [md] - 26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [edac-poller] - 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] - 34 root 25 5 0 0 0 S 0.0 0.0 0:00.00 [ksmd] - 35 root 39 19 0 0 0 S 0.0 0.0 0:12.80 [khugepaged] - 36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [crypto] -``` - -### How to Sort Output Based on Specific Fields - -In the latest version of the top command release, press the **“f”** key to sort the fields via the field letter. - -To sort with a new field, use the **“up/down”** arrow to select the correct selection, and then press **“s”** to sort it. Finally press **“q”** to exit from this window. - -``` -Fields Management for window 1:Def, whose current sort field is %CPU - Navigate with Up/Dn, Right selects for move then or Left commits, - 'd' or toggles display, 's' sets sort. Use 'q' or to end! - PID = Process Id nsUTS = UTS namespace Inode - USER = Effective User Name LXC = LXC container name - PR = Priority RSan = RES Anonymous (KiB) - NI = Nice Value RSfd = RES File-based (KiB) - VIRT = Virtual Image (KiB) RSlk = RES Locked (KiB) - RES = Resident Size (KiB) RSsh = RES Shared (KiB) - SHR = Shared Memory (KiB) CGNAME = Control Group name - S = Process Status NU = Last Used NUMA node - %CPU = CPU Usage - %MEM = Memory Usage (RES) - TIME+ = CPU Time, hundredths - COMMAND = Command Name/Line - PPID = Parent Process pid - UID = Effective User Id - RUID = Real User Id - RUSER = Real User Name - SUID = Saved User Id - SUSER = Saved User Name - GID = Group Id - GROUP = Group Name - PGRP = Process Group Id - TTY = Controlling Tty - TPGID = Tty Process Grp Id - SID = Session Id - nTH = Number of Threads - P = Last Used Cpu (SMP) - TIME = CPU Time - SWAP = Swapped Size (KiB) - CODE = Code Size (KiB) - DATA = Data+Stack (KiB) - nMaj = Major Page Faults - nMin = Minor Page Faults - nDRT = Dirty Pages Count - WCHAN = Sleeping in Function - Flags = Task Flags - CGROUPS = Control Groups - SUPGIDS = Supp Groups IDs - SUPGRPS = Supp Groups Names - TGID = Thread Group Id - OOMa = OOMEM Adjustment - OOMs = OOMEM Score current - ENVIRON = Environment vars - vMj = Major Faults delta - vMn = Minor Faults delta - USED = Res+Swap Size (KiB) - nsIPC = IPC namespace Inode - nsMNT = MNT namespace Inode - nsNET = NET namespace Inode - nsPID = PID namespace Inode - nsUSER = USER namespace Inode -``` - -For older version of the top command, press the **“shift+f”** or **“shift+o”** key to sort the fields via the field letter. - -To sort with a new field, select the corresponding sort **field letter**, and then press **“Enter”** to sort it. - -``` -Current Sort Field: N for window 1:Def - Select sort field via field letter, type any other key to return - a: PID = Process Id - b: PPID = Parent Process Pid - c: RUSER = Real user name - d: UID = User Id - e: USER = User Name - f: GROUP = Group Name - g: TTY = Controlling Tty - h: PR = Priority - i: NI = Nice value - j: P = Last used cpu (SMP) - k: %CPU = CPU usage - l: TIME = CPU Time - m: TIME+ = CPU Time, hundredths -* N: %MEM = Memory usage (RES) - o: VIRT = Virtual Image (kb) - p: SWAP = Swapped size (kb) - q: RES = Resident size (kb) - r: CODE = Code size (kb) - s: DATA = Data+Stack size (kb) - t: SHR = Shared Mem size (kb) - u: nFLT = Page Fault count - v: nDRT = Dirty Pages count - w: S = Process Status - x: COMMAND = Command name/line - y: WCHAN = Sleeping in Function - z: Flags = Task Flags - Note1: - If a selected sort field can't be - shown due to screen width or your - field order, the '<' and '>' keys - will be unavailable until a field - within viewable range is chosen. - Note2: - Field sorting uses internal values, - not those in column display. Thus, - the TTY & WCHAN fields will violate - strict ASCII collating sequence. - (shame on you if WCHAN is chosen) -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/ - -作者:[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/linux-top-command-linux-system-performance-monitoring-tool/ -[2]: https://www.2daygeek.com/category/system-monitoring/ -[3]: https://www.2daygeek.com/understanding-linux-top-command-output-usage/ -[4]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ From 7fb9665c9eb501290cdc833eaf3bf8b8ef8a5181 Mon Sep 17 00:00:00 2001 From: way-ww <40491614+way-ww@users.noreply.github.com> Date: Sun, 20 Oct 2019 14:31:35 +0800 Subject: [PATCH 059/800] Create 20191003 How to Run the Top Command in Batch Mode.md --- ...ow to Run the Top Command in Batch Mode.md | 335 ++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 translated/tech/20191003 How to Run the Top Command in Batch Mode.md diff --git a/translated/tech/20191003 How to Run the Top Command in Batch Mode.md b/translated/tech/20191003 How to Run the Top Command in Batch Mode.md new file mode 100644 index 0000000000..7c575c5bb7 --- /dev/null +++ b/translated/tech/20191003 How to Run the Top Command in Batch Mode.md @@ -0,0 +1,335 @@ +[#]: collector: "lujun9972" +[#]: translator: "way-ww" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How to Run the Top Command in Batch Mode" +[#]: via: "https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/" +[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" + +如何在批处理模式下运行 Top 命令 +====== + +**[Top 命令][1]** 是每个人都在使用的用于 **[监控 Linux 系统性能][2]** 的最好的命令。 + +除了很少的几个操作, 你可能已经知道 top 命令的绝大部分操作, 如果我没错的话, 批处理模式就是其中之一。 + +大部分的脚本编写者和开发人员都知道这个, 因为这个操作主要就是用来编写脚本。 + +如果你不了解这个, 不用担心,我们将在这里介绍它。 + +### 什么是 Top 命令的批处理模式 + +批处理模式允许你将 top 命令的输出发送至其他程序或者文件中。 + +在这个模式中, top 命令将不会接收输入并且持续运行直到迭代次数达到你用 “-n” 选项指定的次数为止。 + +如果你想解决 Linux 服务器上的任何性能问题, 你需要正确的 **[理解 top 命令的输出][3]** 。 + +### 1) 如何在批处理模式下运行 top 命令 + +默认地, top 命令按照 CPU 的使用率来排序输出结果, 所以当你在批处理模式中运行以下命令时, 它会执行同样的操作并打印前 35 行。 + +``` +# top -bc | head -35 + +top - 06:41:14 up 8 days, 20:24, 1 user, load average: 0.87, 0.77, 0.81 +Tasks: 139 total, 1 running, 136 sleeping, 0 stopped, 2 zombie +%Cpu(s): 0.0 us, 3.2 sy, 0.0 ni, 96.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1595932 free, 886736 used, 1398272 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2648472 avail Mem + +PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.63 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.32 [kthreadd] + 3 root 20 0 0 0 0 S 0.0 0.0 0:28.10 [ksoftirqd/0] + 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H] + 7 root rt 0 0 0 0 S 0.0 0.0 0:33.96 [migration/0] + 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [rcu_bh] + 9 root 20 0 0 0 0 S 0.0 0.0 63:05.12 [rcu_sched] + 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [lru-add-drain] + 11 root rt 0 0 0 0 S 0.0 0.0 0:08.79 [watchdog/0] + 12 root rt 0 0 0 0 S 0.0 0.0 0:08.82 [watchdog/1] + 13 root rt 0 0 0 0 S 0.0 0.0 0:44.27 [migration/1] + 14 root 20 0 0 0 0 S 0.0 0.0 1:22.45 [ksoftirqd/1] + 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/1:0H] + 18 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [kdevtmpfs] + 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [netns] + 20 root 20 0 0 0 0 S 0.0 0.0 0:01.35 [khungtaskd] + 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.02 [writeback] + 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kintegrityd] + 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] + 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kblockd] + 25 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [md] + 26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [edac-poller] + 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] + 34 root 25 5 0 0 0 S 0.0 0.0 0:00.00 [ksmd] + 35 root 39 19 0 0 0 S 0.0 0.0 0:12.80 [khugepaged] + 36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [crypto] + 44 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kthrotld] + 46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kmpath_rdacd] +``` + +### 2) 如何在批处理模式下运行 top 命令并按内存使用率排序结果 + +在批处理模式中运行以下命令按内存使用率对结果进行排序 + +``` +# top -bc -o +%MEM | head -n 20 + +top - 06:42:00 up 8 days, 20:25, 1 user, load average: 0.66, 0.74, 0.80 +Tasks: 146 total, 1 running, 145 sleeping, 0 stopped, 0 zombie +%Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1422044 free, 1059176 used, 1399720 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2475984 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 18105 mysql 20 0 1453900 156096 8816 S 0.0 4.0 2:12.98 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid + 1841 root 20 0 228980 107036 5360 S 0.0 2.8 0:05.56 /usr/local/cpanel/3rdparty/perl/528/bin/perl -T -w /usr/local/cpanel/3rdparty/bin/spamd --max-children=3 --max-spare=1 --allowed-ips=127.0.0.+ + 4301 root 20 0 230208 104608 1816 S 0.0 2.7 0:03.77 spamd child + 8139 nobody 20 0 257000 27108 3408 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start + 7961 nobody 20 0 256988 26912 3160 S 0.0 0.7 0:00.05 /usr/sbin/httpd -k start + 8190 nobody 20 0 256976 26812 3140 S 0.0 0.7 0:00.05 /usr/sbin/httpd -k start + 8353 nobody 20 0 256976 26812 3144 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start + 8629 nobody 20 0 256856 26736 3108 S 0.0 0.7 0:00.02 /usr/sbin/httpd -k start + 8636 nobody 20 0 256856 26712 3100 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start + 8611 nobody 20 0 256844 25764 2228 S 0.0 0.7 0:00.01 /usr/sbin/httpd -k start + 8451 nobody 20 0 256844 25760 2220 S 0.0 0.7 0:00.04 /usr/sbin/httpd -k start + 8610 nobody 20 0 256844 25748 2224 S 0.0 0.7 0:00.01 /usr/sbin/httpd -k start + 8632 nobody 20 0 256844 25744 2216 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start +``` + +**上面命令的详细信息:** + + * **-b :** 批处理模式选项 + * **-c :** 打印运行中的进程的绝对路径 + * **-o :** 指定进行排序的字段 + * **head :** 输出文件的第一部分 + * **-n :** 打印前 n 行 + + + +### 3) 如何在批处理模式下运行 top 命令并按照指定的用户进程对结果进行排序 + +如果你想要按照指定用户进程对结果进行排序请运行以下命令 + +``` +# top -bc -u mysql | head -n 10 + +top - 06:44:58 up 8 days, 20:27, 1 user, load average: 0.99, 0.87, 0.84 +Tasks: 140 total, 1 running, 137 sleeping, 0 stopped, 2 zombie +%Cpu(s): 13.3 us, 3.3 sy, 0.0 ni, 83.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1589832 free, 885648 used, 1405460 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2649412 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 18105 mysql 20 0 1453900 156888 8816 S 0.0 4.0 2:16.42 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid +``` + +### 4) 如何在批处理模式下运行 top 命令并按照处理时间进行排序 + +在批处理模式中使用以下 top 命令按照处理时间对结果进行排序。 这展示了任务从启动以来已使用的总 CPU 时间 + +但是如果你想要检查一个进程在 Linux 上运行了多长时间请看接下来的文章。 + + * **[检查 Linux 中进程运行时间的五种方法][4]** + + + +``` +# top -bc -o TIME+ | head -n 20 + +top - 06:45:56 up 8 days, 20:28, 1 user, load average: 0.56, 0.77, 0.81 +Tasks: 148 total, 1 running, 146 sleeping, 0 stopped, 1 zombie +%Cpu(s): 0.0 us, 3.1 sy, 0.0 ni, 96.9 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1378664 free, 1094876 used, 1407400 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2440332 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 9 root 20 0 0 0 0 S 0.0 0.0 63:05.70 [rcu_sched] + 272 root 20 0 0 0 0 S 0.0 0.0 16:12.13 [xfsaild/vda1] + 3882 root 20 0 229832 6212 1220 S 0.0 0.2 9:00.84 /usr/sbin/httpd -k start + 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.75 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 + 3761 root 20 0 68784 9820 2048 S 0.0 0.3 5:09.67 tailwatchd + 3529 root 20 0 404380 3472 2604 S 0.0 0.1 3:24.98 /usr/sbin/rsyslogd -n + 3520 root 20 0 574208 572 164 S 0.0 0.0 3:07.74 /usr/bin/python2 -Es /usr/sbin/tuned -l -P + 444 dbus 20 0 58444 1144 612 S 0.0 0.0 2:23.90 /usr/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation + 18105 mysql 20 0 1453900 157152 8816 S 0.0 4.0 2:17.29 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid + 249 root 0 -20 0 0 0 S 0.0 0.0 1:28.83 [kworker/0:1H] + 14 root 20 0 0 0 0 S 0.0 0.0 1:22.46 [ksoftirqd/1] + 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] + 342 root 20 0 39472 2940 2752 S 0.0 0.1 1:18.17 /usr/lib/systemd/systemd-journald +``` + +### 5) 如何在批处理模式下运行 top 命令并将结果保存到文件中 + +如果出于解决问题的目的, 你想要和别人分享 top 命令的输出, 请使用以下命令重定向输出到文件中 + +``` +# top -bc | head -35 > top-report.txt + +# cat top-report.txt + +top - 06:47:11 up 8 days, 20:30, 1 user, load average: 0.67, 0.77, 0.81 +Tasks: 133 total, 4 running, 129 sleeping, 0 stopped, 0 zombie +%Cpu(s): 59.4 us, 12.5 sy, 0.0 ni, 28.1 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st +KiB Mem : 3880940 total, 1596268 free, 843284 used, 1441388 buff/cache +KiB Swap: 1048572 total, 514640 free, 533932 used. 2659084 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 9686 daygeekc 20 0 406132 62184 43448 R 94.1 1.6 0:00.34 /opt/cpanel/ea-php56/root/usr/bin/php-cgi + 9689 nobody 20 0 256588 24428 1184 S 5.9 0.6 0:00.01 /usr/sbin/httpd -k start + 1 root 20 0 191144 2800 1596 S 0.0 0.1 5:43.79 /usr/lib/systemd/systemd --switched-root --system --deserialize 22 + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.32 [kthreadd] + 3 root 20 0 0 0 0 S 0.0 0.0 0:28.11 [ksoftirqd/0] + 5 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/0:0H] + 7 root rt 0 0 0 0 S 0.0 0.0 0:33.96 [migration/0] + 8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 [rcu_bh] + 9 root 20 0 0 0 0 R 0.0 0.0 63:05.82 [rcu_sched] + 10 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [lru-add-drain] + 11 root rt 0 0 0 0 S 0.0 0.0 0:08.79 [watchdog/0] + 12 root rt 0 0 0 0 S 0.0 0.0 0:08.82 [watchdog/1] + 13 root rt 0 0 0 0 S 0.0 0.0 0:44.28 [migration/1] + 14 root 20 0 0 0 0 S 0.0 0.0 1:22.46 [ksoftirqd/1] + 16 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kworker/1:0H] + 18 root 20 0 0 0 0 S 0.0 0.0 0:00.01 [kdevtmpfs] + 19 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [netns] + 20 root 20 0 0 0 0 S 0.0 0.0 0:01.35 [khungtaskd] + 21 root 0 -20 0 0 0 S 0.0 0.0 0:00.02 [writeback] + 22 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kintegrityd] + 23 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [bioset] + 24 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kblockd] + 25 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [md] + 26 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [edac-poller] + 33 root 20 0 0 0 0 S 0.0 0.0 1:19.07 [kswapd0] + 34 root 25 5 0 0 0 S 0.0 0.0 0:00.00 [ksmd] + 35 root 39 19 0 0 0 S 0.0 0.0 0:12.80 [khugepaged] + 36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [crypto] +``` + +### 如何按照指定字段对结果进行排序 + +在 top 命令的最新版本中, 按下 **“f”** 键进入字段管理界面。 + +要使用新字段进行排序, 请使用 **“up/down”** 箭头选择正确的选项, 然后再按下 **“s”** 键进行排序。 最后按 **“q”** 键退出此窗口。 + +``` +Fields Management for window 1:Def, whose current sort field is %CPU + Navigate with Up/Dn, Right selects for move then or Left commits, + 'd' or toggles display, 's' sets sort. Use 'q' or to end! + PID = Process Id nsUTS = UTS namespace Inode + USER = Effective User Name LXC = LXC container name + PR = Priority RSan = RES Anonymous (KiB) + NI = Nice Value RSfd = RES File-based (KiB) + VIRT = Virtual Image (KiB) RSlk = RES Locked (KiB) + RES = Resident Size (KiB) RSsh = RES Shared (KiB) + SHR = Shared Memory (KiB) CGNAME = Control Group name + S = Process Status NU = Last Used NUMA node + %CPU = CPU Usage + %MEM = Memory Usage (RES) + TIME+ = CPU Time, hundredths + COMMAND = Command Name/Line + PPID = Parent Process pid + UID = Effective User Id + RUID = Real User Id + RUSER = Real User Name + SUID = Saved User Id + SUSER = Saved User Name + GID = Group Id + GROUP = Group Name + PGRP = Process Group Id + TTY = Controlling Tty + TPGID = Tty Process Grp Id + SID = Session Id + nTH = Number of Threads + P = Last Used Cpu (SMP) + TIME = CPU Time + SWAP = Swapped Size (KiB) + CODE = Code Size (KiB) + DATA = Data+Stack (KiB) + nMaj = Major Page Faults + nMin = Minor Page Faults + nDRT = Dirty Pages Count + WCHAN = Sleeping in Function + Flags = Task Flags + CGROUPS = Control Groups + SUPGIDS = Supp Groups IDs + SUPGRPS = Supp Groups Names + TGID = Thread Group Id + OOMa = OOMEM Adjustment + OOMs = OOMEM Score current + ENVIRON = Environment vars + vMj = Major Faults delta + vMn = Minor Faults delta + USED = Res+Swap Size (KiB) + nsIPC = IPC namespace Inode + nsMNT = MNT namespace Inode + nsNET = NET namespace Inode + nsPID = PID namespace Inode + nsUSER = USER namespace Inode +``` + +对 top 命令的旧版本, 请按 **“shift+f”** 或 **“shift+o”** 键进入字段管理界面进行排序。 + +要使用新字段进行排序, 请选择相应的排序字段字母, 然后按下 **“Enter”** 排序。 + +``` +Current Sort Field: N for window 1:Def + Select sort field via field letter, type any other key to return + a: PID = Process Id + b: PPID = Parent Process Pid + c: RUSER = Real user name + d: UID = User Id + e: USER = User Name + f: GROUP = Group Name + g: TTY = Controlling Tty + h: PR = Priority + i: NI = Nice value + j: P = Last used cpu (SMP) + k: %CPU = CPU usage + l: TIME = CPU Time + m: TIME+ = CPU Time, hundredths +* N: %MEM = Memory usage (RES) + o: VIRT = Virtual Image (kb) + p: SWAP = Swapped size (kb) + q: RES = Resident size (kb) + r: CODE = Code size (kb) + s: DATA = Data+Stack size (kb) + t: SHR = Shared Mem size (kb) + u: nFLT = Page Fault count + v: nDRT = Dirty Pages count + w: S = Process Status + x: COMMAND = Command name/line + y: WCHAN = Sleeping in Function + z: Flags = Task Flags + Note1: + If a selected sort field can't be + shown due to screen width or your + field order, the '<' and '>' keys + will be unavailable until a field + within viewable range is chosen. + Note2: + Field sorting uses internal values, + not those in column display. Thus, + the TTY & WCHAN fields will violate + strict ASCII collating sequence. + (shame on you if WCHAN is chosen) +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[way-ww](https://github.com/way-ww) +校对:[校对者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/linux-top-command-linux-system-performance-monitoring-tool/ +[2]: https://www.2daygeek.com/category/system-monitoring/ +[3]: https://www.2daygeek.com/understanding-linux-top-command-output-usage/ +[4]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ From 1156e68d0fd8630e4c26e4d17ad6ca5a81a10012 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Oct 2019 15:00:50 +0800 Subject: [PATCH 060/800] Rename sources/tech/20191019 To space and beyond with open source.md to sources/talk/20191019 To space and beyond with open source.md --- .../20191019 To space and beyond with open source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191019 To space and beyond with open source.md (100%) diff --git a/sources/tech/20191019 To space and beyond with open source.md b/sources/talk/20191019 To space and beyond with open source.md similarity index 100% rename from sources/tech/20191019 To space and beyond with open source.md rename to sources/talk/20191019 To space and beyond with open source.md From 0c9d729dd1c58d41da3b3765308ffba653c188ac Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 20 Oct 2019 15:01:48 +0800 Subject: [PATCH 061/800] Rename sources/tech/20191020 Project Trident Ditches BSD for Linux.md to sources/talk/20191020 Project Trident Ditches BSD for Linux.md --- .../20191020 Project Trident Ditches BSD for Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191020 Project Trident Ditches BSD for Linux.md (100%) diff --git a/sources/tech/20191020 Project Trident Ditches BSD for Linux.md b/sources/talk/20191020 Project Trident Ditches BSD for Linux.md similarity index 100% rename from sources/tech/20191020 Project Trident Ditches BSD for Linux.md rename to sources/talk/20191020 Project Trident Ditches BSD for Linux.md From f28882e52b3e79db450e7b5dca605ba771de99ad Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 20 Oct 2019 20:01:50 +0800 Subject: [PATCH 062/800] PRF @Morisun029 --- ...ing by example- How to leverage failure.md | 97 ++++++++----------- 1 file changed, 39 insertions(+), 58 deletions(-) diff --git a/translated/tech/20190923 Mutation testing by example- How to leverage failure.md b/translated/tech/20190923 Mutation testing by example- How to leverage failure.md index 115b7f05bf..66a9f9fcec 100644 --- a/translated/tech/20190923 Mutation testing by example- How to leverage failure.md +++ b/translated/tech/20190923 Mutation testing by example- How to leverage failure.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Mutation testing by example: How to leverage failure) @@ -9,69 +9,59 @@ 变异测试:如何利用故障? ====== -使用事先设计好的故障以确保你的代码达到预期的结果,并遵循 .NET xUnit.net 测试框架来进行测试。 -![failure sign at a party, celebrating failure][1] -[在变异测试是TDD的演变][2]一文中, 我谈到了迭代的力量。在可度量的测试中,迭代能够保证找到问题的解决方案。 在那篇文章中,我们讨论了迭代法帮助确定实现计算给定数字平方根的代码。 +> 使用事先设计好的故障以确保你的代码达到预期的结果,并遵循 .NET xUnit.net 测试框架来进行测试。 -我还演示了最有效的方法是找到可衡量的目标或测试,然后以最佳猜测值开始迭代。 正如所预期的,第一次测试通常会失败。因此,必须根据可衡量的目标或测试对失败的代码进行完善。 根据运行结果,对测试值进行验证或进一步加以完善。 -在此模型中,学习获得解决方案的唯一方法是反复失败。 这听起来有悖常理,但它确实有效。 +![](https://img.linux.net.cn/data/attachment/album/201910/20/200030ipm13zmi08mv8z34.jpg) -按照这种分析,本文探讨了在构建包含某些依赖项的解决方案时使用 DevOps 的最佳方法。 第一步是编写一个预期结果失败的用例。 +[在变异测试是 TDD 的演变][2] 一文中,我谈到了迭代的力量。在可度量的测试中,迭代能够保证找到问题的解决方案。在那篇文章中,我们讨论了迭代法帮助确定实现计算给定数字平方根的代码。 +我还演示了最有效的方法是找到可衡量的目标或测试,然后以最佳猜测值开始迭代。正如所预期的,第一次测试通常会失败。因此,必须根据可衡量的目标或测试对失败的代码进行完善。根据运行结果,对测试值进行验证或进一步加以完善。 + +在此模型中,学习获得解决方案的唯一方法是反复失败。这听起来有悖常理,但它确实有效。 + +按照这种分析,本文探讨了在构建包含某些依赖项的解决方案时使用 DevOps 的最佳方法。第一步是编写一个预期结果失败的用例。 ### 依赖性问题是你不能依赖它们 -正如迈克尔•尼加德(Michael Nygard)在_[Architecture without an end state][3]_,表达的那样,依赖问题是一个很大的话题,最好留到另一篇文章中讨论。 在这里,你将会看到依赖项给项目带来的一些潜在问题,以及 -如何利用测试驱动开发(TDD)来避免这些陷阱。 +正如迈克尔·尼加德Michael Nygard在《[没有终结状态的架构][3]》中机智的表示的那样,依赖问题是一个很大的话题,最好留到另一篇文章中讨论。在这里,你将会看到依赖项给项目带来的一些潜在问题,以及如何利用测试驱动开发(TDD)来避免这些陷阱。 -首先,找到现实生活中的一个挑战,然后看看如何使用TDD解决它。 +首先,找到现实生活中的一个挑战,然后看看如何使用 TDD 解决它。 -### 谁让猫出来? +### 谁把猫放出来? ![一只猫站在屋顶][4] +在敏捷开发环境中,通过定义期望结果开始构建解决方案会很有帮助。通常,在 [用户故事][5]user story 中描述期望结果: -在敏捷开发环境中,通过定义期望结果开始构建解决方案会很有帮助。 通常,在 [用户故事][5]中描述期望结果: - - ->我想使用我家的自动化系统(HAS)来控制猫何时可以出门,因为我想保证它在夜间的安全。 - +> 我想使用我的家庭自动化系统(HAS)来控制猫何时可以出门,因为我想保证它在夜间的安全。 现在你已经有了一个用户故事,你需要通过提供一些功能要求(即指定验收标准)来对其进行详细说明。 从伪代码中描述的最简单的场景开始: -> 场景1:在夜间关闭猫门 +> 场景 1:在夜间关闭猫门 > -> * 用时钟监测到晚上时间 +> * 用时钟监测到了晚上的时间 > * 时钟通知 HAS 系统 > * HAS 关闭支持物联网(IoT)的猫门 -> - ### 分解系统 +开始构建之前,你需要将正在构建的系统(HAS)进行分解(分解为依赖项)。你必须要做的第一件事是识别任何依赖项(如果幸运的话,你的系统没有依赖项,这将会更容易,但是,这样的系统可以说不是非常有用)。 -开始构建之前,你需要将正在构建的系统(HAS)进行分解(分解为依赖项)。 你必须要做的第一件事是识别任何依赖项(如果幸运的话,你的系统没有依赖项,这将会更容易,但是,这样的系统可以说不是非常有用)。 - -从上面的简单场景中,你可以看到所需的业务成果(自动控制猫门)取决于对夜间情况监测。 这种依赖性取决于时钟。 但是时钟是无法区分白天和夜晚的。 需要你来提供这种逻辑。 - -正在构建的系统中的另一个依赖项是能够自动访问猫门并启用或关闭它。 该依赖项很可能取决于具有 IoT 功能的猫门提供的API。 - +从上面的简单场景中,你可以看到所需的业务成果(自动控制猫门)取决于对夜间情况监测。这种依赖性取决于时钟。但是时钟是无法区分白天和夜晚的。需要你来提供这种逻辑。 +正在构建的系统中的另一个依赖项是能够自动访问猫门并启用或关闭它。该依赖项很可能取决于具有 IoT 功能的猫门提供的 API。 ### 依赖管理面临快速失败 -为了满足一个依赖项,我们将构建确定当前时间是白天还是晚上的逻辑。 本着TDD的精神,我们将从一个小小的失败开始。 +为了满足依赖项,我们将构建确定当前时间是白天还是晚上的逻辑。本着 TDD 的精神,我们将从一个小小的失败开始。 +有关如何设置此练习所需的开发环境和脚手架的详细说明,请参阅我的[上一篇文章][2]。我们将重用相同的 NET 环境和 [xUnit.net][6] 框架。 -有关如何设置此练习所需的开发环境和脚手架的详细说明,请参阅我的[上一篇文章][2]。 我们将重用相同的 NET 环境和 [xUnit.net][6] 框架。 - - -接下来,创建一个名为 HAS(“家庭自动化系统”)的新项目,创建一个名为**UnitTest1.cs**的文件。 在该文件中,编写第一个失败的单元测试。 在此单元测试中,描述你的期望结果。 例如,当系统运行时,如果时间是晚上7点,负责确定是白天还是夜晚的组件将返回值“ Nighttime”。 +接下来,创建一个名为 HAS(“家庭自动化系统”)的新项目,创建一个名为 `UnitTest1.cs` 的文件。在该文件中,编写第一个失败的单元测试。在此单元测试中,描述你的期望结果。例如,当系统运行时,如果时间是晚上 7 点,负责确定是白天还是夜晚的组件将返回值 `Nighttime`。 这是描述期望值的单元测试: - ``` using System; using Xunit; @@ -80,7 +70,7 @@ namespace unittest { public class UnitTest1 { - DayOrNightUtility dayOrNightUtility = [new][7] DayOrNightUtility(); + DayOrNightUtility dayOrNightUtility = new DayOrNightUtility(); [Fact] public void Given7pmReturnNighttime() @@ -93,19 +83,15 @@ namespace unittest } ``` +至此,你可能已经熟悉了单元测试的结构。快速复习一下:在此示例中,通过给单元测试一个描述性名称`Given7pmReturnNighttime` 来描述期望结果。然后,在单元测试的主体中,创建一个名为 `expected` 的变量,并为该变量指定期望值(在该示例中,值为 `Nighttime`)。然后,为实际值指定一个 `actual`(在组件或服务处理一天中的时间之后可用)。 -至此,你可能已经熟悉了单元测试的结构。 快速复习:在此示例中,通过给单元测试一个描述性名称**Given7pmReturnNighttime** 来描述期望结果。 然后,在单元测试的主体中,创建一个名为**expected** 的变量,并为该变量指定期望值(在该示例中,值为“ Nighttime”)。 然后,为实际变量指定一个 **actual**(在组件或服务处理一天中的时间之后可用)。 +最后,通过断言期望值和实际值是否相等来检查是否满足期望结果:`Assert.Equal(expected, actual)`。 -最后,通过断言期望值和实际值是否相等来检查是否满足期望结果:**Assert.Equal(expected, actual)**。 +你还可以在上面的列表中看到名为 `dayOrNightUtility` 的组件或服务。该模块能够接收消息`GetDayOrNight`,并且返回 `string` 类型的值。 +同样,本着 TDD 的精神,描述的组件或服务还尚未构建(仅为了后面说明在此进行描述)。构建这些是由所描述的期望结果来驱动的。 -你还可以在上面的列表中看到名为**dayOrNightUtility** 的组件或服务。 该模块能够接收消息**GetDayOrNight**,并且返回**string** 类型的值。 - - -同样,本着TDD的精神,描述的组件或服务还尚未构建(仅为了后面说明在此进行描述)。 构建这些是由所描述的期望结果来驱动的。 - -在 **app** 文件夹中创建一个新文件,并将其命名为**DayOrNightUtility.cs**。 将以下 C# 代码添加到该文件中并保存: - +在 `app` 文件夹中创建一个新文件,并将其命名为 `DayOrNightUtility.cs`。将以下 C# 代码添加到该文件中并保存: ``` using System; @@ -120,8 +106,7 @@ namespace app { } ``` - -现在转到命令行,将目录更改为**unittests**文件夹,然后运行: +现在转到命令行,将目录更改为 `unittests` 文件夹,然后运行: ``` [Xunit.net 00:00:02.33] unittest.UnitTest1.Given7pmReturnNighttime [FAIL] @@ -129,12 +114,11 @@ Failed unittest.UnitTest1.Given7pmReturnNighttime [...] ``` -恭喜,你已经完成了第一个失败的单元测试。 单元测试的期望结果是**DayOrNightUtility**方法返回字符串“ Nighttime”,但相反,它返回是“ Undetermined”。 +恭喜,你已经完成了第一个失败的单元测试。单元测试的期望结果是 `DayOrNightUtility` 方法返回字符串 `Nighttime`,但相反,它返回是 `Undetermined`。 ### 修复失败的单元测试 - -修复失败的测试的一种快速而粗略的方法是将值“ Undetermined”替换为值“ Nighttime”并保存更改: +修复失败的测试的一种快速而粗略的方法是将值 `Undetermined` 替换为值 `Nighttime` 并保存更改: ``` using System; @@ -149,7 +133,7 @@ namespace app { } ``` -现在运行时,成功了。 +现在运行,成功了。 ``` Starting test execution, please wait... @@ -159,27 +143,24 @@ Test Run Successful. Test execution time: 2.6470 Seconds ``` -但是,对值进行硬编码基本上是在作弊,最好为**DayOrNightUtility** 方法赋予一些智能。 修改**GetDayOrNight**方法以包括一些时间计算逻辑: - +但是,对值进行硬编码基本上是在作弊,最好为 `DayOrNightUtility` 方法赋予一些智能。修改 `GetDayOrNight` 方法以包括一些时间计算逻辑: ``` public string GetDayOrNight() { string dayOrNight = "Daylight"; DateTime time = new DateTime(); - if(time.Hour < 7) { + if(time.Hour < 7) { dayOrNight = "Nighttime"; } return dayOrNight; } ``` - -该方法现在从系统获取当前时间,并与 **Hour**比较,查看其是否小于上午7点。 如果小于,则处理逻辑将 **dayOrNight**字符串值从“ Daylight”转换为“ Nighttime”。 现在,单元测试通过。 - +该方法现在从系统获取当前时间,并与 `Hour` 比较,查看其是否小于上午 7 点。如果小于,则处理逻辑将 `dayOrNight` 字符串值从 `Daylight` 转换为 `Nighttime`。现在,单元测试通过。 ### 测试驱动解决方案的开始 -现在,我们已经开始了基本的单元测试,并为我们的时间依赖项提供了可行的解决方案。 后面还有更多的测试案例需要执行。 +现在,我们已经开始了基本的单元测试,并为我们的时间依赖项提供了可行的解决方案。后面还有更多的测试案例需要执行。 在下一篇文章中,我将演示如何对白天时间进行测试以及如何在整个过程中利用故障。 @@ -189,15 +170,15 @@ via: https://opensource.com/article/19/9/mutation-testing-example-tdd 作者:[Alex Bunardzic][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [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/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) -[2]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd +[2]: https://linux.cn/article-11468-1.html [3]: https://www.infoq.com/presentations/Architecture-Without-an-End-State/ [4]: https://opensource.com/sites/default/files/uploads/cat.png (Cat standing on a roof) [5]: https://www.agilealliance.org/glossary/user-stories From 6ba6361c013a8dbae5eb358ed9846fa565cba37f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 20 Oct 2019 20:02:26 +0800 Subject: [PATCH 063/800] PUB @Morisun029 https://linux.cn/article-11482-1.html --- ...23 Mutation testing by example- How to leverage failure.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190923 Mutation testing by example- How to leverage failure.md (99%) diff --git a/translated/tech/20190923 Mutation testing by example- How to leverage failure.md b/published/20190923 Mutation testing by example- How to leverage failure.md similarity index 99% rename from translated/tech/20190923 Mutation testing by example- How to leverage failure.md rename to published/20190923 Mutation testing by example- How to leverage failure.md index 66a9f9fcec..f0d5dac0df 100644 --- a/translated/tech/20190923 Mutation testing by example- How to leverage failure.md +++ b/published/20190923 Mutation testing by example- How to leverage failure.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11483-1.html) [#]: subject: (Mutation testing by example: How to leverage failure) [#]: via: (https://opensource.com/article/19/9/mutation-testing-example-tdd) [#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) From ccdcbd02bebc3f6b8299f9301b5174362b324b6e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 20 Oct 2019 22:47:56 +0800 Subject: [PATCH 064/800] PRF @geekpi --- ...ntial Accessories for Intel NUC Mini PC.md | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md b/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md index 56655d2ee3..d6cb85fec9 100644 --- a/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md +++ b/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md @@ -1,32 +1,34 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Essential Accessories for Intel NUC Mini PC) [#]: via: (https://itsfoss.com/intel-nuc-essential-accessories/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) -Intel NUC 迷你 PC 的基本配件 +英特尔 NUC 迷你 PC 的基本配件 ====== -几周前,我买了一台 [Intel NUC 迷你 PC][1]。我[在上面安装了 Linux][2],我非常享受。这个小巧的无风扇机器取代了台式机那庞大的 CPU。 +![](https://img.linux.net.cn/data/attachment/album/201910/20/224650me0qoiqjeiysqqph.jpg) -Intel NUC 通常采用准系统形式,这意味着它没有任何内存、硬盘,也显然没有操作系统。许多[基于 Linux 的微型 PC][3] 定制化 Intel NUC 并添加磁盘、RAM 和操作系统将它出售给终端用户。 +几周前,我买了一台 [英特尔 NUC 迷你 PC][1]。我[在上面安装了 Linux][2],我非常喜欢它。这个小巧的无风扇机器取代了台式机那庞大的 CPU。 -不用说,它不像大多数其他台式机那样带有键盘,鼠标或屏幕。 +英特尔 NUC 通常采用准系统形式,这意味着它没有任何内存、硬盘,也显然没有操作系统。许多[基于 Linux 的微型 PC][3] 定制化英特尔 NUC 并添加磁盘、RAM 和操作系统将它出售给终端用户。 -[Intel NUC][4] 是一款出色的设备,如果你要购买台式机,我强烈建议你购买它。如果你正在考虑购买 Intel NUC,你需要买一些配件,以便开始使用它。 +不用说,它不像大多数其他台式机那样带有键盘、鼠标或屏幕。 -### 基本的 Intel NUC 配件 +[英特尔 NUC][4] 是一款出色的设备,如果你要购买台式机,我强烈建议你购买它。如果你正在考虑购买英特尔 NUC,你需要买一些配件,以便开始使用它。 + +### 基本的英特尔 NUC 配件 ![][5] -_文章中的 Amazon 链接是联盟链接。请阅读我们的[联盟政策][6]。_ +*文章中的 Amazon 链接是(原文的)受益链接。请阅读我们的[受益政策][6]。 #### 外围设备:显示器、键盘和鼠标 -这很容易想到。你需要具有屏幕、键盘和鼠标才能使用计算机。你需要一台有 HDMI 连接的显示器和一个 USB 或无线键盘鼠标。如果你已经有了这些东西,那你可以继续。 +这很容易想到。你需要有屏幕、键盘和鼠标才能使用计算机。你需要一台有 HDMI 连接的显示器和一个 USB 或无线键盘鼠标。如果你已经有了这些东西,那你可以继续。 如果你正在寻求建议,我建议购买 LG IPS LED 显示器。我有两台 22 英寸的型号,我对它提供的清晰视觉效果感到满意。 @@ -34,35 +36,27 @@ _文章中的 Amazon 链接是联盟链接。请阅读我们的[联盟政策][6] ![HP EliteDisplay Monitor][8] -我在多屏设置中同时连接了三台显示器。一台显示器连接到指定的 HDMI 端口。两台显示器通过[Club 3D 的 Thunderbolt 转 HDMI 分配器][9]连接到 Thunderbolt 端口。 +我在多屏设置中同时连接了三台显示器。一台显示器连接到指定的 HDMI 端口。两台显示器通过 [Club 3D 的 Thunderbolt 转 HDMI 分配器][9]连接到 Thunderbolt 端口。 你也可以选择超宽显示器。我对此没有亲身经历。 -#### 交流电源线 - -当你拿到 NUC 时,你会惊讶地发现,尽管它有电源适配器,但它并没有插头。 - -![][10] - -由于不同国家/地区的插头不同,因此英特尔决定将其从 NUC 套件中删除。我使用的是旧笔记本的电源线,但是如果你没有笔记本的电源线,那么很可能你需要自己准备一个。 - #### 内存 -Intel NUC 有两个内存插槽,最多可支持 32GB 内存。由于我的是 i3 核心处理器,因此我选择了 [Crucial 的 8GB DDR4 内存][11],价格约为 $33。 +英特尔 NUC 有两个内存插槽,最多可支持 32GB 内存。由于我的是 i3 核心处理器,因此我选择了 [Crucial 的 8GB DDR4 内存][11],价格约为 $33。 ![][12] -8 GB 内存在大多数情况下都没问题,但是如果你的是 i7 核心处理器,那么可以选择 [16GB 内存][13],价格约为 $67。你可以加倍,以获得最大 32GB。选择全在于你。 +8 GB 内存在大多数情况下都没问题,但是如果你的是 i7 核心处理器,那么可以选择 [16GB 内存][13],价格约为 $67。你可以加两条,以获得最大 32GB。选择全在于你。 #### 硬盘(重要) -Intel NUC 同时支持 2.5 英寸驱动器和 M.2 SSD,因此你可以同时使用两者以获得更多存储空间。 +英特尔 NUC 同时支持 2.5 英寸驱动器和 M.2 SSD,因此你可以同时使用两者以获得更多存储空间。 -2.5 英寸插槽可同时容纳 SSD 和 HDD。我强烈建议选择 SSD,因为它比 HDD 快得多。[480GB 2.5寸][14]的价格是 $60。我认为这是一个合理的价格。 +2.5 英寸插槽可同时容纳 SSD 和 HDD。我强烈建议选择 SSD,因为它比 HDD 快得多。[480GB 2.5 英寸][14]的价格是 $60。我认为这是一个合理的价格。 ![][15] -2.5 英寸驱动器的标准 SATA 口速度为 6Gb/秒。根据你是否选择 NVMe SSD,M.2 插槽可能会更快。 NVMe(非易失性内存主机控制器接口规范)SSD 的速度比普通 SSD(也称为 SATA SSD)快 4 倍。但是它们可能也比 SATA M2 SSD 贵一些。 +2.5 英寸驱动器的标准 SATA 口速度为 6 Gb/秒。根据你是否选择 NVMe SSD,M.2 插槽可能会更快。 NVMe(非易失性内存主机控制器接口规范)SSD 的速度比普通 SSD(也称为 SATA SSD)快 4 倍。但是它们可能也比 SATA M2 SSD 贵一些。 当购买 M.2 SSD 时,请检查产品图片。无论是 NVMe 还是 SATA SSD,都应在磁盘本身的图片中提到。你可以考虑使用[经济的三星 EVO NVMe M.2 SSD][16]。 @@ -70,19 +64,27 @@ Intel NUC 同时支持 2.5 英寸驱动器和 M.2 SSD,因此你可以同时使 M.2 插槽和 2.5 英寸插槽中的 SATA SSD 具有相同的速度。这就是为什么如果你不想选择昂贵的 NVMe SSD,建议你选择 2.5 英寸 SATA SSD,并保留 M.2 插​​槽供以后升级。 +#### 交流电源线 + +当我拿到 NUC 时,为惊讶地发现,尽管它有电源适配器,但它并没有插头。 + +正如一些读者指出的那样,你可能有完整的电源线。这取决于你的地理区域和供应商。因此,请检查产品说明和用户评论,以验证其是否具有完整的电源线。 + +![][10] + #### 其他配套配件 你需要使用 HDMI 线缆连接显示器。如果你要购买新显示器,通常应会有一根线缆。 -如果要使用 M.2 插槽,那么可能需要螺丝刀。Intel NUC 是一款出色的设备,你只需用手旋转四个脚即可拧开底部面板。你必须打开设备才能放置内存和磁盘。 +如果要使用 M.2 插槽,那么可能需要螺丝刀。英特尔 NUC 是一款出色的设备,你只需用手旋转四个脚即可拧开底部面板。你必须打开设备才能放置内存和磁盘。 ![Intel NUC with Security Cable | Image Credit Intel][18] NUC 还有防盗孔,可与防盗绳一起使用。在业务环境中,建议使用防盗绳保护计算机安全。购买[防盗绳几美元][19]便可节省数百美元。 -**你使用什么配件?** +### 你使用什么配件? -这些即使我在使用和建议使用的 Intel NUC 配件。你呢?如果你有一台 NUC,你会使用哪些配件并推荐给其他 NUC 用户? +这些就是我在使用和建议使用的英特尔 NUC 配件。你呢?如果你有一台 NUC,你会使用哪些配件并推荐给其他 NUC 用户? -------------------------------------------------------------------------------- @@ -91,14 +93,14 @@ via: https://itsfoss.com/intel-nuc-essential-accessories/ 作者:[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/) 荣誉推出 [a]: https://itsfoss.com/author/abhishek/ [b]: https://github.com/lujun9972 [1]: https://www.amazon.com/Intel-NUC-Mainstream-Kit-NUC8i3BEH/dp/B07GX4X4PW?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B07GX4X4PW (barebone Intel NUC mini PC) -[2]: https://itsfoss.com/install-linux-on-intel-nuc/ +[2]: https://linux.cn/article-11477-1.html [3]: https://itsfoss.com/linux-based-mini-pc/ [4]: https://www.intel.in/content/www/in/en/products/boards-kits/nuc.html [5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/intel-nuc-accessories.png?ssl=1 @@ -106,7 +108,7 @@ via: https://itsfoss.com/intel-nuc-essential-accessories/ [7]: https://www.amazon.com/HP-EliteDisplay-21-5-Inch-1FH45AA-ABA/dp/B075L4VKQF?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B075L4VKQF (HP EliteDisplay monitors) [8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/hp-elitedisplay-monitor.png?ssl=1 [9]: https://www.amazon.com/Club3D-CSV-1546-USB-C-Multi-Monitor-Splitter/dp/B06Y2FX13G?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B06Y2FX13G (thunderbolt to HDMI splitter from Club 3D) -[10]: https://itsfoss.com/wp-content/uploads/2019/09/ac-power-cord-3-pongs.webp +[10]: https://img.linux.net.cn/data/attachment/album/201910/20/224718eebvzvvvm0b6f3ow.jpg [11]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B01BIWKP58?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B01BIWKP58 (8GB DDR4 RAM from Crucial) [12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/crucial-ram.jpg?ssl=1 [13]: https://www.amazon.com/Crucial-Single-PC4-19200-SODIMM-260-Pin/dp/B019FRBHZ0?psc=1&SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=B019FRBHZ0 (16 GB RAM) From 2770fc09a5f1a155aeaebb4d404f6ffdcfdf34cb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 20 Oct 2019 22:53:34 +0800 Subject: [PATCH 065/800] PUB @geekpi https://linux.cn/article-11485-1.html --- .../20190925 Essential Accessories for Intel NUC Mini PC.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190925 Essential Accessories for Intel NUC Mini PC.md (99%) diff --git a/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md b/published/20190925 Essential Accessories for Intel NUC Mini PC.md similarity index 99% rename from translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md rename to published/20190925 Essential Accessories for Intel NUC Mini PC.md index d6cb85fec9..8d6f9b7f63 100644 --- a/translated/tech/20190925 Essential Accessories for Intel NUC Mini PC.md +++ b/published/20190925 Essential Accessories for Intel NUC Mini PC.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11485-1.html) [#]: subject: (Essential Accessories for Intel NUC Mini PC) [#]: via: (https://itsfoss.com/intel-nuc-essential-accessories/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 10a9ce9dc111628ed2ce33ac4ae0163614ac1eff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 21 Oct 2019 00:51:15 +0800 Subject: [PATCH 066/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191020=2014=20S?= =?UTF-8?q?CP=20Command=20Examples=20to=20Securely=20Transfer=20Files=20in?= =?UTF-8?q?=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md --- ...les to Securely Transfer Files in Linux.md | 241 ++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md diff --git a/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md b/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md new file mode 100644 index 0000000000..e34b1d825c --- /dev/null +++ b/sources/tech/20191020 14 SCP Command Examples to Securely Transfer Files in Linux.md @@ -0,0 +1,241 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (14 SCP Command Examples to Securely Transfer Files in Linux) +[#]: via: (https://www.linuxtechi.com/scp-command-examples-in-linux/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +14 SCP Command Examples to Securely Transfer Files in Linux +====== + +**SCP** (Secure Copy) is command line tool in Linux and Unix like systems which is used to transfer files and directories across the systems securely over the network. When we use scp command to copy files and directories from our local system to remote system then in the backend it makes **ssh connection** to remote system. In other words, we can say scp uses the same **SSH security mechanism** in the backend, it needs either password or keys for authentication. + +[![scp-command-examples-linux][1]][2] + +In this tutorial we will discuss 14 useful Linux scp command examples. + +**Syntax of scp command:** + +### scp <options> <files_or_directories> [root@linuxtechi][3]_host:/<folder> + +### scp <options> [root@linuxtechi][3]_host:/files   <folder_local_system> + +First syntax of scp command demonstrate how to copy files or directories from local system to target host under the specific folder. + +Second syntax of scp command demonstrate how files from target host is copied into local system. + +Some of the most widely used options in scp command are listed below, + + *  -C         Enable Compression + *  -i           identity File or private key + *  -l           limit the bandwidth while copying + *  -P          ssh port number of target host + *  -p          Preserves permissions, modes and access time of files while copying + *  -q          Suppress warning message of SSH + *   -r          Copy files and directories recursively + *   -v          verbose output + + + +Let’s jump into the examples now!!!! + +###### Example:1) Copy a file from local system to remote system using scp + +Let’s assume we want to copy jdk rpm package from our local Linux system to remote system (172.20.10.8) using scp command, use the following command, + +``` +[root@linuxtechi ~]$ scp jdk-linux-x64_bin.rpm root@linuxtechi:/opt +root@linuxtechi's password: +jdk-linux-x64_bin.rpm 100% 10MB 27.1MB/s 00:00 +[root@linuxtechi ~]$ +``` + +Above command will copy jdk rpm package file to remote system under /opt folder. + +###### Example:2) Copy a file from remote System to local system using scp + +Let’s suppose we want to copy a file from remote system to our local system under the /tmp folder, execute the following scp command, + +``` +[root@linuxtechi ~]$ scp root@linuxtechi:/root/Technical-Doc-RHS.odt /tmp +root@linuxtechi's password: +Technical-Doc-RHS.odt 100% 1109KB 31.8MB/s 00:00 +[root@linuxtechi ~]$ ls -l /tmp/Technical-Doc-RHS.odt +-rwx------. 1 pkumar pkumar 1135521 Oct 19 11:12 /tmp/Technical-Doc-RHS.odt +[root@linuxtechi ~]$ +``` + +######  Example:3) Verbose Output while transferring files using scp (-v) + +In scp command, we can enable the verbose output using -v option, using verbose output we can easily find what exactly is happening in the background. This becomes very useful in **debugging connection**, **authentication** and **configuration problems**. + +``` +root@linuxtechi ~]$ scp -v jdk-linux-x64_bin.rpm root@linuxtechi:/opt +Executing: program /usr/bin/ssh host 172.20.10.8, user root, command scp -v -t /opt +OpenSSH_7.8p1, OpenSSL 1.1.1 FIPS 11 Sep 2018 +debug1: Reading configuration data /etc/ssh/ssh_config +debug1: Reading configuration data /etc/ssh/ssh_config.d/05-redhat.conf +debug1: Reading configuration data /etc/crypto-policies/back-ends/openssh.config +debug1: /etc/ssh/ssh_config.d/05-redhat.conf line 8: Applying options for * +debug1: Connecting to 172.20.10.8 [172.20.10.8] port 22. +debug1: Connection established. +………… +debug1: Next authentication method: password +root@linuxtechi's password: +``` + +###### Example:4) Transfer multiple files to remote system + +Multiple files can be copied / transferred to remote system using scp command in one go, in scp command specify the multiple files separated by space, example is shown below + +``` +[root@linuxtechi ~]$ scp install.txt index.html jdk-linux-x64_bin.rpm root@linuxtechi:/mnt +root@linuxtechi's password: +install.txt 100% 0 0.0KB/s 00:00 +index.html 100% 85KB 7.2MB/s 00:00 +jdk-linux-x64_bin.rpm 100% 10MB 25.3MB/s 00:00 +[root@linuxtechi ~]$ +``` + +###### Example:5) Transfer files across two remote hosts + +Using scp command we can copy files and directories between two remote hosts, let’s suppose we have a local Linux system which can connect to two remote Linux systems, so from my local linux system I can use scp command to copy files across these two systems, + +Syntax: + +### scp [root@linuxtechi][3]_hosts1:/<files_to_transfer>  [root@linuxtechi][3]_host2:/<folder> + +Example is shown below, + +``` +# scp root@linuxtechi:~/backup-Oct.zip root@linuxtechi:/tmp +# ssh root@linuxtechi "ls -l /tmp/backup-Oct.zip" +-rwx------. 1 root root 747438080 Oct 19 12:02 /tmp/backup-Oct.zip +``` + +###### Example:6) Copy files and directories recursively (-r) + +Use -r option in scp command to recursively copy the entire directory from one system to another, example is shown below, + +``` +[root@linuxtechi ~]$ scp -r Downloads root@linuxtechi:/opt +``` + +Use below command to verify whether Download folder is copied to remote system or not, + +``` +[root@linuxtechi ~]$ ssh root@linuxtechi "ls -ld /opt/Downloads" +drwxr-xr-x. 2 root root 75 Oct 19 12:10 /opt/Downloads +[root@linuxtechi ~]$ +``` + +###### Example:7) Increase transfer speed by enabling compression (-C) + +In scp command, we can increase the transfer speed by enabling the compression using -C option, it will automatically enable compression at source and decompression at destination host. + +``` +root@linuxtechi ~]$ scp -r -C Downloads root@linuxtechi:/mnt +``` + +In the above example we are transferring the Download directory with compression enabled. + +###### Example:8) Limit bandwidth while copying ( -l ) + +Use ‘-l’ option in scp command to put limit on bandwidth usage while copying. Bandwidth is specified in Kbit/s, example is shown below, + +``` +[root@linuxtechi ~]$ scp -l 500 jdk-linux-x64_bin.rpm root@linuxtechi:/var +``` + +###### Example:9) Specify different ssh port while scp ( -P) + +There can be some scenario where ssh port is changed on destination host, so while using scp command we can specify the ssh port number using ‘-P’ option. + +``` +[root@linuxtechi ~]$ scp -P 2022 jdk-linux-x64_bin.rpm root@linuxtechi:/var +``` + +In above example, ssh port for remote host is “2022” + +###### Example:10) Preserves permissions, modes and access time of files while copying (-p) + +Use “-p” option in scp command to preserve permissions, access time and modes while copying from source to destination + +``` +[root@linuxtechi ~]$ scp -p jdk-linux-x64_bin.rpm root@linuxtechi:/var/tmp +jdk-linux-x64_bin.rpm 100% 10MB 13.5MB/s 00:00 +[root@linuxtechi ~]$ +``` + +###### Example:11) Transferring files in quiet mode ( -q) in scp + +Use ‘-q’ option in scp command to suppress transfer progress, warning and diagnostic messages of ssh. Example is shown below, + +``` +[root@linuxtechi ~]$ scp -q -r Downloads root@linuxtechi:/var/tmp +[root@linuxtechi ~]$ +``` + +###### Example:12) Use Identify file in scp while transferring ( -i ) + +In most of the Linux environments, keys-based authentication is preferred. In scp command we specify the identify file or private key file using ‘-i’ option, example is shown below, + +``` +[root@linuxtechi ~]$ scp -i my_key.pem -r Downloads root@linuxtechi:/root +``` + +In above example, “my_key.pem” is the identity file or private key file. + +###### Example:13) Use different ‘ssh_config’ file in scp ( -F) + +There are some scenarios where you use different networks to connect to Linux systems, may be some network is behind proxy servers, so in that case we must have different **ssh_config** file. + +Different ssh_config file in scp command is specified via ‘-F’ option, example is shown below + +``` +[root@linuxtechi ~]$ scp -F /home/pkumar/new_ssh_config -r Downloads root@linuxtechi:/root +root@linuxtechi's password: +jdk-linux-x64_bin.rpm 100% 10MB 16.6MB/s 00:00 +backup-Oct.zip 100% 713MB 41.9MB/s 00:17 +index.html 100% 85KB 6.6MB/s 00:00 +[root@linuxtechi ~]$ +``` + +###### Example:14) Use Different Cipher in scp command (-c) + +By default, scp uses ‘AES-128’ cipher to encrypt the files. If you want to use another cipher in scp command then use ‘-c’ option followed by cipher name, + +Let’s suppose we want to use ‘3des-cbc’ cipher in scp command while transferring the files, run the following scp command + +``` +[root@linuxtechi ~]# scp -c 3des-cbc -r Downloads root@linuxtechi:/root +``` + +Use the below command to list ssh and scp ciphers, + +``` +[root@linuxtechi ~]# ssh -Q cipher localhost | paste -d , -s - +3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,root@linuxtechi,aes128-ctr,aes192-ctr,aes256-ctr,root@linuxtechi,root@linuxtechi,root@linuxtechi +[root@linuxtechi ~]# +``` + +That’s all from this tutorial, to get more details about scp command, kindly refer its man page. Please do share your feedback and comments in comments section below. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/scp-command-examples-in-linux/ + +作者:[Pradeep Kumar][a] +选题:[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/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/scp-command-examples-linux.jpg +[3]: https://www.linuxtechi.com/cdn-cgi/l/email-protection From f9d93a9dfb12460335ed9b527da5e51f8302b4d4 Mon Sep 17 00:00:00 2001 From: lctt-bot Date: Sun, 20 Oct 2019 17:00:22 +0000 Subject: [PATCH 067/800] =?UTF-8?q?Revert=20"=E7=BF=BB=E8=AF=91=E7=94=B3?= =?UTF-8?q?=E9=A2=86"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit d4c4f2276107c8f0e98ff5e95fdea0e13e716b3d. --- ...ocols That Help Things to Communicate Over the Internet.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/talk/20190918 The Protocols That Help Things to Communicate Over the Internet.md b/sources/talk/20190918 The Protocols That Help Things to Communicate Over the Internet.md index 1dd919dc02..6fbfa24bb0 100644 --- a/sources/talk/20190918 The Protocols That Help Things to Communicate Over the Internet.md +++ b/sources/talk/20190918 The Protocols That Help Things to Communicate Over the Internet.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (runningwater) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -126,7 +126,7 @@ via: https://opensourceforu.com/2019/09/the-protocols-that-help-things-to-commun 作者:[Sapna Panchal][a] 选题:[lujun9972][b] -译者:[runningwater](https://github.com/runningwater) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 5cacd18d4c489f96873de1277d3b7bb1c4984067 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 21 Oct 2019 08:43:01 +0800 Subject: [PATCH 068/800] translated --- ...es-Folders Older Than -X- Days in Linux.md | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) rename {sources => translated}/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md (70%) diff --git a/sources/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md b/translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md similarity index 70% rename from sources/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md rename to translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md index cb606aa1c7..21964e83c9 100644 --- a/sources/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md +++ b/translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md @@ -7,32 +7,32 @@ [#]: via: (https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-days-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Bash Script to Delete Files/Folders Older Than “X” Days in Linux +在 Linux 中使用 Bash 脚本删除早于 “X” 天的文件/文件夹 ====== -**[Disk Usage][1]** Monitoring tools are capable of alerting us when a given threshold is reached. +**[磁盘使用率][1]**监控工具能够在达到给定阈值时提醒我们。 -But they don’t have the ingenuity to fix the **[disk usage][2]** problem on their own. +但它们无法自行解决**[磁盘使用率][2]**问题。 -Manual intervention is needed to solve the problem. +需要手动干预才能解决该问题。 -But if you want to fully automate this kind of activity, what you will do. +如果你想完全自动化此类操作,你会做什么。 -Yes, it can be done using the bash script. +是的,可以使用 bash 脚本来完成。 -This script prevents alerts from **[monitoring tool][3]** because we delete old log files before filling the disk space. +该脚本可防止来自**[监控工具][3]**的警报,因为我们会在填满磁盘空间之前删除旧的日志文件。 -We have added many useful shell scripts in the past. If you want to check them out, go to the link below. +我们过去做了很多 shell 脚本。如果要查看,请进入下面的链接。 - * **[How to automate day to day activities using shell scripts?][4]** + * **[如何使用 shell 脚本自动化日常活动?][4]** -I’ve added two bash scripts to this article, which helps clear up old logs. +我在本文中添加了两个 bash 脚本,它们有助于清除旧日志。 -### 1) Bash Script to Delete a Folders Older Than “X” Days in Linux +### 1)在 Linux 中删除早于 “X” 天的文件夹的 Bash 脚本 -We have a folder named **“/var/log/app/”** that contains 15 days of logs and we are going to delete 10 days old folders. +我们有一个名为 **“/var/log/app/”** 的文件夹,其中包含 15 天的日志,我们将删除早于 10 天的文件夹。 ``` $ ls -lh /var/log/app/ @@ -54,9 +54,9 @@ drwxrw-rw- 3 root root 24K Oct 14 23:52 app_log.14 drwxrw-rw- 3 root root 24K Oct 15 23:52 app_log.15 ``` -This script will delete 10 days old folders and send folder list via mail. +该脚本将删除早于 10 天的文件夹,并通过邮件发送文件夹列表。 -You can change the value **“-mtime X”** depending on your requirement. Also, replace your email id instead of us. +你可以根据需要修改 **“-mtime X”** 的值。另外,请替换你的电子邮箱,而不是用我们的。 ``` # /opt/script/delete-old-folders.sh @@ -81,13 +81,13 @@ rm $MESSAGE /tmp/folder.out fi ``` -Set an executable permission to **“delete-old-folders.sh”** file. +给 **“delete-old-folders.sh”** 设置可执行权限。 ``` # chmod +x /opt/script/delete-old-folders.sh ``` -Finally add a **[cronjob][5]** to automate this. It runs daily at 7AM. +最后添加一个 [cronjob][5] 自动化此任务。它于每天早上 7 点运行。 ``` # crontab -e @@ -95,7 +95,7 @@ Finally add a **[cronjob][5]** to automate this. It runs daily at 7AM. 0 7 * * * /bin/bash /opt/script/delete-old-folders.sh ``` -You will get an output like the one below. +你将看到类似下面的输出。 ``` Application log folders are deleted older than 20 days @@ -107,15 +107,15 @@ Oct 14 /var/log/app/app_log.14 Oct 15 /var/log/app/app_log.15 ``` -### 2) Bash Script to Delete a Files Older Than “X” Days in Linux +### 2)在 Linux 中删除早于 “X” 天的文件的 Bash 脚本 -We have a folder named **“/var/log/apache/”** that contains 15 days of logs and we are going to delete 10 days old files. +我们有一个名为 **“/var/log/apache/”** 的文件夹,其中包含15天的日志,我们将删除 10 天前的文件。 -The articles below are related to this topic, so you may be interested to read. +以下文章与该主题相关,因此你可能有兴趣阅读。 - * **[How To Find And Delete Files Older Than “X” Days And “X” Hours In Linux?][6]** - * **[How to Find Recently Modified Files/Folders in Linux][7]** - * **[How To Automatically Delete Or Clean Up /tmp Folder Contents In Linux?][8]** + * **[如何在 Linux 中查找和删除早于 “X” 天和 “X” 小时的文件?][6]** + * **[如何在 Linux 中查找最近修改的文件/文件夹][7]** + * **[如何在 Linux 中自动删除或清理 /tmp 文件夹内容?][8]** @@ -139,9 +139,9 @@ The articles below are related to this topic, so you may be interested to read. -rw-rw-rw- 3 root root 24K Oct 15 23:52 2daygeek_access.15 ``` -This script will delete 10 days old files and send folder list via mail. +该脚本将删除 10 天前的文件并通过邮件发送文件夹列表。 -You can change the value **“-mtime X”** depending on your requirement. Also, replace your email id instead of us. +你可以根据需要修改 **“-mtime X”** 的值。另外,请替换你的电子邮箱,而不是用我们的。 ``` # /opt/script/delete-old-files.sh @@ -166,13 +166,13 @@ rm $MESSAGE /tmp/file.out fi ``` -Set an executable permission to **“delete-old-files.sh”** file. +给 **“delete-old-files.sh”** 设置可执行权限。 ``` # chmod +x /opt/script/delete-old-files.sh ``` -Finally add a **[cronjob][5]** to automate this. It runs daily at 7AM. +最后添加一个 [cronjob][5] 自动化此任务。它于每天早上 7 点运行。 ``` # crontab -e @@ -180,7 +180,7 @@ Finally add a **[cronjob][5]** to automate this. It runs daily at 7AM. 0 7 * * * /bin/bash /opt/script/delete-old-folders.sh ``` -You will get an output like the one below. +你将看到类似下面的输出。 ``` Apache Access log files are deleted older than 20 days @@ -198,7 +198,7 @@ via: https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-d 作者:[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 c7d9ca65955f76d64b030acd3db9809dc5925876 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 21 Oct 2019 08:47:52 +0800 Subject: [PATCH 069/800] translating --- ...91016 Linux sudo flaw can lead to unauthorized privileges.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md b/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md index 5a6e7beaf3..84a74e2afc 100644 --- a/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md +++ b/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4d5cfff1c293f525ab1d538b4b6de194721c7354 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 00:56:33 +0800 Subject: [PATCH 070/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20How=20?= =?UTF-8?q?to=20Get=20the=20Size=20of=20a=20Directory=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191022 How to Get the Size of a Directory in Linux.md --- ...to Get the Size of a Directory in Linux.md | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 sources/tech/20191022 How to Get the Size of a Directory in Linux.md diff --git a/sources/tech/20191022 How to Get the Size of a Directory in Linux.md b/sources/tech/20191022 How to Get the Size of a Directory in Linux.md new file mode 100644 index 0000000000..eac3e774b8 --- /dev/null +++ b/sources/tech/20191022 How to Get the Size of a Directory in Linux.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Get the Size of a Directory in Linux) +[#]: via: (https://www.2daygeek.com/find-get-size-of-directory-folder-linux-disk-usage-du-command/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Get the Size of a Directory in Linux +====== + +You may have noticed that the size of a directory is showing only 4KB when you use the **[ls command][1]** to list the directory content in Linux. + +Is this the right size? If not, what is it, and how to get a directory or folder size in Linux? + +This is the default size, which is used to store the meta information of the directory on the disk. + +There are some applications on Linux to **[get the actual size of a directory][2]**. + +But the disk usage (du) command is widely used by the Linux administrator. + +I will show you how to get folder size with various options. + +### What’s du Command? + +**[du command][3]** stands for `Disk Usage`. It’s a standard Unix program which used to estimate file space usage in present working directory. + +It summarize disk usage recursively to get a directory and its sub-directory size. + +As I said, the directory size only shows 4KB when you use the ls command. See the below output. + +``` +$ ls -lh | grep ^d + +drwxr-xr-x 3 daygeek daygeek 4.0K Aug 2 13:57 Bank_Details +drwxr-xr-x 2 daygeek daygeek 4.0K Mar 15 2019 daygeek +drwxr-xr-x 6 daygeek daygeek 4.0K Feb 16 2019 drive-2daygeek +drwxr-xr-x 13 daygeek daygeek 4.0K Jan 6 2019 drive-mageshm +drwxr-xr-x 15 daygeek daygeek 4.0K Sep 29 21:32 Thanu_Photos +``` + +### 1) How to Check Only the Size of the Parent Directory on Linux + +Use the below du command format to get the total size of a given directory. In this example, we are going to get the total size of the **“/home/daygeek/Documents”** directory. + +``` +$ du -hs /home/daygeek/Documents +or +$ du -h --max-depth=0 /home/daygeek/Documents/ + +20G /home/daygeek/Documents +``` + +**Details**: + + * du – It is a command + * h – Print sizes in human readable format (e.g., 1K 234M 2G) + * s – Display only a total for each argument + * –max-depth=N – Print levels of directory + + + +### 2) How to Get the Size of Each Directory on Linux + +Use the below du command format to get the total size of each directory, including sub-directories. + +In this example, we are going to get the total size of each **“/home/daygeek/Documents”** directory and it’s sub-directories. + +``` +$ du -h /home/daygeek/Documents/ | sort -rh | head -20 + +20G /home/daygeek/Documents/ +9.6G /home/daygeek/Documents/drive-2daygeek +6.3G /home/daygeek/Documents/Thanu_Photos +5.3G /home/daygeek/Documents/Thanu_Photos/Camera +5.3G /home/daygeek/Documents/drive-2daygeek/Thanu-videos +3.2G /home/daygeek/Documents/drive-mageshm +2.3G /home/daygeek/Documents/drive-2daygeek/Thanu-Photos +2.2G /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month +916M /home/daygeek/Documents/drive-mageshm/Tanisha +454M /home/daygeek/Documents/drive-mageshm/2g-backup +415M /home/daygeek/Documents/Thanu_Photos/WhatsApp Video +300M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Jan-2017 +288M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Oct-2017 +226M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Sep-2017 +219M /home/daygeek/Documents/Thanu_Photos/WhatsApp Documents +213M /home/daygeek/Documents/drive-mageshm/photos +163M /home/daygeek/Documents/Thanu_Photos/WhatsApp Video/Sent +161M /home/daygeek/Documents/Thanu_Photos/WhatsApp Images +154M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/June-2017 +150M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Nov-2016 +``` + +### 3) How to Get a Summary of Each Directory on Linux + +Use the below du command format to get only the summary for each directory. + +``` +$ du -hs /home/daygeek/Documents/* | sort -rh | head -10 + +9.6G /home/daygeek/Documents/drive-2daygeek +6.3G /home/daygeek/Documents/Thanu_Photos +3.2G /home/daygeek/Documents/drive-mageshm +756K /home/daygeek/Documents/Bank_Details +272K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-TouchInterface1.png +172K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-NightLight.png +164K /home/daygeek/Documents/ConfigServer Security and Firewall (csf) Cheat Sheet.pdf +132K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-Todo.png +112K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-ZorinAutoTheme.png +96K /home/daygeek/Documents/distro-info.xlsx +``` + +### 4) How to Display the Size of Each Directory and Exclude Sub-Directories on Linux + +Use the below du command format to display the total size of each directory, excluding subdirectories. + +``` +$ du -hS /home/daygeek/Documents/ | sort -rh | head -20 + +5.3G /home/daygeek/Documents/Thanu_Photos/Camera +5.3G /home/daygeek/Documents/drive-2daygeek/Thanu-videos +2.3G /home/daygeek/Documents/drive-2daygeek/Thanu-Photos +1.5G /home/daygeek/Documents/drive-mageshm +831M /home/daygeek/Documents/drive-mageshm/Tanisha +454M /home/daygeek/Documents/drive-mageshm/2g-backup +300M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Jan-2017 +288M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Oct-2017 +253M /home/daygeek/Documents/Thanu_Photos/WhatsApp Video +226M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Sep-2017 +219M /home/daygeek/Documents/Thanu_Photos/WhatsApp Documents +213M /home/daygeek/Documents/drive-mageshm/photos +163M /home/daygeek/Documents/Thanu_Photos/WhatsApp Video/Sent +154M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/June-2017 +150M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Nov-2016 +127M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Dec-2016 +100M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Oct-2016 +94M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Nov-2017 +92M /home/daygeek/Documents/Thanu_Photos/WhatsApp Images +90M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Dec-2017 +``` + +### 5) How to Get Only the Size of First-Level Sub-Directories on Linux + +If you want to get the size of the first-level sub-directories, including their subdirectories, for a given directory on Linux, use the command format below. + +``` +$ du -h --max-depth=1 /home/daygeek/Documents/ + +3.2G /home/daygeek/Documents/drive-mageshm +4.0K /home/daygeek/Documents/daygeek +756K /home/daygeek/Documents/Bank_Details +9.6G /home/daygeek/Documents/drive-2daygeek +6.3G /home/daygeek/Documents/Thanu_Photos +20G /home/daygeek/Documents/ +``` + +### 6) How to Get Grand Total in the du Command Output + +If you want to get the grand total in the du Command output, use the below du command format. + +``` +$ du -hsc /home/daygeek/Documents/* | sort -rh | head -10 + +20G total +9.6G /home/daygeek/Documents/drive-2daygeek +6.3G /home/daygeek/Documents/Thanu_Photos +3.2G /home/daygeek/Documents/drive-mageshm +756K /home/daygeek/Documents/Bank_Details +272K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-TouchInterface1.png +172K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-NightLight.png +164K /home/daygeek/Documents/ConfigServer Security and Firewall (csf) Cheat Sheet.pdf +132K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-Todo.png +112K /home/daygeek/Documents/user-friendly-zorin-os-15-has-been-released-ZorinAutoTheme.png +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/find-get-size-of-directory-folder-linux-disk-usage-du-command/ + +作者:[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/linux-unix-ls-command-display-directory-contents/ +[2]: https://www.2daygeek.com/how-to-get-find-size-of-directory-folder-linux/ +[3]: https://www.2daygeek.com/linux-check-disk-usage-files-directories-size-du-command/ From 01dcba78220f7c5a68bcb14f5c3773431e8722f8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 00:57:42 +0800 Subject: [PATCH 071/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20Beginn?= =?UTF-8?q?er=E2=80=99s=20Guide=20to=20Handle=20Various=20Update=20Related?= =?UTF-8?q?=20Errors=20in=20Ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md --- ...Various Update Related Errors in Ubuntu.md | 261 ++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md diff --git a/sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md b/sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md new file mode 100644 index 0000000000..381ee4c9dd --- /dev/null +++ b/sources/tech/20191022 Beginner-s Guide to Handle Various Update Related Errors in Ubuntu.md @@ -0,0 +1,261 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Beginner’s Guide to Handle Various Update Related Errors in Ubuntu) +[#]: via: (https://itsfoss.com/ubuntu-update-error/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Beginner’s Guide to Handle Various Update Related Errors in Ubuntu +====== + +_**Who hasn’t come across an error while doing an update in Ubuntu? Update errors are common and plenty in Ubuntu and other Linux distributions based on Ubuntu. Here are some common Ubuntu update errors and their fixes.**_ + +This article is part of Ubuntu beginner series that explains the know-how of Ubuntu so that a new user could understand the things better. + +In an earlier article, I discussed [how to update Ubuntu][1]. In this tutorial, I’ll discuss some common errors you may encounter while updating [Ubuntu][2]. It usually happens because you tried to add software or repositories on your own and that probably caused an issue. + +There is no need to panic if you see the errors while updating your system.The errors are common and the fix is easy. You’ll learn how to fix those common update errors. + +_**Before you begin, I highly advise reading these two articles to have a better understanding of the repository concept in Ubuntu.**_ + +![Understand Ubuntu repositories][3] + +![Understand Ubuntu repositories][3] + +###### **Understand Ubuntu repositories** + +Learn what are various repositories in Ubuntu and how they enable you to install software in your system. + +[Read More][4] + +![Understanding PPA in Ubuntu][5] + +![Understanding PPA in Ubuntu][5] + +###### **Understanding PPA in Ubuntu** + +Further improve your concept of repositories and package handling in Ubuntu with this detailed guide on PPA. + +[Read More][6] + +### Error 0: Failed to download repository information + +Many Ubuntu desktop users update their system through the graphical software updater tool. You are notified that updates are available for your system and you can click one button to start downloading and installing the updates. + +Well, that’s what usually happens. But sometimes you’ll see an error like this: + +![][7] + +_**Failed to download repository information. Check your internet connection.**_ + +That’s a weird error because your internet connection is most likely working just fine and it still says to check the internet connection. + +Did you note that I called it ‘error 0’? It’s because it’s not an error in itself. I mean, most probably, it has nothing to do with the internet connection. But there is no useful information other than this misleading error message. + +If you see this error message and your internet connection is working fine, it’s time to put on your detective hat and [use your grey cells][8] (as [Hercule Poirot][9] would say). + +You’ll have to use the command line here. You can [use Ctrl+Alt+T keyboard shortcut to open the terminal in Ubuntu][10]. In the terminal, use this command: + +``` +sudo apt update +``` + +Let the command finish. Observe the last three-four lines of its output. That will give you the real reason why sudo apt-get update fails. Here’s an example: + +![][11] + +Rest of the tutorial here shows how to handle the errors that you just saw in the last few lines of the update command output. + +### Error 1: Problem With MergeList + +When you run update in terminal, you may see an error “[problem with MergeList][12]” like below: + +``` +E:Encountered a section with no Package: header, +E:Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-i386_Packages, +E:The package lists or status file could not be parsed or opened.’ +``` + +For some reasons, the file in /var/lib/apt/lists directory got corrupted. You can delete all the files in this directory and run the update again to regenerate everything afresh. Use the following commands one by one: + +``` +sudo rm -r /var/lib/apt/lists/* +sudo apt-get clean && sudo apt-get update +``` + +Your problem should be fixed. + +### Error 2: Hash Sum mismatch + +If you find an error that talks about [Hash Sum mismatch][13], the fix is the same as the one in the previous error. + +``` +W:Failed to fetch bzip2:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_restricted_binary-i386_Packages Hash Sum mismatch, +W:Failed to fetch bzip2:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_multiverse_binary-i386_Packages Hash Sum mismatch, +E:Some index files failed to download. They have been ignored, or old ones used instead +``` + +The error occurs possibly because of a mismatched metadata cache between the server and your system. You can use the following commands to fix it: + +``` +sudo rm -rf /var/lib/apt/lists/* +sudo apt update +``` + +### Error 3: Failed to fetch with error 404 not found + +If you try adding a PPA repository that is not available for your current [Ubuntu version][14], you’ll see that it throws a 404 not found error. + +``` +W: Failed to fetch http://ppa.launchpad.net/venerix/pkg/ubuntu/dists/raring/main/binary-i386/Packages 404 Not Found +E: Some index files failed to download. They have been ignored, or old ones used instead. +``` + +You added a PPA hoping to install an application but it is not available for your Ubuntu version and you are now stuck with the update error. This is why you should check beforehand if a PPA is available for your Ubuntu version or not. I have discussed how to check the PPA availability in the detailed [PPA guide][6]. + +Anyway, the fix here is that you remove the troublesome PPA from your list of repositories. Note the PPA name from the error message. Go to _Software & Updates_ tool: + +![Open Software & Updates][15] + +In here, move to _Other Software_ tab and look for that PPA. Uncheck the box to [remove the PPA][16] from your system. + +![Remove PPA Using Software & Updates In Ubuntu][17] + +Your software list will be updated when you do that. Now if you run the update again, you shouldn’t see the error. + +### Error 4: Failed to download package files error + +A similar error is **[failed to download package files error][18] **like this: + +![][19] + +In this case, a newer version of the software is available but it’s not propagated to all the mirrors. If you are not using a mirror, easily fixed by changing the software sources to Main server. Please read this article for more details on [failed to download package error][18]. + +Go to _Software & Updates_ and in there changed the download server to Main server: + +![][20] + +### Error 5: GPG error: The following signatures couldn’t be verified + +Adding a PPA may also result in the following [GPG error: The following signatures couldn’t be verified][21] when you try to run an update in terminal: + +``` +W: GPG error: http://repo.mate-desktop.org saucy InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 68980A0EA10B4DE8 +``` + +All you need to do is to fetch this public key in the system. Get the key number from the message. In the above message, the key is 68980A0EA10B4DE8. + +This key can be used in the following manner: + +``` +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68980A0EA10B4DE8 +``` + +Once the key has been added, run the update again and it should be fine. + +### Error 6: BADSIG error + +Another signature related Ubuntu update error is [BADSIG error][22] which looks something like this: + +``` +W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com precise Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key +W: GPG error: http://ppa.launchpad.net precise Release: +The following signatures were invalid: BADSIG 4C1CBC1B69B0E2F4 Launchpad PPA for Jonathan French W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release +``` + +All the repositories are signed with the GPG and for some reason, your system finds them invalid. You’ll need to update the signature keys. The easiest way to do that is by regenerating the apt packages list (with their signature keys) and it should have the correct key. + +Use the following commands one by one in the terminal: + +``` +cd /var/lib/apt +sudo mv lists oldlist +sudo mkdir -p lists/partial +sudo apt-get clean +sudo apt-get update +``` + +### Error 7: Partial upgrade error + +Running updates in terminal may throw this partial upgrade error: + +![][23] + +``` +Not all updates can be installed +Run a partial upgrade, to install as many updates as possible +``` + +Run the following command in terminal to fix this error: + +``` +sudo apt-get install -f +``` + +### Error 8: Could not get lock /var/cache/apt/archives/lock + +This error happens when another program is using APT. Suppose you are installing some thing in Ubuntu Software Center and at the same time, trying to run apt in terminal. + +``` +E: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable) +E: Unable to lock directory /var/cache/apt/archives/ +``` + +Check if some other program might be using apt. It could be a command running terminal, Software Center, Software Updater, Software & Updates or any other software that deals with installing and removing applications. + +If you can close other such programs, close them. If there is a process in progress, wait for it to finish. + +If you cannot find any such programs, use the following [command to kill all such running processes][24]: + +``` +sudo killall apt apt-get +``` + +This is a tricky problem and if the problem still persists, please read this detailed tutorial on [fixing the unable to lock the administration directory error in Ubuntu][25]. + +_**Any other update error you encountered?**_ + +That compiles the list of frequent Ubuntu update errors you may encounter. I hope this helps you to get rid of these errors. + +Have you encountered any other update error in Ubuntu recently that hasn’t been covered here? Do mention it in comments and I’ll try to do a quick tutorial on it. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-update-error/ + +作者:[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/update-ubuntu/ +[2]: https://ubuntu.com/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/ubuntu-repositories.png?ssl=1 +[4]: https://itsfoss.com/ubuntu-repositories/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/what-is-ppa.png?ssl=1 +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/04/Failed-to-download-repository-information-Ubuntu-13.04.png?ssl=1 +[8]: https://idioms.thefreedictionary.com/little+grey+cells +[9]: https://en.wikipedia.org/wiki/Hercule_Poirot +[10]: https://itsfoss.com/ubuntu-shortcuts/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/11/Ubuntu-Update-error.jpeg?ssl=1 +[12]: https://itsfoss.com/how-to-fix-problem-with-mergelist/ +[13]: https://itsfoss.com/solve-ubuntu-error-failed-to-download-repository-information-check-your-internet-connection/ +[14]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/05/software-updates-ubuntu-gnome.jpeg?ssl=1 +[16]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/remove_ppa_using_software_updates_in_ubuntu.jpg?ssl=1 +[18]: https://itsfoss.com/fix-failed-download-package-files-error-ubuntu/ +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2014/09/Ubuntu_Update_error.jpeg?ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2014/09/Change_server_Ubuntu.jpeg?ssl=1 +[21]: https://itsfoss.com/solve-gpg-error-signatures-verified-ubuntu/ +[22]: https://itsfoss.com/solve-badsig-error-quick-tip/ +[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2013/09/Partial_Upgrade_error_Elementary_OS_Luna.png?ssl=1 +[24]: https://itsfoss.com/how-to-find-the-process-id-of-a-program-and-kill-it-quick-tip/ +[25]: https://itsfoss.com/could-not-get-lock-error/ From e9caf83c58c375b0992c96921c4e5da7d9c84c91 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 00:59:54 +0800 Subject: [PATCH 072/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191021=20Kubern?= =?UTF-8?q?etes=20networking,=20OpenStack=20Train,=20and=20more=20industry?= =?UTF-8?q?=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md --- ...enStack Train, and more industry trends.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md diff --git a/sources/tech/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md b/sources/tech/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md new file mode 100644 index 0000000000..5d224af465 --- /dev/null +++ b/sources/tech/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Kubernetes networking, OpenStack Train, and more industry trends) +[#]: via: (https://opensource.com/article/19/10/kubernetes-openstack-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Kubernetes networking, OpenStack Train, and more industry trends +====== +A weekly look at open source community and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [A look at the most exciting features in OpenStack Train][2] + +> But given all the technology goodies ([you can see the release highlights here][3]) that the Train release has to offer, you may be curious about the features that we at Red Hat believe are among the top capabilities that will benefit our telecommunications and enterprise customers and their uses cases. Here's an overview of the features we are most excited about this release. + +**The impact**: OpenStack to me is like Shia LaBeouf: it reached peak hype a couple of years ago and then continued turning out good work. The Train release looks like yet another pretty incredible drop of innovation. + +## [Building Kubernetes Operators in an Ansible-native way][4] + +> Operators simplify management of complex applications on Kubernetes. They are usually written in Go and require expertise with the internals of Kubernetes. But, there’s an alternative to that with a lower barrier to entry. Ansible is a first-class citizen in the Operator SDK. Using Ansible frees up application engineers, maximizes time to automate and orchestrate your applications, and doing it across new & existing platforms with one simple language. Here we see how. + +**The impact**: This is like finding out you can make pretty good ice cream with a blender and frozen bananas: Ansible (which is generally thought of as being pretty simple to pick up) lets you do some pretty impressive Operator magic way easier than you thought you could. + +## [Kubernetes networking: Behind the scenes][5] + +> While there are very good resources around this topic (links [here][6]), I couldn’t find a single example that connects all of the dots with commands outputs that network engineers love and hate, showing what is actually happening behind the scenes. So, I decided to curate this information from a number of different sources to hopefully help you better understand how things are tied together. + +**The impact**: An accessible, well-written take on a complicated topic (with pictures). Guaranteed to make Kube networking 10% less confusing. + +## [Securing the container supply chain][7] + +> With the emergence of containers, Software as a Service and Functions as a Service, the focus in on consuming existing services, functions and container images in the race to provide new value. Scott McCarty, Principal Product Manager, Containers at [Red Hat][8], says that focus has both advantages and disadvantages. “It allows us to focus our energy on writing new application code that is specific to our needs, while shifting the concern for the underlying infrastructure to someone else,” says McCarty. “Containers are in a sweet spot providing enough control, but offloading a lot of tedious infrastructure work.” But containers can also create disadvantages related to security. + +**The impact**: I sit amongst a group of ~10 security people, and can safely say that it takes a certain disposition to want to think about software security all day. When you stare into the abyss for long enough, it stares back into you. If you are a software developer who is not so disposed, please take Scott's advice and make sure your suppliers are. + +## [Fedora at 15: Why Matthew Miller sees a bright future for the Linux distribution][9] + +> In a wide-ranging interview with TechRepublic, Fedora project leader Matthew Miller discussed lessons learned from the past, popular adoption and competing standards for software containers, potential changes coming to Fedora, as well as hot-button topics, including systemd. + +**The impact**: What I like about the Fedora project is it's clarity; the project knows what it stands for. People like Matt are why. + +## _I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/kubernetes-openstack-and-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.redhat.com/en/blog/look-most-exciting-features-openstack-train +[3]: https://releases.openstack.org/train/highlights.html +[4]: https://www.cncf.io/webinars/building-kubernetes-operators-in-an-ansible-native-way/ +[5]: https://itnext.io/kubernetes-networking-behind-the-scenes-39a1ab1792bb +[6]: https://github.com/nleiva/kubernetes-networking-links +[7]: https://www.devprojournal.com/technology-trends/open-source/securing-the-container-supply-chain/ +[8]: https://www.redhat.com/en +[9]: https://www.techrepublic.com/article/fedora-at-15-why-matthew-miller-sees-a-bright-future-for-the-linux-distribution/ From 96c4f83f4d010c1c194f52f21372e92e1bb0e411 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 01:01:07 +0800 Subject: [PATCH 073/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191021=20How=20?= =?UTF-8?q?to=20program=20with=20Bash:=20Syntax=20and=20tools?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191021 How to program with Bash- Syntax and tools.md --- ... to program with Bash- Syntax and tools.md | 272 ++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100644 sources/tech/20191021 How to program with Bash- Syntax and tools.md diff --git a/sources/tech/20191021 How to program with Bash- Syntax and tools.md b/sources/tech/20191021 How to program with Bash- Syntax and tools.md new file mode 100644 index 0000000000..ae17b836d5 --- /dev/null +++ b/sources/tech/20191021 How to program with Bash- Syntax and tools.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to program with Bash: Syntax and tools) +[#]: via: (https://opensource.com/article/19/10/programming-bash-part-1) +[#]: author: (David Both https://opensource.com/users/dboth) + +How to program with Bash: Syntax and tools +====== +Learn basic Bash programming syntax and tools, as well as how to use +variables and control operators, in the first article in this three-part +series. +![bash logo on green background][1] + +A shell is the command interpreter for the operating system. Bash is my favorite shell, but every Linux shell interprets the commands typed by the user or sysadmin into a form the operating system can use. When the results are returned to the shell program, it sends them to STDOUT which, by default, [displays them in the terminal][2]. All of the shells I am familiar with are also programming languages. + +Features like tab completion, command-line recall and editing, and shortcuts like aliases all contribute to its value as a powerful shell. Its default command-line editing mode uses Emacs, but one of my favorite Bash features is that I can change it to Vi mode to use editing commands that are already part of my muscle memory. + +However, if you think of Bash solely as a shell, you miss much of its true power. While researching my three-volume [Linux self-study course][3] (on which this series of articles is based), I learned things about Bash that I'd never known in over 20 years of working with Linux. Some of these new bits of knowledge relate to its use as a programming language. Bash is a powerful programming language, one perfectly designed for use on the command line and in shell scripts. + +This three-part series explores using Bash as a command-line interface (CLI) programming language. This first article looks at some simple command-line programming with Bash, variables, and control operators. The other articles explore types of Bash files; string, numeric, and miscellaneous logical operators that provide execution-flow control logic; different types of shell expansions; and the **for**, **while**, and **until** loops that enable repetitive operations. They will also look at some commands that simplify and support the use of these tools. + +### The shell + +A shell is the command interpreter for the operating system. Bash is my favorite shell, but every Linux shell interprets the commands typed by the user or sysadmin into a form the operating system can use. When the results are returned to the shell program, it displays them in the terminal. All of the shells I am familiar with are also programming languages. + +Bash stands for Bourne Again Shell because the Bash shell is [based upon][4] the older Bourne shell that was written by Steven Bourne in 1977. Many [other shells][5] are available, but these are the four I encounter most frequently: + + * **csh:** The C shell for programmers who like the syntax of the C language + * **ksh:** The Korn shell, written by David Korn and popular with Unix users + * **tcsh:** A version of csh with more ease-of-use features + * **zsh:** The Z shell, which combines many features of other popular shells + + + +All shells have built-in commands that supplement or replace the ones provided by the core utilities. Open the shell's man page and find the "BUILT-INS" section to see the commands it provides. + +Each shell has its own personality and syntax. Some will work better for you than others. I have used the C shell, the Korn shell, and the Z shell. I still like the Bash shell more than any of them. Use the one that works best for you, although that might require you to try some of the others. Fortunately, it's quite easy to change shells. + +All of these shells are programming languages, as well as command interpreters. Here's a quick tour of some programming constructs and tools that are integral parts of Bash. + +### Bash as a programming language + +Most sysadmins have used Bash to issue commands that are usually fairly simple and straightforward. But Bash can go beyond entering single commands, and many sysadmins create simple command-line programs to perform a series of tasks. These programs are common tools that can save time and effort. + +My objective when writing CLI programs is to save time and effort (i.e., to be the lazy sysadmin). CLI programs support this by listing several commands in a specific sequence that execute one after another, so you do not need to watch the progress of one command and type in the next command when the first finishes. You can go do other things and not have to continually monitor the progress of each command. + +### What is "a program"? + +The Free On-line Dictionary of Computing ([FOLDOC][6]) defines a program as: "The instructions executed by a computer, as opposed to the physical device on which they run." Princeton University's [WordNet][7] defines a program as: "…a sequence of instructions that a computer can interpret and execute…" [Wikipedia][8] also has a good entry about computer programs. + +Therefore, a program can consist of one or more instructions that perform a specific, related task. A computer program instruction is also called a program statement. For sysadmins, a program is usually a sequence of shell commands. All the shells available for Linux, at least the ones I am familiar with, have at least a basic form of programming capability, and Bash, the default shell for most Linux distributions, is no exception. + +While this series uses Bash (because it is so ubiquitous), if you use a different shell, the general programming concepts will be the same, although the constructs and syntax may differ somewhat. Some shells may support some features that others do not, but they all provide some programming capability. Shell programs can be stored in a file for repeated use, or they may be created on the command line as needed. + +### Simple CLI programs + +The simplest command-line programs are one or two consecutive program statements, which may be related or not, that are entered on the command line before the **Enter** key is pressed. The second statement in a program, if there is one, might be dependent upon the actions of the first, but it does not need to be. + +There is also one bit of syntactical punctuation that needs to be clearly stated. When entering a single command on the command line, pressing the **Enter** key terminates the command with an implicit semicolon (**;**). When used in a CLI shell program entered as a single line on the command line, the semicolon must be used to terminate each statement and separate it from the next one. The last statement in a CLI shell program can use an explicit or implicit semicolon. + +### Some basic syntax + +The following examples will clarify this syntax. This program consists of a single command with an explicit terminator: + + +``` +[student@studentvm1 ~]$ echo "Hello world." ; +Hello world. +``` + +That may not seem like much of a program, but it is the first program I encounter with every new programming language I learn. The syntax may be a bit different for each language, but the result is the same. + +Let's expand a little on this trivial but ubiquitous program. Your results will be different from mine because I have done other experiments, while you may have only the default directories and files that are created in the account home directory the first time you log into an account via the GUI desktop. + + +``` +[student@studentvm1 ~]$ echo "My home directory." ; ls ; +My home directory. +chapter25   TestFile1.Linux  dmesg2.txt  Downloads  newfile.txt  softlink1  testdir6 +chapter26   TestFile1.mac    dmesg3.txt  file005    Pictures     Templates  testdir +TestFile1      Desktop       dmesg.txt   link3      Public       testdir    Videos +TestFile1.dos  dmesg1.txt    Documents   Music      random.txt   testdir1 +``` + +That makes a bit more sense. The results are related, but the individual program statements are independent of each other. Notice that I like to put spaces before and after the semicolon because it makes the code a bit easier to read. Try that little CLI program again without an explicit semicolon at the end: + + +``` +`[student@studentvm1 ~]$ echo "My home directory." ; ls` +``` + +There is no difference in the output. + +### Something about variables + +Like all programming languages, the Bash shell can deal with variables. A variable is a symbolic name that refers to a specific location in memory that contains a value of some sort. The value of a variable is changeable, i.e., it is variable. + +Bash does not type variables like C and related languages, defining them as integers, floating points, or string types. In Bash, all variables are strings. A string that is an integer can be used in integer arithmetic, which is the only type of math that Bash is capable of doing. If more complex math is required, the [**bc** command][9] can be used in CLI programs and scripts. + +Variables are assigned values and can be used to refer to those values in CLI programs and scripts. The value of a variable is set using its name but not preceded by a **$** sign. The assignment **VAR=10** sets the value of the variable VAR to 10. To print the value of the variable, you can use the statement **echo $VAR**. Start with text (i.e., non-numeric) variables. + +Bash variables become part of the shell environment until they are unset. + +Check the initial value of a variable that has not been assigned; it should be null. Then assign a value to the variable and print it to verify its value. You can do all of this in a single CLI program: + + +``` +[student@studentvm1 ~]$ echo $MyVar ; MyVar="Hello World" ; echo $MyVar ; + +Hello World +[student@studentvm1 ~]$ +``` + +_Note: The syntax of variable assignment is very strict. There must be no spaces on either side of the equal (**=**) sign in the assignment statement._ + +The empty line indicates that the initial value of **MyVar** is null. Changing and setting the value of a variable are done the same way. This example shows both the original and the new value. + +As mentioned, Bash can perform integer arithmetic calculations, which is useful for calculating a reference to the location of an element in an array or doing simple math problems. It is not suitable for scientific computing or anything that requires decimals, such as financial calculations. There are much better tools for those types of calculations. + +Here's a simple calculation: + + +``` +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1*Var2))" +Result = 63 +``` + +What happens when you perform a math operation that results in a floating-point number? + + +``` +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1/Var2))" +Result = 0 +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var2/Var1))" +Result = 1 +[student@studentvm1 ~]$ +``` + +The result is the nearest integer. Notice that the calculation was performed as part of the **echo** statement. The math is performed before the enclosing echo command due to the Bash order of precedence. For details see the Bash man page and search "precedence." + +### Control operators + +Shell control operators are one of the syntactical operators for easily creating some interesting command-line programs. The simplest form of CLI program is just stringing several commands together in a sequence on the command line: + + +``` +`command1 ; command2 ; command3 ; command4 ; . . . ; etc. ;` +``` + +Those commands all run without a problem so long as no errors occur. But what happens when an error occurs? You can anticipate and allow for errors using the built-in **&&** and **||** Bash control operators. These two control operators provide some flow control and enable you to alter the sequence of code execution. The semicolon is also considered to be a Bash control operator, as is the newline character. + +The **&&** operator simply says, "if command1 is successful, then run command2. If command1 fails for any reason, then command2 is skipped." That syntax looks like this: + + +``` +`command1 && command2` +``` + +Now, look at some commands that will create a new directory and—if it's successful—make it the present working directory (PWD). Ensure that your home directory (**~**) is the PWD. Try this first in **/root**, a directory that you do not have access to: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir/ && cd $Dir +mkdir: cannot create directory '/root/testdir/': Permission denied +[student@studentvm1 ~]$ +``` + +The error was emitted by the **mkdir** command. You did not receive an error indicating that the file could not be created because the creation of the directory failed. The **&&** control operator sensed the non-zero return code, so the **touch** command was skipped. Using the **&&** control operator prevents the **touch** command from running because there was an error in creating the directory. This type of command-line program flow control can prevent errors from compounding and making a real mess of things. But it's time to get a little more complicated. + +The **||** control operator allows you to add another program statement that executes when the initial program statement returns a code greater than zero. The basic syntax looks like this: + + +``` +`command1 || command2` +``` + +This syntax reads, "If command1 fails, execute command2." That implies that if command1 succeeds, command2 is skipped. Try this by attempting to create a new directory: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir || echo "$Dir was not created." +mkdir: cannot create directory '/root/testdir': Permission denied +/root/testdir was not created. +[student@studentvm1 ~]$ +``` + +This is exactly what you would expect. Because the new directory could not be created, the first command failed, which resulted in the execution of the second command. + +Combining these two operators provides the best of both. The control operator syntax using some flow control takes this general form when the **&&** and **||** control operators are used: + + +``` +`preceding commands ; command1 && command2 || command3 ; following commands` +``` + +This syntax can be stated like so: "If command1 exits with a return code of 0, then execute command2, otherwise execute command3." Try it: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." +mkdir: cannot create directory '/root/testdir': Permission denied +/root/testdir was not created. +[student@studentvm1 ~]$ +``` + +Now try the last command again using your home directory instead of the **/root** directory. You will have permission to create this directory: + + +``` +[student@studentvm1 ~]$ Dir=~/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." +[student@studentvm1 testdir]$ +``` + +The control operator syntax, like **command1 && command2**, works because every command sends a return code (RC) to the shell that indicates if it completed successfully or whether there was some type of failure during execution. By convention, an RC of zero (0) indicates success, and any positive number indicates some type of failure. Some of the tools sysadmins use just return a one (1) to indicate a failure, but many use other codes to indicate the type of failure that occurred. + +The Bash shell variable **$?** contains the RC from the last command. This RC can be checked very easily by a script, the next command in a list of commands, or even the sysadmin directly. Start by running a simple command and immediately checking the RC. The RC will always be for the last command that ran before you looked at it. + + +``` +[student@studentvm1 testdir]$ ll ; echo "RC = $?" +total 1264 +drwxrwxr-x  2 student student   4096 Mar  2 08:21 chapter25 +drwxrwxr-x  2 student student   4096 Mar 21 15:27 chapter26 +-rwxr-xr-x  1 student student     92 Mar 20 15:53 TestFile1 +<snip> +drwxrwxr-x. 2 student student 663552 Feb 21 14:12 testdir +drwxr-xr-x. 2 student student   4096 Dec 22 13:15 Videos +RC = 0 +[student@studentvm1 testdir]$ +``` + +The RC, in this case, is zero, which means the command completed successfully. Now try the same command on root's home directory, a directory you do not have permissions for: + + +``` +[student@studentvm1 testdir]$ ll /root ; echo "RC = $?" +ls: cannot open directory '/root': Permission denied +RC = 2 +[student@studentvm1 testdir]$ +``` + +In this case, the RC is two; this means permission was denied for a non-root user to access a directory to which the user is not permitted access. The control operators use these RCs to enable you to alter the sequence of program execution. + +### Summary + +This article looked at Bash as a programming language and explored its basic syntax as well as some basic tools. It showed how to print data to STDOUT and how to use variables and control operators. The next article in this series looks at some of the many Bash logical operators that control the flow of instruction execution. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/programming-bash-part-1 + +作者:[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/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/18/10/linux-data-streams +[3]: http://www.both.org/?page_id=1183 +[4]: https://opensource.com/19/9/command-line-heroes-bash +[5]: https://en.wikipedia.org/wiki/Comparison_of_command_shells +[6]: http://foldoc.org/program +[7]: https://wordnet.princeton.edu/ +[8]: https://en.wikipedia.org/wiki/Computer_program +[9]: https://www.gnu.org/software/bc/manual/html_mono/bc.html From 4f1f57855f5a017ae3fbace679a14ff1f8d465fd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 01:02:04 +0800 Subject: [PATCH 074/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191021=20How=20?= =?UTF-8?q?to=20build=20a=20Flatpak?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191021 How to build a Flatpak.md --- .../tech/20191021 How to build a Flatpak.md | 320 ++++++++++++++++++ 1 file changed, 320 insertions(+) create mode 100644 sources/tech/20191021 How to build a Flatpak.md diff --git a/sources/tech/20191021 How to build a Flatpak.md b/sources/tech/20191021 How to build a Flatpak.md new file mode 100644 index 0000000000..94bbb65036 --- /dev/null +++ b/sources/tech/20191021 How to build a Flatpak.md @@ -0,0 +1,320 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to build a Flatpak) +[#]: via: (https://opensource.com/article/19/10/how-build-flatpak-packaging) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to build a Flatpak +====== +A universal packaging format with a decentralized means of distribution. +Plus, portability and sandboxing. +![][1] + +A long time ago, a Linux distribution shipped an operating system along with _all_ the software available for it. There was no concept of “third party” software because everything was a part of the distribution. Applications weren’t so much installed as they were enabled from a great big software repository that you got on one of the many floppy disks or, later, CDs you purchased or downloaded. + +This evolved into something even more convenient as the internet became ubiquitous, and the concept of what is now the “app store” was born. Of course, Linux distributions tend to call this a _software repository_ or just _repo_ for short, with some variations for “branding”, such as _Ubuntu Software Center_ or, with typical GNOME minimalism, simply _Software_. + +This model worked well back when open source software was still a novelty and the number of open source applications was a number rather than a _theoretical_ number. In today’s world of GitLab and GitHub and Bitbucket (and [many][2] [many][3] more), it’s hardly possible to count the number of open source projects, much less package them up in a repository. No Linux distribution today, even [Debian][4] and its formidable group of package maintainers, can claim or hope to have a package for every installable open source project. + +Of course, a Linux package doesn’t have to be in a repository to be installable. Any programmer can package up their software and distribute it from their own website. However, because repositories are seen as an integral part of a distribution, there isn’t a universal packaging format, meaning that a programmer must decide whether to release a `.deb` or `.rpm`, or an AUR build script, or a Nix or Guix package, or a Homebrew script, or just a mostly-generic `.tgz` archive for `/opt`. It’s overwhelming for a developer who lives and breathes Linux every day, much less for a developer just trying to make a best-effort attempt at supporting a free and open source target. + +### Why Flatpak? + +The Flatpak project provides a universal packaging format along with a decentralized means of distribution, plus portability, and sandboxing. + + * **Universal** Install the Flatpak system, and you can run Flatpaks, regardless of your distribution. No daemon or systemd required. The same Flatpak runs on Fedora, Ubuntu, Mageia, Pop OS, Arch, Slackware, and more. + * **Decentralized** Developers can create and sign their own Flatpak packages and repositories. There’s no repository to petition in order to get a package included. + * **Portability** If you have a Flatpak on your system and want to hand it to a friend so they can run the same application, you can export the Flatpak to a USB thumbdrive. + * **Sandboxed** Flatpaks use a container-based model, allowing multiple versions of libraries and applications to exist on one system. Yes, you can easily install the latest version of an app to test out while maintaining the old version you rely on. + + + +### Building a Flatpak + +To build a Flatpak, you must first install Flatpak (the subsystem that enables you to use Flatpak packages) and the Flatpak-builder application. + +On Fedora, CentOS, RHEL, and similar: + + +``` +`$ sudo dnf install flatpak flatpak-builder` +``` + +On Debian, Ubuntu, and similar: + + +``` +`$ sudo apt install flatpak flatpak-builder` +``` + +You must also install the development tools required to build the application you are packaging. By nature of developing the application you’re now packaging, you may already have a development environment installed, so you might not notice that these components are required, but should you start building Flatpaks with Jenkins or from inside containers, then you must ensure that your build tools are a part of your toolchain. + +For the first example build, this article assumes that your application uses [GNU Autotools][5], but Flatpak itself supports other build systems, such as `cmake`, `cmake-ninja`, `meson`, `ant`, as well as custom commands (a `simple` build system, in Flatpak terminology, but by no means does this imply that the build itself is actually simple). + +#### Project directory + +Unlike the strict RPM build infrastructure, Flatpak doesn’t impose a project directory structure. I prefer to create project directories based on the **dist** packages of software, but there’s no technical reason you can’t instead integrate your Flatpak build process with your source directory. It is technically easier to build a Flatpak from your **dist** package, though, and it’s an easier demo too, so that’s the model this article uses. Set up a project directory for GNU Hello, serving as your first Flatpak: + + +``` +$ mkdir hello_flatpak +$ mkdir src +``` + +Download your distributable source. For this example, the source code is located at `https://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz`. + + +``` +$ cd hello_flatpak +$ wget +``` + +#### Manifest + +A Flatpak is defined by a manifest, which describes how to build and install the application it is delivering. A manifest is atomic and reproducible. A Flatpak exists in a “sandbox” container, though, so the manifest is based on a mostly empty environment with a root directory call `/app`. + +The first two attributes are the ID of the application you are packaging and the command provided by it. The application ID must be unique to the application you are packaging. The canonical way of formulating a unique ID is to use a triplet value consisting of the entity responsible for the code followed by the name of the application, such as `org.gnu.Hello`. The command provided by the application is whatever you type into a terminal to run the application. This does not imply that the application is intended to be run from a terminal instead of a `.desktop` file in the Activities or Applications menu. + +In a file called `org.gnu.Hello.yaml`, enter this text: + + +``` +id: org.gnu.Hello +command: hello +``` + +A manifest can be written in [YAML][6] or in JSON. This article uses YAML. + +Next, you must define each “module” delivered by this Flatpak package. You can think of a module as a dependency or a component. For GNU Hello, there is only one module: GNU Hello. More complex applications may require a specific library or another application entirely. + + +``` +modules: +  - name: hello +    buildsystem: autotools +    no-autogen: true +    sources: +      - type: archive +        path: src/hello-2.10.tar.gz +``` + +The `buildsystem` value identifies how Flatpak must build the module. Each module can use its own build system, so one Flatpak can have several build systems defined. + +The `no-autogen` value tells Flatpak not to run the setup commands for `autotools`, which aren’t necessary because the GNU Hello source code is the product of `make dist`. If the code you’re building isn’t in a easily buildable form, then you may need to install `autogen` and `autoconf` to prepare the source for `autotools`. This option doesn’t apply at all to projects that don’t use `autotools`. + +The `type` value tells Flatpak that the source code is in an archive, which triggers the requisite unarchival tasks before building. The `path` points to the source code. In this example, the source exists in the `src` directory on your local build machine, but you could instead define the source as a remote location: + + +``` +modules: +  - name: hello +    buildsystem: autotools +    no-autogen: true +    sources: +      - type: archive +        url: +``` + +Finally, you must define the platform required for the application to run and build. The Flatpak maintainers supply runtimes and SDKs that include common libraries, including `freedesktop`, `gnome`, and `kde`. The basic requirement is the `freedesk` runtime and SDK, although this may be superseded by GNOME or KDE, depending on what your code needs to run. For this GNU Hello example, only the basics are required. + + +``` +runtime: org.freedesktop.Platform +runtime-version: '18.08' +sdk: org.freedesktop.Sdk +``` + +The entire GNU Hello flatpak manifest: + + +``` +id: org.gnu.Hello +runtime: org.freedesktop.Platform +runtime-version: '18.08' +sdk: org.freedesktop.Sdk +command: hello +modules: +  - name: hello +    buildsystem: autotools +    no-autogen: true +    sources: +      - type: archive +        path: src/hello-2.10.tar.gz +``` + +#### Building a Flatpak + +Now that the package is defined, you can build it. The build process prompts Flatpak-builder to parse the manifest and to resolve each requirement: it ensures that the necessary Platform and SDK are available (if they aren’t, then you’ll have to install them with the `flatpak` command), it unarchives the source code, and executes the `buildsystem` specified. + +The command to start: + + +``` +`$ flatpak-builder build-dir org.gnu.Hello.yaml` +``` + +The directory `build-dir` is created if it does not already exist. The name `build-dir` is arbitrary; you could call it `build` or `bld` or `penguin`, and you can have more than one build destination in the same project directory. However, the term `build-dir` is a frequent value used in documentation, so using it as the literal value can be helpful. + +#### Testing your application + +You can test your application before or after it has been built by running the build command along with the `--run` option, and endingi the command with the command provided by the Flatpak: + + +``` +$ flatpak-builder --run build-dir \ +org.gnu.Hello.yaml hello +Hello, world! +``` + +### Packaging GUI apps with Flatpak + +Packaging up a simple self-contained _hello world_ application is trivial, and fortunately packaging up a GUI application isn’t much harder. The most difficult applications to package are those that don’t rely on common libraries and frameworks (in the context of packaging, “common” means anything _not_ already packaged by someone else). The Flatpak community provides SDKs and SDK Extensions for many components you might otherwise have had to package yourself. For instance, when packaging the pure Java implementation of `pdftk`, I use the OpenJDK SDK extension I found in the Flatpak Github repository: + + +``` +runtime: org.freedesktop.Platform +runtime-version: '18.08' +sdk: org.freedesktop.Sdk +sdk-extensions: + - org.freedesktop.Sdk.Extension.openjdk11 +``` + +The Flatpak community does a lot of work on the foundations required for applications to run upon in order to make the packaging process easy for developers. For instance, the Kblocks game from the KDE community requires the KDE platform to run, and that’s already available from Flatpak. The additional `libkdegames` library is not included, but it’s as easy to add it to your list of `modules` as `kblocks` itself. + +Here’s a manifest for the Kblocks game: + + +``` +id: org.kde.kblocks +command: kblocks +modules: +\- buildsystem: cmake-ninja +  name: libkdegames +  sources: +    type: archive +    path: src/libkdegames-19.08.2.tar.xz +\- buildsystem: cmake-ninja +  name: kblocks +  sources: +    type: archive +    path: src/kblocks-19.08.2.tar.xz +runtime: org.kde.Platform +runtime-version: '5.13' +sdk: org.kde.Sdk +``` + +As you can see, the manifest is still straight-forward and relatively intuitive. The build system is different, and the runtime and SDK point to KDE instead of the Freedesktop, but the structure and requirements are basically the same. + +Because it’s a GUI application, however, there are some new options required. First, it needs an icon so that when it’s listed in the Activities or Application menu, it looks nice and recognizable. Kblocks includes an icon in its sources, but the names of files exported by a Flatpak must be prefixed using the application ID (such as `org.kde.Kblocks.desktop`). The easiest way to do this is to rename the file directly in the application source, which Flatpak can do for you as long as you include this directive in your manifest: + + +``` +`rename-icon: kblocks` +``` + +Another unique trait of GUI applications is that they often require integration with common desktop services, like the graphics server (X11 or Wayland) itself, a sound server such as [Pulse Audio][7], and the Inter-Process Communication (IPC) subsystem. + +In the case of Kblocks, the requirements are: + + +``` +finish-args: +\- --share=ipc +\- --socket=x11 +\- --socket=wayland +\- --socket=pulseaudio +\- --device=dri +\- --filesystem=xdg-config/kdeglobals:ro +``` + +Here’s the final, complete manifest, using URLs for the sources so you can try this on your own system easily: + + +``` +command: kblocks +finish-args: +\- --share=ipc +\- --socket=x11 +\- --socket=wayland +\- --socket=pulseaudio +\- --device=dri +\- --filesystem=xdg-config/kdeglobals:ro +id: org.kde.kblocks +modules: +\- buildsystem: cmake-ninja +  name: libkdegames +  sources: +  - sha256: 83456cec44502a1f79c0be00c983090e32fd8aea5fec1461fbfbd37b5f8866ac +    type: archive +    url: +\- buildsystem: cmake-ninja +  name: kblocks +  sources: +  - sha256: 8b52c949e2d446a4ccf81b09818fc90234f2f55d8722c385491ee67e1f2abf93 +    type: archive +    url: +rename-icon: kblocks +runtime: org.kde.Platform +runtime-version: '5.13' +sdk: org.kde.Sdk +``` + +To build the application, you must have the KDE Platform and SDK Flatpaks (version 5.13 as of this writing) installed. Once the application has been built, you can run it using the `--run` method, but to see the application icon, you must install it. + +#### Distributing and installing a Flatpak you have built + +Distributing flatpaks happen through repositories. + +You can list your apps on [Flathub.org][8], a community website meant as a _technically_ decentralised (but central in spirit) location for Flatpaks. To submit your Flatpak, [place your manifest into a Git repository][9] and [submit a pull request on Github][10]. + +Alternately, you can create your own repository using the `flatpak build-export` command. + +You can also just install locally: + + +``` +`$ flatpak-builder --force-clean --install build-dir org.kde.Kblocks.yaml` +``` + +Once installed, open your Activities or Applications menu and search for Kblocks. + +![The Activities menu in GNOME][11] + +### Learning more + +The [Flatpak documentation site][12] has a good walkthrough on building your first Flatpak. It’s worth reading even if you’ve followed along with this article. Besides that, the docs provide details on what Platforms and SDKs are available. + +For those who enjoy learning from examples, there are manifests for _every application_ available on [Flathub][13]. + +The resources to build and use Flatpaks are plentiful, and Flatpak, along with containers and sandboxed apps, are arguably [the future][14], so get familiar with them, start integrating them with your Jenkins pipelines, and enjoy easy and universal Linux app packaging. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-build-flatpak-packaging + +作者:[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/flatpak-lead-image.png?itok=J93RG_fi +[2]: http://notabug.org +[3]: http://savannah.nongnu.org/ +[4]: http://debian.org +[5]: https://opensource.com/article/19/7/introduction-gnu-autotools +[6]: https://www.redhat.com/sysadmin/yaml-tips +[7]: https://opensource.com/article/17/1/linux-plays-sound +[8]: http://flathub.org +[9]: https://opensource.com/resources/what-is-git +[10]: https://opensource.com/life/16/3/submit-github-pull-request +[11]: https://opensource.com/sites/default/files/gnome-activities-kblocks.jpg (The Activities menu in GNOME) +[12]: http://docs.flatpak.org/en/latest/introduction.html +[13]: https://github.com/flathub +[14]: https://silverblue.fedoraproject.org/ From b9b5e8824fb3a8cc3499c7ef4d3f786b1addddcd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 01:02:48 +0800 Subject: [PATCH 075/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191021=20Pylint?= =?UTF-8?q?:=20Making=20your=20Python=20code=20consistent?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191021 Pylint- Making your Python code consistent.md --- ...int- Making your Python code consistent.md | 101 ++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 sources/tech/20191021 Pylint- Making your Python code consistent.md diff --git a/sources/tech/20191021 Pylint- Making your Python code consistent.md b/sources/tech/20191021 Pylint- Making your Python code consistent.md new file mode 100644 index 0000000000..7ed967472f --- /dev/null +++ b/sources/tech/20191021 Pylint- Making your Python code consistent.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pylint: Making your Python code consistent) +[#]: via: (https://opensource.com/article/19/10/python-pylint-introduction) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Pylint: Making your Python code consistent +====== +Pylint is your friend when you want to avoid arguing about code +complexity. +![OpenStack source code \(Python\) in VIM][1] + +Pylint is a higher-level Python style enforcer. While [flake8][2] and [black][3] will take care of "local" style: where the newlines occur, how comments are formatted, or find issues like commented out code or bad practices in log formatting. + +Pylint is extremely aggressive by default. It will offer strong opinions on everything from checking if declared interfaces are actually implemented to opportunities to refactor duplicate code, which can be a lot to a new user. One way of introducing it gently to a project, or a team, is to start by turning _all_ checkers off, and then enabling checkers one by one. This is especially useful if you already use flake8, black, and [mypy][4]: Pylint has quite a few checkers that overlap in functionality. + +However, one of the things unique to Pylint is the ability to enforce higher-level issues: for example, number of lines in a function, or number of methods in a class. + +These numbers might be different from project to project and can depend on the development team's preferences. However, once the team comes to an agreement about the parameters, it is useful to _enforce_ those parameters using an automated tool. This is where Pylint shines. + +### Configuring Pylint + +In order to start with an empty configuration, start your `.pylintrc` with + + +``` +[MESSAGES CONTROL] + +disable=all +``` + +This disables all Pylint messages. Since many of them are redundant, this makes sense. In Pylint, a `message` is a specific kind of warning. + +You can check that all messages have been turned off by running `pylint`: + + +``` +`$ pylint ` +``` + +In general, it is not a great idea to add parameters to the `pylint` command-line: the best place to configure your `pylint` is the `.pylintrc`. In order to have it do _something_ useful, we need to enable some messages. + +In order to enable messages, add to your `.pylintrc`, under the `[MESSAGES CONTROL]`. + + +``` +enable=<message>, + +       ... +``` + +For the "messages" (what Pylint calls different kinds of warnings) that look useful. Some of my favorites include `too-many-lines`, `too-many-arguments`, and `too-many-branches`. All of those limit complexity of modules or functions, and serve as an objective check, without a human nitpicker needed, for code complexity measurement. + +A _checker_ is a source of _messages_: every message belongs to exactly one checker. Many of the most useful messages are under the [design checker][5]. The default numbers are usually good, but tweaking the maximums is straightfoward: we can add a section called `DESIGN` in the `.pylintrc`. + + +``` +[DESIGN] + +max-args=7 + +max-locals=15 +``` + +Another good source of useful messages is the `refactoring` checker. Some of my favorite messages to enable there are `consider-using-dict-comprehension`, `stop-iteration-return` (which looks for generators which use `raise StopIteration` when `return` is the correct way to stop the iteration). and `chained-comparison`, which will suggest using syntax like `1 <= x < 5` rather than the less obvious `1 <= x && 5 > 5` + +Finally, an expensive checker, in terms of performance, but highly useful, is `similarities`. It is designed to enforce "Don't Repeat Yourself" (the DRY principle) by explicitly looking for copy-paste between different parts of the code. It only has one message to enable: `duplicate-code`. The default "minimum similarity lines" is set to `4`. It is possible to set it to a different value using the `.pylintrc`. + + +``` +[SIMILARITIES] + +min-similarity-lines=3 +``` + +### Pylint makes code reviews easy + +If you are sick of code reviews where you point out that a class is too complicated, or that two different functions are basically the same, add Pylint to your [Continuous Integration][6] configuration, and only have the arguments about complexity guidelines for your project _once_. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/python-pylint-introduction + +作者:[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/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM) +[2]: https://opensource.com/article/19/5/python-flake8 +[3]: https://opensource.com/article/19/5/python-black +[4]: https://opensource.com/article/19/5/python-mypy +[5]: https://pylint.readthedocs.io/en/latest/technical_reference/features.html#design-checker +[6]: https://opensource.com/business/15/7/six-continuous-integration-tools From dec17a51471f464ac6d356a70ea7937feabd500f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 01:04:58 +0800 Subject: [PATCH 076/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191021=20Enterp?= =?UTF-8?q?rises=20find=20new=20uses=20for=20mainframes:=20blockchain=20an?= =?UTF-8?q?d=20containerized=20apps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191021 Enterprises find new uses for mainframes- blockchain and containerized apps.md --- ...ames- blockchain and containerized apps.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/talk/20191021 Enterprises find new uses for mainframes- blockchain and containerized apps.md diff --git a/sources/talk/20191021 Enterprises find new uses for mainframes- blockchain and containerized apps.md b/sources/talk/20191021 Enterprises find new uses for mainframes- blockchain and containerized apps.md new file mode 100644 index 0000000000..540e09df54 --- /dev/null +++ b/sources/talk/20191021 Enterprises find new uses for mainframes- blockchain and containerized apps.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Enterprises find new uses for mainframes: blockchain and containerized apps) +[#]: via: (https://www.networkworld.com/article/3446140/enterprises-find-a-new-use-for-mainframes-blockchain-and-containerized-apps.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Enterprises find new uses for mainframes: blockchain and containerized apps +====== +Blockchain and containerized microservices can benefit from the mainframe’s integrated security and massive parallelization capabilities. +Thinkstock + +News flash: Mainframes still aren't dead. + +On the contrary, mainframe use is increasing, and not to run COBOL, either. Mainframes are being eyed for modern technologies including blockchain and containers. + +A survey of 153 IT decision makers found that 50% of organizations will continue with the mainframe and increase its use over the next two years, while just 5% plan to decrease or remove mainframe activity. The survey was conducted by Forrester Research and commissioned by Ensono, a hybrid IT services provider, and Wipro Limited, a global IT consulting services company. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +**READ MORE:** [Data center workloads become more complex despite promises to the contrary][2] + +That kind of commitment to the mainframe is a bit of a surprise, given the trend to reduce or eliminate the on-premises data center footprint and move to the cloud. However, enterprises are now taking a hybrid approach to their infrastructure, migrating some applications to the cloud while keeping the most business-critical applications on-premises and on mainframes. + +Forrester's research found mainframes continue to be considered a critical piece of infrastructure for the modern business – and not solely to run old technologies. Of course, traditional enterprise applications and workloads remain firmly on the mainframe, with 48% of ERP apps, 45% of finance and accounting apps, 44% of HR management apps, and 43% of ECM apps staying on mainframes. + +But that's not all. Among survey respondents, 25% said that mobile sites and applications were being put into the mainframe, and 27% said they're running new blockchain initiatives and containerized applications. Blockchain and containerized applications benefit from the integrated security and massive parallelization inherent in a mainframe, Forrester said in its report. + +"We believe this research challenges popular opinion that mainframe is for legacy," said Brian Klingbeil, executive vice president of technology and strategy at Ensono, in a statement. "Mainframe modernization is giving enterprises not only the ability to continue to run their legacy applications, but also allows them to embrace new technologies such as containerized microservices, blockchain and mobile applications." + +Wipro's Kiran Desai, senior vice president and global head of cloud and infrastructure services, added that enterprises should adopt two strategies to take full advantage of mainframes. The first is to refactor applications to take advantage of cloud, while the second is to adopt DevOps to modernize mainframes. + +**Learn more about mixing cloud and on-premises workloads** + + * [5 times when cloud repatriation makes sense][3] + * [Network monitoring in the hybrid cloud/multi-cloud era][4] + * [Data center workloads become more complex][2] + * [The benefits of mixing private and public cloud services][5] + + + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446140/enterprises-find-a-new-use-for-mainframes-blockchain-and-containerized-apps.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/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.networkworld.com/article/3400086/data-center-workloads-become-more-complex-despite-promises-to-the-contrary.html +[3]: https://www.networkworld.com/article/3388032/5-times-when-cloud-repatriation-makes-sense.html +[4]: https://www.networkworld.com/article/3398482/network-monitoring-in-the-hybrid-cloudmulti-cloud-era.html +[5]: https://www.networkworld.com/article/3233132/what-is-hybrid-cloud-computing.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From f931f09b1af201be3565ebec961b129e2a70e254 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 01:05:33 +0800 Subject: [PATCH 077/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191021=20Tokala?= =?UTF-8?q?bs=20Software=20Defined=20Labs=20automates=20configuration=20of?= =?UTF-8?q?=20lab=20test-beds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191021 Tokalabs Software Defined Labs automates configuration of lab test-beds.md --- ...utomates configuration of lab test-beds.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/talk/20191021 Tokalabs Software Defined Labs automates configuration of lab test-beds.md diff --git a/sources/talk/20191021 Tokalabs Software Defined Labs automates configuration of lab test-beds.md b/sources/talk/20191021 Tokalabs Software Defined Labs automates configuration of lab test-beds.md new file mode 100644 index 0000000000..1213813bf8 --- /dev/null +++ b/sources/talk/20191021 Tokalabs Software Defined Labs automates configuration of lab test-beds.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tokalabs Software Defined Labs automates configuration of lab test-beds) +[#]: via: (https://www.networkworld.com/article/3446816/tokalabs-software-defined-labs-automates-configuration-of-lab-test-beds.html) +[#]: author: (Linda Musthaler https://www.networkworld.com/author/Linda-Musthaler/) + +Tokalabs Software Defined Labs automates configuration of lab test-beds +====== +The primary challenge of running a test lab is the amount of time it takes to provision the test beds within the lab. This software defined lab platform automates the setup and configuration process so that tests can be accelerated. +7Postman / Getty Images + +Network environments have become so complex that companies such as systems integrators, equipment manufacturers and enterprise organizations feel compelled to test their configurations and equipment in lab environments before deployment. Performance test labs are used extensively for quality, proof of concept, customer support, and technical sales initiatives. Labs are the perfect place to see how well something performs before it’s put into a production environment. + +The primary challenge of running a test lab is the amount of time it takes to provision the test environments. A network lab infrastructure might include switches, routers, servers, [virtual machines][1] running on various server clusters, security services, cloud resources, software and so on. It takes considerable time to wire the configurations, physically build the desired test beds, login to each individual device and load the proper software configurations. Quite often, lab staffers spend more time on setup than they do on conducting actual tests. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +This is a problem that the networking company Allied Telesis was having in building test beds for its own development engineers. The company developed an application for internal use that would ease the setup and reconfiguration problem. The equipment could be physically cabled once and then configured and controlled centrally through software. The application worked so well that Allied Telesis spun it off for others to use, and this is the origin of [Tokalabs Software Defined Labs][3] (SDL) technology. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Tokalabs provides a platform that enables engineers to manage a lab-network infrastructure and create sandboxes or topologies that can be used for R&D, product development and quality testing, customer support, sales demos, competitive benchmarking, driving proof of concept efforts, etc. There’s an automation sequencer built into the platform that allows users to automate test cases, sales demos, troubleshooting methods, image upgrades and the like.  + +The Tokalabs SDL controller is a virtual appliance that can be imported into any virtualization environment. Once installed, the customer can access the controller’s UI using a web browser. The controller has an auto-discovery mechanism that inventories everything within a specified range of IP addresses, including cloud resources. + +Tokalabs probes the addresses to figure out what ports are open on them, what management types are supported, and the vendor information of the devices. This results in an inventory of hundreds of devices that are discovered by the SDL controller. + +On the hardware side, lab engineers only need to cable and configure their lab devices once, which eliminates the cumbersome setup and tear down processes. These devices are abstracted and managed centrally through the SDL controller, which maintains a centralized networking fabric. Lab engineers have full visibility of every physical and virtual device and every public and [private cloud][5] instance within their domain. + +Engineers can use the Tokalabs SDL controller to dynamically create and reserve test-bed resources and then save them as a template for future use. Engineers also can automate and schedule test executions and the controller will release the resources once the tests are done. The controller’s codeless automation feature means users don’t need to know how to write scripts to orchestrate and automate a pretty comprehensive configuration and test scenario. They can use the controller to automate sequences without writing code or instruct the controller to execute external scripts developed by an engineer. + +The automation is helpful to set up a specific configuration quickly. For example, a customer-support engineer might need to replicate a scenario that one of its customers has in order to troubleshoot an issue. Using the controller’s automation feature, devices can be configured and loaded with specific firmware quickly to ease the setup process. + +Tokalabs logs everything that transpires through its controller, so a lab administrator has oversight into how the equipment is being used or what types of tests are being created and executed. This helps with resource capacity planning, to ensure that there is enough equipment without having devices sit idle for too long. + +One leader in cybersecurity became an early adopter of Tokalabs. This vendor has a test lab to conduct comparative benchmark numbers with competitors’ products in order to close large deals and to confirm their product strengths and performance numbers for marketing materials. + +Prior to using the Tokalabs SDL controller, engineering teams would physically cable the topologies, configure the devices and execute various benchmark tests. Then they would tear down that configuration and start all over again for every set of devices and firmware revisions. + +Given that this is a multi-billion-dollar equipment manufacturer, there are a lot of new product releases and updates to existing products. That means there’s a heck of a lot of work for the engineers in the lab to test each product and compare it to competitors’ offerings. They can’t really afford the time spent configuring rather than testing, so they turned to Tokalabs’ technology to manage the lab infrastructure and to automate the configurations and scheduling of test executions. They chose this solution largely for the ease of setup and use. + +Now, each engineer can create hundreds of reusable templates, thus eliminating the repetitive work of creating test beds, and also automate test scripts using the Tokalabs’ automation sequencer. Additionally, all their existing test scripts are available to use through the SDL controller. This has helped the team reduce its backlog and keep up with the product release cycles. + +Beyond this use case for comparative benchmark tests, some of the other uses for Tokalabs SDL include: + + * Creating a portal for others to use lab resources; for example, for training purposes or for customers to test network environments prior to purchasing them + * Doing sales demonstrations and customer PoCs in order to showcase a feature, an application, or even an entire configuration + * Automating bringing up virtualized environments + + + +Tokalabs claims to work closely with its customers to tailor the Software Defined Labs platform to specific use cases and customer needs. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446816/tokalabs-software-defined-labs-automates-configuration-of-lab-test-beds.html + +作者:[Linda Musthaler][a] +选题:[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/Linda-Musthaler/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3234795/what-is-virtualization-definition-virtual-machine-hypervisor.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://tokalabs.com/ +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/2159885/cloud-computing-gartner-5-things-a-private-cloud-is-not.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 7dcce363d2db3efc5071089b9f1cc07f283a5179 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 22 Oct 2019 01:07:40 +0800 Subject: [PATCH 078/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191021=20Transi?= =?UTF-8?q?tion=20to=20Nftables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191021 Transition to Nftables.md --- .../tech/20191021 Transition to Nftables.md | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 sources/tech/20191021 Transition to Nftables.md diff --git a/sources/tech/20191021 Transition to Nftables.md b/sources/tech/20191021 Transition to Nftables.md new file mode 100644 index 0000000000..a6b7af0e08 --- /dev/null +++ b/sources/tech/20191021 Transition to Nftables.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Transition to Nftables) +[#]: via: (https://opensourceforu.com/2019/10/transition-to-nftables/) +[#]: author: (Vijay Marcel D https://opensourceforu.com/author/vijay-marcel/) + +Transition to Nftables +====== + +[![][1]][2] + +_Every major distribution in the open source world is moving towards nftables as the default firewall. In short, the venerable Iptables is now dead. This article is a tutorial on how to build nftables._ + +Currently, there is an iptables-nft backend that is compatible with nftables but soon, even this will not be available. Also, as noted by Red Hat developers, sometimes it may translate the rules incorrectly. Rather than rely on an iptables-to-nftables converter, we need to know how to build our own nftables. In nftables, all the address families come under one rule. Nftables runs in the user space unlike iptables, where every module is in the kernel. It also needs less kernel updates and comes with new features such as maps, families and dictionaries. + +**Address families** +Address families determine the types of packets that are processed. There are six address families in nftables and they are: + + * ip + * ipv6 + * inet + * arp + * bridge + * netdev + + + +In nftables, the ipv4 and ipv6 protocols are combined into one single family called inet. So we do not need to specify two rules – one for ipv4 and another for ipv6. If no address family is specified, it will default to ip protocol, i.e., ipv4. Our area of interest lies in the inet family, since most home users will use either ipv4 or ipv6 protocols (see Figure 1). + +**Nftables** +A typical nftable rule contains three parts – table, chain and rules. +Tables are containers for chains and rules. They are identified by their address families and their names. Chains contain the rules needed for the _inet/arp/bridge/netdev_ protocols and are of three types — filter, NAT and route. Nftable rules can be loaded from a script or they can be typed into a terminal and then saved as a rule-set. For home users, the default chain will be filter. The inet family contains the following hooks: + + * Input + * Output + * Forward + * Pre-routing + * Post-routing + + + +**To script or not to script?** +One of the biggest questions is whether we can use a firewall script or not. The answer is: it’s your choice. Here’s some advice – if you have hundreds of rules in your firewall, then it is best to use a script, but if you are a typical home user, then you can type the commands in the terminal and then load your rule-set. Each option has its own advantages and disadvantages. In this article, we will type them in the terminal to build our firewall. + +Nftables uses a program called nft to add, create, list, delete and load rules. Make sure nftables is installed along with conntrackd and netfilter-persistent, and remove iptables, using the following command: + +``` +apt-get install nftables conntrackd netfilter-persistent +apt-get purge iptables +``` + +_nft_ needs to be run as root or use sudo. Use the following commands to list, flush, delete ruleset and load the script respectively. + +``` +nft list ruleset +nft flush ruleset +nft delete table inet filter +/usr/sbin/nft -f /etc/nftables.conf +``` + +**Input policy** +The firewall will contain three parts – input, forward and output – just like in iptables. In the terminal, type the following commands for the input firewall. Make sure you have flushed your rule-set before you begin. Our default policy will be to drop everything. We will use the inet family in the firewall. Add the following rules as root or use sudo: + +``` +nft add table inet filter +nft add chain inet filter input { type filter hook input priority 0 \; counter \; policy drop \; } +``` + +You have noticed there is something called _priority 0_. It means giving the rule higher precedence. Hooks typically give higher precedence to the negative integer. Every hook has its own precedence and the filter chain has priority 0. You can check the nftables wiki page to see the priority of each hook. +To know the network interfaces in your computer, run the following command: + +``` +ip link show +``` + +It will show the installed network interface, one local host and other Ethernet port or your wireless port. Your Ethernet port’s name looks something like this: _enpXsY_ where X and Y are numbers, and the same goes for your wireless port. We have to allow the local host and only allow established incoming connections from the Internet. +Nftables has a feature called verdict statements on how to parse a rule. The verdict statements are _accept, drop, queue, jump, goto, continue_ and _return_. Since the firewall is a simple one, we will use either _accept_ or _drop the packets_ (Figure 2). + +``` +nft add rule inet filter input iifname lo accept +nft add rule inet filter input iifname enpXsY ct state new, established, related accept +``` + +Next, we have to add rules to protect us from stealth scans. Not all stealth scans are malicious but most of them are. We have to protect the network from such scans. The first set lists the TCP flags to be tested. Of these flags, the second set lists the flags to be matched with the first. + +``` +nft add rule inet filter input iifname enpXsY tcp flags \& \(syn\|fin\) == \(syn\|fin\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(syn\|rst\) == \(syn\|rst\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(fin\|rst\) == \(fin\|rst\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|fin\) == fin drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|psh\) == psh drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|urg\) == urg drop +``` + +Remember, we are typing these commands in the terminal. So we have to add a backslash before some special characters, to make sure the terminal interprets it as it should. If you are using a script, then this isn’t required. + +**A word of caution regarding ICMP** +The Internet Control Message Protocol (ICMP) is a diagnostic tool and so should not be dropped outright. Any attempt to fully block ICMP is unwise as it will also stop giving error messages to us. Enable only the most important control messages such as echo-request, echo-reply, destination-unreachable and time-exceeded, and reject the rest. Echo-request and echo-reply are part of ping. In the input, we only allow echo reply and in the output, we only allow the echo-request. + +``` +nft add rule inet filter input iifname enpXsY icmp type { echo-reply, destination-unreachable, time-exceeded } limit rate 1/second accept +nft add rule inet filter input iifname enpXsY ip protocol icmp drop +``` + +Finally, we are logging and dropping all the invalid packets. + +``` +nft add rule inet filter input iifname enpXsY ct state invalid log flags all level info prefix \”Invalid-Input: \” +nft add rule inet filter input iifname enpXsY ct state invalid drop +``` + +**Forward and output policy** +In both the forward and output policies, we will drop packets by default and only accept those that are established connections. + +``` +nft add chain inet filter forward { type filter hook forward priority 0 \; counter \; policy drop \; } +nft add rule inet filter forward ct state established, related accept +nft add rule inet filter forward ct state invalid drop +nft add chain inet filter output { type filter hook output priority 0 \; counter \; policy drop \; } +``` + +A typical desktop user needs only Port 80 and 443 to be allowed to access the Internet. Finally, allow acceptable ICMP protocols and drop the invalid packets while logging them. + +``` +nft add rule inet filter output oifname enpXsY tcp dport { 80, 443 } ct state established accept +nft add rule inet filter output oifname enpXsY icmp type { echo-request, destination-unreachable, time-exceeded } limit rate 1/second accept +nft add rule inet filter output oifname enpXsY ip protocol icmp drop +nft add rule inet filter output oifname enpXsY ct state invalid log flags all level info prefix \”Invalid-Output: \” +nft add rule inet filter output oifname enpXsY ct state invalid drop +``` + +Now we have to save our rule-set, otherwise it will be lost when we reboot. To do so, run the following command: + +``` +sudo nft list ruleset. > /etc/nftables.conf +``` + +We now have to load nftables at boot, for that enables the nftables service in systemd: + +``` +sudo systemctl enable nftables +``` + +Next, edit the nftables unit file to remove the Execstop option to avoid flushing the rule-set at every boot. The file is usually located in /etc/systemd/system/sysinit.target.wants/nftables.service. Now restart the nftables: + +``` +sudo systemctl restart nftables +``` + +**Logging in rsyslog** +When you log the dropped packets, they go straight to _syslog_, which makes reading your log file quite difficult. It is better to redirect your firewall logs to a separate file. Create a directory called nftables in +_/var/log_ and in it, create two files called _input.log_ and _output.log_ to store the input and output logs, respectively. Make sure rsyslog is installed in your system. Now go to _/etc/rsyslog.d_ and create a file called _nftables.conf_ with the following contents: + +``` +:msg,regex,”Invalid-Input: “ -/var/log/nftables/Input.log +:msg,regex,”Invalid-Output: “ -/var/log/nftables/Output.log +& stop +``` + +Now we have to make sure the log is manageable. For that, create another file in _/etc/logrotate.d_ called nftables with the following code: + +``` +/var/log/nftables/* { rotate 5 daily maxsize 50M missingok notifempty delaycompress compress postrotate invoke-rc.d rsyslog rotate > /dev/null endscript } +``` + +Restart nftables. You can now check your rule-set. If you feel typing each command in the terminal is bothersome, you can use a script to load the nftables firewall. I hope this article is useful in protecting your system. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/transition-to-nftables/ + +作者:[Vijay Marcel D][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/vijay-marcel/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/01/REHfirewall-1.jpg?resize=696%2C481&ssl=1 (REHfirewall) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/01/REHfirewall-1.jpg?fit=900%2C622&ssl=1 From 18ed6524bb24c8e8dcc9d29401bf9d9db6eadc0d Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 22 Oct 2019 08:59:08 +0800 Subject: [PATCH 079/800] translating --- ...riented Programming and Essential State.md | 98 ------------------ ...riented Programming and Essential State.md | 99 +++++++++++++++++++ 2 files changed, 99 insertions(+), 98 deletions(-) delete mode 100644 sources/tech/20191013 Object-Oriented Programming and Essential State.md create mode 100644 translated/tech/20191013 Object-Oriented Programming and Essential State.md diff --git a/sources/tech/20191013 Object-Oriented Programming and Essential State.md b/sources/tech/20191013 Object-Oriented Programming and Essential State.md deleted file mode 100644 index b51c726cdd..0000000000 --- a/sources/tech/20191013 Object-Oriented Programming and Essential State.md +++ /dev/null @@ -1,98 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Object-Oriented Programming and Essential State) -[#]: via: (https://theartofmachinery.com/2019/10/13/oop_and_essential_state.html) -[#]: author: (Simon Arneaud https://theartofmachinery.com) - -Object-Oriented Programming and Essential State -====== - -Back in 2015, Brian Will wrote a provocative blog post: [Object-Oriented Programming: A Disaster Story][1]. He followed it up with a video called [Object-Oriented Programming is Bad][2], which is much more detailed. I recommend taking the time to watch the video, but here’s my one-paragraph summary: - -The Platonic ideal of OOP is a sea of decoupled objects that send stateless messages to one another. No one really makes software like that, and Brian points out that it doesn’t even make sense: objects need to know which other objects to send messages to, and that means they need to hold references to one another. Most of the video is about the pain that happens trying to couple objects for control flow, while pretending that they’re decoupled by design. - -Overall his ideas resonate with my own experiences of OOP: objects can be okay, but I’ve just never been satisfied with object-_orientation_ for modelling a program’s control flow, and trying to make code “properly” object-oriented always seems to create layers of unneccessary complexity. - -There’s one thing I don’t think he explains fully. He says outright that “encapsulation does not work”, but follows it with the footnote “at fine-grained levels of code”, and goes on to acknowledge that objects can sometimes work, and that encapsulation can be okay at the level of, say, a library or file. But he doesn’t explain exactly why it sometimes works and sometimes doesn’t, and how/where to draw the line. Some people might say that makes his “OOP is bad” claim flawed, but I think his point stands, and that the line can be drawn between essential state and accidental state. - -If you haven’t heard this usage of the terms “essential” and “accidental” before, you should check out Fred Brooks’ classic [No Silver Bullet][3] essay. (He’s written many great essays about building software systems, by the way.) I’ve aleady written [my own post about essential and accidential complexity][4] before, but here’s a quick TL;DR: Software is complex. Partly that’s because we want software to solve messy real-world problems, and we call that “essential complexity”. “Accidental complexity” is all the other complexity that exists because we’re trying to use silicon and metal to solve problems that have nothing to do with silicon and metal. For example, code for memory management, or transferring data between RAM and disk, or parsing text formats, is all “accidental complexity” for most programs. - -Suppose you’re building a chat application that supports multiple channels. Messages can arrive for any channel at any time. Some channels are especially interesting and the user wants to be notified or pinged when a new message comes in. Other channels are muted: the message is stored, but the user isn’t interrupted. You need to keep track of the user’s preferred setting for each channel. - -One way to do it is to use a map (a.k.a, hash table, dictionary or associative array) between the channels and channel settings. Note that a map is the kind of abstract data type (ADT) that Brian Will said can work as an object. - -If we get a debugger and look inside the map object in memory, what will we see? We’ll find channel IDs and channel settings data of course (or pointers to them, at least). But we’ll also find other data. If the map is implemented using a red-black tree, we’ll see tree node objects with red/black labels and pointers to other nodes. The channel-related data is the essential state, and the tree nodes are the accidental state. Notice something, though: The map effectively encapsulates its accidental state — you could replace the map with another one implemented using AVL trees and your chat app would still work. On the other hand, the map doesn’t encapsulate the essential state (simply using `get()` and `set()` methods to access data isn’t encapsulation). In fact, the map is as agnostic as possible about the essential state — you could use basically the same map data structure to store other mappings unrelated to channels or notifications. - -And that’s why the map ADT is so successful: it encapsulates accidental state and is decoupled from essential state. If you think about it, the problems that Brian describes with encapsulation are problems with trying to encapsulate essential state. The benefits that others describe are benefits from encapsulating accidental state. - -It’s pretty hard to make entire software systems meet this ideal, but scaling up, I think it looks something like this: - - * No global, mutable state - * Accidental state encapsulated (in objects or modules or whatever) - * Stateless accidental complexity enclosed in free functions, decoupled from data - * Inputs and outputs made explicit using tricks like dependency injection - * Components fully owned and controlled from easily identifiable locations - - - -Some of this goes against instincts I had a long time ago. For example, if you have a function that makes a database query, the interface looks simpler and nicer if the database connection handling is hidden inside the function, and the only parameters are the query parameters. However, when you build a software system out of functions like this, it actually becomes more complex to coordinate the database usage. Not only are the components doing things their own ways, they’re trying to hide what they’re doing as “implementation details”. The fact that a database query requires a database connection never was an implementation detail. If something can’t be hidden, it’s saner to make it explicit. - -I’m wary of feeding the OOP and functional programming false dichotomy, but I think it’s interesting that FP goes to the opposite extreme of OOP: OOP tries to encapsulate things, including the essential complexity that can’t be encapsulated, while pure FP tends to make things explicit, including some accidental complexity. Most of the time, that’s the safer side to go wrong, but sometimes (such as when [building self-referential data structures in a purely functional language][5]) you can get designs that are more for the sake of FP than for the sake of simplicity (which is why [Haskell includes some escape hatches][6]). I’ve written before about [the middle ground of so-called “weak purity”][7]. - -Brian found that encapsulation works at a larger scale for a couple of reasons. One is that larger components are simply more likely to contain accidental state, just because of size. Another is that what’s “accidental” is relative to what problem you’re solving. From the chat app user’s point of view, “accidental complexity” is anything unrelated to messages and channels and users, etc. As you break the problems into subproblems, however, more things become essential. For example, the mapping between channel names and channel IDs is arguably accidental complexity when solving the “build a chat app” problem, but it’s essential complexity when solving the “implement the `getChannelIdByName()` function” subproblem. So, encapsulation tends to be less useful for subcomponents than supercomponents. - -By the way, at the end of his video, Brian Will wonders if any language supports anonymous functions that _can’t_ access they scope they’re in. [D][8] does. Anonymous lambdas in D are normally closures, but anonymous stateless functions can also be declared if that’s what you want: - -``` -import std.stdio; - -void main() -{ - int x = 41; - - // Value from immediately executed lambda - auto v1 = () { - return x + 1; - }(); - writeln(v1); - - // Same thing - auto v2 = delegate() { - return x + 1; - }(); - writeln(v2); - - // Plain functions aren't closures - auto v3 = function() { - // Can't access x - // Can't access any mutable global state either if also marked pure - return 42; - }(); - writeln(v3); -} -``` - --------------------------------------------------------------------------------- - -via: https://theartofmachinery.com/2019/10/13/oop_and_essential_state.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://medium.com/@brianwill/object-oriented-programming-a-personal-disaster-1b044c2383ab -[2]: https://www.youtube.com/watch?v=QM1iUe6IofM -[3]: http://www.cs.nott.ac.uk/~pszcah/G51ISS/Documents/NoSilverBullet.html -[4]: https://theartofmachinery.com/2017/06/25/compression_complexity_and_software.html -[5]: https://wiki.haskell.org/Tying_the_Knot -[6]: https://en.wikibooks.org/wiki/Haskell/Mutable_objects#The_ST_monad -[7]: https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html -[8]: https://dlang.org diff --git a/translated/tech/20191013 Object-Oriented Programming and Essential State.md b/translated/tech/20191013 Object-Oriented Programming and Essential State.md new file mode 100644 index 0000000000..caacee3372 --- /dev/null +++ b/translated/tech/20191013 Object-Oriented Programming and Essential State.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Object-Oriented Programming and Essential State) +[#]: via: (https://theartofmachinery.com/2019/10/13/oop_and_essential_state.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +面向对象编程和根本状态 +====== + +早在 2015 年,Brian Will 撰写了一篇有挑衅性的博客:[面向对象编程:一个灾难故事][1]。他随后发布了一个名为[面向对象编程很糟糕][2]的视频,该视频更加详细。我建议你花些时间观看视频,但这是我的一小段摘要: + +OOP 的柏拉图式理想是一堆相互解耦的对象,它们彼此之间发送无状态消息。没有人真的像这样制作软件,Brian 指出这甚至没有意义:对象需要知道向哪个对象发送消息,这意味着它们需要相互引用。视频大部分讲述的是人们试图将对象耦合以实现控制流,同时假装它们是通过设计解耦的。 + +总的来说,他的想法与我自己的 OOP 经验产生了共鸣:对象没有问题,但是我从来没有对_面向_对象建立程序控制流满意,而试图使代码“正确地”面向对象似乎总是在创建不必要的复杂性。 + +我认为他无法完全解释一件事。他直截了当地说“封装没有作用”,但在脚注后面加上“在细粒度的代码级别”,并继续承认对象有时可以奏效,并且在库和文件级别可以封装。但是他没有确切解释为什么有时会奏效,有时却没有奏效,以及如何/在何处划清界限。有人可能会说这使他的“ OOP不好”的说法有缺陷,但是我认为他的观点是正确的,并且可以在根本状态和偶发状态之间划清界限。 + +如果你以前从未听说过“根本”和“偶发”这两个术语的使用,那么你应该阅读 Fred Brooks 的经典文章[没有银弹][3]。 (顺便说一句,他写了许多有关构建软件系统的很棒的文章。)我以前曾写过[关于根本和偶发的复杂性的文章][4],但是这里有一个简短的摘要:软件很复杂。部分原因是因为我们希望软件能够解决混乱的现实世界问题,因此我们将其称为“根本复杂性”。“偶发复杂性”是所有其他复杂性,因为我们正尝试使用硅和金属来解决与硅和金属无关的问题。例如,对于大多数程序而言,用于内存管理或在内存与磁盘之间传输数据或解析文本格式的代码都是“偶发的复杂性”。 + +假设你正在构建一个支持多个频道的聊天应用。消息可以随时到达任何频道。有些频道特别有趣,当有新消息传入时,用户希望得到通知。其他频道静音:消息被存储,但用户不会受到打扰。你需要跟踪每个频道的用户首选设置。 + +一种实现方法是在频道和频道设置之间使用映射(也称为哈希表,字典或关联数组)。注意,映射是 Brian Will 所说的可以用作对象的抽象数据类型(ADT)。 + +如果我们有一个调试器并查看内存中的 map 对象,我们将看到什么?我们当然会找到频道 ID 和频道设置数据(或至少指向它们的指针)。但是我们还会找到其他数据。如果 map 是使用红黑树实现的,我们将看到带有红/黑标签和指向其他节点的指针的树节点对象。与频道相关的数据是根本状态,而树节点是偶发状态。不过,请注意以下几点:该映射有效地封装了它的偶发状态-你可以用 AVL 树实现的另一个映射替换该映射,并且你的聊天程序仍然可以使用。另一方面,映射没有封装根本状态(仅使用 `get()` 和 `set()`方法访问数据不是封装)。事实上,映射与根本状态是尽可能不可知的,你可以使用基本相同的映射数据结构来存储与频道或通知无关的其他映射。 + + +这就是映射 ADT 如此成功的原因:它封装了偶发状态,并与根本状态解耦。如果你考虑一下,Brian 描述的封装问题就是尝试封装根本状态。其他描述的好处是封装偶发状态的好处。 + +要使整个软件系统都达到这一理想相当困难,但扩展开来,我认为它看起来像这样: + + * 没有全局的可变状态 + * 封装了偶发状态(在对象或模块或以其他任何形式) + * 无状态偶发复杂性封装在单独函数中,与数据解耦 + * 使用诸如依赖注入之类的技巧使输入和输出变得明确 + * 完全拥有组件,并从易于识别的位置进行控制 + + + +其中有些违反了我很久以前的本能。例如,如果你有一个数据库查询函数,如果数据库连接处理隐藏在该函数内部,并且唯一的参数是查询参数,那么接口会看起来会更简单。但是,当你使用这样的函数构建软件系统时,协调数据库的使用实际上变得更加复杂。组件不仅以自己的方式做事,而且还试图将自己所做的事情隐藏为“实现细节”。数据库查询需要数据库连接这一事实从来都不是实现细节。如果无法隐藏某些内容,那么显露它是更合理的。 + +我警惕将面向对象编程和函数式编程放在两极,但我认为从函数式编程进入面向对象编程的另一极端是很有趣的:OOP 试图封装事物,包括无法封装的根本复杂性,而纯函数式编程往往会使事情变得明确,包括一些偶发复杂性。在大多数时候,没什么问题,但有时候(比如[在纯函数式语言中构建自我指称的数据结构][5])设计更多的是为了函数编程,而不是为了简便(这就是为什么 [Haskell 包含了一些“逃生出口”( escape hatches)][6])。我之前写过一篇[中立的所谓的“弱纯性” (weak purity)][7] + +Brian 发现封装对更大规模有效,原因有几个。一个是,由于大小的原因,较大的组件更可能包含偶发状态。另一个是“偶发”与你要解决的问题有关。从聊天程序用户的角度来看,“偶发的复杂性”是与消息,频道和用户等无关的任何事物。但是,当你将问题分解为子问题时,更多的事情就变得重要。例如,在解决“构建聊天应用”问题时,可以说频道名称和频道 ID 之间的映射是偶发的复杂性,而在解决“实现 `getChannelIdByName()` 函数”子问题时,这是根本复杂性。因此,封装对于子组件的作用比对父组件的作用要小。 + +顺便说一句,在影片的结尾,Brian Will 想知道是否有任何语言支持_无法_访问它们所作用的范围的匿名函数。[D][8] 语言可以。 D 中的匿名 Lambda 通常是闭包,但是如果你想要的话,也可以声明匿名无状态函数: + +``` +import std.stdio; + +void main() +{ + int x = 41; + + // Value from immediately executed lambda + auto v1 = () { + return x + 1; + }(); + writeln(v1); + + // Same thing + auto v2 = delegate() { + return x + 1; + }(); + writeln(v2); + + // Plain functions aren't closures + auto v3 = function() { + // Can't access x + // Can't access any mutable global state either if also marked pure + return 42; + }(); + writeln(v3); +} +``` + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2019/10/13/oop_and_essential_state.html + +作者:[Simon Arneaud][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://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://medium.com/@brianwill/object-oriented-programming-a-personal-disaster-1b044c2383ab +[2]: https://www.youtube.com/watch?v=QM1iUe6IofM +[3]: http://www.cs.nott.ac.uk/~pszcah/G51ISS/Documents/NoSilverBullet.html +[4]: https://theartofmachinery.com/2017/06/25/compression_complexity_and_software.html +[5]: https://wiki.haskell.org/Tying_the_Knot +[6]: https://en.wikibooks.org/wiki/Haskell/Mutable_objects#The_ST_monad +[7]: https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html +[8]: https://dlang.org From 560f53cf26e20435f0e7f6262f58809a92bea230 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 22 Oct 2019 09:08:40 +0800 Subject: [PATCH 080/800] translating --- ...1018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md b/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md index 80bcc96a51..38b8dd2dc7 100644 --- a/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md +++ b/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3ee757137a0e23a2a47c436e56eb42305fbe6543 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 22 Oct 2019 14:35:35 +0800 Subject: [PATCH 081/800] PRF @wxy --- ...aro 18.1 (KDE Edition) with Screenshots.md | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md b/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md index 5b389addd3..31d8a38a88 100644 --- a/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md +++ b/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots) @@ -35,15 +35,15 @@ Manjaro 18.1(KDE)安装图解 #### 步骤 1) 下载 Manjaro 18.1 ISO -在安装之前,你需要从位于 [这里] [1] 的官方下载页面下载 Manjaro 18.1 的最新副本。由于我们这里介绍的是 KDE 版本,因此我们选择 KDE 版本。但是对于所有桌面环境(包括 Xfce、KDE 和 Gnome 版本),安装过程都是相同的。 +在安装之前,你需要从位于 [这里][1] 的官方下载页面下载 Manjaro 18.1 的最新副本。由于我们这里介绍的是 KDE 版本,因此我们选择 KDE 版本。但是对于所有桌面环境(包括 Xfce、KDE 和 Gnome 版本),安装过程都是相同的。 #### 步骤 2) 创建 USB 启动盘 -从 Manjaro 下载页面成功下载 ISO 文件后,就可以创建 USB 磁盘了。将下载的 ISO 文件复制到 USB 磁盘中,然后创建可引导磁盘。确保将你的引导设置更改为使用 USB 引导并重新启动系统。 +从 Manjaro 下载页面成功下载 ISO 文件后,就可以创建 USB 磁盘了。将下载的 ISO 文件复制到 USB 磁盘中,然后创建可引导磁盘。确保将你的引导设置更改为使用 USB 引导,并重新启动系统。 #### 步骤 3) Manjaro Live 版安装环境 -系统重新启动时,它将自动检测到 USB 驱动器并开始启动进入 Manjaro Live 版安装屏幕。 +系统重新启动时,它将自动检测到 USB 驱动器,并开始启动进入 Manjaro Live 版安装屏幕。 ![Boot-Manjaro-18-1-kde-installation][3] @@ -77,14 +77,14 @@ Manjaro 18.1(KDE)安装图解 #### 步骤 8) 选择分区类型 -这是安装过程中非常关键的一步。 它将允许你选择: +这是安装过程中非常关键的一步。 它将允许你选择分区方式: * 擦除磁盘 * 手动分区 * 并存安装 * 替换分区 -如果要在 VM(虚拟机)中安装 Manjaro 18.1,则将看不到最后两个选项。 +如果在 VM(虚拟机)中安装 Manjaro 18.1,则将看不到最后两个选项。 如果你不熟悉 Manjaro Linux,那么我建议你使用第一个选项(擦除磁盘Erase Disk),它将为你自动创建所需的分区。如果要创建自定义分区,则选择第二个选项“手动分区Manual Partitioning”,顾名思义,它将允许我们创建自己的自定义分区。 @@ -102,7 +102,7 @@ Manjaro 18.1(KDE)安装图解 * `/opt`       –  4 GB(ext4) * 交换分区Swap     –  2 GB -当我们在上方窗口中单击“下一步Next”时,将显示以下屏幕,选择创建“新分区表new partition table”: +当我们在上方窗口中单击“下一步Next”时,将显示以下屏幕,选择“新建分区表new partition table”: ![Create-Partition-Table-Manjaro18-1-Installation][9] @@ -110,10 +110,6 @@ Manjaro 18.1(KDE)安装图解 现在选择可用空间,然后单击“创建create”以将第一个分区设置为大小为 2 GB 的 `/boot`, -点击“确定OK”。 - -现在选择可用空间,然后单击“创建create”以将第一个分区设置为大小为 2 GB 的 `/boot`: - ![boot-partition-manjaro-18-1-installation][10] 单击“确定OK”以继续操作,在下一个窗口中再次选择可用空间,然后单击“创建create”以将第二个分区设置为 `/`,大小为 10 GB: @@ -174,7 +170,7 @@ Manjaro 18.1(KDE)安装图解 ![Login-screen-after-manjaro-18-1-installation][22] -点击“登录Login。 +点击“登录Login”。 ![KDE-Desktop-Screen-Manjaro-18-1][23] @@ -187,7 +183,7 @@ via: https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/ 作者:[Pradeep Kumar][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 1ae55c0f7af92c6ee9b8504f26276f0cdc12b3b8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 22 Oct 2019 14:36:29 +0800 Subject: [PATCH 082/800] PUB @wxy https://linux.cn/article-11487-1.html --- ...on Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md (99%) diff --git a/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md b/published/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md similarity index 99% rename from translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md rename to published/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md index 31d8a38a88..bd8516c2b3 100644 --- a/translated/tech/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md +++ b/published/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11487-1.html) [#]: subject: (Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots) [#]: via: (https://www.linuxtechi.com/install-manjaro-18-1-kde-edition-screenshots/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) From 7b4cce23134858fb37b6e48033c753dd50d2abd2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 22 Oct 2019 15:07:09 +0800 Subject: [PATCH 083/800] PRF @geekpi --- ...es-Folders Older Than -X- Days in Linux.md | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md b/translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md index 21964e83c9..eb0d94b0a3 100644 --- a/translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md +++ b/translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Bash Script to Delete Files/Folders Older Than “X” Days in Linux) @@ -10,29 +10,21 @@ 在 Linux 中使用 Bash 脚本删除早于 “X” 天的文件/文件夹 ====== -**[磁盘使用率][1]**监控工具能够在达到给定阈值时提醒我们。 +[磁盘使用率][1] 监控工具能够在达到给定阈值时提醒我们。但它们无法自行解决 [磁盘使用率][2] 问题。需要手动干预才能解决该问题。 -但它们无法自行解决**[磁盘使用率][2]**问题。 +如果你想完全自动化此类操作,你会做什么。是的,可以使用 bash 脚本来完成。 -需要手动干预才能解决该问题。 - -如果你想完全自动化此类操作,你会做什么。 - -是的,可以使用 bash 脚本来完成。 - -该脚本可防止来自**[监控工具][3]**的警报,因为我们会在填满磁盘空间之前删除旧的日志文件。 +该脚本可防止来自 [监控工具][3] 的警报,因为我们会在填满磁盘空间之前删除旧的日志文件。 我们过去做了很多 shell 脚本。如果要查看,请进入下面的链接。 - * **[如何使用 shell 脚本自动化日常活动?][4]** - - +* [如何使用 shell 脚本自动化日常活动?][4] 我在本文中添加了两个 bash 脚本,它们有助于清除旧日志。 ### 1)在 Linux 中删除早于 “X” 天的文件夹的 Bash 脚本 -我们有一个名为 **“/var/log/app/”** 的文件夹,其中包含 15 天的日志,我们将删除早于 10 天的文件夹。 +我们有一个名为 `/var/log/app/` 的文件夹,其中包含 15 天的日志,我们将删除早于 10 天的文件夹。 ``` $ ls -lh /var/log/app/ @@ -56,7 +48,7 @@ drwxrw-rw- 3 root root 24K Oct 15 23:52 app_log.15 该脚本将删除早于 10 天的文件夹,并通过邮件发送文件夹列表。 -你可以根据需要修改 **“-mtime X”** 的值。另外,请替换你的电子邮箱,而不是用我们的。 +你可以根据需要修改 `-mtime X` 的值。另外,请替换你的电子邮箱,而不是用我们的。 ``` # /opt/script/delete-old-folders.sh @@ -81,7 +73,7 @@ rm $MESSAGE /tmp/folder.out fi ``` -给 **“delete-old-folders.sh”** 设置可执行权限。 +给 `delete-old-folders.sh` 设置可执行权限。 ``` # chmod +x /opt/script/delete-old-folders.sh @@ -109,15 +101,13 @@ Oct 15 /var/log/app/app_log.15 ### 2)在 Linux 中删除早于 “X” 天的文件的 Bash 脚本 -我们有一个名为 **“/var/log/apache/”** 的文件夹,其中包含15天的日志,我们将删除 10 天前的文件。 +我们有一个名为 `/var/log/apache/` 的文件夹,其中包含15天的日志,我们将删除 10 天前的文件。 以下文章与该主题相关,因此你可能有兴趣阅读。 - * **[如何在 Linux 中查找和删除早于 “X” 天和 “X” 小时的文件?][6]** - * **[如何在 Linux 中查找最近修改的文件/文件夹][7]** - * **[如何在 Linux 中自动删除或清理 /tmp 文件夹内容?][8]** - - + * [如何在 Linux 中查找和删除早于 “X” 天和 “X” 小时的文件?][6] + * [如何在 Linux 中查找最近修改的文件/文件夹][7] + * [如何在 Linux 中自动删除或清理 /tmp 文件夹内容?][8] ``` # ls -lh /var/log/apache/ @@ -141,7 +131,7 @@ Oct 15 /var/log/app/app_log.15 该脚本将删除 10 天前的文件并通过邮件发送文件夹列表。 -你可以根据需要修改 **“-mtime X”** 的值。另外,请替换你的电子邮箱,而不是用我们的。 +你可以根据需要修改 `-mtime X` 的值。另外,请替换你的电子邮箱,而不是用我们的。 ``` # /opt/script/delete-old-files.sh @@ -166,7 +156,7 @@ rm $MESSAGE /tmp/file.out fi ``` -给 **“delete-old-files.sh”** 设置可执行权限。 +给 `delete-old-files.sh` 设置可执行权限。 ``` # chmod +x /opt/script/delete-old-files.sh @@ -199,7 +189,7 @@ via: https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-d 作者:[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 61c8c573a25abac0f1c1c72513b35333a24092fe Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 22 Oct 2019 15:07:42 +0800 Subject: [PATCH 084/800] PUB @geekpi https://linux.cn/article-11490-1.html --- ...pt to Delete Files-Folders Older Than -X- Days in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md (99%) diff --git a/translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md b/published/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md similarity index 99% rename from translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md rename to published/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md index eb0d94b0a3..c80f5540b9 100644 --- a/translated/tech/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md +++ b/published/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11490-1.html) [#]: subject: (Bash Script to Delete Files/Folders Older Than “X” Days in Linux) [#]: via: (https://www.2daygeek.com/bash-script-to-delete-files-folders-older-than-x-days-in-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 3d86f555df6923c1f9cfd2d867b693a6d1ae077a Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Tue, 22 Oct 2019 15:44:41 +0800 Subject: [PATCH 085/800] translating --- ...10 DevSecOps pipelines and tools- What you need to know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191010 DevSecOps pipelines and tools- What you need to know.md b/sources/tech/20191010 DevSecOps pipelines and tools- What you need to know.md index c9e7432d49..c5c0d2afef 100644 --- a/sources/tech/20191010 DevSecOps pipelines and tools- What you need to know.md +++ b/sources/tech/20191010 DevSecOps pipelines and tools- What you need to know.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lnrCoder) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -60,7 +60,7 @@ via: https://opensource.com/article/19/10/devsecops-pipeline-and-tools 作者:[Sagar Nangare][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lnrCoder](https://github.com/lnrCoder) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 9470f78babdd5d16d44bb240e7d1ae967b25373f Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Tue, 22 Oct 2019 11:06:36 +0200 Subject: [PATCH 086/800] Update 20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ...anage All Your Linux Games in One Place.md | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index 5fb1f5d7ef..3e652550e4 100644 --- a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -7,39 +7,46 @@ [#]: via: (https://itsfoss.com/gamehub/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Use GameHub to Manage All Your Linux Games in One Place +Use GameHub to Manage All Your Linux Games in One Place 用GameHub集中管理Linux上你的所有游戏 ====== How do you [play games on Linux][1]? Let me guess. Either you install games from the software center or from Steam or from GOG or Humble Bundle etc, right? But, how do you plan to manage all your games from multiple launchers and clients? Well, that sounds like a hassle to me – which is why I was delighted when I come across [GameHub][2]. +你在Linux 上怎么[玩游戏呢][1]? 让我猜猜, 要不就是从软件中心安装游戏,要不就是选Steam,GOG, Humble Bundle 等平台,对吧?但是,你对多个游戏启动器和客户打算如何管理呢?好吧,对我来说这简直令人头疼 —— 这也是我发现[GameHub][2]之后,感到高兴的原因。 GameHub is a desktop application for Linux distributions that lets you manage “All your games in one place”. That sounds interesting, isn’t it? Let me share more details about it. -![][3] +GameHub是为Linux发行版设计的一个桌面应用,它能“集中管理你的所有游戏”。这听起来很有趣,是不是?让我来具体说明一下。 +![][3] ### GameHub Features to manage Linux games from different sources at one place Let’s see all the features that make GameHub one of the [essential Linux applications][4], specially for gamers. +让我们来看看,尤其对玩家来说,让GameHub成为一个[不可或缺的Linux应用][4]的功能,都有哪些。 -#### Steam, GOG & Humble Bundle Support - +#### Steam, GOG & Humble Bundle 支持 ![][5] It supports Steam, [GOG][6], and [Humble Bundle][7] account integration. You can sign in to your account to see manager your library from within GameHub. +它支持Steam, [GOG][6], 和 [Humble Bundle][7] 账户整合。你可以登录你的GameHub账号,从而在库管理器中管理所有游戏。 + For my usage, I have a lot of games on Steam and a couple on Humble Bundle. I can’t speak for all – but it is safe to assume that these are the major platforms one would want to have. +对我来说,我在Steam上有很多游戏,Humble Bundle上也有一些。我不能确保它能支持所有平台。但确信的是,主流平台是可以保证支持的。 -#### Native Game Support - +#### Native Game Support 本地游戏支持 ![][8] There are several [websites where you can find and download Linux games][9]. You can also add native Linux games by downloading their installers or add the executable file. +很多网站都有专门推荐Linux游戏,并[支持下载][9]。你可以通过下载安装包,或者添加可执行文件加入本地游戏。 Unfortunately, there’s no easy way of finding out games for Linux from within GameHub at the moment. So, you will have to download them separately and add it to the GameHub as shown in the image above. -#### Emulator Support +可惜的是,在GameHub上,无法在线搜索Linux游戏。如上图所示,你需要将各平台游戏分开下载,随后添加到自己的GameHub账号中。 + +#### 模拟器支持 With emulators, you can [play retro games on Linux][10]. As you can observe in the image above, you also get the ability to add emulators (and import emulated images). - +在模拟器方面,你可以玩[Linux上的retro game][10]。正如上图所示,你可以添加模拟器(或者导入) You can see [RetroArch][11] listed already but you can also add custom emulators as per your requirements. #### User Interface From a30a0878b325edc5ea5b481f8a44733b0b644cde Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Tue, 22 Oct 2019 17:25:13 +0800 Subject: [PATCH 087/800] translated --- ...elines and tools- What you need to know.md | 74 ------------------- ...elines and tools- What you need to know.md | 69 +++++++++++++++++ 2 files changed, 69 insertions(+), 74 deletions(-) delete mode 100644 sources/tech/20191010 DevSecOps pipelines and tools- What you need to know.md create mode 100644 translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md diff --git a/sources/tech/20191010 DevSecOps pipelines and tools- What you need to know.md b/sources/tech/20191010 DevSecOps pipelines and tools- What you need to know.md deleted file mode 100644 index c5c0d2afef..0000000000 --- a/sources/tech/20191010 DevSecOps pipelines and tools- What you need to know.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lnrCoder) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (DevSecOps pipelines and tools: What you need to know) -[#]: via: (https://opensource.com/article/19/10/devsecops-pipeline-and-tools) -[#]: author: (Sagar Nangare https://opensource.com/users/sagarnangare) - -DevSecOps pipelines and tools: What you need to know -====== -DevSecOps evolves DevOps to ensure security remains an essential part of -the process. -![An intersection of pipes.][1] - -DevOps is well-understood in the IT world by now, but it's not flawless. Imagine you have implemented all of the DevOps engineering practices in modern application delivery for a project. You've reached the end of the development pipeline—but a penetration testing team (internal or external) has detected a security flaw and come up with a report. Now you have to re-initiate all of your processes and ask developers to fix the flaw. - -This is not terribly tedious in a DevOps-based software development lifecycle (SDLC) system—but it does consume time and affects the delivery schedule. If security were integrated from the start of the SDLC, you might have tracked down the glitch and eliminated it on the go. But pushing security to the end of the development pipeline, as in the above scenario, leads to a longer development lifecycle. - -This is the reason for introducing DevSecOps, which consolidates the overall software delivery cycle in an automated way. - -In modern DevOps methodologies, where containers are widely used by organizations to host applications, we see greater use of [Kubernetes][2] and [Istio][3]. However, these tools have their own vulnerabilities. For example, the Cloud Native Computing Foundation (CNCF) recently completed a [Kubernetes security audit][4] that identified several issues. All tools used in the DevOps pipeline need to undergo security checks while running in the pipeline, and DevSecOps pushes admins to monitor the tools' repositories for upgrades and patches. - -### What Is DevSecOps? - -Like DevOps, DevSecOps is a mindset or a culture that developers and IT operations teams follow while developing and deploying software applications. It integrates active and automated security audits and penetration testing into agile application development. - -To utilize [DevSecOps][5], you need to: - - * Introduce the concept of security right from the start of the SDLC to minimize vulnerabilities in software code. - * Ensure everyone (including developers and IT operations teams) shares responsibility for following security practices in their tasks. - * Integrate security controls, tools, and processes at the start of the DevOps workflow. These will enable automated security checks at each stage of software delivery. - - - -DevOps has always been about including security—as well as quality assurance (QA), database administration, and everyone else—in the dev and release process. However, DevSecOps is an evolution of that process to ensure security is never forgotten as an essential part of the process. - -### Understanding the DevSecOps pipeline - -There are different stages in a typical DevOps pipeline; a typical SDLC process includes phases like Plan, Code, Build, Test, Release, and Deploy. In DevSecOps, specific security checks are applied in each phase. - - * **Plan:** Execute security analysis and create a test plan to determine scenarios for where, how, and when testing will be done. - * **Code:** Deploy linting tools and Git controls to secure passwords and API keys. - * **Build:** While building code for execution, incorporate static application security testing (SAST) tools to track down flaws in code before deploying to production. These tools are specific to programming languages. - * **Test:** Use dynamic application security testing (DAST) tools to test your application while in runtime. These tools can detect errors associated with user authentication, authorization, SQL injection, and API-related endpoints. - * **Release:** Just before releasing the application, employ security analysis tools to perform thorough penetration testing and vulnerability scanning. - * **Deploy:** After completing the above tests in runtime, send a secure build to production for final deployment. - - - -### DevSecOps tools - -Tools are available for every phase of the SDLC. Some are commercial products, but most are open source. In my next article, I will talk more about the tools to use in different stages of the pipeline. - -DevSecOps will play a more crucial role as we continue to see an increase in the complexity of enterprise security threats built on modern IT infrastructure. However, the DevSecOps pipeline will need to improve over time, rather than simply relying on implementing all security changes simultaneously. This will eliminate the possibility of backtracking or the failure of application delivery. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/devsecops-pipeline-and-tools - -作者:[Sagar Nangare][a] -选题:[lujun9972][b] -译者:[lnrCoder](https://github.com/lnrCoder) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/sagarnangare -[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://opensource.com/resources/what-is-kubernetes -[3]: https://opensource.com/article/18/9/what-istio -[4]: https://www.cncf.io/blog/2019/08/06/open-sourcing-the-kubernetes-security-audit/ -[5]: https://resources.whitesourcesoftware.com/blog-whitesource/devsecops diff --git a/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md b/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md new file mode 100644 index 0000000000..726c963910 --- /dev/null +++ b/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (lnrCoder) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevSecOps pipelines and tools: What you need to know) +[#]: via: (https://opensource.com/article/19/10/devsecops-pipeline-and-tools) +[#]: author: (Sagar Nangare https://opensource.com/users/sagarnangare) + +你需要知道的 DevSecOps 流程及工具 +====== +DevSecOps 对 DevOps 进行了改进,以确保安全性仍然是该过程的一个重要部分。 +![An intersection of pipes.][1] + +到目前为止,DevOps 在 IT 世界中已广为人知,但其并非完美无缺。试想一下,你已经在一个项目的现代应用程序交付中实施了所有 DevOps 工程实践。你已经到达开发流程的末尾,但是渗透测试团队(内部或外部)检测到安全漏洞并提出了报告。 现在,你必须重新启动所有流程,并要求开发人员修复该漏洞。 + +在基于 DevOps 的软件开发生命周期(SDLC)系统中,这并不繁琐,但它确实会浪费时间并影响交付进度。如果安全性从 SDLC 初期就已经集成,那么你可能已经跟踪到了该故障,并在开发流程中就消除了它。但是,如上述情形那样,将安全性推到开发流程的最后将导致更长的开发生命周期。 + +这就是引入 DevSecOps 的原因,它以自动化的方式巩固了整个软件交付周期。 + +在现代 DevOps 方法中,组织广泛使用容器托管应用程序,我们看到 [Kubernetes][2] 和 [Istio][3] 使用的较多。但是,这些工具都有其自身的漏洞。例如,云原生计算基金会(CNCF)最近完成了一项 [kubernetes 安全审计][4],发现了几个问题。DevOps 开发流程中使用的所有工具在流程运行时都需要进行安全检查,DevSecOps 会推动管理员监视工具的存储库以获取升级和补丁。 + +### 什么是 DevSecOps? + +与 DevOps 一样,DevSecOps 是开发人员和 IT 运营团队在开发和部署软件应用程序时所遵循的一种思维方式或文化。它将主动和自动化的安全审计以及渗透测试集成到敏捷应用程序开发中。 + +要使用 [DevSecOps][5],你需要: + + * 从SDLC开始就引入安全性概念,以最大程度地减少软件代码中的漏洞。 + * 确保每个人(包括开发人员和IT运营团队)共同承担在其任务中遵循安全实践的责任。 + * 在DevOps工作流程开始时集成安全控件,工具和流程。这些将在软件交付的每个阶段启用自动安全检查。 + +DevOps 一直致力于在开发和发布过程中包括安全性以及质量保证(QA),数据库管理和其他所有方面。然而,DevSecOps 是该过程的一个演进,以确保安全永远不会被遗忘,成为该过程的一个重要部分。 + +### 了解 DevSecOps 流程 + +典型的 DevOps 流程有不同的阶段;典型的 SDLC 流程包括计划,编码,构建,测试,发布和部署等阶段。在 DevSecOps 中,每个阶段都会应用特定的安全检查。 + + * **计划:** 执行安全性分析并创建测试计划,以确定在何处,如何以及何时进行测试的方案。 + * **编码:** 部署整理工具和 Git 控件以保护密码和 API 密钥。 + * **构建:** 在构建执行代码时,请结合使用静态应用程序安全测试(SAST)工具来跟踪代码中的缺陷,然后再部署到生产环境中。 这些工具针对特定的编程语言。 + * **测试:** 在运行时使用动态应用程序安全测试(DAST)工具来测试您的应用程序。 这些工具可以检测与用户身份验证,授权,SQL 注入以及与 API 相关的端点相关的错误。 + * **发布:** 在发布应用程序之前,请使用安全分析工具来进行全面的渗透测试和漏洞扫描。 + * **部署:** 在运行时完成上述测试后,将安全的版本发送到生产中以进行最终部署。 + +### DevSecOps 工具 + +SDLC 的每个阶段都有可用的工具。有些是商业产品,但大多数是开源的。在我的下一篇文章中,我将更多地讨论在流程的不同阶段使用的工具。 + +随着基于现代 IT 基础设施的企业安全威胁的复杂性增加,DevSecOps 将发挥更加关键的作用。然而,DevSecOps 流程将需要随着时间的推移而改进,而不是仅仅依靠同时实施所有安全更改即可。这将消除回溯或应用交付失败的可能性。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/devsecops-pipeline-and-tools + +作者:[Sagar Nangare][a] +选题:[lujun9972][b] +译者:[lnrCoder](https://github.com/lnrCoder) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sagarnangare +[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://opensource.com/resources/what-is-kubernetes +[3]: https://opensource.com/article/18/9/what-istio +[4]: https://www.cncf.io/blog/2019/08/06/open-sourcing-the-kubernetes-security-audit/ +[5]: https://resources.whitesourcesoftware.com/blog-whitesource/devsecops From a2be2318b207fb2f8fd3999fcb8f9dd2887f82b7 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Tue, 22 Oct 2019 12:32:02 +0200 Subject: [PATCH 088/800] Update 20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ...anage All Your Linux Games in One Place.md | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index 3e652550e4..29a577824b 100644 --- a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -31,7 +31,7 @@ It supports Steam, [GOG][6], and [Humble Bundle][7] account integration. You can 它支持Steam, [GOG][6], 和 [Humble Bundle][7] 账户整合。你可以登录你的GameHub账号,从而在库管理器中管理所有游戏。 For my usage, I have a lot of games on Steam and a couple on Humble Bundle. I can’t speak for all – but it is safe to assume that these are the major platforms one would want to have. -对我来说,我在Steam上有很多游戏,Humble Bundle上也有一些。我不能确保它能支持所有平台。但确信的是,主流平台是可以保证支持的。 +对我来说,我在Steam上有很多游戏,Humble Bundle上也有一些。我不能确保它能支持所有平台。但确信的是,主流平台是可以保证的。 #### Native Game Support 本地游戏支持 ![][8] @@ -46,39 +46,50 @@ Unfortunately, there’s no easy way of finding out games for Linux from within #### 模拟器支持 With emulators, you can [play retro games on Linux][10]. As you can observe in the image above, you also get the ability to add emulators (and import emulated images). -在模拟器方面,你可以玩[Linux上的retro game][10]。正如上图所示,你可以添加模拟器(或者导入) +在模拟器方面,你可以玩[Linux上的retro game][10]。正如上图所示,你可以添加模拟器(或者导入模拟器游戏)。 + You can see [RetroArch][11] listed already but you can also add custom emulators as per your requirements. +你可以在[RetroArch][11]查看可添加的模拟器,但也能根据需求,自行添加模拟器。 -#### User Interface +#### 用户界面 -![Gamehub Appearance Option][12] +![Gamehub 界面选项][12] Of course, the user experience matters. Hence, it is important to take a look at its user interface and what it offers. +当然,用户体验很重要。因此,探究下用户界面都有什么,是很重要的。 To me, I felt it very easy to use and the presence of a dark theme is a bonus. +我个人觉得,这一应用很容易使用,并且黑色主题是一个加分点。 -#### Controller Support +#### 手柄支持 If you are comfortable using a controller with your Linux system to play games – you can easily add it, enable or disable it from the settings. +如果你习惯了在Linux系统上用手柄玩游戏 —— 你可以在设置中很轻松地添加,启用或禁用它。 -#### Multiple Data Providers +#### 多个数据提供商 Just because it fetches the information (or metadata) of your games, it needs a source for that. You can see all the sources listed in the image below. +因为它需要获取你游戏的信息(或元数据),也就意味着需要数据源。你可以看到上图列表中显示的所有数据源。 ![Data Providers Gamehub][13] + You don’t have to do anything here – but if you are using anything else other than steam as your platform, you can generate an [API key for IDGB.][14] -I shall recommend you to do that only if you observe a prompt/notice within GameHub or if you have some games that do not have any description/pictures/stats on GameHub. +这里你什么也不用做 —— 但如果你需要使用其他平台,而不是steam的话,你需要为[IDGB生成一个API密钥][14]。 -#### Compatibility Layer +I shall recommend you to do that only if you observe a prompt/notice within GameHub or if you have some games that do not have any description/pictures/stats on GameHub. +我建议你,只有在你看到GameHub上出现提示/或者通知时,或者你发现在GameHub上,有些游戏没有任何描述/图片/状态时,再这么做。 + +#### 兼容性选项 ![][15] Do you have a game that does not support Linux? +你有不支持在Linux上运行的游戏吗? You do not have to worry. GameHub offers multiple compatibility layers like Wine/Proton which you can use to get the game installed in order to make it playable. - +你不需要太担心。GameHub上提供了 We can’t be really sure on what works for you – so you have to test it yourself for that matter. Nevertheless, it is an important feature that could come handy for a lot of gamers. ### How Do You Manage Your Games in GameHub? From 7c53b06d0ae1a3ef7974a4597e11406c99df0b7b Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Tue, 22 Oct 2019 20:50:15 +0800 Subject: [PATCH 089/800] Translating --- .../20191011 How to use IoT devices to keep children safe.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191011 How to use IoT devices to keep children safe.md b/sources/talk/20191011 How to use IoT devices to keep children safe.md index 5acc31a838..acc7bd6647 100644 --- a/sources/talk/20191011 How to use IoT devices to keep children safe.md +++ b/sources/talk/20191011 How to use IoT devices to keep children safe.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9b32e648bdba2e7c913c533152be356513a10dc3 Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Tue, 22 Oct 2019 22:57:12 +0800 Subject: [PATCH 090/800] Update 20180706 Building a Messenger App- OAuth.md --- ...0180706 Building a Messenger App- OAuth.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translated/tech/20180706 Building a Messenger App- OAuth.md b/translated/tech/20180706 Building a Messenger App- OAuth.md index 10153263be..227ffff0c9 100644 --- a/translated/tech/20180706 Building a Messenger App- OAuth.md +++ b/translated/tech/20180706 Building a Messenger App- OAuth.md @@ -14,13 +14,13 @@ 在这篇帖子中,我们将会通过为应用添加社交登录功能进入后端开发。 -它的工作方式十分简单:用户点击链接,然后重定向到 GitHub 授权页面。当用户授予我们对他的个人信息的访问权限之后,就会重定向回登录页面。下一次尝试登录时,系统将不会再次请求授权,也就是说,我们的应用已经记住了他。这使得登录流程看起来就像单击一样快。 +社交登录的工作方式十分简单:用户点击链接,然后重定向到 GitHub 授权页面。当用户授予我们对他的个人信息的访问权限之后,就会重定向回登录页面。下一次尝试登录时,系统将不会再次请求授权,也就是说,我们的应用已经记住了这个用户。这使得整个登录流程看起来就和你用鼠标单击一样快。 -如果考虑内部实现的话,过程将会比较复杂。首先,我们需要注册一个新的 [GitHub OAuth 应用][2]。 +如果进一步考虑其内部实现的话,过程就会变得复杂起来。首先,我们需要注册一个新的 [GitHub OAuth 应用][2]。 -比较重要的是回调 URL。我们将它设置为 `http://localhost:3000/api/oauth/github/callback`。这是因为,在开发过程中,我们总是在本地主机上工作。一旦你要将应用交付生产,请使用正确的回调 URL 注册一个新的应用。 +这一步中,比较重要的是回调 URL。我们将它设置为 `http://localhost:3000/api/oauth/github/callback`。这是因为,在开发过程中,我们总是在本地主机上工作。一旦你要将应用交付生产,请使用正确的回调 URL 注册一个新的应用。 -注册以后,你将会收到客户端 id 和安全密钥。安全起见,请不要与任何人分享他们 👀 +注册以后,你将会收到「客户端 id」和「安全密钥」。安全起见,请不要与任何人分享他们 👀 顺便让我们开始写一些代码吧。现在,创建一个 `main.go` 文件: @@ -161,14 +161,14 @@ GITHUB_CLIENT_SECRET=your_github_client_secret 我们还要用到的其他环境变量有: * `PORT`:服务器运行的端口,默认值是 `3000`。 - * `ORIGIN`:你的域名,默认值是 `http://localhost:3000/`。端口也可以在这里指定。 + * `ORIGIN`:你的域名,默认值是 `http://localhost:3000/`。我们也可以在这里指定端口。 * `DATABASE_URL`:Cockroach 数据库的地址。默认值是 `postgresql://root@127.0.0.1:26257/messenger?sslmode=disable`。 * `HASH_KEY`:用于为 cookies 签名的密钥。没错,我们会使用已签名的 cookies 来确保安全。 - * `JWT_KEY`:用于签署 JSON 网络令牌的密钥。 + * `JWT_KEY`:用于签署 JSON 网络令牌(Json Web Token)的密钥。 因为代码中已经设定了默认值,所以你也不用把它们写到 `.env` 文件中。 -在读取配置并连接到数据库之后,我们会创建一个 OAuth 配置。我们会使用 origin 来构建回调 URL(就和我们在 GitHub 页面上注册的一样)。我们的范围设置为 “read:user”。这会允许我们读取公开的用户信息,我们只是需要他的用户名和头像。然后我们会初始化 cookie 和 JWT 签名器。定义一些端点并启动服务器。 +在读取配置并连接到数据库之后,我们会创建一个 OAuth 配置。我们会使用 `ORIGIN` 来构建回调 URL(就和我们在 GitHub 页面上注册的一样)。我们的数据范围设置为 “read:user”。这会允许我们读取公开的用户信息,这里我们只需要他的用户名和头像就够了。然后我们会初始化 cookie 和 JWT 签名器。定义一些端点并启动服务器。 在实现 HTTP 处理程序之前,让我们编写一些函数来发送 HTTP 响应。 @@ -190,7 +190,7 @@ func respondError(w http.ResponseWriter, err error) { } ``` -第一个用来发送 JSON,而第二个将错误记录到控制台并返回一个 `500 Internal Server Error` 错误信息。 +第一个函数用来发送 JSON,而第二个将错误记录到控制台并返回一个 `500 Internal Server Error` 错误信息。 ### OAuth 开始 @@ -220,11 +220,11 @@ func githubOAuthStart(w http.ResponseWriter, r *http.Request) { } ``` -OAuth2 使用一种机制来防止 CSRF 攻击,因此它需要一个「状态」 "state"。我们使用 nanoid 来创建一个随机字符串并用它作为状态。我们也把它保存为一个 cookie。 +OAuth2 使用一种机制来防止 CSRF 攻击,因此它需要一个「状态」 "state"。我们使用 `Nanoid()` 来创建一个随机字符串,并用这个字符串作为状态。我们也把它保存为一个 cookie。 ### OAuth 回调 -一旦用户授权我们访问他的个人信息,他将会被重定向到这个端点。这个 URL 将会在查询字符串上包含状态(state)和授权码(code) `/api/oauth/github/callback?state=&code=` +一旦用户授权我们访问他的个人信息,他将会被重定向到这个端点。这个 URL 的查询字符串上将会包含状态(state)和授权码(code) `/api/oauth/github/callback?state=&code=` ``` const jwtLifetime = time.Hour * 24 * 14 @@ -341,17 +341,17 @@ func githubOAuthCallback(w http.ResponseWriter, r *http.Request) { 首先,我们会尝试使用之前保存的状态对 cookie 进行解码。并将其与查询字符串中的状态进行比较。如果它们不匹配,我们会返回一个 `418 I'm teapot`(未知来源)错误。 -接着,我们使用授权码生成一个令牌。这个令牌被用于创建 HTTP 客户端来向 GitHub API 发出请求。所以最终我们向 `https://api.github.com/user` 发送了一个 GET 请求。这个端点将会以 JSON 格式向我们提供当前经过身份验证的用户信息。我们将会解码这些内容,来获取用户 ID,登录名(用户名)和头像 URL。 +接着,我们使用授权码生成一个令牌。这个令牌被用于创建 HTTP 客户端来向 GitHub API 发出请求。所以最终我们会向 `https://api.github.com/user` 发送一个 GET 请求。这个端点将会以 JSON 格式向我们提供当前经过身份验证的用户信息。我们将会解码这些内容,一并获取用户的 ID,登录名(用户名)和头像 URL。 -然后我们将会尝试在数据库上找到具有该 GitHub ID 的用户。如果没有找到,那么我们就会使用该数据创建一个新的。 +然后我们将会尝试在数据库上找到具有该 GitHub ID 的用户。如果没有找到,就使用该数据创建一个新的。 -之后,对于新创建的用户,我们会发出一个用户 ID 为主题的 JSON 网络令牌,并使用该令牌重定向到前端,查询字符串中一并包含该令牌的到期日(the expiration date)。 +之后,对于新创建的用户,我们会发出一个用户 ID 为主题(subject)的 JSON 网络令牌,并使用该令牌重定向到前端,查询字符串中一并包含该令牌的到期日(the expiration date)。 这一 Web 应用也会被用在其他帖子,但是重定向的链接会是 `/callback?token=&expires_at=`。在那里,我们将会利用 JavaScript 从 URL 中获取令牌和到期日,并通过 `Authorization` 标头中的令牌以`Bearer token_here` 的形式对 `/ api / auth_user` 进行GET请求,来获取已认证的身份用户并将其保存到 localStorage。 -### 保护中间件 +### Guard 中间件 -为了获取当前已经过身份验证的用户,我们使用了中间件。这是因为在接下来的文章中,我们会有很多需要身份认证的端点,而中间件将会允许我们共享这一功能。 +为了获取当前已经过身份验证的用户,我们设计了 Guard 中间件。这是因为在接下来的文章中,我们会有很多需要进行身份认证的端点,而中间件将会允许我们共享这一功能。 ``` type ContextKey struct { @@ -388,7 +388,7 @@ func guard(handler http.HandlerFunc) http.HandlerFunc { 首先,我们尝试从 `Authorization` 标头或者是 URL 查询字符串中的 `token` 字段中读取令牌。如果没有找到,我们需要返回 `401 Unauthorized`(未授权)错误。然后我们将会对令牌中的申明进行解码,并使用该主题作为当前已经过身份验证的用户 ID。 -现在,我们可以用这一中间件来封装任何需要授权的 `http.handlerFunc`,并且在处理函数的上下文中具有已经过身份验证的用户 ID。 +现在,我们可以用这一中间件来封装任何需要授权的 `http.handlerFunc`,并且在处理函数的上下文中保有已经过身份验证的用户 ID。 ``` var guarded = guard(func(w http.ResponseWriter, r *http.Request) { @@ -420,7 +420,7 @@ func getAuthUser(w http.ResponseWriter, r *http.Request) { } ``` -我们使用保护中间件来获取当前经过身份认证的用户 ID 并查询数据库。 +我们使用 Guard 中间件来获取当前经过身份认证的用户 ID 并查询数据库。 * * * From d513a36c819e3c6da64178f163b423a20011f1ee Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Tue, 22 Oct 2019 23:02:13 +0800 Subject: [PATCH 091/800] fix format --- .../20180706 Building a Messenger App- OAuth.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20180706 Building a Messenger App- OAuth.md b/translated/tech/20180706 Building a Messenger App- OAuth.md index 227ffff0c9..044df1e174 100644 --- a/translated/tech/20180706 Building a Messenger App- OAuth.md +++ b/translated/tech/20180706 Building a Messenger App- OAuth.md @@ -1,11 +1,11 @@ -[#]: collector: "lujun9972" -[#]: translator: "PsiACE" -[#]: reviewer: " " -[#]: publisher: " " -[#]: url: " " -[#]: subject: "Building a Messenger App: OAuth" -[#]: via: "https://nicolasparada.netlify.com/posts/go-messenger-oauth/" -[#]: author: "Nicolás Parada https://nicolasparada.netlify.com/" +[#]: collector: (lujun9972) +[#]: translator: (PsiACE) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a Messenger App: OAuth) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-oauth/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) 构建一个即时消息应用(二):OAuth ====== From f02d30b6368a26fa3978bb69b58246e74f07dad1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 22 Oct 2019 23:21:12 +0800 Subject: [PATCH 092/800] Rename sources/tech/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md to sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md --- ...netes networking, OpenStack Train, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md (100%) diff --git a/sources/tech/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md b/sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md similarity index 100% rename from sources/tech/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md rename to sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md From c529eed53973db5a7f055f24cd1be143fbd1981b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 22 Oct 2019 23:55:04 +0800 Subject: [PATCH 093/800] PRF @way-ww --- ...ow to Run the Top Command in Batch Mode.md | 60 +++++++++---------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/translated/tech/20191003 How to Run the Top Command in Batch Mode.md b/translated/tech/20191003 How to Run the Top Command in Batch Mode.md index 7c575c5bb7..05d66c241b 100644 --- a/translated/tech/20191003 How to Run the Top Command in Batch Mode.md +++ b/translated/tech/20191003 How to Run the Top Command in Batch Mode.md @@ -1,34 +1,34 @@ [#]: collector: "lujun9972" [#]: translator: "way-ww" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "How to Run the Top Command in Batch Mode" [#]: via: "https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/" [#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" -如何在批处理模式下运行 Top 命令 +如何在批处理模式下运行 top 命令 ====== -**[Top 命令][1]** 是每个人都在使用的用于 **[监控 Linux 系统性能][2]** 的最好的命令。 +![](https://img.linux.net.cn/data/attachment/album/201910/22/235420ylswdescv5ddffit.jpg) -除了很少的几个操作, 你可能已经知道 top 命令的绝大部分操作, 如果我没错的话, 批处理模式就是其中之一。 +[top 命令][1] 是每个人都在使用的用于 [监控 Linux 系统性能][2] 的最好的命令。你可能已经知道 `top` 命令的绝大部分操作,除了很少的几个操作,如果我没错的话,批处理模式就是其中之一。 -大部分的脚本编写者和开发人员都知道这个, 因为这个操作主要就是用来编写脚本。 +大部分的脚本编写者和开发人员都知道这个,因为这个操作主要就是用来编写脚本。 -如果你不了解这个, 不用担心,我们将在这里介绍它。 +如果你不了解这个,不用担心,我们将在这里介绍它。 -### 什么是 Top 命令的批处理模式 +### 什么是 top 命令的批处理模式 -批处理模式允许你将 top 命令的输出发送至其他程序或者文件中。 +批处理模式允许你将 `top` 命令的输出发送至其他程序或者文件中。 -在这个模式中, top 命令将不会接收输入并且持续运行直到迭代次数达到你用 “-n” 选项指定的次数为止。 +在这个模式中,`top` 命令将不会接收输入并且持续运行,直到迭代次数达到你用 `-n` 选项指定的次数为止。 -如果你想解决 Linux 服务器上的任何性能问题, 你需要正确的 **[理解 top 命令的输出][3]** 。 +如果你想解决 Linux 服务器上的任何性能问题,你需要正确的 [理解 top 命令的输出][3]。 ### 1) 如何在批处理模式下运行 top 命令 -默认地, top 命令按照 CPU 的使用率来排序输出结果, 所以当你在批处理模式中运行以下命令时, 它会执行同样的操作并打印前 35 行。 +默认地,`top` 命令按照 CPU 的使用率来排序输出结果,所以当你在批处理模式中运行以下命令时,它会执行同样的操作并打印前 35 行: ``` # top -bc | head -35 @@ -72,7 +72,7 @@ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND ### 2) 如何在批处理模式下运行 top 命令并按内存使用率排序结果 -在批处理模式中运行以下命令按内存使用率对结果进行排序 +在批处理模式中运行以下命令按内存使用率对结果进行排序: ``` # top -bc -o +%MEM | head -n 20 @@ -99,19 +99,17 @@ KiB Swap: 1048572 total, 514640 free, 533932 used. 2475984 avail Mem 8632 nobody 20 0 256844 25744 2216 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start ``` -**上面命令的详细信息:** - - * **-b :** 批处理模式选项 - * **-c :** 打印运行中的进程的绝对路径 - * **-o :** 指定进行排序的字段 - * **head :** 输出文件的第一部分 - * **-n :** 打印前 n 行 - +上面命令的详细信息: + * `-b`:批处理模式选项 + * `-c`:打印运行中的进程的绝对路径 + * `-o`:指定进行排序的字段 + * `head`:输出文件的第一部分 + * `-n`:打印前 n 行 ### 3) 如何在批处理模式下运行 top 命令并按照指定的用户进程对结果进行排序 -如果你想要按照指定用户进程对结果进行排序请运行以下命令 +如果你想要按照指定用户进程对结果进行排序请运行以下命令: ``` # top -bc -u mysql | head -n 10 @@ -128,13 +126,11 @@ KiB Swap: 1048572 total, 514640 free, 533932 used. 2649412 avail Mem ### 4) 如何在批处理模式下运行 top 命令并按照处理时间进行排序 -在批处理模式中使用以下 top 命令按照处理时间对结果进行排序。 这展示了任务从启动以来已使用的总 CPU 时间 - -但是如果你想要检查一个进程在 Linux 上运行了多长时间请看接下来的文章。 - - * **[检查 Linux 中进程运行时间的五种方法][4]** +在批处理模式中使用以下 `top` 命令按照处理时间对结果进行排序。这展示了任务从启动以来已使用的总 CPU 时间。 +但是如果你想要检查一个进程在 Linux 上运行了多长时间请看接下来的文章: + * [检查 Linux 中进程运行时间的五种方法][4] ``` # top -bc -o TIME+ | head -n 20 @@ -163,7 +159,7 @@ KiB Swap: 1048572 total, 514640 free, 533932 used. 2440332 avail Mem ### 5) 如何在批处理模式下运行 top 命令并将结果保存到文件中 -如果出于解决问题的目的, 你想要和别人分享 top 命令的输出, 请使用以下命令重定向输出到文件中 +如果出于解决问题的目的,你想要和别人分享 `top` 命令的输出,请使用以下命令重定向输出到文件中: ``` # top -bc | head -35 > top-report.txt @@ -209,9 +205,9 @@ KiB Swap: 1048572 total, 514640 free, 533932 used. 2659084 avail Mem ### 如何按照指定字段对结果进行排序 -在 top 命令的最新版本中, 按下 **“f”** 键进入字段管理界面。 +在 `top` 命令的最新版本中, 按下 `f` 键进入字段管理界面。 -要使用新字段进行排序, 请使用 **“up/down”** 箭头选择正确的选项, 然后再按下 **“s”** 键进行排序。 最后按 **“q”** 键退出此窗口。 +要使用新字段进行排序, 请使用 `up`/`down` 箭头选择正确的选项,然后再按下 `s` 键进行排序。最后按 `q` 键退出此窗口。 ``` Fields Management for window 1:Def, whose current sort field is %CPU @@ -269,9 +265,9 @@ Fields Management for window 1:Def, whose current sort field is %CPU nsUSER = USER namespace Inode ``` -对 top 命令的旧版本, 请按 **“shift+f”** 或 **“shift+o”** 键进入字段管理界面进行排序。 +对 `top` 命令的旧版本,请按 `shift+f` 或 `shift+o` 键进入字段管理界面进行排序。 -要使用新字段进行排序, 请选择相应的排序字段字母, 然后按下 **“Enter”** 排序。 +要使用新字段进行排序,请选择相应的排序字段字母, 然后按下回车键排序。 ``` Current Sort Field: N for window 1:Def @@ -323,7 +319,7 @@ via: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[way-ww](https://github.com/way-ww) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f4c7fb6d1cdbfe7c1c7dae2b47a61d744e915b90 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 22 Oct 2019 23:55:44 +0800 Subject: [PATCH 094/800] PUB @way-ww https://linux.cn/article-11491-1.html --- .../20191003 How to Run the Top Command in Batch Mode.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191003 How to Run the Top Command in Batch Mode.md (99%) diff --git a/translated/tech/20191003 How to Run the Top Command in Batch Mode.md b/published/20191003 How to Run the Top Command in Batch Mode.md similarity index 99% rename from translated/tech/20191003 How to Run the Top Command in Batch Mode.md rename to published/20191003 How to Run the Top Command in Batch Mode.md index 05d66c241b..6e0316f9b8 100644 --- a/translated/tech/20191003 How to Run the Top Command in Batch Mode.md +++ b/published/20191003 How to Run the Top Command in Batch Mode.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "way-ww" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11491-1.html" [#]: subject: "How to Run the Top Command in Batch Mode" [#]: via: "https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/" [#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" From 27c3fddb412cb8e40dcea19a3ca7b32bb332f928 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 00:20:37 +0800 Subject: [PATCH 095/800] PRF @lnrCoder --- ...elines and tools- What you need to know.md | 38 ++++++++++--------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md b/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md index 726c963910..37289cddfc 100644 --- a/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md +++ b/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (DevSecOps pipelines and tools: What you need to know) @@ -9,16 +9,18 @@ 你需要知道的 DevSecOps 流程及工具 ====== -DevSecOps 对 DevOps 进行了改进,以确保安全性仍然是该过程的一个重要部分。 -![An intersection of pipes.][1] -到目前为止,DevOps 在 IT 世界中已广为人知,但其并非完美无缺。试想一下,你已经在一个项目的现代应用程序交付中实施了所有 DevOps 工程实践。你已经到达开发流程的末尾,但是渗透测试团队(内部或外部)检测到安全漏洞并提出了报告。 现在,你必须重新启动所有流程,并要求开发人员修复该漏洞。 +> DevSecOps 对 DevOps 进行了改进,以确保安全性仍然是该过程的一个重要部分。 -在基于 DevOps 的软件开发生命周期(SDLC)系统中,这并不繁琐,但它确实会浪费时间并影响交付进度。如果安全性从 SDLC 初期就已经集成,那么你可能已经跟踪到了该故障,并在开发流程中就消除了它。但是,如上述情形那样,将安全性推到开发流程的最后将导致更长的开发生命周期。 +![](https://img.linux.net.cn/data/attachment/album/201910/23/002010fvzh282e8ghhdzpk.jpg) + +到目前为止,DevOps 在 IT 世界中已广为人知,但其并非完美无缺。试想一下,你在一个项目的现代应用程序交付中实施了所有 DevOps 工程实践。你已经到达开发流程的末尾,但是渗透测试团队(内部或外部)检测到安全漏洞并提出了报告。现在,你必须重新启动所有流程,并要求开发人员修复该漏洞。 + +在基于 DevOps 的软件开发生命周期(SDLC)系统中,这并不繁琐,但它确实会浪费时间并影响交付进度。如果从 SDLC 初期就已经集成了安全性,那么你可能已经跟踪到了该故障,并在开发流程中就消除了它。但是,如上述情形那样,将安全性推到开发流程的最后将导致更长的开发生命周期。 这就是引入 DevSecOps 的原因,它以自动化的方式巩固了整个软件交付周期。 -在现代 DevOps 方法中,组织广泛使用容器托管应用程序,我们看到 [Kubernetes][2] 和 [Istio][3] 使用的较多。但是,这些工具都有其自身的漏洞。例如,云原生计算基金会(CNCF)最近完成了一项 [kubernetes 安全审计][4],发现了几个问题。DevOps 开发流程中使用的所有工具在流程运行时都需要进行安全检查,DevSecOps 会推动管理员监视工具的存储库以获取升级和补丁。 +在现代 DevOps 方法中,组织广泛使用容器托管应用程序,我们看到 [Kubernetes][2] 和 [Istio][3] 使用的较多。但是,这些工具都有其自身的漏洞。例如,云原生计算基金会(CNCF)最近完成了一项 [kubernetes 安全审计][4],发现了几个问题。DevOps 开发流程中使用的所有工具在流程运行时都需要进行安全检查,DevSecOps 会推动管理员去监视工具的存储库以获取升级和补丁。 ### 什么是 DevSecOps? @@ -26,22 +28,22 @@ DevSecOps 对 DevOps 进行了改进,以确保安全性仍然是该过程的 要使用 [DevSecOps][5],你需要: - * 从SDLC开始就引入安全性概念,以最大程度地减少软件代码中的漏洞。 - * 确保每个人(包括开发人员和IT运营团队)共同承担在其任务中遵循安全实践的责任。 - * 在DevOps工作流程开始时集成安全控件,工具和流程。这些将在软件交付的每个阶段启用自动安全检查。 + * 从 SDLC 开始就引入安全性概念,以最大程度地减少软件代码中的漏洞。 + * 确保每个人(包括开发人员和 IT 运营团队)共同承担在其任务中遵循安全实践的责任。 + * 在 DevOps 工作流程开始时集成安全控件、工具和流程。这些将在软件交付的每个阶段启用自动安全检查。 -DevOps 一直致力于在开发和发布过程中包括安全性以及质量保证(QA),数据库管理和其他所有方面。然而,DevSecOps 是该过程的一个演进,以确保安全永远不会被遗忘,成为该过程的一个重要部分。 +DevOps 一直致力于在开发和发布过程中包括安全性以及质量保证(QA)、数据库管理和其他所有方面。然而,DevSecOps 是该过程的一个演进,以确保安全永远不会被遗忘,成为该过程的一个重要部分。 ### 了解 DevSecOps 流程 -典型的 DevOps 流程有不同的阶段;典型的 SDLC 流程包括计划,编码,构建,测试,发布和部署等阶段。在 DevSecOps 中,每个阶段都会应用特定的安全检查。 +典型的 DevOps 流程有不同的阶段;典型的 SDLC 流程包括计划、编码、构建、测试、发布和部署等阶段。在 DevSecOps 中,每个阶段都会应用特定的安全检查。 - * **计划:** 执行安全性分析并创建测试计划,以确定在何处,如何以及何时进行测试的方案。 - * **编码:** 部署整理工具和 Git 控件以保护密码和 API 密钥。 - * **构建:** 在构建执行代码时,请结合使用静态应用程序安全测试(SAST)工具来跟踪代码中的缺陷,然后再部署到生产环境中。 这些工具针对特定的编程语言。 - * **测试:** 在运行时使用动态应用程序安全测试(DAST)工具来测试您的应用程序。 这些工具可以检测与用户身份验证,授权,SQL 注入以及与 API 相关的端点相关的错误。 - * **发布:** 在发布应用程序之前,请使用安全分析工具来进行全面的渗透测试和漏洞扫描。 - * **部署:** 在运行时完成上述测试后,将安全的版本发送到生产中以进行最终部署。 + * **计划**:执行安全性分析并创建测试计划,以确定在何处、如何以及何时进行测试的方案。 + * **编码**:部署整理工具和 Git 控件以保护密码和 API 密钥。 + * **构建**:在构建执行代码时,请结合使用静态应用程序安全测试(SAST)工具来跟踪代码中的缺陷,然后再部署到生产环境中。这些工具针对特定的编程语言。 + * **测试**:在运行时使用动态应用程序安全测试(DAST)工具来测试您的应用程序。 这些工具可以检测与用户身份验证,授权,SQL 注入以及与 API 相关的端点相关的错误。 + * **发布**:在发布应用程序之前,请使用安全分析工具来进行全面的渗透测试和漏洞扫描。 + * **部署**:在运行时完成上述测试后,将安全的版本发送到生产中以进行最终部署。 ### DevSecOps 工具 @@ -56,7 +58,7 @@ via: https://opensource.com/article/19/10/devsecops-pipeline-and-tools 作者:[Sagar Nangare][a] 选题:[lujun9972][b] 译者:[lnrCoder](https://github.com/lnrCoder) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 36328b2216540d5619e62691c589476f336c77fa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 00:21:30 +0800 Subject: [PATCH 096/800] PUB @lnrCoder https://linux.cn/article-11492-1.html --- ...10 DevSecOps pipelines and tools- What you need to know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191010 DevSecOps pipelines and tools- What you need to know.md (98%) diff --git a/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md b/published/20191010 DevSecOps pipelines and tools- What you need to know.md similarity index 98% rename from translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md rename to published/20191010 DevSecOps pipelines and tools- What you need to know.md index 37289cddfc..11ef11bb61 100644 --- a/translated/tech/20191010 DevSecOps pipelines and tools- What you need to know.md +++ b/published/20191010 DevSecOps pipelines and tools- What you need to know.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11492-1.html) [#]: subject: (DevSecOps pipelines and tools: What you need to know) [#]: via: (https://opensource.com/article/19/10/devsecops-pipeline-and-tools) [#]: author: (Sagar Nangare https://opensource.com/users/sagarnangare) From f575b98f71897718ec1e697991a2aebd7dbe9139 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 00:54:22 +0800 Subject: [PATCH 097/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20Disney?= =?UTF-8?q?=E2=80=99s=20Streaming=20Service=20is=20Having=20Troubles=20wit?= =?UTF-8?q?h=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191023 Disney-s Streaming Service is Having Troubles with Linux.md --- ...g Service is Having Troubles with Linux.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20191023 Disney-s Streaming Service is Having Troubles with Linux.md diff --git a/sources/tech/20191023 Disney-s Streaming Service is Having Troubles with Linux.md b/sources/tech/20191023 Disney-s Streaming Service is Having Troubles with Linux.md new file mode 100644 index 0000000000..8dbe791467 --- /dev/null +++ b/sources/tech/20191023 Disney-s Streaming Service is Having Troubles with Linux.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Disney’s Streaming Service is Having Troubles with Linux) +[#]: via: (https://itsfoss.com/disney-plus-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Disney’s Streaming Service is Having Troubles with Linux +====== + +You might be already using Amazon Prime Video (comes free with [Amazon Prime membership][1]) or [Netflix on your Linux system][2]. Google Chrome supports these streaming services out of the box. You can also [watch Netflix on Firefox in Linux][3] but you have to explicitly enable DRM content. + +However we just learned that Disney’s upcoming streaming service, Disney+ does not work in the same way. + +A user, Hans de Goede, on [LiveJournal][4] revealed this from his experience with Disney+ in the testing period. In fact, the upcoming streaming service Disney+ does not support Linux at all, at least for now. + +### The trouble with Disney+ and DRM + +![][5] + +As Hans explains in his [post][4], he subscribed to the streaming service in the testing period because of the availability of Disney+ in Netherlands. + +Hans tested it on Fedora with mainstream browsers like Firefox and Chrome. However, every time, an error was encountered – “**Error Code 83**“. + +So, he reached out to Disney support to solve the issue – but interestingly they weren’t even properly aware of the issue as it took them a week to give him a response. + +Here’s how he puts his experience: + +> So I mailed the Disney helpdesk about this, explaining how Linux works fine with Netflix, AmazonPrime video and even the web-app from my local cable provider. They promised to get back to me in 24 hours, the eventually got back to me in about a week. They wrote: “We are familiar with Error 83. This often happens if you want to play Disney + via the web browser or certain devices. Our IT department working hard to solve this. In the meantime, I want to advise you to watch Disney + via the app on a phone or tablet. If this error code still occurs in a few days, you can check the help center …” this was on September 23th. + +They just blatantly advised him to use his phone/tablet to access the streaming service instead. That’s genius! + +### Disney should reconsider their DRM implementation + +What is DRM? + +Digital Rights Management ([DRM][6]) technologies attempt to control what you can and can’t do with the media and hardware you’ve purchased. + +Even though they want to make sure that their content remains protected from pirates (which won’t make a difference either), it creates a problem with the support for multiple platforms. + +How on earth do you expect more people to subscribe to your streaming service when you do not even support platforms like Linux? So many media center devices run on Linux. This will be a big setback if Disney continues like this. + +To shed some light on the issue, a user on [tweakers.net][7] found out that it is a [Widevine][8] error. Here, it generally means that your device is incompatible with the security level of DRM implemented. + +It turns out that it isn’t just limited to Linux – but a lot of users are encountering the same error on other platforms as well. + +In addition to the wave of issues, the Widevine error also points to a fact that Disney+ may not even work on Chromebooks, some Android smartphones, and Linux desktops in general. + +Seriously, Disney? + +### Go easy, Disney! + +A common DRM (low-level security) implementation with Disney+ should make it accessible on every platform including Linux systems. + +Disney+ might want to re-think about the DRM implementation if they want to compete with other streaming platforms like Netflix and Amazon Prime Video. + +Personally, I would prefer to stay with Netflix if Disney does not care about supporting multiple platforms. + +It is not actually about supporting “Linux” but conveniently making the streaming service available for more platforms which could justify its subscription fee. + +What do you think about this? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/disney-plus-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.amazon.com/tryprimefree?tag=chmod7mediate-20 +[2]: https://itsfoss.com/watch-netflix-in-ubuntu-linux/ +[3]: https://itsfoss.com/netflix-firefox-linux/ +[4]: https://hansdegoede.livejournal.com/22338.html +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/disney-plus-linux.jpg?resize=800%2C450&ssl=1 +[6]: https://www.eff.org/issues/drm +[7]: https://tweakers.net/nieuws/157224/disney+-start-met-gratis-proefperiode-van-twee-maanden-in-nederland.html?showReaction=13428408#r_13428408 +[8]: https://www.widevine.com/ From 197dcf41c3ef8f64e141da0a070127085f6150a7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 00:56:52 +0800 Subject: [PATCH 098/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20How=20?= =?UTF-8?q?to=20program=20with=20Bash:=20Logical=20operators=20and=20shell?= =?UTF-8?q?=20expansions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md --- ... Logical operators and shell expansions.md | 498 ++++++++++++++++++ 1 file changed, 498 insertions(+) create mode 100644 sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md diff --git a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md new file mode 100644 index 0000000000..2d92d9a66c --- /dev/null +++ b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -0,0 +1,498 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to program with Bash: Logical operators and shell expansions) +[#]: via: (https://opensource.com/article/19/10/programming-bash-part-2) +[#]: author: (David Both https://opensource.com/users/dboth) + +How to program with Bash: Logical operators and shell expansions +====== +Learn about logical operators and shell expansions, in the second +article in this three-part series on programming with Bash. +![Women in computing and open source v5][1] + +Bash is a powerful programming language, one perfectly designed for use on the command line and in shell scripts. This three-part series (which is based on my [three-volume Linux self-study course][2]) explores using Bash as a programming language on the command-line interface (CLI). + +The [first article][3] explored some simple command-line programming with Bash, including using variables and control operators. This second article looks into the types of file, string, numeric, and miscellaneous logical operators that provide execution-flow control logic and different types of shell expansions in Bash. The third and final article in the series will explore the **for**, **while**, and **until** loops that enable repetitive operations. + +Logical operators are the basis for making decisions in a program and executing different sets of instructions based on those decisions. This is sometimes called flow control. + +### Logical operators + +Bash has a large set of logical operators that can be used in conditional expressions. The most basic form of the **if** control structure tests for a condition and then executes a list of program statements if the condition is true. There are three types of operators: file, numeric, and non-numeric operators. Each operator returns true (0) if the condition is met and false (1) if the condition is not met. + +The functional syntax of these comparison operators is one or two arguments with an operator that are placed within square braces, followed by a list of program statements that are executed if the condition is true, and an optional list of program statements if the condition is false: + + +``` +if [ arg1 operator arg2 ] ; then list +or +if [ arg1 operator arg2 ] ; then list ; else list ; fi +``` + +The spaces in the comparison are required as shown. The single square braces, **[** and **]**, are the traditional Bash symbols that are equivalent to the **test** command: + + +``` +`if test arg1 operator arg2 ; then list` +``` + +There is also a more recent syntax that offers a few advantages and that some sysadmins prefer. This format is a bit less compatible with different versions of Bash and other shells, such as ksh (the Korn shell). It looks like: + + +``` +`if [[ arg1 operator arg2 ]] ; then list` +``` + +#### File operators + +File operators are a powerful set of logical operators within Bash. Figure 1 lists more than 20 different operators that Bash can perform on files. I use them quite frequently in my scripts. + +Operator | Description +---|--- +-a filename | True if the file exists; it can be empty or have some content but, so long as it exists, this will be true +-b filename | True if the file exists and is a block special file such as a hard drive like **/dev/sda** or **/dev/sda1** +-c filename | True if the file exists and is a character special file such as a TTY device like **/dev/TTY1** +-d filename | True if the file exists and is a directory +-e filename | True if the file exists; this is the same as **-a** above +-f filename | True if the file exists and is a regular file, as opposed to a directory, a device special file, or a link, among others +-g filename | True if the file exists and is **set-group-id**, **SETGID** +-h filename | True if the file exists and is a symbolic link +-k filename | True if the file exists and its "sticky'" bit is set +-p filename | True if the file exists and is a named pipe (FIFO) +-r filename | True if the file exists and is readable, i.e., has its read bit set +-s filename | True if the file exists and has a size greater than zero; a file that exists but that has a size of zero will return false +-t fd | True if the file descriptor **fd** is open and refers to a terminal +-u filename | True if the file exists and its **set-user-id** bit is set +-w filename | True if the file exists and is writable +-x filename | True if the file exists and is executable +-G filename | True if the file exists and is owned by the effective group ID +-L filename | True if the file exists and is a symbolic link +-N filename | True if the file exists and has been modified since it was last read +-O filename | True if the file exists and is owned by the effective user ID +-S filename | True if the file exists and is a socket +file1 -ef file2 | True if file1 and file2 refer to the same device and iNode numbers +file1 -nt file2 | True if file1 is newer (according to modification date) than file2, or if file1 exists and file2 does not +file1 -ot file2 | True if file1 is older than file2, or if file2 exists and file1 does not + +_**Fig. 1: The Bash file operators**_ + +As an example, start by testing for the existence of a file: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; if [ -e $File ] ; then echo "The file $File exists." ; else echo "The file $File does not exist." ; fi +The file TestFile1 does not exist. +[student@studentvm1 testdir]$ +``` + +Next, create a file for testing named **TestFile1**. For now, it does not need to contain any data: + + +``` +`[student@studentvm1 testdir]$ touch TestFile1` +``` + +It is easy to change the value of the **$File** variable rather than a text string for the file name in multiple locations in this short CLI program: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; if [ -e $File ] ; then echo "The file $File exists." ; else echo "The file $File does not exist." ; fi +The file TestFile1 exists. +[student@studentvm1 testdir]$ +``` + +Now, run a test to determine whether a file exists and has a non-zero length, which means it contains data. You want to test for three conditions: 1. the file does not exist; 2. the file exists and is empty; and 3. the file exists and contains data. Therefore, you need a more complex set of tests—use the **elif** stanza in the **if-elif-else** construct to test for all of the conditions: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; if [ -s $File ] ; then echo "$File exists and contains data." ; fi +[student@studentvm1 testdir]$ +``` + +In this case, the file exists but does not contain any data. Add some data and try again: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; fi +TestFile1 exists and contains data. +[student@studentvm1 testdir]$ +``` + +That works, but it is only truly accurate for one specific condition out of the three possible ones. Add an **else** stanza so you can be somewhat more accurate, and delete the file so you can fully test this new code: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; rm $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi +TestFile1 does not exist or is empty. +``` + +Now create an empty file to test: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; touch $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi +TestFile1 does not exist or is empty. +``` + +Add some content to the file and test again: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is file $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; else echo "$File does not exist or is empty." ; fi +TestFile1 exists and contains data. +``` + +Now, add the **elif** stanza to discriminate between a file that does not exist and one that is empty: + + +``` +[student@studentvm1 testdir]$ File="TestFile1" ; touch $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; elif [ -e $File ] ; then echo "$File exists and is empty." ; else echo "$File does not exist." ; fi +TestFile1 exists and is empty. +[student@studentvm1 testdir]$ File="TestFile1" ; echo "This is $File" > $File ; if [ -s $File ] ; then echo "$File exists and contains data." ; elif [ -e $File ] ; then echo "$File exists and is empty." ; else echo "$File does not exist." ; fi +TestFile1 exists and contains data. +[student@studentvm1 testdir]$ +``` + +Now you have a Bash CLI program that can test for these three different conditions… but the possibilities are endless. + +It is easier to see the logic structure of the more complex compound commands if you arrange the program statements more like you would in a script that you can save in a file. Figure 2 shows how this would look. The indents of the program statements in each stanza of the **if-elif-else** structure help to clarify the logic. + + +``` +File="TestFile1" +echo "This is $File" > $File +if [ -s $File ] +   then +   echo "$File exists and contains data." +elif [ -e $File ] +   then +   echo "$File exists and is empty." +else +   echo "$File does not exist." +fi +``` + +_**Fig. 2: The command line program rewritten as it would appear in a script**_ + +Logic this complex is too lengthy for most CLI programs. Although any Linux or Bash built-in commands may be used in CLI programs, as the CLI programs get longer and more complex, it makes more sense to create a script that is stored in a file and can be executed at any time, now or in the future. + +#### String comparison operators + +String comparison operators enable the comparison of alphanumeric strings of characters. There are only a few of these operators, which are listed in Figure 3. + +Operator | Description +---|--- +-z string | True if the length of string is zero +-n string | True if the length of string is non-zero +string1 == string2 +or +string1 = string2 | True if the strings are equal; a single **=** should be used with the test command for POSIX conformance. When used with the **[[** command, this performs pattern matching as described above (compound commands). +string1 != string2 | True if the strings are not equal +string1 < string2 | True if string1 sorts before string2 lexicographically (refers to locale-specific sorting sequences for all alphanumeric and special characters) +string1 > string2 | True if string1 sorts after string2 lexicographically + +_**Fig. 3: Bash string logical operators**_ + +First, look at string length. The quotes around **$MyVar** in the comparison must be there for the comparison to work. (You should still be working in **~/testdir**.) + + +``` +[student@studentvm1 testdir]$ MyVar="" ; if [ -z "" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi +MyVar is zero length. +[student@studentvm1 testdir]$ MyVar="Random text" ; if [ -z "" ] ; then echo "MyVar is zero length." ; else echo "MyVar contains data" ; fi +MyVar is zero length. +``` + +You could also do it this way: + + +``` +[student@studentvm1 testdir]$ MyVar="Random text" ; if [ -n "$MyVar" ] ; then echo "MyVar contains data." ; else echo "MyVar is zero length" ; fi +MyVar contains data. +[student@studentvm1 testdir]$ MyVar="" ; if [ -n "$MyVar" ] ; then echo "MyVar contains data." ; else echo "MyVar is zero length" ; fi +MyVar is zero length +``` + +Sometimes you may need to know a string's exact length. This is not a comparison, but it is related. Unfortunately, there is no simple way to determine the length of a string. There are a couple of ways to do it, but I think using the **expr** (evaluate expression) command is easiest. Read the man page for **expr** for more about what it can do. Note that quotes are required around the string or variable you're testing. + + +``` +[student@studentvm1 testdir]$ MyVar="" ; expr length "$MyVar" +0 +[student@studentvm1 testdir]$ MyVar="How long is this?" ; expr length "$MyVar" +17 +[student@studentvm1 testdir]$ expr length "We can also find the length of a literal string as well as a variable." +70 +``` + +Regarding comparison operators, I use a lot of testing in my scripts to determine whether two strings are equal (i.e., identical). I use the non-POSIX version of this comparison operator: + + +``` +[student@studentvm1 testdir]$ Var1="Hello World" ; Var2="Hello World" ; if [ "$Var1" == "$Var2" ] ; then echo "Var1 matches Var2" ; else echo "Var1 and Var2 do not match." ; fi +Var1 matches Var2 +[student@studentvm1 testdir]$ Var1="Hello World" ; Var2="Hello world" ; if [ "$Var1" == "$Var2" ] ; then echo "Var1 matches Var2" ; else echo "Var1 and Var2 do not match." ; fi +Var1 and Var2 do not match. +``` + +Experiment some more on your own to try out these operators. + +#### Numeric comparison operators + +Numeric operators make comparisons between two numeric arguments. Like the other operator classes, most are easy to understand. + +Operator | Description +---|--- +arg1 -eq arg2 | True if arg1 equals arg2 +arg1 -ne arg2 | True if arg1 is not equal to arg2 +arg1 -lt arg2 | True if arg1 is less than arg2 +arg1 -le arg2 | True if arg1 is less than or equal to arg2 +arg1 -gt arg2 | True if arg1 is greater than arg2 +arg1 -ge arg2 | True if arg1 is greater than or equal to arg2 + +_**Fig. 4: Bash numeric comparison logical operators**_ + +Here are some simple examples. The first instance sets the variable **$X** to 1, then tests to see if **$X** is equal to 1. In the second instance, **X** is set to 0, so the comparison is not true. + + +``` +[student@studentvm1 testdir]$ X=1 ; if [ $X -eq 1 ] ; then echo "X equals 1" ; else echo "X does not equal 1" ; fi +X equals 1 +[student@studentvm1 testdir]$ X=0 ; if [ $X -eq 1 ] ; then echo "X equals 1" ; else echo "X does not equal 1" ; fi +X does not equal 1 +[student@studentvm1 testdir]$ +``` + +Try some more experiments on your own. + +#### Miscellaneous operators + +These miscellaneous operators show whether a shell option is set or a shell variable has a value, but it does not discover the value of the variable, just whether it has one. + +Operator | Description +---|--- +-o optname | True if the shell option optname is enabled (see the list of options under the description of the **-o** option to the Bash set builtin in the Bash man page) +-v varname | True if the shell variable varname is set (has been assigned a value) +-R varname | True if the shell variable varname is set and is a name reference + +_**Fig. 5: Miscellaneous Bash logical operators**_ + +Experiment on your own to try out these operators. + +### Expansions + +Bash supports a number of types of expansions and substitutions that can be quite useful. According to the Bash man page, Bash has seven forms of expansions. This article looks at five of them: tilde expansion, arithmetic expansion, pathname expansion, brace expansion, and command substitution. + +#### Brace expansion + +Brace expansion is a method for generating arbitrary strings. (This tool is used below to create a large number of files for experiments with special pattern characters.) Brace expansion can be used to generate lists of arbitrary strings and insert them into a specific location within an enclosing static string or at either end of a static string. This may be hard to visualize, so it's best to just do it. + +First, here's what a brace expansion does: + + +``` +[student@studentvm1 testdir]$ echo {string1,string2,string3} +string1 string2 string3 +``` + +Well, that is not very helpful, is it? But look what happens when you use it just a bit differently: + + +``` +[student@studentvm1 testdir]$ echo "Hello "{David,Jen,Rikki,Jason}. +Hello David. Hello Jen. Hello Rikki. Hello Jason. +``` + +That looks like something useful—it could save a good deal of typing. Now try this: + + +``` +[student@studentvm1 testdir]$ echo b{ed,olt,ar}s +beds bolts bars +``` + +I could go on, but you get the idea. + +#### Tilde expansion + +Arguably, the most common expansion is the tilde (**~**) expansion. When you use this in a command like **cd ~/Documents**, the Bash shell expands it as a shortcut to the user's full home directory. + +Use these Bash programs to observe the effects of the tilde expansion: + + +``` +[student@studentvm1 testdir]$ echo ~ +/home/student +[student@studentvm1 testdir]$ echo ~/Documents +/home/student/Documents +[student@studentvm1 testdir]$ Var1=~/Documents ; echo $Var1 ; cd $Var1 +/home/student/Documents +[student@studentvm1 Documents]$ +``` + +#### Pathname expansion + +Pathname expansion is a fancy term expanding file-globbing patterns, using the characters **?** and *****, into the full names of directories that match the pattern. File globbing refers to special pattern characters that enable significant flexibility in matching file names, directories, and other strings when performing various actions. These special pattern characters allow matching single, multiple, or specific characters in a string. + + * **?** — Matches only one of any character in the specified location within the string + * ***** — Matches zero or more of any character in the specified location within the string + + + +This expansion is applied to matching directory names. To see how this works, ensure that **testdir** is the present working directory (PWD) and start with a plain listing (the contents of my home directory will be different from yours): + + +``` +[student@studentvm1 testdir]$ ls +chapter6  cpuHog.dos    dmesg1.txt  Documents  Music       softlink1  testdir6    Videos +chapter7  cpuHog.Linux  dmesg2.txt  Downloads  Pictures    Templates  testdir +testdir  cpuHog.mac    dmesg3.txt  file005    Public      testdir    tmp +cpuHog     Desktop       dmesg.txt   link3      random.txt  testdir1   umask.test +[student@studentvm1 testdir]$ +``` + +Now list the directories that start with **Do**, **testdir/Documents**, and **testdir/Downloads**: + + +``` +Documents: +Directory01  file07  file15        test02  test10  test20      testfile13  TextFiles +Directory02  file08  file16        test03  test11  testfile01  testfile14 +file01       file09  file17        test04  test12  testfile04  testfile15 +file02       file10  file18        test05  test13  testfile05  testfile16 +file03       file11  file19        test06  test14  testfile09  testfile17 +file04       file12  file20        test07  test15  testfile10  testfile18 +file05       file13  Student1.txt  test08  test16  testfile11  testfile19 +file06       file14  test01        test09  test18  testfile12  testfile20 + +Downloads: +[student@studentvm1 testdir]$ +``` + +Well, that did not do what you wanted. It listed the contents of the directories that begin with **Do**. To list only the directories and not their contents, use the **-d** option. + + +``` +[student@studentvm1 testdir]$ ls -d Do* +Documents  Downloads +[student@studentvm1 testdir]$ +``` + +In both cases, the Bash shell expands the **Do*** pattern into the names of the two directories that match the pattern. But what if there are also files that match the pattern? + + +``` +[student@studentvm1 testdir]$ touch Downtown ; ls -d Do* +Documents  Downloads  Downtown +[student@studentvm1 testdir]$ +``` + +This shows the file, too. So any files that match the pattern are also expanded to their full names. + +#### Command substitution + +Command substitution is a form of expansion that allows the STDOUT data stream of one command to be used as the argument of another command; for example, as a list of items to be processed in a loop. The Bash man page says: "Command substitution allows the output of a command to replace the command name." I find that to be accurate if a bit obtuse. + +There are two forms of this substitution, **`command`** and **$(command)**. In the older form using back tics (**`**), using a backslash (**\**) in the command retains its literal meaning. However, when it's used in the newer parenthetical form, the backslash takes on its meaning as a special character. Note also that the parenthetical form uses only single parentheses to open and close the command statement. + +I frequently use this capability in command-line programs and scripts where the results of one command can be used as an argument for another command. + +Start with a very simple example that uses both forms of this expansion (again, ensure that **testdir** is the PWD): + + +``` +[student@studentvm1 testdir]$ echo "Todays date is `date`" +Todays date is Sun Apr  7 14:42:46 EDT 2019 +[student@studentvm1 testdir]$ echo "Todays date is $(date)" +Todays date is Sun Apr  7 14:42:59 EDT 2019 +[student@studentvm1 testdir]$ +``` + +The **-w** option to the **seq** utility adds leading zeros to the numbers generated so that they are all the same width, i.e., the same number of digits regardless of the value. This makes it easier to sort them in numeric sequence. + +The **seq** utility is used to generate a sequence of numbers: + + +``` +[student@studentvm1 testdir]$ seq 5 +1 +2 +3 +4 +5 +[student@studentvm1 testdir]$ echo `seq 5` +1 2 3 4 5 +[student@studentvm1 testdir]$ +``` + +Now you can do something a bit more useful, like creating a large number of empty files for testing: + + +``` +`[student@studentvm1 testdir]$ for I in $(seq -w 5000) ; do touch file-$I ; done` +``` + +In this usage, the statement **seq -w 5000** generates a list of numbers from one to 5,000. By using command substitution as part of the **for** statement, the list of numbers is used by the **for** statement to generate the numerical part of the file names. + +#### Arithmetic expansion + +Bash can perform integer math, but it is rather cumbersome (as you will soon see). The syntax for arithmetic expansion is **$((arithmetic-expression))**, using double parentheses to open and close the expression. + +Arithmetic expansion works like command substitution in a shell program or script; the value calculated from the expression replaces the expression for further evaluation by the shell. + +Once again, start with something simple: + + +``` +[student@studentvm1 testdir]$ echo $((1+1)) +2 +[student@studentvm1 testdir]$ Var1=5 ; Var2=7 ; Var3=$((Var1*Var2)) ; echo "Var 3 = $Var3" +Var 3 = 35 +``` + +The following division results in zero because the result would be a decimal value of less than one: + + +``` +[student@studentvm1 testdir]$ Var1=5 ; Var2=7 ; Var3=$((Var1/Var2)) ; echo "Var 3 = $Var3" +Var 3 = 0 +``` + +Here is a simple calculation I often do in a script or CLI program that tells me how much total virtual memory I have in a Linux host. The **free** command does not provide that data: + + +``` +[student@studentvm1 testdir]$ RAM=`free | grep ^Mem | awk '{print $2}'` ; Swap=`free | grep ^Swap | awk '{print $2}'` ; echo "RAM = $RAM and Swap = $Swap" ; echo "Total Virtual memory is $((RAM+Swap))" ; +RAM = 4037080 and Swap = 6291452 +Total Virtual memory is 10328532 +``` + +I used the **`** character to delimit the sections of code used for command substitution. + +I use Bash arithmetic expansion mostly for checking system resource amounts in a script and then choose a program execution path based on the result. + +### Summary + +This article, the second in this series on Bash as a programming language, explored the Bash file, string, numeric, and miscellaneous logical operators that provide execution-flow control logic and the different types of shell expansions. + +The third article in this series will explore the use of loops for performing various types of iterative operations. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/programming-bash-part-2 + +作者:[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/OSDC_women_computing_5.png?itok=YHpNs_ss (Women in computing and open source v5) +[2]: http://www.both.org/?page_id=1183 +[3]: https://opensource.com/article/19/10/programming-bash-part-1 From 95eb7079997b10b0e5c9b933c29c132ae07241fe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 00:58:37 +0800 Subject: [PATCH 099/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20Initia?= =?UTF-8?q?lizing=20arrays=20in=20Java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191022 Initializing arrays in Java.md --- .../20191022 Initializing arrays in Java.md | 389 ++++++++++++++++++ 1 file changed, 389 insertions(+) create mode 100644 sources/tech/20191022 Initializing arrays in Java.md diff --git a/sources/tech/20191022 Initializing arrays in Java.md b/sources/tech/20191022 Initializing arrays in Java.md new file mode 100644 index 0000000000..50451e57c3 --- /dev/null +++ b/sources/tech/20191022 Initializing arrays in Java.md @@ -0,0 +1,389 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Initializing arrays in Java) +[#]: via: (https://opensource.com/article/19/10/initializing-arrays-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Initializing arrays in Java +====== +Arrays are a helpful data type for managing collections elements best +modeled in contiguous memory locations. Here's how to use them +effectively. +![Coffee beans and a cup of coffee][1] + +People who have experience programming in languages like C or FORTRAN are familiar with the concept of arrays. They’re basically a contiguous block of memory where each location is a certain type: integers, floating-point numbers, or what-have-you. + +The situation in Java is similar, but with a few extra wrinkles. + +### An example array + +Let’s make an array of 10 integers in Java: + + +``` +int[] ia = new int[10]; +``` + +What’s going on in the above piece of code? From left to right: + + 1. The **int[]** to the extreme left declares the _type_ of the variable as an array (denoted by the **[]**) of **int**. + + 2. To the right is the _name_ of the variable, which in this case is **ia**. + + 3. Next, the **=** tells us that the variable defined on the left side is set to what’s to the right side. + + 4. To the right of the **=** we see the word **new**, which in Java indicates that an object is being _initialized_, meaning that storage is allocated and its constructor is called ([see here for more information][2]). + + 5. Next, we see **int[10]**, which tells us that the specific object being initialized is an array of 10 integers. + + + + +Since Java is strongly-typed, the type of the variable **ia** must be compatible with the type of the expression on the right-hand side of the **=**. + +### Initializing the example array + +Let’s put this simple array in a piece of code and try it out. Save the following in a file called **Test1.java**, use **javac** to compile it, and use **java** to run it (in the terminal of course): + + +``` +import java.lang.*; + +public class Test1 { + +    public static void main([String][3][] args) { +        int[] ia = new int[10];                              // See note 1 below +        [System][4].out.println("ia is " + ia.getClass());        // See note 2 below +        for (int i = 0; i < ia.length; i++)                  // See note 3 below +            [System][4].out.println("ia[" + i + "] = " + ia[i]);  // See note 4 below +    } + +} +``` + +Let’s work through the most important bits. + + 1. Our declaration and initialization of the array of 10 integers, **ia**, is easy to spot. + 2. In the line just following, we see the expression **ia.getClass()**. That’s right, **ia** is an _object_ belonging to a _class_, and this code will let us know which class that is. + 3. In the next line following that, we see the start of the loop **for (int i = 0; i < ia.length; i++)**, which defines a loop index variable **i** that runs through a sequence from zero to one less than **ia.length**, which is an expression that tells us how many elements are defined in the array **ia**. + 4. Next, the body of the loop prints out the values of each element of **ia**. + + + +When this program is compiled and run, it produces the following results: + + +``` +me@mydesktop:~/Java$ javac Test1.java +me@mydesktop:~/Java$ java Test1 +ia is class [I +ia[0] = 0 +ia[1] = 0 +ia[2] = 0 +ia[3] = 0 +ia[4] = 0 +ia[5] = 0 +ia[6] = 0 +ia[7] = 0 +ia[8] = 0 +ia[9] = 0 +me@mydesktop:~/Java$ +``` + +The string representation of the output of **ia.getClass()** is **[I**, which is shorthand for "array of integer." Similar to the C programming language, Java arrays begin with element zero and extend up to element **<array size> – 1**. We can see above that each of the elements of **ia** are set to zero (by the array constructor, it seems). + +So, is that it? We declare the type, use the appropriate initializer, and we’re done? + +Well, no. There are many other ways to initialize an array in Java.  + +### Why do I want to initialize an array, anyway? + +The answer to this question, like that of all good questions, is "it depends." In this case, the answer depends on what we expect to do with the array once it is initialized. + +In some cases, arrays emerge naturally as a type of accumulator. For example, suppose we are writing code for counting the number of calls received and made by a set of telephone extensions in a small office. There are eight extensions, numbered one through eight, plus the operator’s extension, numbered zero. So we might declare two arrays: + + +``` +int[] callsMade; +int[] callsReceived; +``` + +Then, whenever we start a new period of accumulating call statistics, we initialize each array as: + + +``` +callsMade = new int[9]; +callsReceived = new int[9]; +``` + +At the end of each period of accumulating call statistics, we can print out the stats. In very rough terms, we might see: + + +``` +import java.lang.*; +import java.io.*; + +public class Test2 { + +    public static void main([String][3][] args) { + +        int[] callsMade; +        int[] callsReceived; + +        // initialize call counters + +        callsMade = new int[9]; +        callsReceived = new int[9]; + +        // process calls... +        //   an extension makes a call: callsMade[ext]++ +        //   an extension receives a call: callsReceived[ext]++ + +        // summarize call statistics + +        [System][4].out.printf("%3s%25s%25s\n","ext"," calls made", +            "calls received"); +        for (int ext = 0; ext < callsMade.length; ext++) +            [System][4].out.printf("%3d%25d%25d\n",ext, +                callsMade[ext],callsReceived[ext]); + +    } + +} +``` + +Which would produce output something like this: + + +``` +me@mydesktop:~/Java$ javac Test2.java +me@mydesktop:~/Java$ java Test2 +ext               calls made           calls received +  0                        0                        0 +  1                        0                        0 +  2                        0                        0 +  3                        0                        0 +  4                        0                        0 +  5                        0                        0 +  6                        0                        0 +  7                        0                        0 +  8                        0                        0 +me@mydesktop:~/Java$ +``` + +Not a very busy day in the call center. + +In the above example of an accumulator, we see that the starting value of zero as set by the array initializer is satisfactory for our needs. But in other cases, this starting value may not be the right choice. + +For example, in some kinds of geometric computations, we might need to initialize a two-dimensional array to the identity matrix (all zeros except for the ones along the main diagonal). We might choose to do this as: + + +``` + double[][] m = new double[3][3]; +        for (int d = 0; d < 3; d++) +            m[d][d] = 1.0; +``` + +In this case, we rely on the array initializer **new double[3][3]** to set the array to zeros, and then use a loop to set the diagonal elements to ones. In this simple case, we might use a shortcut that Java provides: + + +``` + double[][] m = { +         {1.0, 0.0, 0.0}, +         {0.0, 1.0, 0.0}, +         {0.0, 0.0, 1.0}}; +``` + +This type of visual structure is particularly appropriate in this sort of application, where it can be a useful double-check to see the actual layout of the array. But in the case where the number of rows and columns is only determined at run time, we might instead see something like this: + + +``` + int nrc; + // some code determines the number of rows & columns = nrc + double[][] m = new double[nrc][nrc]; + for (int d = 0; d < nrc; d++) +     m[d][d] = 1.0; +``` + +It’s worth mentioning that a two-dimensional array in Java is actually an array of arrays, and there’s nothing stopping the intrepid programmer from having each one of those second-level arrays be a different length. That is, something like this is completely legitimate: + + +``` +int [][] differentLengthRows = { +     { 1, 2, 3, 4, 5}, +     { 6, 7, 8, 9}, +     {10,11,12}, +     {13,14}, +     {15}}; +``` + +There are various linear algebra applications that involve irregularly-shaped matrices, where this type of structure could be applied (for more information see [this Wikipedia article][5] as a starting point). Beyond that, now that we understand that a two-dimensional array is actually an array of arrays, it shouldn’t be too much of a surprise that: + + +``` +differentLengthRows.length +``` + +tells us the number of rows in the two-dimensional array **differentLengthRows**, and: + + +``` +differentLengthRows[i].length +``` + +tells us the number of columns in row **i** of **differentLengthRows**. + +### Taking the array further + +Considering this idea of array size that is determined at run time, we see that arrays still require us to know that size before instantiating them. But what if we don’t know the size until we’ve processed all of the data? Does that mean we have to process it once to figure out the size of the array, and then process it again? That could be hard to do, especially if we only get one chance to consume the data. + +The [Java Collections Framework][6] solves this problem in a nice way. One of the things provided there is the class **ArrayList**, which is like an array but dynamically extensible. To demonstrate the workings of **ArrayList**, let’s create one and initialize it to the first 20 [Fibonacci numbers][7]: + + +``` +import java.lang.*; +import java.util.*; + +public class Test3 { +        +        public static void main([String][3][] args) { + +                ArrayList<Integer> fibos = new ArrayList<Integer>(); + +                fibos.add(0); +                fibos.add(1); +                for (int i = 2; i < 20; i++) +                        fibos.add(fibos.get(i-1) + fibos.get(i-2)); + +                for (int i = 0; i < fibos.size(); i++) +                        [System][4].out.println("fibonacci " + i + +                       " = " + fibos.get(i)); + +        } +} +``` + +Above, we see: + + * The declaration and instantiation of an **ArrayList** that is used to store **Integer**s. + * The use of **add()** to append to the **ArrayList** instance. + * The use of **get()** to retrieve an element by index number. + * The use of **size()** to determine how many elements are already in the **ArrayList** instance. + + + +Not shown is the **put()** method, which places a value at a given index number. + +The output of this program is: + + +``` +fibonacci 0 = 0 +fibonacci 1 = 1 +fibonacci 2 = 1 +fibonacci 3 = 2 +fibonacci 4 = 3 +fibonacci 5 = 5 +fibonacci 6 = 8 +fibonacci 7 = 13 +fibonacci 8 = 21 +fibonacci 9 = 34 +fibonacci 10 = 55 +fibonacci 11 = 89 +fibonacci 12 = 144 +fibonacci 13 = 233 +fibonacci 14 = 377 +fibonacci 15 = 610 +fibonacci 16 = 987 +fibonacci 17 = 1597 +fibonacci 18 = 2584 +fibonacci 19 = 4181 +``` + +**ArrayList** instances can also be initialized by other techniques. For example, an array can be supplied to the **ArrayList** constructor, or the **List.of()** and **Arrays.asList()** methods can be used when the initial elements are known at compile time. I don’t find myself using these options all that often since my primary use case for an **ArrayList** is when I only want to read the data once. + +Moreover, an **ArrayList** instance can be converted to an array using its **toArray()** method, for those who prefer to work with an array once the data is loaded; or, returning to the current topic, once the **ArrayList** instance is initialized. + +The Java Collections Framework provides another kind of array-like data structure called a **Map**. What I mean by "array-like" is that a **Map** defines a collection of objects whose values can be set or retrieved by a key, but unlike an array (or an **ArrayList**), this key need not be an integer; it could be a **String** or any other complex object. + +For example, we can create a **Map** whose keys are **String**s and whose values are **Integer**s as follows: + + +``` +Map<[String][3],Integer> stoi = new Map<[String][3],Integer>(); +``` + +Then we can initialize this **Map** as follows: + + +``` +stoi.set("one",1); +stoi.set("two",2); +stoi.set("three",3); +``` + +And so on. Later, when we want to know the numeric value of **"three"**, we can retrieve it as: + + +``` +stoi.get("three"); +``` + +In my world, a **Map** is useful for converting strings occurring in third-party datasets into coherent code values in my datasets. As a part of a [data transformation pipeline][8], I will often build a small standalone program to clean the data before processing it; for this, I will almost always use one or more **Map**s. + +Worth mentioning is that it’s quite possible, and sometimes reasonable, to have **ArrayLists** of **ArrayLists** and **Map**s of **Map**s. For example, let’s assume we’re looking at trees, and we’re interested in accumulating the count of the number of trees by tree species and age range. Assuming that the age range definition is a set of string values ("young," "mid," "mature," and "old") and that the species are string values like "Douglas fir," "western red cedar," and so forth, then we might define a **Map** of **Map**s as: + + +``` +Map<[String][3],Map<[String][3],Integer>> counter = +        new Map<[String][3],Map<[String][3],Integer>>(); +``` + +One thing to watch out for here is that the above only creates storage for the _rows_ of **Map**s. So, our accumulation code might look like: + + +``` +// assume at this point we have figured out the species +// and age range +if (!counter.containsKey(species)) +        counter.put(species,new Map<[String][3],Integer>()); +if (!counter.get(species).containsKey(ageRange)) +        counter.get(species).put(ageRange,0); +``` + +At which point, we can start accumulating as: + + +``` +counter.get(species).put(ageRange, +        counter.get(species).get(ageRange) + 1); +``` + +Finally, it’s worth mentioning that the (new in Java 8) Streams facility can also be used to initialize arrays, **ArrayList** instances, and **Map** instances. A nice discussion of this feature can be found [here][9] and [here][10]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/initializing-arrays-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/19/8/what-object-java +[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[5]: https://en.wikipedia.org/wiki/Irregular_matrix +[6]: https://en.wikipedia.org/wiki/Java_collections_framework +[7]: https://en.wikipedia.org/wiki/Fibonacci_number +[8]: https://towardsdatascience.com/data-science-for-startups-data-pipelines-786f6746a59a +[9]: https://stackoverflow.com/questions/36885371/lambda-expression-to-initialize-array +[10]: https://stackoverflow.com/questions/32868665/how-to-initialize-a-map-using-a-lambda From 8408078368d5e3f9d02b086ed0977ede4116dcf7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 01:00:05 +0800 Subject: [PATCH 100/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20NGT:?= =?UTF-8?q?=20A=20library=20for=20high-speed=20approximate=20nearest=20nei?= =?UTF-8?q?ghbor=20search?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191022 NGT- A library for high-speed approximate nearest neighbor search.md --- ...eed approximate nearest neighbor search.md | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 sources/tech/20191022 NGT- A library for high-speed approximate nearest neighbor search.md diff --git a/sources/tech/20191022 NGT- A library for high-speed approximate nearest neighbor search.md b/sources/tech/20191022 NGT- A library for high-speed approximate nearest neighbor search.md new file mode 100644 index 0000000000..5922064511 --- /dev/null +++ b/sources/tech/20191022 NGT- A library for high-speed approximate nearest neighbor search.md @@ -0,0 +1,258 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NGT: A library for high-speed approximate nearest neighbor search) +[#]: via: (https://opensource.com/article/19/10/ngt-open-source-library) +[#]: author: (Masajiro Iwasaki https://opensource.com/users/masajiro-iwasaki) + +NGT: A library for high-speed approximate nearest neighbor search +====== +NGT is a high-performing, open source deep learning library for +large-scale and high-dimensional vectors. +![Houses in a row][1] + +Approximate nearest neighbor ([ANN][2]) search is used in deep learning to make a best guess at the point in a given set that is most similar to another point. This article explains the differences between ANN search and traditional search methods and introduces [NGT][3], a top-performing open source ANN library developed by [Yahoo! Japan Research][4]. + +### Nearest neighbor search for high-dimensional data + +Different search methods are used for different data types. For example, full-text search is for text data, content-based image retrieval is for images, and relational databases are for data relationships. Deep learning models can easily generate vectors from various kinds of data so that the vector space has embedded relationships among source data. This means that if two source data are similar, the two vectors from the data will be located near each other in the vector space. Therefore, all you have to do is search the vectors instead of the source data. + +Moreover, the vectors not only represent the text and image characteristics of the source data, but they also represent products, human beings, organizations, and so forth. Therefore, you can search for similar documents and images as well as products with similar attributes, human beings with similar skills, clothing with similar features, and so on. For example, [Yahoo! Japan][5] provides a similarity-based fashion-item search using NGT. + +![Nearest neighbour search][6] + +Since the number of dimensions in deep learning models tends to increase, ANN search methods are indispensable when searching for more than several million high-dimensional vectors. ANN search methods allow you to search for neighbors to the specified query vector in high-dimensional space. + +There are many nearest-neighbor search methods to choose from. [ANN Benchmarks][7] evaluates the best-known ANN search methods, including Faiss (Facebook), Flann, and Hnswlib. According to this benchmark, NGT achieves top-level performance. + +### NGT algorithms + +The NGT index combines a graph and a tree. This result is a very good search performance, with the graph's vertices representing searchable objects. Neighboring vertices are connected by edges. + +This animation shows how a graph is constructed. + +![NGT graph construction][8] + +In the search procedure, neighboring vertices to the specified query can be found descending the graph. Densely connected vertices enable users to explore the graph effectively. + +![NGT graph][9] + +NGT provides a command-line tool, along with C, C++, and Python APIs. This article focuses on the command-line tool and the Python API. + +### Using NGT with the command-line tool + +#### Linux installation + +Download the [latest version of NGT][10] as a ZIP file and install it on Linux with: + + +``` +unzip NGT-x.x.x.zip +cd NGT-x.x.x +mkdir build +cd build +cmake .. +make +make install +``` + +Since NGT libraries are installed in **/usr/local/lib(64)** by default, add the directory to the search path: + + +``` +export PATH="$PATH:/opt/local/bin" +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" +``` + +#### Sample dataset generation + +Before you can search for a large-scale dataset, you must generate an NGT dataset. As an example, [download the][11] [fastText][11] [dataset][11] from the [fastText website][12], then convert it to the NGT registration format with: + + +``` +curl -O +unzip wiki-news-300d-1M-subword.vec.zip +tail -n +2 wiki-news-300d-1M-subword.vec | cut -d " " -f 2- > objects.ssv +``` + +**Objects.ssv** is a registration file that has 1 million objects. One object in the file is extracted as a query: + + +``` +`head -10000 objects.ssv | tail -1 > query.ssv` +``` + +#### Index construction + +An **ngt_index** can be constructed using the following command: + + +``` +`ngt create -d 300 -D c index objects.ssv` +``` + +_-d_ specifies the number of dimensions of the vector. _-D c_ means using cosine similarity. + +#### Approximate nearest neighbor search + +The **ngt_index** can be searched for with the queries using: + + +``` +`ngt search -n 10 index query.ssv` +``` + +**-n** specifies the number of resulting objects. + +The search results are: + + +``` +Query No.1 +Rank    ID      Distance +1       10000   0 +2       21516   0.184495 +3       201860  0.240375 +4       71865   0.241284 +5       339589  0.267265 +6       485158  0.280977 +7       7961    0.283865 +8       924513  0.286571 +9       28870   0.286654 +10      395274  0.290466 +Query Time= 0.000972628 (sec), 0.972628 (msec) +Average Query Time= 0.000972628 (sec), 0.972628 (msec), (0.000972628/1) +``` + +Please see the [NGT command-line README][13] for more information. + +### Using NGT from Python + +Although NGT has C and C++ APIs, the [ngtpy][14] Python binding for NGT is the simplest option for programming. + +#### Installing ngtpy + +Install the Python binding (ngtpy) through PyPI with: + + +``` +`pip3 install ngt` +``` + +#### Sample dataset generation + +Generate data files for Python sample programs from the sample data set you downloaded by using this code: + + +``` +dataset_path = 'wiki-news-300d-1M-subword.vec' +with open(dataset_path, 'r') as fi, open('objects.tsv', 'w') as fov, +open('words.tsv', 'w') as fow: +    n, dim = map(int, fi.readline().split()) +    fov.write('{0}¥t{1}¥n'.format(n, dim)) +    for line in fi: +        tokens = line.rstrip().split(' ') +        fow.write(tokens[0] + '¥n') +        fov.write('{0}¥n'.format('¥t'.join(tokens[1:]))) +``` + +#### Index construction + +Construct the NGT index with: + + +``` +import ngtpy + +index_path = 'index' +with open('objects.tsv', 'r') as fin: +    n, dim = map(int, fin.readline().split()) +    ngtpy.create(index_path, dim, distance_type='Cosine') # create an index +    index = ngtpy.Index(index_path) # open the index +    print('inserting objects...') +    for line in fin: +        object = list(map(float, line.rstrip().split('¥t'))) +        index.insert(object) # insert objects +print('building objects...') +index.build_index() +print('saving the index...') +index.save() +``` + +#### Approximate nearest neighbor search + +Here is an example ANN search program: + + +``` +import ngtpy + +print('loading words...') +with open('words.tsv', 'r') as fin: +    words = list(map(lambda x: x.rstrip('¥n'), fin.readlines())) + +index = ngtpy.Index('index', zero_based_numbering = False) # open index +query_id = 10000 +query_object = index.get_object(query_id) # get the object for a query + +result = index.search(query_object) # aproximate nearest neighbor search +print('Query={}'.format(words[query_id - 1])) +print('Rank¥tID¥tDistance¥tWord') +for rank, object in enumerate(result): +    print('{}¥t{}¥t{:.6f}¥t{}'.format(rank + 1, object[0], object[1], words[object[0] - 1])) +``` + +And here are the search results, which are the same as the NGT command-line option's results: + + +``` +loading words... +Query=Horse +Rank    ID      Distance        Word +1       10000   0.000000        Horse +2       21516   0.184495        Horses +3       201860  0.240375        Horseback +4       71865   0.241284        Horseman +5       339589  0.267265        Prancing +6       485158  0.280977        Horsefly +7       7961    0.283865        Dog +8       924513  0.286571        Horsing +9       28870   0.286654        Pony +10      395274  0.290466        Blood-Horse +``` + +For more information, please see [ngtpy README][14]. + +Approximate nearest neighbor (ANN) principles are important features for analyzing data. Learning how to use it in your own projects, or to make sense of data that you're analyzing, is a powerful way to make correlations and interpret information. With NGT, you can use ANN in whatever way you require, or build upon it to add custom features. + +Introduction to Apache Hadoop, an open source software framework for storage and large scale... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/ngt-open-source-library + +作者:[Masajiro Iwasaki][a] +选题:[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/masajiro-iwasaki +[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://en.wikipedia.org/wiki/Nearest_neighbor_search#Approximate_nearest_neighbor +[3]: https://github.com/yahoojapan/NGT +[4]: https://research-lab.yahoo.co.jp/en/ +[5]: https://www.yahoo.co.jp/ +[6]: https://opensource.com/sites/default/files/browser-visual-search_new.jpg (Nearest neighbour search) +[7]: https://github.com/erikbern/ann-benchmarks +[8]: https://opensource.com/sites/default/files/uploads/ngt_movie2.gif (NGT graph construction) +[9]: https://opensource.com/sites/default/files/uploads/ngt_movie1.gif (NGT graph) +[10]: https://github.com/yahoojapan/NGT/releases/latest +[11]: https://dl.fbaipublicfiles.com/fasttext/vectors-english/wiki-news-300d-1M-subword.vec.zip +[12]: https://fasttext.cc/ +[13]: https://github.com/yahoojapan/NGT/blob/master/bin/ngt/README.md +[14]: https://github.com/yahoojapan/NGT/blob/master/python/README-ngtpy.md From 56adbdb4e9058d504879279376a71d4920992e57 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 01:01:46 +0800 Subject: [PATCH 101/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20How=20?= =?UTF-8?q?collaboration=20fueled=20a=20development=20breakthrough=20at=20?= =?UTF-8?q?Greenpeace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191022 How collaboration fueled a development breakthrough at Greenpeace.md --- ... development breakthrough at Greenpeace.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20191022 How collaboration fueled a development breakthrough at Greenpeace.md diff --git a/sources/tech/20191022 How collaboration fueled a development breakthrough at Greenpeace.md b/sources/tech/20191022 How collaboration fueled a development breakthrough at Greenpeace.md new file mode 100644 index 0000000000..6d236a3ab7 --- /dev/null +++ b/sources/tech/20191022 How collaboration fueled a development breakthrough at Greenpeace.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How collaboration fueled a development breakthrough at Greenpeace) +[#]: via: (https://opensource.com/open-organization/19/10/collaboration-breakthrough-greenpeace) +[#]: author: (Laura Hilliger https://opensource.com/users/laurahilliger) + +How collaboration fueled a development breakthrough at Greenpeace +====== +We're building an innovative platform to connect environmental +advocates—but system complexity threatened to slow us down. Opening up +was the answer. +![The Open Organization at Greenpeace][1] + +Activists really don't like feeling stuck. + +We thrive on forward momentum and the energy it creates. When that movement grinds to a halt, even for a moment, our ability to catalyze passion in others stalls too. + +And my colleagues and I at Greenpeace International were feeling stuck. + +We'd managed to launch a prototype of Planet 4, [Greenpeace's new, open engagement platform][2] for activists and communities. It's live in more than 38 countries (with many more sites). More than 1.75 million people are using it. We've topped more than 3.1 million pageviews. + +To get here, we [spent more than 650 hours in meetings, drank 1,478 litres of coffee, and fixed more than 300 bugs][3]. But it fell short of our vision; it _still_ wasn't [the minimum lovable product][4] we wanted and we didn't know how to move it forward. + +We were stuck. + +Planet 4's complexity was daunting. We didn't always have the right people to address the numerous challenges the project raised. We didn't know if we'd ever realize our vision. Yet a commitment to openness had gotten us here, and I knew a commitment to openness would get us through this, too. + +As [the story of Planet 4][5] continues, I'll explain how it did. + +### An opportunity + +By 2016, my work helping Greenpeace International become a more open organization—[which I described in the first part of this series][6]—was beginning to bear fruit. We were holding regular [community calls][7]. We were releasing project updates frequently and publicly. We were networking with global stakeholders across the organization to define what Planet 4 needed to be. We were [architecting the project with participation in mind][8]. + +Becoming open is an organic process. There's no standard "game plan" for implementing process and practices in an organization. Success depends on the people, the tools, the project, the very fabric of the culture you're working inside. + +Inside Greenpeace, we were beginning to see that success. + +A commitment to openness had gotten us here, and I knew a commitment to openness would get us through this, too. + +For some, this open way of working was inspiring and engaging. For others it was terrifying. Some thought asking for everyone's input was ridiculous. Some thought only "experts" should be part of the conversations, a viewpoint that doesn't mesh well with [the principle of inclusivity][9]. I appreciate expertise—don't get me wrong—but the problem with only asking for "expert" opinions is that you exclude people who might have more interest, passion, and knowledge than someone with a formal title. + +Planet 4 was a vision—not just of a new and open engagement platform, but of an organization that could make _use_ of this platform. And it raised problems on both those fronts: + + * **Data and systems integration:** As a network of 28 independent offices all over the world, Greenpeace has a complex technical landscape. While Greenpeace International provides system _recommendations_ and _support_, individual National and Regional Offices are free to make their own systems choices, even if they aren't the supported ones. This is a good thing; different tools better address different needs for different offices. But it's challenging, too, because the absence of standardization means a lack of expertise in all those systems. + * **Organizational culture and work styles:** Planet 4 devoured many of Greenpeace's internal strategies and visions, then spit them out into a way that promised to move toward the type of organization we wanted to be. It was challenging the organizational status quo. + + + +Our team was too small, our work too big, and the landscape of working in a global non-profit too complex. The team was struggling, and we needed help. + +Then, in 2018, I saw an opportunity. + +As an [Open Organization Ambassador][10], I'd been to Red Hat Summit to speak on a panel about open organizational principles. There I noticed a session exploring what [Red Hat had done to help UNICEF][11], another global non-profit, with its digital transformation efforts. Surely, I thought, Red Hat and Greenpeace could work together, too. + +So I did something that shouldn't seem so revolutionary or audacious: I found the Red Hatter responsible for the company's collaboration with UNICEF, Alexandra Machado, and I _said hello_. I wasn't just introducing myself; I was approaching Alexandra on behalf of a global community of open-minded advocates. + +And it worked. + +### Accelerating + +Together, Alexandra and I spent more than a year coordinating a collaboration that could help Greenpeace move forward. Earlier this year, we started to succeed. + +Planet 4 was a vision—not just of a new and open engagement platform, but of an organization that could make use of this platform. And it raised problems on both those fronts. + +In late May, members of the Planet 4 project and a team from Red Hat's App Dev Center of Excellence met in Amsterdam. The goal: Accelerate us. + +We'd spend an entire week together in a design sprint aimed at helping us chart a speedy path toward making our vision for the Planet 4 engagement platform a reality, beginning with navigating its technical complexity. And in the process, we'd lean heavily on the open way of working we'd learned to embrace. + +At the sprint, our teams got to know each other. We dumped everything on the table. In a radically open and honest way, the Greenpeace team helped the Red Hat team from Waterford understand the technical and cultural hurdles we faced. We explained our organization and our tech stack, our vision and our dreams. Red Hatters noticed our passion and worked alongside us to explore possible technologies that could make our vision a reality. + +Through a series of exercises—including a particularly helpful session of [event storming][12]—we confirmed that our dream was not only the right one to have but also fully realizable. We talked through the dynamics of the systems we are addressing, and, in the end, the Red Hat team helped us envision a prototype for integrated systems that the Greenpeace team could take forward. We've already begun user testing. + +_Listen to Patrick Carney of Red Hat Open Innovation Labs explain event storming._ + +On top of that, our new allies wrote a technical report that laid out the complexities we could _see_ but not _address_—and in a way that spurred internal conversations forward. We found ourselves, a few weeks after the event, moving forward at speed. + +Finally, we were unstuck. + +In the final chapter of Planet 4's story, I'll explain what the experience taught us about the power of openness. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/10/collaboration-breakthrough-greenpeace + +作者:[Laura Hilliger][a] +选题:[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/laurahilliger +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/images/open-org/open-org-greenpeace-article-2-blog-thumbnail-520x292.png?itok=YNEKRAxS (The Open Organization at Greenpeace) +[2]: http://greenpeace.org/international +[3]: https://medium.com/planet4/p4-in-2018-3bec1cc12be8 +[4]: https://medium.com/planet4/past-the-prototype-d3e0a4d3a171 +[5]: https://opensource.com/tags/open-organization-greenpeace +[6]: https://opensource.com/open-organization/19/10/open-platform-greenpeace-1 +[7]: https://opensource.com/open-organization/16/1/community-calls-will-increase-participation-your-open-organization +[8]: https://opensource.com/open-organization/16/8/best-results-design-participation +[9]: https://opensource.com/open-organization/resources/open-org-definition +[10]: https://opensource.com/open-organization/resources/meet-ambassadors +[11]: https://www.redhat.com/en/proof-of-concept-series +[12]: https://openpracticelibrary.com/practice/event-storming/ From c29368617e1ac7cc4a417c629ee07964b790ba91 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 01:04:06 +0800 Subject: [PATCH 102/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20Gartne?= =?UTF-8?q?r:=2010=20infrastructure=20trends=20you=20need=20to=20know?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191022 Gartner- 10 infrastructure trends you need to know.md --- ... infrastructure trends you need to know.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/talk/20191022 Gartner- 10 infrastructure trends you need to know.md diff --git a/sources/talk/20191022 Gartner- 10 infrastructure trends you need to know.md b/sources/talk/20191022 Gartner- 10 infrastructure trends you need to know.md new file mode 100644 index 0000000000..fb3af2e634 --- /dev/null +++ b/sources/talk/20191022 Gartner- 10 infrastructure trends you need to know.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Gartner: 10 infrastructure trends you need to know) +[#]: via: (https://www.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Gartner: 10 infrastructure trends you need to know +====== +Gartner names the most important factors affecting infrastructure and operations +[Daniel Páscoa][1] [(CC0)][2] + +ORLANDO – Corporate network infrastructure is only going to get more  involved  over the next two to three years as automation, network challenges and hybrid cloud become more integral to the enterprise. + +Those were some of the main infrastructure trend themes espoused by Gartner vice president and distinguished analyst [David Cappuccio][3] at the research firm’s IT Symposium/XPO here this week. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +Cappuccio noted that Gartner’s look at the top infrastructure and operational trends reflect offshoots of technologies – such as cloud computing, automation and networking advances the company’s [analysts have talked][5] about many times before. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Gartners “Top Ten Trends Impacting Infrastructure and Operations” list is: + +### Automation-strategy rethink + +[Automation][7] has been going on at some level for years, Cappuccio said, but the level of complexity as it is developed and deployed further is what’s becoming confusing.  The amounts and types of automation need to be managed and require a shift to a team development approach led by an automation architect that can be standardized across business units. Cappuccio said.  What would help?  Gartner says by 2025, more than 90 percent of enterprises will have an automation architect, up from less than 20 percent today. + +Advertisement + +### Hybrid IT Impacts Disaster Recovery Confidence + +Hybrid IT which includes a mix of data center, SAAS, PAAS, branch offices, [edge computing][8] and security services makes it hard to promise enterprise resources will be available or backed-up, Cappuccio said. Overly-simplistic IT disaster recovery plans may only deliver partial success.  By 2021, the root cause of 90 percent of cloud-based availability issues will be the failure to fully use cloud service provider native redundancy capabilities, he said.  Enterprises need to leverage their automation investments and other IT tools to refocus how systems are recovered. + +### Scaling DevOps agility demands platform rethinking + +IT’s role in many companies has almost become that of a product manager for all its different DevOps teams. IT needs to build consistency across the enterprise because they don’t want islands of DeVOps teams across the company. By 2023, 90 percent of enterprises will fail to scale DevOps initiatives if shared self-service platform approaches are not adopted, Gartner stated.  + +### Infrastructure - and your data - are everywhere + +By 2022, more than 50 percent of enterprise-generated data will be created and processed outside the [data cente][9]r or cloud, up from less than 10 percent in 2019.  Infrastructure is everywhere, Cappuccio said and every time data is moved it creates challenges. How does IT manage data-everywhere scenarios?  Cappuccio advocated mandating data-driven infrastructure impact-assessment at early stages of design, investing in infrastructure tools to manage data wherever it resides, and modernizing existing backup architectures to be able to protect data wherever it resides. + +### Overwhelming Impact of IoT + +The issue here is that most [IoT][10] implementations are not driven by IT, and they typically involve different protocols and vendors that don’t usually deal with an IT organization. In the end, who controls and manages IoT becomes an issue and it creates security and operational risks. Cappuccio said companies need to engage with business leaders to shape IoT strategies and establish a center of excellence for IoT. + +### Distributed cloud + +The methods of putting cloud services or cloud-like services on-premises but letting a vendor manage that cloud are increasing. Google has Athos and AWS will soon roll out OutPosts, for example, so this environment is going to change a lot in the next two years, Cappuccio said. This is a nascent market so customers should beware. Enterprises should also be prepared to set boundaries and determine who is responsible for software upgrades, patching and performance. + +### Immersive Experience + +Humans used to learn about and adapt to technology. Today, technology learns and adapts to humans, Cappuccio said. “We have created a world where customers have a serious expectation of perfection. We have designed applications where perfection is the norm.” Such systems are great for mindshare, marketshare and corporate reputation, but as soon as there’s one glitch that’s all out the window. + +### Democratization of IT + +Application development is no longer the realm of specialists. There has been the rollout of simpler development tools like [low code][11] or [no code][12] packages and a focus on bringing new applications to market quickly. That may bring a quicker time-to-market for the business but could be riskier for IT, Cappuccio said.  IT leaders perhaps can’t control such rapid development, but it needs to understand what’s happening. + +### What's next for networking? + +There are tons of emerging trends around networking such as mesh, secure-access service edge, network automation, network-on-demand service, network automation, and firewalls as a service. “After decades of focusing on network performance and availability, future network innovation will target operational simplicity, automation, reliability and flexible business models,” Cappuccio said.  Enterprises need to automate “everywhere” and balance what technologies are safe vs. what is agile, he said. + +### Hybrid digital-infrastructure management + +The general idea here is that CIOs face the challenge of selecting the right mixture of cloud and traditional IT for the organization.  The mix of many different elements such as edge, [hybrid cloud][13], workflow and management creates complex infrastructures. Gartner recommends a focus on workflow visualization – utilizing an in integrated toolset and developing a center of excellence to work on the issues, Cappuccio said. + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.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://unsplash.com/photos/tjiPN3e45WE +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.linkedin.com/in/davecappuccio/ +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/2160904/gartner--10-critical-it-trends-for-the-next-five-years.html +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.networkworld.com/article/3223189/how-network-automation-can-speed-deployments-and-improve-security.html +[8]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[9]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[10]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[11]: https://www.mendix.com/low-code-guide/ +[12]: https://kissflow.com/no-code/ +[13]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world From b474b15c3a531b615f80c1fdc301c78ee5a636b0 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 01:05:21 +0800 Subject: [PATCH 103/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191018=20VMware?= =?UTF-8?q?=20on=20AWS=20gets=20an=20on-premises=20option?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191018 VMware on AWS gets an on-premises option.md --- ...Mware on AWS gets an on-premises option.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 sources/talk/20191018 VMware on AWS gets an on-premises option.md diff --git a/sources/talk/20191018 VMware on AWS gets an on-premises option.md b/sources/talk/20191018 VMware on AWS gets an on-premises option.md new file mode 100644 index 0000000000..bfae9b8523 --- /dev/null +++ b/sources/talk/20191018 VMware on AWS gets an on-premises option.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (VMware on AWS gets an on-premises option) +[#]: via: (https://www.networkworld.com/article/3446796/vmware-on-aws-gets-an-on-premises-option.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +VMware on AWS gets an on-premises option +====== +Amazon Relational Database Service on VMware automates database provisioning for customers running VMware vSphere 6.5 or later, and it supports Microsoft SQL Server, PostgreSQL, and MySQL. +Getty Images + +VMware has taken another step to integrate its virtual kingdom with Amazon Web Services' world with an [on-premise service][1] that will let customers automate database provisioning and management.  + +The package, [Amazon Relational Database Service][2] (RDS) on VMware is available now for customers running VMware vSphere 6.5 or later and supports Microsoft SQL Server, PostgreSQL, and MySQL. Other DBs will be supported in the future, the companies said. + +****[**** Read also: [How to plan a software-defined data-center network][3] ****|**** [Get regularly scheduled insights by signing up for Network World newsletters.][4]**]** + +The RDS lets customers run native RDS Database instances on a vSphere platform and manage those instances from the AWS Management Console in the cloud. It automates database provisioning, operating-system and database patching, backups, point-in-time restore and compute scaling, as well as database-instance health management, VMware said. + +[][5] + +BrandPost Sponsored by HPE + +[HPE Synergy For Dummies][5] + +Here’s how IT can provide an anytime, anywhere, any workload infrastructure. + +With the service customers such as software developers and database administrators get native access to the Amazon Relational Database Service using their familiar AWS Management Console, CLI, and RDS APIs,  Chris Wolf, vice president and CTO, global field and industry at VMware wrote in a [blog][6] about the service. “Operations teams can quickly stand up an RDS instance anywhere they run vSphere, and manage it using all of their existing tools and processes.” + +Wolf said the service should greatly simplify managing databases linked to its flagship vSphere system.  + +Advertisement + +Managing databases on vSphere or natively has always been a tedious exercise that steals the focus of highly skilled database administrators, Wolf stated. “VMware customers will now be able to expand the benefits of automation and standardization of their database workloads inside of vSphere and focus more of their time and energy on improving their applications for their customers.” + +The RDS is just the part of the enterprise data center/cloud integration work VMware and AWS have been up to in the past year. + +In August [VMware said it added VMware HCX][7] capabilities to enable push-button migration and interconnectivity between VMware Cloud on AWS Software-Defined Data Centers running in different AWS Regions. It has also added new Elastic vSAN support to bolster storage scaling. + +Once applications are migrated to the cloud, customers can extend their capabilities  through the integration of native AWS services. In the future, through technology such as Bitfusion and partnerships with other vendors such as NVIDIA, customers will be able to enrich existing applications and power new enterprise applications. + +VMware and NVIDIA also announced their intent to deliver accelerated GPU services for VMware Cloud on AWS.  These services will let customers migrate VMware vSphere-based applications and containers to the cloud, unchanged, where they can be modernized to take advantage of high-performance computing, machine learning, data analytics and video-processing applications, VMware said. + +And last November [AWS tied in VMware][8] to its on-premises Outposts development, which comes in two versions. The first, VMware Cloud on AWS Outposts, lets customers  use the same VMware control plane and APIs they currently deploy. The other is an AWS-native variant that lets customers use the same APIs and control plane they use to run in the AWS cloud, but on premises, according to AWS. + +Outposts can be upgraded with the latest hardware and next-generation instances to run all native AWS and VMware applications, [AWS stated][9]. A second version, VMware Cloud on AWS Outposts, lets customers use a VMware control plane and APIs to run the hybrid environment. + +The idea with Outposts is that customers can use the same programming interface, same APIs, same console and CLI they use on the AWS cloud for on-premises applications, develop and maintain a single code base, and use the same deployment tools in the AWS cloud and on premises, AWS wrote. + +VMware isn’t the only vendor cozying up to AWS. Cisco has done a variety of integration work with the cloud service provider as well.  In [April Cisco released Cloud ACI for AWS][10] to let users configure inter-site connectivity, define policies and monitor the health of network infrastructure across hybrid environments, Cisco said. The AWS service utilizes the Cisco Cloud APIC [Application Policy Infrastructure Controller] to provide connectivity, policy translation and enhanced visibility of workloads in the public cloud, Cisco said. + +“This solution brings a suite of capabilities to extend your on-premises data center into true multi-cloud architectures, helping to drive policy and operational consistency, independent of where your applications or data reside. [It] uses the native AWS constructs for policy translation and gives end-to-end visibility into the customer's multi-cloud workloads and connectivity,” Cisco said. + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446796/vmware-on-aws-gets-an-on-premises-option.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://aws.amazon.com/blogs/aws/now-available-amazon-relational-database-service-rds-on-vmware/ +[2]: https://blogs.vmware.com/vsphere/2019/10/how-amazon-rds-on-vmware-works.html +[3]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE19718&utm_content=sidebar (HPE Synergy For Dummies) +[6]: https://cloud.vmware.com/community/2019/10/16/announcing-general-availability-amazon-rds-vmware/ +[7]: https://www.networkworld.com/article/3434397/vmware-fortifies-its-hybrid-cloud-portfolio-with-management-automation-aws-and-dell-offerings.html +[8]: https://www.networkworld.com/article/3324043/aws-does-hybrid-cloud-with-on-prem-hardware-vmware-help.html +[9]: https://aws.amazon.com/outposts/ +[10]: https://www.networkworld.com/article/3388679/cisco-taps-into-aws-for-data-center-cloud-applications.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world From 5d73f490b6c41c43872e6e3cdb59be2ec888744d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 01:07:07 +0800 Subject: [PATCH 104/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20How=20?= =?UTF-8?q?to=20Go=20About=20Linux=20Boot=20Time=20Optimisation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md --- ...o Go About Linux Boot Time Optimisation.md | 227 ++++++++++++++++++ 1 file changed, 227 insertions(+) create mode 100644 sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md diff --git a/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md b/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md new file mode 100644 index 0000000000..9e99bcdb7c --- /dev/null +++ b/sources/tech/20191022 How to Go About Linux Boot Time Optimisation.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Go About Linux Boot Time Optimisation) +[#]: via: (https://opensourceforu.com/2019/10/how-to-go-about-linux-boot-time-optimisation/) +[#]: author: (B Thangaraju https://opensourceforu.com/author/b-thangaraju/) + +How to Go About Linux Boot Time Optimisation +====== + +[![][1]][2] + +_Booting an embedded device or a piece of telecommunication equipment quickly is crucial for time-critical applications and also plays a very major role in improving the user experience. This article gives some important tips on how to enhance the boot-up time of any device._ + +Fast booting or fast rebooting plays a crucial role in various situations. It is critical for an embedded system to boot up fast in order to maintain the high availability and better performance of all the services. Imagine a telecommunications device running a Linux operating system that does not have fast booting enabled. All the systems, services and the users dependent on that particular embedded device might be affected. It is really important that devices maintain high availability in their services, for which fast booting and rebooting play a crucial role. + +A small failure or shutdown of a telecom device, even for a few seconds, can play havoc with countless users working on the Internet. Thus, it is really important for a lot of time-dependent devices and telecommunication devices to incorporate fast booting in their devices to help them get back to work quicker. Let us understand the Linux boot-up procedure from Figure 1. + +![Figure 1: Boot-up procedure][3] + +![Figure 2: Boot chart][4] + +**Monitoring tools and the boot-up procedure** +A user should take note of a number of factors before making changes to a machine. These include the current booting speed of the machine and also the services, processes or applications that are taking up resources and increasing the boot-up time. + +**Boot chart:** To monitor the boot-up speed and the various services that start while booting up, the user can install the boot chart using the following command: + +``` +sudo apt-get install pybootchartgui. +``` + +Each time you boot up, the boot chart saves a _.png_ (portable network graphics) file in the log, which enables the user to view the _png_ files to get an understanding about the system’s boot-up process and services. Use the following command for this purpose: + +``` +cd /var/log/bootchart +``` + +The user might need an application to view the _.png_ files. Feh is an X11 image viewer that targets console users. It doesn’t have a fancy GUI, unlike most other image viewers, but it simply displays pictures. Feh can be used to view the _.png_ files. You can install it using the following command: + +``` +sudo apt-get install feh +``` + +You can view the _png_ files using _feh xxxx.png_. +Figure 2 shows the boot chart when a boot chart _png_ file is viewed. +However, a boot chart is not necessary for Ubuntu versions later than 15.10. To get very brief information regarding boot up speed, use the following command: + +``` +systemd-analyze +``` + +![Figure 3: Output of systemd-analyze][5] + +Figure 3 shows the output of the command _systemd-analyze_. +The command _systemd-analyze_ blame is used to print a list of all running units based on the time they took to initialise. This information is very helpful and can be used to optimise boot-up times. systemd-analyze blame doesn’t display results for services with _Type=simple_, because systemd considers such services to be started immediately; hence, no measurement of the initialisation delays can be done. + +![Figure 4: Output of systemd-analyze blame][6] + +Figure 4 shows the output of _systemd-analyze_ blame. +The following command prints a tree of the time-critical chain of units: + +``` +command systemd-analyze critical-chain +``` + +Figure 5 shows the output of the command _systemd-analyze critical-chain_. + +![Figure 5: Output of systemd-analyze critical-chain][7] + +**Steps to reduce the boot-up time** +Shown below are the various steps that can be taken to reduce boot-up time. + +**BUM (Boot-Up-Manager):** BUM is a run level configuration editor that allows the configuration of _init_ services when the system boots up or reboots. It displays a list of every service that can be started at boot. The user can toggle individual services on and off. BUM has a very clean GUI and is very easy to use. + +BUM can be installed in Ubuntu 14.04 using the following command: + +``` +sudo apt-get install bum +``` + +To install it in versions later than 15.10, download the packages from the link _ 13_. + +Start with basic things and disable services related to the scanner and printer. You can also disable Bluetooth and all other unwanted devices and services if you are not using any of them. I strongly recommend that you study the basics about the services before disabling them, as it might affect the machine or operating system. Figure 6 shows the GUI of BUM. + +![Figure 6: BUM][8] + +**Editing the rc file:** To edit the rc file, you need to go to the rc directory. This can be done using the following command: + +``` +cd /etc/init.d. +``` + +However, root privileges are needed to access _init.d_, which basically contains start/stop scripts that are used to control (start, stop, reload, restart) the daemon while the system is running or during boot. + +The _rc_ file in _init.d_ is called a run control script. During booting, init executes the _rc_ script and plays its role. To improve the booting speed, we make changes to the _rc_ file. Open the _rc_ file (once you are in the _init.d_ directory) using any file editor. + +For example, by entering _vim rc_, you can change the value of _CONCURRENCY=none_ to _CONCURRENCY=shell_. The latter allows certain startup scripts to be executed simultaneously, rather than serially. + +In the latest versions of the kernel, the value should be changed to _CONCURRENCY=makefile_. +Figures 7 and 8 show the comparison of boot-up times before and after editing the rc file. The improvement in the boot-up speed can be noticed. The time to boot before editing the rc file was 50.98 seconds, whereas the time to boot after making the changes to the rc file is 23.85 seconds. +However, the above-mentioned changes don’t work on operating systems later than the Ubuntu version 15.10, since the operating systems with the latest kernel use the systemd file and not the _init.d_ file any more. + +![Figure 7: Boot speed before making changes to the rc file][9] + +![Figure 8: Boot speed after making changes to the rc file][10] + +**E4rat:** E4rat stands for e4 ‘reduced access time’ (ext4 file system only). It is a project developed by Andreas Rid and Gundolf Kiefer. E4rat is an application that helps in achieving a fast boot with the help of defragmentation. It also accelerates application startups. E4rat eliminates both seek times and rotational delays using physical file reallocation. This leads to a high disk transfer rate. +E4rat is available as a .deb package and you can download it from its official website __. + +Ubuntu’s default ureadahead package conflicts with e4rat. So a few packages have to be installed using the following command: + +``` +sudo dpkg purge ureadahead ubuntu-minimal +``` + +Now install the dependencies for e4rat using the following command: + +``` +sudo apt-get install libblkid1 e2fslibs +``` + +Open the downloaded _.deb_ file and install it. Boot data is now needed to be gathered properly to work with e4rat. + +Follow the steps given below to get e4rat running properly and to increase the boot-up speed. + + * Access the Grub menu while booting. This can be done by holding the shift button when the system is booting. + * Choose the option (kernel version) that is normally used to boot and press ‘e’. + * Look for the line starting with _linux /boot/vmlinuz_ and add the following code at the end of the line (hit space after the last letter of the sentence): + + + +``` +- init=/sbin/e4rat-collect or try - quiet splash vt.handsoff =7 init=/sbin/e4rat-collect +``` + + * Now press _Ctrl+x_ to continue booting. This lets e4rat collect data after booting. Work on the machine, open and close applications for the next two minutes. + * Access the log file by going to the e4rat folder and using the following command: + + + +``` +cd /var/log/e4rat +``` + + * If you do not find any log file, repeat the above mentioned process. Once the log file is there, access the Grub menu again and press ‘e’ as your option. + * Enter ‘single’ at the end of the same line that you have edited before. This will help you access the command line. If a different menu appears asking for anything, choose Resume normal boot. If you don’t get to the command prompt for some reason, hit Ctrl+Alt+F1. + * Enter your details once you see the login prompt. + * Now enter the following command: + + + +``` +sudo e4rat-realloc /var/lib/e4rat/startup.log +``` + +This process takes a while, depending on the machine’s disk speed. + + * Now restart your machine using the following command: + + + +``` +sudo shutdown -r now +``` + + * Now, we need to configure Grub to run e4rat at every boot. + * Access the grub file using any editor. For example, _gksu gedit /etc/default/grub._ + * Look for a line starting with _GRUB CMDLINE LINUX DEFAULT=_, and add the following line in between the quotes and before whatever options there are: + + + +``` +init=/sbin/e4rat-preload 18 +``` + + * It should look like this: + + + +``` +GRUB CMDLINE LINUX DEFAULT = init=/sbin/e4rat- preload quiet splash +``` + + * Save and close the Grub menu and update Grub using _sudo update-grub_. + * Reboot the system and you will find noticeable changes in boot speed. + + + +Figures 9 and 10 show the differences between the boot-up time before and after installing e4rat. The improvement in the boot-up speed can be noticed. The time taken to boot before using e4rat was 22.32 seconds, whereas the time taken to boot after using e4rat is 9.065 seconds + +![Figure 9: Boot speed before using e4rat][11] + +![Figure 10: Boot speed after using e4rat][12] + +**A few simple tweaks** +A good boot-up speed can also be achieved using very small tweaks, two of which are listed below. +**SSD:** Using solid-state devices rather than normal hard disks or other storage devices will surely improve your booting speed. SSDs also help in achieving great speeds in transferring files and running applications. + +**Disabling GUI:** The graphical user interface, desktop graphics and window animations take up a lot of resources. Disabling the GUI is another good way to achieve great boot-up speed. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/how-to-go-about-linux-boot-time-optimisation/ + +作者:[B Thangaraju][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/b-thangaraju/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Screenshot-from-2019-10-07-13-16-32.png?resize=696%2C496&ssl=1 (Screenshot from 2019-10-07 13-16-32) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Screenshot-from-2019-10-07-13-16-32.png?fit=700%2C499&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-1.png?resize=350%2C302&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-2.png?resize=350%2C412&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-3.png?resize=350%2C69&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-4.png?resize=350%2C535&ssl=1 +[7]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-5.png?resize=350%2C206&ssl=1 +[8]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-6.png?resize=350%2C449&ssl=1 +[9]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-7.png?resize=350%2C85&ssl=1 +[10]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-8.png?resize=350%2C72&ssl=1 +[11]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-9.png?resize=350%2C61&ssl=1 +[12]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-10.png?resize=350%2C61&ssl=1 From 77e918ac5ca8420585db42f2748cde4ca6dc4cdc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 23 Oct 2019 01:08:33 +0800 Subject: [PATCH 105/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20?= =?UTF-8?q?=E2=80=9CMaking=20software=20liquid:=20a=20DevOps=20company=20f?= =?UTF-8?q?ounder=E2=80=99s=20journey=20from=20OSS=20community=20to=20bill?= =?UTF-8?q?ion-dollar=20darling=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191022 -Making software liquid- a DevOps company founder-s journey from OSS community to billion-dollar darling.md --- ...OSS community to billion-dollar darling.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/talk/20191022 -Making software liquid- a DevOps company founder-s journey from OSS community to billion-dollar darling.md diff --git a/sources/talk/20191022 -Making software liquid- a DevOps company founder-s journey from OSS community to billion-dollar darling.md b/sources/talk/20191022 -Making software liquid- a DevOps company founder-s journey from OSS community to billion-dollar darling.md new file mode 100644 index 0000000000..25587ad532 --- /dev/null +++ b/sources/talk/20191022 -Making software liquid- a DevOps company founder-s journey from OSS community to billion-dollar darling.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (“Making software liquid: a DevOps company founder’s journey from OSS community to billion-dollar darling”) +[#]: via: (https://opensourceforu.com/2019/10/making-software-liquid-a-devops-company-founders-journey-from-oss-community-to-billion-dollar-darling/) +[#]: author: (Editor Team https://opensourceforu.com/author/editor/) + +“Making software liquid: a DevOps company founder’s journey from OSS community to billion-dollar darling” +====== + +![][1] + +_JFrog claims to make software development easier and faster, and enable firms to reduce their development costs. To understand the basis of this promise, **Rahul Chopra, editorial director, EFY Group**, spoke to **Fred Simon, co-founder and chief architect, JFrog** and here’s what he discovered…_ + +**Q. How would you explain JFrog’s solutions to a senior business decision maker?** + +**A.** It’s a fair question, as we have been – and continue to be – a developer-driven company that makes tools and solutions for developers. Originally, we were a team of engineers working on Java and had the task of solving some package management pain during the J2EE (now Java EE) transformation. So, it was all hyper-technical and hard to explain to non-engineers. + +Today, it’s a bit easier. As the world moves towards cloud-native applications as the default and every company is now a software company, the benefits of software management and delivery are now mission-critical. We see that as this industry maturity has taken place, software conversations are now management-level conversations. So, it’s now a very simple proposition: You are getting business demands for faster, smarter, more secure software. And you must “release software fast, or you die,” as we like to say. Competition is fierce, so if you can provide value to the end-user faster and smarter without downtime – what we call “Liquid Software,” you have a competitive edge. JFrog helps you achieve these goals faster as a DevOps organization. + +**Q. How does the explanation change, when explaining it to a senior techie like a CTO?** + +**A.** At this level, it is even simpler. You have historically released software once a quarter or even once a year or more. You know that this demand has changed with cloud, microservices and agility movements. We give you the ability to get a new version rapidly, control where the version was validated and how it ends up in runtime as quickly as possible. We’ve been doing this for more than 10 years at scale. When we started, our customers managed a gigabyte, then later a terabyte and today we have customers with petabytes of binary software creating dozens or hundreds of builds a day. + +**Q. You mentioned the word ‘control’. But, a lot of developers do not like control. So, how would you explain JFrog’s promise to them, what would your pitch be?** + +**A.** The word “control” to a developer’s ear can sound like something being imposed on them. It’s “someone else’s” control. But the developer roots of JFrog demand that we provide speed and agility to developers, giving them as much control over their environments as possible without sacrificing their speed. + +**Q. According to you, the drivers within the company are the developers, who then take it to DevOps, then to CTO and the CEO signs the cheque? Is that how it works?** + +**A.** Yes. JFrog to date has only had an inside sales force with no outbound sales. The first time we ever talked to a company was because the developer said that they needed a professional version of JFrog tools. Then we started the discussion with the managers and so on up the chain. Developers – as some like our friends at RedMonk have said – are still the kingmakers. + +**Q. Can you explain the term ‘Liquid Software’ that’s been mentioned quite a few times on your website?** + +**A.** The concept of Liquid Software is to enable continuous, secure, seamless updates of every piece of software that is running without any downtime. This is very different than the traditional build, package, distribute once a year model. The old way doesn’t scale. The new world of Liquid Software makes the update process nearly seamless from code to end device. + +**Q. Has the shift to “everything-as-a-service” become the main driver for this concept of Liquid Software?** + +**A.** Yes. People are not making software as a service, they are delivering services. They are using our Liquid Software pipeline delivery process for every kind of delivery. It’s important to note that “as a service” isn’t just for cloud, but is in fact the standard for every type of software delivery. + +**Q. How’s JFrog connected with open source and how does it shift to an enterprise paid version? What is the licensing model at JFrog?** + +**A.** We have an open-source version licensed under AGPL. This open source version allows you to do many Java-related works, and is sometimes where developers start to “kick the tires.”.There is also an edition specifically for C/C++ developer utilizing the Conan framework. Since most development shops do more than one type of development, our commercial versions – starting with a Pro subscription – universally support all package types. From there, there are other plans available that include HA, Security and Compliance tools, Distribution and more. We have also recently added JFrog Pipelines for  full automation of your pipelines across the organization. So, you can choose what makes the most sense for them, and JFrog can grow alongside your needs as you mature your DevOps and DevSecOps infrastructure. + +**Q. Do you have a different set of solutions for developers depending on whether they are developing for the web, mobile, IoT?** + +**A.** No, we are universal. You don’t need to re-install different things for different technology. So, if you are a Ruby developer or a Python developer or if you have Docker, Debian, Microsoft or NuGet, then you get everything in one single tool. Pipelines are so unique to each organization that we need to support all of it. + +**Q. Are there any specific solutions or capabilities that you have developed for IoT?** + +**A.** Yes. Quite early on we worked with customers on an IoT offering. We provided an IoT-specific solution, which is an extension of Debian for IoT, and we also have Conan and Yocto. Controlling and increasing the speed of delivery is something that is in the early stages of the IoT environment. So we are helping in this integration and providing tools that are enabling different technologies on your JFrog platform that are tailored to an IoT environment. + +**Q. Overall, how important is India, both as development and tech-support centre for JFrog globally as well as a market for JFrog?** + +**A.** JFrog opened its first office in India more than three years ago, with a development office working on JFrog Insight and JFrog Mission Control (which provide pipeline tooling and performance visibility). We purchased an organization called Shippable at the beginning of this year for their technology and their R&D team, who then created JFrog Pipelines product. They are also located in India, so India has been and is increasingly important from both an R&D and support perspective. A lot of our senior support force is in India, so we need really good developers working at JFrog to handle the high-tech support volume. We are already at 60 employees in Bangalore and have recently appointed a General Manager. As you know, JFrog is now a company of more than 500 people. We are also growing our marketing and sales teams in India that will help drive the DevOps revolution for Indian customers. + +**Q. Are these more of a global account that have shops in India or are these Indian companies?** + +**A.** Both. We started with the global companies with R&D in India. Today, we have companies throughout India that are directly buying from us. + +**Q. A little bit about your personal journey, when and how did you connect with the open-source world?** + +**A.** I will date myself and say that in 1992, I used to play with Mosaic while I was in University, and I created a web server based on open source web stacks. Gloriously geeky stuff, but it put me in the OSS community right from the beginning. When I was a kid, I used to share code and OSS was the way I learned how to code in the first place. It’s clear to me that OSS is the future for creating innovative software, and I – and JFrog – continue to support and contribute to development communities globally. I look forward to seeing OSS and OSS communities drive the innovations of the future. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/making-software-liquid-a-devops-company-founders-journey-from-oss-community-to-billion-dollar-darling/ + +作者:[Editor Team][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/editor/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Copy-of-IMG_0219a-_39_-new.jpg?resize=350%2C472&ssl=1 From e280519741b63f4c3cbd97f78d6e0e3594606fa5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 23 Oct 2019 09:00:47 +0800 Subject: [PATCH 106/800] translated --- ...law can lead to unauthorized privileges.md | 81 ------------------- ...law can lead to unauthorized privileges.md | 69 ++++++++++++++++ 2 files changed, 69 insertions(+), 81 deletions(-) delete mode 100644 sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md create mode 100644 translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md diff --git a/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md b/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md deleted file mode 100644 index 84a74e2afc..0000000000 --- a/sources/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux sudo flaw can lead to unauthorized privileges) -[#]: via: (https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Linux sudo flaw can lead to unauthorized privileges -====== -Exploiting a newly discovered sudo flaw in Linux can enable certain users with to run commands as root despite restrictions against it. -Thinkstock - -A newly discovered and serious flaw in the [**sudo**][1] command can, if exploited, enable users to run commands as root in spite of the fact that the syntax of the  **/etc/sudoers** file specifically disallows them from doing so. - -Updating **sudo** to version 1.8.28 should address the problem, and Linux admins are encouraged to do so as soon as possible.  - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] - -How the flaw might be exploited depends on specific privileges granted in the **/etc/sudoers** file. A rule that allows a user to edit files as any user except root, for example, would actually allow that user to edit files as root as well. In this case, the flaw could lead to very serious problems. - -[][3] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][3] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -For a user to exploit the flaw, **a user** needs to be assigned privileges in the **/etc/sudoers **file that allow that user to run commands as some other users, and the flaw is limited to the command privileges that are assigned in this way.   - -This problem affects versions prior to 1.8.28. To check your sudo version, use this command: - -``` -$ sudo -V -Sudo version 1.8.27 <=== -Sudoers policy plugin version 1.8.27 -Sudoers file grammar version 46 -Sudoers I/O plugin version 1.8.27 -``` - -The vulnerability has been assigned [CVE-2019-14287][4] in the **Common Vulnerabilities and Exposures** database. The risk is that any user who has been given the ability to run even a single command as an arbitrary user may be able to escape the restrictions and run that command as root – even if the specified privilege is written to disallow running the command as root. - -The lines below are meant to give the user "jdoe" the ability to edit files with **vi** as any user except root (**!root** means "not root") and nemo the right to run the **id** command as any user except root: - -``` -# affected entries on host "dragonfly" -jdoe dragonfly = (ALL, !root) /usr/bin/vi -nemo dragonfly = (ALL, !root) /usr/bin/id -``` - -However, given the flaw, either of these users would be able to circumvent the restriction and edit files or run the **id** command as root as well. - -The flaw can be exploited by an attacker to run commands as root by specifying the user ID "-1" or "4294967295."   - -The response of "1" demonstrates that the command is being run as root (showing root's user ID). - -Joe Vennix from Apple Information Security both found and analyzed the problem. - -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/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.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/article/3236499/some-tricks-for-using-sudo.html -[2]: https://www.networkworld.com/newsletters/signup.html -[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[4]: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-14287 -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md b/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md new file mode 100644 index 0000000000..4eed68efea --- /dev/null +++ b/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux sudo flaw can lead to unauthorized privileges) +[#]: via: (https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux sudo 漏洞可能导致未经授权的特权 +====== +在 Linux 中利用新发现的 sudo 漏洞可以使某些用户以 root 身份运行命令,尽管对此还有所限制。 + +[**sudo**][1] 命令中最近发现了一个严重漏洞,如果被利用,那么即使在 **/etc/sudoers** 文件中明确禁止了该用户,它们也可以以 root 身份运行命令。。 + +将 **sudo** 更新到版本 1.8.28 应该可以解决该问题,因此鼓励 Linux 管理员尽快这样做。 + +如何利用此漏洞取决于 **/etc/sudoers** 中授予的特定权限。例如,一条规则允许用户以除 root 用户之外的任何用户身份来编辑文件,这实际上将允许该用户也以 root 用户身份来编辑文件。在这种情况下,该漏洞可能会导致非常严重的问题。 + +要让用户能够利用此漏洞,需要在 **/etc/sudoers ** 中为**用户**分配权限,以使该用户可以像其他用户一样运行命令,并且该漏洞仅限于以这种方式分配的命令特权。 + +此问题影响 1.8.28 之前的版本。要检查你的 sudo 版本,请使用以下命令: + +``` +$ sudo -V +Sudo version 1.8.27 <=== +Sudoers policy plugin version 1.8.27 +Sudoers file grammar version 46 +Sudoers I/O plugin version 1.8.27 +``` + +该漏洞已在“常见漏洞和披露”数据库中分配了编号 [CVE-2019-14287][4]。它的风险是,任何被指定能以任意用户运行单个命令的用户,即使被明确禁止以 root 身份运行,它都能逃脱限制。 + +下面这些行让 “jdoe” 能够以除了 root 用户之外的其他身份使用 **vi**编辑文件(**!root**表示“非 root”),同时 nemo有权运行以除了 root 身份以外的任何用户使用 **id** 命令: + +``` +# affected entries on host "dragonfly" +jdoe dragonfly = (ALL, !root) /usr/bin/vi +nemo dragonfly = (ALL, !root) /usr/bin/id +``` + +但是,由于存在漏洞,这些用户中的任何一个都将能够绕过限制并编辑文件,或者也可以 root 用户身份运行 **id** 命令。 + + +攻击者可以通过指定用户 ID 为 “-1” 或 “4294967295” 来以 root 身份运行命令。 + +响应 “1” 表明该命令以 root 身份运行(显示 root 的用户 ID)。 + +苹果信息安全团队的 Joe Vennix 找到并分析该问题。 + +在 [Facebook][5] 和 [LinkedIn][6] 加入 Network World 社区,评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.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 +[1]: https://www.networkworld.com/article/3236499/some-tricks-for-using-sudo.html +[4]: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-14287 +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 80138109ff89d8b9b3e63069b71e427e6fc36225 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 23 Oct 2019 09:02:46 +0800 Subject: [PATCH 107/800] translating --- .../tech/20191021 Pylint- Making your Python code consistent.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191021 Pylint- Making your Python code consistent.md b/sources/tech/20191021 Pylint- Making your Python code consistent.md index 7ed967472f..1795e3ecbf 100644 --- a/sources/tech/20191021 Pylint- Making your Python code consistent.md +++ b/sources/tech/20191021 Pylint- Making your Python code consistent.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From df1b8bf26ca05d873edb1667e967a05f8c3b91ae Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Wed, 23 Oct 2019 09:21:33 +0800 Subject: [PATCH 108/800] translating --- .../20191022 How to Get the Size of a Directory in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191022 How to Get the Size of a Directory in Linux.md b/sources/tech/20191022 How to Get the Size of a Directory in Linux.md index eac3e774b8..1df903a85e 100644 --- a/sources/tech/20191022 How to Get the Size of a Directory in Linux.md +++ b/sources/tech/20191022 How to Get the Size of a Directory in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lnrCoder) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -180,7 +180,7 @@ via: https://www.2daygeek.com/find-get-size-of-directory-folder-linux-disk-usage 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lnrCoder](https://github.com/lnrCoder) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From cfcf139aeb7946abaa94243d83e90ab72c8350ca Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 23 Oct 2019 16:26:13 +0800 Subject: [PATCH 109/800] Rename sources/tech/20191023 Disney-s Streaming Service is Having Troubles with Linux.md to sources/talk/20191023 Disney-s Streaming Service is Having Troubles with Linux.md --- ...23 Disney-s Streaming Service is Having Troubles with Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191023 Disney-s Streaming Service is Having Troubles with Linux.md (100%) diff --git a/sources/tech/20191023 Disney-s Streaming Service is Having Troubles with Linux.md b/sources/talk/20191023 Disney-s Streaming Service is Having Troubles with Linux.md similarity index 100% rename from sources/tech/20191023 Disney-s Streaming Service is Having Troubles with Linux.md rename to sources/talk/20191023 Disney-s Streaming Service is Having Troubles with Linux.md From fa77859c841a3432a4adc60f35b2541b095380f1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 17:19:20 +0800 Subject: [PATCH 110/800] PRF @Morisun029 --- ... by example- Failure as experimentation.md | 113 +++++++++--------- 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/translated/tech/20190924 Mutation testing by example- Failure as experimentation.md b/translated/tech/20190924 Mutation testing by example- Failure as experimentation.md index 939359c7cc..4f5af805f7 100644 --- a/translated/tech/20190924 Mutation testing by example- Failure as experimentation.md +++ b/translated/tech/20190924 Mutation testing by example- Failure as experimentation.md @@ -1,30 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Mutation testing by example: Failure as experimentation) [#]: via: (https://opensource.com/article/19/9/mutation-testing-example-failure-experimentation) [#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzichttps://opensource.com/users/jocunddew) -以变异测试为例:基于故障的试验 +变异测试:基于故障的试验 ====== -基于 .NET 的 xUnit.net 测试框架,开发一款自动猫门的逻辑,让门在白天开放,夜间锁定, + +> 基于 .NET 的 xUnit.net 测试框架,开发一款自动猫门的逻辑,让门在白天开放,夜间锁定。 + ![Digital hand surrounding by objects, bike, light bulb, graphs][1] +在本系列的[第一篇文章][2]中,我演示了如何使用设计的故障来确保代码中的预期结果。在第二篇文章中,我将继续开发示例项目:一款自动猫门,该门在白天开放,夜间锁定。 -在本系列的[第一篇文章][2]中,我演示了如何使用设计的故障来确保代码中的预期结果。 在第二篇文章中,我将继续开发示例项目——一款自动猫门,该门在白天开放,夜间锁定。 -在此提醒一下,您可以按照[此处的说明][3]使用 .NET 的 xUnit.net 测试框架。 - - +在此提醒一下,你可以按照[此处的说明][3]使用 .NET 的 xUnit.net 测试框架。 ### 关于白天时间 回想一下,测试驱动开发(TDD)围绕着大量的单元测试。 - -第一篇文章中实现了满足 **Given7pmReturnNighttime** 单元测试期望的逻辑。 但还没有完, 现在,您需要描述当前时间大于7点时期望发生的结果。 这是新的单元测试,称为 **Given7amReturnDaylight**: - +第一篇文章中实现了满足 `Given7pmReturnNighttime` 单元测试期望的逻辑。但还没有完,现在,你需要描述当前时间大于 7 点时期望发生的结果。这是新的单元测试,称为 `Given7amReturnDaylight`: ``` [Fact] @@ -36,7 +34,7 @@ } ``` - 现在,新的单元测试失败了(越早失败越好!): +现在,新的单元测试失败了(越早失败越好!): ``` Starting test execution, please wait... @@ -45,63 +43,66 @@ Failed unittest.UnitTest1.Given7amReturnDaylight [...] ``` -期望接收到字符串值是 "Daylight" ,但实际接收到的值是 "Nighttime"。 - +期望接收到字符串值是 `Daylight`,但实际接收到的值是 `Nighttime`。 ### 分析失败的测试用例 -经过仔细检查,代码本身似乎已经出现问题。 事实证明,**GetDayOrNight** 方法的实现是不可测试的! +经过仔细检查,代码本身似乎已经出现问题。 事实证明,`GetDayOrNight` 方法的实现是不可测试的! + 看看我们面临的核心挑战: - 1. **GetDayOrNight 依赖隐藏输入。 ** -**dayOrNight** 的值取决于隐藏输入(它从内置系统时钟中获取一天的时间值)。 +1. `GetDayOrNight` 依赖隐藏输入。 + + `dayOrNight` 的值取决于隐藏输入(它从内置系统时钟中获取一天的时间值)。 +2. `GetDayOrNight` 包含非确定性行为。 - 2. **GetDayOrNight 包含非确定性行为。 ** -从系统时钟中获取到的时间值是不确定的。 (因为)该时间取决于你运行代码的时间点,而这一点我们认为这是不可预测的。 + 从系统时钟中获取到的时间值是不确定的。(因为)该时间取决于你运行代码的时间点,而这一点我们认为这是不可预测的。 +3. `GetDayOrNight` API 的质量差。 - 3. **GetDayOrNight API 的质量差。** -该 API 与具体的数据源(系统 **DateTime**) 紧密耦合。 + 该 API 与具体的数据源(系统 `DateTime`)紧密耦合。 +4. `GetDayOrNight` 违反了单一责任原则。 + + 该方法实现同时使用和处理信息。优良作法是一种方法应负责执行一项职责。 +5. `GetDayOrNight` 有多个更改原因。 - 4. **GetDayOrNight violates 违反了单一责任原则。** -该方法实现同时使用和处理信息。优良作法是一种方法应负责执行一项职责。 - 5. **GetDayOrNight 有多个更改原因。** -可以想象内部时间源可能会更改的情况。同样,很容易想象处理逻辑也将改变。这些变化的不同原因必须相互隔离。 - 6. **当(我们)尝试了解 GetDayOrNight 行为时,会发现它的 API 签名不足。 ** -最理想的做法就是通过简单的查看API的签名,就能了解API预期的行为类型。。 - 7. **GetDayOrNight 取决于全局共享可变状态。** -要不惜一切代价避免共享的可变状态! - 8. **即使在阅读源代码之后,也无法预测 GetDayOrNight方法的行为。** -这是一个严重的问题。 通过阅读源代码,应该始终非常清楚,系统一旦开始运行,便可以预测出其行为。 + 可以想象内部时间源可能会更改的情况。同样,很容易想象处理逻辑也将改变。这些变化的不同原因必须相互隔离。 +6. 当(我们)尝试了解 `GetDayOrNight` 行为时,会发现它的 API 签名不足。 + + 最理想的做法就是通过简单的查看 API 的签名,就能了解 API 预期的行为类型。 +7. `GetDayOrNight` 取决于全局共享可变状态。 + 要不惜一切代价避免共享的可变状态! +8. 即使在阅读源代码之后,也无法预测 `GetDayOrNight` 方法的行为。 + + 这是一个严重的问题。通过阅读源代码,应该始终非常清晰,系统一旦开始运行,便可以预测出其行为。 ### 失败背后的原则 -每当您遇到工程问题时,建议使用久经考验的分而治之策略。 在这种情况下,遵循关注点分离的原则是一种可行的方法。 +每当你遇到工程问题时,建议使用久经考验的分而治之divide and conquer策略。在这种情况下,遵循关注点分离separation of concerns的原则是一种可行的方法。 -> **separation of concerns** (**SoC**) 是一种用于将计算机程序分为不同模块的设计原理,以便每个模块都可以解决一个关注点。 关注点是影响计算机程序代码的一组信息。 关注点信息可能与要优化代码的硬件的细节一样概括,也可能与要实例化的类的名称一样具体。完美体现 SoC 的程序称为模块化程序。 +> 关注点分离(SoC)是一种用于将计算机程序分为不同模块的设计原理,以便每个模块都可以解决一个关注点。关注点是影响计算机程序代码的一组信息。关注点可以和要优化代码的硬件的细节一样概括,也可以和要实例化的类的名称一样具体。完美体现 SoC 的程序称为模块化程序。 > -> ([source][4]) +> ([出处][4]) -**GetDayOrNight** 方法应仅与确定日期和时间值表示白天还是夜晚有关。 它不应该与寻找该值的来源有关。该问题应留给调用客户端。 +`GetDayOrNight` 方法应仅与确定日期和时间值表示白天还是夜晚有关。它不应该与寻找该值的来源有关。该问题应留给调用客户端。 -必须将这个问题留给调用客户端,以获取当前时间。 这种方法符合另一个有价值的工程原理-控制反转。 Martin Fowler [在这里][5]详细探讨了这一概念。 +必须将这个问题留给调用客户端,以获取当前时间。这种方法符合另一个有价值的工程原理——控制反转inversion of control。Martin Fowler [在这里][5]详细探讨了这一概念。 -> 框架的一个重要特征是用户定义的用于定制框架的方法通常来自于框架本身而不是从用户的应用程序代码调用来的。 该框架通常在协调和排序应用程序活动中扮演主程序的角色。 控制权的这种反转使框架有能力充当可扩展的框架。 用户提供的方法为框架中的特定应用程序量身制定泛化算法。 +> 框架的一个重要特征是用户定义的用于定制框架的方法通常来自于框架本身,而不是从用户的应用程序代码调用来的。该框架通常在协调和排序应用程序活动中扮演主程序的角色。控制权的这种反转使框架有能力充当可扩展的框架。用户提供的方法为框架中的特定应用程序量身制定泛化算法。 > -> \-- [Ralph Johnson and Brian Foote][6] +> -- [Ralph Johnson and Brian Foote][6] ### 重构测试用例 - -因此,代码需要重构。 摆脱对内部时钟的依赖(**DateTime** 系统实用程序): +因此,代码需要重构。摆脱对内部时钟的依赖(`DateTime` 系统实用程序): ``` -` DateTime time = new DateTime();` + DateTime time = new DateTime(); ``` -删除上述代码(在你的文件中应该是第7行)。 通过将输入参数 **DateTime** 时间添加到 **GetDayOrNight** 方法,进一步重构代码。 -这是重构类 **DayOrNightUtility.cs**: +删除上述代码(在你的文件中应该是第 7 行)。通过将输入参数 `DateTime` 时间添加到 `GetDayOrNight` 方法,进一步重构代码。 +这是重构的类 `DayOrNightUtility.cs`: ``` using System; @@ -110,7 +111,7 @@ namespace app { public class DayOrNightUtility { public string GetDayOrNight(DateTime time) { string dayOrNight = "Nighttime"; - if(time.Hour >= 7 && time.Hour < 19) { + if(time.Hour >= 7 && time.Hour < 19) { dayOrNight = "Daylight"; } return dayOrNight; @@ -119,9 +120,7 @@ namespace app { } ``` - -重构代码需要更改单元测试。 需要准备 **nightHour** 和 **dayHour** 的测试数据,并将这些值传到**GetDayOrNight** 方法中。 以下是重构的单元测试: - +重构代码需要更改单元测试。 需要准备 `nightHour` 和 `dayHour` 的测试数据,并将这些值传到`GetDayOrNight` 方法中。 以下是重构的单元测试: ``` using System; @@ -132,9 +131,9 @@ namespace unittest { public class UnitTest1 { - DayOrNightUtility dayOrNightUtility = [new][7] DayOrNightUtility(); - DateTime nightHour = [new][7] DateTime(2019, 08, 03, 19, 00, 00); - DateTime dayHour = [new][7] DateTime(2019, 08, 03, 07, 00, 00); + DayOrNightUtility dayOrNightUtility = new DayOrNightUtility(); + DateTime nightHour = new DateTime(2019, 08, 03, 19, 00, 00); + DateTime dayHour = new DateTime(2019, 08, 03, 07, 00, 00); [Fact] public void Given7pmReturnNighttime() @@ -158,34 +157,32 @@ namespace unittest ### 经验教训 - 在继续开发这种简单的场景之前,请先回顾复习一下本次练习中所学到的东西。 -运行无法测试的代码,很容易在不经意间制造陷阱。 从表面上看,这样的代码似乎可以正常工作。但是,遵循测试驱动开发(TDD)的实践(首先描述期望结果---执行测试---暴露了代码中的严重问题。 +运行无法测试的代码,很容易在不经意间制造陷阱。从表面上看,这样的代码似乎可以正常工作。但是,遵循测试驱动开发(TDD)的实践(首先描述期望结果,然后才描述实现),暴露了代码中的严重问题。 -这表明 TDD 是确保代码不会太凌乱的理想方法。 TDD 指出了一些问题区域,例如缺乏单一责任和存在隐藏输入。 此外,TDD 有助于删除不确定性代码,并用行为明确的完全可测试代码替换它。 +这表明 TDD 是确保代码不会太凌乱的理想方法。TDD 指出了一些问题区域,例如缺乏单一责任和存在隐藏输入。此外,TDD 有助于删除不确定性代码,并用行为明确的完全可测试代码替换它。 最后,TDD 帮助交付易于阅读、逻辑易于遵循的代码。 在本系列的下一篇文章中,我将演示如何使用在本练习中创建的逻辑来实现功能代码,以及如何进行进一步的测试使其变得更好。 - -------------------------------------------------------------------------------- via: https://opensource.com/article/19/9/mutation-testing-example-failure-experimentation 作者:[Alex Bunardzic][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 -[a]: https://opensource.com/users/alex-bunardzichttps://opensource.com/users/jocunddew +[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/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) -[2]: https://opensource.com/article/19/9/mutation-testing-example-part-1-how-leverage-failure -[3]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd +[2]: https://linux.cn/article-11483-1.html +[3]: https://linux.cn/article-11468-1.html [4]: https://en.wikipedia.org/wiki/Separation_of_concerns [5]: https://martinfowler.com/bliki/InversionOfControl.html [6]: http://www.laputan.org/drc/drc.html From e91994a008a72a2f7f1dd78cd2585851fefc6360 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 17:19:48 +0800 Subject: [PATCH 111/800] PUB @Morisun029 https://linux.cn/article-11494-1.html --- ...Mutation testing by example- Failure as experimentation.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190924 Mutation testing by example- Failure as experimentation.md (99%) diff --git a/translated/tech/20190924 Mutation testing by example- Failure as experimentation.md b/published/20190924 Mutation testing by example- Failure as experimentation.md similarity index 99% rename from translated/tech/20190924 Mutation testing by example- Failure as experimentation.md rename to published/20190924 Mutation testing by example- Failure as experimentation.md index 4f5af805f7..bc1b43181f 100644 --- a/translated/tech/20190924 Mutation testing by example- Failure as experimentation.md +++ b/published/20190924 Mutation testing by example- Failure as experimentation.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11494-1.html) [#]: subject: (Mutation testing by example: Failure as experimentation) [#]: via: (https://opensource.com/article/19/9/mutation-testing-example-failure-experimentation) [#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzichttps://opensource.com/users/jocunddew) From aaecaae9eaa058c956dd5cb7adeb2192d648b70c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 17:39:57 +0800 Subject: [PATCH 112/800] PRF @geekpi --- ...law can lead to unauthorized privileges.md | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md b/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md index 4eed68efea..5f49979606 100644 --- a/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md +++ b/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md @@ -1,25 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Linux sudo flaw can lead to unauthorized privileges) [#]: via: (https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -Linux sudo 漏洞可能导致未经授权的特权 +Linux sudo 漏洞可能导致未经授权的特权访问 ====== -在 Linux 中利用新发现的 sudo 漏洞可以使某些用户以 root 身份运行命令,尽管对此还有所限制。 -[**sudo**][1] 命令中最近发现了一个严重漏洞,如果被利用,那么即使在 **/etc/sudoers** 文件中明确禁止了该用户,它们也可以以 root 身份运行命令。。 +![](https://img.linux.net.cn/data/attachment/album/201910/23/173934huyi6siys2u33w9z.png) -将 **sudo** 更新到版本 1.8.28 应该可以解决该问题,因此鼓励 Linux 管理员尽快这样做。 +> 在 Linux 中利用新发现的 sudo 漏洞可以使某些用户以 root 身份运行命令,尽管对此还有所限制。 -如何利用此漏洞取决于 **/etc/sudoers** 中授予的特定权限。例如,一条规则允许用户以除 root 用户之外的任何用户身份来编辑文件,这实际上将允许该用户也以 root 用户身份来编辑文件。在这种情况下,该漏洞可能会导致非常严重的问题。 +[sudo][1] 命令中最近发现了一个严重漏洞,如果被利用,普通用户可以 root 身份运行命令,即使在 `/etc/sudoers` 文件中明确禁止了该用户这样做。 -要让用户能够利用此漏洞,需要在 **/etc/sudoers ** 中为**用户**分配权限,以使该用户可以像其他用户一样运行命令,并且该漏洞仅限于以这种方式分配的命令特权。 +将 `sudo` 更新到版本 1.8.28 应该可以解决该问题,因此建议 Linux 管理员尽快这样做。 -此问题影响 1.8.28 之前的版本。要检查你的 sudo 版本,请使用以下命令: +如何利用此漏洞取决于 `/etc/sudoers` 中授予的特定权限。例如,一条规则允许用户以除了 root 用户之外的任何用户身份来编辑文件,这实际上将允许该用户也以 root 用户身份来编辑文件。在这种情况下,该漏洞可能会导致非常严重的问题。 + +用户要能够利用此漏洞,需要在 `/etc/sudoers` 中为**用户**分配特权,以使该用户可以以其他用户身份运行命令,并且该漏洞仅限于以这种方式分配的命令特权。 + +此问题影响 1.8.28 之前的版本。要检查你的 `sudo` 版本,请使用以下命令: ``` $ sudo -V @@ -29,9 +32,9 @@ Sudoers file grammar version 46 Sudoers I/O plugin version 1.8.27 ``` -该漏洞已在“常见漏洞和披露”数据库中分配了编号 [CVE-2019-14287][4]。它的风险是,任何被指定能以任意用户运行单个命令的用户,即使被明确禁止以 root 身份运行,它都能逃脱限制。 +该漏洞已在 CVE 数据库中分配了编号 [CVE-2019-14287][4]。它的风险是,任何被指定能以任意用户运行某个命令的用户,即使被明确禁止以 root 身份运行,它都能逃脱限制。 -下面这些行让 “jdoe” 能够以除了 root 用户之外的其他身份使用 **vi**编辑文件(**!root**表示“非 root”),同时 nemo有权运行以除了 root 身份以外的任何用户使用 **id** 命令: +下面这些行让 `jdoe` 能够以除了 root 用户之外的其他身份使用 `vi` 编辑文件(`!root` 表示“非 root”),同时 `nemo` 有权运行以除了 root 身份以外的任何用户使用 `id` 命令: ``` # affected entries on host "dragonfly" @@ -39,17 +42,24 @@ jdoe dragonfly = (ALL, !root) /usr/bin/vi nemo dragonfly = (ALL, !root) /usr/bin/id ``` -但是,由于存在漏洞,这些用户中的任何一个都将能够绕过限制并编辑文件,或者也可以 root 用户身份运行 **id** 命令。 +但是,由于存在漏洞,这些用户中要么能够绕过限制并以 root 编辑文件,或者以 root 用户身份运行 `id` 命令。 +攻击者可以通过指定用户 ID 为 `-1` 或 `4294967295` 来以 root 身份运行命令。 -攻击者可以通过指定用户 ID 为 “-1” 或 “4294967295” 来以 root 身份运行命令。 +``` +sudo -u#-1 id -u +``` -响应 “1” 表明该命令以 root 身份运行(显示 root 的用户 ID)。 +或者 + +``` +sudo -u#4294967295 id -u +``` + +响应为 `1` 表明该命令以 root 身份运行(显示 root 的用户 ID)。 苹果信息安全团队的 Joe Vennix 找到并分析该问题。 -在 [Facebook][5] 和 [LinkedIn][6] 加入 Network World 社区,评论热门主题。 - -------------------------------------------------------------------------------- via: https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.html @@ -57,7 +67,7 @@ via: https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-un 作者:[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 98506cd7475db987d94d165e14157287204dd7a3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 17:40:52 +0800 Subject: [PATCH 113/800] PUB @geekpi https://linux.cn/article-11495-1.html --- ...016 Linux sudo flaw can lead to unauthorized privileges.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191016 Linux sudo flaw can lead to unauthorized privileges.md (98%) diff --git a/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md b/published/20191016 Linux sudo flaw can lead to unauthorized privileges.md similarity index 98% rename from translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md rename to published/20191016 Linux sudo flaw can lead to unauthorized privileges.md index 5f49979606..327458485a 100644 --- a/translated/tech/20191016 Linux sudo flaw can lead to unauthorized privileges.md +++ b/published/20191016 Linux sudo flaw can lead to unauthorized privileges.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11495-1.html) [#]: subject: (Linux sudo flaw can lead to unauthorized privileges) [#]: via: (https://www.networkworld.com/article/3446036/linux-sudo-flaw-can-lead-to-unauthorized-privileges.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From ebc32b77332484ad7323a3d754c2095ca0daf665 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 20:20:13 +0800 Subject: [PATCH 114/800] APL --- ...tes networking, OpenStack Train, and more industry trends.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md b/sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md index 5d224af465..25811a522e 100644 --- a/sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md +++ b/sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a35e3bc73fa25a3126d578cfca1633191d577c6f Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Wed, 23 Oct 2019 21:15:34 +0800 Subject: [PATCH 115/800] translated --- ...o use IoT devices to keep children safe.md | 62 ----------------- ...o use IoT devices to keep children safe.md | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 62 deletions(-) delete mode 100644 sources/talk/20191011 How to use IoT devices to keep children safe.md create mode 100644 translated/talk/20191011 How to use IoT devices to keep children safe.md diff --git a/sources/talk/20191011 How to use IoT devices to keep children safe.md b/sources/talk/20191011 How to use IoT devices to keep children safe.md deleted file mode 100644 index acc7bd6647..0000000000 --- a/sources/talk/20191011 How to use IoT devices to keep children safe.md +++ /dev/null @@ -1,62 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use IoT devices to keep children safe?) -[#]: via: (https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children-safe/) -[#]: author: (Andrew Carroll https://opensourceforu.com/author/andrew-carroll/) - -How to use IoT devices to keep children safe? -====== - -[![][1]][2] - -_IoT (Internet of Things) devices are transforming our lives rapidly. These devices are everywhere, from our homes to industries. According to some estimates, there will be 10 billion IoT devices by 2020. By 2025, the number of IoT devices will grow to 22 billion. IoT has found its application in a range of fields, including smart homes, industrial processes, agriculture, and even healthcare. With such a wide variety of applications, it is obvious why IoT has become one of the hot topics in recent years._ - -Several factors have contributed to the explosion of IoT devices in multiple disciplines. These include the availability of low-cost processors and wireless connectivity. Moreover, open-source platforms have enabled the exchange of information in driving innovation in the field of IoT. Compared with conventional application development, IoT has developed exponentially because its resources are open-source. -Before explaining how IoT can be used to protect children, a basic understanding of IoT technology is essential. - -**What are IoT devices?** -IoT devices are those that can communicate with each other, without the involvement of humans. Hence, smartphones and computers are not considered as IoT devices by many experts. Moreover, IoT devices must be able to gather data and communicate it to other devices or the cloud for processing. - -However, there are some fields where we need to explore the potential for IoT. Children are vulnerable, which makes them an easy target for criminals and others who mean to harm them. Whether in the physical or digital world, children are susceptible to crime. Since parents cannot be physically present to protect their children at all times; that’s where the need for monitoring tools is obvious. - -In addition to wearable devices for children, there are plenty of parental monitoring applications such as Xnspy that monitor children in real-time and provide live updates. These tools ensure that the child is safe. While wearable devices ensure that the child is not physically in danger, parental monitoring apps ensure that the child is safe online. - -As more children spend time on their smartphones, it is no surprise to see them becoming the primary target for frauds and scammers. Moreover, there is also a chance of children becoming targets of cyberbullying because pedophilia, catfishing, and other crimes are prevalent on the internet. - -Are these solutions enough? We need to find IoT solutions for ensuring our children’s safety, both online and offline. How can we keep children secure in these times? We need to come up with new and innovative solutions that keep our children safe. The solutions provided by IoT can help keep our children safe in schools as well as homes. - -**The potential of IoT** -The benefits offered by IoT devices are numerous. For one, parents can remotely monitor their children without being too overbearing. Thus, children have space and freedom to become independent while having a safe environment to do so. - -Moreover, parents do not have to worry about their children’s safety. IoT devices can provide 24/7 updates about a child. Monitoring apps such as Xnspy go a step further in providing information regarding a child’s smartphone activity. As IoT devices become more sophisticated, it is only a matter of time before we have devices with increased battery life. IoT devices such as location tracking can provide accurate details regarding a child’s whereabouts, so parents do not have to worry. - -While wearable devices are great to have, these are often not enough, when ensuring a child’s safety. Hence, to provide a safe environment for children, we need other methods. Many incidents have shown that schools are just as susceptible to attacks than any other public place. Therefore, schools need to adopt safety measures that keep children and teachers safe. In this, IoT devices can be used to detect threats and take necessary action to prevent the onslaught of an attack. The threat detection system can include cameras. Once the system detects a threat, it can notify the authorities, including law enforcement agencies and hospitals. Devices such as smart locks can be used to lock down the school, including classrooms, to protect children. In addition to this, parents can be informed about their child’s safety, receive immediate alerts on threats. It would require the implementation of wireless technology, such as Wi-Fi and sensors. Thus, schools need to create a budget that is specifically for providing security in the classroom. - -Smart homes have made it possible to turn off lights with a clap, or telling your home assistant to do so. Likewise, IoT devices can be used in a house to protect children. In a home, IoT devices such as cameras can be used to provide parents with 100% visibility when looking after the children. When parents aren’t in the house, cameras and other sensors can be used to detect if any suspicious activity takes place. Other devices, such as smart locks connected to these sensors, can lock the doors, windows, and bedrooms to ensure that the kids are safe. -Likewise, there are plenty of IoT solutions that can be introduced to keep kids safe. - -**Just as bad as they are good** -Sensors in IoT devices create an enormous amount of data. The safety of the data is a crucial factor. The data gathered on a child falling into the wrong hands is a risk. Hence, precautions are required. Any data data breached from your IoT devices can be used to determine behavior patterns. So one must invest in providing safe IoT solutions that do not breach user privacy. - -Often IoT devices connect to the Wi-Fi to transmit data between devices. Unsecure networks that deal with unencrypted data pose certain risks. Such networks are easy to eavesdrop. Hackers can use such network points to hack the system. They can also introduce malware into the system, making it vulnerable. Moreover, cyberattacks on devices and public networks such as those in schools can lead to data breaches and theft of private data. Hence, an overall plan for protecting the network and IoT devices must be in effect when implementing an IoT solution for the protection of children. - -The potential of IoT devices to protect children in schools and homes is yet to find innovation. We need more effort to protect the network that connects IoT devices. Moreover, the data generated by an IoT device can fall into the wrong hands, causing more trouble. So this is one area where IoT security is essential. - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children-safe/ - -作者:[Andrew Carroll][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensourceforu.com/author/andrew-carroll/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Visual-Internet-of-things_EB-May18.jpg?resize=696%2C507&ssl=1 (Visual Internet of things_EB May18) -[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Visual-Internet-of-things_EB-May18.jpg?fit=900%2C656&ssl=1 diff --git a/translated/talk/20191011 How to use IoT devices to keep children safe.md b/translated/talk/20191011 How to use IoT devices to keep children safe.md new file mode 100644 index 0000000000..f85cd46dd7 --- /dev/null +++ b/translated/talk/20191011 How to use IoT devices to keep children safe.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use IoT devices to keep children safe?) +[#]: via: (https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children-safe/) +[#]: author: (Andrew Carroll https://opensourceforu.com/author/andrew-carroll/) + +如何使用物联网设备来确保儿童安全? +====== + +[![][1]][2] + +IoT (物联网)设备正在迅速改变我们的生活。这些设备无处不在,从我们的家庭到其它行业。根据一些预测数据,到2020年,将会有100亿个 IoT 设备。到2025年,该数量将增长到220亿。目前,物联网已经在很多领域得到了应用,包括智能家居,工业生产过程,农业甚至医疗保健领域。伴随着如此广泛的应用,物联网显然已经成为近年来的热门话题之一。 +多种因素促成了物联网设备在多个学科的爆炸式增长。这其中包括低成本处理器和无线连接的的可用性, 以及开源平台的信息交流推动了物联网领域的创新。与传统的应用程序开发相比,物联网设备的开发成指数级增长,因为它的资源是开源的。 +在解释如何使用物联网设备来保护儿童之前,必须对物联网技术有基本的了解。 + + +**IOT 设备是什么?** +IOT 设备是指那些在没有人类参与的情况下彼此之间可以通信的设备。 因此,许多专家并不将智能手机和计算机视为物联网设备。 此外,物联网设备必须能够收集数据并且能将收集到的数据传送到其他设备或云端进行处理。 + +然而,在某些领域中,我们需要探索物联网的潜力。 儿童往往是脆弱的,他们很容易成为犯罪分子和其他蓄意伤害者的目标。 无论在物理世界还是数字世界中,儿童都很容易犯罪。 因为父母不能始终亲自到场保护孩子; 这就是为什么需要监视工具了。 + +除了适用于儿童的可穿戴设备外,还有许多父母监视应用程序,例如Xnspy,可实时监控儿童并提供信息的实时更新。 这些工具可确保儿童安全。 可穿戴设备确保儿童身体上的安全性,而家长监控应用可确保儿童的上网安全。 + +由于越来越多的孩子花费时间在智能手机上,毫无意外地,他们也就成为诈骗分子的主要目标。 此外,由于恋童癖,网络自夸和其他犯罪在网络上的盛行,儿童也有可能成为网络欺凌的目标。 + +这些解决方案够吗? 我们需要找到物联网解决方案,以确保孩子们在网上和线下的安全。 在当代,我们如何确保孩子的安全? 我们需要提出创新的解决方案。 物联网可以帮助保护孩子在学校和家里的安全。 + + +**物联网的潜力** +物联网设备提供的好处很多。 举例来说,父母可以远程监控自己的孩子,而又不会显得太霸道。 因此,儿童在拥有安全环境的同时也会有空间和自由让自己变得独立。 +而且,父母也不必在为孩子的安全而担忧。物联网设备可以提供7x24小时的信息更新。像 Xnspy 之类的监视应用程序在提供有关孩子的智能手机活动信息方面更进了一步。随着物联网设备变得越来越复杂,拥有更长使用寿命的电池只是一个时间问题。诸如位置跟踪器之类的物联网设备可以提供有关孩子下落的准确详细信息,所以父母不必担心。 + +虽然可穿戴设备已经非常好了,但在确保儿童安全方面,这些通常还远远不够。因此,要为儿童提供安全的环境,我们还需要其他方法。许多事件表明,学校比其他任何公共场所都容易受到攻击。因此,学校需要采取安全措施,以确保儿童和教师的安全。在这一点上,物联网设备可用于检测潜在威胁并采取必要的措施来防止攻击。威胁检测系统包括摄像头。系统一旦检测到威胁,便可以通知当局,如一些执法机构和医院。智能锁等设备可用于封锁学校(包括教室),来保护儿童。除此之外,还可以告知父母其孩子的安全,并立即收到有关威胁的警报。这将需要实施无线技术,例如 Wi-Fi 和传感器。因此,学校需要制定专门用于提供教室安全性的预算。 + +智能家居实现拍手关灯,也可以让你的家庭助手帮你关灯。 同样,物联网设备也可用在屋内来保护儿童。 在家里,物联网设备(例如摄像头)为父母在照顾孩子时提供100%的可见性。 当父母不在家里时,可以使用摄像头和其他传感器检测是否发生了可疑活动。 其他设备(例如连接到这些传感器的智能锁)可以锁门和窗,以确保孩子们的安全。 + +同样,可以引入许多物联网解决方案来确保孩子的安全。 + + + +**有多好就有多坏** +物联网设备中的传感器会创建大量数据。 数据的安全性是至关重要的一个因素。 收集的有关孩子的数据如果落入不法分子手中会存在危险。 因此,需要采取预防措施。 IoT 设备中泄露的任何数据都可用于确定行为模式。 因此,必须投资提供不违反用户隐私的安全物联网解决方案。 + +IoT 设备通常连接到 Wi-Fi,用于设备之间传输数据。未加密数据的不安全网络会带来某些风险。 这样的网络很容易被窃听。 黑客可以使用此类网点来入侵系统。 他们还可以将恶意软件引入系统,从而使系统变得脆弱,易受攻击。 此外,对设备和公共网络(例如学校的网络)的网络攻击可能导致数据泄露和私有数据盗用。 因此,在实施用于保护儿童的物联网解决方案时,保护网络和物联网设备的总体计划必须生效。 + +物联网设备保护儿童在学校和家里的安全的潜力尚未发现有什么创新。 我们需要付出更多努力来保护连接 IoT 设备的网络安全。 此外,物联网设备生成的数据可能落入不法分子手中,从而造成更多麻烦。 因此,这是物联网安全至关重要的一个领域。 + + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children-safe/ + +作者:[Andrew Carroll][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/andrew-carroll/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Visual-Internet-of-things_EB-May18.jpg?resize=696%2C507&ssl=1 (Visual Internet of things_EB May18) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Visual-Internet-of-things_EB-May18.jpg?fit=900%2C656&ssl=1 From f24a54b454e986120f7c0e01733d339febba0df8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 22:12:02 +0800 Subject: [PATCH 116/800] TSL&PRF --- ...enStack Train, and more industry trends.md | 70 ---------------- ...enStack Train, and more industry trends.md | 82 +++++++++++++++++++ 2 files changed, 82 insertions(+), 70 deletions(-) delete mode 100644 sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md create mode 100644 translated/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md diff --git a/sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md b/sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md deleted file mode 100644 index 25811a522e..0000000000 --- a/sources/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Kubernetes networking, OpenStack Train, and more industry trends) -[#]: via: (https://opensource.com/article/19/10/kubernetes-openstack-and-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Kubernetes networking, OpenStack Train, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [A look at the most exciting features in OpenStack Train][2] - -> But given all the technology goodies ([you can see the release highlights here][3]) that the Train release has to offer, you may be curious about the features that we at Red Hat believe are among the top capabilities that will benefit our telecommunications and enterprise customers and their uses cases. Here's an overview of the features we are most excited about this release. - -**The impact**: OpenStack to me is like Shia LaBeouf: it reached peak hype a couple of years ago and then continued turning out good work. The Train release looks like yet another pretty incredible drop of innovation. - -## [Building Kubernetes Operators in an Ansible-native way][4] - -> Operators simplify management of complex applications on Kubernetes. They are usually written in Go and require expertise with the internals of Kubernetes. But, there’s an alternative to that with a lower barrier to entry. Ansible is a first-class citizen in the Operator SDK. Using Ansible frees up application engineers, maximizes time to automate and orchestrate your applications, and doing it across new & existing platforms with one simple language. Here we see how. - -**The impact**: This is like finding out you can make pretty good ice cream with a blender and frozen bananas: Ansible (which is generally thought of as being pretty simple to pick up) lets you do some pretty impressive Operator magic way easier than you thought you could. - -## [Kubernetes networking: Behind the scenes][5] - -> While there are very good resources around this topic (links [here][6]), I couldn’t find a single example that connects all of the dots with commands outputs that network engineers love and hate, showing what is actually happening behind the scenes. So, I decided to curate this information from a number of different sources to hopefully help you better understand how things are tied together. - -**The impact**: An accessible, well-written take on a complicated topic (with pictures). Guaranteed to make Kube networking 10% less confusing. - -## [Securing the container supply chain][7] - -> With the emergence of containers, Software as a Service and Functions as a Service, the focus in on consuming existing services, functions and container images in the race to provide new value. Scott McCarty, Principal Product Manager, Containers at [Red Hat][8], says that focus has both advantages and disadvantages. “It allows us to focus our energy on writing new application code that is specific to our needs, while shifting the concern for the underlying infrastructure to someone else,” says McCarty. “Containers are in a sweet spot providing enough control, but offloading a lot of tedious infrastructure work.” But containers can also create disadvantages related to security. - -**The impact**: I sit amongst a group of ~10 security people, and can safely say that it takes a certain disposition to want to think about software security all day. When you stare into the abyss for long enough, it stares back into you. If you are a software developer who is not so disposed, please take Scott's advice and make sure your suppliers are. - -## [Fedora at 15: Why Matthew Miller sees a bright future for the Linux distribution][9] - -> In a wide-ranging interview with TechRepublic, Fedora project leader Matthew Miller discussed lessons learned from the past, popular adoption and competing standards for software containers, potential changes coming to Fedora, as well as hot-button topics, including systemd. - -**The impact**: What I like about the Fedora project is it's clarity; the project knows what it stands for. People like Matt are why. - -## _I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/kubernetes-openstack-and-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.redhat.com/en/blog/look-most-exciting-features-openstack-train -[3]: https://releases.openstack.org/train/highlights.html -[4]: https://www.cncf.io/webinars/building-kubernetes-operators-in-an-ansible-native-way/ -[5]: https://itnext.io/kubernetes-networking-behind-the-scenes-39a1ab1792bb -[6]: https://github.com/nleiva/kubernetes-networking-links -[7]: https://www.devprojournal.com/technology-trends/open-source/securing-the-container-supply-chain/ -[8]: https://www.redhat.com/en -[9]: https://www.techrepublic.com/article/fedora-at-15-why-matthew-miller-sees-a-bright-future-for-the-linux-distribution/ diff --git a/translated/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md b/translated/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md new file mode 100644 index 0000000000..c5c30e12a7 --- /dev/null +++ b/translated/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Kubernetes networking, OpenStack Train, and more industry trends) +[#]: via: (https://opensource.com/article/19/10/kubernetes-openstack-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +每周开源点评:Kubernetes 网络、OpenStack Train 以及更多的行业趋势 +====== + +> 开源社区和行业趋势的每周总览。 + +![Person standing in front of a giant computer screen with numbers, data][1] + +作为我在具有开源开发模型的企业软件公司担任高级产品营销经理的角色的一部分,我为产品营销人员、经理和其他影响者定期发布有关开源社区,市场和行业趋势的定期更新。以下是该更新中我和他们最喜欢的五篇文章。 + +### OpenStack Train 中最令人兴奋的功能 + +- [文章地址][2] + +> 考虑到 Train 版本必须提供的所有技术优势([你可以在此处查看版本亮点][3]),你可能会对 Red Hat 认为这些将使我们的电信和企业客户受益的顶级功能及其用例感到好奇。以下我们对该版本最兴奋的功能的概述。 + +**影响**:OpenStack 对我来说就像 Shia LaBeouf:它在几年前达到了炒作的顶峰,然后继续产出了好的作品。Train 版本看起来是又一次令人难以置信的创新下降。 + +### 以 Ansible 原生的方式构建 Kubernetes 操作器 + +- [文章地址][4] + +> 操作器简化了 Kubernetes 上复杂应用程序的管理。它们通常是用 Go 语言编写的,并且需要懂得 Kubernetes 内部的专业知识。但是,还有另一种进入门槛较低的选择。Ansible 是操作器 SDK 中的一等公民。使用 Ansible 可以释放应用程序工程师的精力,最大限度地利用时间来自动化和协调你的应用程序,并使用一种简单的语言在新的和现有的平台上进行操作。在这里我们可以看到如何做。 + +**影响**:这就像你发现可以用搅拌器和冷冻香蕉制作出不错的冰淇淋一样:Ansible(通常被认为很容易掌握)可以使你比你想象的更容易地做一些令人印象深刻的操作器魔术。 + +### Kubernetes 网络:幕后花絮 + +- [文章地址][5] + +> 尽管围绕该主题有很多很好的资源(链接在[这里][6]),但我找不到一个示例,可以将所有的点与网络工程师喜欢和讨厌的命令输出连接起来,以显示背后实际发生的情况。因此,我决定从许多不同的来源收集这些信息,以期帮助你更好地了解事物之间的联系。 + +**影响**:这是一篇对复杂主题(带有图片)阐述的很好的作品。保证可以使 Kubenetes 网络的混乱程度降低 10%。 + +### 保护容器供应链 + +- [文章地址][7] + +> 随着容器、软件即服务和函数即服务的出现,人们开始着眼于在使用现有服务、函数和容器映像的过程中寻求新的价值。[Red Hat][8] 的容器首席产品经理 Scott McCarty 表示,关注这个重点既有优点也有缺点。“它使我们能够集中精力编写满足我们需求的新应用程序代码,同时将对基础架构的关注转移给其他人身上,”McCarty 说,“容器处于一个最佳位置,提供了足够的控制,而卸去了许多繁琐的基础架构工作。”但是,容器也会带来与安全性相关的劣势。 + +**影响**:我在一个由大约十位安全人员组成的小组中,可以肯定地说,整天要考虑软件安全性需要一定的倾向。当你长时间凝视深渊时,它也凝视着你。如果你不是如此倾向的软件开发人员,请听取 Scott 的建议并确保你的供应商考虑安全。 + +### 15 岁的 Fedora:为何 Matthew Miller 看到 Linux 发行版的光明前景 + +- [文章链接][9] + +> 在 TechRepublic 的一个大范围采访中,Fedora 项目负责人 Matthew Miller 讨论了过去的经验教训、软件容器的普遍采用和竞争性标准、Fedora 的潜在变化以及包括 systemd 在内的热门话题。 + +**影响**:我喜欢 Fedora 项目的原因是它的清晰度;该项目知道它代表什么。像 Matt 这样的人就是为什么能看到光明前景的原因。 + +*我希望你喜欢这张上周让我印象深刻的列表,并在下周一回来了解更多的开放源码社区、市场和行业趋势。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/kubernetes-openstack-and-more-industry-trends + +作者:[Tim Hildred][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/thildred +[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://www.redhat.com/en/blog/look-most-exciting-features-openstack-train +[3]: https://releases.openstack.org/train/highlights.html +[4]: https://www.cncf.io/webinars/building-kubernetes-operators-in-an-ansible-native-way/ +[5]: https://itnext.io/kubernetes-networking-behind-the-scenes-39a1ab1792bb +[6]: https://github.com/nleiva/kubernetes-networking-links +[7]: https://www.devprojournal.com/technology-trends/open-source/securing-the-container-supply-chain/ +[8]: https://www.redhat.com/en +[9]: https://www.techrepublic.com/article/fedora-at-15-why-matthew-miller-sees-a-bright-future-for-the-linux-distribution/ From 406edd05a6b1500df0680e1384126b1edaeb7a4b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 23 Oct 2019 22:14:58 +0800 Subject: [PATCH 117/800] PUB @wxy https://linux.cn/article-11497-1.html --- ...s networking, OpenStack Train, and more industry trends.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md (98%) diff --git a/translated/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md b/published/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md similarity index 98% rename from translated/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md rename to published/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md index c5c30e12a7..994c583274 100644 --- a/translated/news/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md +++ b/published/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11497-1.html) [#]: subject: (Kubernetes networking, OpenStack Train, and more industry trends) [#]: via: (https://opensource.com/article/19/10/kubernetes-openstack-and-more-industry-trends) [#]: author: (Tim Hildred https://opensource.com/users/thildred) From 892f98c4fd7b3156027c71f5d4fd8bc76c5e9a44 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Oct 2019 00:52:39 +0800 Subject: [PATCH 118/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20Using?= =?UTF-8?q?=20SSH=20port=20forwarding=20on=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191023 Using SSH port forwarding on Fedora.md --- ...023 Using SSH port forwarding on Fedora.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20191023 Using SSH port forwarding on Fedora.md diff --git a/sources/tech/20191023 Using SSH port forwarding on Fedora.md b/sources/tech/20191023 Using SSH port forwarding on Fedora.md new file mode 100644 index 0000000000..5b5dc4ef38 --- /dev/null +++ b/sources/tech/20191023 Using SSH port forwarding on Fedora.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using SSH port forwarding on Fedora) +[#]: via: (https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +Using SSH port forwarding on Fedora +====== + +![][1] + +You may already be familiar with using the _[ssh][2]_ [command][2] to access a remote system. The protocol behind _ssh_ allows terminal input and output to flow through a [secure channel][3]. But did you know that you can also use _ssh_ to send and receive other data securely as well? One way is to use _port forwarding_, which allows you to connect network ports securely while conducting your _ssh_ session. This article shows you how it works. + +### About ports + +A standard Linux system has a set of network ports already assigned, from 0-65535. Your system reserves ports up to 1023 for system use. In many systems you can’t elect to use one of these low-numbered ports. Quite a few ports are commonly expected to run specific services. You can find these defined in your system’s _/etc/services_ file. + +You can think of a network port like a physical port or jack to which you can connect a cable. That port may connect to some sort of service on the system, like wiring behind that physical jack. An example is the Apache web server (also known as _httpd_). The web server usually claims port 80 on the host system for HTTP non-secure connections, and 443 for HTTPS secure connections. + +When you connect to a remote system, such as with a web browser, you are also “wiring” your browser to a port on your host. This is usually a random high port number, such as 54001. The port on your host connects to the port on the remote host, such as 443 to reach its secure web server. + +So why use port forwarding when you have so many ports available? Here are a couple common cases in the life of a web developer. + +### Local port forwarding + +Imagine that you are doing web development on a remote system called _remote.example.com_. You usually reach this system via _ssh_ but it’s behind a firewall that allows very little additional access, and blocks most other ports. To try out your web app, it’s helpful to be able to use your web browser to point to the remote system. But you can’t reach it via the normal method of typing the URL in your browser, thanks to that pesky firewall. + +Local forwarding allows you to tunnel a port available via the remote system through your _ssh_ connection. The port appears as a local port on your system (thus “local forwarding.”) + +Let’s say your web app is running on port 8000 on the _remote.example.com_ box. To locally forward that system’s port 8000 to your system’s port 8000, use the _-L_ option with _ssh_ when you start your session: + +``` +$ ssh -L 8000:localhost:8000 remote.example.com +``` + +Wait, why did we use _localhost_ as the target for forwarding? It’s because from the perspective of _remote.example.com_, you’re asking the host to use its own port 8000. (Recall that any host usually can refer to itself as _localhost_ to connect to itself via a network connection.) That port now connects to your system’s port 8000. Once the _ssh_ session is ready, keep it open, and you can type __ in your browser to see your web app. The traffic between systems now travels securely over an _ssh_ tunnel! + +If you have a sharp eye, you may have noticed something. What if we used a different hostname than _localhost_ for the _remote.example.com_ to forward? If it can reach a port on another system on its network, it usually can forward that port just as easily. For example, say you wanted to reach a MariaDB or MySQL service on the _db.example.com_ box also on the remote network. This service typically runs on port 3306. So you could forward it with this command, even if you can’t _ssh_ to the actual _db.example.com_ host: + +``` +$ ssh -L 3306:db.example.com:3306 remote.example.com +``` + +Now you can run MariaDB commands against your _localhost_ and you’re actually using the _db.example.com_ box. + +### Remote port forwarding + +Remote forwarding lets you do things the opposite way. Imagine you’re designing a web app for a friend at the office, and want to show them your work. Unfortunately, though, you’re working in a coffee shop, and because of the network setup, they can’t reach your laptop via a network connection. However, you both use the _remote.example.com_ system at the office and you can still log in there. Your web app seems to be running well on port 5000 locally. + +Remote port forwarding lets you tunnel a port from your local system through your _ssh_ connection, and make it available on the remote system. Just use the _-R_ option when you start your _ssh_ session: + +``` +$ ssh -R 6000:localhost:5000 remote.example.com +``` + +Now when your friend inside the corporate firewall runs their browser, they can point it at __ and see your work. And as in the local port forwarding example, the communications travel securely over your _ssh_ session. + +By default the _sshd_ daemon running on a host is set so that **only** that host can connect to its remote forwarded ports. Let’s say your friend wanted to be able to let people on other _example.com_ corporate hosts see your work, and they weren’t on _remote.example.com_ itself. You’d need the owner of the _remote.example.com_ host to add **one** of these options to _/etc/ssh/sshd_config_ on that box: + +``` +GatewayPorts yes # OR +GatewayPorts clientspecified +``` + +The first option means remote forwarded ports are available on all the network interfaces on _remote.example.com_. The second means that the client who sets up the tunnel gets to choose the address. This option is set to **no** by default. + +With this option, you as the _ssh_ client must still specify the interfaces on which the forwarded port on your side can be shared. Do this by adding a network specification before the local port. There are several ways to do this, including the following: + +``` +$ ssh -R *:6000:localhost:5000 # all networks +$ ssh -R 0.0.0.0:6000:localhost:5000 # all networks +$ ssh -R 192.168.1.15:6000:localhost:5000 # single network +$ ssh -R remote.example.com:6000:localhost:5000 # single network +``` + +### Other notes + +Notice that the port numbers need not be the same on local and remote systems. In fact, at times you may not even be able to use the same port. For instance, normal users may not to forward onto a system port in a default setup. + +In addition, it’s possible to restrict forwarding on a host. This might be important to you if you need tighter security on a network-connected host. The _PermitOpen_ option for the _sshd_ daemon controls whether, and which, ports are available for TCP forwarding. The default setting is **any**, which allows all the examples above to work. To disallow any port fowarding, choose **none**, or choose only a specific **host:port** setting to permit. For more information, search for _PermitOpen_ in the manual page for _sshd_ daemon configuration: + +``` +$ man sshd_config +``` + +Finally, remember port forwarding only happens as long as the controlling _ssh_ session is open. If you need to keep the forwarding active for a long period, try running the session in the background using the _-N_ option. Make sure your console is locked to prevent tampering while you’re away from it. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/ + +作者:[Paul W. Frields][a] +选题:[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/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/ssh-port-forwarding-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Secure_Shell +[3]: https://fedoramagazine.org/open-source-ssh-clients/ From 1c22197bb01c21724b9626a4bd548f22078788f2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Oct 2019 00:53:08 +0800 Subject: [PATCH 119/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191024=20Open?= =?UTF-8?q?=20Source=20CMS=20Ghost=203.0=20Released=20with=20New=20feature?= =?UTF-8?q?s=20for=20Publishers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md --- ...leased with New features for Publishers.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md diff --git a/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md new file mode 100644 index 0000000000..544ec7b3f2 --- /dev/null +++ b/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source CMS Ghost 3.0 Released with New features for Publishers) +[#]: via: (https://itsfoss.com/ghost-3-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Open Source CMS Ghost 3.0 Released with New features for Publishers +====== + +[Ghost][1] is a free and open source content management system (CMS). If you are not aware of the term, a CMS is a software that allows you to build a website that is primarily focused on creating content without knowledge of HTML and other web-related technologies. + +Ghost is in fact one of the [best open source CMS][2] out there. It’s main focus is on creating lightweight, fast loading and good looking blogs. + +It has a modern intuitive editor with built-in SEO features. You also have native desktop (Linux including) and mobile apps. If you like terminal, you can also use the CLI tools it provides. + +Let’s see what new feature Ghost 3.0 brings. + +### New Features in Ghost 3.0 + +![][3] + +I’m usually intrigued by open source CMS solutions – so after reading the official announcement post, I went ahead and gave it a try by installing a new Ghost instance via [Digital Ocean cloud server][4]. + +I was really impressed with the improvements they’ve made with the features and the UI compared to the previous version. + +Here, I shall list out the key changes/additions worth mentioning. + +#### Bookmark Cards + +![][5] + +In addition to all the subtle change to the editor, it now lets you add a beautiful bookmark card by just entering the URL. + +If you have used WordPress – you may have noticed that you need to have a plugin in order to add a card like that – so it is definitely a useful addition in Ghost 3.0. + +#### Improved WordPress Migration Plugin + +I haven’t tested this in particular but they have updated their WordPress migration plugin to let you easily clone the posts (with images) to Ghost CMS. + +Basically, with the plugin, you will be able to create an archive (with images) and import it to Ghost CMS. + +#### Responsive Image Galleries & Images + +To make the user experience better, they have also updated the image galleries (which is now responsive) to present your picture collection comfortably across all devices. + +In addition, the images in post/pages are now responsive as well. + +#### Members & Subscriptions option + +![Ghost Subscription Model][6] + +Even though the feature is still in the beta phase, it lets you add members and a subscription model for your blog if you choose to make it a premium publication to sustain your business. + +With this feature, you can make sure that your blog can only be accessed by the subscribed members or choose to make it available to the public in addition to the subscription. + +#### Stripe: Payment Integration + +It supports Stripe payment gateway by default to help you easily enable the subscription (or any type of payments) with no additional fee charged by Ghost. + +#### New App Integrations + +![][7] + +You can now integrate a variety of popular applications/services with your blog on Ghost 3.0. It could come in handy to automate a lot of things. + +#### Default Theme Improvement + +The default theme (design) that comes baked in has improved and now offers a dark mode as well. + +You can always choose to create a custom theme as well (if not pre-built themes available). + +#### Other Minor Improvements + +In addition to all the key highlights, the visual editor to create posts/pages has improved as well (with some drag and drop capabilities). + +I’m sure there’s a lot of technical changes as well – which you can check it out in their [changelog][8] if you’re interested. + +### Ghost is gradually getting good traction + +It’s not easy to make your mark in a world dominated by WordPress. But Ghost has gradually formed a dedicated community of publishers around it. + +Not only that, their managed hosting service [Ghost Pro][9] now has customers like NASA, Mozilla and DuckDuckGo. + +In last six years, Ghost has made $5 million in revenue from their Ghost Pro customers . Considering that they are a non-profit organization working on open source solution, this is indeed an achievement. + +This helps them remain independent by avoiding external funding from venture capitalists. The more customers for managed Ghost CMS hosting, the more funds goes into the development of the free and open source CMS. + +Overall, Ghost 3.0 is by far the best upgrade they’ve offered. I’m personally impressed with the features. + +If you have websites of your own, what CMS do you use? Have you ever used Ghost? How’s your experience with it? Do share your thoughts in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ghost-3-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/recommends/ghost/ +[2]: https://itsfoss.com/open-source-cms/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/ghost-3.jpg?ssl=1 +[4]: https://itsfoss.com/recommends/digital-ocean/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/ghost-editor-screenshot.png?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/ghost-subscription-model.jpg?resize=800%2C503&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/ghost-app-integration.jpg?ssl=1 +[8]: https://ghost.org/faq/upgrades/ +[9]: https://itsfoss.com/recommends/ghost-pro/ From 856c6ab932bea1d4c7aead84747774666fb8a608 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Oct 2019 00:53:54 +0800 Subject: [PATCH 120/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20How=20?= =?UTF-8?q?to=20dual=20boot=20Windows=2010=20and=20Debian=2010?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md --- ...w to dual boot Windows 10 and Debian 10.md | 263 ++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md diff --git a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md new file mode 100644 index 0000000000..6bc74a6b8e --- /dev/null +++ b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md @@ -0,0 +1,263 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to dual boot Windows 10 and Debian 10) +[#]: via: (https://www.linuxtechi.com/dual-boot-windows-10-debian-10/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to dual boot Windows 10 and Debian 10 +====== + +So, you finally made the bold decision to try out **Linux** after much convincing. However, you do not want to let go of your Windows 10 operating system yet as you will still be needing it before you learn the ropes on Linux. Thankfully, you can easily have a dual boot setup that allows you to switch to either of the operating systems upon booting your system. In this guide, you will learn how to **dual boot  Windows 10 alongside Debian 10**. + +[![How-to-dual-boot-Windows-and-Debian10][1]][2] + +### Prerequisites + +Before you get started, ensure you have the following: + + * A bootable USB  or DVD of Debian 10 + * A fast and stable internet connection ( For installation updates & third party applications) + + + +Additionally, it worth paying attention to how your system boots (UEFI or Legacy) and ensure both the operating systems boot using the same boot mode. + +### Step 1: Create a free partition on your hard drive + +To start off, you need to create a free partition on your hard drive. This is the partition where Debian will be installed during the installation process. To achieve this, you will invoke the disk management utility as shown: + +Press **Windows Key + R** to launch the Run dialogue. Next, type **diskmgmt.msc** and hit **ENTER** + +[![Launch-Run-dialogue][1]][3] + +This launches the **disk management** window displaying all the drives existing on your Windows system. + +[![Disk-management][1]][4] + +Next, you need to create a free space for Debian installation. To do this, you need to shrink a partition from one of the volumes and create a new unallocated partition. In this case, I will create a **30 GB** partition from Volume D. + +To shrink a volume, right-click on it and select the ‘**shrink**’ option + +[![Shrink-volume][1]][5] + +In the pop-up dialogue, define the size that you want to shrink your space. Remember, this will be the disk space on which Debian 10 will be installed. In my case, I selected **30000MB  ( Approximately 30 GB)**. Once done, click on ‘**Shrink**’. + +[![Shrink-space][1]][6] + +After the shrinking operation completes, you should have an unallocated partition as shown: + +[![Unallocated-partition][1]][7] + +Perfect! We are now good to go and ready to begin the installation process. + +### Step 2: Begin the installation of Debian 10 + +With the free partition already created, plug in your bootable USB drive or insert the DVD installation medium in your PC and reboot your system. Be sure to make changes to the **boot order** in the **BIOS** set up by pressing the function keys (usually, **F9, F10 or F12** depending on the vendor). This is crucial so that the PC boots into your installation medium. Saves the BIOS settings and reboot. + +A new grub menu will be displayed as shown below: Click on ‘**Graphical install**’ + +[![Graphical-Install-Debian10][1]][8] + +In the next step, select your **preferred language** and click ‘**Continue**’ + +[![Select-Language-Debian10][1]][9] + +Next, select your **location** and click ‘**Continue**’. Based on this location the time will automatically be selected for you. If you cannot find you located, scroll down and click on ‘**other**’ then select your location. + +[![Select-location-Debain10][1]][10] + +Next, select your **keyboard** layout. + +[![Configure-Keyboard-layout-Debain10][1]][11] + +In the next step, specify your system’s **hostname** and click ‘**Continue**’ + +[![Set-hostname-Debian10][1]][12] + +Next, specify the **domain name**. If you are not in a domain environment, simply click on the ‘**continue**’ button. + +[![Set-domain-name-Debian10][1]][13] + +In the next step, specify the **root password** as shown and click ‘**continue**’. + +[![Set-root-Password-Debian10][1]][14] + +In the next step, specify the full name of the user for the account and click ‘**continue**’ + +[![Specify-fullname-user-debain10][1]][15] + +Then set the account name by specifying the **username** associated with the account + +[![Specify-username-Debian10][1]][16] + +Next, specify the username’s password as shown and click ‘**continue**’ + +[![Specify-user-password-Debian10][1]][17] + +Next, specify your **timezone** + +[![Configure-timezone-Debian10][1]][18] + +At this point, you need to create partitions for your Debian 10 installation. If you are an inexperienced user, Click on the ‘**Use the largest continuous free space**’ and click ‘**continue**’. + +[![Use-largest-continuous-free-space-debian10][1]][19] + +However, if you are more knowledgeable about creating partitions, select the ‘**Manual**’ option and click ‘**continue**’ + +[![Select-Manual-Debain10][1]][20] + +Thereafter, select the partition labeled ‘**FREE SPACE**’  and click ‘**continue**’ . Next click on ‘**Create a new partition**’. + +[![Create-new-partition-Debain10][1]][21] + +In the next window, first, define the size of swap space, In my case, I specified **2GB**. Click **Continue**. + +[![Define-swap-space-debian10][1]][22] + +Next, click on ‘’**Primary**’ on the next screen and click ‘**continue**’ + +[![Partition-Disks-Primary-Debain10][1]][23] + +Select the partition to **start at the beginning** and click continue. + +[![Start-at-the-beginning-Debain10][1]][24] + +Next, click on **Ext 4 journaling file system** and click ‘**continue**’ + +[![Select-Ext4-Journaling-system-debain10][1]][25] + +On the next window, select **swap  **and click continue + +[![Select-swap-debain10][1]][26] + +Next, click on **done setting the partition** and click continue. + +[![Done-setting-partition-debian10][1]][27] + +Back to the **Partition disks** page, click on **FREE SPACE** and click continue + +[![Click-Free-space-Debain10][1]][28] + +To make your life easy select **Automatically partition the free space** and click **continue**. + +[![Automatically-partition-free-space-Debain10][1]][29] + +Next click on **All files in one partition (recommended for new users)** + +[![All-files-in-one-partition-debian10][1]][30] + +Finally, click on **Finish partitioning and write changes to disk** and click **continue**. + +[![Finish-partitioning-write-changes-to-disk][1]][31] + +Confirm that you want to write changes to disk and click ‘**Yes**’ + +[![Write-changes-to-disk-Yes-Debian10][1]][32] + +Thereafter, the installer will begin installing all the requisite software packages. + +When asked if you want to scan another CD, select **No** and click continue + +[![Scan-another-CD-No-Debain10][1]][33] + +Next, select the mirror of the Debian archive closest to you and click ‘Continue’ + +[![Debian-archive-mirror-country][1]][34] + +Next, select the **Debian mirror** that is most preferable to you and click ‘**Continue**’ + +[![Select-Debian-archive-mirror][1]][35] + +If you plan on using a proxy server, enter its details as shown below, otherwise leave it blank and click ‘continue’ + +[![Enter-proxy-details-debian10][1]][36] + +As the installation proceeds, you will be asked if you would like to participate in a **package usage survey**. You can select either option and click ‘continue’ . In my case, I selected ‘**No**’ + +[![Participate-in-survey-debain10][1]][37] + +Next, select the packages you need in the **software selection** window and click **continue**. + +[![Software-selection-debian10][1]][38] + +The installation will continue installing the selected packages. At this point, you can take a coffee break as the installation goes on. + +You will be prompted whether to install the grub **bootloader** on **Master Boot Record (MBR)**. Click **Yes** and click **Continue**. + +[![Install-grub-bootloader-debian10][1]][39] + +Next, select the hard drive on which you want to install **grub** and click **Continue**. + +[![Select-hard-drive-install-grub-Debian10][1]][40] + +Finally, the installation will complete, Go ahead and click on the ‘**Continue**’ button + +[![Installation-complete-reboot-debian10][1]][41] + +You should now have a grub menu with both **Windows** and **Debian** listed. To boot to Debian, scroll and click on Debian. Thereafter, you will be prompted with a login screen. Enter your details and hit ENTER. + +[![Debian10-log-in][1]][42] + +And voila! There goes your fresh copy of Debian 10 in a dual boot setup with Windows 10. + +[![Debian10-Buster-Details][1]][43] + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/dual-boot-windows-10-debian-10/ + +作者:[James Kiarie][a] +选题:[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/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/How-to-dual-boot-Windows-and-Debian10.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Launch-Run-dialogue.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Disk-management.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Shrink-volume.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Shrink-space.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Unallocated-partition.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Graphical-Install-Debian10.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-Language-Debian10.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-location-Debain10.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Configure-Keyboard-layout-Debain10.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Set-hostname-Debian10.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Set-domain-name-Debian10.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Set-root-Password-Debian10.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Specify-fullname-user-debain10.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Specify-username-Debian10.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Specify-user-password-Debian10.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Configure-timezone-Debian10.jpg +[19]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Use-largest-continuous-free-space-debian10.jpg +[20]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-Manual-Debain10.jpg +[21]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Create-new-partition-Debain10.jpg +[22]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Define-swap-space-debian10.jpg +[23]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Partition-Disks-Primary-Debain10.jpg +[24]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Start-at-the-beginning-Debain10.jpg +[25]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-Ext4-Journaling-system-debain10.jpg +[26]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-swap-debain10.jpg +[27]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Done-setting-partition-debian10.jpg +[28]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Click-Free-space-Debain10.jpg +[29]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Automatically-partition-free-space-Debain10.jpg +[30]: https://www.linuxtechi.com/wp-content/uploads/2019/10/All-files-in-one-partition-debian10.jpg +[31]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Finish-partitioning-write-changes-to-disk.jpg +[32]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Write-changes-to-disk-Yes-Debian10.jpg +[33]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Scan-another-CD-No-Debain10.jpg +[34]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Debian-archive-mirror-country.jpg +[35]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-Debian-archive-mirror.jpg +[36]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Enter-proxy-details-debian10.jpg +[37]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Participate-in-survey-debain10.jpg +[38]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Software-selection-debian10.jpg +[39]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-grub-bootloader-debian10.jpg +[40]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Select-hard-drive-install-grub-Debian10.jpg +[41]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Installation-complete-reboot-debian10.jpg +[42]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Debian10-log-in.jpg +[43]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Debian10-Buster-Details.jpg From b42a411864d93cef87c03dda58557546025d82b3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Oct 2019 00:56:37 +0800 Subject: [PATCH 121/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20How=20?= =?UTF-8?q?to=20program=20with=20Bash:=20Loops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191023 How to program with Bash- Loops.md --- ...0191023 How to program with Bash- Loops.md | 352 ++++++++++++++++++ 1 file changed, 352 insertions(+) create mode 100644 sources/tech/20191023 How to program with Bash- Loops.md diff --git a/sources/tech/20191023 How to program with Bash- Loops.md b/sources/tech/20191023 How to program with Bash- Loops.md new file mode 100644 index 0000000000..b32748b397 --- /dev/null +++ b/sources/tech/20191023 How to program with Bash- Loops.md @@ -0,0 +1,352 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to program with Bash: Loops) +[#]: via: (https://opensource.com/article/19/10/programming-bash-part-3) +[#]: author: (David Both https://opensource.com/users/dboth) + +How to program with Bash: Loops +====== +Learn how to use loops for performing iterative operations, in the final +article in this three-part series on programming with Bash. +![arrows cycle symbol for failing faster][1] + +Bash is a powerful programming language, one perfectly designed for use on the command line and in shell scripts. This three-part series, based on my [three-volume Linux self-study course][2], explores using Bash as a programming language on the command-line interface (CLI). + +The [first article][3] in this series explored some simple command-line programming with Bash, including using variables and control operators. The [second article][4] looked into the types of file, string, numeric, and miscellaneous logical operators that provide execution-flow control logic and different types of shell expansions in Bash. This third (and final) article examines the use of loops for performing various types of iterative operations and ways to control those loops. + +### Loops + +Every programming language I have ever used has at least a couple types of loop structures that provide various capabilities to perform repetitive operations. I use the for loop quite often but I also find the while and until loops useful. + +#### for loops + +Bash's implementation of the **for** command is, in my opinion, a bit more flexible than most because it can handle non-numeric values; in contrast, for example, the standard C language **for** loop can deal only with numeric values. + +The basic structure of the Bash version of the **for** command is simple: + + +``` +`for Var in list1 ; do list2 ; done` +``` + +This translates to: "For each value in list1, set the **$Var** to that value and then perform the program statements in list2 using that value; when all of the values in list1 have been used, it is finished, so exit the loop." The values in list1 can be a simple, explicit string of values, or they can be the result of a command substitution (described in the second article in the series). I use this construct frequently. + +To try it, ensure that **~/testdir** is still the present working directory (PWD). Clean up the directory, then look at a trivial example of the **for** loop starting with an explicit list of values. This list is a mix of alphanumeric values—but do not forget that all variables are strings and can be treated as such. + + +``` +[student@studentvm1 testdir]$ rm * +[student@studentvm1 testdir]$ for I in a b c d 1 2 3 4 ; do echo $I ; done +a +b +c +d +1 +2 +3 +4 +``` + +Here is a bit more useful version with a more meaningful variable name: + + +``` +[student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Department $Dept" ; done +Department Human Resources +Department Sales +Department Finance +Department Information Technology +Department Engineering +Department Administration +Department Research +``` + +Make some directories (and show some progress information while doing so): + + +``` +[student@studentvm1 testdir]$ for Dept in "Human Resources" Sales Finance "Information Technology" Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done +Working on Department Human Resources +Working on Department Sales +Working on Department Finance +Working on Department Information Technology +Working on Department Engineering +Working on Department Administration +Working on Department Research +[student@studentvm1 testdir]$ ll +total 28 +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Administration +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Engineering +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Finance +drwxrwxr-x 2 student student 4096 Apr  8 15:45 'Human Resources' +drwxrwxr-x 2 student student 4096 Apr  8 15:45 'Information Technology' +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Research +drwxrwxr-x 2 student student 4096 Apr  8 15:45  Sales +``` + +The **$Dept** variable must be enclosed in quotes in the **mkdir** statement; otherwise, two-part department names (such as "Information Technology") will be treated as two separate departments. That highlights a best practice I like to follow: all file and directory names should be a single word. Although most modern operating systems can deal with spaces in names, it takes extra work for sysadmins to ensure that those special cases are considered in scripts and CLI programs. (They almost certainly should be considered, even if they're annoying because you never know what files you will have.) + +So, delete everything in **~/testdir**—again—and do this one more time: + + +``` +[student@studentvm1 testdir]$ rm -rf * ; ll +total 0 +[student@studentvm1 testdir]$ for Dept in Human-Resources Sales Finance Information-Technology Engineering Administration Research ; do echo "Working on Department $Dept" ; mkdir "$Dept"  ; done +Working on Department Human-Resources +Working on Department Sales +Working on Department Finance +Working on Department Information-Technology +Working on Department Engineering +Working on Department Administration +Working on Department Research +[student@studentvm1 testdir]$ ll +total 28 +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Administration +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Engineering +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Finance +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Human-Resources +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Information-Technology +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Research +drwxrwxr-x 2 student student 4096 Apr  8 15:52 Sales +``` + +Suppose someone asks for a list of all RPMs on a particular Linux computer and a short description of each. This happened to me when I worked for the State of North Carolina. Since open source was not "approved" for use by state agencies at that time, and I only used Linux on my desktop computer, the pointy-haired bosses (PHBs) needed a list of each piece of software that was installed on my computer so that they could "approve" an exception. + +How would you approach that? Here is one way, starting with the knowledge that the **rpm –qa** command provides a complete description of an RPM, including the two items the PHBs want: the software name and a brief summary. + +Build up to the final result one step at a time. First, list all RPMs: + + +``` +[student@studentvm1 testdir]$ rpm -qa +perl-HTTP-Message-6.18-3.fc29.noarch +perl-IO-1.39-427.fc29.x86_64 +perl-Math-Complex-1.59-429.fc29.noarch +lua-5.3.5-2.fc29.x86_64 +java-11-openjdk-headless-11.0.ea.28-2.fc29.x86_64 +util-linux-2.32.1-1.fc29.x86_64 +libreport-fedora-2.9.7-1.fc29.x86_64 +rpcbind-1.2.5-0.fc29.x86_64 +libsss_sudo-2.0.0-5.fc29.x86_64 +libfontenc-1.1.3-9.fc29.x86_64 +<snip> +``` + +Add the **sort** and **uniq** commands to sort the list and print the unique ones (since it's possible that some RPMs with identical names are installed): + + +``` +[student@studentvm1 testdir]$ rpm -qa | sort | uniq +a2ps-4.14-39.fc29.x86_64 +aajohan-comfortaa-fonts-3.001-3.fc29.noarch +abattis-cantarell-fonts-0.111-1.fc29.noarch +abiword-3.0.2-13.fc29.x86_64 +abrt-2.11.0-1.fc29.x86_64 +abrt-addon-ccpp-2.11.0-1.fc29.x86_64 +abrt-addon-coredump-helper-2.11.0-1.fc29.x86_64 +abrt-addon-kerneloops-2.11.0-1.fc29.x86_64 +abrt-addon-pstoreoops-2.11.0-1.fc29.x86_64 +abrt-addon-vmcore-2.11.0-1.fc29.x86_64 +<snip> +``` + +Since this gives the correct list of RPMs you want to look at, you can use this as the input list to a loop that will print all the details of each RPM: + + +``` +`[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done` +``` + +This code produces way more data than you want. Note that the loop is complete. The next step is to extract only the information the PHBs requested. So, add an **egrep** command, which is used to select **^Name** or **^Summary**. The carat (**^**) specifies the beginning of the line; thus, any line with Name or Summary at the beginning of the line is displayed. + + +``` +[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary" +Name        : a2ps +Summary     : Converts text and other types of files to PostScript +Name        : aajohan-comfortaa-fonts +Summary     : Modern style true type font +Name        : abattis-cantarell-fonts +Summary     : Humanist sans serif font +Name        : abiword +Summary     : Word processing program +Name        : abrt +Summary     : Automatic bug detection and reporting tool +<snip> +``` + +You can try **grep** instead of **egrep** in the command above, but it will not work. You could also pipe the output of this command through the **less** filter to explore the results. The final command sequence looks like this: + + +``` +`[student@studentvm1 testdir]$ for RPM in `rpm -qa | sort | uniq` ; do rpm -qi $RPM ; done | egrep -i "^Name|^Summary" > RPM-summary.txt` +``` + +This command-line program uses pipelines, redirection, and a **for** loop—all on a single line. It redirects the output of your little CLI program to a file that can be used in an email or as input for other purposes. + +This process of building up the program one step at a time allows you to see the results of each step and ensure that it is working as you expect and provides the desired results. + +From this exercise, the PHBs received a list of over 1,900 separate RPM packages. I seriously doubt that anyone read that list. But I gave them exactly what they asked for, and I never heard another word from them about it. + +### Other loops + +There are two more types of loop structures available in Bash: the **while** and **until** structures, which are very similar to each other in both syntax and function. The basic syntax of these loop structures is simple: + + +``` +`while [ expression ] ; do list ; done` +``` + +and + + +``` +`until [ expression ] ; do list ; done` +``` + +The logic of the first reads: "While the expression evaluates as true, execute the list of program statements. When the expression evaluates as false, exit from the loop." And the second: "Until the expression evaluates as true, execute the list of program statements. When the expression evaluates as true, exit from the loop." + +#### While loop + +The **while** loop is used to execute a series of program statements while (so long as) the logical expression evaluates as true. Your PWD should still be **~/testdir**. + +The simplest form of the **while** loop is one that runs forever. The following form uses the true statement to always generate a "true" return code. You could also use a simple "1"—and that would work just the same—but this illustrates the use of the true statement: + + +``` +[student@studentvm1 testdir]$ X=0 ; while [ true ] ; do echo $X ; X=$((X+1)) ; done | head +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +[student@studentvm1 testdir]$ +``` + +This CLI program should make more sense now that you have studied its parts. First, it sets **$X** to zero in case it has a value left over from a previous program or CLI command. Then, since the logical expression **[ true ]** always evaluates to 1, which is true, the list of program instructions between **do** and **done** is executed forever—or until you press **Ctrl+C** or otherwise send a signal 2 to the program. Those instructions are an arithmetic expansion that prints the current value of **$X** and then increments it by one. + +One of the tenets of [_The Linux Philosophy for Sysadmins_][5] is to strive for elegance, and one way to achieve elegance is simplicity. You can simplify this program by using the variable increment operator, **++**. In the first instance, the current value of the variable is printed, and then the variable is incremented. This is indicated by placing the **++** operator after the variable: + + +``` +[student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((X++)) ; done | head +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +``` + +Now delete **| head** from the end of the program and run it again. + +In this version, the variable is incremented before its value is printed. This is specified by placing the **++** operator before the variable. Can you see the difference? + + +``` +[student@studentvm1 ~]$ X=0 ; while [ true ] ; do echo $((++X)) ; done | head +1 +2 +3 +4 +5 +6 +7 +8 +9 +``` + +You have reduced two statements into a single one that prints the value of the variable and increments that value. There is also a decrement operator, **\--**. + +You need a method for stopping the loop at a specific number. To accomplish that, change the true expression to an actual numeric evaluation expression. Have the program loop to 5 and stop. In the example code below, you can see that **-le** is the logical numeric operator for "less than or equal to." This means: "So long as **$X** is less than or equal to 5, the loop will continue. When **$X** increments to 6, the loop terminates." + + +``` +[student@studentvm1 ~]$ X=0 ; while [ $X -le 5 ] ; do echo $((X++)) ; done +0 +1 +2 +3 +4 +5 +[student@studentvm1 ~]$ +``` + +#### Until loop + +The **until** command is very much like the **while** command. The difference is that it will continue to loop until the logical expression evaluates to "true." Look at the simplest form of this construct: + + +``` +[student@studentvm1 ~]$ X=0 ; until false  ; do echo $((X++)) ; done | head +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +[student@studentvm1 ~]$ +``` + +It uses a logical comparison to count to a specific value: + + +``` +[student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((X++)) ; done +0 +1 +2 +3 +4 +[student@studentvm1 ~]$ X=0 ; until [ $X -eq 5 ]  ; do echo $((++X)) ; done +1 +2 +3 +4 +5 +[student@studentvm1 ~]$ +``` + +### Summary + +This series has explored many powerful tools for building Bash command-line programs and shell scripts. But it has barely scratched the surface on the many interesting things you can do with Bash; the rest is up to you. + +I have discovered that the best way to learn Bash programming is to do it. Find a simple project that requires multiple Bash commands and make a CLI program out of them. Sysadmins do many tasks that lend themselves to CLI programming, so I am sure that you will easily find tasks to automate. + +Many years ago, despite being familiar with other shell languages and Perl, I made the decision to use Bash for all of my sysadmin automation tasks. I have discovered that—sometimes with a bit of searching—I have been able to use Bash to accomplish everything I need. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/programming-bash-part-3 + +作者:[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/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) +[2]: http://www.both.org/?page_id=1183 +[3]: https://opensource.com/article/19/10/programming-bash-part-1 +[4]: https://opensource.com/article/19/10/programming-bash-part-2 +[5]: https://www.apress.com/us/book/9781484237298 From b501090986ed6e9dfd4f6cb80c89cbc07573a2b3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Oct 2019 00:57:44 +0800 Subject: [PATCH 122/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20Buildi?= =?UTF-8?q?ng=20container=20images=20with=20the=20ansible-bender=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191023 Building container images with the ansible-bender tool.md --- ...ner images with the ansible-bender tool.md | 154 ++++++++++++++++++ 1 file changed, 154 insertions(+) create mode 100644 sources/tech/20191023 Building container images with the ansible-bender tool.md diff --git a/sources/tech/20191023 Building container images with the ansible-bender tool.md b/sources/tech/20191023 Building container images with the ansible-bender tool.md new file mode 100644 index 0000000000..02aa64607b --- /dev/null +++ b/sources/tech/20191023 Building container images with the ansible-bender tool.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building container images with the ansible-bender tool) +[#]: via: (https://opensource.com/article/19/10/building-container-images-ansible) +[#]: author: (Tomas Tomecek https://opensource.com/users/tomastomecek) + +Building container images with the ansible-bender tool +====== +Learn how to use Ansible to execute commands in a container. +![Blocks for building][1] + +Containers and [Ansible][2] blend together so nicely—from management and orchestration to provisioning and building. In this article, we'll focus on the building part. + +If you are familiar with Ansible, you know that you can write a series of tasks, and the **ansible-playbook** command will execute them for you. Did you know that you can also execute such commands in a container environment and get the same result as if you'd written a Dockerfile and run **podman build**. + +Here is an example: + + +``` +\- name: Serve our file using httpd +  hosts: all +  tasks: +  - name: Install httpd +    package: +      name: httpd +      state: installed +  - name: Copy our file to httpd’s webroot +    copy: +      src: our-file.txt +      dest: /var/www/html/ +``` + +You could execute this playbook locally on your web server or in a container, and it would work—as long as you remember to create the **our-file.txt** file first. + +But something is missing. You need to start (and configure) httpd in order for your file to be served. This is a difference between container builds and infrastructure provisioning: When building an image, you just prepare the content; running the container is a different task. On the other hand, you can attach metadata to the container image that tells the command to run by default. + +Here's where a tool would help. How about trying **ansible-bender**? + + +``` +`$ ansible-bender build the-playbook.yaml fedora:30 our-httpd` +``` + +This script uses the ansible-bender tool to execute the playbook against a Fedora 30 container image and names the resulting container image **our-httpd**. + +But when you run that container, it won't start httpd because it doesn't know how to do it. You can fix this by adding some metadata to the playbook: + + +``` +\- name: Serve our file using httpd +  hosts: all +  vars: +    ansible_bender: +      base_image: fedora:30 +      target_image: +        name: our-httpd +        cmd: httpd -DFOREGROUND +  tasks: +  - name: Install httpd +    package: +      name: httpd +      state: installed +  - name: Listen on all network interfaces. +    lineinfile:     +      path: /etc/httpd/conf/httpd.conf   +      regexp: '^Listen ' +      line: Listen 0.0.0.0:80   +  - name: Copy our file to httpd’s webroot +    copy: +      src: our-file.txt +      dest: /var/www/html +``` + +Now you can build the image (from here on, please run all the commands as root—currently, Buildah and Podman won't create dedicated networks for rootless containers): + + +``` +# ansible-bender build the-playbook.yaml +PLAY [Serve our file using httpd] **************************************************** +                                                                                                                                                                              +TASK [Gathering Facts] ***************************************************************     +ok: [our-httpd-20191004-131941266141-cont] + +TASK [Install httpd] ***************************************************************** +loaded from cache: 'f053578ed2d47581307e9ba3f64f4b4da945579a082c6f99bd797635e62befd0' +skipping: [our-httpd-20191004-131941266141-cont] + +TASK [Listen on all network interfaces.] ********************************************* +changed: [our-httpd-20191004-131941266141-cont] + +TASK [Copy our file to httpd’s webroot] ********************************************** +changed: [our-httpd-20191004-131941266141-cont] + +PLAY RECAP *************************************************************************** +our-httpd-20191004-131941266141-cont : ok=3    changed=2    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0 + +Getting image source signatures +Copying blob sha256:4650c04b851c62897e9c02c6041a0e3127f8253fafa3a09642552a8e77c044c8 +Copying blob sha256:87b740bba596291af8e9d6d91e30a01d5eba9dd815b55895b8705a2acc3a825e +Copying blob sha256:82c21252bd87532e93e77498e3767ac2617aa9e578e32e4de09e87156b9189a0 +Copying config sha256:44c6dc6dda1afe28892400c825de1c987c4641fd44fa5919a44cf0a94f58949f +Writing manifest to image destination +Storing signatures +44c6dc6dda1afe28892400c825de1c987c4641fd44fa5919a44cf0a94f58949f +Image 'our-httpd' was built successfully \o/ +``` + +The image is built, and it's time to run the container: + + +``` +# podman run our-httpd +AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.2.106. Set the 'ServerName' directive globally to suppress this message +``` + +Is your file being served? First, find out the IP of your container: + + +``` +# podman inspect -f '{{ .NetworkSettings.IPAddress }}' 7418570ba5a0 +10.88.2.106 +``` + +And now you can check: + + +``` +$ curl +Ansible is ❤ +``` + +What were the contents of your file? + +This was just an introduction to building container images with Ansible. If you want to learn more about what ansible-bender can do, please check it out on [GitHub][3]. Happy building! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/building-container-images-ansible + +作者:[Tomas Tomecek][a] +选题:[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/tomastomecek +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/blocks_building.png?itok=eMOT-ire (Blocks for building) +[2]: https://www.ansible.com/ +[3]: https://github.com/ansible-community/ansible-bender From c2ecabcb71c86635a830fe60f9418b907eb7731d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 24 Oct 2019 00:58:46 +0800 Subject: [PATCH 123/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20Best?= =?UTF-8?q?=20practices=20in=20test-driven=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191023 Best practices in test-driven development.md --- ...st practices in test-driven development.md | 206 ++++++++++++++++++ 1 file changed, 206 insertions(+) create mode 100644 sources/tech/20191023 Best practices in test-driven development.md diff --git a/sources/tech/20191023 Best practices in test-driven development.md b/sources/tech/20191023 Best practices in test-driven development.md new file mode 100644 index 0000000000..47f025a111 --- /dev/null +++ b/sources/tech/20191023 Best practices in test-driven development.md @@ -0,0 +1,206 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best practices in test-driven development) +[#]: via: (https://opensource.com/article/19/10/test-driven-development-best-practices) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +Best practices in test-driven development +====== +Ensure you're producing very high-quality code by following these TDD +best practices. +![magnifying glass on computer screen][1] + +In my previous series on [test-driven development (TDD) and mutation testing][2], I demonstrated the benefits of relying on examples when building a solution. That begs the question: What does "relying on examples" mean? + +In that series, I described one of my expectations when building a solution to determine whether it's daytime or nighttime. I provided an example of a specific hour of the day that I consider to fall in the daytime category. I created a **DateTime** variable named **dayHour** and gave it the specific value of **August 8, 2019, 7 hours, 0 minutes, 0 seconds**. + +My logic (or way of reasoning) was: "When the system is notified that the time is exactly 7am on August 8, 2019, I expect that the system will perform the necessary calculations and return the value **Daylight**." + +Armed with such a specific example, it was very easy to create a unit test (**Given7amReturnDaylight**). I then ran the tests and watched my unit test fail, which gave me the opportunity to work on fixing this early failure. + +### Iteration is the solution + +One very important aspect of TDD (and, by proxy, of agile) is the fact that it is impossible to arrive at an acceptable solution unless you are iterating. TDD is a professional discipline based on the process of relentless iterating. It is very important to note that it mandates that each iteration must begin with a micro-failure. That micro-failure has only one purpose: to solicit immediate feedback. And that immediate feedback ensures we can rapidly close the gap between _wanting_ a solution and _getting_ a solution. + +Iteration provides an opportunity to solicit immediate feedback by failing as early as possible. Because that failure is fast (i.e., it is a micro-failure), it is not alarming; even when we fail, we can remain calm, knowing that it will be easy to fix the failure. And the feedback from that failure will guide us toward fixing the failure. + +Rinse, repeat, until we completely close the gap and deliver the solution that fully meets the expectation (but keep in mind that the expectation must also be a micro-expectation). + +### Why micro? + +This approach often feels very unambitious. In TDD (and in agile), it's best to pick a tiny, almost trivial challenge, and then do the TDD song-and-dance by failing first, then iterating until we solve that trivial challenge. People who are used to more substantial, beefy engineering and problem solving tend to feel that such an exercise is beneath their level of competence. + +One of the cornerstones of agile philosophy relies on reducing the problem space to multiple, smallest-possible surface areas. As Robert C. Martin puts it: + +> _"Agile is a small idea about the small problems of small programming teams doing small things"_ + +But how can making an unimpressive series of such pedestrian, minuscule, and almost insignificant micro-victories ever enable us to reach the big-scale solution? + +Here is where sophisticated and elaborate systems thinking comes into play. When building a system, there's always the risk of ending up with a dreaded "monolith." A monolith is a system built on the principle of tight coupling. Any part of the monolith is highly dependent on many other parts of the same monolith. That arrangement makes the monolith very brittle, unreliable, and difficult to operate, maintain, troubleshoot, and fix. + +The only way to avoid this trap is to minimize or, better yet, completely remove coupling. Instead of investing heroic efforts into building elaborate parts that will be assembled into a system, it is much better to take humble, baby steps toward building tiny, micro parts. These micro parts have very little capability on their own, and will, by virtue of such arrangement, not be dependent on other components. This will minimize and even remove any coupling. + +The desired end game in building a useful, elaborate system is to compose it from a collection of generic, completely independent components. The more generic each component is, the more robust, resilient, and flexible the resulting system will be. Also, having a collection of generic components enables them to be repurposed to build brand new systems by reconfiguring those components. + +Consider a toy castle made out of Lego blocks. If we pick almost any block from that castle and examine it in isolation, we won't be able to find anything on that block that specifies it is a Lego block meant for building a castle. The block itself is sufficiently generic, which makes it suitable for building other contraptions, such as toy cars, toy airplanes, toy boats, etc. That's the power of having generic components. + +TDD is a proven discipline for delivering generic, independent, and autonomous components that can be safely used to assemble large, sophisticated systems expediently. As in agile, TDD is focused on micro-activities. And because agile is based on the fundamental principle known as "the Whole Team," the humble approach illustrated here is also important when specifying business examples. If the example used for building a component is not modest, it will be difficult to meet the expectations. Therefore, the expectations must be humble, which makes the resulting examples equally humble. + +For instance, if a member of the Whole Team (a requester) provides the developer with an expectation and an example that reads: + +> _"When processing an order, make sure to apply appropriate discount for orders made by loyal customers, or for orders over certain monetary value, or both."_ + +The developer should recognize that this example is too ambitious. That's not a humble expectation. It is not sufficiently micro, if you will. The developer should always strive to guide a requester in being more specific and micro-level when crafting examples. Paradoxically, the more specific the example, the more generic the resulting solution will be. + +A much better, more effective expectation and example would be: + +> _"Discount made for an order greater than $100.00 is $18.00."_ + +Or: + +> _"Discount made for an order greater than $100.00 that was made by a customer who already placed three orders is $25.00."_ + +Such micro-examples make it easy to turn them into automated micro-expectations (read: unit tests). Such expectations will make us fail, and then we will pick ourselves up and iterate until we deliver the solution—a robust, generic component that knows how to calculate discounts based on the micro-examples supplied by the Whole Team. + +### Writing quality unit tests + +Merely writing unit tests without any concern about their quality is a fool's errand. Shoddily written unit tests will result in bloated, tightly coupled code. Such code is brittle, difficult to reason about, and often nearly impossible to fix. + +We need to lay down some ground rules for writing quality unit tests. These ground rules will help us make swift progress in building robust, reliable solutions. The easiest way to do that is to introduce a mnemonic in the form of an acronym: **FIRST**, which says unit tests must be: + + * **F** = Fast + * **I** = Independent + * **R** = Repeatable + * **S** = Self-validating + * **T** = Thorough + + + +#### Fast + +Since a unit test describes a micro-example, it should expect very simple processing from the implemented code. This means that each unit test should be very fast to run. + +#### Independent + +Since a unit test describes a micro-example, it should describe a very simple process that does not depend on any other unit test. + +#### Repeatable + +Since a unit test does not depend on any other unit test, it must be fully repeatable. What that means is that each time a certain unit test runs, it produces the same results as the previous time it ran. Neither the number of times the unit tests run nor the order in which they run should ever affect the expected output. + +#### Self-validating + +When unit tests run, the outcome of the testing should be instantly visible. Developers should not be expected to reach for some other source(s) of information to find out whether their unit tests failed or passed. + +#### Thorough + +Unit tests should describe all the expectations as defined in the micro-examples. + +### Well-structured unit tests + +Unit tests are code. And the same as any other code, unit tests need to be well-structured. It is unacceptable to deliver sloppy, messy unit tests. All the principles that apply to the rules governing clean implementation code apply with equal force to unit tests. + +A time-tested and proven methodology for writing reliable quality code is based on the clean code principle known as **SOLID**. This acronym that helps us remember five very important principles: + + * **S** = Single responsibility principle + * **O** = Open–closed principle + * **L** = Liskov substitution principle + * **I** = Interface segregation principle + * **D** = Dependency inversion principle + + + +#### Single responsibility principle + +Each component must be responsible for performing only one operation. This principle is illustrated in this meme + +![Sign illustrating single-responsibility principle][3] + +Pumping septic tanks is an operation that must be kept separate from filling swimming pools. + +Applied to unit tests, this principle ensures that each unit test verifies one—and only one—expectation. From a technical standpoint, this means each unit test must have one and only one **Assert** statement. + +#### Open–closed principle + +This principle states that a component should be open for extensions, but closed for any modifications. + +![Open-closed principle][4] + +Applied to unit tests, this principle ensures that we will not implement a change to an existing unit test in that unit test. Instead, we must write a brand new unit test that will implement the changes. + +#### Liskov substitution principle + +This principle provides a guide for deciding which level of abstraction may be appropriate for the solution. + +![Liskov substitution principle][5] + +Applied to unit tests, this principle guides us to avoid tight coupling with dependencies that depend on the underlying computing environment (such as databases, disks, network, etc.). + +#### Interface segregation principle + +This principle reminds us not to bloat APIs. When subsystems need to collaborate to complete a task, they should communicate via interfaces. But those interfaces must not be bloated. If a new capability becomes necessary, don't add it to the already defined interface; instead, craft a brand new interface. + +![Interface segregation principle][6] + +Applied to unit tests, removing the bloat from interfaces helps us craft more specific unit tests, which, in turn, results in more generic components. + +#### Dependency inversion principle + +This principle states that we should control our dependencies, instead of dependencies controlling us. If there is a need to use another component's services, instead of being responsible for instantiating that component within the component we are building, it must instead be injected into our component. + +![Dependency inversion principle][7] + +Applied to the unit tests, this principle helps separate the intention from the implementation. We must strive to inject only those dependencies that have been sufficiently abstracted. That approach is important for ensuring unit tests are not mixed with integration tests. + +### Testing the tests + +Finally, even if we manage to produce well-structured unit tests that fulfill the FIRST principles, it does not guarantee that we have delivered a solid solution. TDD best practices rely on the proper sequence of events when building components/services; we are always and invariably expected to provide a description of our expectations (supplied in the micro-examples). Only after those expectations are described in the unit test can we move on to writing the implementation code. However, two unwanted side effects can, and often do, happen while writing implementation code: + + 1. Implemented code enables the unit tests to pass, but they are written in a convoluted way, using unnecessarily complex logic + 2. Implemented code gets tagged on AFTER the unit tests have been written + + + +In the first case, even if all unit tests pass, mutation testing uncovers that some mutants have survived. As I explained in _[Mutation testing by example: Evolving from fragile TDD][8]_, that is an extremely undesirable situation because it means that the solution is unnecessarily complex and, therefore, unmaintainable. + +In the second case, all unit tests are guaranteed to pass, but a potentially large portion of the codebase consists of implemented code that hasn't been described anywhere. This means we are dealing with mysterious code. In the best-case scenario, we could treat that mysterious code as deadwood and safely remove it. But more likely than not, removing this not-described, implemented code will cause some serious breakages. And such breakages indicate that our solution is not well engineered. + +### Conclusion + +TDD best practices stem from the time-tested methodology called [extreme programming][9] (XP for short). One of the cornerstones of XP is based on the **three C's**: + + 1. **Card:** A small card briefly specifies the intent (e.g., "Review customer request"). + 2. **Conversation:** The card becomes a ticket to conversation. The whole team gets together and talks about "Review customer request." What does that mean? Do we have enough information/knowledge to ship the "review customer request" functionality in this increment? If not, how do we further slice this card? + 3. **Concrete confirmation examples:** This includes all the specific values plugged in (e.g., concrete names, numeric values, specific dates, whatever else is pertinent to the use case) plus all values expected as an output of the processing. + + + +Starting from such micro-examples, we write unit tests. We watch unit tests fail, then make them pass. And while doing that, we observe and respect the best software engineering practices: the **FIRST** principles, the **SOLID** principles, and the mutation testing discipline (i.e., kill all surviving mutants). + +This ensures that our components and services are delivered with solid quality built in. And what is the measure of that quality? Simple—**the cost of change**. If the delivered code is costly to change, it is of shoddy quality. Very high-quality code is structured so well that it is simple and inexpensive to change and, at the same time, does not incur any change-management risks. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/test-driven-development-best-practices + +作者:[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/search_find_code_issue_bug_programming.png?itok=XPrh7fa0 (magnifying glass on computer screen) +[2]: https://opensource.com/users/alex-bunardzic +[3]: https://opensource.com/sites/default/files/uploads/single-responsibility.png (Sign illustrating single-responsibility principle) +[4]: https://opensource.com/sites/default/files/uploads/openclosed_cc.jpg (Open-closed principle) +[5]: https://opensource.com/sites/default/files/uploads/liskov_substitution_cc.jpg (Liskov substitution principle) +[6]: https://opensource.com/sites/default/files/uploads/interface_segregation_cc.jpg (Interface segregation principle) +[7]: https://opensource.com/sites/default/files/uploads/dependency_inversion_cc.jpg (Dependency inversion principle) +[8]: https://opensource.com/article/19/9/mutation-testing-example-definition +[9]: https://en.wikipedia.org/wiki/Extreme_programming From 84d5c4064219687102b207c7ff77d13308e1253d Mon Sep 17 00:00:00 2001 From: Chojan Shang Date: Thu, 24 Oct 2019 01:33:56 +0800 Subject: [PATCH 124/800] Add translator --- .../tech/20180708 Building a Messenger App- Conversations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20180708 Building a Messenger App- Conversations.md b/sources/tech/20180708 Building a Messenger App- Conversations.md index 6789d1d4a1..1a5c7d251a 100644 --- a/sources/tech/20180708 Building a Messenger App- Conversations.md +++ b/sources/tech/20180708 Building a Messenger App- Conversations.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (PsiACE) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -339,7 +339,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[PsiACE](https://github.com/PsiACE) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 71c0baf28d1036947d96444ef094ce1f252597bb Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 23 Oct 2019 23:11:05 +0200 Subject: [PATCH 125/800] Update 20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ...anage All Your Linux Games in One Place.md | 102 ++++++++---------- 1 file changed, 42 insertions(+), 60 deletions(-) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index 29a577824b..a80edde61f 100644 --- a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -7,120 +7,102 @@ [#]: via: (https://itsfoss.com/gamehub/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Use GameHub to Manage All Your Linux Games in One Place 用GameHub集中管理Linux上你的所有游戏 +用GameHub集中管理你Linux上的所有游戏 ====== -How do you [play games on Linux][1]? Let me guess. Either you install games from the software center or from Steam or from GOG or Humble Bundle etc, right? But, how do you plan to manage all your games from multiple launchers and clients? Well, that sounds like a hassle to me – which is why I was delighted when I come across [GameHub][2]. -你在Linux 上怎么[玩游戏呢][1]? 让我猜猜, 要不就是从软件中心安装游戏,要不就是选Steam,GOG, Humble Bundle 等平台,对吧?但是,你对多个游戏启动器和客户打算如何管理呢?好吧,对我来说这简直令人头疼 —— 这也是我发现[GameHub][2]之后,感到高兴的原因。 +你在Linux 上打算怎么[玩游戏呢][1]? 让我猜猜, 要不就是从软件中心直接安装,要不就选Steam,GOG, Humble Bundle 等平台,对吧?但是,如果你有多个游戏启动器和客户端,又要如何管理呢?好吧,对我来说这简直令人头疼 —— 这也是我发现[GameHub][2]这个应用之后,感到非常高兴的原因。 -GameHub is a desktop application for Linux distributions that lets you manage “All your games in one place”. That sounds interesting, isn’t it? Let me share more details about it. - -GameHub是为Linux发行版设计的一个桌面应用,它能“集中管理你的所有游戏”。这听起来很有趣,是不是?让我来具体说明一下。 +GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中管理你的所有游戏”。这听起来很有趣,是不是?下面让我来具体说明一下。 ![][3] -### GameHub Features to manage Linux games from different sources at one place +### GameHub Features to manage Linux games from different sources at one place -Let’s see all the features that make GameHub one of the [essential Linux applications][4], specially for gamers. -让我们来看看,尤其对玩家来说,让GameHub成为一个[不可或缺的Linux应用][4]的功能,都有哪些。 +让我们看看,对玩家来说,让GameHub成为一个[不可或缺的Linux应用][4]的功能,都有哪些。 #### Steam, GOG & Humble Bundle 支持 ![][5] -It supports Steam, [GOG][6], and [Humble Bundle][7] account integration. You can sign in to your account to see manager your library from within GameHub. - 它支持Steam, [GOG][6], 和 [Humble Bundle][7] 账户整合。你可以登录你的GameHub账号,从而在库管理器中管理所有游戏。 -For my usage, I have a lot of games on Steam and a couple on Humble Bundle. I can’t speak for all – but it is safe to assume that these are the major platforms one would want to have. -对我来说,我在Steam上有很多游戏,Humble Bundle上也有一些。我不能确保它能支持所有平台。但确信的是,主流平台是可以保证的。 +对我来说,我在Steam上有很多游戏,Humble Bundle上也有一些。我不能确保它支持所有平台。但可以确信的是,主流平台游戏是没有问题的。 -#### Native Game Support 本地游戏支持 +#### 本地游戏支持 ![][8] -There are several [websites where you can find and download Linux games][9]. You can also add native Linux games by downloading their installers or add the executable file. -很多网站都有专门推荐Linux游戏,并[支持下载][9]。你可以通过下载安装包,或者添加可执行文件加入本地游戏。 +有很多网站专门推荐Linux游戏,并[支持下载][9]。你可以通过下载安装包,或者添加可执行文件,从而管理本地游戏。 -Unfortunately, there’s no easy way of finding out games for Linux from within GameHub at the moment. So, you will have to download them separately and add it to the GameHub as shown in the image above. - -可惜的是,在GameHub上,无法在线搜索Linux游戏。如上图所示,你需要将各平台游戏分开下载,随后添加到自己的GameHub账号中。 +可惜的是,在GameHub内,无法在线搜索Linux游戏。如上图所示,你需要将各平台游戏分开下载,随后再添加到自己的GameHub账号中。 #### 模拟器支持 -With emulators, you can [play retro games on Linux][10]. As you can observe in the image above, you also get the ability to add emulators (and import emulated images). -在模拟器方面,你可以玩[Linux上的retro game][10]。正如上图所示,你可以添加模拟器(或者导入模拟器游戏)。 +在模拟器方面,你可以玩[Linux上的retro game][10]。正如上图所示,你可以添加模拟器(或导入模拟器镜像)。 -You can see [RetroArch][11] listed already but you can also add custom emulators as per your requirements. -你可以在[RetroArch][11]查看可添加的模拟器,但也能根据需求,自行添加模拟器。 +你可以在[RetroArch][11]查看可添加的模拟器,但也能根据需求,添加自定义模拟器。 #### 用户界面 ![Gamehub 界面选项][12] -Of course, the user experience matters. Hence, it is important to take a look at its user interface and what it offers. -当然,用户体验很重要。因此,探究下用户界面都有什么,是很重要的。 +当然,用户体验很重要。因此,探究下用户界面都有些什么,也很有必要。 -To me, I felt it very easy to use and the presence of a dark theme is a bonus. -我个人觉得,这一应用很容易使用,并且黑色主题是一个加分点。 +我个人觉得,这一应用很容易使用,并且黑色主题是一个加分项。 #### 手柄支持 -If you are comfortable using a controller with your Linux system to play games – you can easily add it, enable or disable it from the settings. -如果你习惯了在Linux系统上用手柄玩游戏 —— 你可以在设置中很轻松地添加,启用或禁用它。 +如果你习惯在Linux系统上用手柄玩游戏 —— 你可以轻松在设置里添加,启用或禁用它。 #### 多个数据提供商 -Just because it fetches the information (or metadata) of your games, it needs a source for that. You can see all the sources listed in the image below. -因为它需要获取你游戏的信息(或元数据),也就意味着需要数据源。你可以看到上图列表中显示的所有数据源。 + +因为它需要获取你的游戏信息(或元数据),也意味着它需要一个数据源。你可以看到上图列出的所有数据源。 ![Data Providers Gamehub][13] +这里你什么也不用做 —— 但如果你使用的是其他平台,而不是steam的话,你需要为[IDGB生成一个API密钥][14]。 -You don’t have to do anything here – but if you are using anything else other than steam as your platform, you can generate an [API key for IDGB.][14] - -这里你什么也不用做 —— 但如果你需要使用其他平台,而不是steam的话,你需要为[IDGB生成一个API密钥][14]。 - -I shall recommend you to do that only if you observe a prompt/notice within GameHub or if you have some games that do not have any description/pictures/stats on GameHub. -我建议你,只有在你看到GameHub上出现提示/或者通知时,或者你发现在GameHub上,有些游戏没有任何描述/图片/状态时,再这么做。 +我建议你,只有在你看到GameHub上出现提示/通知时,或你发现在GameHub上,有些游戏没有任何描述/图片/状态时,再这么做。 #### 兼容性选项 ![][15] -Do you have a game that does not support Linux? 你有不支持在Linux上运行的游戏吗? -You do not have to worry. GameHub offers multiple compatibility layers like Wine/Proton which you can use to get the game installed in order to make it playable. -你不需要太担心。GameHub上提供了 -We can’t be really sure on what works for you – so you have to test it yourself for that matter. Nevertheless, it is an important feature that could come handy for a lot of gamers. +你不需要担心。GameHub上提供了多种兼容工具,如 Wine/Proton,你可以利用它们让游戏得以运行。 -### How Do You Manage Your Games in GameHub? +我们无法确定具体哪个兼容工具适用于你 —— 所以你需要自己亲自测试。 然而,对许多游戏玩家来说,这的确是个很有用的功能。 -You get the option to add Steam/GOG/Humble Bundle account right after you launch it. +### 如何在GameHub上管理你的游戏? + +在启动程序后,你可以将自己的Steam/GOG/Humble Bundle 账号添加进来。 + +对于Steam, 你需要在Linux 发行版上安装Steam 客户端。一旦安装完成,你可以轻松将账号中的游戏导入GameHub. -For Steam, you need to have the Steam client installed on your Linux distro. Once, you have it, you can easily link the games to GameHub. ![][16] -For GOG & Humble Bundle, you can directly sign in using your credentials to get your games organized in GameHub. +对于GOG & Humble Bundle, 只要登录就能直接在GameHub上管理你的游戏了。 -If you are adding an emulated image or a native installer, you can always do that by clicking on the “**+**” button that you observe in the top-right corner of the window. +如果你想添加模拟器或者本地安装文件,只要点击窗口右上角的 “**+**” 按钮就可以了。 -### How Do You Install Games? -For Steam games, it automatically launches the Steam client to download/install (I wish if this was possible without launching Steam!) +### 如何安装游戏? + +对于Steam游戏,它会自动启动Steam 客户端,从而下载/安装游戏(我希望之后安装游戏,可以不用启动Steam!) ![][17] -But, for GOG/Humble Bundle, you can directly start downloading to install the games after signing in. If necessary, you can utilize the compatibility layer for non-native Linux games. +但是,对于GOG/Humble Bundle, 登录后就能直接下载安装游戏了。必要的话,对于那些不支持在Linux运行的游戏,你可以使用兼容工具。 -In either case, if you want to install an emulated game or a native game – just add the installer or import the emulated image. There’s nothing more to it. +无论是安装模拟器游戏或者本地游戏,你只要添加安装包或者导入模拟器镜像就可以了。这里没什么其他步骤要做。 -### GameHub: How do you install it? +### GameHub: 如何安装它呢? ![][18] -To start with, you can just search for it in your software center or app center. It is available in the **Pop!_Shop**. So, it can be found in most of the official repositories. +首先,你可以直接在你的软件中心或者应用商店内搜索。 它在 **Pop!_Shop** 分类下可见。所以,它在绝大多数官方源中都能找到。 -If you don’t find it there, you can always add the repository and install it via terminal by typing these commands: +如果你在这些地方都没有找到,你可以手动添加源,并从终端上安装它,你需要输入以下命令: ``` sudo add-apt-repository ppa:tkashkin/gamehub @@ -128,21 +110,21 @@ sudo apt update sudo apt install com.github.tkashkin.gamehub ``` -In case you encounter “**add-apt-repository command not found**” error, you can take a look at our article to help fix [add-apt-repository not found error.][19] +如果你遇到了 “**add-apt-repository command not found**” 这个错误,你可以看看我们这篇文章,[add-apt-repository not found error.][19] 来帮你解决问题。 -There are also AppImage and Flatpak versions available. You can find installation instructions for other Linux distros on its [official webpage][2]. +这里还提供AppImage 和 FlatPak版本。 在[官网][2] 上,你可以针对找到其他Linux发行版的安装手册。 -Also, you have the option to download pre-release packages from its [GitHub page][20]. +同时,你还可以从它的 [GitHub页面][20]下载之前版本的安装包. [GameHub][2] -**Wrapping Up** +**注意** -GameHub is a pretty neat application as a unified library for all your games. The user interface is intuitive and so are the options. +GameHub 是相当灵活的一个集中游戏管理应用。 用户界面和选项设置也相当直观。 -Have you had the chance it test it out before? If yes, let us know your experience in the comments down below. +你之前有没有使用过这一应用呢?如果有,在下面的评论里写下你的体验。 -Also, feel free to tell us about some of your favorite tools/applications similar to this which you would want us to try. +而且,如果你想让尝试一些与此功能相似的工具/应用,请务必告诉我们。 -------------------------------------------------------------------------------- From ddaa4286c030cbad32cdb38ecff8321e259efbf3 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 23 Oct 2019 23:15:23 +0200 Subject: [PATCH 126/800] Update 20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ...Use GameHub to Manage All Your Linux Games in One Place.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index a80edde61f..7660a5eabb 100644 --- a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -15,7 +15,7 @@ GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中管理你的所有游戏”。这听起来很有趣,是不是?下面让我来具体说明一下。 ![][3] -### GameHub Features to manage Linux games from different sources at one place +### 集中管理不同平台Linux游戏的GameHub功能 让我们看看,对玩家来说,让GameHub成为一个[不可或缺的Linux应用][4]的功能,都有哪些。 @@ -60,7 +60,7 @@ GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中 这里你什么也不用做 —— 但如果你使用的是其他平台,而不是steam的话,你需要为[IDGB生成一个API密钥][14]。 -我建议你,只有在你看到GameHub上出现提示/通知时,或你发现在GameHub上,有些游戏没有任何描述/图片/状态时,再这么做。 +我建议只有出现提示/通知,或有些游戏在GameHub上没有任何描述/图片/状态时,再这么做。 #### 兼容性选项 From 58ecfe8a0d45a9c564a4896b63e5a3581b9b90d4 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 23 Oct 2019 23:16:05 +0200 Subject: [PATCH 127/800] Update 20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ...5 Use GameHub to Manage All Your Linux Games in One Place.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index 7660a5eabb..b2052cc221 100644 --- a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -68,7 +68,7 @@ GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中 你有不支持在Linux上运行的游戏吗? -你不需要担心。GameHub上提供了多种兼容工具,如 Wine/Proton,你可以利用它们让游戏得以运行。 +不用担心,GameHub上提供了多种兼容工具,如 Wine/Proton,你可以利用它们让游戏得以运行。 我们无法确定具体哪个兼容工具适用于你 —— 所以你需要自己亲自测试。 然而,对许多游戏玩家来说,这的确是个很有用的功能。 From 46a9b07313e363475e6e86e4a3c60cfd91b56dd1 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 23 Oct 2019 23:21:23 +0200 Subject: [PATCH 128/800] Update 20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ... to Manage All Your Linux Games in One Place.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index b2052cc221..62f006fd95 100644 --- a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -81,9 +81,9 @@ GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中 ![][16] -对于GOG & Humble Bundle, 只要登录就能直接在GameHub上管理你的游戏了。 +对于GOG & Humble Bundle, 登录后,就能直接在GameHub上管理游戏了。 -如果你想添加模拟器或者本地安装文件,只要点击窗口右上角的 “**+**” 按钮就可以了。 +如果你想添加模拟器或者本地安装文件,点击窗口右上角的 “**+**” 按钮进行添加。 ### 如何安装游戏? @@ -92,9 +92,9 @@ GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中 ![][17] -但是,对于GOG/Humble Bundle, 登录后就能直接下载安装游戏了。必要的话,对于那些不支持在Linux运行的游戏,你可以使用兼容工具。 +但对于GOG/Humble Bundle, 登录后就能直接、下载安装游戏。必要的话,对于那些不支持在Linux上运行的游戏,你可以使用兼容工具。 -无论是安装模拟器游戏或者本地游戏,你只要添加安装包或者导入模拟器镜像就可以了。这里没什么其他步骤要做。 +无论安装模拟器游戏还是本地游戏,只需添加安装包或导入模拟器镜像。这里没什么其他步骤要做。 ### GameHub: 如何安装它呢? @@ -110,7 +110,7 @@ sudo apt update sudo apt install com.github.tkashkin.gamehub ``` -如果你遇到了 “**add-apt-repository command not found**” 这个错误,你可以看看我们这篇文章,[add-apt-repository not found error.][19] 来帮你解决问题。 +如果你遇到了 “**add-apt-repository command not found**” 这个错误,你可以看看,[add-apt-repository not found error.][19]这篇文章,它能帮你解决这一问题。 这里还提供AppImage 和 FlatPak版本。 在[官网][2] 上,你可以针对找到其他Linux发行版的安装手册。 @@ -122,9 +122,9 @@ sudo apt install com.github.tkashkin.gamehub GameHub 是相当灵活的一个集中游戏管理应用。 用户界面和选项设置也相当直观。 -你之前有没有使用过这一应用呢?如果有,在下面的评论里写下你的体验。 +你之前是否使用过这一应用呢?如果有,请在评论里写下你的感受。 -而且,如果你想让尝试一些与此功能相似的工具/应用,请务必告诉我们。 +而且,如果你想尝试一些与此功能相似的工具/应用,请务必告诉我们。 -------------------------------------------------------------------------------- From 5b6e6369e203e83238508bdff8ea734730fb36a3 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 23 Oct 2019 23:23:54 +0200 Subject: [PATCH 129/800] Update 20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ...Use GameHub to Manage All Your Linux Games in One Place.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index 62f006fd95..383cebb174 100644 --- a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -94,13 +94,13 @@ GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中 但对于GOG/Humble Bundle, 登录后就能直接、下载安装游戏。必要的话,对于那些不支持在Linux上运行的游戏,你可以使用兼容工具。 -无论安装模拟器游戏还是本地游戏,只需添加安装包或导入模拟器镜像。这里没什么其他步骤要做。 +无论是模拟器游戏,还是本地游戏,只需添加安装包或导入模拟器镜像就可以了。这里没什么其他步骤要做。 ### GameHub: 如何安装它呢? ![][18] -首先,你可以直接在你的软件中心或者应用商店内搜索。 它在 **Pop!_Shop** 分类下可见。所以,它在绝大多数官方源中都能找到。 +首先,你可以直接在软件中心或者应用商店内搜索。 它在 **Pop!_Shop** 分类下可见。所以,它在绝大多数官方源中都能找到。 如果你在这些地方都没有找到,你可以手动添加源,并从终端上安装它,你需要输入以下命令: From bd1270fc10a0128f4b04deaaf83fcfc1b5f94d9c Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 23 Oct 2019 23:24:51 +0200 Subject: [PATCH 130/800] Rename sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md to translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md --- ...005 Use GameHub to Manage All Your Linux Games in One Place.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md (100%) diff --git a/sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md similarity index 100% rename from sources/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md rename to translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md From cf6c3a06f1e0339a91f37bd69f0163dc59cf60ff Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 23 Oct 2019 23:30:03 +0200 Subject: [PATCH 131/800] Update 20191017 Using multitail on Linux.md --- sources/tech/20191017 Using multitail on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191017 Using multitail on Linux.md b/sources/tech/20191017 Using multitail on Linux.md index b89ef375d2..3b6fc7ca78 100644 --- a/sources/tech/20191017 Using multitail on Linux.md +++ b/sources/tech/20191017 Using multitail on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wenwensnow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b4239d29e22445b11f9b6b9b70b36d8a985147bc Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Oct 2019 08:51:07 +0800 Subject: [PATCH 132/800] translated --- ...ure Rsyslog Server in CentOS 8 - RHEL 8.md | 210 ------------------ ...ure Rsyslog Server in CentOS 8 - RHEL 8.md | 207 +++++++++++++++++ 2 files changed, 207 insertions(+), 210 deletions(-) delete mode 100644 sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md create mode 100644 translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md diff --git a/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md b/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md deleted file mode 100644 index 38b8dd2dc7..0000000000 --- a/sources/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md +++ /dev/null @@ -1,210 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Configure Rsyslog Server in CentOS 8 / RHEL 8) -[#]: via: (https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/) -[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) - -How to Configure Rsyslog Server in CentOS 8 / RHEL 8 -====== - -**Rsyslog** is a free and opensource logging utility that exists by default on  **CentOS** 8 and **RHEL** 8 systems. It provides an easy and effective way of **centralizing logs** from client nodes to a single central server. The centralization of logs is beneficial in two ways. First,  it simplifies viewing of logs as the Systems administrator can view all the logs of remote servers from a central point without logging into every client system to check the logs. This is greatly beneficial if there are several servers that need to be monitored and secondly, in the event that a remote client suffers a crash, you need not worry about losing the logs because all the logs will be saved on the **central rsyslog server**. Rsyslog has replaced syslog which only supported **UDP** protocol. It extends the basic syslog protocol with superior features such as support for both **UDP** and **TCP** protocols in transporting logs, augmented filtering abilities, and flexible configuration options. That said, let’s explore how to configure the Rsyslog server in CentOS 8 / RHEL 8 systems. - -[![configure-rsyslog-centos8-rhel8][1]][2] - -### Prerequisites - -We are going to have the following lab setup to test the centralized logging process: - - * **Rsyslog server**       CentOS 8 Minimal    IP address: 10.128.0.47 - * **Client system**         RHEL 8 Minimal      IP address: 10.128.0.48 - - - -From the setup above, we will demonstrate how you can set up the Rsyslog server and later configure the client system to ship logs to the Rsyslog server for monitoring. - -Let’s get started! - -### Configuring the Rsyslog Server on CentOS 8 - -By default, Rsyslog comes installed on CentOS 8 / RHEL 8 servers. To verify the status of Rsyslog, log in via SSH and issue the command: - -``` -$ systemctl status rsyslog -``` - -Sample Output - -![rsyslog-service-status-centos8][1] - -If rsyslog is not present for whatever reason, you can install it using the command: - -``` -$ sudo yum install rsyslog -``` - -Next, you need to modify a few settings in the Rsyslog configuration file. Open the configuration file. - -``` -$ sudo vim /etc/rsyslog.conf -``` - -Scroll and uncomment the lines shown below to allow reception of logs via UDP protocol - -``` -module(load="imudp") # needs to be done just once -input(type="imudp" port="514") -``` - -![rsyslog-conf-centos8-rhel8][1] - -Similarly, if you prefer to enable TCP rsyslog reception uncomment the lines: - -``` -module(load="imtcp") # needs to be done just once -input(type="imtcp" port="514") -``` - -![rsyslog-conf-tcp-centos8-rhel8][1] - -Save and exit the configuration file. - -To receive the logs from the client system,  we need to open Rsyslog default port 514 on the firewall. To achieve this, run - -``` -# sudo firewall-cmd --add-port=514/tcp --zone=public --permanent -``` - -Next, reload the firewall to save the changes - -``` -# sudo firewall-cmd --reload -``` - -Sample Output - -![firewall-ports-rsyslog-centos8][1] - -Next, restart Rsyslog server - -``` -$ sudo systemctl restart rsyslog -``` - -To enable Rsyslog on boot, run beneath command - -``` -$ sudo systemctl enable rsyslog -``` - -To confirm that the Rsyslog server is listening on port 514, use the netstat command as follows: - -``` -$ sudo netstat -pnltu -``` - -Sample Output - -![netstat-rsyslog-port-centos8][1] - -Perfect! we have successfully configured our Rsyslog server to receive logs from the client system. - -To view log messages in real-time run the command: - -``` -$ tail -f /var/log/messages -``` - -Let’s now configure the client system. - -### Configuring the client system on RHEL 8 - -Like the Rsyslog server, log in and check if the rsyslog daemon is running by issuing the command: - -``` -$ sudo systemctl status rsyslog -``` - -Sample Output - -![client-rsyslog-service-rhel8][1] - -Next, proceed to open the rsyslog configuration file - -``` -$ sudo vim /etc/rsyslog.conf -``` - -At the end of the file, append the following line - -``` -*.* @10.128.0.47:514 # Use @ for UDP protocol -*.* @@10.128.0.47:514 # Use @@ for TCP protocol -``` - -Save and exit the configuration file. Just like the Rsyslog Server, open port 514 which is the default Rsyslog port on the firewall - -``` -$ sudo firewall-cmd --add-port=514/tcp --zone=public --permanent -``` - -Next, reload the firewall to save the changes - -``` -$ sudo firewall-cmd --reload -``` - -Next,  restart the rsyslog service - -``` -$ sudo systemctl restart rsyslog -``` - -To enable Rsyslog on boot, run following command - -``` -$ sudo systemctl enable rsyslog -``` - -### Testing the logging operation - -Having successfully set up and configured Rsyslog Server and client system, it’s time to verify of your configuration is working as intended. - -On the client system issue the command: - -``` -# logger "Hello guys! This is our first log" -``` - -Now head out to the Rsyslog server and run the command below to check the logs messages in real-time - -``` -# tail -f /var/log/messages -``` - -The output from the command run on the client system should register on the Rsyslog server’s log messages to imply that the  Rsyslog server is now receiving logs from the client system. - -![centralize-logs-rsyslogs-centos8][1] - -And that’s it, guys! We have successfully setup the Rsyslog server to receive log messages from a client system. - -Read Also: **[How to Setup Multi Node Elastic Stack Cluster on RHEL 8 / CentOS 8][3]** - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/ - -作者:[James Kiarie][a] -选题:[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/james/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/configure-rsyslog-centos8-rhel8.jpg -[3]: https://www.linuxtechi.com/setup-multinode-elastic-stack-cluster-rhel8-centos8/ diff --git a/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md b/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..370c68d163 --- /dev/null +++ b/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md @@ -0,0 +1,207 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Configure Rsyslog Server in CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +如何在 CentOS 8 / RHEL 8 中配置 Rsyslog 服务器 +====== + +**Rsyslog** 是一个免费的开源日志记录程序,默认下在 **CentOS** 8 和 **RHEL** 8 系统上存在。它提供了一种从客户端节点到单个中央服务器的“集中日志”的简单有效的方法。日志集中化有两个好处。首先,它简化了日志查看,因为系统管理员可以在一个中心节点查看远程服务器的所有日志,而无需登录每个客户端系统来检查日志。如果需要监视多台服务器,这将非常有用,其次,如果远程客户端崩溃,你不用担心丢失日志,因为所有日志都将保存在**中央 rsyslog 服务器上**。Rsyslog 取代了仅支持 **UDP** 协议的 syslog。它以优异的功能扩展了基本的 syslog 协议,例如在传输日志时支持 **UDP** 和 **TCP**协议,增强的过滤功能以及灵活的配置选项。让我们来探讨如何在 CentOS 8 / RHEL 8 系统中配置 Rsyslog 服务器。 + +[![configure-rsyslog-centos8-rhel8][1]][2] + +### 预先条件 + +我们将搭建以下实验环境来测试集中式日志记录过程: + + * **Rsyslog 服务器**       CentOS 8 Minimal    IP 地址: 10.128.0.47 + * **客户端系统**         RHEL 8 Minimal      IP 地址: 10.128.0.48 + + + +通过上面的设置,我们将演示如何设置 Rsyslog 服务器,然后配置客户端系统以将日志发送到 Rsyslog 服务器进行监视。 + +让我们开始! + +### 在 CentOS 8 上配置 Rsyslog 服务器 + +默认情况下,Rsyslog 已安装在 CentOS 8 / RHEL 8 服务器上。要验证 Rsyslog 的状态,请通过 SSH 登录并运行以下命令: + +``` +$ systemctl status rsyslog +``` + +示例输出 + +![rsyslog-service-status-centos8][1] + +如果由于某种原因不存在 rsyslog,那么可以使用以下命令进行安装: + +``` +$ sudo yum install rsyslog +``` + +接下来,你需要修改 Rsyslog 配置文件中的一些设置。打开配置文件。 + +``` +$ sudo vim /etc/rsyslog.conf +``` + +滚动并取消注释下面的行,以允许通过 UDP 协议接收日志 + +``` +module(load="imudp") # needs to be done just once +input(type="imudp" port="514") +``` + +![rsyslog-conf-centos8-rhel8][1] + +同样,如果你希望启用 TCP rsyslog 接收,请取消注释下面的行: + +``` +module(load="imtcp") # needs to be done just once +input(type="imtcp" port="514") +``` + +![rsyslog-conf-tcp-centos8-rhel8][1] + +保存并退出配置文件。 + +要从客户端系统接收日志,我们需要在防火墙上打开 Rsyslog 默认端口 514。为此,请运行 + +``` +# sudo firewall-cmd --add-port=514/tcp --zone=public --permanent +``` + +接下来,重新加载防火墙保存更改 + +``` +# sudo firewall-cmd --reload +``` + +示例输出 + +![firewall-ports-rsyslog-centos8][1] + +接下来,重启 Rsyslog 服务器 + +``` +$ sudo systemctl restart rsyslog +``` + +要在启动时运行 Rsyslog,运行以下命令 + +``` +$ sudo systemctl enable rsyslog +``` + +要确认 Rsyslog 服务器正在监听 514 端口,请使用 netstat 命令,如下所示: + +``` +$ sudo netstat -pnltu +``` + +示例输出 + +![netstat-rsyslog-port-centos8][1] + +完美!我们已经成功配置了 Rsyslog 服务器来从客户端系统接收日志。 + +要实时查看日志消息,请运行以下命令: + +``` +$ tail -f /var/log/messages +``` + +现在开始配置客户端系统。 + +### 在 RHEL 8 上配置客户端系统 + +与 Rsyslog 服务器一样,登录并通过以下命令检查 rsyslog 守护进程是否正在运行: + +``` +$ sudo systemctl status rsyslog +``` + +示例输出 + +![client-rsyslog-service-rhel8][1] + +接下来,打开 rsyslog 配置文件 + +``` +$ sudo vim /etc/rsyslog.conf +``` + +在文件末尾,添加以下行 + +``` +*.* @10.128.0.47:514 # Use @ for UDP protocol +*.* @@10.128.0.47:514 # Use @@ for TCP protocol +``` + +保存并退出配置文件。就像 Rsyslog 服务器一样,打开 514 端口,这是防火墙上的默认 Rsyslog 端口。 + +``` +$ sudo firewall-cmd --add-port=514/tcp --zone=public --permanent +``` + +接下来,重新加载防火墙以保存更改 + +``` +$ sudo firewall-cmd --reload +``` + +接下来,重启 rsyslog 服务 + +``` +$ sudo systemctl restart rsyslog +``` + +要在启动时运行 Rsyslog,请运行以下命令 + +``` +$ sudo systemctl enable rsyslog +``` + +### 测试日志记录操作 + +已经成功安装并配置 Rsyslog 服务器和客户端后,就该验证你的配置是否按预期运行了。 + +在客户端系统上,运行以下命令: + +``` +# logger "Hello guys! This is our first log" +``` + +现在进入 Rsyslog 服务器并运行以下命令来实时查看日志消息 + +``` +# tail -f /var/log/messages +``` + +客户端系统上命令运行的输出显示在了 Rsyslog 服务器的日志中,这意味着 Rsyslog 服务器正在接收来自客户端系统的日志。 + +![centralize-logs-rsyslogs-centos8][1] + +就是这些了!我们成功设置了 Rsyslog 服务器来接收来自客户端系统的日志信息。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/ + +作者:[James Kiarie][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.linuxtechi.com/author/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/configure-rsyslog-centos8-rhel8.jpg \ No newline at end of file From 05c5dfd1b5e096bfc6396b6267a5beb2f317f661 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 24 Oct 2019 08:58:41 +0800 Subject: [PATCH 133/800] translating --- sources/tech/20191023 Using SSH port forwarding on Fedora.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191023 Using SSH port forwarding on Fedora.md b/sources/tech/20191023 Using SSH port forwarding on Fedora.md index 5b5dc4ef38..5bf45983d2 100644 --- a/sources/tech/20191023 Using SSH port forwarding on Fedora.md +++ b/sources/tech/20191023 Using SSH port forwarding on Fedora.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0468d6fb49d39631c1350eada5fc89afb14b4547 Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Thu, 24 Oct 2019 11:35:18 +0800 Subject: [PATCH 134/800] translated --- ...to Get the Size of a Directory in Linux.md | 59 +++++++++---------- 1 file changed, 29 insertions(+), 30 deletions(-) rename {sources => translated}/tech/20191022 How to Get the Size of a Directory in Linux.md (71%) diff --git a/sources/tech/20191022 How to Get the Size of a Directory in Linux.md b/translated/tech/20191022 How to Get the Size of a Directory in Linux.md similarity index 71% rename from sources/tech/20191022 How to Get the Size of a Directory in Linux.md rename to translated/tech/20191022 How to Get the Size of a Directory in Linux.md index 1df903a85e..2c05b4a8b6 100644 --- a/sources/tech/20191022 How to Get the Size of a Directory in Linux.md +++ b/translated/tech/20191022 How to Get the Size of a Directory in Linux.md @@ -7,28 +7,28 @@ [#]: via: (https://www.2daygeek.com/find-get-size-of-directory-folder-linux-disk-usage-du-command/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -How to Get the Size of a Directory in Linux +如何获取 Linux 中的目录大小 ====== -You may have noticed that the size of a directory is showing only 4KB when you use the **[ls command][1]** to list the directory content in Linux. +你应该已经注意用到,在 Linux 中使用 **[ls 命令][1]** 列出的目录内容中,目录的大小仅显示 4KB。 -Is this the right size? If not, what is it, and how to get a directory or folder size in Linux? +这个大小正确吗?如果不正确,那它代表什么,又该如何获取 Linux 中的目录或文件夹大小? -This is the default size, which is used to store the meta information of the directory on the disk. +这是一个默认的大小,用来存储磁盘上存储目录的元数据。 -There are some applications on Linux to **[get the actual size of a directory][2]**. +Linux 上有一些应用程序可以 **[获取目录的实际大小][2]**. -But the disk usage (du) command is widely used by the Linux administrator. +但是,磁盘使用率(du)命令已被 Linux 管理员广泛使用。 -I will show you how to get folder size with various options. +我将向您展示如何使用各种选项获取文件夹大小。 -### What’s du Command? +### 什么是 du 命令? -**[du command][3]** stands for `Disk Usage`. It’s a standard Unix program which used to estimate file space usage in present working directory. +**[du 命令][3]** 表示 Disk Usage磁盘使用率。这是一个标准的 Unix 程序,用于估计当前工作目录中的文件空间使用情况。 -It summarize disk usage recursively to get a directory and its sub-directory size. +它使用递归方式总结磁盘使用情况,以获取目录及其子目录的大小。 -As I said, the directory size only shows 4KB when you use the ls command. See the below output. +如同我说的那样, 使用 ls 命令时,目录大小仅显示 4KB。参见下面的输出。 ``` $ ls -lh | grep ^d @@ -40,9 +40,9 @@ drwxr-xr-x 13 daygeek daygeek 4.0K Jan 6 2019 drive-mageshm drwxr-xr-x 15 daygeek daygeek 4.0K Sep 29 21:32 Thanu_Photos ``` -### 1) How to Check Only the Size of the Parent Directory on Linux +### 1) 在 Linux 上如何只获取父目录的大小 -Use the below du command format to get the total size of a given directory. In this example, we are going to get the total size of the **“/home/daygeek/Documents”** directory. +使用以下 du 命令格式获取给定目录的总大小。在该示例中,我们将得到 **“/home/daygeek/Documents”** 目录的总大小 ``` $ du -hs /home/daygeek/Documents @@ -52,20 +52,19 @@ $ du -h --max-depth=0 /home/daygeek/Documents/ 20G /home/daygeek/Documents ``` -**Details**: +**详细说明**: - * du – It is a command - * h – Print sizes in human readable format (e.g., 1K 234M 2G) - * s – Display only a total for each argument - * –max-depth=N – Print levels of directory + * du – 这是一个命令 + * h – 以人类可读的格式显示大小 (例如 1K 234M 2G) + * s – 仅显示每个参数的总数 + * –max-depth=N – 目录的打印级别 +### 2) 在 Linux 上如何获取每个目录的大小 -### 2) How to Get the Size of Each Directory on Linux +使用以下 du 命令格式获取每个目录(包括子目录)的总大小。 -Use the below du command format to get the total size of each directory, including sub-directories. - -In this example, we are going to get the total size of each **“/home/daygeek/Documents”** directory and it’s sub-directories. +在该示例中,我们将获得每个 **“/home/daygeek/Documents”** 目录及其子目录的总大小。 ``` $ du -h /home/daygeek/Documents/ | sort -rh | head -20 @@ -92,9 +91,9 @@ $ du -h /home/daygeek/Documents/ | sort -rh | head -20 150M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Nov-2016 ``` -### 3) How to Get a Summary of Each Directory on Linux +### 3) 在 Linux 上如何获取每个目录的摘要 -Use the below du command format to get only the summary for each directory. +使用如下 du 命令格式仅获取每个目录的摘要。 ``` $ du -hs /home/daygeek/Documents/* | sort -rh | head -10 @@ -111,9 +110,9 @@ $ du -hs /home/daygeek/Documents/* | sort -rh | head -10 96K /home/daygeek/Documents/distro-info.xlsx ``` -### 4) How to Display the Size of Each Directory and Exclude Sub-Directories on Linux +### 4) 在 Linux 上如何获取每个目录的不含子目录的大小 -Use the below du command format to display the total size of each directory, excluding subdirectories. +使用如下 du 命令格式来展示每个目录的总大小,不包括子目录。 ``` $ du -hS /home/daygeek/Documents/ | sort -rh | head -20 @@ -140,9 +139,9 @@ $ du -hS /home/daygeek/Documents/ | sort -rh | head -20 90M /home/daygeek/Documents/drive-2daygeek/Thanu-photos-by-month/Dec-2017 ``` -### 5) How to Get Only the Size of First-Level Sub-Directories on Linux +### 5) 在 Linux 上如何仅获取一级子目录的大小 -If you want to get the size of the first-level sub-directories, including their subdirectories, for a given directory on Linux, use the command format below. +如果要获取 Linux 上给定目录的一级子目录(包括其子目录)的大小,请使用以下命令格式。 ``` $ du -h --max-depth=1 /home/daygeek/Documents/ @@ -155,9 +154,9 @@ $ du -h --max-depth=1 /home/daygeek/Documents/ 20G /home/daygeek/Documents/ ``` -### 6) How to Get Grand Total in the du Command Output +### 6) 如何在 du 命令输出中获得总计 -If you want to get the grand total in the du Command output, use the below du command format. +如果要在 du 命令输出中获得总计,请使用以下 du 命令格式。 ``` $ du -hsc /home/daygeek/Documents/* | sort -rh | head -10 From 3a5ee9e94cc6f00f93c8a49d9d294598e9199b58 Mon Sep 17 00:00:00 2001 From: laingke Date: Thu, 24 Oct 2019 16:18:54 +0800 Subject: [PATCH 135/800] 20191022-initializing-arrays-java translating --- sources/tech/20191022 Initializing arrays in Java.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191022 Initializing arrays in Java.md b/sources/tech/20191022 Initializing arrays in Java.md index 50451e57c3..7971ec104b 100644 --- a/sources/tech/20191022 Initializing arrays in Java.md +++ b/sources/tech/20191022 Initializing arrays in Java.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -370,7 +370,7 @@ via: https://opensource.com/article/19/10/initializing-arrays-java 作者:[Chris Hermansen][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From e783f217d110bb1c3dc7ec65bada5fe25c8b8c66 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 24 Oct 2019 20:27:19 +0800 Subject: [PATCH 136/800] PRF @hopefully2333 --- ...essionals can become security champions.md | 40 ++++++++----------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/translated/talk/20190924 How DevOps professionals can become security champions.md b/translated/talk/20190924 How DevOps professionals can become security champions.md index 84155a0517..b9811e03b2 100644 --- a/translated/talk/20190924 How DevOps professionals can become security champions.md +++ b/translated/talk/20190924 How DevOps professionals can become security champions.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (hopefully2333) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How DevOps professionals can become security champions) [#]: via: (https://opensource.com/article/19/9/devops-security-champions) -[#]: author: (Jessica Repka https://opensource.com/users/jrepkahttps://opensource.com/users/jrepkahttps://opensource.com/users/patrickhousleyhttps://opensource.com/users/mehulrajputhttps://opensource.com/users/alanfdosshttps://opensource.com/users/marcobravo) +[#]: author: (Jessica Repka https://opensource.com/users/jrepka) DevOps 专业人员如何成为网络安全拥护者 ====== -打破信息孤岛,成为网络安全的拥护者,这对你、对你的职业、对你的公司都会有所帮助。 -![A lock on the side of a building][1] + +> 打破信息孤岛,成为网络安全的拥护者,这对你、对你的职业、对你的公司都会有所帮助。 + +![](https://img.linux.net.cn/data/attachment/album/201910/24/202520u09xw2vm4w2jm0mx.jpg) 安全是 DevOps 中一个被误解了的部分,一些人认为它不在 DevOps 的范围内,而另一些人认为它太过重要(并且被忽视),建议改为使用 DevSecOps。无论你同意哪一方的观点,网络安全都会影响到我们每一个人,这是很明显的事实。 -每年, [黑客行为的统计数据][3] 都会更加令人震惊。例如, 每 39 秒就有一次黑客行为发生,这可能会导致你为公司写的记录、身份和专有项目被盗。你的安全团队可能需要花上几个月(也可能是永远找不到)才能发现这次黑客行为背后是谁,目的是什么,人在哪,什么时候黑进来的。 +每年,[黑客行为的统计数据][3] 都会更加令人震惊。例如,每 39 秒就有一次黑客行为发生,这可能会导致你为公司写的记录、身份和专有项目被盗。你的安全团队可能需要花上几个月(也可能是永远找不到)才能发现这次黑客行为背后是谁,目的是什么,人在哪,什么时候黑进来的。 -运营专家面对这些棘手问题应该如何是好?呐我说,现在是时候成为网络安全的拥护者,变为解决方案的一部分了。 +运维专家面对这些棘手问题应该如何是好?呐我说,现在是时候成为网络安全的拥护者,变为解决方案的一部分了。 ### 孤岛势力范围的战争 @@ -28,52 +30,44 @@ DevOps 专业人员如何成为网络安全拥护者 为了打破这些孤岛并结束势力战争,我在每个安全团队中都选了至少一个人来交谈,了解我们组织日常安全运营里的来龙去脉。我开始做这件事是出于好奇,但我持续做这件事是因为它总是能带给我一些有价值的、新的观点。例如,我了解到,对于每个因为失败的安全性而被停止的部署,安全团队都在疯狂地尝试修复 10 个他们看见的其他问题。他们反应的莽撞和尖锐是因为他们必须在有限的时间里修复这些问题,不然这些问题就会变成一个大问题。 -考虑到发现、识别和撤销已完成操作所需的大量知识,或者指出 DevOps 团队正在做什么-没有背景信息-然后复制并测试它。所有的这些通常都要由人手配备非常不足的安全团队完成。 +考虑到发现、识别和撤销已完成操作所需的大量知识,或者指出 DevOps 团队正在做什么(没有背景信息)然后复制并测试它。所有的这些通常都要由人手配备非常不足的安全团队完成。 这就是你的安全团队的日常生活,并且你的 DevOps 团队看不到这些。ITSEC 的日常工作意味着超时加班和过度劳累,以确保公司,公司的团队,团队里工作的所有人能够安全地工作。 ### 成为安全拥护者的方法 -这些是你成为你的安全团队的拥护者之后可以帮到它们的。这意味着-对于你做的所有操作-你必须仔细、认真地查看所有能够让其他人登录的方式,以及他们能够从中获得什么。 +这些是你成为你的安全团队的拥护者之后可以帮到它们的。这意味着,对于你做的所有操作,你必须仔细、认真地查看所有能够让其他人登录的方式,以及他们能够从中获得什么。 -帮助你的安全团队就是在帮助你自己。将工具添加到你的工作流程里,以此将你知道的要干的活和他们知道的要干的活结合到一起。从小事入手,例如阅读公共漏洞披露(CVEs),并将扫描模块添加到你的 CI/CD 流程里。对于你写的所有代码,都会有一个开源扫描工具,添加小型开源工具(例如下面列出来的)在长远看来是可以让项目更好的。 +帮助你的安全团队就是在帮助你自己。将工具添加到你的工作流程里,以此将你知道的要干的活和他们知道的要干的活结合到一起。从小事入手,例如阅读公共漏洞披露(CVE),并将扫描模块添加到你的 CI/CD 流程里。对于你写的所有代码,都会有一个开源扫描工具,添加小型开源工具(例如下面列出来的)在长远看来是可以让项目更好的。 -**容器扫描工具:** +**容器扫描工具:** * [Anchore Engine][5] * [Clair][6] * [Vuls][7] * [OpenSCAP][8] - - -**代码扫描工具:** +**代码扫描工具:** * [OWASP SonarQube][9] * [Find Security Bugs][10] * [Google Hacking Diggity Project][11] - - -**Kubernetes 安全工具:** +**Kubernetes 安全工具:** * [Project Calico][12] * [Kube-hunter][13] * [NeuVector][14] - - ### 保持你的 DevOps 态度 如果你的工作角色是和 DevOps 相关的,那么学习新技术和如何运用这项新技术创造新事物就是你工作的一部分。安全也是一样。我在 DevOps 安全方面保持到最新,下面是我的方法的列表。 * 每周阅读一篇你工作的方向里和安全相关的文章. - * 每周查看 [CVE][15] 官方网站,了解出现了什么新漏洞. + * 每周查看 [CVE][15] 官方网站,了解出现了什么新漏洞. * 尝试做一次黑客马拉松。一些公司每个月都要这样做一次;如果你觉得还不够、想了解更多,可以访问 Beginner Hack 1.0 网站。 * 每年至少一次和那你的安全团队的成员一起参加安全会议,从他们的角度来看事情。 - - ### 成为拥护者是为了变得更好 你应该成为你的安全的拥护者,下面是我们列出来的几个理由。首先是增长你的知识,帮助你的职业发展。第二是帮助其他的团队,培养新的关系,打破对你的组织有害的孤岛。在你的整个组织内建立由很多好处,包括设置沟通团队的典范,并鼓励人们一起工作。你同样能促进在整个组织中分享知识,并给每个人提供一个在安全方面更好的内部合作的新契机。 @@ -87,11 +81,11 @@ via: https://opensource.com/article/19/9/devops-security-champions 作者:[Jessica Repka][a] 选题:[lujun9972][b] 译者:[hopefully2333](https://github.com/hopefully2333) -校对:[校对者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/jrepkahttps://opensource.com/users/jrepkahttps://opensource.com/users/patrickhousleyhttps://opensource.com/users/mehulrajputhttps://opensource.com/users/alanfdosshttps://opensource.com/users/marcobravo +[a]: https://opensource.com/users/jrepka [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://opensource.com/article/19/1/what-devsecops From cb827de236fad36a12cfc555d52062dd452fa69a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 24 Oct 2019 20:28:29 +0800 Subject: [PATCH 137/800] PUB @hopefully2333 https://linux.cn/article-11498-1.html --- ... How DevOps professionals can become security champions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190924 How DevOps professionals can become security champions.md (98%) diff --git a/translated/talk/20190924 How DevOps professionals can become security champions.md b/published/20190924 How DevOps professionals can become security champions.md similarity index 98% rename from translated/talk/20190924 How DevOps professionals can become security champions.md rename to published/20190924 How DevOps professionals can become security champions.md index b9811e03b2..c356e406ff 100644 --- a/translated/talk/20190924 How DevOps professionals can become security champions.md +++ b/published/20190924 How DevOps professionals can become security champions.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (hopefully2333) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11498-1.html) [#]: subject: (How DevOps professionals can become security champions) [#]: via: (https://opensource.com/article/19/9/devops-security-champions) [#]: author: (Jessica Repka https://opensource.com/users/jrepka) From 1134efd685d23383ad13209abfc20daae39d3c0b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 24 Oct 2019 22:28:10 +0800 Subject: [PATCH 138/800] PRF @wxy --- ...iters can get work done better with Git.md | 62 +++++++++---------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/translated/tech/20190404 How writers can get work done better with Git.md b/translated/tech/20190404 How writers can get work done better with Git.md index 213c63bba9..75a9a79434 100644 --- a/translated/tech/20190404 How writers can get work done better with Git.md +++ b/translated/tech/20190404 How writers can get work done better with Git.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How writers can get work done better with Git) @@ -12,7 +12,7 @@ > 如果你是一名写作者,你也能从使用 Git 中受益。在我们的系列文章中了解有关 Git 鲜为人知的用法。 -![Writing Hand][1] +![](https://img.linux.net.cn/data/attachment/album/201910/24/222747ltajik2ymzmmttha.png) [Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。 @@ -20,7 +20,7 @@ ### 写作者的 Git -有些人写小说,也有人撰写学术论文、诗歌、剧本、技术手册或有关开源的文章。许多人都在做一点各种写作。相同的是,如果你是一名写作者,则或许能从使用 Git 中受益。尽管 Git 是著名的计算机程序员所使用的高度技术性工具,但它也是现代写作者的理想之选,本文将向你演示如何改变你的书写方式以及为什么要这么做的原因。 +有些人写小说,也有人撰写学术论文、诗歌、剧本、技术手册或有关开源的文章。许多人都在做一些各种写作。相同的是,如果你是一名写作者,或许能从使用 Git 中受益。尽管 Git 是著名的计算机程序员所使用的高度技术性工具,但它也是现代写作者的理想之选,本文将向你演示如何改变你的书写方式以及为什么要这么做的原因。 但是,在谈论 Git 之前,重要的是先谈谈“副本”(或者叫“内容”,对于数字时代而言)到底是什么,以及为什么它与你的交付*媒介*不同。这是 21 世纪,大多数写作者选择的工具是计算机。尽管计算机看似擅长将副本的编辑和布局等过程结合在一起,但写作者还是(重新)发现将内容与样式分开是一个好主意。这意味着你应该在计算机上像在打字机上而不是在文字处理器中进行书写。以计算机术语而言,这意味着以*纯文本*形式写作。 @@ -30,13 +30,13 @@ 你只需要逐字写下你的内容,而将交付工作留给发布者。即使你是自己发布,将字词作为写作作品的一种源代码也是一种更聪明、更有效的工作方式,因为在发布时,你可以使用相同的源(你的纯文本)生成适合你的目标输出(用于打印的 PDF、用于电子书的 EPUB、用于网站的 HTML 等)。 -用纯文本编写不仅意味着你不必担心布局或文本样式,而且也不再需要专门的工具。无论是手机或平板电脑上的基本记事本应用程序、计算机附带的文本编辑器,还是从互联网上下载的免费编辑器,任何能够产生文本内容的工具对你而言都是有效的“文字处理器”。无论你身在何处或在做什么,几乎可以在任何设备上书写,并且所生成的文本可以与你的项目完美集成,而无需进行任何修改。 +用纯文本编写不仅意味着你不必担心布局或文本样式,而且也不再需要专门的工具。无论是手机或平板电脑上的基本的记事本应用程序、计算机附带的文本编辑器,还是从互联网上下载的免费编辑器,任何能够产生文本内容的工具对你而言都是有效的“文字处理器”。无论你身在何处或在做什么,几乎可以在任何设备上书写,并且所生成的文本可以与你的项目完美集成,而无需进行任何修改。 而且,Git 专门用来管理纯文本。 ### Atom 编辑器 -当你以纯文本形式书写时,文字处理程序会显得过于庞大。使用文本编辑器更容易,因为文本编辑器不会尝试“有效地”重组输入内容。它使你可以将脑海中的单词输入到屏幕中,而不会受到干扰。更好的是,文本编辑器通常是围绕插件体系结构设计的,这样应用程序本身就很基础(它用来编辑文本),但是你可以围绕它构建一个环境来满足你的各种需求。 +当你以纯文本形式书写时,文字处理程序会显得过于庞大。使用文本编辑器更容易,因为文本编辑器不会尝试“有效地”重组输入内容。它使你可以将脑海中的单词输入到屏幕中,而不会受到干扰。更好的是,文本编辑器通常是围绕插件体系结构设计的,这样应用程序本身很基础(它用来编辑文本),但是你可以围绕它构建一个环境来满足你的各种需求。 [Atom][4] 编辑器就是这种设计理念的一个很好的例子。这是一个具有内置 Git 集成的跨平台文本编辑器。如果你不熟悉纯文本格式,也不熟悉 Git,那么 Atom 是最简单的入门方法。 @@ -64,15 +64,15 @@ Atom 当前没有在 BSD 上构建。但是,有很好的替代方法,例如 #### 快速指导 -如果要使用纯文本和 Git,则需要适应你的编辑器。Atom 的用户界面可能比你习惯的更加动态。实际上,你可以将它视为 Firefox 或 Chrome,而不是文字处理程序,因为它具有可以根据需要打开和关闭的选项卡和面板,甚至还可以安装和配置附件。尝试全部掌握 Atom 如许之多的功能是不切实际的,但是你至少可以知道有什么功能。 +如果要使用纯文本和 Git,则需要适应你的编辑器。Atom 的用户界面可能比你习惯的更加动态。实际上,你可以将它视为 Firefox 或 Chrome,而不是文字处理程序,因为它具有可以根据需要打开或关闭的选项卡和面板,甚至还可以安装和配置附件。尝试全部掌握 Atom 如许之多的功能是不切实际的,但是你至少可以知道有什么功能。 -当 Atom 打开时,它将显示一个欢迎屏幕。如果不出意外,此屏幕很好地介绍了 Atom 的选项卡式界面。你可以通过单击 Atom 窗口顶部选项卡上的“关闭”图标来关闭欢迎屏幕,并使用“文件 > 新建文件”创建一个新文件。 +当打开 Atom 时,它将显示一个欢迎屏幕。如果不出意外,此屏幕很好地介绍了 Atom 的选项卡式界面。你可以通过单击 Atom 窗口顶部选项卡上的“关闭”图标来关闭欢迎屏幕,并使用“文件 > 新建文件”创建一个新文件。 -使用纯文本格式与使用文字处理程序有点不同,因此这里有一些技巧,以人可以连接的方式编写内容,并且 Git 和计算机可以解析,跟踪和转换。 +使用纯文本格式与使用文字处理程序有点不同,因此这里有一些技巧,以人可以理解的方式编写内容,并且 Git 和计算机可以解析,跟踪和转换。 #### 用 Markdown 书写 -如今,当人们谈论纯文本时,大多是指 Markdown。Markdown 与其说是格式,不如说是样式,这意味着它旨在为文本提供可预测的结构,以便计算机可以检测自然的模式并智能地转换文本。Markdown 有很多定义,但是最好的技术定义和备忘单在 [CommonMark 的网站][8]上。 +如今,当人们谈论纯文本时,大多是指 Markdown。Markdown 与其说是格式,不如说是样式,这意味着它旨在为文本提供可预测的结构,以便计算机可以检测自然的模式并智能地转换文本。Markdown 有很多定义,但是最好的技术定义和备忘清单在 [CommonMark 的网站][8]上。 ``` # Chapter 1 @@ -85,9 +85,9 @@ And it can even reference an image. 从示例中可以看出,Markdown 读起来感觉不像代码,但可以将其视为代码。如果你遵循 CommonMark 定义的 Markdown 规范,那么一键就可以可靠地将 Markdown 的文字转换为 .docx、.epub、.html、MediaWiki、.odt、.pdf、.rtf 和各种其他的格式,而*不会*失去格式。 -你可以认为 Markdown 有点像文字处理程序的样式。如果你曾经为出版社撰写过一套样式来控制章节标题和章节标题的样式,那基本上就是一回事,除了不是从下拉菜单中选择样式以外,你要给你的文字添加一些小记号。对于任何习惯“以文字交谈”的现代阅读者来说,这些表示法都是很自然的,但是在呈现文本时,它们会被精美的文本样式替换掉。实际上,这是文字处理程序在后台秘密进行的操作。文字处理器显示粗体文本,但是如果你可以看到使文本变为粗体的生成代码,则它与 Markdown 很像(实际上,它是更复杂的 XML)。使用 Markdown 可以消除这种代码和样式之间的阻隔,一方面看起来更可怕,但另一方面,你可以在几乎所有可以生成文本的东西上书写 Markdown 而不会丢失任何格式信息。 +你可以认为 Markdown 有点像文字处理程序的样式。如果你曾经为出版社撰写过一套样式来控制章节标题及其样式,那基本上就是一回事,除了不是从下拉菜单中选择样式以外,你需要给你的文字添加一些小记号。对于任何习惯“以文字交谈”的现代阅读者来说,这些表示法都是很自然的,但是在呈现文本时,它们会被精美的文本样式替换掉。实际上,这就是文字处理程序在后台秘密进行的操作。文字处理器显示粗体文本,但是如果你可以看到使文本变为粗体的生成代码,则它与 Markdown 很像(实际上,它是更复杂的 XML)。使用 Markdown 可以消除这种代码和样式之间的阻隔,一方面看起来更可怕一些,但另一方面,你可以在几乎所有可以生成文本的东西上书写 Markdown 而不会丢失任何格式信息。 -Markdown 文件流行d 文件扩展名是 .md。如果你使用的平台不知道 .md 文件是什么,则可以手动将扩展名与 Atom 关联,或者仅使用通用的 .txt 扩展名。文件扩展名不会更改文件的性质。它只会改变你的计算机决定如何处理它的方式。Atom 和某些平台足够聪明,可以知道该文件是纯文本格式,无论你给它以什么扩展名。 +Markdown 文件流行的文件扩展名是 .md。如果你使用的平台不知道 .md 文件是什么,则可以手动将该扩展名与 Atom 关联,或者仅使用通用的 .txt 扩展名。文件扩展名不会更改文件的性质。它只会改变你的计算机决定如何处理它的方式。Atom 和某些平台足够聪明,可以知道该文件是纯文本格式,无论你给它以什么扩展名。 #### 实时预览 @@ -97,25 +97,25 @@ Atom 具有 “Markdown 预览” 插件,该插件可以向你显示正在编 要激活此预览窗格,请选择“包 > Markdown 预览 > 切换预览” 或按 `Ctrl + Shift + M`。 -此视图为你提供了两全其美的方法。无需承担为你的文本添加样式的负担,就可以写作,而你也可以看到一个通用的示例外观,至少是以典型的数字化格式显示了文本的外观。当然,关键是你无法控制文本的最终呈现方式,因此不要试图调整 Markdown 来强制以某种方式显示呈现的预览。 +此视图为你提供了两全其美的方法。无需承担为你的文本添加样式的负担就可以写作,而你也可以看到一个通用的示例外观,至少是以典型的数字化格式显示文本的外观。当然,关键是你无法控制文本的最终呈现方式,因此不要试图调整 Markdown 来强制以某种方式显示呈现的预览。 #### 每行一句话 你的高中写作老师不会看你的 Markdown。 -一开始它并那么自然,但是在数字世界中,保持每行一个句子更有意义。Markdown 忽略单个换行符(当你按下 Return 或 Enter 键时),并且只在单个空行之后才会创建一个新段落。 +一开始它不那么自然,但是在数字世界中,保持每行一个句子更有意义。Markdown 会忽略单个换行符(当你按下 `Return` 或 `Enter` 键时),并且只在单个空行之后才会创建一个新段落。 ![Writing in Atom][10] -每行写一个句子的好处是你的工作更容易跟踪。也就是说,如果你在段落的开头更改了一个单词,那么如果更改仅限于一行而不是一个长的段落中的一个单词,那么 Atom、Git 或任何应用程序很容易以有意义的方式突出显示该更改。换句话说,对一个句子的更改只会影响该句子,而不会影响整个段落。 +每行写一个句子的好处是你的工作更容易跟踪。也就是说,假如你在段落的开头更改了一个单词,如果更改仅限于一行而不是一个长的段落中的一个单词,那么 Atom、Git 或任何应用程序很容易以有意义的方式突出显示该更改。换句话说,对一个句子的更改只会影响该句子,而不会影响整个段落。 -你可能会想:“许多文字处理器也可以跟踪更改,它们可以突出显示已更改的单个单词。”但是这些修订跟踪器绑定到该字处理器的界面上,这意味着你必须先打开该字处理器才能浏览修订。在纯文本工作流程中,你可以以纯文本形式查看修订,这意味着无论手头有什么,只要该设备可以处理纯文本(大多数都可以),就可以进行编辑或批准编辑。 +你可能会想:“许多文字处理器也可以跟踪更改,它们可以突出显示已更改的单个单词。”但是这些修订跟踪器绑定在该字处理器的界面上,这意味着你必须先打开该字处理器才能浏览修订。在纯文本工作流程中,你可以以纯文本形式查看修订,这意味着无论手头有什么,只要该设备可以处理纯文本(大多数都可以),就可以进行编辑或批准编辑。 -诚然,写作者通常不会考虑行号,但它对于计算机有用,并且通常是一个很好的参考点。默认情况下,Atom 为文本文档的行进行编号。按下 Enter 键或 Return 键后,一*行*就是一行。 +诚然,写作者通常不会考虑行号,但它对于计算机有用,并且通常是一个很好的参考点。默认情况下,Atom 为文本文档的行进行编号。按下 `Enter` 键或 `Return` 键后,一*行*就是一行。 ![Writing in Atom][11] -如果一行中有一个点而不是一个数字,则表示它是上一行折叠的一部分,因为它不超出了你的屏幕。 +如果(在 Atom 的)一行的行号中有一个点而不是一个数字,则表示它是上一行折叠的一部分,因为它超出了你的屏幕。 #### 主题 @@ -127,7 +127,7 @@ Atom 具有 “Markdown 预览” 插件,该插件可以向你显示正在编 ![Atom's themes][13] -要使用已安装的主题或根据喜好自定义主题,请导航至“设置”标签页中的“主题”类别中。从下拉菜单中选择要使用的主题。更改会立即进行,因此你可以准确了解主题如何影响您的环境。 +要使用已安装的主题或根据喜好自定义主题,请导航至“设置”标签页中的“主题”类别中。从下拉菜单中选择要使用的主题。更改会立即进行,因此你可以准确了解主题如何影响你的环境。 你也可以在“设置”标签的“编辑器”类别中更改工作字体。Atom 默认采用等宽字体,程序员通常首选这种字体。但是你可以使用系统上的任何字体,无论是衬线字体、无衬线字体、哥特式字体还是草书字体。无论你想整天盯着什么字体都行。 @@ -139,19 +139,19 @@ Atom 具有 “Markdown 预览” 插件,该插件可以向你显示正在编 创建长文档时,我发现每个文件写一个章节比在一个文件中写整本书更有意义。此外,我不会以明显的语法 ` chapter-1.md` 或 `1.example.md` 来命名我的章节,而是以章节标题或关键词(例如 `example.md`)命名。为了将来为自己提供有关如何编写本书的指导,我维护了一个名为 `toc.md` (用于“目录”)的文件,其中列出了各章的(当前)顺序。 -我这样做是因为,无论我多么相信第 6 章都不可能出现在第 1 章之前,但在我完成整本书之前,几乎不大可能出现我不会交换一两个章节的顺序。我发现从一开始就保持动态变化可以帮助我避免重命名混乱,也可以帮助我避免僵化的结构。 +我这样做是因为,无论我多么相信第 6 章都不可能出现在第 1 章之前,但在我完成整本书之前,几乎难以避免我会交换一两个章节的顺序。我发现从一开始就保持动态变化可以帮助我避免重命名混乱,也可以帮助我避免僵化的结构。 ### 在 Atom 中使用 Git -每位写作者的共同点是两件事:他们为流传而写作,而他们的写作是一段旅程。你无需坐下来写作就完成最终稿件。顾名思义,你有一个初稿。该草稿会经过修订,你会仔细地将每个修订保存一式两份或三份,以防万一你的文件损坏了。最终,你得到了所谓的最终草案,但很有可能你有一天还会回到这份最终草案,要么恢复好的部分要么修改坏的部分。 +每位写作者的共同点是两件事:他们为流传而写作,而他们的写作是一段旅程。你不能一坐下来写作就完成了最终稿件。顾名思义,你有一个初稿。该草稿会经过修订,你会仔细地将每个修订保存一式两份或三份的备份,以防万一你的文件损坏了。最终,你得到了所谓的最终草稿,但很有可能你有一天还会回到这份最终草稿,要么恢复好的部分,要么修改坏的部分。 -Atom 最令人兴奋的功能是其强大的 Git 集成。无需离开 Atom,你就可以与 Git 的所有主要功能进行交互,跟踪和更新项目、回滚你不喜欢的更改、集成来自协作者的更改等等。最好的学习方法就是逐步学习,因此这是从写作项目开始到结束在 Atom 界面中使用 Git 的方法。 +Atom 最令人兴奋的功能是其强大的 Git 集成。无需离开 Atom,你就可以与 Git 的所有主要功能进行交互,跟踪和更新项目、回滚你不喜欢的更改、集成来自协作者的更改等等。最好的学习方法就是逐步学习,因此这是在一个写作项目中从始至终在 Atom 界面中使用 Git 的方法。 第一件事:通过选择 “视图 > 切换 Git 标签页” 来显示 Git 面板。这将在 Atom 界面的右侧打开一个新标签页。现在没什么可看的,所以暂时保持打开状态就行。 #### 建立一个 Git 项目 -你可以将 Git 视为它被绑定到文件夹。Git 目录之外的任何文件夹都不知道 Git,而 Git 也不知道外面。Git 目录中的文件夹和文件将被忽略,直到你授予 Git 权限来跟踪它们为止。 +你可以认为 Git 被绑定到一个文件夹。Git 目录之外的任何文件夹都不知道 Git,而 Git 也不知道外面。Git 目录中的文件夹和文件将被忽略,直到你授予 Git 权限来跟踪它们为止。 你可以通过在 Atom 中创建新的项目文件夹来创建 Git 项目。选择 “文件 > 添加项目文件夹”,然后在系统上创建一个新文件夹。你创建的文件夹将出现在 Atom 窗口的左侧“项目面板”中。 @@ -159,11 +159,11 @@ Atom 最令人兴奋的功能是其强大的 Git 集成。无需离开 Atom, 右键单击你的新项目文件夹,然后选择“新建文件”以在项目文件夹中创建一个新文件。如果你要导入文件到新项目中,请右键单击该文件夹,然后选择“在文件管理器中显示”,以在系统的文件查看器中打开该文件夹(Linux 上为 Dolphin 或 Nautilus,Mac 上为 Finder,在 Windows 上是 Explorer),然后拖放文件到你的项目文件夹。 -在 Atom 中打开一个项目文件(你创建的空文件或导入的文件)后,单击 Git 标签中的 “创建存储库Create Repository” 按钮。在弹出的对话框中,单击 “初始化Init” 以将你的项目目录初始化为本地 Git 存储库。 Git 会将 `.git` 目录(在系统的文件管理器中不可见,但在 Atom 中可见)添加到项目文件夹中。不要被这个愚弄了:`.git` 目录是 Git 管理的,而不是由你管理的,因此你一般不要动它。但是在 Atom 中看到它可以很好地提醒你正在由 Git 管理的项目中工作。换句话说,当你看到 `.git` 目录时,就有了修订历史记录。 +在 Atom 中打开一个项目文件(你创建的空文件或导入的文件)后,单击 Git 标签中的 “创建存储库Create Repository” 按钮。在弹出的对话框中,单击 “初始化Init” 以将你的项目目录初始化为本地 Git 存储库。 Git 会将 `.git` 目录(在系统的文件管理器中不可见,但在 Atom 中可见)添加到项目文件夹中。不要被这个愚弄了:`.git` 目录是 Git 管理的,而不是由你管理的,因此一般你不要动它。但是在 Atom 中看到它可以很好地提醒你正在由 Git 管理的项目中工作。换句话说,当你看到 `.git` 目录时,就有了修订历史记录。 在你的空文件中,写一些东西。你是写作者,所以输入一些单词就行。你可以随意输入任何一组单词,但要记住上面的写作技巧。 -按 `Ctrl + S` 保存文件,该文件将显示在 Git 标签的 “未暂存的改变Unstaged Changes” 部分中。这意味着该文件存在于你的项目文件夹中,但尚未提交给 Git 管理。通过单击 Git 选项卡右上方的 “暂存全部Stage All” 按钮,允许 Git 跟踪这些文件。如果你使用过带有修订历史记录的文字处理器,则可以将此步骤视为允许 Git记录更改。 +按 `Ctrl + S` 保存文件,该文件将显示在 Git 标签的 “未暂存的改变Unstaged Changes” 部分中。这意味着该文件存在于你的项目文件夹中,但尚未提交给 Git 管理。通过单击 Git 选项卡右上方的 “暂存全部Stage All” 按钮,以允许 Git 跟踪这些文件。如果你使用过带有修订历史记录的文字处理器,则可以将此步骤视为允许 Git 记录更改。 #### Git 提交 @@ -171,7 +171,7 @@ Atom 最令人兴奋的功能是其强大的 Git 集成。无需离开 Atom, Git 的提交commit会将你的文件发送到 Git 的内部和永久存档中。如果你习惯于文字处理程序,这就类似于给一个修订版命名。要创建一个提交,请在 Git 选项卡底部的“提交Commit”消息框中输入一些描述性文本。你可能会感到含糊不清或随意写点什么,但如果你想在将来知道进行修订的原因,那么输入一些有用的信息会更有用。 -第一次提交时,必须创建一个分支branch。Git 分支有点像另外一个空间,它允许你从一个时间轴切换到另一个时间轴,以进行你可能想要或可能不想要永久保留的更改。如果最终喜欢该更改,则可以将一个实验分支合并到另一个实验分支,从而统一项目的不同版本。这是一个高级过程,不需要先学会,但是你仍然需要一个活动分支,因此你必须为首次提交创建一个分支。 +第一次提交时,必须创建一个分支branch。Git 分支有点像另外一个空间,它允许你从一个时间轴切换到另一个时间轴,以进行你可能想要也可能不想要永久保留的更改。如果最终喜欢该更改,则可以将一个实验分支合并到另一个实验分支,从而统一项目的不同版本。这是一个高级过程,不需要先学会,但是你仍然需要一个活动分支,因此你必须为首次提交创建一个分支。 单击 Git 选项卡最底部的“分支Branch”图标,以创建新的分支。 @@ -185,7 +185,7 @@ Git 的提交commit会将你的文件发送到 Git 的内 #### 历史记录和 Git 差异 -一个自然而然的问题是你应该多久做一次提交。这并没有正确的答案。使用 `Ctrl + S` 保存文件并提交到 Git 是两个单独的过程,因此你会一直做这两个过程。每当你觉得自己已经做了重要的事情或打算尝试一个可能要被干掉的疯狂的新想法时,你可能都会想要做个提交。 +一个自然而然的问题是你应该多久做一次提交。这并没有正确的答案。使用 `Ctrl + S` 保存文件和提交到 Git 是两个单独的过程,因此你会一直做这两个过程。每当你觉得自己已经做了重要的事情或打算尝试一个可能会被干掉的疯狂的新想法时,你可能都会想要做次提交。 要了解提交对工作流程的影响,请从测试文档中删除一些文本,然后在顶部和底部添加一些文本。再次提交。 这样做几次,直到你在 Git 标签的底部有了一小段历史记录,然后单击其中一个提交以在 Atom 中查看它。 @@ -199,15 +199,15 @@ Git 的提交commit会将你的文件发送到 Git 的内 #### 远程备份 -使用 Git 的优点之一是,按照设计,它是分布式的,这意味着你可以将工作提交到本地存储库,并将所做的更改推送到任意数量的服务器上进行备份。你还可以从这些服务器中拉取更改,以便你碰巧正在使用的任何设备始终具有最新更改。 +使用 Git 的优点之一是,按照设计它是分布式的,这意味着你可以将工作提交到本地存储库,并将所做的更改推送到任意数量的服务器上进行备份。你还可以从这些服务器中拉取更改,以便你碰巧正在使用的任何设备始终具有最新更改。 -为此,你必须在 Git 服务器上拥有一个帐户。有几种免费的托管服务,其中包括 GitHub,这个公司开发了 Atom,但奇怪的是 GitHub 不是开源的;而 GitLab 是开源的。相比私有的,我更喜欢开源,在本示例中,我将使用 GitLab。 +为此,你必须在 Git 服务器上拥有一个帐户。有几种免费的托管服务,其中包括 GitHub,这个公司开发了 Atom,但奇怪的是 GitHub 不是开源的;而 GitLab 是开源的。相比私有软件,我更喜欢开源,在本示例中,我将使用 GitLab。 如果你还没有 GitLab 帐户,请注册一个帐户并开始一个新项目。项目名称不必与 Atom 中的项目文件夹匹配,但是如果匹配,则可能更有意义。你可以将项目保留为私有,在这种情况下,只有你和任何一个你给予了明确权限的人可以访问它,或者,如果你希望该项目可供任何互联网上偶然发现它的人使用,则可以将其公开。 不要将 README 文件添加到项目中。 -创建项目后,这个文件将为你提供有关如何设置存储库的说明。如果你决定在终端中或通过单独的 GUI 使用 Git,这是非常有用的信息,但是 Atom 的工作流程则有所不同。 +创建项目后,它将为你提供有关如何设置存储库的说明。如果你决定在终端中或通过单独的 GUI 使用 Git,这是非常有用的信息,但是 Atom 的工作流程则有所不同。 单击 GitLab 界面右上方的 “克隆Clone” 按钮。这显示了访问 Git 存储库必须使用的地址。复制 “SSH” 地址(而不是 “https” 地址)。 @@ -224,7 +224,7 @@ Git 的提交commit会将你的文件发送到 Git 的内 在 Git 标签的底部,出现了一个新按钮,标记为 “提取Fetch”。由于你的服务器是全新的服务器,因此没有可供你提取的数据,因此请右键单击该按钮,然后选择“推送Push”。这会将你的更改推送到你的 GitLab 帐户,现在你的项目已备份到 Git 服务器上。 -你可以在每次提交后将更改推送到服务器。它提供了立即的异地备份,并且由于数据量通常很少,因此它几乎与本地保存一样快。 +你可以在每次提交后将更改推送到服务器。它提供了即刻的异地备份,并且由于数据量通常很少,因此它几乎与本地保存一样快。 ### 撰写而 Git @@ -237,7 +237,7 @@ via: https://opensource.com/article/19/4/write-git 作者:[Seth Kenlon][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 0bb13b3ff0f6d2d00d2cdab807dbb2d2a8019fd1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 24 Oct 2019 22:34:13 +0800 Subject: [PATCH 139/800] PUB @wxy https://linux.cn/article-11499-1.html --- .../20190404 How writers can get work done better with Git.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190404 How writers can get work done better with Git.md (99%) diff --git a/translated/tech/20190404 How writers can get work done better with Git.md b/published/20190404 How writers can get work done better with Git.md similarity index 99% rename from translated/tech/20190404 How writers can get work done better with Git.md rename to published/20190404 How writers can get work done better with Git.md index 75a9a79434..125f925fef 100644 --- a/translated/tech/20190404 How writers can get work done better with Git.md +++ b/published/20190404 How writers can get work done better with Git.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11499-1.html) [#]: subject: (How writers can get work done better with Git) [#]: via: (https://opensource.com/article/19/4/write-git) [#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/noreplyhttps://opensource.com/users/seth) From c3f5fcadaa68962aa394d4640f5851a8d7e5ddf1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 25 Oct 2019 00:55:20 +0800 Subject: [PATCH 140/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191025=20MX=20L?= =?UTF-8?q?inux=2019=20Released=20With=20Debian=2010.1=20=E2=80=98Buster?= =?UTF-8?q?=E2=80=99=20&=20Other=20Improvements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md --- ...bian 10.1 ‘Buster- - Other Improvements.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sources/tech/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md diff --git a/sources/tech/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md b/sources/tech/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md new file mode 100644 index 0000000000..df7ea64637 --- /dev/null +++ b/sources/tech/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (MX Linux 19 Released With Debian 10.1 ‘Buster’ & Other Improvements) +[#]: via: (https://itsfoss.com/mx-linux-19/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +MX Linux 19 Released With Debian 10.1 ‘Buster’ & Other Improvements +====== + +MX Linux 18 has been one of my top recommendations for the [best Linux distributions][1], specially when considering distros other than Ubuntu. + +It is based on Debian 9.6 ‘Stretch’ – which was incredibly a fast and smooth experience. + +Now, as a major upgrade to that, MX Linux 19 brings a lot of major improvements and changes. Here, we shall take a look at the key highlights. + +### New features in MX Linux 19 + +[Subscribe to our YouTube channel for more Linux videos][2] + +#### Debian 10 ‘Buster’ + +This deserves a separate mention as Debian 10 is indeed a major upgrade from Debian 9.6 ‘Stretch’ on which MX Linux 18 was based on. + +In case you’re curious about what has changed with Debian 10 Buster, we suggest to check out our article on the [new features of Debian 10 Buster][3]. + +#### Xfce Desktop 4.14 + +![MX Linux 19][4] + +[Xfce 4.14][5] happens to be the latest offering from Xfce development team. Personally, I’m not a fan of Xfce desktop environment but it screams fast performance when you get to use it on a Linux distro (especially on MX Linux 19). + +Interestingly, we also have a quick guide to help you [customize Xfce][6] on your system. + +#### Updated Packages & Latest Debian Kernel 4.19 + +Along with updated packages for [GIMP][7], MESA, Firefox, and so on – it also comes baked in with the latest kernel 4.19 available for Debian Buster. + +#### Updated MX-Apps + +If you’ve used MX Linux before, you might be knowing that it comes pre-installed with useful MX-Apps that help you get more things done quickly. + +The apps like MX-installer and MX-packageinstaller have significantly improved. + +In addition to these two, all other MX-tools have been updated here and there to fix bugs, add new translations (or simply to improve the user experience). + +#### Other Improvements + +Considering it a major upgrade, there’s obviously a lot of under-the-hood changes than highlighted (including the latest antiX live system updates). + +You can check out more details on their [official announcement post][8]. You may also watch this video from the developers explaining all the new stuff in MX Linux 19: + +### Getting MX Linux 19 + +Even if you are using MX Linux 18 versions right now, you [cannot upgrade][9] to MX Linux 19. You need to go for a clean install like everyone else. + +You can download MX Linux 19 from this page: + +[Download MX Linux 19][10] + +**Wrapping Up** + +With MX Linux 18, I had a problem using my WiFi adapter due to a driver issue which I resolved through the [forum][11], it seems that it still hasn’t been fixed with MX Linux 19. So, you might want to take a look at my [forum post][11] if you face the same issue after installing MX Linux 19. + +If you’ve been using MX Linux 18, this definitely seems to be an impressive upgrade. + +Have you tried it yet? What are your thoughts on the new MX Linux 19 release? Let me know what you think in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mx-linux-19/ + +作者:[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-distributions/ +[2]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[3]: https://itsfoss.com/debian-10-buster/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/mx-linux-19.jpg?ssl=1 +[5]: https://xfce.org/about/news +[6]: https://itsfoss.com/customize-xfce/ +[7]: https://itsfoss.com/gimp-2-10-release/ +[8]: https://mxlinux.org/blog/mx-19-patito-feo-released/ +[9]: https://mxlinux.org/migration/ +[10]: https://mxlinux.org/download-links/ +[11]: https://forum.mxlinux.org/viewtopic.php?t=52201 From 09d05210af3a9083f3ef0e562e62cc6d51911e10 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 25 Oct 2019 06:37:31 +0800 Subject: [PATCH 141/800] =?UTF-8?q?Rename=20sources/tech/20191025=20MX=20L?= =?UTF-8?q?inux=2019=20Released=20With=20Debian=2010.1=20=E2=80=98Buster-?= =?UTF-8?q?=20-=20Other=20Improvements.md=20to=20sources/news/20191025=20M?= =?UTF-8?q?X=20Linux=2019=20Released=20With=20Debian=2010.1=20=E2=80=98Bus?= =?UTF-8?q?ter-=20-=20Other=20Improvements.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md (100%) diff --git a/sources/tech/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md b/sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md similarity index 100% rename from sources/tech/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md rename to sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md From c3658ccf0ba7bb20c94d7afd7e5f6d0717b162cd Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 Oct 2019 08:50:17 +0800 Subject: [PATCH 142/800] translated --- ...int- Making your Python code consistent.md | 101 ------------------ ...int- Making your Python code consistent.md | 99 +++++++++++++++++ 2 files changed, 99 insertions(+), 101 deletions(-) delete mode 100644 sources/tech/20191021 Pylint- Making your Python code consistent.md create mode 100644 translated/tech/20191021 Pylint- Making your Python code consistent.md diff --git a/sources/tech/20191021 Pylint- Making your Python code consistent.md b/sources/tech/20191021 Pylint- Making your Python code consistent.md deleted file mode 100644 index 1795e3ecbf..0000000000 --- a/sources/tech/20191021 Pylint- Making your Python code consistent.md +++ /dev/null @@ -1,101 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Pylint: Making your Python code consistent) -[#]: via: (https://opensource.com/article/19/10/python-pylint-introduction) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -Pylint: Making your Python code consistent -====== -Pylint is your friend when you want to avoid arguing about code -complexity. -![OpenStack source code \(Python\) in VIM][1] - -Pylint is a higher-level Python style enforcer. While [flake8][2] and [black][3] will take care of "local" style: where the newlines occur, how comments are formatted, or find issues like commented out code or bad practices in log formatting. - -Pylint is extremely aggressive by default. It will offer strong opinions on everything from checking if declared interfaces are actually implemented to opportunities to refactor duplicate code, which can be a lot to a new user. One way of introducing it gently to a project, or a team, is to start by turning _all_ checkers off, and then enabling checkers one by one. This is especially useful if you already use flake8, black, and [mypy][4]: Pylint has quite a few checkers that overlap in functionality. - -However, one of the things unique to Pylint is the ability to enforce higher-level issues: for example, number of lines in a function, or number of methods in a class. - -These numbers might be different from project to project and can depend on the development team's preferences. However, once the team comes to an agreement about the parameters, it is useful to _enforce_ those parameters using an automated tool. This is where Pylint shines. - -### Configuring Pylint - -In order to start with an empty configuration, start your `.pylintrc` with - - -``` -[MESSAGES CONTROL] - -disable=all -``` - -This disables all Pylint messages. Since many of them are redundant, this makes sense. In Pylint, a `message` is a specific kind of warning. - -You can check that all messages have been turned off by running `pylint`: - - -``` -`$ pylint ` -``` - -In general, it is not a great idea to add parameters to the `pylint` command-line: the best place to configure your `pylint` is the `.pylintrc`. In order to have it do _something_ useful, we need to enable some messages. - -In order to enable messages, add to your `.pylintrc`, under the `[MESSAGES CONTROL]`. - - -``` -enable=<message>, - -       ... -``` - -For the "messages" (what Pylint calls different kinds of warnings) that look useful. Some of my favorites include `too-many-lines`, `too-many-arguments`, and `too-many-branches`. All of those limit complexity of modules or functions, and serve as an objective check, without a human nitpicker needed, for code complexity measurement. - -A _checker_ is a source of _messages_: every message belongs to exactly one checker. Many of the most useful messages are under the [design checker][5]. The default numbers are usually good, but tweaking the maximums is straightfoward: we can add a section called `DESIGN` in the `.pylintrc`. - - -``` -[DESIGN] - -max-args=7 - -max-locals=15 -``` - -Another good source of useful messages is the `refactoring` checker. Some of my favorite messages to enable there are `consider-using-dict-comprehension`, `stop-iteration-return` (which looks for generators which use `raise StopIteration` when `return` is the correct way to stop the iteration). and `chained-comparison`, which will suggest using syntax like `1 <= x < 5` rather than the less obvious `1 <= x && 5 > 5` - -Finally, an expensive checker, in terms of performance, but highly useful, is `similarities`. It is designed to enforce "Don't Repeat Yourself" (the DRY principle) by explicitly looking for copy-paste between different parts of the code. It only has one message to enable: `duplicate-code`. The default "minimum similarity lines" is set to `4`. It is possible to set it to a different value using the `.pylintrc`. - - -``` -[SIMILARITIES] - -min-similarity-lines=3 -``` - -### Pylint makes code reviews easy - -If you are sick of code reviews where you point out that a class is too complicated, or that two different functions are basically the same, add Pylint to your [Continuous Integration][6] configuration, and only have the arguments about complexity guidelines for your project _once_. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/python-pylint-introduction - -作者:[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/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM) -[2]: https://opensource.com/article/19/5/python-flake8 -[3]: https://opensource.com/article/19/5/python-black -[4]: https://opensource.com/article/19/5/python-mypy -[5]: https://pylint.readthedocs.io/en/latest/technical_reference/features.html#design-checker -[6]: https://opensource.com/business/15/7/six-continuous-integration-tools diff --git a/translated/tech/20191021 Pylint- Making your Python code consistent.md b/translated/tech/20191021 Pylint- Making your Python code consistent.md new file mode 100644 index 0000000000..224cb557a2 --- /dev/null +++ b/translated/tech/20191021 Pylint- Making your Python code consistent.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Pylint: Making your Python code consistent) +[#]: via: (https://opensource.com/article/19/10/python-pylint-introduction) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Pylint:让你的 Python 代码保持一致 +====== +当你想要争论代码复杂性时,Pylint 是你的朋友。 +![OpenStack source code \(Python\) in VIM][1] + +Pylint 是更高层级的 Python 样式强制程序。而 [flake8][2] 和 [black][3] 检查的是“本地”样式:换行位置、注释的格式、发现注释掉的代码或日志格式中的错误做法之类的问题。 + +默认情况下,Pylint 非常激进。它将对一切提供强有力的意见,从检查是否实际实现声明的接口到重构重复代码,这对新用户来说可能会很多。一种温和地将其引入项目或团对的方法是先关闭_所有_检查器,然后逐个启用检查器。如果你已经在使用 flake8、black 和 [mypy][4],这尤其有用:Pylint 有相当多的检查器在功能上重叠。 + +但是,Pylint 独有之处之一是能够强制执行更高级别的问题:例如,函数的行数或者类中方法的数量。 + +这些数字可能因项目而异,并且可能取决于开发团队的偏好。但是,一旦团队就参数达成一致,使用自动工具_强制化_这些参数非常有用。这是 Pylint 闪耀的地方。 + +### 配置 Pylint + +要以空配置开始,请将 `.pylintrc` 设置为 + + +``` +[MESSAGES CONTROL] + +disable=all +``` + +这将禁用所有 Pylint 消息。由于其中许多是冗余的,这是有道理的。在 Pylint 中, `message` 是一种特定的警告。 + +你可以通过运行 `pylint` 来检查所有消息都已关闭: + + +``` +`$ pylint ` +``` + +通常,向 `pylint` 命令行添加参数并不是一个好主意:配置 `pylint` 的最佳位置是 `.pylintrc`。为了使它做_一些_有用的事,我们需要启用一些消息。 + +要启用消息,在 `.pylintrc` 中的 `[MESSAGES CONTROL]` 下添加 + + +``` +enable=<message>, + +       ... +``` + +对于看起来有用的“消息”(Pylint 称之为不同类型的警告)。我最喜欢的包括 `too-many-lines`、`too-many-arguments` 和 `too-many-branches`。所有这些限制模块或函数的复杂性,并且无需进行人工操作即可客观地进行代码复杂度测量。。 + +_检查器_是_消息_的来源:每条消息只属于一个检查器。许多最有用的消息都在[设计检查器][5]下。 默认数字通常都不错,但要调整最大值也很简单:我们可以在 `.pylintrc` 中添加一个名为 `DESIGN` 的一段。 + + +``` +[DESIGN] + +max-args=7 + +max-locals=15 +``` + +另一个有用的消息来源是`重构`检查器。我已启用一些最喜欢的消息有 `consider-using-dict-comprehension`、`stop-iteration-return`(它会查找使用当 `return` 是正确的停止迭代的方式,而使用 `raise StopIteration` 的迭代器)和 `chained-comparison`,它将建议使用如 `1 <= x < 5`,而不是不太明显的 `1 <= x && 5 > 5` 的语法 + +最后是一个在性能方面昂贵的检查器,但它非常有用,是 `similarities`。它会查找不同部分代码之间的复制粘贴来强制执行“不要重复自己”(DRY 原则)。它只启用一条消息:`duplicate-code`。默认的 “minimum similarity lines” 设置为 “4”。可以使用 `.pylintrc` 将其设置为不同的值。 + +``` +[SIMILARITIES] + +min-similarity-lines=3 +``` + +### Pylint 使代码评审变得简单 + +如果你厌倦了需要指出一个类太复杂,或者两个不同的函数基本相同的代码评审,请将 Pylint 添加到你的[持续集成][6]配置中,只需_一次性_设置你项目的复杂性指导参数。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/python-pylint-introduction + +作者:[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/openstack_python_vim_2.jpg?itok=4fza48WU (OpenStack source code (Python) in VIM) +[2]: https://opensource.com/article/19/5/python-flake8 +[3]: https://opensource.com/article/19/5/python-black +[4]: https://opensource.com/article/19/5/python-mypy +[5]: https://pylint.readthedocs.io/en/latest/technical_reference/features.html#design-checker +[6]: https://opensource.com/business/15/7/six-continuous-integration-tools From 93cf068299e622ee776530497e8c68f71b598104 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 25 Oct 2019 08:57:53 +0800 Subject: [PATCH 143/800] translating --- ...23 Building container images with the ansible-bender tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191023 Building container images with the ansible-bender tool.md b/sources/tech/20191023 Building container images with the ansible-bender tool.md index 02aa64607b..2056e4e4b7 100644 --- a/sources/tech/20191023 Building container images with the ansible-bender tool.md +++ b/sources/tech/20191023 Building container images with the ansible-bender tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 22671af81b60352b1302a09cb798bf478509765a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 25 Oct 2019 17:01:04 +0800 Subject: [PATCH 144/800] PRF @geekpi --- ...int- Making your Python code consistent.md | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/translated/tech/20191021 Pylint- Making your Python code consistent.md b/translated/tech/20191021 Pylint- Making your Python code consistent.md index 224cb557a2..c940c12db1 100644 --- a/translated/tech/20191021 Pylint- Making your Python code consistent.md +++ b/translated/tech/20191021 Pylint- Making your Python code consistent.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Pylint: Making your Python code consistent) @@ -9,74 +9,68 @@ Pylint:让你的 Python 代码保持一致 ====== -当你想要争论代码复杂性时,Pylint 是你的朋友。 + +> 当你想要争论代码复杂性时,Pylint 是你的朋友。 + ![OpenStack source code \(Python\) in VIM][1] Pylint 是更高层级的 Python 样式强制程序。而 [flake8][2] 和 [black][3] 检查的是“本地”样式:换行位置、注释的格式、发现注释掉的代码或日志格式中的错误做法之类的问题。 -默认情况下,Pylint 非常激进。它将对一切提供强有力的意见,从检查是否实际实现声明的接口到重构重复代码,这对新用户来说可能会很多。一种温和地将其引入项目或团对的方法是先关闭_所有_检查器,然后逐个启用检查器。如果你已经在使用 flake8、black 和 [mypy][4],这尤其有用:Pylint 有相当多的检查器在功能上重叠。 +默认情况下,Pylint 非常激进。它将对每样东西都提供严厉的意见,从检查是否实际实现声明的接口到重构重复代码的可能性,这对新用户来说可能会很多。一种温和地将其引入项目或团队的方法是先关闭*所有*检查器,然后逐个启用检查器。如果你已经在使用 flake8、black 和 [mypy][4],这尤其有用:Pylint 有相当多的检查器和它们在功能上重叠。 但是,Pylint 独有之处之一是能够强制执行更高级别的问题:例如,函数的行数或者类中方法的数量。 -这些数字可能因项目而异,并且可能取决于开发团队的偏好。但是,一旦团队就参数达成一致,使用自动工具_强制化_这些参数非常有用。这是 Pylint 闪耀的地方。 +这些数字可能因项目而异,并且可能取决于开发团队的偏好。但是,一旦团队就参数达成一致,使用自动工具*强制化*这些参数非常有用。这是 Pylint 闪耀的地方。 ### 配置 Pylint 要以空配置开始,请将 `.pylintrc` 设置为 - ``` [MESSAGES CONTROL] disable=all ``` -这将禁用所有 Pylint 消息。由于其中许多是冗余的,这是有道理的。在 Pylint 中, `message` 是一种特定的警告。 - -你可以通过运行 `pylint` 来检查所有消息都已关闭: +这将禁用所有 Pylint 消息。由于其中许多是冗余的,这是有道理的。在 Pylint 中,`message` 是一种特定的警告。 +你可以通过运行 `pylint` 来确认所有消息都已关闭: ``` -`$ pylint ` +$ pylint ``` -通常,向 `pylint` 命令行添加参数并不是一个好主意:配置 `pylint` 的最佳位置是 `.pylintrc`。为了使它做_一些_有用的事,我们需要启用一些消息。 - -要启用消息,在 `.pylintrc` 中的 `[MESSAGES CONTROL]` 下添加 +通常,向 `pylint` 命令行添加参数并不是一个好主意:配置 `pylint` 的最佳位置是 `.pylintrc`。为了使它做*一些*有用的事,我们需要启用一些消息。 +要启用消息,在 `.pylintrc` 中的 `[MESSAGES CONTROL]` 下添加 ``` -enable=<message>, - -       ... +enable=, + ... ``` -对于看起来有用的“消息”(Pylint 称之为不同类型的警告)。我最喜欢的包括 `too-many-lines`、`too-many-arguments` 和 `too-many-branches`。所有这些限制模块或函数的复杂性,并且无需进行人工操作即可客观地进行代码复杂度测量。。 - -_检查器_是_消息_的来源:每条消息只属于一个检查器。许多最有用的消息都在[设计检查器][5]下。 默认数字通常都不错,但要调整最大值也很简单:我们可以在 `.pylintrc` 中添加一个名为 `DESIGN` 的一段。 +对于看起来有用的“消息”(Pylint 称之为不同类型的警告)。我最喜欢的包括 `too-many-lines`、`too-many-arguments` 和 `too-many-branches`。所有这些会限制模块或函数的复杂性,并且无需进行人工操作即可客观地进行代码复杂度测量。 +*检查器*是*消息*的来源:每条消息只属于一个检查器。许多最有用的消息都在[设计检查器][5]下。默认数字通常都不错,但要调整最大值也很简单:我们可以在 `.pylintrc` 中添加一个名为 `DESIGN` 的段。 ``` [DESIGN] - max-args=7 - max-locals=15 ``` -另一个有用的消息来源是`重构`检查器。我已启用一些最喜欢的消息有 `consider-using-dict-comprehension`、`stop-iteration-return`(它会查找使用当 `return` 是正确的停止迭代的方式,而使用 `raise StopIteration` 的迭代器)和 `chained-comparison`,它将建议使用如 `1 <= x < 5`,而不是不太明显的 `1 <= x && 5 > 5` 的语法 +另一个有用的消息来源是“重构”检查器。我已启用一些最喜欢的消息有 `consider-using-dict-comprehension`、`stop-iteration-return`(它会查找正确的停止迭代的方式是 `return` 而使用了 `raise StopIteration` 的迭代器)和 `chained-comparison`,它将建议使用如 `1 <= x < 5`,而不是不太明显的 `1 <= x && 5 > 5` 的语法。 -最后是一个在性能方面昂贵的检查器,但它非常有用,是 `similarities`。它会查找不同部分代码之间的复制粘贴来强制执行“不要重复自己”(DRY 原则)。它只启用一条消息:`duplicate-code`。默认的 “minimum similarity lines” 设置为 “4”。可以使用 `.pylintrc` 将其设置为不同的值。 +最后是一个在性能方面消耗很大的检查器,但它非常有用,就是 `similarities`。它会查找不同部分代码之间的复制粘贴来强制执行“不要重复自己”(DRY 原则)。它只启用一条消息:`duplicate-code`。默认的 “最小相似行数” 设置为 4。可以使用 `.pylintrc` 将其设置为不同的值。 ``` [SIMILARITIES] - min-similarity-lines=3 ``` ### Pylint 使代码评审变得简单 -如果你厌倦了需要指出一个类太复杂,或者两个不同的函数基本相同的代码评审,请将 Pylint 添加到你的[持续集成][6]配置中,只需_一次性_设置你项目的复杂性指导参数。 +如果你厌倦了需要指出一个类太复杂,或者两个不同的函数基本相同的代码评审,请将 Pylint 添加到你的[持续集成][6]配置中,并且只需要对项目复杂性准则的争论一次就行。 -------------------------------------------------------------------------------- @@ -85,7 +79,7 @@ via: https://opensource.com/article/19/10/python-pylint-introduction 作者:[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 e1359b1455f1f49b9915359522fc67df1f6af4ca Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 25 Oct 2019 17:01:38 +0800 Subject: [PATCH 145/800] PUB @geekpi https://linux.cn/article-11502-1.html --- .../20191021 Pylint- Making your Python code consistent.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191021 Pylint- Making your Python code consistent.md (98%) diff --git a/translated/tech/20191021 Pylint- Making your Python code consistent.md b/published/20191021 Pylint- Making your Python code consistent.md similarity index 98% rename from translated/tech/20191021 Pylint- Making your Python code consistent.md rename to published/20191021 Pylint- Making your Python code consistent.md index c940c12db1..80991142a5 100644 --- a/translated/tech/20191021 Pylint- Making your Python code consistent.md +++ b/published/20191021 Pylint- Making your Python code consistent.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11502-1.html) [#]: subject: (Pylint: Making your Python code consistent) [#]: via: (https://opensource.com/article/19/10/python-pylint-introduction) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From e0685a6a732d2f77b2cf315a5b2f35064e3196c8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 25 Oct 2019 17:14:55 +0800 Subject: [PATCH 146/800] PRF @lnrCoder --- ...to Get the Size of a Directory in Linux.md | 44 ++++++++----------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/translated/tech/20191022 How to Get the Size of a Directory in Linux.md b/translated/tech/20191022 How to Get the Size of a Directory in Linux.md index 2c05b4a8b6..15af1dd6cc 100644 --- a/translated/tech/20191022 How to Get the Size of a Directory in Linux.md +++ b/translated/tech/20191022 How to Get the Size of a Directory in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Get the Size of a Directory in Linux) @@ -10,25 +10,19 @@ 如何获取 Linux 中的目录大小 ====== -你应该已经注意用到,在 Linux 中使用 **[ls 命令][1]** 列出的目录内容中,目录的大小仅显示 4KB。 +你应该已经注意到,在 Linux 中使用 [ls 命令][1] 列出的目录内容中,目录的大小仅显示 4KB。这个大小正确吗?如果不正确,那它代表什么,又该如何获取 Linux 中的目录或文件夹大小?这是一个默认的大小,是用来存储磁盘上存储目录的元数据的大小。 -这个大小正确吗?如果不正确,那它代表什么,又该如何获取 Linux 中的目录或文件夹大小? - -这是一个默认的大小,用来存储磁盘上存储目录的元数据。 - -Linux 上有一些应用程序可以 **[获取目录的实际大小][2]**. - -但是,磁盘使用率(du)命令已被 Linux 管理员广泛使用。 +Linux 上有一些应用程序可以 [获取目录的实际大小][2]。其中,磁盘使用率(`du`)命令已被 Linux 管理员广泛使用。 我将向您展示如何使用各种选项获取文件夹大小。 ### 什么是 du 命令? -**[du 命令][3]** 表示 Disk Usage磁盘使用率。这是一个标准的 Unix 程序,用于估计当前工作目录中的文件空间使用情况。 +[du 命令][3] 表示 磁盘使用率Disk Usage。这是一个标准的 Unix 程序,用于估计当前工作目录中的文件空间使用情况。 它使用递归方式总结磁盘使用情况,以获取目录及其子目录的大小。 -如同我说的那样, 使用 ls 命令时,目录大小仅显示 4KB。参见下面的输出。 +如同我说的那样, 使用 `ls` 命令时,目录大小仅显示 4KB。参见下面的输出。 ``` $ ls -lh | grep ^d @@ -42,29 +36,27 @@ drwxr-xr-x 15 daygeek daygeek 4.0K Sep 29 21:32 Thanu_Photos ### 1) 在 Linux 上如何只获取父目录的大小 -使用以下 du 命令格式获取给定目录的总大小。在该示例中,我们将得到 **“/home/daygeek/Documents”** 目录的总大小 +使用以下 `du` 命令格式获取给定目录的总大小。在该示例中,我们将得到 `/home/daygeek/Documents` 目录的总大小。 ``` $ du -hs /home/daygeek/Documents -or +或 $ du -h --max-depth=0 /home/daygeek/Documents/ - 20G /home/daygeek/Documents ``` -**详细说明**: - - * du – 这是一个命令 - * h – 以人类可读的格式显示大小 (例如 1K 234M 2G) - * s – 仅显示每个参数的总数 - * –max-depth=N – 目录的打印级别 +详细说明: + * `du` – 这是一个命令 + * `-h` – 以易读的格式显示大小 (例如 1K 234M 2G) + * `-s` – 仅显示每个参数的总数 + * `--max-depth=N` – 目录的打印深度 ### 2) 在 Linux 上如何获取每个目录的大小 -使用以下 du 命令格式获取每个目录(包括子目录)的总大小。 +使用以下 `du` 命令格式获取每个目录(包括子目录)的总大小。 -在该示例中,我们将获得每个 **“/home/daygeek/Documents”** 目录及其子目录的总大小。 +在该示例中,我们将获得每个 `/home/daygeek/Documents` 目录及其子目录的总大小。 ``` $ du -h /home/daygeek/Documents/ | sort -rh | head -20 @@ -93,7 +85,7 @@ $ du -h /home/daygeek/Documents/ | sort -rh | head -20 ### 3) 在 Linux 上如何获取每个目录的摘要 -使用如下 du 命令格式仅获取每个目录的摘要。 +使用如下 `du` 命令格式仅获取每个目录的摘要。 ``` $ du -hs /home/daygeek/Documents/* | sort -rh | head -10 @@ -112,7 +104,7 @@ $ du -hs /home/daygeek/Documents/* | sort -rh | head -10 ### 4) 在 Linux 上如何获取每个目录的不含子目录的大小 -使用如下 du 命令格式来展示每个目录的总大小,不包括子目录。 +使用如下 `du` 命令格式来展示每个目录的总大小,不包括子目录。 ``` $ du -hS /home/daygeek/Documents/ | sort -rh | head -20 @@ -156,7 +148,7 @@ $ du -h --max-depth=1 /home/daygeek/Documents/ ### 6) 如何在 du 命令输出中获得总计 -如果要在 du 命令输出中获得总计,请使用以下 du 命令格式。 +如果要在 `du` 命令输出中获得总计,请使用以下 `du` 命令格式。 ``` $ du -hsc /home/daygeek/Documents/* | sort -rh | head -10 @@ -180,7 +172,7 @@ via: https://www.2daygeek.com/find-get-size-of-directory-folder-linux-disk-usage 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[lnrCoder](https://github.com/lnrCoder) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3beabc3f903c46069dc12194a3355157b0fc34d6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 25 Oct 2019 17:15:24 +0800 Subject: [PATCH 147/800] PUB @lnrCoder https://linux.cn/article-11503-1.html --- .../20191022 How to Get the Size of a Directory in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191022 How to Get the Size of a Directory in Linux.md (99%) diff --git a/translated/tech/20191022 How to Get the Size of a Directory in Linux.md b/published/20191022 How to Get the Size of a Directory in Linux.md similarity index 99% rename from translated/tech/20191022 How to Get the Size of a Directory in Linux.md rename to published/20191022 How to Get the Size of a Directory in Linux.md index 15af1dd6cc..d5566b7ec0 100644 --- a/translated/tech/20191022 How to Get the Size of a Directory in Linux.md +++ b/published/20191022 How to Get the Size of a Directory in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11503-1.html) [#]: subject: (How to Get the Size of a Directory in Linux) [#]: via: (https://www.2daygeek.com/find-get-size-of-directory-folder-linux-disk-usage-du-command/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 71938b93d49f38a6abe1b3e7591d138ba8112673 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Fri, 25 Oct 2019 20:45:17 +0800 Subject: [PATCH 148/800] translating --- ...e CMS Ghost 3.0 Released with New features for Publishers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md index 544ec7b3f2..60f5d8f421 100644 --- a/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md +++ b/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0679b4c90c88ed3fa326078604efa30ab871a4a7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 00:53:55 +0800 Subject: [PATCH 149/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191026=20How=20?= =?UTF-8?q?to=20Backup=20Configuration=20Files=20on=20a=20Remote=20System?= =?UTF-8?q?=20Using=20the=20Bash=20Script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191026 How to Backup Configuration Files on a Remote System Using the Bash Script.md --- ...n a Remote System Using the Bash Script.md | 550 ++++++++++++++++++ 1 file changed, 550 insertions(+) create mode 100644 sources/tech/20191026 How to Backup Configuration Files on a Remote System Using the Bash Script.md diff --git a/sources/tech/20191026 How to Backup Configuration Files on a Remote System Using the Bash Script.md b/sources/tech/20191026 How to Backup Configuration Files on a Remote System Using the Bash Script.md new file mode 100644 index 0000000000..c2d3b4397f --- /dev/null +++ b/sources/tech/20191026 How to Backup Configuration Files on a Remote System Using the Bash Script.md @@ -0,0 +1,550 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Backup Configuration Files on a Remote System Using the Bash Script) +[#]: via: (https://www.2daygeek.com/linux-bash-script-backup-configuration-files-remote-linux-system-server/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Backup Configuration Files on a Remote System Using the Bash Script +====== + +It is a good practice to backup configuration files before performing any activity on a Linux system. + +You can use this script if you are restarting the server after several days. + +If you are really concerned about the backup of your configuration files, it is advisable to use this script at least once a month. + +If something goes wrong, you can restore the system to normal by comparing configuration files based on the error message. + +Three **[bash scripts][1]** are included in this article, and each **[shell script][2]** is used for specific purposes. + +You can choose one based on your requirements. + +Everything in Linux is a file. If you make some wrong changes in the configuration file, it will cause the associated service to crash. + +So it is a good idea to take a backup of configuration files, and you do not have to worry about disk usage as this not consume much space. + +### What does this script do? + +This script backs up specific configuration files, moves them to another server, and finally deletes the backup on the remote machine. + +This script has six parts, and the details are below. + + * **Part-1:** Backup a General Configuration Files + * **Part-2:** Backup a wwn/wwpn number if the server is physical. + * **Part-3:** Backup an oracle related files if the system has an oracle user account. + * **Part-4:** Create a tar archive of backup configuration files. + * **Part-5:** Copy the tar archive to other server. + * **Part-6:** Remove Backup of configuration files on the remote system. + + + +**System details are as follows:** + + * **Server-A:** Local System/ JUMP System (local.2daygeek.com) + * **Server-B:** Remote System-1 (CentOS6.2daygeek.com) + * **Server-C:** Remote System-2 (CentOS7.2daygeek.com) + + + +### 1) Bash Script to Backup Configuration files on Remote Server + +Two scripts are included in this example, which allow you to back up important configurations files from one server to another (that is, from a remote server to a local server). + +For example, if you want to back up important configuration files from **“Server-B”** to **“Server-A”**. Use the following script. + +This is a real bash script that takes backup of configuration files on the remote server. + +``` +# vi /home/daygeek/shell-script/config-file.sh + +#!/bin/bash +mkdir /tmp/conf-bk-$(date +%Y%m%d) +cd /tmp/conf-bk-$(date +%Y%m%d) + +For General Configuration Files +hostname > hostname.out +uname -a > uname.out +uptime > uptime.out +cat /etc/hosts > hosts.out +/bin/df -h>df-h.out +pvs > pvs.out +vgs > vgs.out +lvs > lvs.out +/bin/ls -ltr /dev/mapper>mapper.out +fdisk -l > fdisk.out +cat /etc/fstab > fstab.out +cat /etc/exports > exports.out +cat /etc/crontab > crontab.out +cat /etc/passwd > passwd.out +ip link show > ip.out +/bin/netstat -in>netstat-in.out +/bin/netstat -rn>netstat-rn.out +/sbin/ifconfig -a>ifconfig-a.out +cat /etc/sysctl.conf > sysctl.out +sleep 10s + +#For Physical Server +vserver=$(lscpu | grep vendor | wc -l) +if [ $vserver -gt 0 ] +then +echo "$(hostname) is a VM" +else +systool -c fc_host -v | egrep "(Class Device path | port_name |port_state)" > systool.out +fi +sleep 10s + +#For Oracle DB Servers +if id oracle >/dev/null 2>&1; then +/usr/sbin/oracleasm listdisks>asm.out +/sbin/multipath -ll > mpath.out +/bin/ps -ef|grep pmon > pmon.out +else +echo "oracle user does not exist on server" +fi +sleep 10s + +#Create a tar archive +tar -cvf /tmp/$(hostname)-date +%Y%m%d.tar /tmp/conf-bk-$(date +%Y%m%d) +sleep 10s + +#Copy a tar archive to other server +sshpass -p 'password' scp /tmp/$(hostname)-date +%Y%m%d.tar Server-A:/home/daygeek/backup/ + +#Remove the backup config folder +cd .. +rm -Rf conf-bk-$(date +%Y%m%d) +rm $(hostname)-date +%Y%m%d.tar +rm config-file.sh +exit +``` + +This is a sub-script that pushes the above script to the target server. + +``` +# vi /home/daygeek/shell-script/conf-remote.sh + +#!/bin/bash +echo -e "Enter the Remote Server Name: \c" +read server +scp /home/daygeek/shell-script/config-file.sh $server:/tmp/ +ssh [email protected]${server} sh /home/daygeek/shell-script/config-file.sh +sleep 10s +exit +``` + +Finally run the bash script to achieve this. + +``` +# sh /home/daygeek/shell-script/conf-remote.sh + +Enter the Remote Server Name: CentOS6.2daygeek.com +config-file.sh 100% 1446 647.8KB/s 00:00 +CentOS6.2daygeek.com is a VM +oracle user does not exist on server +tar: Removing leading `/' from member names +/tmp/conf-bk-20191024/ +/tmp/conf-bk-20191024/pvs.out +/tmp/conf-bk-20191024/vgs.out +/tmp/conf-bk-20191024/ip.out +/tmp/conf-bk-20191024/netstat-in.out +/tmp/conf-bk-20191024/fstab.out +/tmp/conf-bk-20191024/ifconfig-a.out +/tmp/conf-bk-20191024/hostname.out +/tmp/conf-bk-20191024/crontab.out +/tmp/conf-bk-20191024/netstat-rn.out +/tmp/conf-bk-20191024/uptime.out +/tmp/conf-bk-20191024/uname.out +/tmp/conf-bk-20191024/mapper.out +/tmp/conf-bk-20191024/lvs.out +/tmp/conf-bk-20191024/exports.out +/tmp/conf-bk-20191024/df-h.out +/tmp/conf-bk-20191024/sysctl.out +/tmp/conf-bk-20191024/hosts.out +/tmp/conf-bk-20191024/passwd.out +/tmp/conf-bk-20191024/fdisk.out +``` + +Once you run the above script, use the ls command to check the copied tar archive file. + +``` +# ls -ltrh /home/daygeek/backup/*.tar + +-rw-r--r-- 1 daygeek daygeek 30K Oct 25 11:01 /home/daygeek/backup/CentOS6.2daygeek.com-20191024.tar +``` + +If it is moved successfully, you can find the contents of it without extracting it using the following tar command. + +``` +# tar -tvf /home/daygeek/backup/CentOS6.2daygeek.com-20191024.tar + +drwxr-xr-x root/root 0 2019-10-25 11:00 tmp/conf-bk-20191024/ +-rw-r--r-- root/root 96 2019-10-25 11:00 tmp/conf-bk-20191024/pvs.out +-rw-r--r-- root/root 92 2019-10-25 11:00 tmp/conf-bk-20191024/vgs.out +-rw-r--r-- root/root 413 2019-10-25 11:00 tmp/conf-bk-20191024/ip.out +-rw-r--r-- root/root 361 2019-10-25 11:00 tmp/conf-bk-20191024/netstat-in.out +-rw-r--r-- root/root 785 2019-10-25 11:00 tmp/conf-bk-20191024/fstab.out +-rw-r--r-- root/root 1375 2019-10-25 11:00 tmp/conf-bk-20191024/ifconfig-a.out +-rw-r--r-- root/root 21 2019-10-25 11:00 tmp/conf-bk-20191024/hostname.out +-rw-r--r-- root/root 457 2019-10-25 11:00 tmp/conf-bk-20191024/crontab.out +-rw-r--r-- root/root 337 2019-10-25 11:00 tmp/conf-bk-20191024/netstat-rn.out +-rw-r--r-- root/root 62 2019-10-25 11:00 tmp/conf-bk-20191024/uptime.out +-rw-r--r-- root/root 116 2019-10-25 11:00 tmp/conf-bk-20191024/uname.out +-rw-r--r-- root/root 210 2019-10-25 11:00 tmp/conf-bk-20191024/mapper.out +-rw-r--r-- root/root 276 2019-10-25 11:00 tmp/conf-bk-20191024/lvs.out +-rw-r--r-- root/root 0 2019-10-25 11:00 tmp/conf-bk-20191024/exports.out +-rw-r--r-- root/root 236 2019-10-25 11:00 tmp/conf-bk-20191024/df-h.out +-rw-r--r-- root/root 1057 2019-10-25 11:00 tmp/conf-bk-20191024/sysctl.out +-rw-r--r-- root/root 115 2019-10-25 11:00 tmp/conf-bk-20191024/hosts.out +-rw-r--r-- root/root 2194 2019-10-25 11:00 tmp/conf-bk-20191024/passwd.out +-rw-r--r-- root/root 1089 2019-10-25 11:00 tmp/conf-bk-20191024/fdisk.out +``` + +### 2) Bash Script to Backup Configuration files on Remote Server + +There are two scripts added in this example, which do the same as the above script, but this can be very useful if you have a JUMP server in your environment. + +This script allows you to copy important configuration files from your client system into the JUMP box + +For example, since we have already set up a password-less login, you have ten clients that can be accessed from the JUMP server. If so, use this script. + +This is a real bash script that takes backup of configuration files on the remote server. + +``` +# vi /home/daygeek/shell-script/config-file-1.sh + +#!/bin/bash +mkdir /tmp/conf-bk-$(date +%Y%m%d) +cd /tmp/conf-bk-$(date +%Y%m%d) + +For General Configuration Files +hostname > hostname.out +uname -a > uname.out +uptime > uptime.out +cat /etc/hosts > hosts.out +/bin/df -h>df-h.out +pvs > pvs.out +vgs > vgs.out +lvs > lvs.out +/bin/ls -ltr /dev/mapper>mapper.out +fdisk -l > fdisk.out +cat /etc/fstab > fstab.out +cat /etc/exports > exports.out +cat /etc/crontab > crontab.out +cat /etc/passwd > passwd.out +ip link show > ip.out +/bin/netstat -in>netstat-in.out +/bin/netstat -rn>netstat-rn.out +/sbin/ifconfig -a>ifconfig-a.out +cat /etc/sysctl.conf > sysctl.out +sleep 10s + +#For Physical Server +vserver=$(lscpu | grep vendor | wc -l) +if [ $vserver -gt 0 ] +then +echo "$(hostname) is a VM" +else +systool -c fc_host -v | egrep "(Class Device path | port_name |port_state)" > systool.out +fi +sleep 10s + +#For Oracle DB Servers +if id oracle >/dev/null 2>&1; then +/usr/sbin/oracleasm listdisks>asm.out +/sbin/multipath -ll > mpath.out +/bin/ps -ef|grep pmon > pmon.out +else +echo "oracle user does not exist on server" +fi +sleep 10s + +#Create a tar archieve +tar -cvf /tmp/$(hostname)-date +%Y%m%d.tar /tmp/conf-bk-$(date +%Y%m%d) +sleep 10s + +#Remove the backup config folder +cd .. +rm -Rf conf-bk-$(date +%Y%m%d) +rm config-file.sh +exit +``` + +This is a sub-script that pushes the above script to the target server. + +``` +# vi /home/daygeek/shell-script/conf-remote-1.sh + +#!/bin/bash +echo -e "Enter the Remote Server Name: \c" +read server +scp /home/daygeek/shell-script/config-file-1.sh $server:/tmp/ +ssh [email protected]${server} sh /home/daygeek/shell-script/config-file-1.sh +sleep 10s +echo -e "Re-Enter the Remote Server Name: \c" +read server +scp $server:/tmp/$server-date +%Y%m%d.tar /home/daygeek/backup/ +exit +``` + +Finally run the bash script to achieve this. + +``` +# sh /home/daygeek/shell-script/conf-remote-1.sh + +Enter the Remote Server Name: CentOS6.2daygeek.com +config-file.sh 100% 1446 647.8KB/s 00:00 +CentOS6.2daygeek.com is a VM +oracle user does not exist on server +tar: Removing leading `/' from member names +/tmp/conf-bk-20191025/ +/tmp/conf-bk-20191025/pvs.out +/tmp/conf-bk-20191025/vgs.out +/tmp/conf-bk-20191025/ip.out +/tmp/conf-bk-20191025/netstat-in.out +/tmp/conf-bk-20191025/fstab.out +/tmp/conf-bk-20191025/ifconfig-a.out +/tmp/conf-bk-20191025/hostname.out +/tmp/conf-bk-20191025/crontab.out +/tmp/conf-bk-20191025/netstat-rn.out +/tmp/conf-bk-20191025/uptime.out +/tmp/conf-bk-20191025/uname.out +/tmp/conf-bk-20191025/mapper.out +/tmp/conf-bk-20191025/lvs.out +/tmp/conf-bk-20191025/exports.out +/tmp/conf-bk-20191025/df-h.out +/tmp/conf-bk-20191025/sysctl.out +/tmp/conf-bk-20191025/hosts.out +/tmp/conf-bk-20191025/passwd.out +/tmp/conf-bk-20191025/fdisk.out +Enter the Server Name Once Again: CentOS6.2daygeek.com +CentOS6.2daygeek.com-20191025.tar +``` + +Once you run the above script, use the ls command to check the copied tar archive file. + +``` +# ls -ltrh /home/daygeek/backup/*.tar + +-rw-r--r-- 1 daygeek daygeek 30K Oct 25 11:44 /home/daygeek/backup/CentOS6.2daygeek.com-20191025.tar +``` + +If it is moved successfully, you can find the contents of it without extracting it using the following tar command. + +``` +# tar -tvf /home/daygeek/backup/CentOS6.2daygeek.com-20191025.tar + +drwxr-xr-x root/root 0 2019-10-25 11:43 tmp/conf-bk-20191025/ +-rw-r--r-- root/root 96 2019-10-25 11:43 tmp/conf-bk-20191025/pvs.out +-rw-r--r-- root/root 92 2019-10-25 11:43 tmp/conf-bk-20191025/vgs.out +-rw-r--r-- root/root 413 2019-10-25 11:43 tmp/conf-bk-20191025/ip.out +-rw-r--r-- root/root 361 2019-10-25 11:43 tmp/conf-bk-20191025/netstat-in.out +-rw-r--r-- root/root 785 2019-10-25 11:43 tmp/conf-bk-20191025/fstab.out +-rw-r--r-- root/root 1375 2019-10-25 11:43 tmp/conf-bk-20191025/ifconfig-a.out +-rw-r--r-- root/root 21 2019-10-25 11:43 tmp/conf-bk-20191025/hostname.out +-rw-r--r-- root/root 457 2019-10-25 11:43 tmp/conf-bk-20191025/crontab.out +-rw-r--r-- root/root 337 2019-10-25 11:43 tmp/conf-bk-20191025/netstat-rn.out +-rw-r--r-- root/root 61 2019-10-25 11:43 tmp/conf-bk-20191025/uptime.out +-rw-r--r-- root/root 116 2019-10-25 11:43 tmp/conf-bk-20191025/uname.out +-rw-r--r-- root/root 210 2019-10-25 11:43 tmp/conf-bk-20191025/mapper.out +-rw-r--r-- root/root 276 2019-10-25 11:43 tmp/conf-bk-20191025/lvs.out +-rw-r--r-- root/root 0 2019-10-25 11:43 tmp/conf-bk-20191025/exports.out +-rw-r--r-- root/root 236 2019-10-25 11:43 tmp/conf-bk-20191025/df-h.out +-rw-r--r-- root/root 1057 2019-10-25 11:43 tmp/conf-bk-20191025/sysctl.out +-rw-r--r-- root/root 115 2019-10-25 11:43 tmp/conf-bk-20191025/hosts.out +-rw-r--r-- root/root 2194 2019-10-25 11:43 tmp/conf-bk-20191025/passwd.out +-rw-r--r-- root/root 1089 2019-10-25 11:43 tmp/conf-bk-20191025/fdisk.out +``` + +### 3) Bash Script to Backup Configuration files on Multiple Linux Remote Systems + +This script allows you to copy important configuration files from multiple remote Linux systems into the JUMP box at the same time. + +This is a real bash script that takes backup of configuration files on the remote server. + +``` +# vi /home/daygeek/shell-script/config-file-2.sh + +#!/bin/bash +mkdir /tmp/conf-bk-$(date +%Y%m%d) +cd /tmp/conf-bk-$(date +%Y%m%d) + +For General Configuration Files +hostname > hostname.out +uname -a > uname.out +uptime > uptime.out +cat /etc/hosts > hosts.out +/bin/df -h>df-h.out +pvs > pvs.out +vgs > vgs.out +lvs > lvs.out +/bin/ls -ltr /dev/mapper>mapper.out +fdisk -l > fdisk.out +cat /etc/fstab > fstab.out +cat /etc/exports > exports.out +cat /etc/crontab > crontab.out +cat /etc/passwd > passwd.out +ip link show > ip.out +/bin/netstat -in>netstat-in.out +/bin/netstat -rn>netstat-rn.out +/sbin/ifconfig -a>ifconfig-a.out +cat /etc/sysctl.conf > sysctl.out +sleep 10s + +#For Physical Server +vserver=$(lscpu | grep vendor | wc -l) +if [ $vserver -gt 0 ] +then +echo "$(hostname) is a VM" +else +systool -c fc_host -v | egrep "(Class Device path | port_name |port_state)" > systool.out +fi +sleep 10s + +#For Oracle DB Servers +if id oracle >/dev/null 2>&1; then +/usr/sbin/oracleasm listdisks>asm.out +/sbin/multipath -ll > mpath.out +/bin/ps -ef|grep pmon > pmon.out +else +echo "oracle user does not exist on server" +fi +sleep 10s + +#Create a tar archieve +tar -cvf /tmp/$(hostname)-date +%Y%m%d.tar /tmp/conf-bk-$(date +%Y%m%d) +sleep 10s + +#Remove the backup config folder +cd .. +rm -Rf conf-bk-$(date +%Y%m%d) +rm config-file.sh +exit +``` + +This is a sub-script that pushes the above script to the target servers. + +``` +# vi /home/daygeek/shell-script/conf-remote-2.sh + +#!/bin/bash +for server in CentOS6.2daygeek.com CentOS7.2daygeek.com +do +scp /home/daygeek/shell-script/config-file-2.sh $server:/tmp/ +ssh [email protected]${server} sh /tmp/config-file-2.sh +sleep 10s +scp $server:/tmp/$server-date +%Y%m%d.tar /home/daygeek/backup/ +done +exit +``` + +Finally run the bash script to achieve this. + +``` +# sh /home/daygeek/shell-script/conf-remote-2.sh + +config-file-1.sh 100% 1444 416.5KB/s 00:00 +CentOS6.2daygeek.com is a VM +oracle user does not exist on server +tar: Removing leading `/' from member names +/tmp/conf-bk-20191025/ +/tmp/conf-bk-20191025/pvs.out +/tmp/conf-bk-20191025/vgs.out +/tmp/conf-bk-20191025/ip.out +/tmp/conf-bk-20191025/netstat-in.out +/tmp/conf-bk-20191025/fstab.out +/tmp/conf-bk-20191025/ifconfig-a.out +/tmp/conf-bk-20191025/hostname.out +/tmp/conf-bk-20191025/crontab.out +/tmp/conf-bk-20191025/netstat-rn.out +/tmp/conf-bk-20191025/uptime.out +/tmp/conf-bk-20191025/uname.out +/tmp/conf-bk-20191025/mapper.out +/tmp/conf-bk-20191025/lvs.out +/tmp/conf-bk-20191025/exports.out +/tmp/conf-bk-20191025/df-h.out +/tmp/conf-bk-20191025/sysctl.out +/tmp/conf-bk-20191025/hosts.out +/tmp/conf-bk-20191025/passwd.out +/tmp/conf-bk-20191025/fdisk.out +CentOS6.2daygeek.com-20191025.tar +config-file-1.sh 100% 1444 386.2KB/s 00:00 +CentOS7.2daygeek.com is a VM +oracle user does not exist on server +/tmp/conf-bk-20191025/ +/tmp/conf-bk-20191025/hostname.out +/tmp/conf-bk-20191025/uname.out +/tmp/conf-bk-20191025/uptime.out +/tmp/conf-bk-20191025/hosts.out +/tmp/conf-bk-20191025/df-h.out +/tmp/conf-bk-20191025/pvs.out +/tmp/conf-bk-20191025/vgs.out +/tmp/conf-bk-20191025/lvs.out +/tmp/conf-bk-20191025/mapper.out +/tmp/conf-bk-20191025/fdisk.out +/tmp/conf-bk-20191025/fstab.out +/tmp/conf-bk-20191025/exports.out +/tmp/conf-bk-20191025/crontab.out +/tmp/conf-bk-20191025/passwd.out +/tmp/conf-bk-20191025/ip.out +/tmp/conf-bk-20191025/netstat-in.out +/tmp/conf-bk-20191025/netstat-rn.out +/tmp/conf-bk-20191025/ifconfig-a.out +/tmp/conf-bk-20191025/sysctl.out +tar: Removing leading `/' from member names +CentOS7.2daygeek.com-20191025.tar +``` + +Once you run the above script, use the ls command to check the copied tar archive file. + +``` +# ls -ltrh /home/daygeek/backup/*.tar + +-rw-r--r-- 1 daygeek daygeek 30K Oct 25 12:37 /home/daygeek/backup/CentOS6.2daygeek.com-20191025.tar +-rw-r--r-- 1 daygeek daygeek 30K Oct 25 12:38 /home/daygeek/backup/CentOS7.2daygeek.com-20191025.tar +``` + +If it is moved successfully, you can find the contents of it without extracting it using the following tar command. + +``` +# tar -tvf /home/daygeek/backup/CentOS7.2daygeek.com-20191025.tar + +drwxr-xr-x root/root 0 2019-10-25 12:23 tmp/conf-bk-20191025/ +-rw-r--r-- root/root 21 2019-10-25 12:23 tmp/conf-bk-20191025/hostname.out +-rw-r--r-- root/root 115 2019-10-25 12:23 tmp/conf-bk-20191025/uname.out +-rw-r--r-- root/root 62 2019-10-25 12:23 tmp/conf-bk-20191025/uptime.out +-rw-r--r-- root/root 228 2019-10-25 12:23 tmp/conf-bk-20191025/hosts.out +-rw-r--r-- root/root 501 2019-10-25 12:23 tmp/conf-bk-20191025/df-h.out +-rw-r--r-- root/root 88 2019-10-25 12:23 tmp/conf-bk-20191025/pvs.out +-rw-r--r-- root/root 84 2019-10-25 12:23 tmp/conf-bk-20191025/vgs.out +-rw-r--r-- root/root 252 2019-10-25 12:23 tmp/conf-bk-20191025/lvs.out +-rw-r--r-- root/root 197 2019-10-25 12:23 tmp/conf-bk-20191025/mapper.out +-rw-r--r-- root/root 1088 2019-10-25 12:23 tmp/conf-bk-20191025/fdisk.out +-rw-r--r-- root/root 465 2019-10-25 12:23 tmp/conf-bk-20191025/fstab.out +-rw-r--r-- root/root 0 2019-10-25 12:23 tmp/conf-bk-20191025/exports.out +-rw-r--r-- root/root 451 2019-10-25 12:23 tmp/conf-bk-20191025/crontab.out +-rw-r--r-- root/root 2748 2019-10-25 12:23 tmp/conf-bk-20191025/passwd.out +-rw-r--r-- root/root 861 2019-10-25 12:23 tmp/conf-bk-20191025/ip.out +-rw-r--r-- root/root 455 2019-10-25 12:23 tmp/conf-bk-20191025/netstat-in.out +-rw-r--r-- root/root 505 2019-10-25 12:23 tmp/conf-bk-20191025/netstat-rn.out +-rw-r--r-- root/root 2072 2019-10-25 12:23 tmp/conf-bk-20191025/ifconfig-a.out +-rw-r--r-- root/root 449 2019-10-25 12:23 tmp/conf-bk-20191025/sysctl.out +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-bash-script-backup-configuration-files-remote-linux-system-server/ + +作者:[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/category/bash-script/ +[2]: https://www.2daygeek.com/category/shell-script/ From 2604b10920be723157e01248ab1e9f7653641db8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 00:54:37 +0800 Subject: [PATCH 150/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191025=204=20co?= =?UTF-8?q?ol=20new=20projects=20to=20try=20in=20COPR=20for=20October=2020?= =?UTF-8?q?19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md --- ...rojects to try in COPR for October 2019.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md diff --git a/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md b/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md new file mode 100644 index 0000000000..4f4717279d --- /dev/null +++ b/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for October 2019) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/) +[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) + +4 cool new projects to try in COPR for October 2019 +====== + +![][1] + +[COPR][2] is a collection 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. + +### Nu + +[Nu][4], or Nushell, is a shell inspired by PowerShell and modern CLI tools. Using a structured data based approach, Nu makes it easy to work with commands that output data, piping through other commands. The results are then displayed in tables that can be sorted or filtered easily and may serve as inputs for further commands. Finally, Nu provides several builtin commands, multiple shells and support for plugins. + +#### Installation instructions + +The [repo][5] currently provides Nu for Fedora 30, 31 and Rawhide. To install Nu, use these commands: + +``` +sudo dnf copr enable atim/nushell +sudo dnf install nushell +``` + +### NoteKit + +[NoteKit][6] is a program for note-taking. It supports Markdown for formatting notes, and the ability to create hand-drawn notes using mouse. In NoteKit, notes are sorted and organized in a tree structure. + +#### Installation instructions + +The [repo][7] currently provides NoteKit for Fedora 29, 30, 31 and Rawhide. To install NoteKit, use these commands: + +``` +sudo dnf copr enable lyessaadi/notekit +sudo dnf install notekit +``` + +### Crow Translate + +[Crow Translate][8] is a program for translating. It can translate text as well as speak both the input and result, and offers a command line interface as well. For translation, Crow Translate uses Google, Yandex or Bing translate API. + +#### Installation instructions + +The [repo][9] currently provides Crow Translate for Fedora 30, 31 and Rawhide, and for Epel 8. To install Crow Translate, use these commands: + +``` +sudo dnf copr enable faezebax/crow-translate +sudo dnf install crow-translate +``` + +### dnsmeter + +[dnsmeter][10] is a command-line tool for testing performance of a nameserver and its infrastructure. For this, it sends DNS queries and counts the replies, measuring various statistics. Among other features, dnsmeter can use different load steps, use payload from PCAP files and spoof sender addresses. + +#### Installation instructions + +The repo currently provides dnsmeter for Fedora 29, 30, 31 and Rawhide, and EPEL 7. To install dnsmeter, use these commands: + +``` +sudo dnf copr enable @dnsoarc/dnsmeter +sudo dnf install dnsmeter +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/ + +作者:[Dominik Turecek][a] +选题:[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/dturecek/ +[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/nushell/nushell +[5]: https://copr.fedorainfracloud.org/coprs/atim/nushell/ +[6]: https://github.com/blackhole89/notekit +[7]: https://copr.fedorainfracloud.org/coprs/lyessaadi/notekit/ +[8]: https://github.com/crow-translate/crow-translate +[9]: https://copr.fedorainfracloud.org/coprs/faezebax/crow-translate/ +[10]: https://github.com/DNS-OARC/dnsmeter From ef825947a9e63fdc727bcd2651679947caa2a424 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 00:56:29 +0800 Subject: [PATCH 151/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191025=20How=20?= =?UTF-8?q?I=20used=20the=20wget=20Linux=20command=20to=20recover=20lost?= =?UTF-8?q?=20images?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191025 How I used the wget Linux command to recover lost images.md --- ...et Linux command to recover lost images.md | 132 ++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 sources/tech/20191025 How I used the wget Linux command to recover lost images.md diff --git a/sources/tech/20191025 How I used the wget Linux command to recover lost images.md b/sources/tech/20191025 How I used the wget Linux command to recover lost images.md new file mode 100644 index 0000000000..08dd80f053 --- /dev/null +++ b/sources/tech/20191025 How I used the wget Linux command to recover lost images.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I used the wget Linux command to recover lost images) +[#]: via: (https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How I used the wget Linux command to recover lost images +====== +The story of the rise and fall of the Open Clip Art Library and the +birth of FreeSVG.org, a new library of communal artwork. +![White shoes on top of an orange tribal pattern][1] + +In 2004, the Open Clip Art Library (OCAL) was launched as a source of free illustrations for anyone to use, for any purpose, without requiring attribution or anything in return. This site was the open source world’s answer to the big stacks of clip art CDs on the shelf of every home office in the 1990s, and to the art dumps provided by the closed-source office and artistic software titles. + +In the beginning, the clip art library consisted mostly of work by a few contributors, but in 2010 it went live with a brand new interactive website, allowing anyone to create and contribute clip art with a vector illustration application. The site immediately garnered contributions from around the globe, and from all manner of free software and free culture projects. A special importer for this library was even included in [Inkscape][2]. + +However, in early 2019, the website hosting the Open Clip Art Library went offline with no warning or explanation. Its community, which had grown to number in the thousands, assumed at first that this was a temporary glitch. The site remained offline, however, for over six months without any clear explanation of what had happened. + +Rumors started to swell. The site was being updated ("There is years of technical debt to pay off," said site developer Jon Philips in an email). The site had fallen to rampant DDOS attacks, claimed a Twitter account. The maintainer had fallen prey to identity theft, another Twitter account claimed. Today, as of this writing, the site’s one and only remaining page declares that it is in "maintenance and protected mode," the meaning of which is unclear, except that users cannot access its content. + +### Recovering the commons + +Sites appear and disappear over the course of time, but the loss of the Open Clip Art Library was particularly surprising to its community because it was seen as a community project. Few community members understood that the site hosting the library had fallen into the hands of a single maintainer, so while the artwork in the library was owned by everyone due to its [Creative Commons 0 License][3], access to it was functionally owned by a single maintainer. And, because the site’s community kept in touch with one another through the site, that same maintainer effectively owned the community. + +When the site failed, the community lost access to its artwork as well as each other. And without the site, there was no community. + +Initially, everything on the site was blocked when it went down. After several months, though, users started recognizing that the site’s database was still online, which meant that a user could access an individual art file by entering its exact URL. In other words, you couldn’t navigate to the art file through clicking around a website, but if you already knew the address, then you could bring it up in your browser. Similarly, technical (or lazy) users realized it was also possible to "scrape" the site with an automated web browser like **wget**. + +The **wget** Linux command is _technically_ a web browser, although it doesn’t let you browse interactively the way you do with Firefox. Instead, **wget** goes out onto the internet and retrieves a file or a collection of files and downloads them to your hard drive. You can then open those files in Firefox or a text editor, or whatever application is most appropriate, and view the content. + +Usually, **wget** needs to know a specific file to fetch. If you’re on Linux or macOS with **wget** installed, you can try this process by downloading the index page for [example.com][4]: + + +``` +$ wget example.org/index.html +[...] +$ tail index.html + +<body><div> +    <h1>Example Domain</h1> +    <p>This domain is for illustrative examples in documents. +    You may use this domain in examples without permission.</p> +        <p><a href="[http://www.iana.org/domains/example"\>More][5] info</a></p> +</div></body></html> +``` + +To scrape the Open Clip Art Library, I used the **\--mirror** option, so that I could point **wget** to just the directory containing the artwork so it could download everything within that directory. This action resulted in four straight days (96 hours) of constant downloading, ending with an excess of 100,000 SVG files that had been contributed by over 5,000 community members. Unfortunately, the author of any file that did not have proper metadata was irrecoverable because this information was locked in inaccessible files in the database, but the CC0 license meant that this issue _technically_ didn’t matter (because no attribution is required with CC0 files). + +A casual analysis of the downloaded files also revealed that nearly 45,000 of them were copies of the same single file (the site’s logo). This was caused by redirects pointing to the site's logo (for reasons unknown), and careful parsing could extract the original destination. Another 96 hours, and all clip art posted on OCAL up to its last day was recovered: **a total of about 156,000 images.** + +SVG files tend to be small, but this is still an enormous amount of work that poses a few very real problems. First of all, several gigabytes of online storage would be needed so the artwork could be made available to its former community. Secondly, a means of searching the artwork would be necessary, because it’s just not realistic to browse through 55,000 files manually. + +It became apparent that what the community really needed was a platform. + +### Building a new platform + +For some time, the site [Public Domain Vectors][6] had been publishing vector art that was in the public domain. While it remains a popular site, open source users often used it only as a secondary source of art because most of the files there were in the EPS and AI formats, both of which are associated with Adobe. Both file formats can generally be converted to SVG but at a loss of features. + +When the Public Domain Vectors site’s maintainers (Vedran and Boris) heard about the loss of the Open Clip Art Library, they decided to create a site oriented toward the open source community. True to form, they chose the open source [Laravel][7] framework as the backend, which provided the site with an admin dashboard and user access. The framework, being robust and well-developed, also allowed them to respond quickly to bug reports and feature requests, and to upgrade the site as needed. The site they are building is called [FreeSVG.org][8], and is already a robust and thriving library of communal artwork. + +Since then they have been uploading all of the clip art from the Open Clip Art Library, and they're even diligently tagging and categorizing the art as they go. As creators of Public Domain Vectors, they are also contributing their own images in SVG format. Their aim is to become the primary resource for SVG images with a CC0 license on the internet. + +### Contributing + +The maintainers of [FreeSVG.org][8] are aware that they have inherited significant stewardship. They are working to title and describe all images on the site so that users can easily find artwork, and will provide this file to the community once it is ready, believing strongly that the metadata about the art belongs to the people that create and use the art as much as the art itself does. They're also aware that unforeseen circumstances can arise, so they create regular backups of their site and content, and intend to make the most recent backup available to the public, should their site fail. + +If you want to add to the Creative Commons content of [FreeSVG.org][9], then download [Inkscape][10] and start drawing. There’s plenty of public domain artwork out there in the world, like [historical advertisements][11], [tarot cards][12], and [storybooks][13] just waiting to be converted to SVG, so you can contribute even if you aren’t confident in your drawing skills. Visit the [FreeSVG forum][14] to connect with and support other contributors. + +The concept of the _commons_ is important. [Creative Commons benefits everyone][15], whether you’re a student, teacher, librarian, small business owner, or CEO. If you don’t contribute directly, then you can always help promote it. + +That’s a strength of free culture: It doesn’t just scale, it gets better when more people participate. + +### Hard lessons learned + +From the demise of the Open Clip Art Library to the rise of FreeSVG.org, the open culture community has learned several hard lessons. For posterity, here are the ones that I believe are most important. + +#### Maintain your metadata + +If you’re a content creator, help the archivists of the future and add metadata to your files. Most image, music, font, and video file formats can have EXIF data embedded into them, and others have metadata entry interfaces in the applications that create them. Be diligent in tagging your work with your name, website or public email, and license. + +#### Make copies + +Don’t assume that somebody else is doing backups. If you care about communal digital content, then back it up yourself, or else don’t count on having it available forever. The trope that _whatever’s uploaded to the internet is forever_ may be true, but that doesn’t mean it’s _available to you_ forever. If the Open Clip Art Library files hadn’t become secretly available again, it’s unlikely that anyone would have ever successfully uncovered all 55,000 images from random places on the web, or from personal stashes on people’s hard drives around the globe. + +#### Create external channels + +If a community is defined by a single website or physical location, then that community is as good as dissolved should it lose access to that space. If you’re a member of a community that’s driven by a single organization or site, you owe it to yourselves to share contact information with those you care about and to establish a channel for communication even when that site is not available. + +For example, [Opensource.com][16] itself maintains mailing lists and other off-site channels for its authors and correspondents to communicate with one another, with or without the intervention or even existence of the website. + +#### Free culture is worth working for + +The internet is sometimes seen as a lazy person’s social club. You can log on when you want and turn it off when you’re tired, and you can wander into whatever social circle you want. + +But in reality, free culture can be hard work. It’s not hard in the sense that it’s difficult to be a part of, but it’s something you have to work to maintain. If you ignore the community you’re in, then the community may wither and fade before you realize it. + +Take a moment to look around you and identify what communities you’re a part of, and if nothing else, tell someone that you appreciate what they bring to your life. And just as importantly, keep in mind that you’re contributing to the lives of your communities, too. + +Creative Commons held its Gl obal Summit a few weeks ago in Warsaw, with amazing international... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons + +作者:[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/tribal_pattern_shoes.png?itok=e5dSf2hS (White shoes on top of an orange tribal pattern) +[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners +[3]: https://creativecommons.org/share-your-work/public-domain/cc0/ +[4]: http://example.com +[5]: http://www.iana.org/domains/example"\>More +[6]: http://publicdomainvectors.org +[7]: https://github.com/viralsolani/laravel-adminpanel +[8]: https://freesvg.org +[9]: http://freesvg.org +[10]: http://inkscape.org +[11]: https://freesvg.org/drinking-coffee-vector-drawing +[12]: https://freesvg.org/king-of-swords-tarot-card +[13]: https://freesvg.org/space-pioneers-135-scene-vector-image +[14]: http://forum.freesvg.org/ +[15]: https://opensource.com/article/18/1/creative-commons-real-world +[16]: http://Opensource.com From 0da0a6bb40bf3612eabc8d2fdac6aad529229645 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 00:57:48 +0800 Subject: [PATCH 152/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191025=20Unders?= =?UTF-8?q?tanding=20system=20calls=20on=20Linux=20with=20strace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191025 Understanding system calls on Linux with strace.md --- ...nding system calls on Linux with strace.md | 452 ++++++++++++++++++ 1 file changed, 452 insertions(+) create mode 100644 sources/tech/20191025 Understanding system calls on Linux with strace.md diff --git a/sources/tech/20191025 Understanding system calls on Linux with strace.md b/sources/tech/20191025 Understanding system calls on Linux with strace.md new file mode 100644 index 0000000000..7628cfa545 --- /dev/null +++ b/sources/tech/20191025 Understanding system calls on Linux with strace.md @@ -0,0 +1,452 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding system calls on Linux with strace) +[#]: via: (https://opensource.com/article/19/10/strace) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Understanding system calls on Linux with strace +====== +Trace the thin layer between user processes and the Linux kernel with +strace. +![Hand putting a Linux file folder into a drawer][1] + +A system call is a programmatic way a program requests a service from the kernel, and **strace** is a powerful tool that allows you to trace the thin layer between user processes and the Linux kernel. + +To understand how an operating system works, you first need to understand how system calls work. One of the main functions of an operating system is to provide abstractions to user programs. + +An operating system can roughly be divided into two modes: + + * **Kernel mode:** A privileged and powerful mode used by the operating system kernel + * **User mode:** Where most user applications run + + + +Users mostly work with command-line utilities and graphical user interfaces (GUI) to do day-to-day tasks. System calls work silently in the background, interfacing with the kernel to get work done. + +System calls are very similar to function calls, which means they accept and work on arguments and return values. The only difference is that system calls enter a kernel, while function calls do not. Switching from user space to kernel space is done using a special [trap][2] mechanism. + +Most of this is hidden away from the user by using system libraries (aka **glibc** on Linux systems). Even though system calls are generic in nature, the mechanics of issuing a system call are very much machine-dependent. + +This article explores some practical examples by using some general commands and analyzing the system calls made by each command using **strace**. These examples use Red Hat Enterprise Linux, but the commands should work the same on other Linux distros: + + +``` +[root@sandbox ~]# cat /etc/redhat-release +Red Hat Enterprise Linux Server release 7.7 (Maipo) +[root@sandbox ~]# +[root@sandbox ~]# uname -r +3.10.0-1062.el7.x86_64 +[root@sandbox ~]# +``` + +First, ensure that the required tools are installed on your system. You can verify whether **strace** is installed using the RPM command below; if it is, you can check the **strace** utility version number using the **-V** option: + + +``` +[root@sandbox ~]# rpm -qa | grep -i strace +strace-4.12-9.el7.x86_64 +[root@sandbox ~]# +[root@sandbox ~]# strace -V +strace -- version 4.12 +[root@sandbox ~]# +``` + +If that doesn't work, install **strace** by running: + + +``` +`yum install strace` +``` + +For the purpose of this example, create a test directory within **/tmp** and create two files using the **touch** command using: + + +``` +[root@sandbox ~]# cd /tmp/ +[root@sandbox tmp]# +[root@sandbox tmp]# mkdir testdir +[root@sandbox tmp]# +[root@sandbox tmp]# touch testdir/file1 +[root@sandbox tmp]# touch testdir/file2 +[root@sandbox tmp]# +``` + +(I used the **/tmp** directory because everybody has access to it, but you can choose another directory if you prefer.) + +Verify that the files were created using the **ls** command on the **testdir** directory: + + +``` +[root@sandbox tmp]# ls testdir/ +file1  file2 +[root@sandbox tmp]# +``` + +You probably use the **ls** command every day without realizing system calls are at work underneath it. There is abstraction at play here; here's how this command works: + + +``` +`Command-line utility -> Invokes functions from system libraries (glibc) -> Invokes system calls` +``` + +The **ls** command internally calls functions from system libraries (aka **glibc**) on Linux. These libraries invoke the system calls that do most of the work. + +If you want to know which functions were called from the **glibc** library, use the **ltrace** command followed by the regular **ls testdir/** command: + + +``` +`ltrace ls testdir/` +``` + +If **ltrace** is not installed, install it by entering: + + +``` +`yum install ltrace` +``` + +A bunch of output will be dumped to the screen; don't worry about it—just follow along. Some of the important library functions from the output of the **ltrace** command that are relevant to this example include: + + +``` +opendir("testdir/")                                  = { 3 } +readdir({ 3 })                                       = { 101879119, "." } +readdir({ 3 })                                       = { 134, ".." } +readdir({ 3 })                                       = { 101879120, "file1" } +strlen("file1")                                      = 5 +memcpy(0x1665be0, "file1\0", 6)                      = 0x1665be0 +readdir({ 3 })                                       = { 101879122, "file2" } +strlen("file2")                                      = 5 +memcpy(0x166dcb0, "file2\0", 6)                      = 0x166dcb0 +readdir({ 3 })                                       = nil +closedir({ 3 })                       +``` + +By looking at the output above, you probably can understand what is happening. A directory called **testdir** is being opened by the **opendir** library function, followed by calls to the **readdir** function, which is reading the contents of the directory. At the end, there is a call to the **closedir** function, which closes the directory that was opened earlier. Ignore the other **strlen** and **memcpy** functions for now. + +You can see which library functions are being called, but this article will focus on system calls that are invoked by the system library functions. + +Similar to the above, to understand what system calls are invoked, just put **strace** before the **ls testdir** command, as shown below. Once again, a bunch of gibberish will be dumped to your screen, which you can follow along with here: + + +``` +[root@sandbox tmp]# strace ls testdir/ +execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +brk(NULL)                               = 0x1f12000 +<<< truncated strace output >>> +write(1, "file1  file2\n", 13file1  file2 +)          = 13 +close(1)                                = 0 +munmap(0x7fd002c8d000, 4096)            = 0 +close(2)                                = 0 +exit_group(0)                           = ? ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +The output on the screen after running the **strace** command was simply system calls made to run the **ls** command. Each system call serves a specific purpose for the operating system, and they can be broadly categorized into the following sections: + + * Process management system calls + * File management system calls + * Directory and filesystem management system calls + * Other system calls + + + +An easier way to analyze the information dumped onto your screen is to log the output to a file using **strace**'s handy **-o** flag. Add a suitable file name after the **-o** flag and run the command again: + + +``` +[root@sandbox tmp]# strace -o trace.log ls testdir/ +file1  file2 +[root@sandbox tmp]# +``` + +This time, no output dumped to the screen—the **ls** command worked as expected by showing the file names and logging all the output to the file **trace.log**. The file has almost 100 lines of content just for a simple **ls** command: + + +``` +[root@sandbox tmp]# ls -l trace.log +-rw-r--r--. 1 root root 7809 Oct 12 13:52 trace.log +[root@sandbox tmp]# +[root@sandbox tmp]# wc -l trace.log +114 trace.log +[root@sandbox tmp]# +``` + +Take a look at the first line in the example's trace.log: + + +``` +`execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0` +``` + + * The first word of the line, **execve**, is the name of a system call being executed. + * The text within the parentheses is the arguments provided to the system call. + * The number after the **=** sign (which is **0** in this case) is a value returned by the **execve** system call. + + + +The output doesn't seem too intimidating now, does it? And you can apply the same logic to understand other lines. + +Now, narrow your focus to the single command that you invoked, i.e., **ls testdir**. You know the directory name used by the command **ls**, so why not **grep** for **testdir** within your **trace.log** file and see what you get? Look at each line of the results in detail: + + +``` +[root@sandbox tmp]# grep testdir trace.log +execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +stat("testdir/", {st_mode=S_IFDIR|0755, st_size=32, ...}) = 0 +openat(AT_FDCWD, "testdir/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 +[root@sandbox tmp]# +``` + +Thinking back to the analysis of **execve** above, can you tell what this system call does? + + +``` +`execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0` +``` + +You don't need to memorize all the system calls or what they do, because you can refer to documentation when you need to. Man pages to the rescue! Ensure the following package is installed before running the **man** command: + + +``` +[root@sandbox tmp]# rpm -qa | grep -i man-pages +man-pages-3.53-5.el7.noarch +[root@sandbox tmp]# +``` + +Remember that you need to add a **2** between the **man** command and the system call name. If you read **man**'s man page using **man man**, you can see that section 2 is reserved for system calls. Similarly, if you need information on library functions, you need to add a **3** between **man** and the library function name. + +The following are the manual's section numbers and the types of pages they contain: + + +``` +1\. Executable programs or shell commands +2\. System calls (functions provided by the kernel) +3\. Library calls (functions within program libraries) +4\. Special files (usually found in /dev) +``` + +Run the following **man** command with the system call name to see the documentation for that system call: + + +``` +`man 2 execve` +``` + +As per the **execve** man page, this executes a program that is passed in the arguments (in this case, that is **ls**). There are additional arguments that can be provided to **ls**, such as **testdir** in this example. Therefore, this system call just runs **ls** with **testdir** as the argument: + + +``` +'execve - execute program' + +'DESCRIPTION +       execve()  executes  the  program  pointed to by filename' +``` + +The next system call, named **stat**, uses the **testdir** argument: + + +``` +`stat("testdir/", {st_mode=S_IFDIR|0755, st_size=32, ...}) = 0` +``` + +Use **man 2 stat** to access the documentation. **stat** is the system call that gets a file's status—remember that everything in Linux is a file, including a directory. + +Next, the **openat** system call opens **testdir.** Keep an eye on the **3** that is returned. This is a file description, which will be used by later system calls: + + +``` +`openat(AT_FDCWD, "testdir/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3` +``` + +So far, so good. Now, open the **trace.log** file and go to the line following the **openat** system call. You will see the **getdents** system call being invoked, which does most of what is required to execute the **ls testdir** command. Now, **grep getdents** from the **trace.log** file: + + +``` +[root@sandbox tmp]# grep getdents trace.log +getdents(3, /* 4 entries */, 32768)     = 112 +getdents(3, /* 0 entries */, 32768)     = 0 +[root@sandbox tmp]# +``` + +The **getdents** man page describes it as **get directory entries**, which is what you want to do. Notice that the argument for **getdents** is **3**, which is the file descriptor from the **openat** system call above. + +Now that you have the directory listing, you need a way to display it in your terminal. So, **grep** for another system call, **write**, which is used to write to the terminal, in the logs: + + +``` +[root@sandbox tmp]# grep write trace.log +write(1, "file1  file2\n", 13)          = 13 +[root@sandbox tmp]# +``` + +In these arguments, you can see the file names that will be displayed: **file1** and **file2**. Regarding the first argument (**1**), remember in Linux that, when any process is run, three file descriptors are opened for it by default. Following are the default file descriptors: + + * 0 - Standard input + * 1 - Standard out + * 2 - Standard error + + + +So, the **write** system call is displaying **file1** and **file2** on the standard display, which is the terminal, identified by **1**. + +Now you know which system calls did most of the work for the **ls testdir/** command. But what about the other 100+ system calls in the **trace.log** file? The operating system has to do a lot of housekeeping to run a process, so a lot of what you see in the log file is process initialization and cleanup. Read the entire **trace.log** file and try to understand what is happening to make the **ls** command work. + +Now that you know how to analyze system calls for a given command, you can use this knowledge for other commands to understand what system calls are being executed. **strace** provides a lot of useful command-line flags to make it easier for you, and some of them are described below. + +By default, **strace** does not include all system call information. However, it has a handy **-v verbose** option that can provide additional information on each system call: + + +``` +`strace -v ls testdir` +``` + +It is good practice to always use the **-f** option when running the **strace** command. It allows **strace** to trace any child processes created by the process currently being traced: + + +``` +`strace -f ls testdir` +``` + +Say you just want the names of system calls, the number of times they ran, and the percentage of time spent in each system call. You can use the **-c** flag to get those statistics: + + +``` +`strace -c ls testdir/` +``` + +Suppose you want to concentrate on a specific system call, such as focusing on **open** system calls and ignoring the rest. You can use the **-e** flag followed by the system call name: + + +``` +[root@sandbox tmp]# strace -e open ls testdir +open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 +open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 +file1  file2 ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +What if you want to concentrate on more than one system call? No worries, you can use the same **-e** command-line flag with a comma between the two system calls. For example, to see the **write** and **getdents** systems calls: + + +``` +[root@sandbox tmp]# strace -e write,getdents ls testdir +getdents(3, /* 4 entries */, 32768)     = 112 +getdents(3, /* 0 entries */, 32768)     = 0 +write(1, "file1  file2\n", 13file1  file2 +)          = 13 ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +The examples so far have traced explicitly run commands. But what about commands that have already been run and are in execution? What, for example, if you want to trace daemons that are just long-running processes? For this, **strace** provides a special **-p** flag to which you can provide a process ID. + +Instead of running a **strace** on a daemon, take the example of a **cat** command, which usually displays the contents of a file if you give a file name as an argument. If no argument is given, the **cat** command simply waits at a terminal for the user to enter text. Once text is entered, it repeats the given text until a user presses Ctrl+C to exit. + +Run the **cat** command from one terminal; it will show you a prompt and simply wait there (remember **cat** is still running and has not exited): + + +``` +`[root@sandbox tmp]# cat` +``` + +From another terminal, find the process identifier (PID) using the **ps** command: + + +``` +[root@sandbox ~]# ps -ef | grep cat +root      22443  20164  0 14:19 pts/0    00:00:00 cat +root      22482  20300  0 14:20 pts/1    00:00:00 grep --color=auto cat +[root@sandbox ~]# +``` + +Now, run **strace** on the running process with the **-p** flag and the PID (which you found above using **ps**). After running **strace**, the output states what the process was attached to along with the PID number. Now, **strace** is tracing the system calls made by the **cat** command. The first system call you see is **read**, which is waiting for input from 0, or standard input, which is the terminal where the **cat** command ran: + + +``` +[root@sandbox ~]# strace -p 22443 +strace: Process 22443 attached +read(0, +``` + +Now, move back to the terminal where you left the **cat** command running and enter some text. I entered **x0x0** for demo purposes. Notice how **cat** simply repeated what I entered; hence, **x0x0** appears twice. I input the first one, and the second one was the output repeated by the **cat** command: + + +``` +[root@sandbox tmp]# cat +x0x0 +x0x0 +``` + +Move back to the terminal where **strace** was attached to the **cat** process. You now see two additional system calls: the earlier **read** system call, which now reads **x0x0** in the terminal, and another for **write**, which wrote **x0x0** back to the terminal, and again a new **read**, which is waiting to read from the terminal. Note that Standard input (**0**) and Standard out (**1**) are both in the same terminal: + + +``` +[root@sandbox ~]# strace -p 22443 +strace: Process 22443 attached +read(0, "x0x0\n", 65536)                = 5 +write(1, "x0x0\n", 5)                   = 5 +read(0, +``` + +Imagine how helpful this is when running **strace** against daemons to see everything it does in the background. Kill the **cat** command by pressing Ctrl+C; this also kills your **strace** session since the process is no longer running. + +If you want to see a timestamp against all your system calls, simply use the **-t** option with **strace**: + + +``` +[root@sandbox ~]#strace -t ls testdir/ + +14:24:47 execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +14:24:47 brk(NULL)                      = 0x1f07000 +14:24:47 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2530bc8000 +14:24:47 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +14:24:47 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +``` + +What if you want to know the time spent between system calls? **strace** has a handy **-r** command that shows the time spent executing each system call. Pretty useful, isn't it? + + +``` +[root@sandbox ~]#strace -r ls testdir/ + +0.000000 execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +0.000368 brk(NULL)                 = 0x1966000 +0.000073 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb6b1155000 +0.000047 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +0.000119 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +``` + +### Conclusion + +The **strace** utility is very handy for understanding system calls on Linux. To learn about its other command-line flags, please refer to the man pages and online documentation. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/strace + +作者:[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://en.wikipedia.org/wiki/Trap_(computing) From 7f3a48d07406b4b6859cfd43ea0ed950cf3a6749 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 00:58:25 +0800 Subject: [PATCH 153/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191025=20Why=20?= =?UTF-8?q?I=20made=20the=20switch=20from=20Mac=20to=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191025 Why I made the switch from Mac to Linux.md --- ...Why I made the switch from Mac to Linux.md | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 sources/tech/20191025 Why I made the switch from Mac to Linux.md diff --git a/sources/tech/20191025 Why I made the switch from Mac to Linux.md b/sources/tech/20191025 Why I made the switch from Mac to Linux.md new file mode 100644 index 0000000000..342a6c9bd3 --- /dev/null +++ b/sources/tech/20191025 Why I made the switch from Mac to Linux.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I made the switch from Mac to Linux) +[#]: via: (https://opensource.com/article/19/10/why-switch-mac-linux) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Why I made the switch from Mac to Linux +====== +Thanks to a lot of open source developers, it's a lot easier to use +Linux as your daily driver than ever before. +![Hands programming][1] + +I have been a huge Mac fan and power user since I started in IT in 2004. But a few months ago—for several reasons—I made the commitment to shift to Linux as my daily driver. This isn't my first attempt at fully adopting Linux, but I'm finding it easier than ever. Here is what inspired me to switch. + +### My first attempt at Linux on the desktop + +I remember looking up at the projector, and it looking back at me. Neither of us understood why it wouldn't display. VGA cords were fully seated with no bent pins to be found. I tapped every key combination I could think of to signal my laptop that it's time to get over the stage fright. + +I ran Linux in college as an experiment. My manager in the IT department was an advocate for the many flavors out there, and as I grew more confident in desktop support and writing scripts, I wanted to learn more about it. IT was far more interesting to me than my computer science degree program, which felt so abstract and theoretical—"who cares about binary search trees?" I thought—while our sysadmin team's work felt so tangible. + +This story ends with me logging into a Windows workstation to get through my presentation for class, and marks the end of my first attempt at Linux as my day-to-day OS. I admired its flexibility, but compatibility was lacking. I would occasionally write a script that SSHed into a box to run another script, but I stopped using Linux on a day-to-day basis. + +### A fresh look at Linux compatibility + +When I decided to give Linux another go a few months ago, I expected more of the same compatibility nightmare, but I couldn't be more wrong. + +Right after the installation process completed, I plugged in a USB-C hub to see what I'd gotten myself into. Everything worked immediately. The HDMI-connected extra-wide monitor popped up as a mirrored display to my laptop screen, and I easily adjusted it to be a second monitor. The USB-connected webcam, which is essential to my [work-from-home life][2], showed up as a video with no trouble at all. Even my Mac charger, which was already plugged into the hub since I've been using a Mac, started to charge my very-not-Mac hardware. + +My positive experience was probably related to some updates to USB-C, which received some needed attention in 2018 to compete with other OS experiences. As [Phoronix explained][3]: + +> "The USB Type-C interface offers an 'Alternate Mode' extension for non-USB signaling and the biggest user of this alternate mode in the specification is allowing DisplayPort support. Besides DP, another alternate mode is the Thunderbolt 3 support. The DisplayPort Alt Mode supports 4K and even 8Kx4K video output, including multi-channel audio. +> +> "While USB-C alternate modes and DisplayPort have been around for a while now and is common in the Windows space, the mainline Linux kernel hasn't supported this functionality. Fortunately, thanks to Intel, that is now changing." + +Thinking beyond ports, a quick scroll through the [Linux on Laptops][4] hardware options shows a much more complete set of choices than I experienced in the early 2000s. + +This has been a night-and-day difference from my first attempt at Linux adoption, and it's one I welcome with open arms. + +### Breaking out of Apple's walled garden + +Using Linux has added new friction to my daily workflow, and I love that it has. + +My Mac workflow was seamless: hop on an iPad in the morning, write down some thoughts on what my day will look like, and start to read some articles in Safari; slide over my iPhone to continue reading; then log into my MacBook where years of fine-tuning have worked out how all these pieces connect. Keyboard shortcuts are built into my brain; user experiences are as they've mostly always been. It's wildly comfortable. + +That comfort comes with a cost. I largely forgot how my environment functions, and I couldn't answer questions I wanted to answer. Did I customize some [PLIST files][5] to get that custom shortcut, or did I remember to check it into [my dotfiles][6]? How did I get so dependent on Safari and Chrome when Firefox has a much better mission? Or why, specifically, won't I use an Android-based phone instead of my i-things? + +On that note, I've often thought about shifting to an Android-based phone, but I would lose the connection I have across all these devices and the little conveniences designed into the ecosystem. For instance, I wouldn't be able to type in searches from my iPhone for the Apple TV or share a password with AirDrop with my other Apple-based friends. Those features are great benefits of homogeneous device environments, and it is remarkable engineering. That said, these conveniences come at a cost of feeling trapped by the ecosystem. + +I love being curious about how devices work. I want to be able to explain environmental configurations that make it fun or easy to use my systems, but I also want to see what adding some friction does for my perspective. To paraphrase [Marcel Proust][7], "The real voyage of discovery consists not in seeking new lands but seeing with new eyes." My use of technology has been so convenient that I stopped being curious about how it all works. Linux gives me an opportunity to see with new eyes again. + +### Inspired by you + +All of the above is reason enough to explore Linux, but I have also been inspired by you. While all operating systems are welcome in the open source community, Opensource.com writers' and readers' joy for Linux is infectious. It inspired me to dive back in, and I'm enjoying the journey. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/why-switch-mac-linux + +作者:[Matthew Broberg][a] +选题:[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/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/article/19/8/rules-remote-work-sanity +[3]: https://www.phoronix.com/scan.php?page=news_item&px=Linux-USB-Type-C-Port-DP-Driver +[4]: https://www.linux-laptop.net/ +[5]: https://fileinfo.com/extension/plist +[6]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[7]: https://www.age-of-the-sage.org/quotations/proust_having_seeing_with_new_eyes.html From 958bd5c19fa024e10d53d3a70531dbd707e28c7e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 00:59:16 +0800 Subject: [PATCH 154/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191024=204=20wa?= =?UTF-8?q?ys=20developers=20can=20have=20a=20say=20in=20what=20agile=20lo?= =?UTF-8?q?oks=20like?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191024 4 ways developers can have a say in what agile looks like.md --- ...can have a say in what agile looks like.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20191024 4 ways developers can have a say in what agile looks like.md diff --git a/sources/tech/20191024 4 ways developers can have a say in what agile looks like.md b/sources/tech/20191024 4 ways developers can have a say in what agile looks like.md new file mode 100644 index 0000000000..1c247c622e --- /dev/null +++ b/sources/tech/20191024 4 ways developers can have a say in what agile looks like.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways developers can have a say in what agile looks like) +[#]: via: (https://opensource.com/article/19/10/ways-developers-what-agile) +[#]: author: (Clement Verna https://opensource.com/users/cverna) + +4 ways developers can have a say in what agile looks like +====== +How agile is implemented—versus imposed—plays a big role in what +developers gain from it. +![Person on top of a mountain, arm raise][1] + +Agile has become the default way of developing software; sometimes, it seems like every organization is doing (or wants to do) agile. But, instead of trying to change their culture to become agile, many companies try to impose frameworks like scrum onto developers, looking for a magic recipe to increase productivity. This has unfortunately created some bad experiences and leads developers to feel like agile is something they would rather avoid. This is a shame because, when it's done correctly, developers and their projects benefit from becoming involved in it. Here are four reasons why. + +### Agile, back to the basics + +The first way for developers to be unafraid of agile is to go back to its basics and remember what agile is really about. Many people see agile as a synonym for scrum, kanban, story points, or daily stand-ups. While these are important parts of the [agile umbrella][2], this perception takes people away from the original spirit of agile. + +Going back to agile's origins means looking at the [Agile Manifesto][3], and what I believe is its most important part, the introduction: + +> We are uncovering better ways of developing software by doing it and helping others do it. + +I'm a believer in continuous improvement, and this sentence resonates with me. It emphasizes the importance of having a [growth mindset][4] while being a part of an agile team. In fact, I think this outlook is a solution to most of the problems a team may face when adopting agile. + +Scrum is not working for your team? Right, let's discover a better way of organizing it. You are working in a distributed team across multiple timezones, and having a daily standup is not ideal? No problem, let's find a better way to communicate and share information. + +Agile is all about flexibility and being able to adapt to change, so be open-minded and creative to discover better ways of collaborating and developing software. + +### Agile metrics as a way to improve, not control + +Indeed, agile is about adopting and embracing change. Metrics play an important part in this process, as they help the team determine if it is heading in the right direction. As an agile developer, you want metrics to provide the data your team needs to support its decisions, including whether it should change directions. This process of learning from facts and experience is known as empiricism, and it is well-illustrated by the three pillars of agile. + +![Three pillars of agile][5] + +Unfortunately, in most of the teams I've worked with, metrics were used by project management as an indicator of the team's performance, which causes people on the team to be afraid of implementing changes or to cut corners to meet expectations. + +In order to avoid those outcomes, developers need to be in control of their team's metrics. They need to know exactly what is measured and, most importantly, why it's being measured. Once the team has a good understanding of those factors, it will be easier for them to try new practices and measure their impact. + +Rather than using metrics to measure your team's performance, engage with management to find a better way to define what success means to your team. + +### Developer power is in the team + +As a member of an agile team, you have more power than you think to help build a team that has a great impact. The [Toyota Production System][6] recognized this long ago. Indeed, Toyota considered that employees, not processes, were the key to building great products. + +This means that, even if a team uses the best process possible, if the people on the team are not comfortable working with each other, there is a high chance that the team will fail. As a developer, invest time to build trust inside your team and to understand what motivates its members. + +If you are curious about how to do this, I recommend reading Alexis Monville's book [_Changing Your Team from the Inside_][7]. + +### Making developer work visible + +A big part of any agile methodology is to make information and work visible; this is often referred to as an [information radiator][8]. In his book [_Teams of Teams_][9], Gen. Stanley McChrystal explains how the US Army had to transform itself from an organization that was optimized on productivity to one optimized to adapt. What we learn from his book is that the world in which we live has changed. The problem of becoming more productive was mostly solved at the end of the 20th century, and the challenge that companies now face is how to adapt to a world in constant evolution. + +![A lot of sticky notes on a whiteboard][10] + +I particularly like Gen. McChrystal's explanation of how he created a powerful information radiator. When he took charge of the [Joint Special Operations Command][11], Gen. McChrystal began holding a daily call with his high commanders to discuss and plan future operations. He soon realized that this was not optimal and instead started running 90-minute briefings every morning for 7,000 people around the world. This allowed every task force to acquire the knowledge necessary to accomplish their missions and made them aware of other task forces' assignments and situations. Gen. McChrystal refers to this as "shared consciousness." + +So, as a developer, how can you help build a shared consciousness in your team? Start by simply sharing what you are working on and/or plan to work on and get curious about what your colleagues are doing. + +* * * + +If you're using agile in your development organization, what do you think are its main benefits? And if you aren't using agile, what barriers are holding your team back? Please share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/ways-developers-what-agile + +作者:[Clement Verna][a] +选题:[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/cverna +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/developer_mountain_cloud_top_strong_win.jpg?itok=axK3EX-q (Person on top of a mountain, arm raise) +[2]: https://confluence.huit.harvard.edu/display/WGAgile/2014/07/01/The+Agile+Umbrella +[3]: https://agilemanifesto.org/ +[4]: https://www.edglossary.org/growth-mindset/ +[5]: https://opensource.com/sites/default/files/uploads/3pillarsofagile.png (Three pillars of agile) +[6]: https://en.wikipedia.org/wiki/Toyota_Production_System#Respect_for_people +[7]: https://leanpub.com/changing-your-team-from-the-inside#packages +[8]: https://www.agilealliance.org/glossary/information-radiators/ +[9]: https://www.mcchrystalgroup.com/insights-2/teamofteams/ +[10]: https://opensource.com/sites/default/files/uploads/stickynotes.jpg (A lot of sticky notes on a whiteboard) +[11]: https://en.wikipedia.org/wiki/Joint_Special_Operations_Command From c0c9123101459ba7ed7f01d65c6f124820dd9a1b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 00:59:53 +0800 Subject: [PATCH 155/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191024=20My=20L?= =?UTF-8?q?inux=20Story:=20Why=20introduce=20people=20to=20the=20Raspberry?= =?UTF-8?q?=20Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md --- ...hy introduce people to the Raspberry Pi.md | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 sources/tech/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md diff --git a/sources/tech/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md b/sources/tech/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md new file mode 100644 index 0000000000..c9e32f85e2 --- /dev/null +++ b/sources/tech/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Linux Story: Why introduce people to the Raspberry Pi) +[#]: via: (https://opensource.com/article/19/10/new-linux-open-source-users) +[#]: author: (RolandBerberich https://opensource.com/users/rolandberberich) + +My Linux Story: Why introduce people to the Raspberry Pi +====== +Learn why I consider the Raspberry Pi one of our best opportunities to +invite more people to the open source community. +![Team of people around the world][1] + +My first steps into Linux happened around 2003 or 2004 when I was a student. The experiment lasted an hour or two. Being used to Windows, I was confused and quickly frustrated at having to learn the most basic stuff again. + +By 2018, I was curious enough to try Ubuntu before settling on Fedora 29 on an unused laptop, and to get a Pi3B+ and Pi4, both currently running Raspbian. What changed? Well, first of all, Linux has certainly changed. Also, by that time I was not only curious but more patient than my younger self by that time. Reflecting on this experience, I reckon that patience to overcome the perceived usability gap is the key to Linux satisfaction. Just one year later, I can confidently say I am productive in both Windows as well as (my) Linux environments. + +This experience has brought up two questions. First, why are more people not using Linux (or other open source software)? Second, what can the savvier among us could do to improve these numbers? Of course, these questions assume the open source world has advantages over the more common alternatives, and that some of us would go to ends of the Earth to convince the non-believers. + +Believe it or not, this last issue is one of the problems. By far, I am not a Linux pro. I would rather describe myself as a "competent user" able to solve a few issues by myself. Admittedly, internet search engines are my friend, but step-by-step I accumulated the expertise and confidence to work outside the omnipresent Windows workspace. + +On the other hand, how technophile is the standard user? Probably not at all. The internet is full of "have you switched it on" examples to illustrate the incompetence of users. Now, imagine someone suggests you are incompetent and then offers (unsolicited) advice on how to improve. How well would you take that, especially if you consider yourself "operational" (meaning that you have no problems at work or surfing the web)? + +### Introduce them to the Raspberry Pi + +Overcoming this initial barrier is crucial, and we cannot do so with a superiority complex. Personally, I consider the Raspberry Pi one of our best opportunities to invite more people to the open source community. The Raspberry Pi’s simplicity combined with its versatility and affordability could entice more people to get and use one. + +I recently upgraded my Pi3B+ to the new Pi4B, and with the exception of my usual reference manager, this unit fully replaces my (Windows) desktop. My next step is to use a Pi3B+ as a media center and gaming console. The point is that if we want people to use open source software, we need to make it accessible for everyday tasks such as the above. Realizing it isn't that difficult will do more for user numbers than aloof superiority from open source advocates, or Linux clubs at university. + +It is one thing to keep preaching the many advantages of open source, but a more convincing experience can only be a personal one. Obviously, people will realize the cost advantage of, say, a Pi4 running Linux over a standard supermarket Windows PC. And humans are curious. An affordable gadget where mistakes are easy to correct (clone your card, it is not hard) will entice more and more users to fiddle around and get first hand IT knowledge. Maybe none of us will be an expert (I count myself among this crowd) but the least that will happen is wider use of open source software with users realizing that is is a viable alternative. + +With curiosity rampant, a Pi club at school or university could make younger workers competent in Linux. Some of these workers perhaps will bring their SD card to work, plug it into any Raspberry Pi provided, and start being productive. Imagine the potential savings in regards to IT. Imagine the flexibility of choosing any space in the office and having your own work environment with you. + +Wider use of open source solutions will not only add flexibility. Targetting mainly Windows environments, your systems will be somewhat safer from attacks, and with more demand, more resources will pour into further development. Consequently, this trend will force propriety software developers to up their game, which is also good for users of course. + +In summary, my point is to reflect as a community how we can improve our resource base by following my journey. We can only do so by starting early, accessibly, and affordably, and by showing that open source is a real alternative for any professional application on a daily basis. + +There are lots of non-code ways to contribute to open source: Here are three alternatives. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/new-linux-open-source-users + +作者:[RolandBerberich][a] +选题:[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/rolandberberich +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_global_people_gis_location.png?itok=Rl2IKo12 (Team of people around the world) From 12ebecaa9768d63adf978cea79f6ae286ec2614f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:00:32 +0800 Subject: [PATCH 156/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191024=20Get=20?= =?UTF-8?q?sorted=20with=20sort=20at=20the=20command=20line?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191024 Get sorted with sort at the command line.md --- ...et sorted with sort at the command line.md | 250 ++++++++++++++++++ 1 file changed, 250 insertions(+) create mode 100644 sources/tech/20191024 Get sorted with sort at the command line.md diff --git a/sources/tech/20191024 Get sorted with sort at the command line.md b/sources/tech/20191024 Get sorted with sort at the command line.md new file mode 100644 index 0000000000..ff291f39bc --- /dev/null +++ b/sources/tech/20191024 Get sorted with sort at the command line.md @@ -0,0 +1,250 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get sorted with sort at the command line) +[#]: via: (https://opensource.com/article/19/10/get-sorted-sort) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Get sorted with sort at the command line +====== +Reorganize your data in a format that makes sense to you—right from the +Linux, BSD, or Mac terminal—with the sort command. +![Coding on a computer][1] + +If you've ever used a spreadsheet application, then you know that rows can be sorted by the contents of a column. For instance, if you have a list of expenses, you might want to sort them by date or by ascending price or by category, and so on. If you're comfortable using a terminal, you may not want to have to use a big office application just to sort text data. And that's exactly what the [**sort**][2] command is for. + +### Installing + +You don't need to install **sort** because it's invariably included on any [POSIX][3] system. On most Linux systems, the **sort** command is bundled in a collection of utilities from the GNU organization. On other POSIX systems, such as BSD and Mac, the default **sort** command is not from GNU, so some options may differ. I'll attempt to account for both GNU and BSD implementations in this article. + +### Sort lines alphabetically + +The **sort** command, by default, looks at the first character of each line of a file and outputs each line in ascending alphabetic order. In the event that two characters on multiple lines are the same, it considers the next character. For example: + + +``` +$ cat distro.list +Slackware +Fedora +Red Hat Enterprise Linux +Ubuntu +Arch +1337 +Mint +Mageia +Debian +$ sort distro.list +1337 +Arch +Debian +Fedora +Mageia +Mint +Red Hat Enterprise Linux +Slackware +Ubuntu +``` + +Using **sort** doesn't change the original file. Sort is a filter, so if you want to preserve your data in its sorted form, you must redirect the output using either **>** or **tee**: + + +``` +$ sort distro.list | tee distro.sorted +1337 +Arch +Debian +[...] +$ cat distro.sorted +1337 +Arch +Debian +[...] +``` + +### Sort by column + +Complex data sets sometimes need to be sorted by something other than the first letter of each line. Imagine, for instance, a list of animals and each one's species and genus, and each "field" (a "cell" in a spreadsheet) is defined by a predictable delimiter character. This is such a common data format for spreadsheet exports that the CSV (comma-separated values) file extension exists to identify such files (although a CSV file doesn't have to be comma-separated, nor does a delimited file have to use the CSV extension to be valid and usable). Consider this example data set: + + +``` +Aptenodytes;forsteri;Miller,JF;1778;Emperor +Pygoscelis;papua;Wagler;1832;Gentoo +Eudyptula;minor;Bonaparte;1867;Little Blue +Spheniscus;demersus;Brisson;1760;African +Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Eudyptes;chrysocome;Viellot;1816;Southern Rockhopper +Torvaldis;linux;Ewing,L;1996;Tux +``` + +Given this sample data set, you can use the **\--field-separator** (use **-t** on BSD and Mac—or on GNU to reduce typing) option to set the delimiting character to a semicolon (because this example uses semicolons instead of commas, but it could use any character), and use the **\--key** (**-k** on BSD and Mac or on GNU to reduce typing) option to define which field to sort by. For example, to sort by the second field (starting at 1, not 0) of each line: + + +``` +sort --field-separator=";" --key=2 +Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +Spheniscus;demersus;Brisson;1760;African +Aptenodytes;forsteri;Miller,JF;1778;Emperor +Torvaldis;linux;Ewing,L;1996;Tux +Eudyptula;minor;Bonaparte;1867;Little Blue +Pygoscelis;papua;Wagler;1832;Gentoo +``` + +That's somewhat difficult to read, but Unix is famous for its _pipe_ method of constructing commands, so you can use the **column** command to "prettify" the output. Using GNU **column**: + + +``` +$ sort --field-separator=";" \ +\--key=2 penguins.list | \ +column --table --separator ";" +Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed +Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper +Spheniscus   demersus    Brisson        1760  African +Aptenodytes  forsteri    Miller,JF      1778  Emperor +Torvaldis    linux       Ewing,L        1996  Tux +Eudyptula    minor       Bonaparte      1867  Little Blue +Pygoscelis   papua       Wagler         1832  Gentoo +``` + +Slightly more cryptic to the new user (but shorter to type), the command options on BSD and Mac: + + +``` +$ sort -t ";" \ +-k2 penguins.list | column -t -s ";" +Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed +Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper +Spheniscus   demersus    Brisson        1760  African +Aptenodytes  forsteri    Miller,JF      1778  Emperor +Torvaldis    linux       Ewing,L        1996  Tux +Eudyptula    minor       Bonaparte      1867  Little Blue +Pygoscelis   papua       Wagler         1832  Gentoo +``` + +The **key** definition doesn't have to be set to **2**, of course. Any existing field may be used as the sorting key. + +### Reverse sort + +You can reverse the order of a sorted list with the **\--reverse** (**-r** on BSD or Mac or GNU for brevity): + + +``` +$ sort --reverse alphabet.list +z +y +x +w +[...] +``` + +You can achieve the same result by piping the output of a normal sort through [tac][4]. + +### Sorting by month (GNU only) + +In a perfect world, everyone would write dates according to the ISO 8601 standard: year, month, day. It's a logical method of specifying a unique date, and it's easy for computers to understand. And yet quite often, humans use other means of identifying dates, including months with pretty arbitrary names. + +Fortunately, the GNU **sort** command accounts for this and is able to sort correctly by month name. Use the **\--month-sort** (**-M**) option: + + +``` +$ cat month.list +November +October +September +April +[...] +$ sort --month-sort month.list +January +February +March +April +May +[...] +November +December +``` + +Months may be identified by their full name or some portion of their names. + +### Human-readable numeric sort (GNU only) + +Another common point of confusion between humans and computers is groups of numbers. For instance, humans often write "1024 kilobytes" as "1KB" because it's easier and quicker for the human brain to parse "1KB" than "1024" (and it gets easier the larger the number becomes). To a computer, though, a string such as 9KB is larger than, for instance, 1MB (even though 9KB is only a fraction of a megabyte). The GNU **sort** command provides the **\--human-numeric-sort** (**-h**) option to help parse these values correctly. + + +``` +$ cat sizes.list +2M +12MB +1k +9k +900 +7000 +$ sort --human-numeric-sort +900 +7000 +1k +9k +2M +12MB +``` + +There are some inconsistencies. For example, 16,000 bytes is greater than 1KB, but **sort** fails to recognize that: + + +``` +$ cat sizes0.list +2M +12MB +16000 +1k +$ sort -h sizes0.list +16000 +1k +2M +12MB +``` + +Logically, 16,000 should be written 16KB in this context, so GNU **sort** is not entirely to blame. As long as you are sure that your numbers are consistent, the **\--human-numeric-sort** can help parse human-readable numbers in a computer-friendly way. + +### Randomized sort (GNU only) + +Sometimes utilities provide the option to do the opposite of what they're meant to do. In a way, it makes no sense for a **sort** command to have the ability to "sort" a file randomly. Then again, the workflow of the command makes it a convenient feature to have. You _could_ use a different command, like [**shuf**][5], or you could just add an option to the command you're using. Whether it's bloat or ingenious UX design, the GNU **sort** command provides the means to sort a file arbitrarily. + +The purest form of arbitrary sorting is the **\--random-sort** or **-R** option (not to be confused with the **-r** option, which is short for **\--reverse**). + + +``` +$ sort --random-sort alphabet.list +d +m +p +a +[...] +``` + +You can run a random sort multiple times on a file for different results each time. + +### Sorted + +There are many more features available with the **sort** GNU and BSD commands, so spend some time getting to know the options. You'll be surprised at how flexible **sort** can be, especially when it's combined with other Unix utilities. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/get-sorted-sort + +作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://en.wikipedia.org/wiki/Sort_(Unix) +[3]: https://en.wikipedia.org/wiki/POSIX +[4]: https://opensource.com/article/19/9/tac-command +[5]: https://www.gnu.org/software/coreutils/manual/html_node/shuf-invocation.html From 64d139fac6f60913dd1ba53ac4b261e6e5dda42d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:01:18 +0800 Subject: [PATCH 157/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20How=20?= =?UTF-8?q?to=20program=20with=20Bash:=20Loops?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191023 How to program with Bash- Loops.md --- sources/tech/20191023 How to program with Bash- Loops.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191023 How to program with Bash- Loops.md b/sources/tech/20191023 How to program with Bash- Loops.md index b32748b397..e582bda447 100644 --- a/sources/tech/20191023 How to program with Bash- Loops.md +++ b/sources/tech/20191023 How to program with Bash- Loops.md @@ -4,7 +4,7 @@ [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to program with Bash: Loops) -[#]: via: (https://opensource.com/article/19/10/programming-bash-part-3) +[#]: via: (https://opensource.com/article/19/10/programming-bash-loops) [#]: author: (David Both https://opensource.com/users/dboth) How to program with Bash: Loops @@ -334,7 +334,7 @@ Many years ago, despite being familiar with other shell languages and Perl, I ma -------------------------------------------------------------------------------- -via: https://opensource.com/article/19/10/programming-bash-part-3 +via: https://opensource.com/article/19/10/programming-bash-loops 作者:[David Both][a] 选题:[lujun9972][b] From 171bf88fb44930c46b65487bc9658b5792e2442a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:02:01 +0800 Subject: [PATCH 158/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191022=20How=20?= =?UTF-8?q?to=20program=20with=20Bash:=20Logical=20operators=20and=20shell?= =?UTF-8?q?=20expansions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md --- ...ogram with Bash- Logical operators and shell expansions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md index 2d92d9a66c..024af38122 100644 --- a/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md +++ b/sources/tech/20191022 How to program with Bash- Logical operators and shell expansions.md @@ -4,7 +4,7 @@ [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to program with Bash: Logical operators and shell expansions) -[#]: via: (https://opensource.com/article/19/10/programming-bash-part-2) +[#]: via: (https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions) [#]: author: (David Both https://opensource.com/users/dboth) How to program with Bash: Logical operators and shell expansions @@ -482,7 +482,7 @@ The third article in this series will explore the use of loops for performing va -------------------------------------------------------------------------------- -via: https://opensource.com/article/19/10/programming-bash-part-2 +via: https://opensource.com/article/19/10/programming-bash-logical-operators-shell-expansions 作者:[David Both][a] 选题:[lujun9972][b] From 9f6b7df977e84caedc30c91e392da4500f6b61df Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:02:37 +0800 Subject: [PATCH 159/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191025=20NICT?= =?UTF-8?q?=20successfully=20demos=20petabit-per-second=20network=20node?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191025 NICT successfully demos petabit-per-second network node.md --- ...y demos petabit-per-second network node.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/talk/20191025 NICT successfully demos petabit-per-second network node.md diff --git a/sources/talk/20191025 NICT successfully demos petabit-per-second network node.md b/sources/talk/20191025 NICT successfully demos petabit-per-second network node.md new file mode 100644 index 0000000000..0439e944c9 --- /dev/null +++ b/sources/talk/20191025 NICT successfully demos petabit-per-second network node.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NICT successfully demos petabit-per-second network node) +[#]: via: (https://www.networkworld.com/article/3447857/nict-successfully-demos-petabit-per-second-network-node.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +NICT successfully demos petabit-per-second network node +====== +One-petabit-per-second signals could send 8K resolution video to 10 million people simultaneously, researchers say. Japan’s national research agency says it has just successfully demoed a networked version of it. +Thinkstock + +Petabit-class networks will support more than 100-times the capacity of existing networks, according to scientists who have just demonstrated an optical switching rig designed to handle the significant amounts of data that would pour through future petabit cables. One petabit is equal to a thousand terabits, or a million gigabits. + +Researchers at the [National Institute of Information and Communications Technology][1] (NICT) in Japan routed signals with capacities ranging from 10 terabits per second to 1 petabit per second through their node. Those kinds of capacities, which could send 8K resolution video to 10 million people simultaneously, are going to be needed for future broadband video streaming and Internet of Things at scale, researchers believe. In-data-center applications and backhaul could benefit. + +“Petabit-class transmission requires petabit-class switching technologies to manage and reliably direct large amounts of data through complex networks, NICT said in a [press release][2]. “Up to now, such technologies have been beyond reach, because the existing approaches are limited by complexity and, or performance.” + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +In this case, NICT used “large-scale” spatial optical switching with spatial-division multiplexing to build its node. Three types of multicore fibers were incorporated, all with different capacities, in order to represent different scenarios, like metropolitan or regional networks. MEMS technology, too, was incorporated. That’s equipment built on micro-electro-mechanical systems, or a kind of merging of micrometer-measured, nanoscale electronics devices with moving parts. + +NICT says that within its testing, it was able to not only perform the one petabit optical switching, but also was able to run a redundant configuration at one petabit per second. That’s to support network failures such as breaks in the fiber. It used 22-core fiber for both of those scenarios. + +Additionally, NICT branched the one petabit signals into other multicore optical fibers with miscellaneous capacities. It used 22-Core Fiber, 7-Core Fiber and 3-Mode Fiber. Finally, running at a slower 10 terabits per second, it managed that lower capacity signal within the capacious one petabit per second network— NICT says that that kind of application would be most suitable for regional networks, whereas the other scenarios apply best to metro networks. + +Actual, straight, petabit-class transmissions over fiber have been achieved before. In 2015 NICT was involved in the successful testing of a 2.15 petabit per second signal over a single 22-core fiber. Then, it said, [in a press release][4], that it was making “progress to the practical realization of an over one petabit per second optical fiber.” (Typical [real-world limits][5], right now, include 26.2 terabits, in an experiment, over a transatlantic cable, and an 800 gigabit fiber data center solution Ciena is pitching.) + +**More about SD-WAN**: [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][6] • [How to pick an off-site data-backup method][7] •  [SD-Branch: What it is and why you’ll need it][8] • [What are the options for security SD-WAN?][9] + +In 2018 NICT said, in another [news release][10], that it had tested a petabit transmission over thinner 4-core, 3-mode fiber with a diameter of 0.16 mm (0.006 inches): There’s an advantage to getting the cladding diameter as small as possible—smaller diameter fiber has less propensity to mechanical stress damage, such as bending or pulling, NICT explains. It can also be connected less problematically if it has a similar diameter to existing fiber cables, already run. + +“This is a major step forward towards practical petabit-class backbone networks,” NICT says of its current 22-core fiber, one petabit per second switch capacity experiments. These will end up being “backbone optical networks capable of supporting the increasing requirements of internet services,” it says. + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447857/nict-successfully-demos-petabit-per-second-network-node.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://www.nict.go.jp/en/about/index.html +[2]: https://www.nict.go.jp/en/press/2019/10/17-1.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.nict.go.jp/en/press/2015/10/13-1.html +[5]: https://www.networkworld.com/article/3374545/data-center-fiber-to-jump-to-800-gigabits-in-2019.html +[6]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html +[7]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html +[8]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html +[9]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html +[10]: https://www.nict.go.jp/en/press/2018/11/21-1.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world From dc343b3c8ee01033479302c01771ce41846066f2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:03:15 +0800 Subject: [PATCH 160/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191024=20The=20?= =?UTF-8?q?evolution=20to=20Secure=20Access=20Service=20Edge=20(SASE)=20is?= =?UTF-8?q?=20being=20driven=20by=20necessity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191024 The evolution to Secure Access Service Edge (SASE) is being driven by necessity.md --- ...dge (SASE) is being driven by necessity.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 sources/talk/20191024 The evolution to Secure Access Service Edge (SASE) is being driven by necessity.md diff --git a/sources/talk/20191024 The evolution to Secure Access Service Edge (SASE) is being driven by necessity.md b/sources/talk/20191024 The evolution to Secure Access Service Edge (SASE) is being driven by necessity.md new file mode 100644 index 0000000000..2990d249cb --- /dev/null +++ b/sources/talk/20191024 The evolution to Secure Access Service Edge (SASE) is being driven by necessity.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The evolution to Secure Access Service Edge (SASE) is being driven by necessity) +[#]: via: (https://www.networkworld.com/article/3448276/the-evolution-to-secure-access-service-edge-sase-is-being-driven-by-necessity.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +The evolution to Secure Access Service Edge (SASE) is being driven by necessity +====== +The users and devices are everywhere. As a result, secure access services also need to be everywhere. +MF3d / Getty Images + +The WAN consists of network and security stacks, both of which have gone through several phases of evolution. Initially, we began with the router, introduced WAN optimization, and then edge SD-WAN. From the perspective of security, we have a number of firewall generations that lead to network security-as-a-service. In today’s scenario, we have advanced to another stage that is more suited to today’s environment. This stage is the convergence of network and security in the cloud. + +For some, the network and security trends have been thought of in terms of silos. However, the new market category of secure access service edge (SASE) challenges this ideology and recommends a converged cloud-delivered secure access service edge. + +Gartner proposes that the future of the network and network security is in the cloud. This is similar to what [Cato Networks][1] has been offering for quite some time – the convergence of networking and security-as-a-service capabilities into a private, global cloud. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +We all know; when we employ anything new, there will be noise. Therefore, it's difficult to dissect the right information and understand who is doing what and if SASE actually benefits your organization. And this is the prime motive of this post. However, before we proceed, I have a question for you. + +Will combining the comprehensive WAN capabilities with comprehensive network security functions be the next evolution? In the following sections, I would like to discuss each of the previous network and security stages to help you answer the same question. So, first, let’s begin with networking. + +### The networking era + +### The router + +We started with the router at the WAN edge, configured with routing protocols. Routing protocols do not make a decision on global information and are limited to the routing loop restrictions. This restricts the number of paths that the application traffic can take. + +For a redundant WAN design, we need the complex BGP tuning to the load balance between the border edges along with the path attributes. This is because these path attributes may not choose the best performing path. By and large, the shortest path is not necessarily the best path. + +**[ Now read [20 hot jobs ambitious IT pros should shoot for][3]. ]** + +The WAN edge exhibited a rigid network topology that applications had to fit into. Security was provided by pushing the traffic from one appliance to another. With the passage of time, we began to see the rise of real-time voice and video traffic which are highly sensitive to latency and jitter. Hence, the WAN optimization was a welcomed feature. + +### WAN optimization + +The basic WAN optimization includes a range of TCP optimizations and basic in-line compression. The advanced WAN optimization includes deduplication, file-based caching and protocol-specific optimizations. This, indeed, helped in managing the latency-sensitive applications and applications where large amounts of data must be transferred across the WAN. + +However, it was a complex deployment. A WAN optimization physical appliance was needed at both ends of the connection and had to be used for all the applications. At that time, it was an all or nothing approach and you couldn’t roll out WAN optimization per application. Besides, it had no effect on the remote workers where the users were not located in the office. + +Subsequently, SD-WAN started to appear in 2015. During this year, I was consulting an Azure migration and attempting to [create my own DIY SD-WAN][4] _[Disclaimer: the author works for Network Insight]_ with a protocol called Tina from Barracuda. Since I was facing some challenges, so I welcomed the news of SD-WAN with open arms. For the first time, we had a decent level of abstraction in the WAN that was manageable. + +Deploying SD-WAN allows me to have all the available bandwidth. Contrarily, many of the WAN optimization techniques such as data compression and deduplication are not as useful. + +But others, such as error correction, protocol, and application acceleration could still be useful and are widely used today. Regardless of how many links you bundle, it might still result in latency and packet loss unless of course, you privatize as much as possible. + +### The security era + +### Packet filters + +Elementally, the firewall is classed in a number of generations. We started with the first-generation firewalls that are just simple packet filters. These packet filters match on layer 2 to 4 headers. Since most of them do not match on the TCP SYN flags it’s impossible to identify the established sessions. + +### Stateful devices + +The second-generation firewalls refer to stateful devices. Stateful firewalls keep the state connections and the return traffic is permitted if the state for that flow is in the connection table. + +These stateful firewalls did not inspect at an application level. The second-generation firewalls were stateful and could track the state of the session. However, they could not go deeper into the application, for example, examining the HTTP content and inspecting what users are doing. + +### Next-generation firewalls + +Just because a firewall is stateful doesn’t mean it can examine the application layer and determine what users are doing. Therefore, we switched to the third-generation firewalls. + +These firewall types are often termed as the next-generation firewalls because they offer layer 7 inspections combined with other network device filtering functionalities. Some examples could be an application firewall using an in-line deep packet inspection (DPI) or intrusion prevention system (IPS). + +Eventually, other niche devices started to emerge, called application-level firewalls. These devices are usually only concerned with the HTTP traffic, also known as web application firewalls (WAF). The WAF has similar functionality to reverse the web proxy, thereby terminating the HTTP session. + +From my experience, while designing the on-premises active/active firewalls with a redundant WAN, you must keep an eye on the asymmetric traffic flows. If the firewall receives a packet that does not have any connection/state information for that packet, it will drop the packet. + +Having an active/active design is complicated, whereas the active/passive design with an idle firewall is expensive. Anyways, if you manage to piece together a redundant design, most firewall vendors will require the management of security boxes instead of delivering policy-based security services. + +### Network Security-as-a-Service + +We then witnessed some major environmental changes. The introduction of the cloud and workload mobility changed the network and security paradigm completely. Workload fluidity and the movement of network state put pressure on the traditional physical security devices. + +The physical devices cannot follow workloads and you can’t move a physical appliance around the network. There is also considerable operational overhead. We have to constantly maintain these devices which literally becomes a race against time. For example, when a new patch is issued there will be a test, stage and deploy phase. All of this needs to be done before the network becomes prone to vulnerability. + +Network Security-as-a-Service was one solution to this problem. Network security functions, such as the CASB, FWaaS cloud SWG are now pushed to the cloud. + +### Converging network and security + +All the technologies described above have a time and a place. But these traditional networks and network security architectures are becoming increasingly ineffective. + +Now, we have more users, devices, applications, services and data located outside of an enterprise than inside. Hence, with the emergence of edge and cloud-based service, we need a completely different type of architecture. + +The SASE proposes combining the network-as-a-service capabilities (SD-WAN, WAN optimization, etc.) with the Security-as-a-Service (SWG, CASB, FWaaS, etc.) to support the dynamic secure access. It focuses extensively on the identity of the user and/or device, not the data center. + +Then policy can be applied to the identity and context. Following this model inverts our thinking about network and security. To be fair, we have seen the adoption of some cloud-based services including cloud-based SWG, content delivery network (CDN) and the WAF. However, the overarching design stays the same – the data center is still the center of most enterprise networks and network security architectures. Yet, the user/identity should be the new center of its operations. + +In the present era, we have dynamic secure access requirements. The users and devices are everywhere. As a result, secure access services need to be everywhere and distributed closer to the systems and devices that require access. When pursuing a data-centric approach to cloud security, one must follow the data everywhere it goes. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][5]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3448276/the-evolution-to-secure-access-service-edge-sase-is-being-driven-by-necessity.html + +作者:[Matt Conran][a] +选题:[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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.catonetworks.com/blog/the-secure-access-service-edge-sase-as-described-in-gartners-hype-cycle-for-enterprise-networking-2019/ +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html +[4]: https://network-insight.net/2015/07/azure-expressroute-cloud-ix-barracuda/ +[5]: https://www.networkworld.com/contributor-network/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 5ffd4fbd7b2a79ed849bf9b089491d1947e39b0c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:04:34 +0800 Subject: [PATCH 161/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191024=20Gartne?= =?UTF-8?q?r=20crystal=20ball:=20Looking=20beyond=202020=20at=20the=20top?= =?UTF-8?q?=20IT-changing=20technologies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191024 Gartner crystal ball- Looking beyond 2020 at the top IT-changing technologies.md --- ...020 at the top IT-changing technologies.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/talk/20191024 Gartner crystal ball- Looking beyond 2020 at the top IT-changing technologies.md diff --git a/sources/talk/20191024 Gartner crystal ball- Looking beyond 2020 at the top IT-changing technologies.md b/sources/talk/20191024 Gartner crystal ball- Looking beyond 2020 at the top IT-changing technologies.md new file mode 100644 index 0000000000..76bd69c4fa --- /dev/null +++ b/sources/talk/20191024 Gartner crystal ball- Looking beyond 2020 at the top IT-changing technologies.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Gartner crystal ball: Looking beyond 2020 at the top IT-changing technologies) +[#]: via: (https://www.networkworld.com/article/3447759/gartner-looks-beyond-2020-to-foretell-the-top-it-changing-technologies.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Gartner crystal ball: Looking beyond 2020 at the top IT-changing technologies +====== +Gartner’s top strategic predictions for 2020 and beyond is heavily weighted toward the human side of technology +[Thinkstock][1] + +ORLANDO –  Forecasting long-range IT technology trends is a little herding cats – things can get a little crazy. + +But Gartner analysts have specialized in looking forwardth, boasting an 80 percent  accuracy rate over the years, Daryl Plummer, distinguished vice president and Gartner Fellow told the IT crowd at this year’s [IT Symposium/XPO][2].  Some of those successful prediction have included the rise of automation, robotics, AI technology  and other ongoing trends. + +[Now see how AI can boost data-center availability and efficiency][3] + +Like some of the [other predictions][4] Gartner has made at this event, this year’s package of predictions for 2020 and beyond is heavily weighted toward the human side of technology rather than technology itself.  + +**[ [Become a Microsoft Office 365 administrator in record time with this quick start course from PluralSight.][5] ]** + + “Beyond offering insights into some of the most critical areas of technology evolution, this year’s predictions help us move beyond thinking about mere notions of technology adoption and draw us more deeply into issues surrounding what it means to be human in the digital world.” Plummer said. + +The list this year goes like this: + +**By 2023, the number of people with disabilities employed will triple due to AI and emerging technologies, reducing barriers to access.** + +Technology is going to make it easier for people with  disabilities  to connect to the business world. “People with disabilities constitute an untapped pool of critically skilled talent,” Plummer said. + +“[Artificial intelligence (AI)][6], augmented reality (AR), virtual reality (VR) and other [emerging technologies][7] have made work more accessible for employees with disabilities. For example, select restaurants are starting to pilot AI robotics technology that enables paralyzed employees to control robotic waiters remotely. Organizations that actively employ people with disabilities will not only cultivate goodwill from their communities, but also see 89 percent higher retention rates, a 72 percent increase in employee productivity, and a 29 percent increase in profitability,” Plummer said. + +**By 2024, AI identification of emotions will influence more than half of the online advertisements you see.** + +Computer vision, which allows AI to identify and interpret physical environments, is one of the key technologies used for emotion recognition and has been ranked by Gartner as one of the most important technologies in the next three to five years.  [Artificial emotional intelligence (AEI)][8] is the next frontier for AI development, Plummer said.  Twenty-eight percent of marketers ranked AI and machine learning (ML) among the top three technologies that will drive future marketing impact, and 87 percent of marketing organizations are currently pursuing some level of personalization, according to Gartner. By 2022, 10 percent of personal devices will have emotion AI capabilities, Gartner predicted. + +“AI makes it possible for both digital and physical experiences to become hyper personalized, beyond clicks and browsing history but actually on how customers _feel_ in a specific purchasing moment. With the promise to measure and engage consumers based on something once thought to be intangible, this area of ‘empathetic marketing’ holds tremendous value for both brands and consumers when used within the proper [privacy][9] boundaries,” said Plummer. + +**Through 2023, 30% of IT organizations will extend BYOD policies with “bring your own enhancement” (BYOE) to address augmented humans in the workforce.** + +The concept of augmented workers has gained traction in social media conversations in 2019 due to advancements in wearable technology. Wearables are driving workplace productivity and safety across most verticals, including automotive, oil and gas, retail and healthcare. + +Wearables are only one example of physical augmentations available today, but humans will look to additional physical augmentations that will enhance their personal lives and help do their jobs. Gartner defines human augmentation as creating cognitive and physical improvements as an integral part of the human body. An example is using active control systems to create limb prosthetics with characteristics that can exceed the highest natural human performance. + +“IT leaders certainly see these technologies as impactful, but it is the consumers’ desire to physically enhance themselves that will drive the adoption of these technologies first,” Plummer said. “Enterprises need to balance the control of these devices in their enterprises while also enabling users to use them for the benefit of the organization.” + +**By 2025, 50% of people with a smartphone but without a bank account will use a mobile-accessible cryptocurrency account.** + +Currently 30 percent of people have no bank account and 71 percent will subscribe to mobile services by 2025.  Major online marketplaces and social media platforms will start supporting cryptocurrency payments by the end of next year. By 2022, Facebook, Uber, Airbnb, eBay, PayPal and other digital e-commerce companies will support over 750 million customer, Gartner predicts. + +At least half the globe’s citizens who do not use a bank account will instead use these new mobile-enabled cryptocurrency account services offered by global digital platforms by 2025, Gartner said. + +**By 2023, a self-regulating association for oversight of AI and machine-learning designers will be established in at least four of the G7 countries.** + +By 2021, multiple incidents involving non-trivial AI-produced harm to hundreds or thousands of individuals can be expected, Gartner said.  Public demand for protection from the consequences of malfunctioning algorithms will in turn produce pressure to assign legal liability for the harmful consequences of algorithm failure. The immediate impact of regulation of process will be to increase cycle times for AI and ML algorithm development and deployment. Enterprises can also expect to spend more for training and certification for practitioners and documentation of processes, as well as higher salaries for certified personnel.  + +“Regulation of products as complex as AI and ML algorithms is no easy task. Consequences of algorithm failures at scale that occur within major societal functions are becoming more visible. For instance, AI-related failures in autonomous vehicles and aircraft have already killed people and attracted widespread attention in recent months,” said Plummer. + +**By 2023, 40% of professional workers will orchestrate their business application experiences and capabilities like they do their music streaming experience.** + +The human desire to have a work environment that is similar to their personal environment continues to rise — one where they can assemble their own applications to meet job and personal requirements in a [self-service fashion][10]. The consumerization of technology and introduction of new applications have elevated the expectations of employees as to what is possible from their business applications. Gartner says through 2020, the top 10 enterprise-application vendors will expose over 90 percent of their application capabilities through APIs. + +“Applications used to define our jobs. Nowadays, we are seeing organizations designing application experiences around the employee. For example, mobile and cloud technologies are freeing many workers from coming into an office and instead supporting a work-anywhere environment, outpacing traditional application business models,”  Plummer said. “Similar to how humans customize their streaming experience, they can increasingly customize and engage with new application experiences.” + +**By 2023, up to 30 percent of world news and video content will be authenticated as real by blockchain countering deep fake technology.** + +Fake news represents deliberate disinformation, such as propaganda that is presented to viewers as real news. Its rapid proliferation in recent years can be attributed to bot-controlled accounts on social media, attracting more viewers than authentic news and manipulating human intake of information, Plummer said. Fake content, exacerbated by AI can pose an existential threat to an organization. + +By 2021, at least 10 major news organizations will use [blockchain][11] to track and prove the authenticity of their published content to readers and consumers. Likewise, governments, technology giants and other entities are fighting back through industry groups and proposed regulations. “The IT organization must work with content-production teams to establish and track the origin of enterprise-generated content using blockchain technology,” Plummer said.   + +**On average, through 202, digital transformation initiatives will take large traditional enterprises  twice as long and cost twice as much as anticipated.** + +Business leaders’ expectations for revenue growth are unlikely to be realized from digital optimization strategies, due to the cost of technology modernization and the unanticipated costs of simplifying operational interdependencies. Such operational complexity also impedes the pace of change along with the degree of innovation and adaptability required to operate as a digital business. + +“In most traditional organizations, the gap between digital ambition and reality is large,” Plummer said. “We expect CIOs’ budget allocation for IT modernization to grow 7 percent year-over-year through 2021 to try to close that gap.” + +**By 2023, individual activities will be tracked digitally by an “Internet of Behavior” to influence, benefit and service eligibility for 40% of people worldwide.** + +Through facial recognition, location tracking and big data, organizations are starting to monitor individual behavior and link that behavior to other digital actions, like buying a train ticket. The Internet of Things (IoT) – where physical things are directed to do a certain thing based on a set of observed operating parameters relative to a desired set of operating parameters — is now being extended to people, known as the Internet of Behavior (IoB).  Through 2020 watch for examples of usage-based and behaviorally-based business models to expand into health insurance or financial services, Plummer said. + +“With IoB, value judgements are applied to behavioral events to create a desired state of behavior,” Plummer said. “What level of tracking will we accept? Will it be hard to get life insurance if your Fitbit tracker doesn’t see 10,000 steps a day?” + +“Over the long term, it is likely that almost everyone living in a modern society will be exposed to some form of IoB that melds with cultural and legal norms of our existing predigital societies,”  Plummer said + +**By 2024, the World Health Organization will identify online shopping as an  addictive disorder, as millions abuse digital commerce and encounter financial stress.** + +Consumer spending via digital commerce platforms will continue to grow over 10 percent year-over-year through 2022. In addition watch for an increased number of digital commerce orders predicted by, and initiated by, AI. + +The ease of online shopping will cause financial stress for millions of people, as online retailers increasingly use AI and personalization to effectively target consumers and prompt them to spend income that they do not have. The resulting debt and personal bankruptcies will cause depression and other health concerns caused by stress, which is capturing the attention of the WHO. + +“The side effects of technology that promote addictive behavior are not exclusive to consumers. CIOs must also consider the possibility of lost productivity among employees who put work aside for online shopping and other digital distractions. In addition, regulations in support of responsible online retail practices might force companies to provide warnings to prospective customers who are ready to make online purchases, similar to casinos or cigarette companies,” Plummer 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/3447759/gartner-looks-beyond-2020-to-foretell-the-top-it-changing-technologies.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]: http://thinkstockphotos.com +[2]: https://www.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.html +[3]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html +[4]: https://www.networkworld.com/article/3447401/gartner-top-10-strategic-technology-trends-for-2020.html +[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fadministering-office-365-quick-start +[6]: https://www.gartner.com/en/newsroom/press-releases/2019-07-15-gartner-survey-reveals-leading-organizations-expect-t +[7]: https://www.gartner.com/en/newsroom/press-releases/2018-08-20-gartner-identifies-five-emerging-technology-trends-that-will-blur-the-lines-between-human-and-machine +[8]: https://www.gartner.com/smarterwithgartner/13-surprising-uses-for-emotion-ai-technology/ +[9]: https://www.gartner.com/smarterwithgartner/how-to-balance-personalization-with-data-privacy/ +[10]: https://www.gartner.com/en/newsroom/press-releases/2019-05-28-gartner-says-the-future-of-self-service-is-customer-l +[11]: https://www.gartner.com/smarterwithgartner/the-cios-guide-to-blockchain/ +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world From ca29a505d779ff7dde4c8cb87ca95c32a3b8ace4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:08:02 +0800 Subject: [PATCH 162/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20Psst!?= =?UTF-8?q?=20Wanna=20buy=20a=20data=20center=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191023 Psst- Wanna buy a data center.md --- .../20191023 Psst- Wanna buy a data center.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/talk/20191023 Psst- Wanna buy a data center.md diff --git a/sources/talk/20191023 Psst- Wanna buy a data center.md b/sources/talk/20191023 Psst- Wanna buy a data center.md new file mode 100644 index 0000000000..26ac4617b8 --- /dev/null +++ b/sources/talk/20191023 Psst- Wanna buy a data center.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Psst! Wanna buy a data center?) +[#]: via: (https://www.networkworld.com/article/3447657/psst-wanna-buy-a-data-center.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Psst! Wanna buy a data center? +====== +Data centers are being bought and sold at an increasing rate, although since they are often private transactions, solid numbers can be hard to come by. +artisteer / Getty Images + +When investment bank Bear Stearns collapsed in 2008, there was nothing left of value to auction off except its [data centers][1]. JP Morgan bought the company's carcass for just $270 million, but the only thing of value was Bear's NYC headquarters and two data centers. + +Since then there have been numerous sales of data centers under better conditions. There are even websites ([Datacenters.com][2], [Five 9s Digital][3]) that list data centers for sale. You can buy an empty building, but in most cases, you get the equipment, too. + +There are several reasons why, the most common being companies want to get out of owning a data center. It's an expensive capex and opex investment, and if the cloud is a good alternative, then that's where they go. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +But there are other reasons, too, said Jon Lin, president of the Equinix Americas office. He said enterprises have overbuilt because of their initial long-term forecasts fell short, partially driven by increased use of cloud. He also said there is an increase in the amount of private equity and real estate investors interested in diversifying into data centers. + +But that doesn't mean Equinix takes every data center they are offered. He cited three reasons why Equinix would pass on an offer: + +1) It is difficult to repurpose an enterprise data center designed around a very tailored customer into a general purpose, multi-tenant data center without significant investment in order to tailor it to the company's satisfaction. + +2) Most of these sites were not built to Equinix standards, diminishing their value. + +**[ Learn more about SDN: Find out [where SDN is going][5] and learn the [difference between SDN and NFV][6]. | Get regularly scheduled insights by [signing up for Network World newsletters][7]. ]** + +3) Enterprise data centers are usually located where the company HQ is for convenience, and not near the interconnection points or infrastructure locations Equinix would prefer for fiber and power. + +Just how much buying and selling is going on is hard to tell. Most of these firms are privately held and thus no disclosure is required. Kelly Morgan, research vice president with 451 Research who tracks the data center market, put the dollar figure for data center sales in 2019 so far at $5.4 billion. That's way down from $19.5 billion just two years ago. + +She says that back then there were very big deals, like when Verizon sold its data centers to Equinix in 2017 for $3.6 billion while AT&T sold its data centers to Brookfield Infrastructure Partners, which buys and managed infrastructure assets, for $1.1 billion. + +These days, she says, the main buyers are big real estate-oriented pension funds that have a different perspective on why they buy vs. traditional real estate investors. Pension funds like the steady income, even in a recession. Private equity firms were buying data centers to buy up the assets, group them, then sell them and make a double-digit return, she said. + +Enterprises do look to sell their data centers, but it's a more challenging process. She echoes what Lin said about the problem with specialty data centers. "They tend to be expensive and often in not great locations for multi-tenant situations. They are often at company headquarters or the town where the company is headquartered. So they are hard to sell," she said. + +Enterprises want to sell their data center to get out of data center ownership, since they are often older -- the average age of corporate data centers is from 10 years to 25 years old – for the obvious reasons. "When we ask enterprises why they are selling or closing their data centers, they say they are consolidating multiple data centers into one, plus moving half their stuff to the cloud," said Morgan. + +There is still a good chunk of companies who build or acquire data centers, either because they are consolidating or just getting rid of older facilities. Some add space because they are moving to a new geography. However, Morgan said they almost never buy. "They lease one from someone else. Enterprise data centers for sale are not bought by other enterprises, they are bought by service providers who will lease it. Enterprises build a new one," she said. + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447657/psst-wanna-buy-a-data-center.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/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: https://www.datacenters.com/real-estate/data-centers-for-sale +[3]: https://five9sdigital.com/data-centers/ +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3209131/lan-wan/what-sdn-is-and-where-its-going.html +[6]: https://www.networkworld.com/article/3206709/lan-wan/what-s-the-difference-between-sdn-and-nfv.html +[7]: https://www.networkworld.com/newsletters/signup.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From 430bd8e73a4bb5826b6debb457b7fb25948e7b2e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:09:43 +0800 Subject: [PATCH 163/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20Cisco?= =?UTF-8?q?=20issues=20critical=20security=20warning=20for=20IOS=20XE=20RE?= =?UTF-8?q?ST=20API=20container?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191023 Cisco issues critical security warning for IOS XE REST API container.md --- ...y warning for IOS XE REST API container.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/talk/20191023 Cisco issues critical security warning for IOS XE REST API container.md diff --git a/sources/talk/20191023 Cisco issues critical security warning for IOS XE REST API container.md b/sources/talk/20191023 Cisco issues critical security warning for IOS XE REST API container.md new file mode 100644 index 0000000000..13bc238c2c --- /dev/null +++ b/sources/talk/20191023 Cisco issues critical security warning for IOS XE REST API container.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cisco issues critical security warning for IOS XE REST API container) +[#]: via: (https://www.networkworld.com/article/3447558/cisco-issues-critical-security-warning-for-ios-xe-rest-api-container.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Cisco issues critical security warning for IOS XE REST API container +====== +This Cisco IOS XE REST API vulnerability could lead to attackers obtaining the token-id of an authenticated user. +D3Damon / Getty Images + +Cisco this week said it issued a software update to address a vulnerability in its [Cisco REST API virtual service container for Cisco IOS XE][1] software that scored a critical 10 out of 10 on the Common Vulnerability Scoring System (CVSS) system. + +With the vulnerability an attacker could submit malicious HTTP requests to the targeted device and if successful, obtain the _token-id_ of an authenticated user. This _token-id_ could be used to bypass authentication and execute privileged actions through the interface of the REST API virtual service container on the affected Cisco IOS XE device, the company said. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +According to Cisco the REST API is an application that runs in a virtual services container. A virtual services container is a virtualized environment on a device and is delivered as an open virtual application (OVA).  The OVA package has to be installed and enabled on a device through the device virtualization manager (VMAN) CLI. + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][3] ]** + +The Cisco REST API provides a set of RESTful APIs as an alternative method to the Cisco IOS XE CLI to provision selected functions on Cisco devices. + +Cisco said the vulnerability can be exploited under the  following conditions: + + * The device runs an affected Cisco IOS XE Software release. + * The device has installed and enabled an affected version of the Cisco REST API virtual service container. + * An authorized user with administrator credentials (level 15) is authenticated to the REST API interface. + + + +The REST API interface is not enabled by default. To be vulnerable, the virtual services container must be installed and activated. Deleting the OVA package from the device storage memory removes the attack vector. If the Cisco REST API virtual service container is not enabled, this operation will not impact the device's normal operating conditions, Cisco stated.    + +This vulnerability affects Cisco devices that are configured to use a vulnerable version of Cisco REST API virtual service container. This vulnerability affected the following products: + + * Cisco 4000 Series Integrated Services Routers + * Cisco ASR 1000 Series Aggregation Services Routers + * Cisco Cloud Services Router 1000V Series + * Cisco Integrated Services Virtual Router + + + +Cisco said it has [released a fixed version of the REST API][4] virtual service container and   a hardened IOS XE release that prevents installation or activation of a vulnerable container on a device. If the device was already configured with an active vulnerable container, the IOS XE software upgrade will deactivate the container, making the device not vulnerable. In that case, to restore the REST API functionality, customers should upgrade the Cisco REST API virtual service container to a fixed software release, the company said. + +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/3447558/cisco-issues-critical-security-warning-for-ios-xe-rest-api-container.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://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190828-iosxe-rest-auth-bypass +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[4]: https://www.cisco.com/c/en/us/about/legal/cloud-and-software/end_user_license_agreement.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 16804431d1639d48f686f032cf2ee9d58d8f6bfc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:10:56 +0800 Subject: [PATCH 164/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20IT-as-?= =?UTF-8?q?a-Service=20Simplifies=20Hybrid=20IT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191023 IT-as-a-Service Simplifies Hybrid IT.md --- ...23 IT-as-a-Service Simplifies Hybrid IT.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/talk/20191023 IT-as-a-Service Simplifies Hybrid IT.md diff --git a/sources/talk/20191023 IT-as-a-Service Simplifies Hybrid IT.md b/sources/talk/20191023 IT-as-a-Service Simplifies Hybrid IT.md new file mode 100644 index 0000000000..1a0b2ad9a0 --- /dev/null +++ b/sources/talk/20191023 IT-as-a-Service Simplifies Hybrid IT.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IT-as-a-Service Simplifies Hybrid IT) +[#]: via: (https://www.networkworld.com/article/3447342/it-as-a-service-simplifies-hybrid-it.html) +[#]: author: (Anne Taylor https://www.networkworld.com/author/Anne-Taylor/) + +IT-as-a-Service Simplifies Hybrid IT +====== +Consumption-based model reduces complexity, improves IT infrastructure. +iStock + +The data center must rapidly change. Companies are increasingly moving toward hybrid IT models, with some workloads in the cloud and others staying on premises. The burden of ever-growing apps and data is placing pressure on infrastructure in both worlds, but especially the data center. + +Organizations are struggling to reach the required speed and flexibility — with the same public-cloud economics — from their on-premises data centers. That’s likely because they’re dealing with legacy systems acquired over the years, possibly inherited as the result of mergers and acquisitions. + +These complex environments create headaches when trying to accommodate for IT capacity fluctuations. When extra storage is needed, for example, 67% of IT departments buy too much, according to [Futurum Research][1]. They don’t have the visibility into resources, nor the ability to effectively scale up and down. + +Meanwhile, lines of business need solutions fast, and if IT can’t deliver, they’ll go out and buy their own cloud-based services or solutions. IT must think strategically about how all this technology strings together — efficiently, securely, and cost-effectively. + +Enter IT-as-a-Service (ITaaS). + +**1) How does ITaaS work?** + +Unlike other as-a-service models, ITaaS is not cloud based, although the concept can be applied to cloud environments. Rather, the focus is about shifting IT operations toward managed services on an as-needed, pay-as-you-go basis. 1 + +For example, HPE GreenLake delivers infrastructure capacity based on actual metered usage, where companies only pay for what is used. There are no upfront costs, extended purchasing and implementation timeframes, or overprovisioning headaches. Infrastructure capacity can be scaled up or down as needed. + +**2) What are the benefits of ITaaS?** + +Some of the most significant advantages include: scalable infrastructure and resources, improved workload management, greater availability, and reduced burden on IT, including network admins. + + * _Infrastructure_. Resource needs are often in flux depending on business demands and market changes. Using ITaaS not only enhances infrastructure usage, it also helps network admins better plan for and manage bandwidth, switches, routers, and other network gear. + * _Workloads_. ITaaS can immediately tackle cloud bursting to better manage application flow. Companies might also, for example, choose to use the consumption-based model for workloads that are unpredictable in their growth — such as big data, storage, and private cloud. + * _Availability_. It’s critical to have zero network downtime. Using a consumption-based IT model, companies can opt to adopt services such as continuous network monitoring or expertise on-call with a 24/7 network help desk. + * _Reduced burden on IT_. All of the above benefits affect day-to-day operations. By simplifying network management, ITaaS frees personnel to use their expertise where it is best served. + + + +Furthermore, a consumption-based IT model helps organizations gain end-to-end visibility into storage resources, so that admins can ensure the highest levels of service, performance, and availability. + +**HPE GreenLake: The Answer** + +As hybrid IT takes hold, IT organizations must get a grip on their infrastructure resources to ensure agility and scalability for the business, while maintaining IT cost-effectiveness. + +HPE GreenLake enables a simplified IT environment where companies pay only for the resources they actually use, while providing the business with the speed and agility it requires. + +[Learn more at hpe.com/greenlake.][2] + +Minimum commitment may apply + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447342/it-as-a-service-simplifies-hybrid-it.html + +作者:[Anne Taylor][a] +选题:[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/Anne-Taylor/ +[b]: https://github.com/lujun9972 +[1]: https://h20195.www2.hpe.com/v2/Getdocument.aspx?docname=a00079768enw +[2]: https://www.hpe.com/us/en/services/flexible-capacity.html From b1b221c1b8f3bab784591cf53b22d4bdcca58b8d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:12:37 +0800 Subject: [PATCH 165/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191024=20The=20?= =?UTF-8?q?Five=20Most=20Popular=20Operating=20Systems=20for=20the=20Inter?= =?UTF-8?q?net=20of=20Things?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191024 The Five Most Popular Operating Systems for the Internet of Things.md --- ...ting Systems for the Internet of Things.md | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 sources/tech/20191024 The Five Most Popular Operating Systems for the Internet of Things.md diff --git a/sources/tech/20191024 The Five Most Popular Operating Systems for the Internet of Things.md b/sources/tech/20191024 The Five Most Popular Operating Systems for the Internet of Things.md new file mode 100644 index 0000000000..89d6ef1acf --- /dev/null +++ b/sources/tech/20191024 The Five Most Popular Operating Systems for the Internet of Things.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Five Most Popular Operating Systems for the Internet of Things) +[#]: via: (https://opensourceforu.com/2019/10/the-five-most-popular-operating-systems-for-the-internet-of-things/) +[#]: author: (K S Kuppusamy https://opensourceforu.com/author/ks-kuppusamy/) + +The Five Most Popular Operating Systems for the Internet of Things +====== + +[![][1]][2] + +_Connecting every ‘thing’ that we see around us to the Internet is the fundamental idea of the Internet of Things (IoT). There are many operating systems to get the best out of the things that are connected to the Internet. This article explores four popular operating systems for IoT — Ubuntu Core, RIOT, Contiki and TinyOS._ + +To say that life is running on the Internet these days is not an exaggeration due to the number and variety of services that we consume on the Net. These services span multiple domains such as information, financial services, social networking and entertainment. As this list grows longer, it becomes imperative that we do not restrict the types of devices that can connect to the Internet. The Internet of Things (IoT) facilitates connecting various types of ‘things’ to the Internet infrastructure. By connecting a device or thing to the Internet, these things get the ability to not only interact with the user but also between themselves. This feature of a variety of things interacting among themselves to assist users in a pervasive manner constitutes an interesting phenomenon called ambient intelligence. + +![Figure 1: IoT application domains][3] + +IoT is becoming increasingly popular as the types of devices that can be connected to it are becoming more diverse. The nature of applications is also evolving. Some of the popular domains in which IoT is getting used increasingly are listed below (Figure 1): + + * Smart homes + * Smart cities + * Smart agriculture + * Connected automobiles + * Smart shopping + * Connected health + + + +![Figure 2: IoT operating system features][4] + +As the application domains become diverse, the need to manage the IoT infrastructure efficiently is also becoming more important. The operating systems in normal computers perform the primary functions such as resource management, user interaction, etc. The requirements of IoT operating systems are specialised due to the nature and size of the devices involved in the process. Some of the important characteristics/requirements of IoT operating systems are listed below (Figure 2): + + * A tiny memory footprint + * Energy efficiency + * Connectivity features + * Hardware-agnostic operations + * Real-time processing requirements + * Security requirements + * Application development ecosystem + + + +As of 2019, there is a spectrum of choices for selecting the operating system (OS) for the Internet of Things. Some of these OSs are shown in Figure 3. + +![Figure 3: IoT operating systems][5] + +**Ubuntu Core** +As Ubuntu is a popular Linux distribution, the Ubuntu Core IoT offering has also become popular. Ubuntu Core is a secure and lightweight OS for IoT, and is designed with a ‘security first’ philosophy. According to the official documentation, the entire system has been redesigned to focus on security from the first boot. There is a detailed white paper available on Ubuntu Core’s security features. It can be accessed at _ -ubuntu-core-security-whitepaper.pdf?_ga=2.74563154.1977628533. 1565098475-2022264852.1565098475_. + +Ubuntu Core has been made tamper-resistant. As the applications may be from diverse sources, they are given privileges for only their own data. This has been done so that one poorly designed app does not make the entire system vulnerable. Ubuntu Core is ‘built for business’, which means that the developers can focus directly on the application at hand, while the other requirements are supported by the default operating system. + +Another important feature of Ubuntu Core is the availability of a secure app store, which you can learn more about at __. There is a ready-to-go software ecosystem that makes using Ubuntu Core simple. + +The official documentation lists various successful case studies about how Ubuntu Core has been successfully used. + +**RIOT** +RIOT is a user-friendly OS for the Internet of Things. This FOSS OS has been developed by a number of people from around the world. +RIOT supports many low-power IoT devices. It has support for various microcontroller architectures. The official documentation lists the following reasons for using the RIOT OS. + + * _**It is developer friendly:**_ It supports the standard environments and tools so that developers need not go through a steep learning curve. Standard programming languages such as C or C++ are supported. The hardware dependent code is very minimal. Developers can code once and then run their code on 8-bit, 16-bit and 32-bit platforms. + * _**RIOT is resource friendly:**_ One of the important features of RIOT is its ability to support lightweight devices. It enables maximum energy efficiency. It supports multi-threading with very little overhead for threading. + * _**RIOT is IoT friendly:**_ The common system support provided by RIOT makes it a very important choice for IoT. It has support for CoAP, CBOR, high resolution and long-term timers. + + + +**Contiki** +Contiki is an important OS for IoT. It facilitates connecting tiny, low-cost and low-energy devices to the Internet. +The prominent reasons for choosing the Contiki OS are as follows. + + * _**Internet standards:**_ The Contiki OS supports the IPv6 and IPv4 standards, in addition to the low-power 6lowpan, RPL and CoAP standards. + * _**Support for a variety of hardware:**_ Contiki can be run on a variety of low-power devices, which are easily available online. + * _**Large community support:**_ One of the important advantages of using Contiki is the availability of an active community of developers. So when you have some technical issues to be solved, these community members make the problem solving process simple and effective. + + + +The major features of Contiki are listed below. + + * _**Memory allocation:**_ Even the tiny systems with only a few kilobytes of memory can also use Contiki. Its memory efficiency is an important feature. + * _**Full IP networking:**_ The Contiki OS offers a full IP network stack. This includes major standard protocols such as UDP, TCP, HTTP, 6lowpan, RPL, CoAP, etc. + * _**Power awareness:**_ The ability to assess the power requirements and to use them in an optimal minimal manner is an important feature of Contiki. + * The Cooja network simulator makes the process of developing and debugging software easier. + * The availability of the Coffee Flash file system and the Contiki shell makes the file handling and command execution simpler and more effective. + + + +**TinyOS** +TinyOS is an open source operating system designed for low-power wireless devices. It has a vibrant community of users spread across the world from both academia and industry. The popularity of TinyOS can be understood from the fact that it gets downloaded more than 35,000 times in a year. +TinyOS is very effectively used in various scenarios such as sensor networks, smart buildings, smart meters, etc. The main repository of TinyOS is available at . +TinyOS is written in nesC which is a dialect of C. A sample code snippet is shown below: + +``` +configuration Led { +provides { +interface LedControl; +} +uses { +interface Gpio; +} +} +implementation { + +command void LedControl.turnOn() { +call Gpio.set(); +} + +command void LedControl.turnOff() { +call Gpio.clear(); +} + +} +``` + +**Zephyr** +Zephyr is a real-time OS that supports multiple architectures and is optimised for resource-constrained environments. Security is also given importance in the Zephyr design. + +The prominent features of Zephyr are listed below: + + * Support for 150+ boards. + * Complete flexibility and freedom of choice. + * Can handle small footprint IoT devices. + * Can develop products with built-in security features. + + + +This article has introduced readers to a list of four OSs for the IoT, from which they can select the ideal one, based on individual requirements. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-five-most-popular-operating-systems-for-the-internet-of-things/ + +作者:[K S Kuppusamy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/ks-kuppusamy/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/OS-for-IoT.jpg?resize=696%2C647&ssl=1 (OS for IoT) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/OS-for-IoT.jpg?fit=800%2C744&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-IoT-application-domains.jpg?resize=350%2C107&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-2-IoT-operating-system-features.jpg?resize=350%2C93&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-3-IoT-operating-systems.jpg?resize=350%2C155&ssl=1 From b3fb832cb0e7aaa6e7b93407e21108e9cfddc853 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 26 Oct 2019 01:13:47 +0800 Subject: [PATCH 166/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20The=20?= =?UTF-8?q?Protocols=20That=20Help=20Things=20to=20Communicate=20Over=20th?= =?UTF-8?q?e=20Internet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191023 The Protocols That Help Things to Communicate Over the Internet.md --- ...Things to Communicate Over the Internet.md | 141 ++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 sources/talk/20191023 The Protocols That Help Things to Communicate Over the Internet.md diff --git a/sources/talk/20191023 The Protocols That Help Things to Communicate Over the Internet.md b/sources/talk/20191023 The Protocols That Help Things to Communicate Over the Internet.md new file mode 100644 index 0000000000..349e2b7e2a --- /dev/null +++ b/sources/talk/20191023 The Protocols That Help Things to Communicate Over the Internet.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Protocols That Help Things to Communicate Over the Internet) +[#]: via: (https://opensourceforu.com/2019/10/the-protocols-that-help-things-to-communicate-over-the-internet-2/) +[#]: author: (Sapna Panchal https://opensourceforu.com/author/sapna-panchal/) + +The Protocols That Help Things to Communicate Over the Internet +====== + +[![][1]][2] + +_The Internet of Things is a system of connected, interrelated objects. These objects transmit data to servers for processing and, in turn, receive messages from the servers. These messages are sent and received using different protocols. This article discusses some of the protocols related to the IoT._ + +The Internet of Things (IoT) is beginning to pervade more and more aspects of our lives. Everyone everywhere is using the Internet of Things. Using the Internet, connected things are used to collect information, convey/send information back, or do both. IoT is an architecture that is a combination of available technologies. It helps to make our daily lives more pleasant and convenient. + +![Figure 1: IoT architecture][3] + +![Figure 2: Messaging Queuing Telemetry Transmit protocol][4] + +**IoT architecture** +Basically, IoT architecture has four components. In this article, we will explore each component to understand the architecture better. + +**Sensors:** These are present everywhere. They help to collect data from any location and then share it to the IoT gateway. As an example, sensors sense the temperature at different locations, which helps to gauge the weather conditions. And this information is shared or passed to the IoT gateway. This is a basic example of how the IoT operates. + +**IoT gateway:** Once the information is collected from the sensors, it is passed on to the gateway. The gateway is a mediator between sensor nodes and the World Wide Web. So basically, it processes the data that is collected from sensor nodes and then transmits this to the Internet infrastructure. +**Cloud server:** Once data is transmitted through the gateway, it is stored and processed in the cloud server. +**Mobile app:** Using a mobile application, the user can view and access the data processed in the cloud server. +This is the basic idea of the IoT and its architecture, along with the components. We now move on to the basic ideas behind different IoT protocols. + +![Figure 3: Advance Message Queuing Protocol][5] + +![Figure 4: CoAP][6] + +**IoT protocols** +As mentioned earlier, connected things are used to collect information, convey/send information back, or do both, using the Internet. This is the fundamental basis of the IoT. To convey/send information, we need a protocol, which is a set of procedures that is used to transmit the data between electronic devices. +Essentially, we have two types of IoT protocols — the IoT network protocols and the IoT data protocols. This article discusses the IoT data protocols. + +![Figure 5: Constrained Application Protocol architecture][7] + +**MQTT** +The Messaging Queuing Telemetry Transmit (MQTT) protocol was primarily designed for low bandwidth networks, but is very popular today as an IoT protocol. It is used to exchange data between clients and the server. It is a lightweight messaging protocol. + +This protocol has many advantages: + + * It is small in size and has low power usage. + * It is a lightweight protocol. + * It is based on low network usage. + * It works entirely in real-time. + + + +Considering all the above reasons, MQTT emerges as the perfect IoT data protocol. + +**How MQTT works:** MQTT is based on a client-server relationship. The server manages the requests that come from different clients and sends the required information to clients. MQTT is based on two operations. + +i) _Publish:_ When the client sends data to the MQTT broker, this operation is known as ‘Publish’. +ii) _Subscribe:_ When the client receives data from the broker, this operation is known as ‘Subscribe’. + +The MQTT broker is the mediator that handles these operations, primarily taking messages and delivering them to the application or client. + +Let’s look at the example of a device temperature sensor, which sends readings to the MQTT broker, and then information is delivered to desktop or mobile applications. As stated earlier, ‘Publish’ means sending readings to the MQTT broker and ‘Subscribe’ means delivering the information to the desktop/mobile application. + +**AMQP** +Advanced Message Queuing Protocol is a peer-to-peer protocol, where one peer plays the role of the client application and the other peer plays the role of the delivery service or broker. It is the combination of hard and fast components that basically routes and saves messages within the delivery service or broker carrier. +The benefits of AMQP are: + + * It helps to send messages without them getting missed out. + * It helps to guarantee a ‘one-time-only’ and secured delivery. + * It provides a secure connection. + * It always supports acknowledgements for message delivery or failure. + + + +**How AMQP works and its architecture:** The AMQP architecture is made up of the following parts. + +_**Exchange**_ – Messages that come from the publisher are accepted by Exchange, which routes them to the message queue. +_**Message queue**_ – This is the combination of multiple queues and is helpful for processing the messages. +_**Binding**_ – This helps to maintain the connectivity between Exchange and the message queue. +The combination of Exchange and the message queues is known as the broker or AMQP broker. + +![Figure 6: Extensible Messaging and Presence Protocol][8] + +**Constrained Application Protocol (CoAP)** +This was initially used as a machine-to-machine (M2M) protocol and later began to be used as an IoT protocol. It is a Web transfer protocol that is used with constrained nodes and constrained networks. CoAP uses the RESTful architecture, just like the HTTP protocol. +The advantages CoAP offers are: + + * It works as a REST model for small devices. + * As this is like HTTP, it’s easy for developers to work on. + * It is a one-to-one protocol for transferring information between the client and server, directly. + * It is very simple to parse. + + + +**How CoAP works and its architecture:** From Figure 4, we can understand that CoAP is the combination of ‘Request/Response and Message’. We can also say it has two layers – ‘Request/Response’and ‘Message’. +Figure 5 clearly explains that CoAP architecture is based on the client server relationship, where… + + * The client sends requests to the server. + * The server receives requests from the client and responds to them. + + + +**Extensible Messaging and Presence Protocol (XMPP)** + +This protocol is used to exchange messages in real-time. It is used not only to communicate with others, but also to get information on the status of the user (away, offline, active). This protocol is widely used in real life, like in WhatsApp. + +The Extensible Messaging and Presence Protocol should be used because: + + * It is free, open and easy to understand. Hence, it is very popular. + * It has secured authentication, is extensible and flexible. + + + +**How XMPP works and its architecture:** In the XMPP architecture, each client has a unique name associated with it and communicates to other clients via the XMPP server. The XMPP client has either the same domain or a different one. + +In Figure 6, the XMPP client belongs to the same domain in which one XMPP client sends the information to the XMPP server. The server translates it and conveys the information to another client. +Basically, this protocol is the backbone that provides universal connectivity between different endpoint protocols. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-protocols-that-help-things-to-communicate-over-the-internet-2/ + +作者:[Sapna Panchal][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/sapna-panchal/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Internet-of-things-illustration.jpg?resize=696%2C439&ssl=1 (Internet of things illustration) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Internet-of-things-illustration.jpg?fit=1125%2C710&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-IoT-architecture.jpg?resize=350%2C133&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-2-Messaging-Queuing-Telemetry-Transmit-protocol.jpg?resize=350%2C206&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-3-Advance-Message-Queuing-Protocol.jpg?resize=350%2C160&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-4-CoAP.jpg?resize=350%2C84&ssl=1 +[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-5-Constrained-Application-Protocol-architecture.jpg?resize=350%2C224&ssl=1 +[8]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-6-Extensible-Messaging-and-Presence-Protocol.jpg?resize=350%2C46&ssl=1 From ba6f7aa83491ccc365d511711bd57166bf398c1a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Oct 2019 00:02:54 +0800 Subject: [PATCH 167/800] PRF @wenwensnow --- ...anage All Your Linux Games in One Place.md | 106 +++++++++--------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index 383cebb174..d762e941bf 100644 --- a/translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -1,43 +1,46 @@ [#]: collector: (lujun9972) [#]: translator: (wenwensnow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Use GameHub to Manage All Your Linux Games in One Place) [#]: via: (https://itsfoss.com/gamehub/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -用GameHub集中管理你Linux上的所有游戏 +用 GameHub 集中管理你 Linux 上的所有游戏 ====== -你在Linux 上打算怎么[玩游戏呢][1]? 让我猜猜, 要不就是从软件中心直接安装,要不就选Steam,GOG, Humble Bundle 等平台,对吧?但是,如果你有多个游戏启动器和客户端,又要如何管理呢?好吧,对我来说这简直令人头疼 —— 这也是我发现[GameHub][2]这个应用之后,感到非常高兴的原因。 +你在 Linux 上是怎么[玩游戏的呢][1]? 让我猜猜,要不就是从软件中心直接安装,要不就选 Steam、GOG、Humble Bundle 等平台,对吧?但是,如果你有多个游戏启动器和客户端,又要如何管理呢?好吧,对我来说这简直令人头疼 —— 这也是我发现 [GameHub][2] 这个应用之后,感到非常高兴的原因。 -GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中管理你的所有游戏”。这听起来很有趣,是不是?下面让我来具体说明一下。 +GameHub 是为 Linux 发行版设计的一个桌面应用,它能让你“集中管理你的所有游戏”。这听起来很有趣,是不是?下面让我来具体说明一下。 ![][3] -### 集中管理不同平台Linux游戏的GameHub功能 -让我们看看,对玩家来说,让GameHub成为一个[不可或缺的Linux应用][4]的功能,都有哪些。 +### 集中管理不同平台 Linux 游戏的 GameHub + +让我们看看,对玩家来说,让 GameHub 成为一个[不可或缺的 Linux 应用][4]的功能,都有哪些。 + +#### Steam、GOG & Humble Bundle 支持 -#### Steam, GOG & Humble Bundle 支持 ![][5] -它支持Steam, [GOG][6], 和 [Humble Bundle][7] 账户整合。你可以登录你的GameHub账号,从而在库管理器中管理所有游戏。 +它支持 Steam、[GOG][6] 和 [Humble Bundle][7] 账户整合。你可以登录你的 GameHub 账号,从而在你的库管理器中管理所有游戏。 -对我来说,我在Steam上有很多游戏,Humble Bundle上也有一些。我不能确保它支持所有平台。但可以确信的是,主流平台游戏是没有问题的。 +对我来说,我在 Steam 上有很多游戏,Humble Bundle 上也有一些。我不能确保它支持所有平台,但可以确信的是,主流平台游戏是没有问题的。 + +#### 支持原生游戏 -#### 本地游戏支持 ![][8] -有很多网站专门推荐Linux游戏,并[支持下载][9]。你可以通过下载安装包,或者添加可执行文件,从而管理本地游戏。 +[有很多网站专门推荐 Linux 游戏,并支持下载][9]。你可以通过下载安装包,或者添加可执行文件,从而管理原生游戏。 -可惜的是,在GameHub内,无法在线搜索Linux游戏。如上图所示,你需要将各平台游戏分开下载,随后再添加到自己的GameHub账号中。 +可惜的是,现在无法在 GameHub 内搜索 Linux 游戏。如上图所示,你需要分别下载游戏,随后再将其添加到 GameHub 中。 #### 模拟器支持 -在模拟器方面,你可以玩[Linux上的retro game][10]。正如上图所示,你可以添加模拟器(或导入模拟器镜像)。 +用模拟器,你可以在 [Linux 上玩复古游戏][10]。正如上图所示,你可以添加模拟器(并导入模拟的镜像)。 -你可以在[RetroArch][11]查看可添加的模拟器,但也能根据需求,添加自定义模拟器。 +你可以在 [RetroArch][11] 查看已有的模拟器,但也能根据需求添加自定义模拟器。 #### 用户界面 @@ -49,58 +52,33 @@ GameHub是为Linux发行版设计的一个桌面应用,它能让你“集中 #### 手柄支持 -如果你习惯在Linux系统上用手柄玩游戏 —— 你可以轻松在设置里添加,启用或禁用它。 +如果你习惯在 Linux 系统上用手柄玩游戏 —— 你可以轻松在设置里添加,启用或禁用它。 #### 多个数据提供商 - -因为它需要获取你的游戏信息(或元数据),也意味着它需要一个数据源。你可以看到上图列出的所有数据源。 +因为它需要获取你的游戏信息(或元数据),也意味着它需要一个数据源。你可以看到下图列出的所有数据源。 ![Data Providers Gamehub][13] -这里你什么也不用做 —— 但如果你使用的是其他平台,而不是steam的话,你需要为[IDGB生成一个API密钥][14]。 +这里你什么也不用做 —— 但如果你使用的是 steam 之外的其他平台,你需要为 [IDGB 生成一个 API 密钥][14]。 -我建议只有出现提示/通知,或有些游戏在GameHub上没有任何描述/图片/状态时,再这么做。 +我建议只有出现 GameHub 中的提示/通知,或有些游戏在 GameHub 上没有任何描述/图片/状态时,再这么做。 #### 兼容性选项 ![][15] -你有不支持在Linux上运行的游戏吗? +你有不支持在 Linux 上运行的游戏吗? -不用担心,GameHub上提供了多种兼容工具,如 Wine/Proton,你可以利用它们让游戏得以运行。 +不用担心,GameHub 上提供了多种兼容工具,如 Wine/Proton,你可以利用它们来玩游戏。 -我们无法确定具体哪个兼容工具适用于你 —— 所以你需要自己亲自测试。 然而,对许多游戏玩家来说,这的确是个很有用的功能。 - -### 如何在GameHub上管理你的游戏? - -在启动程序后,你可以将自己的Steam/GOG/Humble Bundle 账号添加进来。 - -对于Steam, 你需要在Linux 发行版上安装Steam 客户端。一旦安装完成,你可以轻松将账号中的游戏导入GameHub. - - -![][16] - -对于GOG & Humble Bundle, 登录后,就能直接在GameHub上管理游戏了。 - -如果你想添加模拟器或者本地安装文件,点击窗口右上角的 “**+**” 按钮进行添加。 - - -### 如何安装游戏? - -对于Steam游戏,它会自动启动Steam 客户端,从而下载/安装游戏(我希望之后安装游戏,可以不用启动Steam!) - -![][17] - -但对于GOG/Humble Bundle, 登录后就能直接、下载安装游戏。必要的话,对于那些不支持在Linux上运行的游戏,你可以使用兼容工具。 - -无论是模拟器游戏,还是本地游戏,只需添加安装包或导入模拟器镜像就可以了。这里没什么其他步骤要做。 +我们无法确定具体哪个兼容工具适用于你 —— 所以你需要自己亲自测试。然而,对许多游戏玩家来说,这的确是个很有用的功能。 ### GameHub: 如何安装它呢? ![][18] -首先,你可以直接在软件中心或者应用商店内搜索。 它在 **Pop!_Shop** 分类下可见。所以,它在绝大多数官方源中都能找到。 +首先,你可以直接在软件中心或者应用商店内搜索。 它在 “Pop!_Shop” 之下。所以,它在绝大多数官方源中都能找到。 如果你在这些地方都没有找到,你可以手动添加源,并从终端上安装它,你需要输入以下命令: @@ -110,15 +88,37 @@ sudo apt update sudo apt install com.github.tkashkin.gamehub ``` -如果你遇到了 “**add-apt-repository command not found**” 这个错误,你可以看看,[add-apt-repository not found error.][19]这篇文章,它能帮你解决这一问题。 +如果你遇到了 “add-apt-repository command not found” 这个错误,你可以看看,[add-apt-repository not found error.][19]这篇文章,它能帮你解决这一问题。 -这里还提供AppImage 和 FlatPak版本。 在[官网][2] 上,你可以针对找到其他Linux发行版的安装手册。 +这里还提供 AppImage 和 FlatPak 版本。 在[官网][2] 上,你可以针对找到其他 Linux 发行版的安装手册。 -同时,你还可以从它的 [GitHub页面][20]下载之前版本的安装包. +同时,你还可以从它的 [GitHub 页面][20]下载之前版本的安装包. [GameHub][2] -**注意** +### 如何在 GameHub 上管理你的游戏? + +在启动程序后,你可以将自己的 Steam/GOG/Humble Bundle 账号添加进来。 + +对于 Steam,你需要在 Linux 发行版上安装 Steam 客户端。一旦安装完成,你可以轻松将账号中的游戏导入 GameHub。 + +![][16] + +对于 GOG & Humble Bundle,登录后,就能直接在 GameHub 上管理游戏了。 + +如果你想添加模拟器或者本地安装文件,点击窗口右上角的 “+” 按钮进行添加。 + +### 如何安装游戏? + +对于 Steam 游戏,它会自动启动 Steam 客户端,从而下载/安装游戏(我希望之后安装游戏,可以不用启动 Steam!) + +![][17] + +但对于 GOG/Humble Bundle,登录后就能直接、下载安装游戏。必要的话,对于那些不支持在 Linux 上运行的游戏,你可以使用兼容工具。 + +无论是模拟器游戏,还是本地游戏,只需添加安装包或导入模拟器镜像就可以了。这里没什么其他步骤要做。 + +### 注意 GameHub 是相当灵活的一个集中游戏管理应用。 用户界面和选项设置也相当直观。 @@ -132,8 +132,8 @@ via: https://itsfoss.com/gamehub/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[wenwensnow](https://github.com/wenwensnow) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f85cc1a77e04be8417afa0523d3fcc3130a2f63e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Oct 2019 00:07:32 +0800 Subject: [PATCH 168/800] PUB @wenwensnow https://linux.cn/article-11504-1.html --- ...Use GameHub to Manage All Your Linux Games in One Place.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191005 Use GameHub to Manage All Your Linux Games in One Place.md (99%) diff --git a/translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/published/20191005 Use GameHub to Manage All Your Linux Games in One Place.md similarity index 99% rename from translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md rename to published/20191005 Use GameHub to Manage All Your Linux Games in One Place.md index d762e941bf..5c4de853c5 100644 --- a/translated/tech/20191005 Use GameHub to Manage All Your Linux Games in One Place.md +++ b/published/20191005 Use GameHub to Manage All Your Linux Games in One Place.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wenwensnow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11504-1.html) [#]: subject: (Use GameHub to Manage All Your Linux Games in One Place) [#]: via: (https://itsfoss.com/gamehub/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 51b4a15587cf5da0969367e9276582cff28ab9c2 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Sun, 27 Oct 2019 00:12:46 +0200 Subject: [PATCH 169/800] Update 20191023 How to dual boot Windows 10 and Debian 10.md --- .../tech/20191023 How to dual boot Windows 10 and Debian 10.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md index 6bc74a6b8e..d445417c83 100644 --- a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md +++ b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wenwensnow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b628af3e67f2ceb5822bfc67ceab73fd6fbf2843 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Oct 2019 06:19:51 +0800 Subject: [PATCH 170/800] Rename sources/talk/20191023 Cisco issues critical security warning for IOS XE REST API container.md to sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md --- ...ues critical security warning for IOS XE REST API container.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => news}/20191023 Cisco issues critical security warning for IOS XE REST API container.md (100%) diff --git a/sources/talk/20191023 Cisco issues critical security warning for IOS XE REST API container.md b/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md similarity index 100% rename from sources/talk/20191023 Cisco issues critical security warning for IOS XE REST API container.md rename to sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md From a0ff2d96c4b92e85922fef9a53a3dc565cb0cf7e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Oct 2019 06:29:35 +0800 Subject: [PATCH 171/800] PRF @geekpi --- ...ure Rsyslog Server in CentOS 8 - RHEL 8.md | 74 +++++++++---------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md b/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md index 370c68d163..26e04809db 100644 --- a/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md +++ b/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md @@ -1,27 +1,27 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Configure Rsyslog Server in CentOS 8 / RHEL 8) [#]: via: (https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) -如何在 CentOS 8 / RHEL 8 中配置 Rsyslog 服务器 +如何在 CentOS8/RHEL8 中配置 Rsyslog 服务器 ====== -**Rsyslog** 是一个免费的开源日志记录程序,默认下在 **CentOS** 8 和 **RHEL** 8 系统上存在。它提供了一种从客户端节点到单个中央服务器的“集中日志”的简单有效的方法。日志集中化有两个好处。首先,它简化了日志查看,因为系统管理员可以在一个中心节点查看远程服务器的所有日志,而无需登录每个客户端系统来检查日志。如果需要监视多台服务器,这将非常有用,其次,如果远程客户端崩溃,你不用担心丢失日志,因为所有日志都将保存在**中央 rsyslog 服务器上**。Rsyslog 取代了仅支持 **UDP** 协议的 syslog。它以优异的功能扩展了基本的 syslog 协议,例如在传输日志时支持 **UDP** 和 **TCP**协议,增强的过滤功能以及灵活的配置选项。让我们来探讨如何在 CentOS 8 / RHEL 8 系统中配置 Rsyslog 服务器。 +![](https://img.linux.net.cn/data/attachment/album/201910/27/062908v4nnzgf7bhnplgvg.jpg) -[![configure-rsyslog-centos8-rhel8][1]][2] +Rsyslog 是一个自由开源的日志记录程序,在 CentOS 8 和 RHEL 8 系统上默认可用。它提供了一种从客户端节点到单个中央服务器的“集中日志”的简单有效的方法。日志集中化有两个好处。首先,它简化了日志查看,因为系统管理员可以在一个中心节点查看远程服务器的所有日志,而无需登录每个客户端系统来检查日志。如果需要监视多台服务器,这将非常有用,其次,如果远程客户端崩溃,你不用担心丢失日志,因为所有日志都将保存在中心的 Rsyslog 服务器上。rsyslog 取代了仅支持 UDP 协议的 syslog。它以优异的功能扩展了基本的 syslog 协议,例如在传输日志时支持 UDP 和 TCP 协议,增强的过滤功能以及灵活的配置选项。让我们来探讨如何在 CentOS 8 / RHEL 8 系统中配置 Rsyslog 服务器。 + +![configure-rsyslog-centos8-rhel8][2] ### 预先条件 我们将搭建以下实验环境来测试集中式日志记录过程: - * **Rsyslog 服务器**       CentOS 8 Minimal    IP 地址: 10.128.0.47 - * **客户端系统**         RHEL 8 Minimal      IP 地址: 10.128.0.48 - - + * Rsyslog 服务器       CentOS 8 Minimal    IP 地址: 10.128.0.47 + * 客户端系统          RHEL 8 Minimal      IP 地址: 10.128.0.48 通过上面的设置,我们将演示如何设置 Rsyslog 服务器,然后配置客户端系统以将日志发送到 Rsyslog 服务器进行监视。 @@ -35,30 +35,30 @@ $ systemctl status rsyslog ``` -示例输出 +示例输出: -![rsyslog-service-status-centos8][1] +![rsyslog-service-status-centos8](https://www.linuxtechi.com/wp-content/uploads/2019/10/rsyslog-service-status-centos8.jpg) -如果由于某种原因不存在 rsyslog,那么可以使用以下命令进行安装: +如果由于某种原因 Rsyslog 不存在,那么可以使用以下命令进行安装: ``` $ sudo yum install rsyslog ``` -接下来,你需要修改 Rsyslog 配置文件中的一些设置。打开配置文件。 +接下来,你需要修改 Rsyslog 配置文件中的一些设置。打开配置文件: ``` $ sudo vim /etc/rsyslog.conf ``` -滚动并取消注释下面的行,以允许通过 UDP 协议接收日志 +滚动并取消注释下面的行,以允许通过 UDP 协议接收日志: ``` module(load="imudp") # needs to be done just once input(type="imudp" port="514") ``` -![rsyslog-conf-centos8-rhel8][1] +![rsyslog-conf-centos8-rhel8](https://www.linuxtechi.com/wp-content/uploads/2019/10/rsyslog-conf-centos8-rhel8.jpg) 同样,如果你希望启用 TCP rsyslog 接收,请取消注释下面的行: @@ -67,47 +67,47 @@ module(load="imtcp") # needs to be done just once input(type="imtcp" port="514") ``` -![rsyslog-conf-tcp-centos8-rhel8][1] +![rsyslog-conf-tcp-centos8-rhel8](https://www.linuxtechi.com/wp-content/uploads/2019/10/rsyslog-conf-tcp-centos8-rhel8.jpg) 保存并退出配置文件。 -要从客户端系统接收日志,我们需要在防火墙上打开 Rsyslog 默认端口 514。为此,请运行 +要从客户端系统接收日志,我们需要在防火墙上打开 Rsyslog 默认端口 514。为此,请运行: ``` # sudo firewall-cmd --add-port=514/tcp --zone=public --permanent ``` -接下来,重新加载防火墙保存更改 +接下来,重新加载防火墙保存更改: ``` # sudo firewall-cmd --reload ``` -示例输出 +示例输出: -![firewall-ports-rsyslog-centos8][1] +![firewall-ports-rsyslog-centos8](https://www.linuxtechi.com/wp-content/uploads/2019/10/firewall-ports-rsyslog-centos8.jpg) -接下来,重启 Rsyslog 服务器 +接下来,重启 Rsyslog 服务器: ``` $ sudo systemctl restart rsyslog ``` -要在启动时运行 Rsyslog,运行以下命令 +要在启动时运行 Rsyslog,运行以下命令: ``` $ sudo systemctl enable rsyslog ``` -要确认 Rsyslog 服务器正在监听 514 端口,请使用 netstat 命令,如下所示: +要确认 Rsyslog 服务器正在监听 514 端口,请使用 `netstat` 命令,如下所示: ``` $ sudo netstat -pnltu ``` -示例输出 +示例输出: -![netstat-rsyslog-port-centos8][1] +![netstat-rsyslog-port-centos8](https://www.linuxtechi.com/wp-content/uploads/2019/10/netstat-rsyslog-port-centos8.jpg) 完美!我们已经成功配置了 Rsyslog 服务器来从客户端系统接收日志。 @@ -127,42 +127,42 @@ $ tail -f /var/log/messages $ sudo systemctl status rsyslog ``` -示例输出 +示例输出: -![client-rsyslog-service-rhel8][1] +![client-rsyslog-service-rhel8](https://www.linuxtechi.com/wp-content/uploads/2019/10/client-rsyslog-service-rhel8.jpg) -接下来,打开 rsyslog 配置文件 +接下来,打开 rsyslog 配置文件: ``` $ sudo vim /etc/rsyslog.conf ``` -在文件末尾,添加以下行 +在文件末尾,添加以下行: ``` *.* @10.128.0.47:514 # Use @ for UDP protocol *.* @@10.128.0.47:514 # Use @@ for TCP protocol ``` -保存并退出配置文件。就像 Rsyslog 服务器一样,打开 514 端口,这是防火墙上的默认 Rsyslog 端口。 +保存并退出配置文件。就像 Rsyslog 服务器一样,打开 514 端口,这是防火墙上的默认 Rsyslog 端口: ``` $ sudo firewall-cmd --add-port=514/tcp --zone=public --permanent ``` -接下来,重新加载防火墙以保存更改 +接下来,重新加载防火墙以保存更改: ``` $ sudo firewall-cmd --reload ``` -接下来,重启 rsyslog 服务 +接下来,重启 rsyslog 服务: ``` $ sudo systemctl restart rsyslog ``` -要在启动时运行 Rsyslog,请运行以下命令 +要在启动时运行 Rsyslog,请运行以下命令: ``` $ sudo systemctl enable rsyslog @@ -178,15 +178,15 @@ $ sudo systemctl enable rsyslog # logger "Hello guys! This is our first log" ``` -现在进入 Rsyslog 服务器并运行以下命令来实时查看日志消息 +现在进入 Rsyslog 服务器并运行以下命令来实时查看日志消息: ``` # tail -f /var/log/messages ``` -客户端系统上命令运行的输出显示在了 Rsyslog 服务器的日志中,这意味着 Rsyslog 服务器正在接收来自客户端系统的日志。 +客户端系统上命令运行的输出显示在了 Rsyslog 服务器的日志中,这意味着 Rsyslog 服务器正在接收来自客户端系统的日志: -![centralize-logs-rsyslogs-centos8][1] +![centralize-logs-rsyslogs-centos8](https://www.linuxtechi.com/wp-content/uploads/2019/10/centralize-logs-rsyslogs-centos8.jpg) 就是这些了!我们成功设置了 Rsyslog 服务器来接收来自客户端系统的日志信息。 @@ -197,11 +197,11 @@ via: https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/ 作者:[James Kiarie][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.linuxtechi.com/author/james/ [b]: https://github.com/lujun9972 [1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/configure-rsyslog-centos8-rhel8.jpg \ No newline at end of file +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/configure-rsyslog-centos8-rhel8.jpg From 6768f51b19936f6be477087f2f7e9b38f75a0216 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Oct 2019 06:30:04 +0800 Subject: [PATCH 172/800] PUB @geekpi https://linux.cn/article-11505-1.html --- ...18 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md (98%) diff --git a/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md b/published/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md similarity index 98% rename from translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md rename to published/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md index 26e04809db..ba0505daf9 100644 --- a/translated/tech/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md +++ b/published/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11505-1.html) [#]: subject: (How to Configure Rsyslog Server in CentOS 8 / RHEL 8) [#]: via: (https://www.linuxtechi.com/configure-rsyslog-server-centos-8-rhel-8/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) From 2e1adab2e6558041607599052043f06e62d2b456 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Oct 2019 06:42:52 +0800 Subject: [PATCH 173/800] PRF @Morisun029 --- ...o use IoT devices to keep children safe.md | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/translated/talk/20191011 How to use IoT devices to keep children safe.md b/translated/talk/20191011 How to use IoT devices to keep children safe.md index f85cd46dd7..7d81118126 100644 --- a/translated/talk/20191011 How to use IoT devices to keep children safe.md +++ b/translated/talk/20191011 How to use IoT devices to keep children safe.md @@ -1,52 +1,54 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to use IoT devices to keep children safe?) [#]: via: (https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children-safe/) [#]: author: (Andrew Carroll https://opensourceforu.com/author/andrew-carroll/) -如何使用物联网设备来确保儿童安全? +如何使用物联网设备来确保儿童安全? ====== -[![][1]][2] +![][1] + +IoT (物联网)设备正在迅速改变我们的生活。这些设备无处不在,从我们的家庭到其它行业。根据一些预测数据,到 2020 年,将会有 100 亿个 IoT 设备。到 2025 年,该数量将增长到 220 亿。目前,物联网已经在很多领域得到了应用,包括智能家居、工业生产过程、农业甚至医疗保健领域。伴随着如此广泛的应用,物联网显然已经成为近年来的热门话题之一。 + +多种因素促成了物联网设备在多个学科的爆炸式增长。这其中包括低成本处理器和无线连接的的可用性,以及开源平台的信息交流推动了物联网领域的创新。与传统的应用程序开发相比,物联网设备的开发成指数级增长,因为它的资源是开源的。 -IoT (物联网)设备正在迅速改变我们的生活。这些设备无处不在,从我们的家庭到其它行业。根据一些预测数据,到2020年,将会有100亿个 IoT 设备。到2025年,该数量将增长到220亿。目前,物联网已经在很多领域得到了应用,包括智能家居,工业生产过程,农业甚至医疗保健领域。伴随着如此广泛的应用,物联网显然已经成为近年来的热门话题之一。 -多种因素促成了物联网设备在多个学科的爆炸式增长。这其中包括低成本处理器和无线连接的的可用性, 以及开源平台的信息交流推动了物联网领域的创新。与传统的应用程序开发相比,物联网设备的开发成指数级增长,因为它的资源是开源的。 在解释如何使用物联网设备来保护儿童之前,必须对物联网技术有基本的了解。 +### IoT 设备是什么? -**IOT 设备是什么?** -IOT 设备是指那些在没有人类参与的情况下彼此之间可以通信的设备。 因此,许多专家并不将智能手机和计算机视为物联网设备。 此外,物联网设备必须能够收集数据并且能将收集到的数据传送到其他设备或云端进行处理。 +IoT 设备是指那些在没有人类参与的情况下彼此之间可以通信的设备。因此,许多专家并不将智能手机和计算机视为物联网设备。此外,物联网设备必须能够收集数据并且能将收集到的数据传送到其他设备或云端进行处理。 -然而,在某些领域中,我们需要探索物联网的潜力。 儿童往往是脆弱的,他们很容易成为犯罪分子和其他蓄意伤害者的目标。 无论在物理世界还是数字世界中,儿童都很容易犯罪。 因为父母不能始终亲自到场保护孩子; 这就是为什么需要监视工具了。 +然而,在某些领域中,我们需要探索物联网的潜力。儿童往往是脆弱的,他们很容易成为犯罪分子和其他蓄意伤害者的目标。无论在物理世界还是数字世界中,儿童都很容易面临犯罪的威胁。因为父母不能始终亲自到场保护孩子;这就是为什么需要监视工具了。 -除了适用于儿童的可穿戴设备外,还有许多父母监视应用程序,例如Xnspy,可实时监控儿童并提供信息的实时更新。 这些工具可确保儿童安全。 可穿戴设备确保儿童身体上的安全性,而家长监控应用可确保儿童的上网安全。 +除了适用于儿童的可穿戴设备外,还有许多父母监视应用程序,例如 Xnspy,可实时监控儿童并提供信息的实时更新。这些工具可确保儿童安全。可穿戴设备确保儿童身体上的安全性,而家长监控应用可确保儿童的上网安全。 -由于越来越多的孩子花费时间在智能手机上,毫无意外地,他们也就成为诈骗分子的主要目标。 此外,由于恋童癖,网络自夸和其他犯罪在网络上的盛行,儿童也有可能成为网络欺凌的目标。 +由于越来越多的孩子花费时间在智能手机上,毫无意外地,他们也就成为诈骗分子的主要目标。此外,由于恋童癖、网络自夸和其他犯罪在网络上的盛行,儿童也有可能成为网络欺凌的目标。 -这些解决方案够吗? 我们需要找到物联网解决方案,以确保孩子们在网上和线下的安全。 在当代,我们如何确保孩子的安全? 我们需要提出创新的解决方案。 物联网可以帮助保护孩子在学校和家里的安全。 +这些解决方案够吗?我们需要找到物联网解决方案,以确保孩子们在网上和线下的安全。在当代,我们如何确保孩子的安全?我们需要提出创新的解决方案。 物联网可以帮助保护孩子在学校和家里的安全。 +### 物联网的潜力 -**物联网的潜力** -物联网设备提供的好处很多。 举例来说,父母可以远程监控自己的孩子,而又不会显得太霸道。 因此,儿童在拥有安全环境的同时也会有空间和自由让自己变得独立。 -而且,父母也不必在为孩子的安全而担忧。物联网设备可以提供7x24小时的信息更新。像 Xnspy 之类的监视应用程序在提供有关孩子的智能手机活动信息方面更进了一步。随着物联网设备变得越来越复杂,拥有更长使用寿命的电池只是一个时间问题。诸如位置跟踪器之类的物联网设备可以提供有关孩子下落的准确详细信息,所以父母不必担心。 +物联网设备提供的好处很多。举例来说,父母可以远程监控自己的孩子,而又不会显得太霸道。因此,儿童在拥有安全环境的同时也会有空间和自由让自己变得独立。 -虽然可穿戴设备已经非常好了,但在确保儿童安全方面,这些通常还远远不够。因此,要为儿童提供安全的环境,我们还需要其他方法。许多事件表明,学校比其他任何公共场所都容易受到攻击。因此,学校需要采取安全措施,以确保儿童和教师的安全。在这一点上,物联网设备可用于检测潜在威胁并采取必要的措施来防止攻击。威胁检测系统包括摄像头。系统一旦检测到威胁,便可以通知当局,如一些执法机构和医院。智能锁等设备可用于封锁学校(包括教室),来保护儿童。除此之外,还可以告知父母其孩子的安全,并立即收到有关威胁的警报。这将需要实施无线技术,例如 Wi-Fi 和传感器。因此,学校需要制定专门用于提供教室安全性的预算。 +而且,父母也不必在为孩子的安全而担忧。物联网设备可以提供 7x24 小时的信息更新。像 Xnspy 之类的监视应用程序在提供有关孩子的智能手机活动信息方面更进了一步。随着物联网设备变得越来越复杂,拥有更长使用寿命的电池只是一个时间问题。诸如位置跟踪器之类的物联网设备可以提供有关孩子下落的准确详细信息,所以父母不必担心。 -智能家居实现拍手关灯,也可以让你的家庭助手帮你关灯。 同样,物联网设备也可用在屋内来保护儿童。 在家里,物联网设备(例如摄像头)为父母在照顾孩子时提供100%的可见性。 当父母不在家里时,可以使用摄像头和其他传感器检测是否发生了可疑活动。 其他设备(例如连接到这些传感器的智能锁)可以锁门和窗,以确保孩子们的安全。 +虽然可穿戴设备已经非常好了,但在确保儿童安全方面,这些通常还远远不够。因此,要为儿童提供安全的环境,我们还需要其他方法。许多事件表明,儿童在学校比其他任何公共场所都容易受到攻击。因此,学校需要采取安全措施,以确保儿童和教师的安全。在这一点上,物联网设备可用于检测潜在威胁并采取必要的措施来防止攻击。威胁检测系统包括摄像头。系统一旦检测到威胁,便可以通知当局,如一些执法机构和医院。智能锁等设备可用于封锁学校(包括教室),来保护儿童。除此之外,还可以告知父母其孩子的安全,并立即收到有关威胁的警报。这将需要实施无线技术,例如 Wi-Fi 和传感器。因此,学校需要制定专门用于提供教室安全性的预算。 + +智能家居实现拍手关灯,也可以让你的家庭助手帮你关灯。同样,物联网设备也可用在屋内来保护儿童。在家里,物联网设备(例如摄像头)为父母在照顾孩子时提供 100% 的可见性。当父母不在家里时,可以使用摄像头和其他传感器检测是否发生了可疑活动。其他设备(例如连接到这些传感器的智能锁)可以锁门和窗,以确保孩子们的安全。 同样,可以引入许多物联网解决方案来确保孩子的安全。 +### 有多好就有多坏 +物联网设备中的传感器会创建大量数据。数据的安全性是至关重要的一个因素。收集的有关孩子的数据如果落入不法分子手中会存在危险。因此,需要采取预防措施。IoT 设备中泄露的任何数据都可用于确定行为模式。因此,必须对提供不违反用户隐私的安全物联网解决方案投入资金。 -**有多好就有多坏** -物联网设备中的传感器会创建大量数据。 数据的安全性是至关重要的一个因素。 收集的有关孩子的数据如果落入不法分子手中会存在危险。 因此,需要采取预防措施。 IoT 设备中泄露的任何数据都可用于确定行为模式。 因此,必须投资提供不违反用户隐私的安全物联网解决方案。 +IoT 设备通常连接到 Wi-Fi,用于设备之间传输数据。未加密数据的不安全网络会带来某些风险。这样的网络很容易被窃听。黑客可以使用此类网点来入侵系统。他们还可以将恶意软件引入系统,从而使系统变得脆弱、易受攻击。此外,对设备和公共网络(例如学校的网络)的网络攻击可能导致数据泄露和私有数据盗用。 因此,在实施用于保护儿童的物联网解决方案时,保护网络和物联网设备的总体计划必须生效。 -IoT 设备通常连接到 Wi-Fi,用于设备之间传输数据。未加密数据的不安全网络会带来某些风险。 这样的网络很容易被窃听。 黑客可以使用此类网点来入侵系统。 他们还可以将恶意软件引入系统,从而使系统变得脆弱,易受攻击。 此外,对设备和公共网络(例如学校的网络)的网络攻击可能导致数据泄露和私有数据盗用。 因此,在实施用于保护儿童的物联网解决方案时,保护网络和物联网设备的总体计划必须生效。 - -物联网设备保护儿童在学校和家里的安全的潜力尚未发现有什么创新。 我们需要付出更多努力来保护连接 IoT 设备的网络安全。 此外,物联网设备生成的数据可能落入不法分子手中,从而造成更多麻烦。 因此,这是物联网安全至关重要的一个领域。 +物联网设备保护儿童在学校和家里的安全的潜力尚未发现有什么创新。我们需要付出更多努力来保护连接 IoT 设备的网络安全。此外,物联网设备生成的数据可能落入不法分子手中,从而造成更多麻烦。因此,这是物联网安全至关重要的一个领域。 -------------------------------------------------------------------------------- @@ -55,8 +57,8 @@ via: https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children- 作者:[Andrew Carroll][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 83ad080a6bf05f6d42cd969457efb413edf40476 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 27 Oct 2019 06:43:17 +0800 Subject: [PATCH 174/800] PUB @Morisun029 https://linux.cn/article-11506-1.html --- .../20191011 How to use IoT devices to keep children safe.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20191011 How to use IoT devices to keep children safe.md (98%) diff --git a/translated/talk/20191011 How to use IoT devices to keep children safe.md b/published/20191011 How to use IoT devices to keep children safe.md similarity index 98% rename from translated/talk/20191011 How to use IoT devices to keep children safe.md rename to published/20191011 How to use IoT devices to keep children safe.md index 7d81118126..bf05a950f1 100644 --- a/translated/talk/20191011 How to use IoT devices to keep children safe.md +++ b/published/20191011 How to use IoT devices to keep children safe.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11506-1.html) [#]: subject: (How to use IoT devices to keep children safe?) [#]: via: (https://opensourceforu.com/2019/10/how-to-use-iot-devices-to-keep-children-safe/) [#]: author: (Andrew Carroll https://opensourceforu.com/author/andrew-carroll/) From ca0809c7212968e278908ec3690f3da3364a81f6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Oct 2019 07:36:11 +0800 Subject: [PATCH 175/800] Rename sources/tech/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md to sources/talk/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md --- ...24 My Linux Story- Why introduce people to the Raspberry Pi.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md (100%) diff --git a/sources/tech/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md b/sources/talk/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md similarity index 100% rename from sources/tech/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md rename to sources/talk/20191024 My Linux Story- Why introduce people to the Raspberry Pi.md From 266216f0a03265cd1dd3df353626eba1a64a7ff0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Oct 2019 07:37:01 +0800 Subject: [PATCH 176/800] Rename sources/tech/20191024 4 ways developers can have a say in what agile looks like.md to sources/talk/20191024 4 ways developers can have a say in what agile looks like.md --- ...4 4 ways developers can have a say in what agile looks like.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191024 4 ways developers can have a say in what agile looks like.md (100%) diff --git a/sources/tech/20191024 4 ways developers can have a say in what agile looks like.md b/sources/talk/20191024 4 ways developers can have a say in what agile looks like.md similarity index 100% rename from sources/tech/20191024 4 ways developers can have a say in what agile looks like.md rename to sources/talk/20191024 4 ways developers can have a say in what agile looks like.md From 59b1b67d2b78373629bb0e2adf3206f1b8caba61 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 27 Oct 2019 07:37:28 +0800 Subject: [PATCH 177/800] Rename sources/tech/20191025 Why I made the switch from Mac to Linux.md to sources/talk/20191025 Why I made the switch from Mac to Linux.md --- .../20191025 Why I made the switch from Mac to Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191025 Why I made the switch from Mac to Linux.md (100%) diff --git a/sources/tech/20191025 Why I made the switch from Mac to Linux.md b/sources/talk/20191025 Why I made the switch from Mac to Linux.md similarity index 100% rename from sources/tech/20191025 Why I made the switch from Mac to Linux.md rename to sources/talk/20191025 Why I made the switch from Mac to Linux.md From 720438ad12de7e38477f5767a6143f36578a1bcd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 00:23:21 +0800 Subject: [PATCH 178/800] APL --- ...9 Released With Debian 10.1 ‘Buster- - Other Improvements.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md b/sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md index df7ea64637..1aea606663 100644 --- a/sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md +++ b/sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 28220458ebbd0f00ad7cfdfc402eb2fe5c418b59 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 00:57:53 +0800 Subject: [PATCH 179/800] TSL&PRF --- ...bian 10.1 ‘Buster- - Other Improvements.md | 94 ------------------ ...bian 10.1 ‘Buster- - Other Improvements.md | 96 +++++++++++++++++++ 2 files changed, 96 insertions(+), 94 deletions(-) delete mode 100644 sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md create mode 100644 translated/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md diff --git a/sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md b/sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md deleted file mode 100644 index 1aea606663..0000000000 --- a/sources/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md +++ /dev/null @@ -1,94 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (MX Linux 19 Released With Debian 10.1 ‘Buster’ & Other Improvements) -[#]: via: (https://itsfoss.com/mx-linux-19/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -MX Linux 19 Released With Debian 10.1 ‘Buster’ & Other Improvements -====== - -MX Linux 18 has been one of my top recommendations for the [best Linux distributions][1], specially when considering distros other than Ubuntu. - -It is based on Debian 9.6 ‘Stretch’ – which was incredibly a fast and smooth experience. - -Now, as a major upgrade to that, MX Linux 19 brings a lot of major improvements and changes. Here, we shall take a look at the key highlights. - -### New features in MX Linux 19 - -[Subscribe to our YouTube channel for more Linux videos][2] - -#### Debian 10 ‘Buster’ - -This deserves a separate mention as Debian 10 is indeed a major upgrade from Debian 9.6 ‘Stretch’ on which MX Linux 18 was based on. - -In case you’re curious about what has changed with Debian 10 Buster, we suggest to check out our article on the [new features of Debian 10 Buster][3]. - -#### Xfce Desktop 4.14 - -![MX Linux 19][4] - -[Xfce 4.14][5] happens to be the latest offering from Xfce development team. Personally, I’m not a fan of Xfce desktop environment but it screams fast performance when you get to use it on a Linux distro (especially on MX Linux 19). - -Interestingly, we also have a quick guide to help you [customize Xfce][6] on your system. - -#### Updated Packages & Latest Debian Kernel 4.19 - -Along with updated packages for [GIMP][7], MESA, Firefox, and so on – it also comes baked in with the latest kernel 4.19 available for Debian Buster. - -#### Updated MX-Apps - -If you’ve used MX Linux before, you might be knowing that it comes pre-installed with useful MX-Apps that help you get more things done quickly. - -The apps like MX-installer and MX-packageinstaller have significantly improved. - -In addition to these two, all other MX-tools have been updated here and there to fix bugs, add new translations (or simply to improve the user experience). - -#### Other Improvements - -Considering it a major upgrade, there’s obviously a lot of under-the-hood changes than highlighted (including the latest antiX live system updates). - -You can check out more details on their [official announcement post][8]. You may also watch this video from the developers explaining all the new stuff in MX Linux 19: - -### Getting MX Linux 19 - -Even if you are using MX Linux 18 versions right now, you [cannot upgrade][9] to MX Linux 19. You need to go for a clean install like everyone else. - -You can download MX Linux 19 from this page: - -[Download MX Linux 19][10] - -**Wrapping Up** - -With MX Linux 18, I had a problem using my WiFi adapter due to a driver issue which I resolved through the [forum][11], it seems that it still hasn’t been fixed with MX Linux 19. So, you might want to take a look at my [forum post][11] if you face the same issue after installing MX Linux 19. - -If you’ve been using MX Linux 18, this definitely seems to be an impressive upgrade. - -Have you tried it yet? What are your thoughts on the new MX Linux 19 release? Let me know what you think in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/mx-linux-19/ - -作者:[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-distributions/ -[2]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[3]: https://itsfoss.com/debian-10-buster/ -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/mx-linux-19.jpg?ssl=1 -[5]: https://xfce.org/about/news -[6]: https://itsfoss.com/customize-xfce/ -[7]: https://itsfoss.com/gimp-2-10-release/ -[8]: https://mxlinux.org/blog/mx-19-patito-feo-released/ -[9]: https://mxlinux.org/migration/ -[10]: https://mxlinux.org/download-links/ -[11]: https://forum.mxlinux.org/viewtopic.php?t=52201 diff --git a/translated/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md b/translated/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md new file mode 100644 index 0000000000..ad1be5a7f7 --- /dev/null +++ b/translated/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (MX Linux 19 Released With Debian 10.1 ‘Buster’ & Other Improvements) +[#]: via: (https://itsfoss.com/mx-linux-19/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +随着 Debian 10.1 “Buster” 的发布,MX Linux 19 也发布了 +====== + +MX Linux 18 是我在[最佳 Linux 发行版][1]中的主要推荐的发行版之一,特别是当你在考虑 Ubuntu 以外的发行版时。 + +它基于 Debian 9.6 “Stretch”,具有令人难以置信的快速流畅的体验。 + +现在,作为该发行版的主要升级版本,MX Linux 19 带来了许多重大改进和变更。在这里,我们将看一下主要亮点。 + +### MX Linux 19 中的新功能 + +- [视频](https://player.vimeo.com/video/368459760) + +#### Debian 10 “Buster” + +这个值得一提,因为 Debian 10 实际上是 MX Linux 18 所基于的 Debian 9.6 “Stretch” 的主要升级。 + +如果你对 Debian 10 “Buster” 的变化感到好奇,建议你阅读有关 [Debian 10 “Buster” 的新功能][3]的文章。 + +#### Xfce 桌面 4.14 + +![MX Linux 19][4] + +[Xfce 4.14][5] 正是 Xfce 开发团队提供的最新产品。就个人而言,我不是 Xfce 桌面环境的粉丝,但是当你在 Linux 发行版(尤其是 MX Linux 19)上使用它时,它超快的性能会让你惊叹。 + +或许你会感兴趣,我们也有一个快速指南来帮助你[自定义 Xfce][6]。 + +#### 升级的软件包及最新的 Debian 内核 4.19 + +除了 [GIMP][7]、MESA、Firefox 等的更新软件包之外,它还随附有 Debian “Buster” 可用的最新内核 4.19。 + +#### 升级的 MX 系列应用 + +如果你以前使用过 MX Linux,则可能会知道它已经预装了有用的 MX 系列应用,可以帮助你快速完成更多工作。 + +像 MX-installer 和 MX-packageinstaller 这样的应用程序得到了显著改进。 + +除了这两个以外,所有其他 MX 工具也已不同程度的进行了更新和修复错误、添加了新的翻译(或只是改善了用户体验)。 + +#### 其它改进 + +考虑到这是一次重大升级,很明显,底层的更改要多于表面(包括最新的 antiX live 系统更新)。 + +你可以在他们的[官方公告][8]中查看更多详细信息。你还可以从开发人员那里观看以下视频,它介绍了 MX Linux 19 中的所有新功能: + +- [视频](https://youtu.be/4XVHA4l4Zrc) + +### 获取 MX Linux 19 + +即使是你现在正在使用 MX Linux 18 版本,你也[无法][9]升级到 MX Linux 19。你需要像其他人一样进行全新安装。 + +你可以从此页面下载 MX Linux 19: + +- [下载 MX Linux 19][10] + +### 结语 + +在 MX Linux 18 上,我在使用 WiFi 适配器时遇到了问题,通过[论坛][11]解决了该问题,但看来 MX Linux 19 仍未解决该问题。因此,如果你在安装 MX Linux 19 之后遇到了相同的问题,你可能想要查看一下我的[论坛帖子][11]。 + +如果你使用的是 MX Linux 18,那么这绝对是一个令人印象深刻的升级。 + +你尝试过了吗?你对新的 MX Linux 19 版本有何想法?让我知道你在以下评论中的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mx-linux-19/ + +作者:[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://linux.cn/article-11411-1.html +[2]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[3]: https://linux.cn/article-11071-1.html +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/mx-linux-19.jpg?ssl=1 +[5]: https://xfce.org/about/news +[6]: https://itsfoss.com/customize-xfce/ +[7]: https://itsfoss.com/gimp-2-10-release/ +[8]: https://mxlinux.org/blog/mx-19-patito-feo-released/ +[9]: https://mxlinux.org/migration/ +[10]: https://mxlinux.org/download-links/ +[11]: https://forum.mxlinux.org/viewtopic.php?t=52201 From d042ed0f46224c89f75772cace3caa42b176b832 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 01:05:07 +0800 Subject: [PATCH 180/800] PUB @wxy https://linux.cn/article-11509-1.html --- ...Released With Debian 10.1 ‘Buster- - Other Improvements.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md (98%) diff --git a/translated/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md b/published/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md similarity index 98% rename from translated/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md rename to published/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md index ad1be5a7f7..1e157e106d 100644 --- a/translated/news/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md +++ b/published/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11509-1.html) [#]: subject: (MX Linux 19 Released With Debian 10.1 ‘Buster’ & Other Improvements) [#]: via: (https://itsfoss.com/mx-linux-19/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From b3231d7d59d39824a610c2fdee5ebce772b4b771 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 07:04:06 +0800 Subject: [PATCH 181/800] PRF @PsiACE --- ...0180706 Building a Messenger App- OAuth.md | 482 +++++++++--------- 1 file changed, 240 insertions(+), 242 deletions(-) diff --git a/translated/tech/20180706 Building a Messenger App- OAuth.md b/translated/tech/20180706 Building a Messenger App- OAuth.md index 044df1e174..4758695394 100644 --- a/translated/tech/20180706 Building a Messenger App- OAuth.md +++ b/translated/tech/20180706 Building a Messenger App- OAuth.md @@ -10,7 +10,7 @@ 构建一个即时消息应用(二):OAuth ====== -[上一篇:模式](https://linux.cn/article-11396-1.html),[原文][1]。 +[上一篇:模式](https://linux.cn/article-11396-1.html)。 在这篇帖子中,我们将会通过为应用添加社交登录功能进入后端开发。 @@ -20,7 +20,7 @@ 这一步中,比较重要的是回调 URL。我们将它设置为 `http://localhost:3000/api/oauth/github/callback`。这是因为,在开发过程中,我们总是在本地主机上工作。一旦你要将应用交付生产,请使用正确的回调 URL 注册一个新的应用。 -注册以后,你将会收到「客户端 id」和「安全密钥」。安全起见,请不要与任何人分享他们 👀 +注册以后,你将会收到“客户端 id”和“安全密钥”。安全起见,请不要与任何人分享他们 👀 顺便让我们开始写一些代码吧。现在,创建一个 `main.go` 文件: @@ -28,21 +28,21 @@ package main import ( - "database/sql" - "fmt" - "log" - "net/http" - "net/url" - "os" - "strconv" + "database/sql" + "fmt" + "log" + "net/http" + "net/url" + "os" + "strconv" - "github.com/gorilla/securecookie" - "github.com/joho/godotenv" - "github.com/knq/jwt" - _ "github.com/lib/pq" - "github.com/matryer/way" - "golang.org/x/oauth2" - "golang.org/x/oauth2/github" + "github.com/gorilla/securecookie" + "github.com/joho/godotenv" + "github.com/knq/jwt" + _ "github.com/lib/pq" + "github.com/matryer/way" + "golang.org/x/oauth2" + "golang.org/x/oauth2/github" ) var origin *url.URL @@ -52,90 +52,90 @@ var cookieSigner *securecookie.SecureCookie var jwtSigner jwt.Signer func main() { - godotenv.Load() + godotenv.Load() - port := intEnv("PORT", 3000) - originString := env("ORIGIN", fmt.Sprintf("http://localhost:%d/", port)) - databaseURL := env("DATABASE_URL", "postgresql://root@127.0.0.1:26257/messenger?sslmode=disable") - githubClientID := os.Getenv("GITHUB_CLIENT_ID") - githubClientSecret := os.Getenv("GITHUB_CLIENT_SECRET") - hashKey := env("HASH_KEY", "secret") - jwtKey := env("JWT_KEY", "secret") + port := intEnv("PORT", 3000) + originString := env("ORIGIN", fmt.Sprintf("http://localhost:%d/", port)) + databaseURL := env("DATABASE_URL", "postgresql://root@127.0.0.1:26257/messenger?sslmode=disable") + githubClientID := os.Getenv("GITHUB_CLIENT_ID") + githubClientSecret := os.Getenv("GITHUB_CLIENT_SECRET") + hashKey := env("HASH_KEY", "secret") + jwtKey := env("JWT_KEY", "secret") - var err error - if origin, err = url.Parse(originString); err != nil || !origin.IsAbs() { - log.Fatal("invalid origin") - return - } + var err error + if origin, err = url.Parse(originString); err != nil || !origin.IsAbs() { + log.Fatal("invalid origin") + return + } - if i, err := strconv.Atoi(origin.Port()); err == nil { - port = i - } + if i, err := strconv.Atoi(origin.Port()); err == nil { + port = i + } - if githubClientID == "" || githubClientSecret == "" { - log.Fatalf("remember to set both $GITHUB_CLIENT_ID and $GITHUB_CLIENT_SECRET") - return - } + if githubClientID == "" || githubClientSecret == "" { + log.Fatalf("remember to set both $GITHUB_CLIENT_ID and $GITHUB_CLIENT_SECRET") + return + } - if db, err = sql.Open("postgres", databaseURL); err != nil { - log.Fatalf("could not open database connection: %v\n", err) - return - } - defer db.Close() - if err = db.Ping(); err != nil { - log.Fatalf("could not ping to db: %v\n", err) - return - } + if db, err = sql.Open("postgres", databaseURL); err != nil { + log.Fatalf("could not open database connection: %v\n", err) + return + } + defer db.Close() + if err = db.Ping(); err != nil { + log.Fatalf("could not ping to db: %v\n", err) + return + } - githubRedirectURL := *origin - githubRedirectURL.Path = "/api/oauth/github/callback" - githubOAuthConfig = &oauth2.Config{ - ClientID: githubClientID, - ClientSecret: githubClientSecret, - Endpoint: github.Endpoint, - RedirectURL: githubRedirectURL.String(), - Scopes: []string{"read:user"}, - } + githubRedirectURL := *origin + githubRedirectURL.Path = "/api/oauth/github/callback" + githubOAuthConfig = &oauth2.Config{ + ClientID: githubClientID, + ClientSecret: githubClientSecret, + Endpoint: github.Endpoint, + RedirectURL: githubRedirectURL.String(), + Scopes: []string{"read:user"}, + } - cookieSigner = securecookie.New([]byte(hashKey), nil).MaxAge(0) + cookieSigner = securecookie.New([]byte(hashKey), nil).MaxAge(0) - jwtSigner, err = jwt.HS256.New([]byte(jwtKey)) - if err != nil { - log.Fatalf("could not create JWT signer: %v\n", err) - return - } + jwtSigner, err = jwt.HS256.New([]byte(jwtKey)) + if err != nil { + log.Fatalf("could not create JWT signer: %v\n", err) + return + } - router := way.NewRouter() - router.HandleFunc("GET", "/api/oauth/github", githubOAuthStart) - router.HandleFunc("GET", "/api/oauth/github/callback", githubOAuthCallback) - router.HandleFunc("GET", "/api/auth_user", guard(getAuthUser)) + router := way.NewRouter() + router.HandleFunc("GET", "/api/oauth/github", githubOAuthStart) + router.HandleFunc("GET", "/api/oauth/github/callback", githubOAuthCallback) + router.HandleFunc("GET", "/api/auth_user", guard(getAuthUser)) - log.Printf("accepting connections on port %d\n", port) - log.Printf("starting server at %s\n", origin.String()) - addr := fmt.Sprintf(":%d", port) - if err = http.ListenAndServe(addr, router); err != nil { - log.Fatalf("could not start server: %v\n", err) - } + log.Printf("accepting connections on port %d\n", port) + log.Printf("starting server at %s\n", origin.String()) + addr := fmt.Sprintf(":%d", port) + if err = http.ListenAndServe(addr, router); err != nil { + log.Fatalf("could not start server: %v\n", err) + } } func env(key, fallbackValue string) string { - v, ok := os.LookupEnv(key) - if !ok { - return fallbackValue - } - return v + v, ok := os.LookupEnv(key) + if !ok { + return fallbackValue + } + return v } func intEnv(key string, fallbackValue int) int { - v, ok := os.LookupEnv(key) - if !ok { - return fallbackValue - } - i, err := strconv.Atoi(v) - if err != nil { - return fallbackValue - } - return i + v, ok := os.LookupEnv(key) + if !ok { + return fallbackValue + } + i, err := strconv.Atoi(v) + if err != nil { + return fallbackValue + } + return i } ``` @@ -163,30 +163,30 @@ GITHUB_CLIENT_SECRET=your_github_client_secret * `PORT`:服务器运行的端口,默认值是 `3000`。 * `ORIGIN`:你的域名,默认值是 `http://localhost:3000/`。我们也可以在这里指定端口。 * `DATABASE_URL`:Cockroach 数据库的地址。默认值是 `postgresql://root@127.0.0.1:26257/messenger?sslmode=disable`。 - * `HASH_KEY`:用于为 cookies 签名的密钥。没错,我们会使用已签名的 cookies 来确保安全。 - * `JWT_KEY`:用于签署 JSON 网络令牌(Json Web Token)的密钥。 + * `HASH_KEY`:用于为 cookie 签名的密钥。没错,我们会使用已签名的 cookie 来确保安全。 + * `JWT_KEY`:用于签署 JSON 网络令牌Web Token的密钥。 因为代码中已经设定了默认值,所以你也不用把它们写到 `.env` 文件中。 -在读取配置并连接到数据库之后,我们会创建一个 OAuth 配置。我们会使用 `ORIGIN` 来构建回调 URL(就和我们在 GitHub 页面上注册的一样)。我们的数据范围设置为 “read:user”。这会允许我们读取公开的用户信息,这里我们只需要他的用户名和头像就够了。然后我们会初始化 cookie 和 JWT 签名器。定义一些端点并启动服务器。 +在读取配置并连接到数据库之后,我们会创建一个 OAuth 配置。我们会使用 `ORIGIN` 信息来构建回调 URL(就和我们在 GitHub 页面上注册的一样)。我们的数据范围设置为 “read:user”。这会允许我们读取公开的用户信息,这里我们只需要他的用户名和头像就够了。然后我们会初始化 cookie 和 JWT 签名器。定义一些端点并启动服务器。 在实现 HTTP 处理程序之前,让我们编写一些函数来发送 HTTP 响应。 ``` func respond(w http.ResponseWriter, v interface{}, statusCode int) { - b, err := json.Marshal(v) - if err != nil { - respondError(w, fmt.Errorf("could not marshal response: %v", err)) - return - } - w.Header().Set("Content-Type", "application/json; charset=utf-8") - w.WriteHeader(statusCode) - w.Write(b) + b, err := json.Marshal(v) + if err != nil { + respondError(w, fmt.Errorf("could not marshal response: %v", err)) + return + } + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(statusCode) + w.Write(b) } func respondError(w http.ResponseWriter, err error) { - log.Println(err) - http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) + log.Println(err) + http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) } ``` @@ -198,156 +198,156 @@ func respondError(w http.ResponseWriter, err error) { ``` func githubOAuthStart(w http.ResponseWriter, r *http.Request) { - state, err := gonanoid.Nanoid() - if err != nil { - respondError(w, fmt.Errorf("could not generte state: %v", err)) - return - } + state, err := gonanoid.Nanoid() + if err != nil { + respondError(w, fmt.Errorf("could not generte state: %v", err)) + return + } - stateCookieValue, err := cookieSigner.Encode("state", state) - if err != nil { - respondError(w, fmt.Errorf("could not encode state cookie: %v", err)) - return - } + stateCookieValue, err := cookieSigner.Encode("state", state) + if err != nil { + respondError(w, fmt.Errorf("could not encode state cookie: %v", err)) + return + } - http.SetCookie(w, &http.Cookie{ - Name: "state", - Value: stateCookieValue, - Path: "/api/oauth/github", - HttpOnly: true, - }) - http.Redirect(w, r, githubOAuthConfig.AuthCodeURL(state), http.StatusTemporaryRedirect) + http.SetCookie(w, &http.Cookie{ + Name: "state", + Value: stateCookieValue, + Path: "/api/oauth/github", + HttpOnly: true, + }) + http.Redirect(w, r, githubOAuthConfig.AuthCodeURL(state), http.StatusTemporaryRedirect) } ``` -OAuth2 使用一种机制来防止 CSRF 攻击,因此它需要一个「状态」 "state"。我们使用 `Nanoid()` 来创建一个随机字符串,并用这个字符串作为状态。我们也把它保存为一个 cookie。 +OAuth2 使用一种机制来防止 CSRF 攻击,因此它需要一个“状态”(`state`)。我们使用 `Nanoid()` 来创建一个随机字符串,并用这个字符串作为状态。我们也把它保存为一个 cookie。 ### OAuth 回调 -一旦用户授权我们访问他的个人信息,他将会被重定向到这个端点。这个 URL 的查询字符串上将会包含状态(state)和授权码(code) `/api/oauth/github/callback?state=&code=` +一旦用户授权我们访问他的个人信息,他将会被重定向到这个端点。这个 URL 的查询字符串上将会包含状态(`state`)和授权码(`code`): `/api/oauth/github/callback?state=&code=`。 ``` const jwtLifetime = time.Hour * 24 * 14 type GithubUser struct { - ID int `json:"id"` - Login string `json:"login"` - AvatarURL *string `json:"avatar_url,omitempty"` + ID int `json:"id"` + Login string `json:"login"` + AvatarURL *string `json:"avatar_url,omitempty"` } type User struct { - ID string `json:"id"` - Username string `json:"username"` - AvatarURL *string `json:"avatarUrl"` + ID string `json:"id"` + Username string `json:"username"` + AvatarURL *string `json:"avatarUrl"` } func githubOAuthCallback(w http.ResponseWriter, r *http.Request) { - stateCookie, err := r.Cookie("state") - if err != nil { - http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) - return - } + stateCookie, err := r.Cookie("state") + if err != nil { + http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) + return + } - http.SetCookie(w, &http.Cookie{ - Name: "state", - Value: "", - MaxAge: -1, - HttpOnly: true, - }) + http.SetCookie(w, &http.Cookie{ + Name: "state", + Value: "", + MaxAge: -1, + HttpOnly: true, + }) - var state string - if err = cookieSigner.Decode("state", stateCookie.Value, &state); err != nil { - http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) - return - } + var state string + if err = cookieSigner.Decode("state", stateCookie.Value, &state); err != nil { + http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) + return + } - q := r.URL.Query() + q := r.URL.Query() - if state != q.Get("state") { - http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) - return - } + if state != q.Get("state") { + http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) + return + } - ctx := r.Context() + ctx := r.Context() - t, err := githubOAuthConfig.Exchange(ctx, q.Get("code")) - if err != nil { - respondError(w, fmt.Errorf("could not fetch github token: %v", err)) - return - } + t, err := githubOAuthConfig.Exchange(ctx, q.Get("code")) + if err != nil { + respondError(w, fmt.Errorf("could not fetch github token: %v", err)) + return + } - client := githubOAuthConfig.Client(ctx, t) - resp, err := client.Get("https://api.github.com/user") - if err != nil { - respondError(w, fmt.Errorf("could not fetch github user: %v", err)) - return - } + client := githubOAuthConfig.Client(ctx, t) + resp, err := client.Get("https://api.github.com/user") + if err != nil { + respondError(w, fmt.Errorf("could not fetch github user: %v", err)) + return + } - var githubUser GithubUser - if err = json.NewDecoder(resp.Body).Decode(&githubUser); err != nil { - respondError(w, fmt.Errorf("could not decode github user: %v", err)) - return - } - defer resp.Body.Close() + var githubUser GithubUser + if err = json.NewDecoder(resp.Body).Decode(&githubUser); err != nil { + respondError(w, fmt.Errorf("could not decode github user: %v", err)) + return + } + defer resp.Body.Close() - tx, err := db.BeginTx(ctx, nil) - if err != nil { - respondError(w, fmt.Errorf("could not begin tx: %v", err)) - return - } + tx, err := db.BeginTx(ctx, nil) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } - var user User - if err = tx.QueryRowContext(ctx, ` - SELECT id, username, avatar_url FROM users WHERE github_id = $1 - `, githubUser.ID).Scan(&user.ID, &user.Username, &user.AvatarURL); err == sql.ErrNoRows { - if err = tx.QueryRowContext(ctx, ` - INSERT INTO users (username, avatar_url, github_id) VALUES ($1, $2, $3) - RETURNING id - `, githubUser.Login, githubUser.AvatarURL, githubUser.ID).Scan(&user.ID); err != nil { - respondError(w, fmt.Errorf("could not insert user: %v", err)) - return - } - user.Username = githubUser.Login - user.AvatarURL = githubUser.AvatarURL - } else if err != nil { - respondError(w, fmt.Errorf("could not query user by github ID: %v", err)) - return - } + var user User + if err = tx.QueryRowContext(ctx, ` + SELECT id, username, avatar_url FROM users WHERE github_id = $1 + `, githubUser.ID).Scan(&user.ID, &user.Username, &user.AvatarURL); err == sql.ErrNoRows { + if err = tx.QueryRowContext(ctx, ` + INSERT INTO users (username, avatar_url, github_id) VALUES ($1, $2, $3) + RETURNING id + `, githubUser.Login, githubUser.AvatarURL, githubUser.ID).Scan(&user.ID); err != nil { + respondError(w, fmt.Errorf("could not insert user: %v", err)) + return + } + user.Username = githubUser.Login + user.AvatarURL = githubUser.AvatarURL + } else if err != nil { + respondError(w, fmt.Errorf("could not query user by github ID: %v", err)) + return + } - if err = tx.Commit(); err != nil { - respondError(w, fmt.Errorf("could not commit to finish github oauth: %v", err)) - return - } + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit to finish github oauth: %v", err)) + return + } - exp := time.Now().Add(jwtLifetime) - token, err := jwtSigner.Encode(jwt.Claims{ - Subject: user.ID, - Expiration: json.Number(strconv.FormatInt(exp.Unix(), 10)), - }) - if err != nil { - respondError(w, fmt.Errorf("could not create token: %v", err)) - return - } + exp := time.Now().Add(jwtLifetime) + token, err := jwtSigner.Encode(jwt.Claims{ + Subject: user.ID, + Expiration: json.Number(strconv.FormatInt(exp.Unix(), 10)), + }) + if err != nil { + respondError(w, fmt.Errorf("could not create token: %v", err)) + return + } - expiresAt, _ := exp.MarshalText() + expiresAt, _ := exp.MarshalText() - data := make(url.Values) - data.Set("token", string(token)) - data.Set("expires_at", string(expiresAt)) + data := make(url.Values) + data.Set("token", string(token)) + data.Set("expires_at", string(expiresAt)) - http.Redirect(w, r, "/callback?"+data.Encode(), http.StatusTemporaryRedirect) + http.Redirect(w, r, "/callback?"+data.Encode(), http.StatusTemporaryRedirect) } ``` 首先,我们会尝试使用之前保存的状态对 cookie 进行解码。并将其与查询字符串中的状态进行比较。如果它们不匹配,我们会返回一个 `418 I'm teapot`(未知来源)错误。 -接着,我们使用授权码生成一个令牌。这个令牌被用于创建 HTTP 客户端来向 GitHub API 发出请求。所以最终我们会向 `https://api.github.com/user` 发送一个 GET 请求。这个端点将会以 JSON 格式向我们提供当前经过身份验证的用户信息。我们将会解码这些内容,一并获取用户的 ID,登录名(用户名)和头像 URL。 +接着,我们使用授权码生成一个令牌。这个令牌被用于创建 HTTP 客户端来向 GitHub API 发出请求。所以最终我们会向 `https://api.github.com/user` 发送一个 GET 请求。这个端点将会以 JSON 格式向我们提供当前经过身份验证的用户信息。我们将会解码这些内容,一并获取用户的 ID、登录名(用户名)和头像 URL。 然后我们将会尝试在数据库上找到具有该 GitHub ID 的用户。如果没有找到,就使用该数据创建一个新的。 -之后,对于新创建的用户,我们会发出一个用户 ID 为主题(subject)的 JSON 网络令牌,并使用该令牌重定向到前端,查询字符串中一并包含该令牌的到期日(the expiration date)。 +之后,对于新创建的用户,我们会发出一个将用户 ID 作为主题(`Subject`)的 JSON 网络令牌,并使用该令牌重定向到前端,查询字符串中一并包含该令牌的到期日(`Expiration`)。 -这一 Web 应用也会被用在其他帖子,但是重定向的链接会是 `/callback?token=&expires_at=`。在那里,我们将会利用 JavaScript 从 URL 中获取令牌和到期日,并通过 `Authorization` 标头中的令牌以`Bearer token_here` 的形式对 `/ api / auth_user` 进行GET请求,来获取已认证的身份用户并将其保存到 localStorage。 +这一 Web 应用也会被用在其他帖子,但是重定向的链接会是 `/callback?token=&expires_at=`。在那里,我们将会利用 JavaScript 从 URL 中获取令牌和到期日,并通过 `Authorization` 标头中的令牌以 `Bearer token_here` 的形式对 `/api/auth_user` 进行 GET 请求,来获取已认证的身份用户并将其保存到 localStorage。 ### Guard 中间件 @@ -355,34 +355,34 @@ func githubOAuthCallback(w http.ResponseWriter, r *http.Request) { ``` type ContextKey struct { - Name string + Name string } var keyAuthUserID = ContextKey{"auth_user_id"} func guard(handler http.HandlerFunc) http.HandlerFunc { - return func(w http.ResponseWriter, r *http.Request) { - var token string - if a := r.Header.Get("Authorization"); strings.HasPrefix(a, "Bearer ") { - token = a[7:] - } else if t := r.URL.Query().Get("token"); t != "" { - token = t - } else { - http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) - return - } + return func(w http.ResponseWriter, r *http.Request) { + var token string + if a := r.Header.Get("Authorization"); strings.HasPrefix(a, "Bearer ") { + token = a[7:] + } else if t := r.URL.Query().Get("token"); t != "" { + token = t + } else { + http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) + return + } - var claims jwt.Claims - if err := jwtSigner.Decode([]byte(token), &claims); err != nil { - http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) - return - } + var claims jwt.Claims + if err := jwtSigner.Decode([]byte(token), &claims); err != nil { + http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) + return + } - ctx := r.Context() - ctx = context.WithValue(ctx, keyAuthUserID, claims.Subject) + ctx := r.Context() + ctx = context.WithValue(ctx, keyAuthUserID, claims.Subject) - handler(w, r.WithContext(ctx)) - } + handler(w, r.WithContext(ctx)) + } } ``` @@ -400,33 +400,31 @@ var guarded = guard(func(w http.ResponseWriter, r *http.Request) { ``` func getAuthUser(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - authUserID := ctx.Value(keyAuthUserID).(string) + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) - var user User - if err := db.QueryRowContext(ctx, ` - SELECT username, avatar_url FROM users WHERE id = $1 - `, authUserID).Scan(&user.Username, &user.AvatarURL); err == sql.ErrNoRows { - http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) - return - } else if err != nil { - respondError(w, fmt.Errorf("could not query auth user: %v", err)) - return - } + var user User + if err := db.QueryRowContext(ctx, ` + SELECT username, avatar_url FROM users WHERE id = $1 + `, authUserID).Scan(&user.Username, &user.AvatarURL); err == sql.ErrNoRows { + http.Error(w, http.StatusText(http.StatusTeapot), http.StatusTeapot) + return + } else if err != nil { + respondError(w, fmt.Errorf("could not query auth user: %v", err)) + return + } - user.ID = authUserID + user.ID = authUserID - respond(w, user, http.StatusOK) + respond(w, user, http.StatusOK) } ``` 我们使用 Guard 中间件来获取当前经过身份认证的用户 ID 并查询数据库。 -* * * - 这一部分涵盖了后端的 OAuth 流程。在下一篇帖子中,我们将会看到如何开始与其他用户的对话。 -[源代码][3] +- [源代码][3] -------------------------------------------------------------------------------- @@ -435,7 +433,7 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] 译者:[PsiACE](https://github.com/PsiACE) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 267db1ae06058543268b62b921f2eaa3dfc79869 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 07:04:37 +0800 Subject: [PATCH 182/800] PUB @PsiACE https://linux.cn/article-11510-1.html --- .../20180706 Building a Messenger App- OAuth.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20180706 Building a Messenger App- OAuth.md (99%) diff --git a/translated/tech/20180706 Building a Messenger App- OAuth.md b/published/20180706 Building a Messenger App- OAuth.md similarity index 99% rename from translated/tech/20180706 Building a Messenger App- OAuth.md rename to published/20180706 Building a Messenger App- OAuth.md index 4758695394..62b85717d5 100644 --- a/translated/tech/20180706 Building a Messenger App- OAuth.md +++ b/published/20180706 Building a Messenger App- OAuth.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (PsiACE) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11510-1.html) [#]: subject: (Building a Messenger App: OAuth) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-oauth/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) From eaeddba4a5930537f5758feec8d5e05fac126f9a Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 Oct 2019 08:56:08 +0800 Subject: [PATCH 183/800] translated --- ...023 Using SSH port forwarding on Fedora.md | 106 ----------------- ...023 Using SSH port forwarding on Fedora.md | 107 ++++++++++++++++++ 2 files changed, 107 insertions(+), 106 deletions(-) delete mode 100644 sources/tech/20191023 Using SSH port forwarding on Fedora.md create mode 100644 translated/tech/20191023 Using SSH port forwarding on Fedora.md diff --git a/sources/tech/20191023 Using SSH port forwarding on Fedora.md b/sources/tech/20191023 Using SSH port forwarding on Fedora.md deleted file mode 100644 index 5bf45983d2..0000000000 --- a/sources/tech/20191023 Using SSH port forwarding on Fedora.md +++ /dev/null @@ -1,106 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using SSH port forwarding on Fedora) -[#]: via: (https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/) -[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) - -Using SSH port forwarding on Fedora -====== - -![][1] - -You may already be familiar with using the _[ssh][2]_ [command][2] to access a remote system. The protocol behind _ssh_ allows terminal input and output to flow through a [secure channel][3]. But did you know that you can also use _ssh_ to send and receive other data securely as well? One way is to use _port forwarding_, which allows you to connect network ports securely while conducting your _ssh_ session. This article shows you how it works. - -### About ports - -A standard Linux system has a set of network ports already assigned, from 0-65535. Your system reserves ports up to 1023 for system use. In many systems you can’t elect to use one of these low-numbered ports. Quite a few ports are commonly expected to run specific services. You can find these defined in your system’s _/etc/services_ file. - -You can think of a network port like a physical port or jack to which you can connect a cable. That port may connect to some sort of service on the system, like wiring behind that physical jack. An example is the Apache web server (also known as _httpd_). The web server usually claims port 80 on the host system for HTTP non-secure connections, and 443 for HTTPS secure connections. - -When you connect to a remote system, such as with a web browser, you are also “wiring” your browser to a port on your host. This is usually a random high port number, such as 54001. The port on your host connects to the port on the remote host, such as 443 to reach its secure web server. - -So why use port forwarding when you have so many ports available? Here are a couple common cases in the life of a web developer. - -### Local port forwarding - -Imagine that you are doing web development on a remote system called _remote.example.com_. You usually reach this system via _ssh_ but it’s behind a firewall that allows very little additional access, and blocks most other ports. To try out your web app, it’s helpful to be able to use your web browser to point to the remote system. But you can’t reach it via the normal method of typing the URL in your browser, thanks to that pesky firewall. - -Local forwarding allows you to tunnel a port available via the remote system through your _ssh_ connection. The port appears as a local port on your system (thus “local forwarding.”) - -Let’s say your web app is running on port 8000 on the _remote.example.com_ box. To locally forward that system’s port 8000 to your system’s port 8000, use the _-L_ option with _ssh_ when you start your session: - -``` -$ ssh -L 8000:localhost:8000 remote.example.com -``` - -Wait, why did we use _localhost_ as the target for forwarding? It’s because from the perspective of _remote.example.com_, you’re asking the host to use its own port 8000. (Recall that any host usually can refer to itself as _localhost_ to connect to itself via a network connection.) That port now connects to your system’s port 8000. Once the _ssh_ session is ready, keep it open, and you can type __ in your browser to see your web app. The traffic between systems now travels securely over an _ssh_ tunnel! - -If you have a sharp eye, you may have noticed something. What if we used a different hostname than _localhost_ for the _remote.example.com_ to forward? If it can reach a port on another system on its network, it usually can forward that port just as easily. For example, say you wanted to reach a MariaDB or MySQL service on the _db.example.com_ box also on the remote network. This service typically runs on port 3306. So you could forward it with this command, even if you can’t _ssh_ to the actual _db.example.com_ host: - -``` -$ ssh -L 3306:db.example.com:3306 remote.example.com -``` - -Now you can run MariaDB commands against your _localhost_ and you’re actually using the _db.example.com_ box. - -### Remote port forwarding - -Remote forwarding lets you do things the opposite way. Imagine you’re designing a web app for a friend at the office, and want to show them your work. Unfortunately, though, you’re working in a coffee shop, and because of the network setup, they can’t reach your laptop via a network connection. However, you both use the _remote.example.com_ system at the office and you can still log in there. Your web app seems to be running well on port 5000 locally. - -Remote port forwarding lets you tunnel a port from your local system through your _ssh_ connection, and make it available on the remote system. Just use the _-R_ option when you start your _ssh_ session: - -``` -$ ssh -R 6000:localhost:5000 remote.example.com -``` - -Now when your friend inside the corporate firewall runs their browser, they can point it at __ and see your work. And as in the local port forwarding example, the communications travel securely over your _ssh_ session. - -By default the _sshd_ daemon running on a host is set so that **only** that host can connect to its remote forwarded ports. Let’s say your friend wanted to be able to let people on other _example.com_ corporate hosts see your work, and they weren’t on _remote.example.com_ itself. You’d need the owner of the _remote.example.com_ host to add **one** of these options to _/etc/ssh/sshd_config_ on that box: - -``` -GatewayPorts yes # OR -GatewayPorts clientspecified -``` - -The first option means remote forwarded ports are available on all the network interfaces on _remote.example.com_. The second means that the client who sets up the tunnel gets to choose the address. This option is set to **no** by default. - -With this option, you as the _ssh_ client must still specify the interfaces on which the forwarded port on your side can be shared. Do this by adding a network specification before the local port. There are several ways to do this, including the following: - -``` -$ ssh -R *:6000:localhost:5000 # all networks -$ ssh -R 0.0.0.0:6000:localhost:5000 # all networks -$ ssh -R 192.168.1.15:6000:localhost:5000 # single network -$ ssh -R remote.example.com:6000:localhost:5000 # single network -``` - -### Other notes - -Notice that the port numbers need not be the same on local and remote systems. In fact, at times you may not even be able to use the same port. For instance, normal users may not to forward onto a system port in a default setup. - -In addition, it’s possible to restrict forwarding on a host. This might be important to you if you need tighter security on a network-connected host. The _PermitOpen_ option for the _sshd_ daemon controls whether, and which, ports are available for TCP forwarding. The default setting is **any**, which allows all the examples above to work. To disallow any port fowarding, choose **none**, or choose only a specific **host:port** setting to permit. For more information, search for _PermitOpen_ in the manual page for _sshd_ daemon configuration: - -``` -$ man sshd_config -``` - -Finally, remember port forwarding only happens as long as the controlling _ssh_ session is open. If you need to keep the forwarding active for a long period, try running the session in the background using the _-N_ option. Make sure your console is locked to prevent tampering while you’re away from it. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/ - -作者:[Paul W. Frields][a] -选题:[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/pfrields/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/ssh-port-forwarding-816x345.jpg -[2]: https://en.wikipedia.org/wiki/Secure_Shell -[3]: https://fedoramagazine.org/open-source-ssh-clients/ diff --git a/translated/tech/20191023 Using SSH port forwarding on Fedora.md b/translated/tech/20191023 Using SSH port forwarding on Fedora.md new file mode 100644 index 0000000000..7930374385 --- /dev/null +++ b/translated/tech/20191023 Using SSH port forwarding on Fedora.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using SSH port forwarding on Fedora) +[#]: via: (https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +在 Fedora 上使用 SSH 端口转发 +====== + +![][1] + +你可能已经熟悉使用 _ [ssh 命令][2]_ 访问远程系统。 _ssh_ 后面的协议允许终端输入和输出经过[安全通道][3]。但是你知道你也可以使用 _ssh_ 来安全地发送和接收其他数据吗?一种方法是使用_端口转发_,它允许你在进行 _ssh_ 会话时安全地连接网络端口。本文向你展示了它是如何工作的。 + +### 关于端口 + +标准 Linux 系统已分配了一组网络端口,范围是 0-65535。你的系统最多保留 1023 个端口供系统使用。在许多系统中,你不能选择使用这些低端口号。通常有几个端口用于运行特定的服务。你可以在系统的 _/etc/services_ 文件中找到这些定义。 + +你可以认为网络端口是类似物理端口或可以连接到电缆的插孔。端口可以连接到系统上的某种服务,类似物理插孔后面的接线。一个例子是 Apache Web 服务器(也称为 _httpd_)。对于 HTTP 非安全连接,Web 服务器通常要求在主机系统上使用端口 80,对于 HTTPS 安全连接通常要求使用 443。 + +当你连接到远程系统(例如,使用 Web 浏览器)时,你是将浏览器“连接”到主机上的端口。这通常是一个随机的高端口号,例如 54001。主机上的端口连接到远程主机上的端口(例如 443)来访问其安全的 Web 服务器。 + +那么,当你有这么多可用端口时,为什么还要使用端口转发呢?这是 Web 开发人员生活中的几种常见情况。 + +### 本地端口转发 + +想象一下,你正在名为 _remote.example.com_ 的远程系统上进行 Web 开发。通常,你是通过 _ssh_ 进入此系统的,但是它位于防火墙后面,而且该防火墙允许很少的其他访问,并且会阻塞大多数其他端口。要尝试你的网络应用,能够使用浏览器访问远程系统会很有帮助。但是,由于使用了讨厌的防火墙,你无法通过在浏览器中输入 URL 的常规方法来访问它。 + +本地转发使你可以通过 _ssh_ 连接来建立可通过远程系统访问的端口。该端口在系统上显示为本地端口(也称为“本地转发”)。 + +假设你的网络应用在 _remote.example.com_ 的 8000 端口上运行。要将那个系统的 8000 端口本地转发到你系统上的 8000 端口,请在开始会话时将 _-L_ 选项与 _ssh_ 结合使用: + +``` +$ ssh -L 8000:localhost:8000 remote.example.com +``` + +等等,为什么我们使用 _localhost_ 作为转发目标?这是因为从 _remote.example.com_ 的角度来看,你是在要求主机使用其自己的端口 8000。(回想一下,任何主机通常可以将自己作为 _localhost_ 来通过网络连接其自身。)现在那个端口连接到你系统的 8000 端口了。_ssh_ 会话准备就绪后,将其保持打开状态,然后可以在浏览器中键入 __ 来查看你的 Web 应用。现在,系统之间的流量可以通过 _ssh_ 隧道安全地传输! + +如果你有敏锐的眼睛,你可能已经注意到了一些东西。如果我们使用与 _localhost_ 不同的主机名来转发 _remote.example.com_ 怎么办?如果它可以访问其网络上另一个系统上的端口,那么通常可以同样轻松地转发该端口。例如,假设你想在远程网络的 _db.example.com_ 中访问 MariaDB 或 MySQL 服务。该服务通常在端口 3306 上运行。因此,即使你无法 _ssh_ 到实际的 _db.example.com_ 主机,你也可以使用此命令将其转发: + +``` +$ ssh -L 3306:db.example.com:3306 remote.example.com +``` + +现在,你可以在 _localhost_ 上运行 MariaDB 命令,这实际上是在使用 _db.example.com_ 主机。 + +### 远程端口转发 + +远程转发让你可以进行相反操作。想象一下,你正在为办公室的朋友设计一个 Web 应用,并想向他们展示你的工作。不过,不幸的是,你在咖啡店里工作,并且由于网络设置,他们无法通过网络连接访问你的笔记本电脑。但是,你同时使用着办公室的 _remote.example.com_ 系统,并且仍然可在这里登录。你的 Web 应用似乎在本地 5000 端口上运行良好。 + +远程端口转发使你可以通过 _ssh_ 连接从本地系统建立端口的隧道,并使该端口在远程系统上可用。在开始 _ssh_ 会话时,只需使用 _-R_ 选项: + +``` +$ ssh -R 6000:localhost:5000 remote.example.com +``` + +现在,当在公司防火墙内的朋友打开浏览器时,他们可以进入 _ _ 并查看你的工作。就像在本地端口转发示例中一样,通信通过 _ssh_ 会话安全地进行。 + +默认情况下,_sshd_ 设置在本机运行,因此**只有**该主机可以连接它的远程转发端口。假设你的朋友希望能够让其他 _example.com_ 公司主机上的人看到你的工作,而他们不在 _remote.example.com_ 上。你需要让 _remote.example.com_ 主机的所有者将以下选项之**一**添加 _/etc/ssh/sshd_config_ 中: + +``` +GatewayPorts yes # 或 +GatewayPorts clientspecified +``` + +第一个选项意味着 _remote.example.com_ 上的所有网络接口都可以使用远程转发的端口。第二个意味着建立隧道的客户端可以选择地址。默认情况下,此选项设置为 **no**。 + +With this option, you as the _ssh_ client must still specify the interfaces on which the forwarded port on your side can be shared. Do this by adding a network specification before the local port. There are several ways to do this, including the following: +使用此选项,作为 _ssh_ 客户端你仍必须指定可以共享你这边转发端口的接口。通过在本地端口之前添加网络规范来进行操作。有几种方法可以做到,包括: + +``` +$ ssh -R *:6000:localhost:5000 # 所有网络 +$ ssh -R 0.0.0.0:6000:localhost:5000 # 所有网络 +$ ssh -R 192.168.1.15:6000:localhost:5000 # 单个网络 +$ ssh -R remote.example.com:6000:localhost:5000 # 单个网络 +``` + +### 其他注意事项 + +请注意,本地和远程系统上的端口号不必相同。实际上,有时你甚至可能无法使用相同的端口。例如,普通用户可能不会在默认设置中转发到系统端口。 + +另外,可以限制主机上的转发。如果你需要在联网主机上更严格的安全性,那么这你来说可能很重要。 _sshd_ 守护程进程 _PermitOpen_ 选项控制是否以及哪些端口可用于 TCP 转发。默认设置为 **any**,这让上面的所有示例都能正常工作。要禁止任何端口转发,请选择 “none”,或仅允许的特定的“主机:端口”。有关更多信息,请在手册页中搜索 _PermitOpen_ 来配置 _sshd_ 守护进程: + +``` +$ man sshd_config +``` + +最后,请记住,只有在 _ssh_ 会话处于打开状态时才会端口转发。如果需要长时间保持转发活动,请尝试使用 _-N_ 选项在后台运行会话。确保控制台已锁定,以防止在你离开控制台时对其进行篡改。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/ + +作者:[Paul W. Frields][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/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/ssh-port-forwarding-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Secure_Shell +[3]: https://fedoramagazine.org/open-source-ssh-clients/ From de04616f990ea3dbca1c5ca8b285a6c8f8e92229 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 28 Oct 2019 09:15:25 +0800 Subject: [PATCH 184/800] translating --- ...91025 4 cool new projects to try in COPR for October 2019.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md b/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md index 4f4717279d..196d4f40ea 100644 --- a/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md +++ b/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e0fca74b1efd8c80bcf25f9313813a3e02091e35 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 13:54:47 +0800 Subject: [PATCH 185/800] APL --- ...ys to Customize Your Linux Desktop With GNOME Tweaks Tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md b/sources/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md index 2cf9c93596..e454687cfd 100644 --- a/sources/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md +++ b/sources/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 34d172706e08726ba258c3895d966f59a04d97c1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 14:27:19 +0800 Subject: [PATCH 186/800] TSL --- ...ur Linux Desktop With GNOME Tweaks Tool.md | 167 ------------------ ...ur Linux Desktop With GNOME Tweaks Tool.md | 167 ++++++++++++++++++ 2 files changed, 167 insertions(+), 167 deletions(-) delete mode 100644 sources/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md create mode 100644 translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md diff --git a/sources/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md b/sources/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md deleted file mode 100644 index e454687cfd..0000000000 --- a/sources/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md +++ /dev/null @@ -1,167 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool) -[#]: via: (https://itsfoss.com/gnome-tweak-tool/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool -====== - -![GNOME Tweak Tool Icon][1] - -There are several ways you can tweak Ubuntu to customize its looks and behavior. The easiest way I find is by using the [GNOME Tweak tool][2]. It is also known as GNOME Tweaks or simply Tweaks. - -I have mentioned it numerous time in my tutorials in the past. Here, I list all the major tweaks you can perform with this tool. - -I have used Ubuntu here but the steps should be applicable to any Linux distribution using GNOME desktop environment. - -### Install GNOME Tweak tool in Ubuntu 18.04 and other versions - -Gnome Tweak tool is available in the [Universe repository in Ubuntu][3] so make sure that you have it enabled in your Software & Updates tool: - -![Enable Universe Repository in Ubuntu][4] - -After that, you can install GNOME Tweak tool from the software center. Just open the Software Center and search for GNOME Tweaks and install it from there: - -![Install GNOME Tweaks Tool from Software Center][5] - -Alternatively, you may also use command line to install software with [apt command][6]: - -``` -sudo apt install gnome-tweaks -``` - -### Customizing GNOME desktop with Tweaks tool - -![][7] - -GNOME Tweak tool enables you to do a number of settings changes. Some of these changes like wallpaper changes, startup applications etc are also available in the official System Settings tool. I am going to focus on tweaks that are not available in the Settings by default. - -#### 1\. Change themes - -You can [install new themes in Ubuntu][8] in various ways. But if you want to change to the newly installed theme, you’ll have to install GNOME Tweaks tool. - -You can find the theme and icon settings in Appearance section. You can browse through the available themes and icons and set the ones you like. The changes take into effect immediately. - -![Change Themes With GNOME Tweaks][9] - -#### 2\. Disable animation to speed up your desktop - -There are subtle animations for application window opening, closing, maximizing etc. You can disable these animations to speed up your system slightly as it will use slightly fewer resources. - -![Disable Animations For Slightly Faster Desktop Experience][10] - -#### 3\. Control desktop icons - -At least in Ubuntu, you’ll see the Home and Trash icons on the desktop. If you don’t like, you can choose to disable it. You can also choose which icons will be displayed on the desktop. - -![Control Desktop Icons in Ubuntu][11] - -#### 4\. Manage GNOME extensions - -I hope you are aware of [GNOME Extensions][12]. These are small ‘plugins’ for your desktop that extends the functionalities of the GNOME desktop. There are [plenty of GNOME extensions][13] that you can use to get CPU consumption in the top panel, get clipboard history etc. - -I have written in detail about [installing and using GNOME extensions][14]. Here, I assume that you are already using them and if that’s the case, you can manage them from within GNOME Tweaks. - -![Manage GNOME Extensions][15] - -#### 5\. Change fonts and scaling factor - -You can [install new fonts in Ubuntu][16] and apply the system wide font change using Tweaks tool. You can also change the scaling factor if you think the icons, text are way too small on your desktop. - -![Change Fonts and Scaling Factor][17] - -#### 6\. Control touchpad behavior like Disable touchpad while typing, Make right click on touchpad working - -The GNOME Tweaks also allows you to disable touchpad while typing. This is useful if you type fast on a laptop. The bottom of your palm may touch the touchpad and the cursor moves away to an undesired location on the screen. - -Automatically disabling touchpad while typing fixes this problem. - -![Disable Touchpad While Typing][18] - -You’ll also notice that [when you press the bottom right corner of your touchpad for right click, nothing happens][19]. There is nothing wrong with your touchpad. It’s a system settings that disables the right clicking this way for any touchpad that doesn’t have a real right click button (like the old Thinkpad laptops). Two finger click gives you the right click. - -You can also get this back by choosing Area in under Mouse Click Simulation instead of Fingers. - -![Fix Right Click Issue][20] - -You may have to [restart Ubuntu][21] in order to take the changes in effect. If you are Emacs lover, you can also force keybindings from Emacs. - -#### 7\. Change power settings - -There is only one power settings here. It allows you to put your laptop in suspend mode when the lid is closed. - -![Power Settings in GNOME Tweaks Tool][22] - -#### 8\. Decide what’s displayed in the top panel - -The top panel in your desktop gives shows a few important things. You have the calendar, network icon, system settings and the Activities option. - -You can also [display battery percentage][23], add date along with day and time and show week numbers. You can also enable hot corners so that if you take your mouse to the top left corner of the screen, you’ll get the activities view with all the running applications. - -![Top Panel Settings in GNOME Tweaks Tool][24] - -If you have the mouse focus on an application window, you’ll notice that it’s menu is displayed in the top panel. If you don’t like it, you may toggle it off and then the application menu will be available on the application itself. - -#### 9\. Configure application window - -You can decide if maximize and minimize option (the buttons on the top right corner) will be shown in the application window. You may also change their positioning between left and right. - -![Application Window Configuration][25] - -There are some other configuration options as well. I don’t use them but feel free to explore them on your own. - -#### 10\. Configure workspaces - -GNOME Tweaks tool also allows you to configure a couple of things around workspaces. - -![Configure Workspaces in Ubuntu][26] - -**In the end…** - -GNOME Tweaks tool is a must have utility for any GNOME user. It helps you configure looks and functionality of the desktop. I find it surprising that this tool is not even in Main repository of Ubuntu. In my opinion, it should be installed by default. Till then, you’ll have to install GNOME Tweak tool in Ubuntu manually. - -If you find some hidden gem in GNOME Tweaks that hasn’t been discussed here, why not share it with the rest of us? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gnome-tweak-tool/ - -作者:[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/2019/10/gnome-tweak-tool-icon.png?ssl=1 -[2]: https://wiki.gnome.org/action/show/Apps/Tweaks?action=show&redirect=Apps%2FGnomeTweakTool -[3]: https://itsfoss.com/ubuntu-repositories/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/enable-repositories-ubuntu.png?ssl=1 -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/install-gnome-tweaks-tool.jpg?ssl=1 -[6]: https://itsfoss.com/apt-command-guide/ -[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/customize-gnome-with-tweak-tool.jpg?ssl=1 -[8]: https://itsfoss.com/install-themes-ubuntu/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/change-theme-ubuntu-gnome.jpg?ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/disable-animation-ubuntu-gnome.jpg?ssl=1 -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/desktop-icons-ubuntu.jpg?ssl=1 -[12]: https://extensions.gnome.org/ -[13]: https://itsfoss.com/best-gnome-extensions/ -[14]: https://itsfoss.com/gnome-shell-extensions/ -[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/manage-gnome-extension-tweaks-tool.jpg?ssl=1 -[16]: https://itsfoss.com/install-fonts-ubuntu/ -[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/change-fonts-ubuntu-gnome.jpg?ssl=1 -[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/disable-touchpad-while-typing-ubuntu.jpg?ssl=1 -[19]: https://itsfoss.com/fix-right-click-touchpad-ubuntu/ -[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/enable-right-click-ubuntu.jpg?ssl=1 -[21]: https://itsfoss.com/schedule-shutdown-ubuntu/ -[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/power-settings-gnome-tweaks-tool.jpg?ssl=1 -[23]: https://itsfoss.com/display-battery-ubuntu/ -[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/top-panel-settings-gnome-tweaks-tool.jpg?ssl=1 -[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/windows-configuration-ubuntu-gnome-tweaks.jpg?ssl=1 -[26]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/configure-workspaces-ubuntu.jpg?ssl=1 diff --git a/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md b/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md new file mode 100644 index 0000000000..44ccc28328 --- /dev/null +++ b/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool) +[#]: via: (https://itsfoss.com/gnome-tweak-tool/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +使用 GNOME 优化工具自定义 Linux 桌面的 10 种方法 +====== + +![GNOME Tweak Tool Icon][1] + +你可以通过多种方法来调整 Ubuntu,以自定义其外观和行为。我发现最简单的方法是使用 [GNOME 优化工具][2]。它也被称为 GNOME Tweak 或简单地称为 Tweak(优化)。 + +在过去的教程中,我已经多次介绍过它。在这里,我列出了你可以使用此工具执行的所有主要优化。 + +我在这里使用的是 Ubuntu,但是这些步骤应该适用于使用 GNOME 桌面环境的任何 Linux 发行版。 + +### 在 Ubuntu 18.04 或其它版本上安装 GNOME 优化工具 + +Gnome 优化工具可从 [Ubuntu 中的 Universe 存储库][3]中安装,因此请确保已在“软件和更新”工具中启用了该工具: + +![在 Ubuntu 中启用 Universe 存储库][4] + +之后,你可以从软件中心安装 GNOME 优化工具。只需打开软件中心并搜索 “GNOME Tweaks”并从那里安装它: + +![从软件中心安装 GNOME 优化工具][5] + +或者,你也可以使用命令行通过 [apt 命令][6]安装此软件: + +``` +sudo apt install gnome-tweaks +``` + +### 用优化工具定制 GNOME 桌面 + +![][7] + +GNOME 优化工具使你可以进行许多设置更改。其中的某些更改(例如墙纸更改、启动应用程序等)也可以在官方的“系统设置”工具中找到。我将重点介绍默认情况下“设置”中不可用的优化。 + +#### 1、改变主题 + +你可以通过各种方式[在 Ubuntu 中安装新主题][8]。但是,如果要更改为新安装的主题,则必须安装GNOME 优化工具。 + +你可以在外观部分找到主题和图标设置。你可以浏览可用的主题和图标并设置所需的主题和图标。更改将立即生效。 + +![通过 GNOME 优化更改主题][9] + +#### 2\、禁用动画以提速你的桌面体验 + +应用程序窗口的打开、关闭、最大化等都有一些细微的动画。你可以禁用这些动画以稍微加快系统的速度,因为它会使用较少的资源。 + +![禁用动画以获得稍快的桌面体验][10] + +#### 3、控制桌面图标 + +至少在 Ubuntu 中,你会在桌面上看到“主目录”和“垃圾箱”图标。如果你不喜欢,可以选择禁用它。你还可以选择要在桌面上显示的图标。 + +![在 Ubuntu 中控制桌面图标][11] + +#### 4、管理 GNOME 扩展 + +我想可能知道 [GNOME 扩展][12]。这些是用于桌面的小型“插件”,可扩展 GNOME 桌面的功能。有[大量的 GNOME 扩展][13],可用于在顶部面板中查看 CPU 消耗、获取剪贴板历史记录等。 + +我已经写了一篇[安装和使用 GNOME 扩展][14]的详细文章。在这里,我假设你已经在使用它们,如果是这种情况,那么可以从 GNOME 优化工具中对其进行管理。 + +![管理 GNOME 扩展][15] + +#### 5、改变字体和缩放比例 + +你可以[在 Ubuntu 中安装新字体][16],并使用优化工具在系统范围应用字体更改。如果你认为桌面上的图标和文本太小,也可以更改缩放比例。 + +![更改字体和缩放比例][17] + +#### 6、控制触摸板行为,例如在键入时禁用触摸板,右键单击触摸板即可正常工作 + +GNOME 优化工具还允许你在键入时禁用触摸板。如果你在笔记本电脑上快速键入,这将很有用。手掌底部可能会触摸触摸板,并导致光标移至屏幕上不需要的位置。 + +在键入时自动禁用触摸板可解决此问题。 + +![键入时禁用触摸板][18] + +你还会注意到[当你按下触摸板的右下角以进行右键单击时,什么也没有发生][19]。你的触摸板并没有问题。这是一项系统设置,可对没有实体右键按钮的任何触摸板(例如旧的 Thinkpad 笔记本电脑)禁用这种右键单击功能。两指点击可为你提供右键单击操作。 + +你也可以通过在“鼠标单击模拟”下的“区域”中而不是“手指”中找到它。 + +![修复右键单击问题][20] + +你可能必须[重新启动 Ubuntu][21] 才能生效。如果你是 Emacs 爱好者,还可以从 Emacs 强制进行键盘绑定。 + +#### 7、改变电源设置 + +电源这里只有一个设置。盖上盖子后,你可以将笔记本电脑置于挂起模式。 + +![GNOME 优化工具中的电源设置][22] + +#### 8、决定什么显示在顶部面板 + +桌面的顶部面板显示了一些重要的信息。在这里有日历、网络图标、系统设置和“活动”选项。 + +你还可以[显示电池百分比][23]、添加日期以及日期和时间,并显示星期数。你还可以启用鼠标热点,以便将鼠标移至屏幕的左上角时可以获得所有正在运行的应用程序的活动视图。 + +![GNOME 优化工具中的顶部面板设置][24] + +如果将鼠标将焦点放在应用程序窗口上,则会注意到其菜单显示在顶部面板中。如果你不喜欢这样,可以将其关闭,然后应用程序菜单将显示应用程序本身。 + +#### 9、配置应用窗口 + +你可以决定是否在应用程序窗口中显示最大化和最小化选项(右上角的按钮)。你也可以在左右两边改变它们的位置。 + +![应用程序窗口配置][25] + +还有其他一些配置选项。我不使用它们,但你可以自行探索。 + +#### 10、配置工作区 + +GNOME 优化工具还允许你围绕工作区配置一些内容。 + +![在 Ubuntu 中配置工作区][26] + +### 总结 + +对于任何 GNOME 用户,GNOME 优化(Tweaks)工具都是必备工具。它可以帮助你配置桌面的外观和功能。 我感到惊讶的是,该工具甚至没有出现在 Ubuntu 的主存储库中。我认为应该默认安装它,要不,你将需得在 Ubuntu 中手动安装 GNOME 优化工具。 + +如果你在 GNOME 优化工具中发现了一些此处没有讨论的隐藏技巧,为什么不与大家分享呢? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-tweak-tool/ + +作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/gnome-tweak-tool-icon.png?ssl=1 +[2]: https://wiki.gnome.org/action/show/Apps/Tweaks?action=show&redirect=Apps%2FGnomeTweakTool +[3]: https://itsfoss.com/ubuntu-repositories/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/03/enable-repositories-ubuntu.png?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/install-gnome-tweaks-tool.jpg?ssl=1 +[6]: https://itsfoss.com/apt-command-guide/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/customize-gnome-with-tweak-tool.jpg?ssl=1 +[8]: https://itsfoss.com/install-themes-ubuntu/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/change-theme-ubuntu-gnome.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/disable-animation-ubuntu-gnome.jpg?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/desktop-icons-ubuntu.jpg?ssl=1 +[12]: https://extensions.gnome.org/ +[13]: https://itsfoss.com/best-gnome-extensions/ +[14]: https://itsfoss.com/gnome-shell-extensions/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/manage-gnome-extension-tweaks-tool.jpg?ssl=1 +[16]: https://itsfoss.com/install-fonts-ubuntu/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/change-fonts-ubuntu-gnome.jpg?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/disable-touchpad-while-typing-ubuntu.jpg?ssl=1 +[19]: https://itsfoss.com/fix-right-click-touchpad-ubuntu/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/enable-right-click-ubuntu.jpg?ssl=1 +[21]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/power-settings-gnome-tweaks-tool.jpg?ssl=1 +[23]: https://itsfoss.com/display-battery-ubuntu/ +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/top-panel-settings-gnome-tweaks-tool.jpg?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/windows-configuration-ubuntu-gnome-tweaks.jpg?ssl=1 +[26]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/configure-workspaces-ubuntu.jpg?ssl=1 From 83e522e76ae49cf0bccb239c828e36039f9c61af Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 21:30:13 +0800 Subject: [PATCH 187/800] APL --- sources/tech/20191021 Transition to Nftables.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191021 Transition to Nftables.md b/sources/tech/20191021 Transition to Nftables.md index a6b7af0e08..d257d57d9e 100644 --- a/sources/tech/20191021 Transition to Nftables.md +++ b/sources/tech/20191021 Transition to Nftables.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f006c5caab6df639050679024d09b50cd346cdb0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 28 Oct 2019 22:12:20 +0800 Subject: [PATCH 188/800] TSL --- .../tech/20191021 Transition to Nftables.md | 185 ----------------- .../tech/20191021 Transition to Nftables.md | 190 ++++++++++++++++++ 2 files changed, 190 insertions(+), 185 deletions(-) delete mode 100644 sources/tech/20191021 Transition to Nftables.md create mode 100644 translated/tech/20191021 Transition to Nftables.md diff --git a/sources/tech/20191021 Transition to Nftables.md b/sources/tech/20191021 Transition to Nftables.md deleted file mode 100644 index d257d57d9e..0000000000 --- a/sources/tech/20191021 Transition to Nftables.md +++ /dev/null @@ -1,185 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Transition to Nftables) -[#]: via: (https://opensourceforu.com/2019/10/transition-to-nftables/) -[#]: author: (Vijay Marcel D https://opensourceforu.com/author/vijay-marcel/) - -Transition to Nftables -====== - -[![][1]][2] - -_Every major distribution in the open source world is moving towards nftables as the default firewall. In short, the venerable Iptables is now dead. This article is a tutorial on how to build nftables._ - -Currently, there is an iptables-nft backend that is compatible with nftables but soon, even this will not be available. Also, as noted by Red Hat developers, sometimes it may translate the rules incorrectly. Rather than rely on an iptables-to-nftables converter, we need to know how to build our own nftables. In nftables, all the address families come under one rule. Nftables runs in the user space unlike iptables, where every module is in the kernel. It also needs less kernel updates and comes with new features such as maps, families and dictionaries. - -**Address families** -Address families determine the types of packets that are processed. There are six address families in nftables and they are: - - * ip - * ipv6 - * inet - * arp - * bridge - * netdev - - - -In nftables, the ipv4 and ipv6 protocols are combined into one single family called inet. So we do not need to specify two rules – one for ipv4 and another for ipv6. If no address family is specified, it will default to ip protocol, i.e., ipv4. Our area of interest lies in the inet family, since most home users will use either ipv4 or ipv6 protocols (see Figure 1). - -**Nftables** -A typical nftable rule contains three parts – table, chain and rules. -Tables are containers for chains and rules. They are identified by their address families and their names. Chains contain the rules needed for the _inet/arp/bridge/netdev_ protocols and are of three types — filter, NAT and route. Nftable rules can be loaded from a script or they can be typed into a terminal and then saved as a rule-set. For home users, the default chain will be filter. The inet family contains the following hooks: - - * Input - * Output - * Forward - * Pre-routing - * Post-routing - - - -**To script or not to script?** -One of the biggest questions is whether we can use a firewall script or not. The answer is: it’s your choice. Here’s some advice – if you have hundreds of rules in your firewall, then it is best to use a script, but if you are a typical home user, then you can type the commands in the terminal and then load your rule-set. Each option has its own advantages and disadvantages. In this article, we will type them in the terminal to build our firewall. - -Nftables uses a program called nft to add, create, list, delete and load rules. Make sure nftables is installed along with conntrackd and netfilter-persistent, and remove iptables, using the following command: - -``` -apt-get install nftables conntrackd netfilter-persistent -apt-get purge iptables -``` - -_nft_ needs to be run as root or use sudo. Use the following commands to list, flush, delete ruleset and load the script respectively. - -``` -nft list ruleset -nft flush ruleset -nft delete table inet filter -/usr/sbin/nft -f /etc/nftables.conf -``` - -**Input policy** -The firewall will contain three parts – input, forward and output – just like in iptables. In the terminal, type the following commands for the input firewall. Make sure you have flushed your rule-set before you begin. Our default policy will be to drop everything. We will use the inet family in the firewall. Add the following rules as root or use sudo: - -``` -nft add table inet filter -nft add chain inet filter input { type filter hook input priority 0 \; counter \; policy drop \; } -``` - -You have noticed there is something called _priority 0_. It means giving the rule higher precedence. Hooks typically give higher precedence to the negative integer. Every hook has its own precedence and the filter chain has priority 0. You can check the nftables wiki page to see the priority of each hook. -To know the network interfaces in your computer, run the following command: - -``` -ip link show -``` - -It will show the installed network interface, one local host and other Ethernet port or your wireless port. Your Ethernet port’s name looks something like this: _enpXsY_ where X and Y are numbers, and the same goes for your wireless port. We have to allow the local host and only allow established incoming connections from the Internet. -Nftables has a feature called verdict statements on how to parse a rule. The verdict statements are _accept, drop, queue, jump, goto, continue_ and _return_. Since the firewall is a simple one, we will use either _accept_ or _drop the packets_ (Figure 2). - -``` -nft add rule inet filter input iifname lo accept -nft add rule inet filter input iifname enpXsY ct state new, established, related accept -``` - -Next, we have to add rules to protect us from stealth scans. Not all stealth scans are malicious but most of them are. We have to protect the network from such scans. The first set lists the TCP flags to be tested. Of these flags, the second set lists the flags to be matched with the first. - -``` -nft add rule inet filter input iifname enpXsY tcp flags \& \(syn\|fin\) == \(syn\|fin\) drop -nft add rule inet filter input iifname enpXsY tcp flags \& \(syn\|rst\) == \(syn\|rst\) drop -nft add rule inet filter input iifname enpXsY tcp flags \& \(fin\|rst\) == \(fin\|rst\) drop -nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|fin\) == fin drop -nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|psh\) == psh drop -nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|urg\) == urg drop -``` - -Remember, we are typing these commands in the terminal. So we have to add a backslash before some special characters, to make sure the terminal interprets it as it should. If you are using a script, then this isn’t required. - -**A word of caution regarding ICMP** -The Internet Control Message Protocol (ICMP) is a diagnostic tool and so should not be dropped outright. Any attempt to fully block ICMP is unwise as it will also stop giving error messages to us. Enable only the most important control messages such as echo-request, echo-reply, destination-unreachable and time-exceeded, and reject the rest. Echo-request and echo-reply are part of ping. In the input, we only allow echo reply and in the output, we only allow the echo-request. - -``` -nft add rule inet filter input iifname enpXsY icmp type { echo-reply, destination-unreachable, time-exceeded } limit rate 1/second accept -nft add rule inet filter input iifname enpXsY ip protocol icmp drop -``` - -Finally, we are logging and dropping all the invalid packets. - -``` -nft add rule inet filter input iifname enpXsY ct state invalid log flags all level info prefix \”Invalid-Input: \” -nft add rule inet filter input iifname enpXsY ct state invalid drop -``` - -**Forward and output policy** -In both the forward and output policies, we will drop packets by default and only accept those that are established connections. - -``` -nft add chain inet filter forward { type filter hook forward priority 0 \; counter \; policy drop \; } -nft add rule inet filter forward ct state established, related accept -nft add rule inet filter forward ct state invalid drop -nft add chain inet filter output { type filter hook output priority 0 \; counter \; policy drop \; } -``` - -A typical desktop user needs only Port 80 and 443 to be allowed to access the Internet. Finally, allow acceptable ICMP protocols and drop the invalid packets while logging them. - -``` -nft add rule inet filter output oifname enpXsY tcp dport { 80, 443 } ct state established accept -nft add rule inet filter output oifname enpXsY icmp type { echo-request, destination-unreachable, time-exceeded } limit rate 1/second accept -nft add rule inet filter output oifname enpXsY ip protocol icmp drop -nft add rule inet filter output oifname enpXsY ct state invalid log flags all level info prefix \”Invalid-Output: \” -nft add rule inet filter output oifname enpXsY ct state invalid drop -``` - -Now we have to save our rule-set, otherwise it will be lost when we reboot. To do so, run the following command: - -``` -sudo nft list ruleset. > /etc/nftables.conf -``` - -We now have to load nftables at boot, for that enables the nftables service in systemd: - -``` -sudo systemctl enable nftables -``` - -Next, edit the nftables unit file to remove the Execstop option to avoid flushing the rule-set at every boot. The file is usually located in /etc/systemd/system/sysinit.target.wants/nftables.service. Now restart the nftables: - -``` -sudo systemctl restart nftables -``` - -**Logging in rsyslog** -When you log the dropped packets, they go straight to _syslog_, which makes reading your log file quite difficult. It is better to redirect your firewall logs to a separate file. Create a directory called nftables in -_/var/log_ and in it, create two files called _input.log_ and _output.log_ to store the input and output logs, respectively. Make sure rsyslog is installed in your system. Now go to _/etc/rsyslog.d_ and create a file called _nftables.conf_ with the following contents: - -``` -:msg,regex,”Invalid-Input: “ -/var/log/nftables/Input.log -:msg,regex,”Invalid-Output: “ -/var/log/nftables/Output.log -& stop -``` - -Now we have to make sure the log is manageable. For that, create another file in _/etc/logrotate.d_ called nftables with the following code: - -``` -/var/log/nftables/* { rotate 5 daily maxsize 50M missingok notifempty delaycompress compress postrotate invoke-rc.d rsyslog rotate > /dev/null endscript } -``` - -Restart nftables. You can now check your rule-set. If you feel typing each command in the terminal is bothersome, you can use a script to load the nftables firewall. I hope this article is useful in protecting your system. - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/10/transition-to-nftables/ - -作者:[Vijay Marcel D][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensourceforu.com/author/vijay-marcel/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/01/REHfirewall-1.jpg?resize=696%2C481&ssl=1 (REHfirewall) -[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/01/REHfirewall-1.jpg?fit=900%2C622&ssl=1 diff --git a/translated/tech/20191021 Transition to Nftables.md b/translated/tech/20191021 Transition to Nftables.md new file mode 100644 index 0000000000..889b071199 --- /dev/null +++ b/translated/tech/20191021 Transition to Nftables.md @@ -0,0 +1,190 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Transition to Nftables) +[#]: via: (https://opensourceforu.com/2019/10/transition-to-nftables/) +[#]: author: (Vijay Marcel D https://opensourceforu.com/author/vijay-marcel/) + +过渡到 nftables +====== + +![][2] + +> 开源世界中的每个主要发行版都正在演进,而将 nftables 作为默认防火墙。换言之,古老的 iptables 现在已经消亡。本文是有关如何构建 nftables 的教程。 + +当前,有一个与 nftables 兼容的 iptables-nft 后端,但是很快,即使是它也不再提供了。另外,正如 Red Hat 开发人员所指出的那样,有时它可能会错误地转换规则。我们需要知道如何构建自己的 nftables,而不是依赖于 iptables 到 nftables 的转换器。在 nftables 中,所有地址族都遵循一个规则。与 iptables 不同,nftables 在用户空间中运行,iptables 中的每个模块都运行在内核(空间)中。它很少需要更新内核,并具有一些新功能,例如映射,地址族和字典。 + +### 地址族 + +地址族确定要处理的数据包的类型。在 nftables 中有六个地址族,它们是: + +* ip +* ipv6 +* inet +* arp +* bridge +* netdev + +在 nftables 中,ipv4 和 ipv6 协议被合并为一个称为 inet 的单一地址族。因此,我们不需要指定两个规则:一个用于 ipv4,另一个用于 ipv6。如果未指定地址族,它将默认为 ip 协议,即 ipv4。我们感兴趣的领域是 inet 系列,因为大多数家庭用户将使用 ipv4 或 ipv6 协议。 + +### nftables + +典型的 nftables 规则包含三个部分:表、链和规则。 + +表是链和规则的容器。它们由其地址族和名称来标识。链包含 inet/arp/bridge/netdev 等协议所需的规则,并具有三种类型:过滤器、NAT 和路由。nftables 规则可以从脚本加载,也可以在终端键入,然后另存为规则集。对于家庭用户,默认链为过滤器。inet 系列包含以下钩子: + +* Input +* Output +* Forward +* Pre-routing +* Post-routing + +### 使用脚本还是不用? + +最大的问题之一是我们是否可以使用防火墙脚本。答案是:这是你自己的选择。这里有一些建议:如果防火墙中有数百条规则,那么最好使用脚本,但是如果你是典型的家庭用户,则可以在终端中键入命令,然后加载规则集。每种选择都有其自身的优缺点。在本文中,我们将在终端中键入它们以构建防火墙。 + +nftables 使用一个名为 `nft` 的程序来添加、创建、列出、删除和加载规则。确保使用以下命令将 nftables 与 conntrackd 和 netfilter-persistent 一起安装,并删除 iptables: + +``` +apt-get install nftables conntrackd netfilter-persistent +apt-get purge iptables +``` + +`nft` 需要以 root 身份运行或使用 sudo 运行。使用以下命令分别列出、刷新、删除规则集和加载脚本。 + +``` +nft list ruleset +nft flush ruleset +nft delete table inet filter +/usr/sbin/nft -f /etc/nftables.conf +``` + +### 输入策略 + +就像 iptables 一样,防火墙将包含三部分:输入(`input`)、转发(`forward`)和输出(`output`)。在终端中,为“输入(`input`)”防火墙键入以下命令。在开始之前,请确保已刷新规则集。我们的默认政策将会删除所有内容。我们将在防火墙中使用 inet 地址族。将以下规则以 root 身份添加或使用 `sudo` 运行: + +``` +nft add table inet filter +nft add chain inet filter input { type filter hook input priority 0 \; counter \; policy drop \; } +``` + +你会注意到有一个名为 `priority 0` 的东西。这意味着赋予该规则更高的优先级。挂钩通常赋予负整数,这意味着更高的优先级。每个挂钩都有自己的优先级,过滤器链的优先级为 0。你可以检查 nftables Wiki 页面以查看每个挂钩的优先级。 + +要了解你计算机中的网络接口,请运行以下命令: + +``` +ip link show +``` + +它将显示已安装的网络接口,一个本地主机、另一个以太网端口或无线端口。以太网端口的名称如下所示:`enpXsY`,其中 `X` 和 `Y` 是数字,无线端口也是如此。我们必须允许本地主机,并且仅允许从互联网建立的传入连接。 + +nftables 具有一项称为裁决语句的功能,用于解析规则。裁决语句为 `accept`、`drop`、`queue`、`jump`、`goto`、`continue` 和 `return`。由于这是一个很简单的防火墙,因此我们将使用 `accept` 或 `drop` 处理数据包。 + +``` +nft add rule inet filter input iifname lo accept +nft add rule inet filter input iifname enpXsY ct state new, established, related accept +``` + +接下来,我们必须添加规则以保护我们免受隐秘扫描。并非所有的隐秘扫描都是恶意的,但大多数都是。我们必须保护网络免受此类扫描。第一组规则列出了要测试的 TCP 标志。在这些标志中,第二组列出了要与第一组匹配的标志。 + +``` +nft add rule inet filter input iifname enpXsY tcp flags \& \(syn\|fin\) == \(syn\|fin\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(syn\|rst\) == \(syn\|rst\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(fin\|rst\) == \(fin\|rst\) drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|fin\) == fin drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|psh\) == psh drop +nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|urg\) == urg drop +``` + +记住,我们在终端中键入这些命令。因此,我们必须在一些特殊字符之前添加一个反斜杠,以确保终端能够正确解释该斜杠。如果你使用的是脚本,则不需要这样做。 + +### 关于 ICMP 的警告 + +互联网控制消息协议(ICMP)是一种诊断工具,因此不应完全丢弃该流量。完全阻止 ICMP 的任何尝试都是不明智的,因为它还会停止向我们提供错误消息。仅启用最重要的控制消息,例如回声请求、回声应答、目的地不可达和超时等消息,并拒绝其余消息。回声请求和回声应答是 `ping` 的一部分。在输入策略中,我们仅允许回声应答、而在输出策略中,我们仅允许回声请求。 + +``` +nft add rule inet filter input iifname enpXsY icmp type { echo-reply, destination-unreachable, time-exceeded } limit rate 1/second accept +nft add rule inet filter input iifname enpXsY ip protocol icmp drop +``` + +最后,我们记录并丢弃所有无效数据包。 + +``` +nft add rule inet filter input iifname enpXsY ct state invalid log flags all level info prefix \”Invalid-Input: \” +nft add rule inet filter input iifname enpXsY ct state invalid drop +``` + +### 转发和输出策略 + +在转发和输出策略中,默认情况下我们将丢弃数据包,仅接受已建立连接的数据包。 + +``` +nft add chain inet filter forward { type filter hook forward priority 0 \; counter \; policy drop \; } +nft add rule inet filter forward ct state established, related accept +nft add rule inet filter forward ct state invalid drop +nft add chain inet filter output { type filter hook output priority 0 \; counter \; policy drop \; } +``` + +典型的桌面用户只需要端口 80 和 443 即可访问互联网。最后,允许可接受的 ICMP 协议并在记录无效数据包时丢弃它们。 + +``` +nft add rule inet filter output oifname enpXsY tcp dport { 80, 443 } ct state established accept +nft add rule inet filter output oifname enpXsY icmp type { echo-request, destination-unreachable, time-exceeded } limit rate 1/second accept +nft add rule inet filter output oifname enpXsY ip protocol icmp drop +nft add rule inet filter output oifname enpXsY ct state invalid log flags all level info prefix \”Invalid-Output: \” +nft add rule inet filter output oifname enpXsY ct state invalid drop +``` + +现在我们必须保存我们的规则集,否则重新启动时它将丢失。为此,请运行以下命令: + +``` +sudo nft list ruleset. > /etc/nftables.conf +``` + +我们必须在引导时加载 nftables,这将在 systemd 中启用 nftables 服务: + +``` +sudo systemctl enable nftables +``` + +接下来,编辑 nftables 单元文件以删除 `Execstop` 选项,以避免在每次引导时刷新规则集。该文件通常位于 `/etc/systemd/system/sysinit.target.wants/nftables.service` 中。现在重新启动nftables: + +``` +sudo systemctl restart nftables +``` + +### 在 rsyslog 中记录日志 + +当你记录丢弃的数据包时,它们直接进入 syslog,这使得读取日志文件非常困难。最好将防火墙日志重定向到单独的文件。在 `/var/log` 目录中创建一个名为 `nftables` 的目录,并在其中创建两个名为 `input.log` 和 `output.log` 的文件,分别存储输入和输出日志。确保系统中已安装 rsyslog。现在转到 `/etc/rsyslog.d` 并创建一个名为 `nftables.conf` 的文件,其内容如下: + +``` +:msg,regex,”Invalid-Input: “ -/var/log/nftables/Input.log +:msg,regex,”Invalid-Output: “ -/var/log/nftables/Output.log +& stop +``` + +现在,我们必须确保日志是可管理的。为此,使用以下代码在 `/etc/logrotate.d` 中创建另一个名为 `nftables` 的文件: + +``` +/var/log/nftables/* { rotate 5 daily maxsize 50M missingok notifempty delaycompress compress postrotate invoke-rc.d rsyslog rotate > /dev/null endscript } +``` + +重新启动 nftables。现在,你可以检查你的规则集。如果你觉得在终端中键入每个命令很麻烦,则可以使用脚本来加载 nftables 防火墙。我希望本文对保护你的系统有用。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/transition-to-nftables/ + +作者:[Vijay Marcel D][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://opensourceforu.com/author/vijay-marcel/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/01/REHfirewall-1.jpg?resize=696%2C481&ssl=1 (REHfirewall) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2017/01/REHfirewall-1.jpg?fit=900%2C622&ssl=1 From 9be794710eba5c36a036eaa96dfd0e5b955849a3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Oct 2019 00:55:47 +0800 Subject: [PATCH 189/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191029=20Collap?= =?UTF-8?q?se=20OS=20=E2=80=93=20An=20OS=20Created=20to=20Run=20After=20th?= =?UTF-8?q?e=20World=20Ends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md --- ... OS Created to Run After the World Ends.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md diff --git a/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md new file mode 100644 index 0000000000..456372ab38 --- /dev/null +++ b/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Collapse OS – An OS Created to Run After the World Ends) +[#]: via: (https://itsfoss.com/collapse-os/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Collapse OS – An OS Created to Run After the World Ends +====== + +When most people think about preparing for a post-apocalyptic world, the first time that comes to mind is food and other living essentials. Recently, a programmer has decided that it would be just as important to create a versatile and survivable operating system after the collapse of society. We will be taking a look at it today, as best we can. + +### Collapse OS – For when the fecal matter hits the rotating device + +![][1] + +The operating system in question is called [Collapse OS][2]. According to the website, Collapse OS is a “z80 kernel and a collection of programs, tools and documentation”. It would allow you to: + + * Run on minimal and improvised machines. + * Interface through improvised means (serial, keyboard, display). + * Edit text files. + * Compile assembler source files for a wide range of MCUs and CPUs. + * Read and write from a wide range of storage devices. + * Replicate itself. + + + +The creator, [Virgil Dupras][3], started the project because [he sees][4] “our global supply chain to collapse before we reach 2030”. He bases this conclusion on the works of Pablo Servigne. He seems to understand that not everyone shares [his views][4]. “That being said, I don’t consider it unreasonable to not believe that collapse is likely to happen by 2030, so please, don’t feel attacked by my beliefs.” + +The overall goal of the project is to jumpstart a post-collapse civilization’s return to the computer age. The production of electronics depends on a very complex supply chain. Once that supply chain crumbles, man will go back to a less technical age. It would take decades to regain our previous technical position. Dupras hopes to jump several steps by creating an ecosystem that will work with simpler chips that can be scavenged from a wide variety of sources. + +### What is the z80? + +The initial CollapseOS kernel is written for the [z80 chip][5]. As a retro computing history buff, I am familiar with [Zilog][6] and it’s z80 chip. In the late 1970s, Zilog introduced the z80 to compete with [Intel’s 8080][7] CPU. The z80 was used in a whole bunch of early personal computers, such as the [Sinclair ZX Spectrum][8] and the [Tandy TRS-80][9]. The majority of these systems used the [CP/M operating system][10], which was the top operating system of the time. (Interestingly, Dupras was originally looking to use an [open-source implementation o][11][f][11] [CP/M][11], but ultimately decided to [start from scratch][12].) + +Both the z80 and CP/M started to decline in popularity after the [IBM PC][13] was released in 1981. Zilog did release several other microprocessors (Z8000 and Z80000), but these did not take off. The company switched its focus to microcontrollers. Today, an updated descendant of the z80 can be found in graphic calculators, embedded devices and consumer electronics. + +Dupras said on [Reddit][14] that he wrote Collapse OS for the z80 because “it’s been in production for so long and because it’s been used in so many machines, scavenger have good chances of getting their hands on it.” + +### Current status and future of the project + +Collapse OS has a pretty decent start. It can self replicate with enough RAM and storage. It is capable of running on an [RC2014 homebrew computer][15] or a Sega Master System/MegaDrive (Genesis). It can read SD cards. It has a simple text editor. The kernel is made up of modules that are connected with glue code. This is designed to make the system flexible and adaptable. + +There is also a detailed [roadmap][16] laying out the direction of the project. Listed goals include: + + * Support for other CPUs, such as 8080 and [6502][17] + * Support for improvised peripherals, such as LCD screens, E-ink displays, and [ACIA devices][18]. + * Support for more storage options, such as floppys, CDs, SPI RAM/ROMs, and AVR MCUs + * Get it to work on other z80 machines, such as [TI-83+][19] and [TI-84+][20] graphing calculators and TRS-80s + + + +If you are interested in helping out or just taking a peek at the project, be sure to visit their [GitHub page][21]. + +### Final Thoughts + +To put it bluntly, I see Collapse OS as more of a fun hobby project (for those who like building operating systems), than something useful. When a collapse does come, how will Collapse OS get distributed, since I imagine that GitHub will be down? I can’t imagine more than a handful of skill people being able to create a system from scavenged parts. There is a whole new generation of makers out there, but most of them are used to picking up an Arduino or a Raspberry Pi and building their project than starting from scratch. + +Contrary to Dupras, my biggest concern is the use of [EMPs][22]. These things fry all electrical systems, meaning there would be nothing left to scavenge to build system. If that doesn’t happen, I imagine that we would be able to find enough x86 components made over the past 30 years to keep things going. + +That being said, Collapse OS sounds like a fun and challenging project to people who like to program in low-level code for strange applications. If you are such a person, check out [Collapse OS][2]. + +Hypothetical question: what is your post-apocalyptic operating system of choice? 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][23]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/collapse-os/ + +作者:[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/2019/10/Collapse_OS.jpg?ssl=1 +[2]: https://collapseos.org/ +[3]: https://github.com/hsoft +[4]: https://collapseos.org/why.html +[5]: https://en.m.wikipedia.org/wiki/Z80 +[6]: https://en.wikipedia.org/wiki/Zilog +[7]: https://en.wikipedia.org/wiki/Intel_8080 +[8]: https://en.wikipedia.org/wiki/ZX_Spectrum +[9]: https://en.wikipedia.org/wiki/TRS-80 +[10]: https://en.wikipedia.org/wiki/CP/M +[11]: https://github.com/davidgiven/cpmish +[12]: https://github.com/hsoft/collapseos/issues/52 +[13]: https://en.wikipedia.org/wiki/IBM_Personal_Computer +[14]: https://old.reddit.com/r/collapse/comments/dejmvz/collapse_os_bootstrap_postcollapse_technology/f2w3sid/?st=k1gujoau&sh=1b344da9 +[15]: https://rc2014.co.uk/ +[16]: https://collapseos.org/roadmap.html +[17]: https://en.wikipedia.org/wiki/MOS_Technology_6502 +[18]: https://en.wikipedia.org/wiki/MOS_Technology_6551 +[19]: https://en.wikipedia.org/wiki/TI-83_series#TI-83_Plus +[20]: https://en.wikipedia.org/wiki/TI-84_Plus_series +[21]: https://github.com/hsoft/collapseos +[22]: https://en.wikipedia.org/wiki/Electromagnetic_pulse +[23]: https://reddit.com/r/linuxusersgroup From 4fbfacd8472971255a9243e6fa1b921ae6c08d1a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Oct 2019 00:56:30 +0800 Subject: [PATCH 190/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191027=20How=20?= =?UTF-8?q?to=20Install=20and=20Configure=20Nagios=20Core=20on=20CentOS=20?= =?UTF-8?q?8=20/=20RHEL=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md --- ...figure Nagios Core on CentOS 8 - RHEL 8.md | 271 ++++++++++++++++++ 1 file changed, 271 insertions(+) create mode 100644 sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md diff --git a/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..bcbf0c27ec --- /dev/null +++ b/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md @@ -0,0 +1,271 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install and Configure Nagios Core on CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to Install and Configure Nagios Core on CentOS 8 / RHEL 8 +====== + +**Nagios** is a free and opensource network and alerting engine used to monitor various devices, such as network devices, and servers in a network. It supports both **Linux** and **Windows OS** and provides an intuitive web interface that allows you to easily monitor network resources. When professionally configured, it can alert you in the event a server or a network device goes down or malfunctions via email alerts. In this topic, we shed light on how you can install and configure Nagios core on **RHEL 8** / **CentOS 8**. + +[![Install-Nagios-Core-RHEL8-CentOS8][1]][2] + +### Prerequisites of Nagios Core + +Before we begin, perform a flight check and ensure you have the following: + + * An instance of RHEL 8 / CentOS 8 + * SSH access to the instance + * A fast and stable internet connection + + + +With the above requirements in check, let’s roll our sleeves! + +### Step 1: Install LAMP Stack + +For Nagios to work as expected, you need to install LAMP stack or any other web hosting stack since it’s going to run on a browser. To achieve this, execute the command: + +``` +# dnf install httpd mariadb-server php-mysqlnd php-fpm +``` + +![Install-LAMP-stack-CentOS8][1] + +You need to ensure that Apache web server is up and running. To do so, start and enable Apache server using the commands: + +``` +# systemctl start httpd +# systemctl enable httpd +``` + +![Start-enable-httpd-centos8][1] + +To check the status of Apache server run + +``` +# systemctl status httpd +``` + +![Check-status-httpd-centos8][1] + +Next, we need to start and enable MariaDB server, run the following commands + +``` +# systemctl start mariadb +# systemctl enable mariadb +``` + +![Start-enable-MariaDB-CentOS8][1] + +To check MariaDB status run: + +``` +# systemctl status mariadb +``` + +![Check-MariaDB-status-CentOS8][1] + +Also, you might consider hardening or securing your server and making it less susceptible to unauthorized access. To secure your server, run the command: + +``` +# mysql_secure_installation +``` + +Be sure to set a strong password for your MySQL instance. For the subsequent prompts, Type **Yes** and hit **ENTER** + +![Secure-MySQL-server-CentOS8][1] + +### Step 2: Install Required packages + +Apart from installing the LAMP server, some additional packages are needed for the installation and proper configuration of Nagios. Therefore, install the packages as shown below: + +``` +# dnf install gcc glibc glibc-common wget gd gd-devel perl postfix +``` + +![Install-requisite-packages-CentOS8][1] + +### Step 3: Create a Nagios user account + +Next, we need to create a user account for the Nagios user. To achieve this , run the command: + +``` +# adduser nagios +# passwd nagios +``` + +![Create-new-user-for-Nagios][1] + +Now, we need to create a group for Nagios and add the Nagios user to this group. + +``` +# groupadd nagiosxi +``` + +Now add the Nagios user to the group + +``` +# usermod -aG nagiosxi nagios +``` + +Also, add Apache user to the Nagios group + +``` +# usermod -aG nagiosxi apache +``` + +![Add-Nagios-group-user][1] + +### Step 4: Download and install Nagios core + +We can now proceed and install Nagios Core. The latest stable version in Nagios 4.4.5 which was released on August 19, 2019.  But first, download the Nagios tarball file from its official site. + +To download Nagios core, first head to the tmp directory + +``` +# cd /tmp +``` + +Next download the tarball file + +``` +# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz +``` + +![Download-Nagios-CentOS8][1] + +After downloading the tarball file, extract it using the command: + +``` +# tar -xvf nagios-4.4.5.tar.gz +``` + +Next, navigate to the uncompressed folder + +``` +# cd nagios-4.4.5 +``` + +Run the commands below in this order + +``` +# ./configure --with-command-group=nagcmd +# make all +# make install +# make install-init +# make install-daemoninit +# make install-config +# make install-commandmode +# make install-exfoliation +``` + +To setup Apache configuration issue the command: + +``` +# make install-webconf +``` + +### Step 5: Configure Apache Web Server Authentication + +Next, we are going to setup authentication for the user **nagiosadmin**. Please be mindful not to change the username or else, you may be required to perform further configuration which may be quite tedious. + +To set up authentication run the command: + +``` +# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin +``` + +![Configure-Apache-webserver-authentication-CentOS8][1] + +You will be prompted for the password of the nagiosadmin user. Enter and confirm the password as requested. This is the user that you will use to login to Nagios towards the end of this tutorial. + +For the changes to come into effect, restart your web server. + +``` +# systemctl restart httpd +``` + +### Step 6: Download & install Nagios Plugins + +Plugins will extend the functionality of the Nagios Server. They will help you monitor various services, network devices, and applications. To download the plugin tarball file run the command: + +``` +# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz +``` + +Next, extract the tarball file and navigate to the uncompressed plugin folder + +``` +# tar -xvf nagios-plugins-2.2.1.tar.gz +# cd nagios-plugins-2.2.1 +``` + +To install the plugins compile the source code as shown + +``` +# ./configure --with-nagios-user=nagios --with-nagios-group=nagiosxi +# make +# make install +``` + +### Step 7: Verify and Start Nagios + +After the successful installation of Nagios plugins, verify the Nagios configuration to ensure that all is well and there is no error in the configuration: + +``` +# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg +``` + +![Verify-Nagios-settings-CentOS8][1] + +Next, start Nagios and verify its status + +``` +# systemctl start nagios +# systemctl status nagios +``` + +![Start-check-status-Nagios-CentOS8][1] + +In case Firewall is running on system then allow “80” using the following command + +``` +# firewall-cmd --permanent --add-port=80/tcp# firewall-cmd --reload +``` + +### Step 8: Access Nagios dashboard via the web browser + +To access Nagios, browse your server’s IP address as shown + + + +A pop-up will appear prompting for the username and the password of the user we created earlier in Step 5. Enter the credentials and hit ‘**Sign In**’ + +![Access-Nagios-via-web-browser-CentOS8][1] + +This ushers you to the Nagios dashboard as shown below + +![Nagios-dashboard-CentOS8][1] + +We have finally successfully installed and configured Nagios Core on CentOS 8 / RHEL 8. Your feedback is most welcome. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/ + +作者:[James Kiarie][a] +选题:[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/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-Nagios-Core-RHEL8-CentOS8.jpg From d06bbd4ccd97a0294240e51b008bafec9e6dc4c2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Oct 2019 00:59:08 +0800 Subject: [PATCH 191/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191028=20Enterp?= =?UTF-8?q?rise=20JavaBeans,=20infrastructure=20predictions,=20and=20more?= =?UTF-8?q?=20industry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md --- ...e predictions, and more industry trends.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md diff --git a/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md new file mode 100644 index 0000000000..e915fe74d9 --- /dev/null +++ b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Enterprise JavaBeans, infrastructure predictions, and more industry trends) +[#]: via: (https://opensource.com/article/19/10/enterprise-javabeans-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Enterprise JavaBeans, infrastructure predictions, and more industry trends +====== +A weekly look at open source community and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [Gartner: 10 infrastructure trends you need to know][2] + +> Corporate network infrastructure is only going to get more involved  over the next two to three years as automation, network challenges, and hybrid cloud become more integral to the enterprise. + +**The impact:** The theme running through all these predictions is the impact of increased complexity. As consumers of technology, we expect things to get easier and easier. As producers of technology, we know what's going on behind the curtains to make that simplicity possible is its opposite. + +## [Jakarta EE: What's in store for Enterprise JavaBeans?][3] + +> [Enterprise JavaBeans (EJB)][4] has been very important to the Java EE ecosystem and promoted many robust solutions to enterprise problems. Besides that, in the past when integration techniques were not so advanced, EJB did great work with remote EJB, integrating many Java EE applications. However, remote EJB is not necessary anymore, and we have many techniques and tools that are better for doing that. So, does EJB still have a place in this new cloud-native world? + +**The impact:** This offers some insights into how programming languages and frameworks evolve and change over time. Respond to changes in developer affinity by identifying the good stuff in a language and getting it landed somewhere else. Ideally that "somewhere else" should be an open standard so that no single vendor gets to control your technology destiny. + +## [From virtualization to containerization][5] + +> Before the telecom industry has got to grips with "step one" virtualization, many industry leaders are already moving on to the next level—containerization. This is a key part of making network software cloud-native i.e. designed, developed, and optimized to exploit cloud technology such as distributed processing and data stores. + +**The impact:** There are certain industries that make big technology decisions on long time horizons; I can only imagine the FOMO that the fast-moving world of infrastructure technology could cause when you've picked something and it starts to look a bit crufty next to the new hotness. + +## [How do you rollback deployments in Kubernetes?][6] + +> There are several strategies when it comes to deploying apps into production. In Kubernetes, rolling updates are the default strategy to update the running version of your app. The rolling update cycles previous Pod out and bring newer Pod in incrementally. + +**The impact:** What is the cloud-native distributed equivalent to **ctrl+z**? And aren't you glad there is one? + +## [What's a Trusted Compute Base?][7] + +> A few months ago, in an article called [Turtles—and chains of trust][8], I briefly mentioned Trusted Compute Bases, or TCBs, but then didn’t go any deeper.  I had a bit of a search across the articles on this blog, and realised that I’ve never gone into this topic in much detail, which feels like a mistake, so I’m going to do it now. + +**The impact:** The issue of to what extent you can trust the computer systems that power your whole life is only going to become more prevalent and more vexing. That turns out to be a great argument for open source from the bottom turtle (hardware) all the way up. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/enterprise-javabeans-and-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.networkworld.com/article/3447397/gartner-10-infrastructure-trends-you-need-to-know.html +[3]: https://developers.redhat.com/blog/2019/10/22/jakarta-ee-whats-in-store-for-enterprise-javabeans/ +[4]: https://docs.oracle.com/cd/E13222_01/wls/docs100/ejb/deploy.html +[5]: https://www.lightreading.com/nfv/from-virtualization-to-containerization/a/d-id/755016 +[6]: https://learnk8s.io/kubernetes-rollbacks/ +[7]: https://aliceevebob.com/2019/10/22/whats-a-trusted-compute-base/ +[8]: https://aliceevebob.com/2019/07/02/turtles-and-chains-of-trust/ From 41c1c51a49a50f2bc95f81ab2e7cb8b9870f5325 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Oct 2019 01:02:07 +0800 Subject: [PATCH 192/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191028=206=20si?= =?UTF-8?q?gns=20you=20might=20be=20a=20Linux=20user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191028 6 signs you might be a Linux user.md --- ...91028 6 signs you might be a Linux user.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20191028 6 signs you might be a Linux user.md diff --git a/sources/tech/20191028 6 signs you might be a Linux user.md b/sources/tech/20191028 6 signs you might be a Linux user.md new file mode 100644 index 0000000000..d66d08cf35 --- /dev/null +++ b/sources/tech/20191028 6 signs you might be a Linux user.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 signs you might be a Linux user) +[#]: via: (https://opensource.com/article/19/10/signs-linux-user) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +6 signs you might be a Linux user +====== +If you're a heavy Linux user, you'll probably recognize these common +tendencies. +![Tux with binary code background][1] + +Linux users are a diverse bunch, but many of us share a few habits. You might not have any of the telltale signs listed in this article, and if you're a new Linux user, you may not recognize many of them... yet. + +Here are six signs you might be a Linux user. + +### 1\. As far as you know, the world began on January 1, 1970. + +There are many rumors about why a Unix computer clock always sets itself back to 1970-01-01 when it resets. But the mundane truth is that the Unix "epoch" serves as a common and simple reference point for synchronization. For example, Halloween is the 304th day of this year in the Julian calendar, but we commonly refer to the holiday as being "on the 31st". We know which 31st we mean because we have common reference points: We know that Halloween is celebrated in October and that October is the 10th month of the year, and we know how many days each preceding month contains. Without these values, we could use traditional methods of timekeeping, such as phases of the moon, to keep track of special seasonal events, but of course, a computer doesn't have that ability. + +A computer requires firm and clearly defined values, so the value 1970-01-01T00:00:00Z was chosen as the beginning of the Unix epoch. Any time a [POSIX][2] computer loses track of time, a service like the Network Time Protocol (NTP) can provide it the number of seconds since 1970-01-01T00:00:00Z, which the computer can convert to a human-friendly date. + +Date and time are a famously complex thing to track in computing, largely because there are exceptions to nearly standard. A month doesn't always have 30 days, a year doesn't always have 365 days, and even seconds tend to drift a little each year. If you're looking for a fun and frustrating programming exercise, try to program a reliable calendaring application! + +### 2\. You think it's a chore to type anything over two letters to get something done. + +The most common Unix commands are famously short. In addition to commands like **cd** and **ls** and **mv**, there's one command that literally can't get any shorter: **w** (which shows who is currently logged in according to the **/var/run/utmp** file). + +On the one hand, extremely short commands seem unintuitive. A new user probably isn't going to guess that typing **ls** would _list_ directories. Once you learn the commands, though, the shorter they are, the better. If you spend all day in a terminal, the fewer keystrokes you have to type means you can spend more time getting your work done. + +Luckily, single-letter commands are far and few between, which means you can use most letters for aliases. For example, I use Emacs often enough that I consider **emacs** too long to type, so I alias it to **e** by adding this line to my **.bashrc** file: + + +``` +`alias e='emacs'` +``` + +You can also alias commands temporarily. For instance, if you find yourself running [firewall-cmd][3] repeatedly while you troubleshoot a network issue, then you can create an alias just for your current session: + + +``` +$ alias f='firewall-cmd' +$ f +usage: see firewall-cmd man page +No option specified. +``` + +As long as the terminal is open, your alias persists. Once the terminal is closed, it's forgotten. + +### 3\. You think it's a chore to click more than two times to get something done. + +Linux users are fond of efficiency. While not every Linux user is always in a hurry to get things done, there are conventions in Linux desktops that seek to reduce the number of actions required to accomplish any given task. Here are some examples. + + * In the KDE file manager Dolphin, a single click opens a file or directory. It's assumed that if you want to select a file, you can either click and drag or else Ctrl+Click instead. This may confuse users who are used to double-clicking everything, but once you've tried single-click actions, you usually can't go back to laborious double-clicks. + * On most Linux desktops, a middle-click pastes the most recent contents of the clipboard. + * On many Linux desktops, drag actions can be modified by pressing the Alt, Ctrl, or Shift keys. For instance, Alt+Drag moves a window in KDE, and Ctrl+Drag in GNOME causes a file to be copied instead of moved. + + + +### 4\. You've never performed any action on a computer more than three times because you've already automated it by the third time. + +Pardon the hyperbole, but many Linux users expect their computer to work harder than they do. While it takes time to learn how to automate common tasks, it tends to be easier on Linux than on other platforms because the Linux terminal and the Linux operating system are so tightly integrated. The easy things to automate are the actions you already do in a terminal because commands are just strings that you type into an interpreter, and that interpreter (the terminal) doesn't care whether you typed the strings out manually or whether you're just pointing it to a script. + +For instance, if you find yourself frequently moving a set of files from one place to another, then you can probably use the same sequence of instructions as a script, which you can trigger with a single command. Imagine you are doing this manually each morning: + + +``` +$ cd Documents +$ trash reports-latest.txt +$ wget myserver.local/reports/daily/report-latest.txt +$ cp report-latest.txt reports_daily/2019-31-10.log +``` + +It's a simple sequence, but repeating it daily isn't the most efficient way of spending your time. With a little bit of abstraction, you could automate it with a simple script: + + +``` +#!/bin/sh + +trash $HOME/Documents/reports-latest.txt + +wget myserver.local/reports/daily/report-latest.txt \ +-P $HOME/Documents/udpates_daily/`date --iso-8601`.log + +cp $HOME/Documents/udpates_daily/`date --iso-8601`.log \ +$HOME/Documents/reports-latest.txt +``` + +You could call your script **get-reports.sh** and launch it manually each morning, or you could even enter it into your crontab so that your computer performs the task without requiring any intervention from you. + +This can be confusing for a new user because it's not always obvious what's integrated with what. For instance, if you regularly find yourself opening images and scaling them down by 50%, then you're probably used to doing something like this: + + 1. Opening up your photo viewer or editor + 2. Scaling the image + 3. Exporting the image as a modified file + 4. Closing the application + + + +If you did this several times a day, you would probably get tired of the repetition. However, because you perform those actions in the graphical user interface (GUI), you would need to know how to script the GUI to automate it. Some applications, like [GIMP][4], have a rich scripting interface, but the process is obviously different than just adapting a bunch of commands and dumping those into a file. + +Then again, sometimes there are command-line equivalents to things you do in a GUI. Converting documents from one text format to another can be done with [Pandoc][5], images can be manipulated with [Image Magick][6], music and video can be edited and converted, and so on. It's a matter of knowing what to look for, and usually learning a new (and sometimes complex) command. Scaling images down, however, is notably simpler in the terminal than in a GUI: + + +``` +#!/bin/sh + +convert "${1}" -scale 50% `basename "${1}" .jpg`_50.jpg +``` + +It's worth investigating those bothersome, repetitious tasks. You never know how simple and fast your work is for a computer to do! + +### 5\. You distro hop + +I'm an ardent Slackware user at home and a RHEL user at work. Actually, that's not true; I'm a Fedora user at work now. Except when I use CentOS. And there was that time I ran [Mageia][7] for a while. + +![Debian on a PowerPC64 box, image CC BY SA Claudio Miranda][8] + +Debian on a PowerPC64 box + +It doesn't matter how great a distribution is; part of the guilty pleasure of being a Linux user is the freedom to be indecisive about which distro you run. At a glance, they're all basically the same, and that's refreshing. But depending on your mood, you might prefer the stability of CentOS to the constant updates of Fedora, or you might truly enjoy the centralized control center of Mageia one day and then frolic in the modularity of raw [Debian][9] configuration files another. And sometimes you turn to an alternate OS altogether. + +![OpenBSD, image CC BY SA Claudio Miranda][10] + +OpenBSD, not a Linux distro + +The point is, Linux distributions are passion projects, and it's fun to be a part of other people's open source passions. + +### 6\. You have a passion for open source. + +Regardless of your experience, if you're a Linux user, you undoubtedly have a passion for open source. Whether you express that on a daily basis through [Creative Commons artwork][11] or code or you sublimate it and just get your work done in a liberating (and liberated) environment, you're living in and building upon open source. It's because of you that there's an open source community, and the community is richer for having you as a member. + +There are lots of things I haven't mentioned. What else betrays you as a Linux user? Let us know in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/signs-linux-user + +作者:[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/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY (Tux with binary code background) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://www.gimp.org/ +[5]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc +[6]: https://opensource.com/article/17/8/imagemagick +[7]: http://mageia.org +[8]: https://opensource.com/sites/default/files/uploads/debian.png (Debian on a PowerPC64 box) +[9]: http://debian.org +[10]: https://opensource.com/sites/default/files/uploads/openbsd.jpg (OpenBSD) +[11]: http://freesvg.org From 74cb42a08abeeca7d3feb9ae3d9893c7864aa013 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Oct 2019 01:03:21 +0800 Subject: [PATCH 193/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191028=20How=20?= =?UTF-8?q?to=20remove=20duplicate=20lines=20from=20files=20with=20awk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191028 How to remove duplicate lines from files with awk.md --- ...ove duplicate lines from files with awk.md | 243 ++++++++++++++++++ 1 file changed, 243 insertions(+) create mode 100644 sources/tech/20191028 How to remove duplicate lines from files with awk.md diff --git a/sources/tech/20191028 How to remove duplicate lines from files with awk.md b/sources/tech/20191028 How to remove duplicate lines from files with awk.md new file mode 100644 index 0000000000..0282a26768 --- /dev/null +++ b/sources/tech/20191028 How to remove duplicate lines from files with awk.md @@ -0,0 +1,243 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to remove duplicate lines from files with awk) +[#]: via: (https://opensource.com/article/19/10/remove-duplicate-lines-files-awk) +[#]: author: (Lazarus Lazaridis https://opensource.com/users/iridakos) + +How to remove duplicate lines from files with awk +====== +Learn how to use awk '!visited[$0]++' without sorting or changing their +order. +![Coding on a computer][1] + +Suppose you have a text file and you need to remove all of its duplicate lines. + +### TL;DR + +To remove the duplicate lines while _preserving their order in the file_, use: + + +``` +`awk '!visited[$0]++' your_file > deduplicated_file` +``` + +### How it works + +The script keeps an associative array with _indices_ equal to the unique lines of the file and _values_ equal to their occurrences. For each line of the file, if the line occurrences are zero, then it increases them by one and _prints the line_, otherwise, it just increases the occurrences _without printing the line_. + +I was not familiar with **awk**, and I wanted to understand how this can be accomplished with such a short script (**awk**ward). I did my research, and here is what is going on: + + * The awk "script" **!visited[$0]++** is executed for _each line_ of the input file. + * **visited[]** is a variable of type [associative array][2] (a.k.a. [Map][3]). We don't have to initialize it because **awk** will do it the first time we access it. + * The **$0** variable holds the contents of the line currently being processed. + * **visited[$0]** accesses the value stored in the map with a key equal to **$0** (the line being processed), a.k.a. the occurrences (which we set below). + * The **!** negates the occurrences' value: + * In awk, [any nonzero numeric value or any nonempty string value is true][4]. + * By default, [variables are initialized to the empty string][5], which is zero if converted to a number. + * That being said: + * If **visited[$0]** returns a number greater than zero, this negation is resolved to **false**. + * If **visited[$0]** returns a number equal to zero or an empty string, this negation is resolved to **true**. + * The **++** operation increases the variable's value (**visited[$0]**) by one. + * If the value is empty, **awk** converts it to **0** (number) automatically and then it gets increased. + * **Note:** The operation is executed after we access the variable's value. + + + +Summing up, the whole expression evaluates to: + + * **true** if the occurrences are zero/empty string + * **false** if the occurrences are greater than zero + + + +**awk** statements consist of a [_pattern-expression_ and an _associated action_][6]. + + +``` +` { }` +``` + +If the pattern succeeds, then the associated action is executed. If we don't provide an action, **awk**, by default, **print**s the input. + +> An omitted action is equivalent to **{ print $0 }**. + +Our script consists of one **awk** statement with an expression, omitting the action. So this: + + +``` +`awk '!visited[$0]++' your_file > deduplicated_file` +``` + +is equivalent to this: + + +``` +`awk '!visited[$0]++ { print $0 }' your_file > deduplicated_file` +``` + +For every line of the file, if the expression succeeds, the line is printed to the output. Otherwise, the action is not executed, and nothing is printed. + +### Why not use the **uniq** command? + +The **uniq** command removes only the _adjacent duplicate lines_. Here's a demonstration: + + +``` +$ cat test.txt +A +A +A +B +B +B +A +A +C +C +C +B +B +A +$ uniq < test.txt +A +B +A +C +B +A +``` + +### Other approaches + +#### Using the sort command + +We can also use the following [**sort**][7] command to remove the duplicate lines, but _the line order is not preserved_. + + +``` +`sort -u your_file > sorted_deduplicated_file` +``` + +#### Using cat, sort, and cut + +The previous approach would produce a de-duplicated file whose lines would be sorted based on the contents. [Piping a bunch of commands][8] can overcome this issue: + + +``` +`cat -n your_file | sort -uk2 | sort -nk1 | cut -f2-` +``` + +##### How it works + +Suppose we have the following file: + + +``` +abc +ghi +abc +def +xyz +def +ghi +klm +``` + +**cat -n test.txt** prepends the order number in each line. + + +``` +1       abc +2       ghi +3       abc +4       def +5       xyz +6       def +7       ghi +8       klm +``` + +**sort -uk2** sorts the lines based on the second column (**k2** option) and keeps only the first occurrence of the lines with the same second column value (**u** option). + + +``` +1       abc +4       def +2       ghi +8       klm +5       xyz +``` + +**sort -nk1** sorts the lines based on their first column (**k1** option) treating the column as a number (**-n** option). + + +``` +1       abc +2       ghi +4       def +5       xyz +8       klm +``` + +Finally, **cut -f2-** prints each line starting from the second column until its end (**-f2-** option: _Note the **-** suffix, which instructs it to include the rest of the line_). + + +``` +abc +ghi +def +xyz +klm +``` + +### References + + * [The GNU awk user's guide][9] + * [Arrays in awk][2] + * [Awk—Truth values][4] + * [Awk expressions][5] + * [How can I delete duplicate lines in a file in Unix?][10] + * [Remove duplicate lines without sorting [duplicate]][11] + * [How does awk '!a[$0]++' work?][12] + + + +That's all. Cat photo. + +![Duplicate cat][13] + +* * * + +_This article originally appeared on the iridakos blog by [Lazarus Lazaridis][14] under a [CC BY-NC 4.0 License][15] and is republished with the author's permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/remove-duplicate-lines-files-awk + +作者:[Lazarus Lazaridis][a] +选题:[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/iridakos +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: http://kirste.userpage.fu-berlin.de/chemnet/use/info/gawk/gawk_12.html +[3]: https://en.wikipedia.org/wiki/Associative_array +[4]: https://www.gnu.org/software/gawk/manual/html_node/Truth-Values.html +[5]: https://ftp.gnu.org/old-gnu/Manuals/gawk-3.0.3/html_chapter/gawk_8.html +[6]: http://kirste.userpage.fu-berlin.de/chemnet/use/info/gawk/gawk_9.html +[7]: http://man7.org/linux/man-pages/man1/sort.1.html +[8]: https://stackoverflow.com/a/20639730/2292448 +[9]: https://www.gnu.org/software/gawk/manual/html_node/ +[10]: https://stackoverflow.com/questions/1444406/how-can-i-delete-duplicate-lines-in-a-file-in-unix +[11]: https://stackoverflow.com/questions/11532157/remove-duplicate-lines-without-sorting +[12]: https://unix.stackexchange.com/questions/159695/how-does-awk-a0-work/159734#159734 +[13]: https://opensource.com/sites/default/files/uploads/duplicate-cat.jpg (Duplicate cat) +[14]: https://iridakos.com/about/ +[15]: http://creativecommons.org/licenses/by-nc/4.0/ From ea7c8d910cb5bdfd557b1f397a8a9b4f23713c3c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Oct 2019 01:05:25 +0800 Subject: [PATCH 194/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191028=20Buildi?= =?UTF-8?q?ng=20trust=20in=20the=20Linux=20community?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191028 Building trust in the Linux community.md --- ...8 Building trust in the Linux community.md | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 sources/tech/20191028 Building trust in the Linux community.md diff --git a/sources/tech/20191028 Building trust in the Linux community.md b/sources/tech/20191028 Building trust in the Linux community.md new file mode 100644 index 0000000000..d4f7e22114 --- /dev/null +++ b/sources/tech/20191028 Building trust in the Linux community.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building trust in the Linux community) +[#]: via: (https://opensource.com/article/19/10/trust-linux-community) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Building trust in the Linux community +====== +Everyone should be empowered to use whatever software they wish, +regardless of platform. +![Tall building with windows][1] + +I recently listened to an interesting interview on [Linux for everyone][2]. Host [Jason Evangelho][3] interviewed [Christopher Scott][4], senior premier field engineer (open source) at Microsoft. Christopher is a Linux advocate who has a unique perspective as an avid Linux user who works for Microsoft. There was a time when there was little trust between Redmond and the Linux world. There are some who fear that Microsoft’s embrace of Linux is sinister. Christopher is trying to dispel that notion and build trust where mistrust has existed in the past. Listening to the interview invited my curiosity. Anxious to learn more, I contacted Christopher on [Twitter][5] and requested an interview (which has been lightly edited for length and clarity). He graciously agreed. + +**Don Watkins:** What is your background? + +**Christopher Scott:** In short, I’m a geek who loves technology, especially hardware. The first computer I got to spend any time with was our 486SX 20MHz 4MB RAM 171MB HDD IBM-compatible machine. My mom spent $2,500 on the setup at the time, which seemed outrageous. It wasn’t long after that I bought Comanche Maximum Overkill (PC Game) and realized I didn’t have a CD-ROM drive, nor a compatible sound card, so I bought those and installed them. That started it right there. I had to play games on our Windows 3.1 machine. That was really the focus of my interest in computers growing up: video games. I had the NES in 1984 and an SNES after, along with many other game systems since, but there was always something about PC gaming that caught my attention. + +My first love, however, was cars. My dad was into hot rods and such, so I read his magazines growing up. I had high aspirations of building my own first car. After finding college to not be for me and realizing that minimum wage jobs wouldn’t secure my future, I went back to school and learned a trade: automotive paint and body repair. I got a job thanks to my instructor and did this for several years, but I wasn’t satisfied that most of the jobs were insurance claim-based. I wanted to focus on the attention to detail aspects and make every job come out perfectly, but insurance companies don’t pay for that type of detail with a "just good enough" mentality. + +I wasn’t able to find work in a custom paint and body shop, so I looked to my second love, computers. I found a company that had training courses on Windows 2000 certification preparation. It was outrageously priced at something like $8,000, but I got a student loan (so I could carry that debt with me for many years after) and started class. I didn’t get a job immediately after, that took a number of months, but I worked my way into a temp job at Timex’s call center in the advanced products division. + +I had been at Timex for a year-and-a-half or so when I was able to get a job offer at a "real computer company." It wasn’t temp work and it had benefits, so it seemed perfect. This company provided managed IT services for their customers, so I started doing PC and network support over the phone and in person. I met my wife while working for this company, too. Since then, I’ve done help desk support, litigation support, SharePoint, Skype for Business, Microsoft Teams, and all of the Office 365 Suite. Today I’m a happily married father of three with two grandsons. + +**DW**: How did you get started with Linux and open source? + +**CS**: Roughly 20 years ago, while I was taking classes on Windows 2000 Server, I started acquiring parts of older machines that were slated for disposal and managed to piece together at least one fully working system with a monitor, keyboard, and mouse. The home computer at the time was running Windows 98 or ME, I can’t recall, but I didn’t have any OS to put on this older system. Somehow, I stumbled across Mandrake Linux and loaded it up. It all seemed to work okay from what I could tell, so I put an ad in the local newspaper classifieds to see if anyone needed a computer for free. I got exactly one response to that ad. I packed up the computer and took it to their house. I found out it was a family with a special needs son and they wanted to get him learning on the computer. I set it up on the little table they wanted to use as a desk, they thanked me, and I left. I sure hope it was helpful for them. At the time, all I really knew of Linux was that I could have a fully working system without having to go to a store to buy a disk. + +Since that point, I would consider myself a Linux hobbyist and enthusiast. I am a distro hopper, always trying out different distros and desktop environments, never making any one of them truly home. I’ve always had my heartstrings pulled between Ubuntu-based systems and Fedora. For some reason, I really like **`apt`** and **DEB**, but always loved getting faster updates from Fedora. I’ve always appreciated the way open source projects are open to the community for feedback and extra dev support, and how the code is freely available for anyone to use, reuse, and review. + +Until recently, I wasn’t able to make Linux my primary OS. I’ve tried over the years and often it came back to games. They would either not run at all, or ran poorly by comparison, so I ended up returning to Windows. With the improvements to Proton and tools like Lutris, that landscape has changed dramatically. I run Linux on my primary desktop and laptop now. Currently, Pop!_OS and Ubuntu 18.04 respectively, but I do have a soft spot for Manjaro (which is on a third machine). + +Admittedly, I do make concessions by having Linux as my primary OS for work. I mostly lean on web-based access to things I need, but I still have a VM for specific applications that won’t run outside of Windows and are required for my job. To be clear on this, I don’t hate Windows. I dislike some of the things it does and some of the things it doesn’t do. Linux, too, has things I like and dislike. My decision on what to run is based on what annoys me the least and what gives me the features and software I want or need. Some distros just don’t appeal to me or annoy me in a number of ways that I just cannot get over. Every OS has its pros and cons. + +**DW**: What invited you to work for Microsoft? + +**CS**: Short answer: A recruiter on LinkedIn. Long answer: Like many people who get into SharePoint, it fell into my lap a number of years ago. Okay, I volunteered, but no one else on the three-person IT team was going to learn it and our CEO wanted it. Fast forward about three years later, I got hired as a SharePoint admin for, what I thought, was a quite large company of 700 users. At that point, I considered Microsoft to be the top option to work for considering that’s who owns SharePoint, but I figured that I was five years or so away from being at the level I needed to be to even be considered. After working at this job for a year, I was contacted by a recruiter on LinkedIn. We chatted, I interviewed, and I got hired. Since then, I have jumped technologies to Skype/Teams and now open source software (OSS) and have gone from leading one team to over 20, all in sort of a non-traditional way. + +To be more to the point, I wanted to move into an OSS role to see more of what Microsoft is doing in this space, which was something I couldn’t see in other roles while supporting other technologies. + +**DW**: How are you building trust for the Linux community at Microsoft? + +**CS**: The first step is to listen. I can’t assume to know, even though I consider myself part of the Linux community, what it would take to build that trust. So, I reached out to get that feedback. My goal is to take action against that feedback as merely an employee looking to make the software landscape better for Linux users who would appreciate the option of running Microsoft software on their chosen platform (as one example). + +**DW**: What Microsoft products besides Visual Studio are wins for the Linux and open source community? + +**CS**: Honestly, it depends on which part of the community you refer to. For developers, there are other things that were released/open-sourced by Microsoft that carry great benefits, like .NET and C++ libraries. Even [Windows Subsystem for Linux][6] (WSL) and the [new Windows Terminal][7] can be seen as big wins. However, there is another component of the community that wants something that impacts their daily, personal lives (if I were to summarize). In a sense, each individual has taken the stance to decide for themselves what constitutes a win and what doesn’t. That issue makes it more difficult at times when they request that Windows or the whole software catalog be open-sourced completely before even considering that Microsoft is doing anything valid. + +Essentially, from how I view Microsoft’s standpoint, the company is focused on the cloud, namely Azure. Who in the Linux and open source community should be targeted that aligns with that? People who manage Linux servers, people who want to use open source software in Azure, and people who develop open source software that can run on Azure. To that market, there have been many wins. The catalog of OSS that runs in the context of Azure is huge. + +**DW**: Some tech writers see the Linux kernel replacing the NT kernel. Do you disagree? + +**CS**: I do disagree. There’s far too much incompatibility to just replace the underpinnings. It’s not realistic, in my opinion. + +**DW**: What is the future of Linux at Microsoft? + +**CS**: I’ll say what I expect and what I hope. I expect continued growth of Linux on Azure, and continued growth in open source used on Azure and written by Microsoft. I hope that this drives further investment into the Linux desktop, essentially, by bringing Windows software to run well on Linux. This topic is what the community wants to see, too, but it will take the customers, the individuals, within the enterprise speaking up to push this to reality. + +Would I like to see, as an example, one code base for Office that runs on all desktop platforms whether through Wine or some other compatibility layer? Yes, of course. I think this would be optimal, really. Office for Mac has never seen all the same features as the Windows versions. Everyone should be empowered to use whatever software they wish, regardless of platform. I believe that Microsoft can get there, I just don’t know if it will, so that’s where I step in to do what I can to try to make this happen. I hope that we can see Linux desktop users have the same options for software from Microsoft as Windows and macOS. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/trust-linux-community + +作者:[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/windows_building_sky_scale.jpg?itok=mH6CAX29 (Tall building with windows) +[2]: https://linuxforeveryone.fireside.fm/10-the-microsoft-linux-interview +[3]: https://opensource.com/article/19/9/found-linux-video-gaming +[4]: https://www.linkedin.com/in/christophersscott/ +[5]: https://twitter.com/chscott_msft +[6]: https://en.wikipedia.org/wiki/Windows_Subsystem_for_Linux +[7]: https://github.com/Microsoft/Terminal From 6317d2c63ed5824b7daa05cd085fc167cb85465a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 29 Oct 2019 01:06:20 +0800 Subject: [PATCH 195/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191026=20Netfli?= =?UTF-8?q?x=20builds=20a=20Jupyter=20Lab=20alternative,=20a=20bug=20bount?= =?UTF-8?q?y=20to=20fight=20election=20hacking,=20Raspberry=20Pi=20goes=20?= =?UTF-8?q?microscopic,=20and=20more=20open=20source=20news?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md --- ... microscopic, and more open source news.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md diff --git a/sources/tech/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md b/sources/tech/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md new file mode 100644 index 0000000000..b50a93d8c1 --- /dev/null +++ b/sources/tech/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news) +[#]: via: (https://opensource.com/article/19/10/news-october-26) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![Weekly news roundup with TV][1] + +In this edition of our open source news roundup, we take a look at a machine learning tool from Netflix, Microsoft's election software bug bounty, a cost-effective microscope built with Raspberry Pi, and more! + +### Netflix release Polynote machine learning tool + +While there have been numerous advances in machine learning over the last decade, it's still a difficult, laborious, and sometimes frustrating task. To help make that task easier, Netflix has [released a machine learning notebook environment][2] called Polynote as open source. + +Polynote enables "data scientists and AI researchers to integrate Netflix’s JVM-based machine learning framework with Python machine learning and visualization libraries". What make Polynote unique is its reproducibility feature, which "takes cells’ positions in the notebook into account before executing them, helping prevent bad practices that make notebooks difficult to rerun from the top." It's also quite flexible—Polynote works with Apache Spark and supports languages like Python, Scala, and SQL. + +You can grab Polynote [off GitHub][3] or learn more about it at the Polynote website. + +### Microsoft announces bug bounty program for its election software + +Hoping that more eyeballs on its code will make bugs shallow, Microsoft announced a [a bug bounty][4] for its open source ElectionGuard software development kit for voting machines. The goal of the program is to "uncover vulnerabilities and help bolster election security." + +The bounty is open to "security professionals, part-time hobbyists, and students." Successful submissions, which must include proofs of concept demonstrating how bugs could compromise the security of voters, are worth up to $15,000 (USD). + +If you're interested in participating, you can find ElectionGuard's code on [GitHub][5], and read more about the [bug bounty][6]. + +### microscoPI: a microscope built on Raspberry Pi + +It's not a stretch to say that the Raspberry Pi is one of the most flexible platforms for hardware and software hackers. Micropalaeontologist Martin Tetard saw the potential of the tiny computers in his field of study and [create the microscoPI][7]. + +The microscoPI is a Raspberry Pi-assisted microscope that can "capture, process, and store images and image analysis results." Using an old adjustable microscope with a movable stage as a base, Tetard added a Raspberry Pi B, a Raspberry Pi camera module, and a small touchscreen to the device. The result is a compact rig that's "completely portable and measuring less than 30 cm (12 inches) in height." The entire setup cost him €159 (about $177 USD). + +Tetard has set up [a website][8] for the microscoPI, where you can learn more about it. + +#### In other news + + * [Happy 15th birthday, Ubuntu][9] + * [Open-Source Arm Puts Robotics Within Reach][10] + * [Apache Rya matures open source triple store database][11] + * [UNICEF Launches Cryptocurrency Fund to Back Open Source Technology][12] + * [Open-source Delta Lake project moves to the Linux Foundation][13] + + + +_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/news-october-26 + +作者:[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/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) +[2]: https://venturebeat.com/2019/10/23/netflix-open-sources-polynote-to-simplify-data-science-and-machine-learning-workflows/ +[3]: https://github.com/polynote/polynote +[4]: https://thenextweb.com/security/2019/10/21/microsofts-open-source-election-software-now-has-a-bug-bounty-program/ +[5]: https://github.com/microsoft/ElectionGuard-SDK +[6]: https://www.microsoft.com/en-us/msrc/bounty +[7]: https://www.geeky-gadgets.com/raspberry-pi-microscope-07-10-2019/ +[8]: https://microscopiproject.wordpress.com/ +[9]: https://www.omgubuntu.co.uk/2019/10/happy-birthday-ubuntu-2019 +[10]: https://hackaday.com/2019/10/17/open-source-arm-puts-robotics-within-reach/ +[11]: https://searchdatamanagement.techtarget.com/news/252472464/Apache-Rya-matures-open-source-triple-store-database +[12]: https://www.coindesk.com/unicef-launches-cryptocurrency-fund-to-back-open-source-technology +[13]: https://siliconangle.com/2019/10/16/open-source-delta-lake-project-moves-linux-foundation/ From 29c40f8a34b5310a8a59dd3ff559b18fa3ffa90b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Oct 2019 08:10:52 +0800 Subject: [PATCH 196/800] Rename sources/tech/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md to sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md --- ...g, Raspberry Pi goes microscopic, and more open source news.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md (100%) diff --git a/sources/tech/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md b/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md similarity index 100% rename from sources/tech/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md rename to sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md From 3c703685ce3e4ebb4183f2938a62e04589291e37 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Oct 2019 08:12:02 +0800 Subject: [PATCH 197/800] Rename sources/tech/20191028 Building trust in the Linux community.md to sources/talk/20191028 Building trust in the Linux community.md --- .../20191028 Building trust in the Linux community.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191028 Building trust in the Linux community.md (100%) diff --git a/sources/tech/20191028 Building trust in the Linux community.md b/sources/talk/20191028 Building trust in the Linux community.md similarity index 100% rename from sources/tech/20191028 Building trust in the Linux community.md rename to sources/talk/20191028 Building trust in the Linux community.md From 5639bf6c2ac8221cdb3d5828e26a7f8d865113d3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 29 Oct 2019 08:28:33 +0800 Subject: [PATCH 198/800] Rename sources/tech/20191028 6 signs you might be a Linux user.md to sources/talk/20191028 6 signs you might be a Linux user.md --- .../{tech => talk}/20191028 6 signs you might be a Linux user.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191028 6 signs you might be a Linux user.md (100%) diff --git a/sources/tech/20191028 6 signs you might be a Linux user.md b/sources/talk/20191028 6 signs you might be a Linux user.md similarity index 100% rename from sources/tech/20191028 6 signs you might be a Linux user.md rename to sources/talk/20191028 6 signs you might be a Linux user.md From 592fe316b8a27aa603d59c19c952a0f4430c1cd2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Oct 2019 09:00:11 +0800 Subject: [PATCH 199/800] PRF @wxy --- .../tech/20191021 Transition to Nftables.md | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/translated/tech/20191021 Transition to Nftables.md b/translated/tech/20191021 Transition to Nftables.md index 889b071199..2fda9fa47e 100644 --- a/translated/tech/20191021 Transition to Nftables.md +++ b/translated/tech/20191021 Transition to Nftables.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Transition to Nftables) @@ -10,11 +10,13 @@ 过渡到 nftables ====== -![][2] +![](https://img.linux.net.cn/data/attachment/album/201910/29/085827o8b7rbswjjr7ijsr.jpg) -> 开源世界中的每个主要发行版都正在演进,而将 nftables 作为默认防火墙。换言之,古老的 iptables 现在已经消亡。本文是有关如何构建 nftables 的教程。 +> 开源世界中的每个主要发行版都在演进,逐渐将 nftables 作为了默认防火墙。换言之,古老的 iptables 现在已经消亡。本文是有关如何构建 nftables 的教程。 -当前,有一个与 nftables 兼容的 iptables-nft 后端,但是很快,即使是它也不再提供了。另外,正如 Red Hat 开发人员所指出的那样,有时它可能会错误地转换规则。我们需要知道如何构建自己的 nftables,而不是依赖于 iptables 到 nftables 的转换器。在 nftables 中,所有地址族都遵循一个规则。与 iptables 不同,nftables 在用户空间中运行,iptables 中的每个模块都运行在内核(空间)中。它很少需要更新内核,并具有一些新功能,例如映射,地址族和字典。 +当前,有一个与 nftables 兼容的 iptables-nft 后端,但是很快,即使是它也不再提供了。另外,正如 Red Hat 开发人员所指出的那样,有时它可能会错误地转换规则。我们需要知道如何构建自己的 nftables,而不是依赖于 iptables 到 nftables 的转换器。 + +在 nftables 中,所有地址族都遵循一个规则。与 iptables 不同,nftables 在用户空间中运行,iptables 中的每个模块都运行在内核(空间)中。它很少需要更新内核,并带有一些新功能,例如映射、地址族和字典。 ### 地址族 @@ -27,13 +29,15 @@ * bridge * netdev -在 nftables 中,ipv4 和 ipv6 协议被合并为一个称为 inet 的单一地址族。因此,我们不需要指定两个规则:一个用于 ipv4,另一个用于 ipv6。如果未指定地址族,它将默认为 ip 协议,即 ipv4。我们感兴趣的领域是 inet 系列,因为大多数家庭用户将使用 ipv4 或 ipv6 协议。 +在 nftables 中,ipv4 和 ipv6 协议可以被合并为一个称为 inet 的单一地址族。因此,我们不需要指定两个规则:一个用于 ipv4,另一个用于 ipv6。如果未指定地址族,它将默认为 ip 协议,即 ipv4。我们感兴趣的领域是 inet 地址族,因为大多数家庭用户将使用 ipv4 或 ipv6 协议。 ### nftables 典型的 nftables 规则包含三个部分:表、链和规则。 -表是链和规则的容器。它们由其地址族和名称来标识。链包含 inet/arp/bridge/netdev 等协议所需的规则,并具有三种类型:过滤器、NAT 和路由。nftables 规则可以从脚本加载,也可以在终端键入,然后另存为规则集。对于家庭用户,默认链为过滤器。inet 系列包含以下钩子: +表是链和规则的容器。它们由其地址族和名称来标识。链包含 inet/arp/bridge/netdev 等协议所需的规则,并具有三种类型:过滤器、NAT 和路由。nftables 规则可以从脚本加载,也可以在终端键入,然后另存为规则集。 + +对于家庭用户,默认链为过滤器。inet 系列包含以下钩子: * Input * Output @@ -43,16 +47,16 @@ ### 使用脚本还是不用? -最大的问题之一是我们是否可以使用防火墙脚本。答案是:这是你自己的选择。这里有一些建议:如果防火墙中有数百条规则,那么最好使用脚本,但是如果你是典型的家庭用户,则可以在终端中键入命令,然后加载规则集。每种选择都有其自身的优缺点。在本文中,我们将在终端中键入它们以构建防火墙。 +最大的问题之一是我们是否可以使用防火墙脚本。答案是:这是你自己的选择。这里有一些建议:如果防火墙中有数百条规则,那么最好使用脚本,但是如果你是典型的家庭用户,则可以在终端中键入命令,然后(保存并在重启时)加载规则集。每种选择都有其自身的优缺点。在本文中,我们将在终端中键入它们以构建防火墙。 -nftables 使用一个名为 `nft` 的程序来添加、创建、列出、删除和加载规则。确保使用以下命令将 nftables 与 conntrackd 和 netfilter-persistent 一起安装,并删除 iptables: +nftables 使用一个名为 `nft` 的程序来添加、创建、列出、删除和加载规则。确保使用以下命令将 nftables 与 conntrackd 和 netfilter-persistent 软件包一起安装,并删除 iptables: ``` apt-get install nftables conntrackd netfilter-persistent apt-get purge iptables ``` -`nft` 需要以 root 身份运行或使用 sudo 运行。使用以下命令分别列出、刷新、删除规则集和加载脚本。 +`nft` 需要以 root 身份运行或使用 `sudo` 运行。使用以下命令分别列出、刷新、删除规则集和加载脚本。 ``` nft list ruleset @@ -63,7 +67,7 @@ nft delete table inet filter ### 输入策略 -就像 iptables 一样,防火墙将包含三部分:输入(`input`)、转发(`forward`)和输出(`output`)。在终端中,为“输入(`input`)”防火墙键入以下命令。在开始之前,请确保已刷新规则集。我们的默认政策将会删除所有内容。我们将在防火墙中使用 inet 地址族。将以下规则以 root 身份添加或使用 `sudo` 运行: +就像 iptables 一样,防火墙将包含三部分:输入(`input`)、转发(`forward`)和输出(`output`)。在终端中,为输入(`input`)策略键入以下命令。在开始之前,请确保已刷新规则集。我们的默认策略将会删除所有内容。我们将在防火墙中使用 inet 地址族。将以下规则以 root 身份添加或使用 `sudo` 运行: ``` nft add table inet filter @@ -78,7 +82,7 @@ nft add chain inet filter input { type filter hook input priority 0 \; counter \ ip link show ``` -它将显示已安装的网络接口,一个本地主机、另一个以太网端口或无线端口。以太网端口的名称如下所示:`enpXsY`,其中 `X` 和 `Y` 是数字,无线端口也是如此。我们必须允许本地主机,并且仅允许从互联网建立的传入连接。 +它将显示已安装的网络接口,一个是本地主机、另一个是以太网端口或无线端口。以太网端口的名称如下所示:`enpXsY`,其中 `X` 和 `Y` 是数字,无线端口也是如此。我们必须允许本地主机的流量,并且仅允许从互联网建立的传入连接。 nftables 具有一项称为裁决语句的功能,用于解析规则。裁决语句为 `accept`、`drop`、`queue`、`jump`、`goto`、`continue` 和 `return`。由于这是一个很简单的防火墙,因此我们将使用 `accept` 或 `drop` 处理数据包。 @@ -102,7 +106,7 @@ nft add rule inet filter input iifname enpXsY tcp flags \& \(ack\|urg\) == urg d ### 关于 ICMP 的警告 -互联网控制消息协议(ICMP)是一种诊断工具,因此不应完全丢弃该流量。完全阻止 ICMP 的任何尝试都是不明智的,因为它还会停止向我们提供错误消息。仅启用最重要的控制消息,例如回声请求、回声应答、目的地不可达和超时等消息,并拒绝其余消息。回声请求和回声应答是 `ping` 的一部分。在输入策略中,我们仅允许回声应答、而在输出策略中,我们仅允许回声请求。 +互联网控制消息协议(ICMP)是一种诊断工具,因此不应完全丢弃该流量。完全阻止 ICMP 的任何尝试都是不明智的,因为它还会导致停止向我们提供错误消息。仅启用最重要的控制消息,例如回声请求、回声应答、目的地不可达和超时等消息,并拒绝其余消息。回声请求和回声应答是 `ping` 的一部分。在输入策略中,我们仅允许回声应答、而在输出策略中,我们仅允许回声请求。 ``` nft add rule inet filter input iifname enpXsY icmp type { echo-reply, destination-unreachable, time-exceeded } limit rate 1/second accept @@ -143,13 +147,13 @@ nft add rule inet filter output oifname enpXsY ct state invalid drop sudo nft list ruleset. > /etc/nftables.conf ``` -我们必须在引导时加载 nftables,这将在 systemd 中启用 nftables 服务: +我们须在引导时加载 nftables,以下将在 systemd 中启用 nftables 服务: ``` sudo systemctl enable nftables ``` -接下来,编辑 nftables 单元文件以删除 `Execstop` 选项,以避免在每次引导时刷新规则集。该文件通常位于 `/etc/systemd/system/sysinit.target.wants/nftables.service` 中。现在重新启动nftables: +接下来,编辑 nftables 单元文件以删除 `Execstop` 选项,以避免在每次引导时刷新规则集。该文件通常位于 `/etc/systemd/system/sysinit.target.wants/nftables.service`。现在重新启动nftables: ``` sudo systemctl restart nftables @@ -157,12 +161,11 @@ sudo systemctl restart nftables ### 在 rsyslog 中记录日志 -当你记录丢弃的数据包时,它们直接进入 syslog,这使得读取日志文件非常困难。最好将防火墙日志重定向到单独的文件。在 `/var/log` 目录中创建一个名为 `nftables` 的目录,并在其中创建两个名为 `input.log` 和 `output.log` 的文件,分别存储输入和输出日志。确保系统中已安装 rsyslog。现在转到 `/etc/rsyslog.d` 并创建一个名为 `nftables.conf` 的文件,其内容如下: +当你记录丢弃的数据包时,它们直接进入 syslog,这使得读取该日志文件非常困难。最好将防火墙日志重定向到单独的文件。在 `/var/log` 目录中创建一个名为 `nftables` 的目录,并在其中创建两个名为 `input.log` 和 `output.log` 的文件,分别存储输入和输出日志。确保系统中已安装 rsyslog。现在转到 `/etc/rsyslog.d` 并创建一个名为 `nftables.conf` 的文件,其内容如下: ``` :msg,regex,”Invalid-Input: “ -/var/log/nftables/Input.log -:msg,regex,”Invalid-Output: “ -/var/log/nftables/Output.log -& stop +:msg,regex,”Invalid-Output: “ -/var/log/nftables/Output.log & stop ``` 现在,我们必须确保日志是可管理的。为此,使用以下代码在 `/etc/logrotate.d` 中创建另一个名为 `nftables` 的文件: @@ -180,7 +183,7 @@ via: https://opensourceforu.com/2019/10/transition-to-nftables/ 作者:[Vijay Marcel D][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 37b80840f9510cad6e0f16f131119d8d129b35f0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Oct 2019 09:00:38 +0800 Subject: [PATCH 200/800] PUB @wxy https://linux.cn/article-11513-1.html --- .../tech => published}/20191021 Transition to Nftables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191021 Transition to Nftables.md (99%) diff --git a/translated/tech/20191021 Transition to Nftables.md b/published/20191021 Transition to Nftables.md similarity index 99% rename from translated/tech/20191021 Transition to Nftables.md rename to published/20191021 Transition to Nftables.md index 2fda9fa47e..71aac43603 100644 --- a/translated/tech/20191021 Transition to Nftables.md +++ b/published/20191021 Transition to Nftables.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11513-1.html) [#]: subject: (Transition to Nftables) [#]: via: (https://opensourceforu.com/2019/10/transition-to-nftables/) [#]: author: (Vijay Marcel D https://opensourceforu.com/author/vijay-marcel/) From a64280410c84caa3c6f3749980333217b3dcf88e Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 Oct 2019 09:05:41 +0800 Subject: [PATCH 201/800] translated --- ...ner images with the ansible-bender tool.md | 154 ------------------ ...ner images with the ansible-bender tool.md | 153 +++++++++++++++++ 2 files changed, 153 insertions(+), 154 deletions(-) delete mode 100644 sources/tech/20191023 Building container images with the ansible-bender tool.md create mode 100644 translated/tech/20191023 Building container images with the ansible-bender tool.md diff --git a/sources/tech/20191023 Building container images with the ansible-bender tool.md b/sources/tech/20191023 Building container images with the ansible-bender tool.md deleted file mode 100644 index 2056e4e4b7..0000000000 --- a/sources/tech/20191023 Building container images with the ansible-bender tool.md +++ /dev/null @@ -1,154 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Building container images with the ansible-bender tool) -[#]: via: (https://opensource.com/article/19/10/building-container-images-ansible) -[#]: author: (Tomas Tomecek https://opensource.com/users/tomastomecek) - -Building container images with the ansible-bender tool -====== -Learn how to use Ansible to execute commands in a container. -![Blocks for building][1] - -Containers and [Ansible][2] blend together so nicely—from management and orchestration to provisioning and building. In this article, we'll focus on the building part. - -If you are familiar with Ansible, you know that you can write a series of tasks, and the **ansible-playbook** command will execute them for you. Did you know that you can also execute such commands in a container environment and get the same result as if you'd written a Dockerfile and run **podman build**. - -Here is an example: - - -``` -\- name: Serve our file using httpd -  hosts: all -  tasks: -  - name: Install httpd -    package: -      name: httpd -      state: installed -  - name: Copy our file to httpd’s webroot -    copy: -      src: our-file.txt -      dest: /var/www/html/ -``` - -You could execute this playbook locally on your web server or in a container, and it would work—as long as you remember to create the **our-file.txt** file first. - -But something is missing. You need to start (and configure) httpd in order for your file to be served. This is a difference between container builds and infrastructure provisioning: When building an image, you just prepare the content; running the container is a different task. On the other hand, you can attach metadata to the container image that tells the command to run by default. - -Here's where a tool would help. How about trying **ansible-bender**? - - -``` -`$ ansible-bender build the-playbook.yaml fedora:30 our-httpd` -``` - -This script uses the ansible-bender tool to execute the playbook against a Fedora 30 container image and names the resulting container image **our-httpd**. - -But when you run that container, it won't start httpd because it doesn't know how to do it. You can fix this by adding some metadata to the playbook: - - -``` -\- name: Serve our file using httpd -  hosts: all -  vars: -    ansible_bender: -      base_image: fedora:30 -      target_image: -        name: our-httpd -        cmd: httpd -DFOREGROUND -  tasks: -  - name: Install httpd -    package: -      name: httpd -      state: installed -  - name: Listen on all network interfaces. -    lineinfile:     -      path: /etc/httpd/conf/httpd.conf   -      regexp: '^Listen ' -      line: Listen 0.0.0.0:80   -  - name: Copy our file to httpd’s webroot -    copy: -      src: our-file.txt -      dest: /var/www/html -``` - -Now you can build the image (from here on, please run all the commands as root—currently, Buildah and Podman won't create dedicated networks for rootless containers): - - -``` -# ansible-bender build the-playbook.yaml -PLAY [Serve our file using httpd] **************************************************** -                                                                                                                                                                              -TASK [Gathering Facts] ***************************************************************     -ok: [our-httpd-20191004-131941266141-cont] - -TASK [Install httpd] ***************************************************************** -loaded from cache: 'f053578ed2d47581307e9ba3f64f4b4da945579a082c6f99bd797635e62befd0' -skipping: [our-httpd-20191004-131941266141-cont] - -TASK [Listen on all network interfaces.] ********************************************* -changed: [our-httpd-20191004-131941266141-cont] - -TASK [Copy our file to httpd’s webroot] ********************************************** -changed: [our-httpd-20191004-131941266141-cont] - -PLAY RECAP *************************************************************************** -our-httpd-20191004-131941266141-cont : ok=3    changed=2    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0 - -Getting image source signatures -Copying blob sha256:4650c04b851c62897e9c02c6041a0e3127f8253fafa3a09642552a8e77c044c8 -Copying blob sha256:87b740bba596291af8e9d6d91e30a01d5eba9dd815b55895b8705a2acc3a825e -Copying blob sha256:82c21252bd87532e93e77498e3767ac2617aa9e578e32e4de09e87156b9189a0 -Copying config sha256:44c6dc6dda1afe28892400c825de1c987c4641fd44fa5919a44cf0a94f58949f -Writing manifest to image destination -Storing signatures -44c6dc6dda1afe28892400c825de1c987c4641fd44fa5919a44cf0a94f58949f -Image 'our-httpd' was built successfully \o/ -``` - -The image is built, and it's time to run the container: - - -``` -# podman run our-httpd -AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.2.106. Set the 'ServerName' directive globally to suppress this message -``` - -Is your file being served? First, find out the IP of your container: - - -``` -# podman inspect -f '{{ .NetworkSettings.IPAddress }}' 7418570ba5a0 -10.88.2.106 -``` - -And now you can check: - - -``` -$ curl -Ansible is ❤ -``` - -What were the contents of your file? - -This was just an introduction to building container images with Ansible. If you want to learn more about what ansible-bender can do, please check it out on [GitHub][3]. Happy building! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/building-container-images-ansible - -作者:[Tomas Tomecek][a] -选题:[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/tomastomecek -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/blocks_building.png?itok=eMOT-ire (Blocks for building) -[2]: https://www.ansible.com/ -[3]: https://github.com/ansible-community/ansible-bender diff --git a/translated/tech/20191023 Building container images with the ansible-bender tool.md b/translated/tech/20191023 Building container images with the ansible-bender tool.md new file mode 100644 index 0000000000..a085b51c5f --- /dev/null +++ b/translated/tech/20191023 Building container images with the ansible-bender tool.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building container images with the ansible-bender tool) +[#]: via: (https://opensource.com/article/19/10/building-container-images-ansible) +[#]: author: (Tomas Tomecek https://opensource.com/users/tomastomecek) + +使用 ansible-bender 构建容器镜像 +====== +了解如何使用 Ansible 在容器中执行命令。 +![Blocks for building][1] + +容器和 [Ansible][2] 很好地融合在一起-从管理和编排到供应和构建。在本文中,我们将重点介绍构建部分。 + +如果你熟悉 Ansible,就会知道你可以编写一系列任务,**ansible-playbook** 命令将为你执行这些任务。你知道吗,你还可以在容器环境中执行此类命令,并获得与编写 Dockerfile 并运行 **podman build** 相同​​的结果。 + +这是一个例子: + + +``` +\- name: Serve our file using httpd + hosts: all + tasks: + - name: Install httpd + package: + name: httpd + state: installed + - name: Copy our file to httpd’s webroot + copy: + src: our-file.txt + dest: /var/www/html/ +``` + +你可以在 Web 服务器上或容器中本地执行这个 playbook,并且只要你记得先创建 **our-file.txt**,它就可以工作。 + +但是缺少了一些东西。你需要启动(并配置)httpd 以便提供文件。这是容器构建和基础架构供应之间的区别:构建镜像时,你只需准备内容;运行容器是另一项任务。另一方面,你可以将元数据附加到容器镜像,它会默认运行命令。 + +这有个工具可以帮助。试试看 **ansible-bender** 怎么样? + + +``` +`$ ansible-bender build the-playbook.yaml fedora:30 our-httpd` +``` + +该脚本使用 ansible-bender 对 Fedora 30 容器镜像执行 playbook,并将生成的容器镜像命名为 “our-httpd”。 + +但是,当你运行该容器时,它不会启动 httpd,因为它不知道如何操作。你可以通过向 playbook 添加一些元数据来解决此问题: + + +``` +\- name: Serve our file using httpd + hosts: all + vars: + ansible_bender: + base_image: fedora:30 + target_image: + name: our-httpd + cmd: httpd -DFOREGROUND + tasks: + - name: Install httpd + package: + name: httpd + state: installed + - name: Listen on all network interfaces. + lineinfile: + path: /etc/httpd/conf/httpd.conf + regexp: '^Listen ' + line: Listen 0.0.0.0:80 + - name: Copy our file to httpd’s webroot + copy: + src: our-file.txt + dest: /var/www/html +``` + +现在你可以构建镜像(从这里开始,请以 root 用户身份运行所有命令。目前,Buildah 和 Podman 不会为无根容器创建专用网络): + + +``` +# ansible-bender build the-playbook.yaml +PLAY [Serve our file using httpd] **************************************************** + +TASK [Gathering Facts] *************************************************************** +ok: [our-httpd-20191004-131941266141-cont] + +TASK [Install httpd] ***************************************************************** +loaded from cache: 'f053578ed2d47581307e9ba3f64f4b4da945579a082c6f99bd797635e62befd0' +skipping: [our-httpd-20191004-131941266141-cont] + +TASK [Listen on all network interfaces.] ********************************************* +changed: [our-httpd-20191004-131941266141-cont] + +TASK [Copy our file to httpd’s webroot] ********************************************** +changed: [our-httpd-20191004-131941266141-cont] + +PLAY RECAP *************************************************************************** +our-httpd-20191004-131941266141-cont : ok=3 changed=2 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0 + +Getting image source signatures +Copying blob sha256:4650c04b851c62897e9c02c6041a0e3127f8253fafa3a09642552a8e77c044c8 +Copying blob sha256:87b740bba596291af8e9d6d91e30a01d5eba9dd815b55895b8705a2acc3a825e +Copying blob sha256:82c21252bd87532e93e77498e3767ac2617aa9e578e32e4de09e87156b9189a0 +Copying config sha256:44c6dc6dda1afe28892400c825de1c987c4641fd44fa5919a44cf0a94f58949f +Writing manifest to image destination +Storing signatures +44c6dc6dda1afe28892400c825de1c987c4641fd44fa5919a44cf0a94f58949f +Image 'our-httpd' was built successfully \o/ +``` + +镜像构建完毕,可以运行容器了: + +``` +# podman run our-httpd +AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 10.88.2.106. Set the 'ServerName' directive globally to suppress this message +``` + +是否提供文件了?首先,找出你容器的 IP: + + +``` +# podman inspect -f '{{ .NetworkSettings.IPAddress }}' 7418570ba5a0 +10.88.2.106 +``` + +你现在可以检查了: + + +``` +$ curl +Ansible is ❤ +``` + +你文件内容是什么? + +这只是使用 Ansible 构建容器镜像的介绍。如果你想了解有关 ansible-bender 可以做什么的更多信息,请查看它的 [GitHub][3] 页面。构建快乐! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/building-container-images-ansible + +作者:[Tomas Tomecek][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/tomastomecek +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/blocks_building.png?itok=eMOT-ire (Blocks for building) +[2]: https://www.ansible.com/ +[3]: https://github.com/ansible-community/ansible-bender \ No newline at end of file From 92413456198822f2e87691e820d376493827aafb Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 29 Oct 2019 09:13:27 +0800 Subject: [PATCH 202/800] translating --- .../tech/20191008 5 Best Password Managers For Linux Desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md b/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md index c9a51c91e6..e350fbe81c 100644 --- a/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md +++ b/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From dcfb6750a1f11ca29fdd8ca1768c9b28808dfbac Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Oct 2019 12:41:26 +0800 Subject: [PATCH 203/800] PRF @geekpi --- ...023 Using SSH port forwarding on Fedora.md | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/translated/tech/20191023 Using SSH port forwarding on Fedora.md b/translated/tech/20191023 Using SSH port forwarding on Fedora.md index 7930374385..e2a66912a4 100644 --- a/translated/tech/20191023 Using SSH port forwarding on Fedora.md +++ b/translated/tech/20191023 Using SSH port forwarding on Fedora.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11515-1.html) [#]: subject: (Using SSH port forwarding on Fedora) [#]: via: (https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/) [#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) @@ -10,65 +10,64 @@ 在 Fedora 上使用 SSH 端口转发 ====== -![][1] +![](https://img.linux.net.cn/data/attachment/album/201910/29/123804dql3aqqlghza9txt.jpg) -你可能已经熟悉使用 _ [ssh 命令][2]_ 访问远程系统。 _ssh_ 后面的协议允许终端输入和输出经过[安全通道][3]。但是你知道你也可以使用 _ssh_ 来安全地发送和接收其他数据吗?一种方法是使用_端口转发_,它允许你在进行 _ssh_ 会话时安全地连接网络端口。本文向你展示了它是如何工作的。 +你可能已经熟悉使用 [ssh 命令][2]访问远程系统。`ssh` 命令背后所使用的协议允许终端的输入和输出流经[安全通道][3]。但是你知道也可以使用 `ssh` 来安全地发送和接收其他数据吗?一种方法是使用“端口转发port forwarding”,它允许你在进行 `ssh` 会话时安全地连接网络端口。本文向你展示了它是如何工作的。 ### 关于端口 -标准 Linux 系统已分配了一组网络端口,范围是 0-65535。你的系统最多保留 1023 个端口供系统使用。在许多系统中,你不能选择使用这些低端口号。通常有几个端口用于运行特定的服务。你可以在系统的 _/etc/services_ 文件中找到这些定义。 +标准 Linux 系统已分配了一组网络端口,范围是 0 - 65535。系统会保留 0 - 1023 的端口以供系统使用。在许多系统中,你不能选择使用这些低端口号。通常有几个端口用于运行特定的服务。你可以在系统的 `/etc/services` 文件中找到这些定义。 -你可以认为网络端口是类似物理端口或可以连接到电缆的插孔。端口可以连接到系统上的某种服务,类似物理插孔后面的接线。一个例子是 Apache Web 服务器(也称为 _httpd_)。对于 HTTP 非安全连接,Web 服务器通常要求在主机系统上使用端口 80,对于 HTTPS 安全连接通常要求使用 443。 +你可以认为网络端口是类似的物理端口或可以连接到电缆的插孔。端口可以连接到系统上的某种服务,类似物理插孔后面的接线。一个例子是 Apache Web 服务器(也称为 `httpd`)。对于 HTTP 非安全连接,Web 服务器通常要求在主机系统上使用端口 80,对于 HTTPS 安全连接通常要求使用 443。 -当你连接到远程系统(例如,使用 Web 浏览器)时,你是将浏览器“连接”到主机上的端口。这通常是一个随机的高端口号,例如 54001。主机上的端口连接到远程主机上的端口(例如 443)来访问其安全的 Web 服务器。 +当你连接到远程系统(例如,使用 Web 浏览器)时,你是将浏览器“连接”到你的主机上的端口。这通常是一个随机的高端口号,例如 54001。你的主机上的端口连接到远程主机上的端口(例如 443)来访问其安全的 Web 服务器。 那么,当你有这么多可用端口时,为什么还要使用端口转发呢?这是 Web 开发人员生活中的几种常见情况。 ### 本地端口转发 -想象一下,你正在名为 _remote.example.com_ 的远程系统上进行 Web 开发。通常,你是通过 _ssh_ 进入此系统的,但是它位于防火墙后面,而且该防火墙允许很少的其他访问,并且会阻塞大多数其他端口。要尝试你的网络应用,能够使用浏览器访问远程系统会很有帮助。但是,由于使用了讨厌的防火墙,你无法通过在浏览器中输入 URL 的常规方法来访问它。 +想象一下,你正在名为 `remote.example.com` 的远程系统上进行 Web 开发。通常,你是通过 `ssh` 进入此系统的,但是它位于防火墙后面,而且该防火墙很少允许其他类型的访问,并且会阻塞大多数其他端口。要尝试你的网络应用,能够使用浏览器访问远程系统会很有帮助。但是,由于使用了讨厌的防火墙,你无法通过在浏览器中输入 URL 的常规方法来访问它。 -本地转发使你可以通过 _ssh_ 连接来建立可通过远程系统访问的端口。该端口在系统上显示为本地端口(也称为“本地转发”)。 +本地转发使你可以通过 `ssh` 连接来建立可通过远程系统访问的端口。该端口在系统上显示为本地端口(因而称为“本地转发”)。 -假设你的网络应用在 _remote.example.com_ 的 8000 端口上运行。要将那个系统的 8000 端口本地转发到你系统上的 8000 端口,请在开始会话时将 _-L_ 选项与 _ssh_ 结合使用: +假设你的网络应用在 `remote.example.com` 的 8000 端口上运行。要将那个系统的 8000 端口本地转发到你系统上的 8000 端口,请在开始会话时将 `-L` 选项与 `ssh` 结合使用: ``` $ ssh -L 8000:localhost:8000 remote.example.com ``` -等等,为什么我们使用 _localhost_ 作为转发目标?这是因为从 _remote.example.com_ 的角度来看,你是在要求主机使用其自己的端口 8000。(回想一下,任何主机通常可以将自己作为 _localhost_ 来通过网络连接其自身。)现在那个端口连接到你系统的 8000 端口了。_ssh_ 会话准备就绪后,将其保持打开状态,然后可以在浏览器中键入 __ 来查看你的 Web 应用。现在,系统之间的流量可以通过 _ssh_ 隧道安全地传输! +等等,为什么我们使用 `localhost` 作为转发目标?这是因为从 `remote.example.com` 的角度来看,你是在要求主机使用其自己的端口 8000。(回想一下,任何主机通常可以通过网络连接 `localhost` 而连接到自身。)现在那个端口连接到你系统的 8000 端口了。`ssh` 会话准备就绪后,将其保持打开状态,然后可以在浏览器中键入 `http://localhost:8000` 来查看你的 Web 应用。现在,系统之间的流量可以通过 `ssh` 隧道安全地传输! -如果你有敏锐的眼睛,你可能已经注意到了一些东西。如果我们使用与 _localhost_ 不同的主机名来转发 _remote.example.com_ 怎么办?如果它可以访问其网络上另一个系统上的端口,那么通常可以同样轻松地转发该端口。例如,假设你想在远程网络的 _db.example.com_ 中访问 MariaDB 或 MySQL 服务。该服务通常在端口 3306 上运行。因此,即使你无法 _ssh_ 到实际的 _db.example.com_ 主机,你也可以使用此命令将其转发: +如果你有敏锐的眼睛,你可能已经注意到了一些东西。如果我们要 `remote.example.com` 转发到与 `localhost` 不同的主机名怎么办?如果它可以访问该网络上另一个系统上的端口,那么通常可以同样轻松地转发该端口。例如,假设你想访问也在该远程网络中的 `db.example.com` 的 MariaDB 或 MySQL 服务。该服务通常在端口 3306 上运行。因此,即使你无法 `ssh` 到实际的 `db.example.com` 主机,你也可以使用此命令将其转发: ``` $ ssh -L 3306:db.example.com:3306 remote.example.com ``` -现在,你可以在 _localhost_ 上运行 MariaDB 命令,这实际上是在使用 _db.example.com_ 主机。 +现在,你可以在 `localhost` 上运行 MariaDB 命令,而实际上是在使用 `db.example.com` 主机。 ### 远程端口转发 -远程转发让你可以进行相反操作。想象一下,你正在为办公室的朋友设计一个 Web 应用,并想向他们展示你的工作。不过,不幸的是,你在咖啡店里工作,并且由于网络设置,他们无法通过网络连接访问你的笔记本电脑。但是,你同时使用着办公室的 _remote.example.com_ 系统,并且仍然可在这里登录。你的 Web 应用似乎在本地 5000 端口上运行良好。 +远程转发让你可以进行相反操作。想象一下,你正在为办公室的朋友设计一个 Web 应用,并想向他们展示你的工作。不过,不幸的是,你在咖啡店里工作,并且由于网络设置,他们无法通过网络连接访问你的笔记本电脑。但是,你同时使用着办公室的 `remote.example.com` 系统,并且仍然可在这里登录。你的 Web 应用似乎在本地 5000 端口上运行良好。 -远程端口转发使你可以通过 _ssh_ 连接从本地系统建立端口的隧道,并使该端口在远程系统上可用。在开始 _ssh_ 会话时,只需使用 _-R_ 选项: +远程端口转发使你可以通过 `ssh` 连接从本地系统建立端口的隧道,并使该端口在远程系统上可用。在开始 `ssh` 会话时,只需使用 `-R` 选项: ``` $ ssh -R 6000:localhost:5000 remote.example.com ``` -现在,当在公司防火墙内的朋友打开浏览器时,他们可以进入 _ _ 并查看你的工作。就像在本地端口转发示例中一样,通信通过 _ssh_ 会话安全地进行。 +现在,当在公司防火墙内的朋友打开浏览器时,他们可以进入 `http://remote.example.com:6000` 查看你的工作。就像在本地端口转发示例中一样,通信通过 `ssh` 会话安全地进行。 -默认情况下,_sshd_ 设置在本机运行,因此**只有**该主机可以连接它的远程转发端口。假设你的朋友希望能够让其他 _example.com_ 公司主机上的人看到你的工作,而他们不在 _remote.example.com_ 上。你需要让 _remote.example.com_ 主机的所有者将以下选项之**一**添加 _/etc/ssh/sshd_config_ 中: +默认情况下,`sshd` 守护进程运行在设置的主机上,因此**只有**该主机可以连接它的远程转发端口。假设你的朋友希望能够让其他 `example.com` 公司主机上的人看到你的工作,而他们不在 `remote.example.com` 上。你需要让 `remote.example.com` 主机的所有者将以下选项**之一**添加到 `/etc/ssh/sshd_config` 中: ``` GatewayPorts yes # 或 GatewayPorts clientspecified ``` -第一个选项意味着 _remote.example.com_ 上的所有网络接口都可以使用远程转发的端口。第二个意味着建立隧道的客户端可以选择地址。默认情况下,此选项设置为 **no**。 +第一个选项意味着 `remote.example.com` 上的所有网络接口都可以使用远程转发的端口。第二个意味着建立隧道的客户端可以选择地址。默认情况下,此选项设置为 `no`。 -With this option, you as the _ssh_ client must still specify the interfaces on which the forwarded port on your side can be shared. Do this by adding a network specification before the local port. There are several ways to do this, including the following: -使用此选项,作为 _ssh_ 客户端你仍必须指定可以共享你这边转发端口的接口。通过在本地端口之前添加网络规范来进行操作。有几种方法可以做到,包括: +使用此选项,你作为 `ssh` 客户端仍必须指定可以共享你这边转发端口的接口。通过在本地端口之前添加网络地址范围来进行此操作。有几种方法可以做到,包括: ``` $ ssh -R *:6000:localhost:5000 # 所有网络 @@ -81,13 +80,13 @@ $ ssh -R remote.example.com:6000:localhost:5000 # 单个网络 请注意,本地和远程系统上的端口号不必相同。实际上,有时你甚至可能无法使用相同的端口。例如,普通用户可能不会在默认设置中转发到系统端口。 -另外,可以限制主机上的转发。如果你需要在联网主机上更严格的安全性,那么这你来说可能很重要。 _sshd_ 守护程进程 _PermitOpen_ 选项控制是否以及哪些端口可用于 TCP 转发。默认设置为 **any**,这让上面的所有示例都能正常工作。要禁止任何端口转发,请选择 “none”,或仅允许的特定的“主机:端口”。有关更多信息,请在手册页中搜索 _PermitOpen_ 来配置 _sshd_ 守护进程: +另外,可以限制主机上的转发。如果你需要在联网主机上更严格的安全性,那么这你来说可能很重要。 `sshd` 守护程进程的 `PermitOpen` 选项控制是否以及哪些端口可用于 TCP 转发。默认设置为 `any`,这让上面的所有示例都能正常工作。要禁止任何端口转发,请选择 `none`,或仅允许的特定的“主机:端口”。有关更多信息,请在手册页中搜索 `PermitOpen` 来配置 `sshd` 守护进程: ``` $ man sshd_config ``` -最后,请记住,只有在 _ssh_ 会话处于打开状态时才会端口转发。如果需要长时间保持转发活动,请尝试使用 _-N_ 选项在后台运行会话。确保控制台已锁定,以防止在你离开控制台时对其进行篡改。 +最后,请记住,只有在 `ssh` 会话处于打开状态时才会端口转发。如果需要长时间保持转发活动,请尝试使用 `-N` 选项在后台运行会话。确保控制台已锁定,以防止在你离开控制台时其被篡夺。 -------------------------------------------------------------------------------- @@ -96,7 +95,7 @@ via: https://fedoramagazine.org/using-ssh-port-forwarding-on-fedora/ 作者:[Paul W. Frields][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 371d96e2dd9f9f223457d54e5c49709d87c481a1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 29 Oct 2019 12:42:32 +0800 Subject: [PATCH 204/800] PUB @geekpi https://linux.cn/article-11515-1.html --- .../20191023 Using SSH port forwarding on Fedora.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20191023 Using SSH port forwarding on Fedora.md (100%) diff --git a/translated/tech/20191023 Using SSH port forwarding on Fedora.md b/published/20191023 Using SSH port forwarding on Fedora.md similarity index 100% rename from translated/tech/20191023 Using SSH port forwarding on Fedora.md rename to published/20191023 Using SSH port forwarding on Fedora.md From 87a5dfb18b6139a444d6315a9c7fa1a2dcfee875 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 00:51:34 +0800 Subject: [PATCH 205/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191030=20How=20?= =?UTF-8?q?to=20Find=20Out=20Top=20Memory=20Consuming=20Processes=20in=20L?= =?UTF-8?q?inux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md --- ...Top Memory Consuming Processes in Linux.md | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md diff --git a/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md b/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md new file mode 100644 index 0000000000..9e30fad132 --- /dev/null +++ b/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md @@ -0,0 +1,218 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Find Out Top Memory Consuming Processes in Linux) +[#]: via: (https://www.2daygeek.com/linux-find-top-memory-consuming-processes/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +How to Find Out Top Memory Consuming Processes in Linux +====== + +You may have seen your system consumes too much of memory many times. + +If that’s the case, what would be the best thing you can do to identify processes that consume too much memory on a Linux machine. + +I believe, you may have run one of the below commands to check it out. + +If not, what is the other commands you tried? + +I would request you to update it in the comment section, it may help other users. + +This can be easily identified using the **[top command][1]** and the **[ps command][2]**. + +I used to check both commands simultaneously, and both were given the same result. + +So i suggest you to use one of the command that you like. + +### 1) How to Find Top Memory Consuming Process in Linux Using the ps Command + +The ps command is used to report a snapshot of the current processes. The ps command stands for process status. + +This is a standard Linux application that looks for information about running processes on a Linux system. + +It is used to list the currently running processes and their process ID (PID), process owner name, process priority (PR), and the absolute path of the running command, etc,. + +The below ps command format provides you more information about top memory consumption process. + +``` +# ps aux --sort -rss | head + +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +mysql 1064 3.2 5.4 886076 209988 ? Ssl Oct25 62:40 /usr/sbin/mysqld +varnish 23396 0.0 2.9 286492 115616 ? SLl Oct25 0:42 /usr/sbin/varnishd -P /var/run/varnish.pid -f /etc/varnish/default.vcl -a :82 -T 127.0.0.1:6082 -S /etc/varnish/secret -s malloc,256M +named 1105 0.0 2.7 311712 108204 ? Ssl Oct25 0:16 /usr/sbin/named -u named -c /etc/named.conf +nobody 23377 0.2 2.3 153096 89432 ? S Oct25 4:35 nginx: worker process +nobody 23376 0.1 2.1 147096 83316 ? S Oct25 2:18 nginx: worker process +root 23375 0.0 1.7 131028 66764 ? Ss Oct25 0:01 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf +nobody 23378 0.0 1.6 130988 64592 ? S Oct25 0:00 nginx: cache manager process +root 1135 0.0 0.9 86708 37572 ? S 05:37 0:20 cwpsrv: worker process +root 1133 0.0 0.9 86708 37544 ? S 05:37 0:05 cwpsrv: worker process +``` + +Use the below ps command format to include only specific information about the process of memory consumption in the output. + +``` +# ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%mem | head + + PID PPID %MEM %CPU CMD + 1064 1 5.4 3.2 /usr/sbin/mysqld +23396 23386 2.9 0.0 /usr/sbin/varnishd -P /var/run/varnish.pid -f /etc/varnish/default.vcl -a :82 -T 127.0.0.1:6082 -S /etc/varnish/secret -s malloc,256M + 1105 1 2.7 0.0 /usr/sbin/named -u named -c /etc/named.conf +23377 23375 2.3 0.2 nginx: worker process +23376 23375 2.1 0.1 nginx: worker process + 3625 977 1.9 0.0 /usr/local/bin/php-cgi /home/daygeekc/public_html/index.php +23375 1 1.7 0.0 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf +23378 23375 1.6 0.0 nginx: cache manager process + 1135 3034 0.9 0.0 cwpsrv: worker process +``` + +If you want to see only the command name instead of the absolute path of the command, use the ps command format below. + +``` +# ps -eo pid,ppid,%mem,%cpu,comm --sort=-%mem | head + + PID PPID %MEM %CPU COMMAND + 1064 1 5.4 3.2 mysqld +23396 23386 2.9 0.0 cache-main + 1105 1 2.7 0.0 named +23377 23375 2.3 0.2 nginx +23376 23375 2.1 0.1 nginx +23375 1 1.7 0.0 nginx +23378 23375 1.6 0.0 nginx + 1135 3034 0.9 0.0 cwpsrv + 1133 3034 0.9 0.0 cwpsrv +``` + +### 2) How to Find Out Top Memory Consuming Process in Linux Using the top Command + +The Linux top command is the best and most well known command that everyone uses to monitor Linux system performance. + +It displays a real-time view of the system process running on the interactive interface. + +But if you want to find top memory consuming process then **[use the top command in the batch mode][3]**. + +You should properly **[understand the top command output][4]** to fix the performance issue in system. + +``` +# top -c -b -o +%MEM | head -n 20 | tail -15 + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 1064 mysql 20 0 886076 209740 8388 S 0.0 5.4 62:41.20 /usr/sbin/mysqld +23396 varnish 20 0 286492 115616 83572 S 0.0 3.0 0:42.24 /usr/sbin/varnishd -P /var/run/varnish.pid -f /etc/varnish/default.vcl -a :82 -T 127.0.0.1:6082 -S /etc/varnish/secret -s malloc,256M + 1105 named 20 0 311712 108204 2424 S 0.0 2.8 0:16.41 /usr/sbin/named -u named -c /etc/named.conf +23377 nobody 20 0 153240 89432 2432 S 0.0 2.3 4:35.74 nginx: worker process +23376 nobody 20 0 147096 83316 2416 S 0.0 2.1 2:18.09 nginx: worker process +23375 root 20 0 131028 66764 1616 S 0.0 1.7 0:01.07 nginx: master process /usr/sbin/nginx -c /etc/nginx/nginx.conf +23378 nobody 20 0 130988 64592 592 S 0.0 1.7 0:00.51 nginx: cache manager process + 1135 root 20 0 86708 37572 2252 S 0.0 1.0 0:20.18 cwpsrv: worker process + 1133 root 20 0 86708 37544 2212 S 0.0 1.0 0:05.94 cwpsrv: worker process + 3034 root 20 0 86704 36740 1452 S 0.0 0.9 0:00.09 cwpsrv: master process /usr/local/cwpsrv/bin/cwpsrv + 1067 nobody 20 0 1356200 31588 2352 S 0.0 0.8 0:56.06 /usr/local/apache/bin/httpd -k start + 977 nobody 20 0 1356088 31268 2372 S 0.0 0.8 0:30.44 /usr/local/apache/bin/httpd -k start + 968 nobody 20 0 1356216 30544 2348 S 0.0 0.8 0:19.95 /usr/local/apache/bin/httpd -k start +``` + +If you only want to see the command name instead of the absolute path of the command, use the below top command format. + +``` +# top -b -o +%MEM | head -n 20 | tail -15 + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 1064 mysql 20 0 886076 210340 8388 S 6.7 5.4 62:40.93 mysqld +23396 varnish 20 0 286492 115616 83572 S 0.0 3.0 0:42.24 cache-main + 1105 named 20 0 311712 108204 2424 S 0.0 2.8 0:16.41 named +23377 nobody 20 0 153240 89432 2432 S 13.3 2.3 4:35.74 nginx +23376 nobody 20 0 147096 83316 2416 S 0.0 2.1 2:18.09 nginx +23375 root 20 0 131028 66764 1616 S 0.0 1.7 0:01.07 nginx +23378 nobody 20 0 130988 64592 592 S 0.0 1.7 0:00.51 nginx + 1135 root 20 0 86708 37572 2252 S 0.0 1.0 0:20.18 cwpsrv + 1133 root 20 0 86708 37544 2212 S 0.0 1.0 0:05.94 cwpsrv + 3034 root 20 0 86704 36740 1452 S 0.0 0.9 0:00.09 cwpsrv + 1067 nobody 20 0 1356200 31588 2352 S 0.0 0.8 0:56.04 httpd + 977 nobody 20 0 1356088 31268 2372 S 0.0 0.8 0:30.44 httpd + 968 nobody 20 0 1356216 30544 2348 S 0.0 0.8 0:19.95 httpd +``` + +### 3) Bonus Tips: How to Find Out Top Memory Consuming Process in Linux Using the ps_mem Command + +The **[ps_mem utility][5]** is used to display the core memory used per program (not per process). + +This utility allows you to check how much memory is used per program. + +It calculates the amount of private and shared memory against a program and returns the total used memory in the most appropriate way. + +It uses the following logic to calculate RAM usage. Total RAM = sum (private RAM for program processes) + sum (shared RAM for program processes) + +``` +# ps_mem + + Private + Shared = RAM used Program +128.0 KiB + 27.5 KiB = 155.5 KiB agetty +228.0 KiB + 47.0 KiB = 275.0 KiB atd +284.0 KiB + 53.0 KiB = 337.0 KiB irqbalance +380.0 KiB + 81.5 KiB = 461.5 KiB dovecot +364.0 KiB + 121.5 KiB = 485.5 KiB log +520.0 KiB + 65.5 KiB = 585.5 KiB auditd +556.0 KiB + 60.5 KiB = 616.5 KiB systemd-udevd +732.0 KiB + 48.0 KiB = 780.0 KiB crond +296.0 KiB + 524.0 KiB = 820.0 KiB avahi-daemon (2) +772.0 KiB + 51.5 KiB = 823.5 KiB systemd-logind +940.0 KiB + 162.5 KiB = 1.1 MiB dbus-daemon + 1.1 MiB + 99.0 KiB = 1.2 MiB pure-ftpd + 1.2 MiB + 100.5 KiB = 1.3 MiB master + 1.3 MiB + 198.5 KiB = 1.5 MiB pickup + 1.3 MiB + 198.5 KiB = 1.5 MiB bounce + 1.3 MiB + 198.5 KiB = 1.5 MiB pipe + 1.3 MiB + 207.5 KiB = 1.5 MiB qmgr + 1.4 MiB + 198.5 KiB = 1.6 MiB cleanup + 1.3 MiB + 299.5 KiB = 1.6 MiB trivial-rewrite + 1.5 MiB + 145.0 KiB = 1.6 MiB config + 1.4 MiB + 291.5 KiB = 1.6 MiB tlsmgr + 1.4 MiB + 308.5 KiB = 1.7 MiB local + 1.4 MiB + 323.0 KiB = 1.8 MiB anvil (2) + 1.3 MiB + 559.0 KiB = 1.9 MiB systemd-journald + 1.8 MiB + 240.5 KiB = 2.1 MiB proxymap + 1.9 MiB + 322.5 KiB = 2.2 MiB auth + 2.4 MiB + 88.5 KiB = 2.5 MiB systemd + 2.8 MiB + 458.5 KiB = 3.2 MiB smtpd + 2.9 MiB + 892.0 KiB = 3.8 MiB bash (2) + 3.3 MiB + 555.5 KiB = 3.8 MiB NetworkManager + 4.1 MiB + 233.5 KiB = 4.3 MiB varnishd + 4.0 MiB + 662.0 KiB = 4.7 MiB dhclient (2) + 4.3 MiB + 623.5 KiB = 4.9 MiB rsyslogd + 3.6 MiB + 1.8 MiB = 5.5 MiB sshd (3) + 5.6 MiB + 431.0 KiB = 6.0 MiB polkitd + 13.0 MiB + 546.5 KiB = 13.6 MiB tuned + 22.5 MiB + 76.0 KiB = 22.6 MiB lfd - sleeping + 30.0 MiB + 6.2 MiB = 36.2 MiB php-fpm (6) + 5.7 MiB + 33.5 MiB = 39.2 MiB cwpsrv (3) + 20.1 MiB + 25.3 MiB = 45.4 MiB httpd (5) +104.7 MiB + 156.0 KiB = 104.9 MiB named +112.2 MiB + 479.5 KiB = 112.7 MiB cache-main + 69.4 MiB + 58.6 MiB = 128.0 MiB nginx (4) +203.4 MiB + 309.5 KiB = 203.7 MiB mysqld +--------------------------------- + 775.8 MiB +================================= +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ + +作者:[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/linux-top-command-linux-system-performance-monitoring-tool/ +[2]: https://www.2daygeek.com/linux-ps-command-find-running-process-monitoring/ +[3]: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/ +[4]: https://www.2daygeek.com/understanding-linux-top-command-output-usage/ +[5]: https://www.2daygeek.com/ps_mem-report-core-memory-usage-accurately-in-linux/ From bf6e6e7e9319fdefc9c8890317e0ff74aa0d54cf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 00:52:41 +0800 Subject: [PATCH 206/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191029=20Upgrad?= =?UTF-8?q?ing=20Fedora=2030=20to=20Fedora=2031?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md --- ...191029 Upgrading Fedora 30 to Fedora 31.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md diff --git a/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md b/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md new file mode 100644 index 0000000000..4e27e83d0d --- /dev/null +++ b/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Upgrading Fedora 30 to Fedora 31) +[#]: via: (https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +Upgrading Fedora 30 to Fedora 31 +====== + +![][1] + +Fedora 31 [is available now][2]. You’ll likely want to upgrade your system to get the latest features available in Fedora. Fedora Workstation has a graphical upgrade method. Alternatively, Fedora offers a command-line method for upgrading Fedora 30 to Fedora 31. + +### Upgrading Fedora 30 Workstation to Fedora 31 + +Soon after release time, a notification appears to tell you an upgrade is available. You can click the notification to launch the **GNOME Software** app. Or you can choose Software from GNOME Shell. + +Choose the _Updates_ tab in GNOME Software and you should see a screen informing you that Fedora 31 is Now Available. + +If you don’t see anything on this screen, try using the reload button at the top left. It may take some time after release for all systems to be able to see an upgrade available. + +Choose _Download_ to fetch the upgrade packages. You can continue working until you reach a stopping point, and the download is complete. Then use GNOME Software to restart your system and apply the upgrade. Upgrading takes time, so you may want to grab a coffee and come back to the system later. + +### Using the command line + +If you’ve upgraded from past Fedora releases, you are likely familiar with the _dnf upgrade_ plugin. This method is the recommended and supported way to upgrade from Fedora 30 to Fedora 31. Using this plugin will make your upgrade to Fedora 31 simple and easy. + +#### 1\. Update software and back up your system + +Before you do start the upgrade process, make sure you have the latest software for Fedora 30. This is particularly important if you have modular software installed; the latest versions of dnf and GNOME Software include improvements to the upgrade process for some modular streams. To update your software, use _GNOME Software_ or enter the following command in a terminal. + +``` +sudo dnf upgrade --refresh +``` + +Additionally, make sure you back up your system before proceeding. For help with taking a backup, see [the backup series][3] on the Fedora Magazine. + +#### 2\. Install the DNF plugin + +Next, open a terminal and type the following command to install the plugin: + +``` +sudo dnf install dnf-plugin-system-upgrade +``` + +#### 3\. Start the update with DNF + +Now that your system is up-to-date, backed up, and you have the DNF plugin installed, you can begin the upgrade by using the following command in a terminal: + +``` +sudo dnf system-upgrade download --releasever=31 +``` + +This command will begin downloading all of the upgrades for your machine locally to prepare for the upgrade. If you have issues when upgrading because of packages without updates, broken dependencies, or retired packages, add the _‐‐allowerasing_ flag when typing the above command. This will allow DNF to remove packages that may be blocking your system upgrade. + +#### 4\. Reboot and upgrade + +Once the previous command finishes downloading all of the upgrades, your system will be ready for rebooting. To boot your system into the upgrade process, type the following command in a terminal: + +``` +sudo dnf system-upgrade reboot +``` + +Your system will restart after this. Many releases ago, the _fedup_ tool would create a new option on the kernel selection / boot screen. With the _dnf-plugin-system-upgrade_ package, your system reboots into the current kernel installed for Fedora 30; this is normal. Shortly after the kernel selection screen, your system begins the upgrade process. + +Now might be a good time for a coffee break! Once it finishes, your system will restart and you’ll be able to log in to your newly upgraded Fedora 31 system. + +![][4] + +### Resolving upgrade problems + +On occasion, there may be unexpected issues when you upgrade your system. If you experience any issues, please visit the [DNF system upgrade quick docs][5] for more information on troubleshooting. + +If you are having issues upgrading and have third-party repositories installed on your system, you may need to disable these repositories while you are upgrading. For support with repositories not provided by Fedora, please contact the providers of the repositories. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/ + +作者:[Ben Cotton][a] +选题:[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/bcotton/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/f30-f31-816x345.jpg +[2]: https://fedoramagazine.org/announcing-fedora-31/ +[3]: https://fedoramagazine.org/taking-smart-backups-duplicity/ +[4]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png +[5]: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/#Resolving_post-upgrade_issues From 53da9d97a28665f4ab412ba816a97e491801ac91 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 00:54:51 +0800 Subject: [PATCH 207/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191029=20Fedora?= =?UTF-8?q?=2031=20is=20officially=20here!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191029 Fedora 31 is officially here.md --- .../20191029 Fedora 31 is officially here.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20191029 Fedora 31 is officially here.md diff --git a/sources/tech/20191029 Fedora 31 is officially here.md b/sources/tech/20191029 Fedora 31 is officially here.md new file mode 100644 index 0000000000..0818e7015d --- /dev/null +++ b/sources/tech/20191029 Fedora 31 is officially here.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora 31 is officially here!) +[#]: via: (https://fedoramagazine.org/announcing-fedora-31/) +[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) + +Fedora 31 is officially here! +====== + +![][1] + +It’s here! We’re proud to announce the release of Fedora 31. Thanks to the hard work of thousands of Fedora community members and contributors, we’re celebrating yet another on-time release. This is getting to be a habit! + +If you just want to get to the bits without delay, go to right now. For details, read on! + +### Toolbox + +If you haven’t used the [Fedora Toolbox][2], this is a great time to try it out. This is a simple tool for launching and managing personal workspace containers, so you can do development or experiment in an isolated experience. It’s as simple as running “toolbox enter” from the command line. + +This containerized workflow is vital for users of the ostree-based Fedora variants like CoreOS, IoT, and Silverblue, but is also extremely useful on any workstation or even server system. Look for many more enhancements to this tool and the user experience around it in the next few months — your feedback is very welcome. + +### All of Fedora’s Flavors + +Fedora Editions are targeted outputs geared toward specific “showcase” uses. + +Fedora Workstation focuses on the desktop, and particular software developers who want a “just works” Linux operating system experience. This release features GNOME 3.34, which brings significant performance enhancements which will be especially noticeable on lower-powered hardware. + +Fedora Server brings the latest in cutting-edge open source server software to systems administrators in an easy-to-deploy fashion. + +And, in preview state, we have Fedora CoreOS, a category-defining operating system made for the modern container world, and [Fedora IoT][3] for “edge computing” use cases. (Stay tuned for a planned contest to find a shiny name for the IoT edition!) + +Of course, we produce more than just the editions. [Fedora Spins][4] and [Labs][5] target a variety of audiences and use cases, including the [Fedora Astronomy][6], which brings a complete open source toolchain to both amateur and professional astronomers, and desktop environments like [KDE Plasma][7] and [Xfce][8]. + +And, don’t forget our alternate architectures, [ARM AArch64, Power, and S390x][9]. Of particular note, we have improved support for the Rockchip system-on-a-chip devices including the Rock960, RockPro64,  and Rock64, plus initial support for “[panfrost][10]”, an open source 3D accelerated graphics driver for newer Arm Mali “midgard” GPUs. + +If you’re using an older 32-bit only i686 system, though, it’s time to find an alternative — [we bid farewell to 32-bit Intel architecture as a base system][11] this release. + +### 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][12]” foundation, we’re enabling CgroupsV2 (if you’re using Docker, [make sure to check this out][13]). Glibc 2.30  and NodeJS 12 are among the many updated packages in Fedora 31. And, we’ve switched the “python” command to by Python 3 — remember, Python 2 is end-of-life at the [end of this year][14]. + +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][15]. + +### In the unlikely event of a problem…. + +If you run into a problem, check out the [Fedora 31 Common Bugs][16] page, and if you have questions, visit our [Ask Fedora][17] 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. And if you’re in Portland for [USENIX LISA][18] this week, stop by the expo floor and visit me at the Red Hat, Fedora, and CentOS booth. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/announcing-fedora-31/ + +作者:[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/2019/10/fedora31-816x345.jpg +[2]: https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/ +[3]: https://iot.fedoraproject.org/ +[4]: https://spins.fedoraproject.org/ +[5]: https://labs.fedoraproject.org/ +[6]: https://labs.fedoraproject.org/en/astronomy/ +[7]: https://spins.fedoraproject.org/en/kde/ +[8]: https://spins.fedoraproject.org/en/xfce/ +[9]: https://alt.fedoraproject.org/alt/ +[10]: https://panfrost.freedesktop.org/ +[11]: https://fedoramagazine.org/in-fedora-31-32-bit-i686-is-86ed/ +[12]: https://docs.fedoraproject.org/en-US/project/#_first +[13]: https://fedoraproject.org/wiki/Common_F31_bugs#Docker_package_no_longer_available_and_will_not_run_by_default_.28due_to_switch_to_cgroups_v2.29 +[14]: https://pythonclock.org/ +[15]: https://docs.fedoraproject.org/en-US/quick-docs/upgrading/ +[16]: https://fedoraproject.org/wiki/Common_F31_bugs +[17]: http://ask.fedoraproject.org +[18]: https://www.usenix.org/conference/lisa19 From fe185ba716179947596065f7e054cfd4d6df0708 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 00:59:38 +0800 Subject: [PATCH 208/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191029=20Demyst?= =?UTF-8?q?ifying=20namespaces=20and=20containers=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191029 Demystifying namespaces and containers in Linux.md --- ...ying namespaces and containers in Linux.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20191029 Demystifying namespaces and containers in Linux.md diff --git a/sources/tech/20191029 Demystifying namespaces and containers in Linux.md b/sources/tech/20191029 Demystifying namespaces and containers in Linux.md new file mode 100644 index 0000000000..80b505bfd0 --- /dev/null +++ b/sources/tech/20191029 Demystifying namespaces and containers in Linux.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Demystifying namespaces and containers in Linux) +[#]: via: (https://opensource.com/article/19/10/namespaces-and-containers-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Demystifying namespaces and containers in Linux +====== +Peek behind the curtains to understand the backend of Linux container +technology. +![cubes coming together to create a larger cube][1] + +Containers have taken the world by storm. Whether you think of Kubernetes, Docker, CoreOS, Silverblue, or Flatpak when you hear the term, it's clear that modern applications are running in containers for convenience, security, and scalability. + +Containers can be confusing to understand, though. What does it mean to run in a container? How can processes in a container interact with the rest of the computer they're running on? Open source dislikes mystery, so this article explains the backend of container technology, just as [my article on Flatpak][2] explained a common frontend. + +### Namespaces + +Namespaces are common in the programming world. If you dwell in the highly technical places of the computer world, then you have probably seen code like this: + + +``` +`using namespace std;` +``` + +Or you may have seen this in XML: + + +``` +`` +``` + +These kinds of phrases provide context for commands used later in a source code file. The only reason C++ knows, for instance, what programmers mean when they type **cout** is because C++ knows the **cout** namespace is a meaningful word. + +If that's too technical for you to picture, you may be surprised to learn that we all use namespaces every day in real life, too. We don't call them namespaces, but we use the concept all the time. For instance, the phrase "I'm a fan of the Enterprise" has one meaning in an IT company that serves large businesses (which are commonly called "enterprises"), but it may have a different meaning at a science fiction convention. The question "what engine is it running?" has one meaning in a garage and a different meaning in web development. We don't always declare a namespace in casual conversation because we're human, and our brains can adapt quickly to determine context, but for computers, the namespace must be declared explicitly. + +For containers, a namespace is what defines the boundaries of a process' "awareness" of what else is running around it. + +### lsns + +You may not realize it, but your Linux machine quietly maintains different namespaces specific to given processes. By using a recent version of the **util-linux** package, you can list existing namespaces on your machine: + + +``` +$ lsns +        NS TYPE   NPROCS   PID USER    COMMAND +4026531835 cgroup     85  1571 seth /usr/lib/systemd/systemd --user +4026531836 pid        85  1571 seth /usr/lib/systemd/systemd --user +4026531837 user       80  1571 seth /usr/lib/systemd/systemd --user +4026532601 user        1  6266 seth /usr/lib64/firefox/firefox [...] +4026532928 net         1  7164 seth /usr/lib64/firefox/firefox [...] +[...] +``` + +If your version of **util-linux** doesn't provide the **lsns** command, you can see namespace entries in **/proc**: + + +``` +$ ls /proc/*/ns +1571 +6266 +7164 +[...] +$ ls /proc/6266/ns +ipc net pid user uts [...] +``` + +Each process running on your Linux machine is enumerated with a process ID (PID). Each PID is assigned a namespace. PIDs in the same namespace can have access to one another because they are programmed to operate within a given namespace. PIDs in different namespaces are unable to interact with one another by default because they are running in a different context, or _namespace_. This is why a process running in a "container" under one namespace cannot access information outside its container or information running inside a different container. + +### Creating a new namespace + +A usual feature of software dealing with containers is automatic namespace management. A human administrator starting up a new containerized application or environment doesn't have to use **lsns** to check which namespaces exist and then create a new one manually; the software using PID namespaces does that automatically with the help of the Linux kernel. However, you can mimic the process manually to gain a better understanding of what's happening behind the scenes. + +First, you need to identify a process that is _not_ running on your computer. For this example, I'll use the Z shell ([Zsh][3]) because I'm running the Bash shell on my machine. If you're running Zsh on your computer, then use **Bash** or **tcsh** or some other shell that you're not currently running. The goal is to find something that you can prove is not running. You can prove something is not running with the **pidof** command, which queries your system to discover the PID of any application you name: + + +``` +$ pidof zsh +$ sudo pidof zsh +``` + +As long as no PID is returned, the application you have queried is not running. + +#### Unshare + +The **unshare** command runs a program in a namespace _unshared_ from its parent process. There are many kinds of namespaces available, so read the **unshare** man page for all options available. + +To create a new namespace for your test command: + + +``` +$ sudo unshare --fork --pid --mount-proc zsh +% +``` + +Because Zsh is an interactive shell, it conveniently brings you into its namespace upon launch. Not all processes do that, because some processes run in the background, leaving you at a prompt in its native namespace. As long as you remain in the Zsh session, you can see that you have left the usual namespace by looking at the PID of your new forked process: + + +``` +% pidof zsh +pid 1 +``` + +If you know anything about Linux process IDs, then you know that PID 1 is always reserved, mostly by nature of the boot process, for the initialization application (systemd on most distributions outside of Slackware, Devuan, and maybe some customized installations of Arch). It's next to impossible for Zsh, or any application that isn't a boot initialization application, to be PID 1 (because without an init system, a computer wouldn't know how to boot up). Yet, as far as your shell knows in this demonstration, Zsh occupies the PID 1 slot. + +Despite what your shell is now telling you, PID 1 on your system has _not_ been replaced. Open a second terminal or terminal tab on your computer and look at PID 1: + + +``` +$ ps 1 +init +``` + +And then find the PID of Zsh: + + +``` +$ pidof zsh +7723 +``` + +As you can see, your "host" system sees the big picture and understands that Zsh is actually running as some high-numbered PID (it probably won't be 7723 on your computer, except by coincidence). Zsh sees itself as PID 1 only because its scope is confined to (or _contained_ within) its namespace. Once you have forked a process into its own namespace, its children processes are numbered starting from 1, but only within that namespace. + +Namespaces, along with other technologies like **cgroups** and more, form the foundation of containerization. Understanding that namespaces exist within the context of the wider namespace of a host environment (in this demonstration, that's your computer, but in the real world the host is typically a server or a hybrid cloud) can help you understand how and why containerized applications act the way they do. For instance, a container running a Wordpress blog doesn't "know" it's not running in a container; it knows that it has access to a kernel and some RAM and whatever configuration files you've provided it, but it probably can't access your home directory or any directory you haven't specifically given it permission to access. Furthermore, a runaway process within that blog software can't affect any other process on your system, because as far as it knows, the PID "tree" only goes back to 1, and 1 is the container it's running in. + +Containers are a powerful Linux feature, and they're getting more popular every day. Now that you understand how they work, try exploring container technology such as Kubernetes, Silverblue, or Flatpak, and see what you can do with containerized apps. Containers are Linux, so start them up, inspect them carefully, and learn as you go. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/namespaces-and-containers-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/cube_innovation_process_block_container.png?itok=vkPYmSRQ (cubes coming together to create a larger cube) +[2]: https://opensource.com/article/19/10/how-build-flatpak-packaging +[3]: https://opensource.com/article/19/9/getting-started-zsh From e810d17767b3a8a844c97c0a30d65303e01440d9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 01:01:22 +0800 Subject: [PATCH 209/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191029=20What?= =?UTF-8?q?=20you=20probably=20didn=E2=80=99t=20know=20about=20sudo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191029 What you probably didn-t know about sudo.md --- ...hat you probably didn-t know about sudo.md | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 sources/tech/20191029 What you probably didn-t know about sudo.md diff --git a/sources/tech/20191029 What you probably didn-t know about sudo.md b/sources/tech/20191029 What you probably didn-t know about sudo.md new file mode 100644 index 0000000000..e58c092602 --- /dev/null +++ b/sources/tech/20191029 What you probably didn-t know about sudo.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What you probably didn’t know about sudo) +[#]: via: (https://opensource.com/article/19/10/know-about-sudo) +[#]: author: (Peter Czanik https://opensource.com/users/czanik) + +What you probably didn’t know about sudo +====== +Think you know everything about sudo? Think again. +![Command line prompt][1] + +Everybody knows **sudo**, right? This tool is installed by default on most Linux systems and is available for most BSD and commercial Unix variants. Still, after talking to hundreds of **sudo** users, the most common answer I received was that **sudo** is a tool to complicate life. + +There is a root user and there is the **su** command, so why have yet another tool? For many, **sudo** was just a prefix for administrative commands. Only a handful mentioned that when you have multiple administrators for the same system, you can use **sudo** logs to see who did what. + +So, what is **sudo**? According to the [**sudo** website][2]: + +> _"Sudo allows a system administrator to delegate authority by giving certain users the ability to run some commands as root or another user while providing an audit trail of the commands and their arguments."_ + +By default, **sudo** comes with a simple configuration, a single rule allowing a user or a group of users to do practically anything (more on the configuration file later in this article): + + +``` +`%wheel ALL=(ALL) ALL` +``` + +In this example, the parameters mean the following: + + * The first parameter defines the members of the group. + * The second parameter defines the host(s) the group members can run commands on. + * The third parameter defines the usernames under which the command can be executed. + * The last parameter defines the applications that can be run. + + + +So, in this example, the members of the **wheel** group can run all applications as all users on all hosts. Even this really permissive rule is useful because it results in logs of who did what on your machine. + +### Aliases + +Of course, once it is not just you and your best friend administering a shared box, you will start to fine-tune permissions. You can replace the items in the above configuration with lists: a list of users, a list of commands, and so on. Most likely, you will copy and paste some of these lists around in your configuration. + +This situation is where aliases can come handy. Maintaining the same list in multiple places is error-prone. You define an alias once and then you can use it many times. Therefore, when you lose trust in one of your administrators, you can remove them from the alias and you are done. With multiple lists instead of aliases, it is easy to forget to remove the user from one of the lists with elevated privileges.  + +### Enable features for a certain group of users + +The **sudo** command comes with a huge set of defaults. Still, there are situations when you want to override some of these. This is when you use the **Defaults** statement in the configuration. Usually, these defaults are enforced on every user, but you can narrow the setting down to a subset of users based on host, username, and so on. Here is an example that my generation of sysadmins loves to hear about: insults. These are just some funny messages for when someone mistypes a password: + + +``` +czanik@linux-mewy:~> sudo ls +[sudo] password for root: +Hold it up to the light --- not a brain in sight! +[sudo] password for root: +My pet ferret can type better than you! +[sudo] password for root: +sudo: 3 incorrect password attempts +czanik@linux-mewy:~> +``` + +Because not everyone is a fan of sysadmin humor, these insults are disabled by default. The following example shows how to enable this setting only for your seasoned sysadmins, who are members of the **wheel** group: + + +``` +Defaults !insults +Defaults:%wheel insults +``` + +I do not have enough fingers to count how many people thanked me for bringing these messages back. + +### Digest verification + +There are, of course, more serious features in **sudo** as well. One of them is digest verification. You can include the digest of applications in your configuration:  + + +``` +`peter ALL = sha244:11925141bb22866afdf257ce7790bd6275feda80b3b241c108b79c88 /usr/bin/passwd` +``` + +In this case, **sudo** checks and compares the digest of the application to the one stored in the configuration before running the application. If they do not match, **sudo** refuses to run the application. While it is difficult to maintain this information in your configuration—there are no automated tools for this purpose—these digests can provide you with an additional layer of protection. + +### Session recording + +Session recording is also a lesser-known feature of **sudo**. After my demo, many people leave my talk with plans to implement it on their infrastructure. Why? Because with session recording, you see not just the command name, but also everything that happened in the terminal. You can see what your admins are doing even if they have shell access and logs only show that **bash** is started. + +There is one limitation, currently. Records are stored locally, so with enough permissions, users can delete their traces. Stay tuned for upcoming features. + +### Plugins + +Starting with version 1.8, **sudo** changed to a modular, plugin-based architecture. With most features implemented as plugins, you can easily replace or extend the functionality of **sudo** by writing your own. There are both open source and commercial plugins already available for **sudo**. + +In my talk, I demonstrated the **sudo_pair** plugin, which is available [on GitHub][3]. This plugin is developed in Rust, meaning that it is not so easy to compile, and it is even more difficult to distribute the results. On the other hand, the plugin provides interesting functionality, requiring a second admin to approve (or deny) running commands through **sudo**. Not just that, but sessions can be followed on-screen and terminated if there is suspicious activity. + +In a demo I did during a recent talk at the All Things Open conference, I had the infamous: + + +``` +`czanik@linux-mewy:~> sudo  rm -fr /` +``` + +command displayed on the screen. Everybody was holding their breath to see whether my laptop got destroyed, but it survived. + +### Logs + +As I already mentioned at the beginning, logging and alerting is an important part of **sudo**. If you do not check your **sudo** logs regularly, there is not much worth in using **sudo**. This tool alerts by email on events specified in the configuration and logs all events to **syslog**. Debug logs can be turned on and used to debug rules or report bugs. + +### Alerts + +Email alerts are kind of old-fashioned now, but if you use **syslog-ng** for collecting your log messages, your **sudo** log messages are automatically parsed. You can easily create custom alerts and send those to a wide variety of destinations, including Slack, Telegram, Splunk, or Elasticsearch. You can learn more about this feature from [my blog on syslong-ng.com][4]. + +### Configuration + +We talked a lot about **sudo** features and even saw a few lines of configuration. Now, let’s take a closer look at how **sudo** is configured. The configuration itself is available in **/etc/sudoers**, which is a simple text file. Still, it is not recommended to edit this file directly. Instead, use **visudo**, as this tool also does syntax checking. If you do not like **vi**, you can change which editor to use by pointing the **EDITOR** environment variable at your preferred option. + +Before you start editing the **sudo** configuration, make sure that you know the root password. (Yes, even on Ubuntu, where root does not have a password by default.) While **visudo** checks the syntax, it is easy to create a syntactically correct configuration that locks you out of your system. + +When you have a root password at hand in case of an emergency, you can start editing your configuration. When it comes to the **sudoers** file, there is one important thing to remember: This file is read from top to bottom, and the last setting wins. What this fact means for you is that you should start with generic settings and place exceptions at the end, otherwise exceptions are overridden by the generic settings. + +You can find a simple **sudoers** file below, based on the one in CentOS, and add a few lines we discussed previously: + + +``` +Defaults !visiblepw +Defaults always_set_home +Defaults match_group_by_gid +Defaults always_query_group_plugin +Defaults env_reset +Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS" +Defaults env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE" +Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin +root ALL=(ALL) ALL +%wheel ALL=(ALL) ALL +Defaults:%wheel insults +Defaults !insults +Defaults log_output +``` + +This file starts by changing a number of defaults. Then come the usual default rules: The **root** user and members of the **wheel** group have full permissions over the machine. Next, we enable insults for the **wheel** group, but disable them for everyone else. The last line enables session recording. + +The above configuration is syntactically correct, but can you spot the logical error? Yes, there is one: Insults are disabled for everyone since the last, generic setting overrides the previous, more specific setting. Once you switch the two lines, the setup works as expected: Members of the **wheel** group receive funny messages, but the rest of the users do not receive them. + +### Configuration management + +Once you have to maintain the **sudoers** file on multiple machines, you will most likely want to manage your configuration centrally. There are two major open source possibilities here. Both have their advantages and drawbacks. + +You can use one of the configuration management applications that you also use to configure the rest of your infrastructure. Red Hat Ansible, Puppet, and Chef all have modules to configure **sudo**. The problem with this approach is that updating configurations is far from real-time. Also, users can still edit the **sudoers** file locally and change settings. + +The **sudo** tool can also store its configuration in LDAP. In this case, configuration changes are real-time and users cannot mess with the **sudoers** file. On the other hand, this method also has limitations. For example, you cannot use aliases or use **sudo** when the LDAP server is unavailable. + +### New features + +There is a new version of **sudo** right around the corner. Version 1.9 will include many interesting new features. Here are the most important planned features: + + * A recording service to collect session recordings centrally, which offers many advantages compared to local storage: + * It is more convenient to search in one place. + * Recordings are available even if the sender machine is down. + * Recordings cannot be deleted by someone who wants to delete their tracks. + * The **audit** plugin does not add new features to **sudoers**, but instead provides an API for plugins to easily access any kind of **sudo** logs. This plugin enables creating custom logs from **sudo** events using plugins. + * The **approval** plugin enables session approvals without using third-party plugins. + * And my personal favorite: Python support for plugins, which enables you to easily extend **sudo** using Python code instead of coding natively in C. + + + +### Conclusion + +I hope this article proved to you that **sudo** is a lot more than just a simple prefix. There are tons of possibilities to fine-tune permissions on your system. You cannot just fine-tune permissions, but also improve security by checking digests. Session recordings enable you to check what is happening on your systems. You can also extend the functionality of **sudo** using plugins, either using something already available or writing your own. Finally, given the list of upcoming features you can see that even if **sudo** is decades old, it is a living project that is constantly evolving. + +If you want to learn more about **sudo**, here are a few resources: + + * [The **sudo** website][5] + + * [The **sudo** blog][6] + + * [Follow us on Twitter][7] + + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/know-about-sudo + +作者:[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/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) +[2]: https://www.sudo.ws +[3]: https://github.com/square/sudo_pair/ +[4]: https://www.syslog-ng.com/community/b/blog/posts/alerting-on-sudo-events-using-syslog-ng +[5]: https://www.sudo.ws/ +[6]: https://blog.sudo.ws/ +[7]: https://twitter.com/sudoproject From 7243a7e3f40cdca167ce909619c70133bb947599 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 01:02:47 +0800 Subject: [PATCH 210/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191029=20The=20?= =?UTF-8?q?best=20(and=20worst)=20ways=20to=20influence=20your=20open=20co?= =?UTF-8?q?mmunity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191029 The best (and worst) ways to influence your open community.md --- ...) ways to influence your open community.md | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 sources/tech/20191029 The best (and worst) ways to influence your open community.md diff --git a/sources/tech/20191029 The best (and worst) ways to influence your open community.md b/sources/tech/20191029 The best (and worst) ways to influence your open community.md new file mode 100644 index 0000000000..51cb63286c --- /dev/null +++ b/sources/tech/20191029 The best (and worst) ways to influence your open community.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The best (and worst) ways to influence your open community) +[#]: via: (https://opensource.com/open-organization/19/10/how-to-influence-open-community) +[#]: author: (ldimaggi https://opensource.com/users/ldimaggi) + +The best (and worst) ways to influence your open community +====== +The trick to effectively influencing your community's decisions? +Empathy, confidence, and patience. +![Media ladder][1] + +After you've established a positive reputation in an open community—hopefully, as [we discussed in our previous article][2], by being an active member in and contributing productively to that community—you'll have built up a healthy "bank balance" of credibility you can use to influence the _direction_ of that community. + +What does this mean in concrete terms? It means you can contribute to the decisions the community makes. + +In this article, we'll explain how best to do this—and how best _not_ to do it. + +### Understanding influence + +To some, the term "influence" denotes a heavy-handed approach to imposing your will over others. That _is_ one way to exercise influence. But "influencing" others over whom you have clear political or economic power and seeing them obey your commands isn't too difficult. + +In an organization structured such that a single leader makes decisions and simply "passes down" those decisions to followers, influence isn't _earned_; it's simply _enforced_. Decisions in this sense are mandates. Those decisions don't encourage differing views. If someone questions a decision (or raises a contrarian view) he or she will have a difficult time promoting that view, because people's employment or membership in the organization depends on following the will of the leader. Unfortunately, many hierarchical organizations around the world run this way. + +When it comes to influencing people who can actually exercise free will (and most people in an open organization can, to some degree), patience is both necessary and useful. Sometimes the only way to make quick progress is to go slowly and persistently. + +### Balancing empathy and confidence + +In an organization structured such that a single leader makes decisions and simply "passes down" those decisions to followers, influence isn't earned; it's simply enforced. + +Apart from patience and persistence, what else will you need to display in order to influence others in an open organization? We think these factors are important: + +#### Expressing empathy + +It's easy to become frustrated when you encounter a situation where you simply cannot get people to change their minds and see things your way. As human beings, we all have beliefs and opinions. And all too frequently, we base these on incorrect information or biases. A key element to success at influencing others in an open organization is understanding not only others' opinions but also the causes behind them. + +In this context, empathy and listening skills are more important than your ability to command (and more effective, too). For example, if you propose a change in direction for a project, and other people object, think: Are they objecting because they are carrying emotional "baggage" from a previous project that encountered problems in a similar situation? They may not be able to see your point of view unless they can be freed from carrying around that baggage. + +#### Having confidence (in yourself and others) + +In this context, to be successful in influencing others, you must have reached your own conclusions through a rigorous vetting process. In other words, must have gotten past the point of conducting internal debates with yourself. You won't influence others to think or do something you yourself don't believe in. + +Don't misunderstand us: This is not a matter of having blind faith in yourself. Indeed, some of the most dangerous people around do not know their own limits. For example, we all have a general understanding of dentistry, but we're not going to work on our own teeth (or anyone else's, for that matter)! The confidence you have in your opinion must be based on your ability to defend that position to both others and yourself, based on facts and evidence. You also have to have confidence in your audience. You have to have faith that when presented with facts and evidence, they have the ability to internalize that argument, understand, and eventually accept that information. + +### Moving forward + +So far we've focused almost exclusively on the _positive_ situations in which you'd want to apply your influence (i.e., to "bring people around" to your side of an issue). Unfortunately, you'll also encounter _negative_ situations where team members are in disagreement, or one or more team members are simply saying "no" to all your attempts to find common ground. + +Remember, in an open organization, great ideas can come from anyone, not just someone in a leadership position, and those ideas must always be reviewed to ensure they provide value. + +What can you do if you hit this type of brick wall? How can you move forward? + +The answer might be by applying patient, persistent, and empathetic escalation, along with some flexibility. For example: + + * **Search for the root causes of disagreement:** Are the problems that you face technical in nature, or are they interpersonal? Technical issues can be difficult to resolve, but interpersonal problems can be much _more_ difficult, as they involve human needs and emotions (we humans love to hold grudges). Does the person with whom you're dealing feel a loss of control over the project, or are they feeling marginalized? With distributed teams (which often require us to communicate through online tools), hard feelings can grow undetected until they explode into the open. How will you spot and resolve these? You may need to invest time and effort reaching out to team members privately, on a one-to-one basis. Based on time zones, this may require some late nights or early mornings. But it can be very effective, as some people will be reluctant to discuss disagreements in group meetings or online chats. + * **Seek common ground:** A blanket refusal to compromise on a topic can sometimes mask areas of potential agreement. Can you sub-divide the topic you're discussing into smaller pieces, then look for areas of possible agreement or common ground? Building upon smaller agreements can have a multiplier effect, which can lead to better cooperation and ultimately agreement on larger topics. Think of this approach as emulating a sailboat facing a headwind. The only way to make forward progress is to "tack"—that is, to move forward at an angle when a straight ahead path is not possible.  + * **Enlist allies:** Open teams and communities can feel like families. At some point in everyone's family, feuds break out, and you can only resolve them through a third party. On your team or in your community, if you're locked in a polarizing disagreement with a team member, reach out to other members of the team to provide support for your conclusions. + + + +And if all that fails, then try turning to these "last resorts": + + * **Last Resort #1:** If empathetic approaches fail, then it's time to escalate. Start by staging an intervention, where the full team meets to convince a team member to adopt a team decision. It's not "do what I'm tellin' ya"; it's "do what we all are asking you to do and here's why." + * **Last Resort #2:** If all else fails—if you've tried _everything else_ on this list and the team is mostly in agreement, yet you cannot get the last few holdouts to agree—then it's time to move on without them. Hopefully, this will be a rare occurrence. + + + +### Conclusions + +In a traditional, top-down organization, a person's degree of influence springs from that person's position, title, and the economic power the position commands. In sharp contrast, many open organizations are meritocracies in which the amount of influence a person possesses is directly related to the value of the contributions that one makes to the community. In open source communities, for example, influence is _earned_ over time through contributions—and through patience and persistence—much like a virtual currency. Making slow, patient, and persistent progress can sometimes be more effective than trying to make _quick_ progress. + +Remember, in an open organization, great ideas can come from anyone, not just someone in a leadership position, and those ideas must always be reviewed to ensure they provide value. Influence in an open community—like happiness in life—must always be earned. And, once earned, it must be applied with patience and sensitivity to other people's views (and the reasons behind them), and with confidence in both your own judgement and others' abilities to accept occasionally unpleasant, but still critical, facts. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/10/how-to-influence-open-community + +作者:[ldimaggi][a] +选题:[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/ldimaggi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_meritladder.png?itok=eWIDxnh2 (Media ladder) +[2]: https://opensource.com/open-organization/19/10/gaining-influence-open-community From 45cc157ec088c715a7ea170b7c5c9e2f610a7d7f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 01:03:25 +0800 Subject: [PATCH 211/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191029=205=20re?= =?UTF-8?q?asons=20why=20I=20love=20Python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191029 5 reasons why I love Python.md --- .../20191029 5 reasons why I love Python.md | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 sources/tech/20191029 5 reasons why I love Python.md diff --git a/sources/tech/20191029 5 reasons why I love Python.md b/sources/tech/20191029 5 reasons why I love Python.md new file mode 100644 index 0000000000..5df5be960e --- /dev/null +++ b/sources/tech/20191029 5 reasons why I love Python.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 reasons why I love Python) +[#]: via: (https://opensource.com/article/19/10/why-love-python) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +5 reasons why I love Python +====== +These are a few of my favorite things about Python. +![Snake charmer cartoon with a yellow snake and a blue snake][1] + +I have been using Python since it was a little-known language in 1998. It was a time when [Perl was quite popular][2] in the open source world, but I believed in Python from the moment I found it. My parents like to remind me that I used to say things like, "Python is going to be a big deal" and "I'll be able to find a job using it one day."** **It took a while, but my predictions came true. + +There is so much to love about the language. Here are my top 5 reasons why I continue to love Python so much (in reverse order, to build anticipation). + +### 5\. Python reads like executable pseudocode + +Pseudocode is the concept of writing out programming logic without it following the exact syntax and grammar of a specific language. I have stopped writing much pseudocode since becoming a Python programmer because its actual design meets my needs. + +Python can be easy to read even if you don't know the language well and that is very much by design. It is reasonably famous for whitespace requirements for code to be able to run. Whitespace is necessary for any language–it allows us to see each of the words in this sentence as distinct. Most languages have suggestions or  "best practices" around whitespace usage, but Python takes a bold step by requiring standardization. For me, that makes it incredibly straightforward to read through code and see exactly what it's doing. + +For example, here is an implementation of the classic [bubble sort algorithm][3]. + + +``` +def bubble_sort(things): + +    needs_pass = True + +    while needs_pass: + +        needs_pass = False + +        for idx in range(1, len(things)): + +            if things[idx - 1] > things[idx]: + +                things[idx - 1], things[idx] = things[idx], things[idx - 1] + +                needs_pass = True +``` + +Now let's compare that with [this implementation][4] in Java. + + +``` +public static int[] bubblesort(int[] numbers) { +    boolean swapped = true; +    for(int i = numbers.length - 1; i > 0 && swapped; i--) { +        swapped = false; +        for (int j = 0; j < i; j++) { +            if (numbers[j] > numbers[j+1]) { +                int temp = numbers[j]; +                numbers[j] = numbers[j+1]; +                numbers[j+1] = temp; +                swapped = true; +            } +        } +    } +    return numbers; +} +``` + +I appreciate that Python requires indentation to indicate nesting of blocks. While our Java example also uses indentation quite nicely, it is not required. The curly brackets are what determine the beginning and end of the block, not the spacing. Since Python uses whitespace as syntax, there is no need for beginning **{** and end **}** notation throughout the other code.  + +Python also avoids the need for semicolons, which is a [syntactic sugar][5] needed to make other languages human-readable. Python is much easier to read on my eyes and it feels so close to pseudocode it sometimes surprises me what is runnable! + +### 4\. Python has powerful primitives + +In programming language design, a primitive is the simplest available element. The fact that Python is easy to read does _not_ mean it is not a powerful language, and that stems from its use of primitives. My favorite example of what makes Python both easy to use and advanced is its concept of **generators**.  + +Imagine you have a simple binary tree structure with `value`, `left`, and `right`. You want to easily iterate over it in order. You usually are looking for "small" elements, in order to exit as soon as the right value is found. That sounds simple so far. However, there are many kinds of algorithms to make a decision on the element. + +Other languages would have you write a **visitor**, where you invert control by putting your "is this the right element?" in a function and call it via function pointers. You _can_ do this in Python. But you don't have to. + + +``` +def in_order(tree): + +    if tree is None: + +        return + +    yield from in_order(tree.left) + +    yield tree.value + +    yield from in_order(tree.right) +``` + +This _generator function_ will return an iterator that, if used in a **for** loop, will only execute as much as needed but no more. That's powerful. + +### 3\. The Python standard library + +Python has a great standard library with many hidden gems I did not know about until I took the time to [walk through the list of all available][6] functions, constants, types, and much more. One of my personal favorites is the `itertools` module, which is listed under the functional programming modules (yes, [Python supports functional programming][7]!). + +It is great for playing jokes on your tech interviewer, for example with this nifty little solution to the classic [FizzBuzz interview question][8]: + + +``` +fizz = itertools.cycle(itertools.chain(['Fizz'], itertools.repeat('', 2))) + +buzz = itertools.cycle(itertools.chain(['Buzz'], itertools.repeat('', 4))) + +fizz_buzz = map(operator.add, fizz, buzz) + +numbers = itertools.islice(itertools.count(), 100) + +combo = zip(fizz_buzz, numbers) + +for fzbz, n in combo: + +    print(fzbz or n) +``` + +A quick web search will show that this is not the most straight-forward way to solve for FizzBuzz, but it sure is fun! + +Beyond jokes, the `itertools` module, as well as the `heapq` and `functools` modules are a trove of treasures that come by default in your Python implementation. + +### 2\. The Python ecosystem is massive + +For everything that is not in the standard library, there is an enormous ecosystem to support the new Pythonista, from exciting packages to text editor plugins specifically for the language. With around 200,000 projects hosted on PyPi (at the time of writing) and growing, there is something for everyone: [data science][9], [async frameworks][10], [web frameworks][11], or just tools to make [remote automation][12] easier. + +### 1\. The Python community is special + +The Python community is amazing. It was one of the first to adopt a code of conduct, first for the [Python Software Foundation][13] and then for [PyCon][14]. There is a real commitment to diversity and inclusion: blog posts and conference talks on this theme are frequent, thoughtful, and well-read by Python community members. + +While the community is global, there is a lot of great activity in the local community as well. Local Python meet-ups are a great place to meet wonderful people who are smart, experienced, and eager to help. A lot of meet-ups will explicitly have time set aside for experienced people to help newcomers who want to learn a new concept or to get past an issue with their code. My local community took the time to support me as I began my Python journey, and I am privileged to continue to give back to new developers. + +Whether you can attend a local community meet-up or you spend time with the [online Python community][15] across IRC, Slack, and Twitter, I am sure you will meet lovely people who want to help you succeed as a developer.  + +### Wrapping it up + +There is so much to love about Python, and now you know my favorite part is definitely the people. + +I have found kind, thoughtful Pythonistas in the community throughout the world, and the amount of community investment provide to those in need is incredibly encouraging. In addition to those I've met, the simple, clean, and powerful Python language gives any developer more than enough to master on their journey toward a career in software development or as a hobbyist enjoying playing around with a fun language. If you are interested in learning your first or a new language, consider Python and let me know how I can help. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/why-love-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/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) +[2]: https://opensource.com/article/19/8/command-line-heroes-perl +[3]: https://en.wikipedia.org/wiki/Bubble_sort +[4]: https://en.wikibooks.org/wiki/Algorithm_Implementation/Sorting/Bubble_sort#Java +[5]: https://en.wikipedia.org/wiki/Syntactic_sugar +[6]: https://docs.python.org/3/library/ +[7]: https://opensource.com/article/19/10/python-programming-paradigms +[8]: https://en.wikipedia.org/wiki/Fizz_buzz +[9]: https://pypi.org/project/pandas/ +[10]: https://pypi.org/project/Twisted/ +[11]: https://pypi.org/project/Django/ +[12]: https://pypi.org/project/paramiko/ +[13]: https://www.python.org/psf/conduct/ +[14]: https://us.pycon.org/2019/about/code-of-conduct/ +[15]: https://www.python.org/community/ From e7cc7cbe1cdced6d62cd95a2807fddd62654266c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 01:04:13 +0800 Subject: [PATCH 212/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191028=20SQLite?= =?UTF-8?q?=20is=20really=20easy=20to=20compile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191028 SQLite is really easy to compile.md --- ...191028 SQLite is really easy to compile.md | 116 ++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 sources/tech/20191028 SQLite is really easy to compile.md diff --git a/sources/tech/20191028 SQLite is really easy to compile.md b/sources/tech/20191028 SQLite is really easy to compile.md new file mode 100644 index 0000000000..6004299e2f --- /dev/null +++ b/sources/tech/20191028 SQLite is really easy to compile.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SQLite is really easy to compile) +[#]: via: (https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/) +[#]: author: (Julia Evans https://jvns.ca/) + +SQLite is really easy to compile +====== + +In the last week I’ve been working on another SQL website (, a list of SQL examples). I’m running all the queries on that site with sqlite, and I wanted to use window functions in one of the examples ([this one][1]). + +But I’m using the version of sqlite from Ubuntu 18.04, and that version is too old and doesn’t support window functions. So I needed to upgrade sqlite! + +This turned to out be surprisingly annoying (as usual), but in a pretty interesting way! I was reminded of some things about how executables and shared libraries work and it had a very satisfying conclusion. So I wanted to write it up here. + +(spoiler: the summary is that explains how to compile SQLite and it takes like 5 seconds to do and it’s 20x easier than my usual experiences compiling software from source) + +### attempt 1: download a SQLite binary from their website + +The [SQLite download page][2] has a link to a Linux binary for the SQLite command line tool. I downloaded it, it worked on my laptop, and I thought I was done. + +But then I tried to run it on a build server I was using (Netlify), and I got this extremely strange error message: “File not found”. I straced it, and sure enough `execve` was returning the error code ENOENT, which means “File not found”. This was kind of maddening because the file was DEFINITELY there and it had the correct permissions and everything. + +I googled this problem (by searching “execve enoent”), found [this stack overflow answer][3], which pointed out that to run a binary, you don’t just need the binary to exist! You also need its **loader** to exist. (the path to the loader is inside the binary) + +To see the path for the loader you can use `ldd`, like this: + +``` +$ ldd sqlite3 + linux-gate.so.1 (0xf7f9d000) + libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7f70000) + libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7e6e000) + libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf7e4f000) + libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7c73000) + /lib/ld-linux.so.2 +``` + +So `/lib/ld-linux.so.2` is the loader,and that file doesn’t exist on the build server, probably because that Xenial installation didn’t have support for 32-bit binaries (?), and I needed to try something different. + +### attempt 2: install the Debian sqlite3 package + +Okay, I thought, maybe I can install the [sqlite package from debian testing][4]. Trying to install a package from a different Debian version that I’m not using is literally never a good idea, but for some reason I decided to try it anyway. + +Doing this completely unsurprisingly broke the sqlite installation on my computer (which also broke git), but I managed to recover from that with a bunch of `sudo dpkg --purge --force-all libsqlite3-0` and make everything that depended on sqlite work again. + +### attempt 3: extract the Debian sqlite3 package + +I also briefly tried to just extract the sqlite3 binary from the Debian sqlite package and run it. Unsurprisingly, this also didn’t work, but in a more understandable way: I had an older version of libreadline (.so.7) and it wanted .so.8. + +``` +$ ./usr/bin/sqlite3 +./usr/bin/sqlite3: error while loading shared libraries: libreadline.so.8: cannot open shared object file: No such file or directory +``` + +### attempt 4: compile it from source + +The whole reason I spent all this time trying to download sqlite binaries is that I assumed it would be annoying or time consuming to compile sqlite from source. But obviously downloading random sqlite binaries was not working for me at all, so I finally decided to try to compile it myself. + +Here are the directions: [How to compile SQLite][5]. And they’re the EASIEST THING IN THE UNIVERSE. Often compiling things feels like this: + + * run `./configure` + * realize i’m missing a dependency + * run `./configure` again + * run `make` + * the compiler fails because actually i have the wrong version of some dependency + * go do something else and try to find a binary + + + +Compiling SQLite works like this: + + * download an [amalgamation tarball from the download page][2] + * run `gcc shell.c sqlite3.c -lpthread -ldl` + * that’s it!!! + + + +All the code is in one file (`sqlite.c`), and there are no weird dependencies! It’s amazing. + +For my specific use case I didn’t actually need threading support or readline support or anything, so I used the instructions on the compile page to create a very simple binary that only used libc and no other shared libraries. + +``` +$ ldd sqlite3 + linux-vdso.so.1 (0x00007ffe8e7e9000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbea4988000) + /lib64/ld-linux-x86-64.so.2 (0x00007fbea4d79000) +``` + +### this is nice because it makes it easy to experiment with sqlite + +I think it’s cool that SQLite’s build process is so simple because in the past I’ve had fun [editing sqlite’s source code][6] to understand how its btree implementation works. + +This isn’t really super surprising given what I know about SQLite (it’s made to work really well in restricted / embedded contexts, so it makes sense that it would be possible to compile it in a really simple/minimal way). But it is super nice! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/ + +作者:[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://sql-steps.wizardzines.com/lag.html +[2]: https://www.sqlite.org/download.html +[3]: https://stackoverflow.com/questions/5234088/execve-file-not-found-when-stracing-the-very-same-file +[4]: https://packages.debian.org/bullseye/amd64/sqlite3/download +[5]: https://www.sqlite.org/howtocompile.html +[6]: https://jvns.ca/blog/2014/10/02/how-does-sqlite-work-part-2-btrees/ From cbafe72b2a018aab842e9f91595584bf31c6b1a6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 01:05:01 +0800 Subject: [PATCH 213/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191030=20Viewin?= =?UTF-8?q?g=20network=20bandwidth=20usage=20with=20bmon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191030 Viewing network bandwidth usage with bmon.md --- ...ewing network bandwidth usage with bmon.md | 222 ++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 sources/tech/20191030 Viewing network bandwidth usage with bmon.md diff --git a/sources/tech/20191030 Viewing network bandwidth usage with bmon.md b/sources/tech/20191030 Viewing network bandwidth usage with bmon.md new file mode 100644 index 0000000000..d8d2b2e1c9 --- /dev/null +++ b/sources/tech/20191030 Viewing network bandwidth usage with bmon.md @@ -0,0 +1,222 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Viewing network bandwidth usage with bmon) +[#]: via: (https://www.networkworld.com/article/3447936/viewing-network-bandwidth-usage-with-bmon.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Viewing network bandwidth usage with bmon +====== +Introducing bmon, a monitoring and debugging tool that captures network statistics and makes them easily digestible. +Sandra Henry-Stocker + +Bmon is a monitoring and debugging tool that runs in a terminal window and captures network statistics, offering options on how and how much data will be displayed and displayed in a form that is easy to understand. + +To check if **bmon** is installed on your system, use the **which** command: + +``` +$ which bmon +/usr/bin/bmon +``` + +### Getting bmon + +On Debian systems, use **sudo apt-get install bmon** to install the tool. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +For Red Hat and related distributions, you might be able to install with **yum install bmon** or **sudo dnf install bmon**. Alternately, you may have to resort to a more complex install with commands like these that first set up the required **libconfuse** using the root account or sudo: + +``` +# wget https://github.com/martinh/libconfuse/releases/download/v3.2.2/confuse-3.2.2.zip +# unzip confuse-3.2.2.zip && cd confuse-3.2.2 +# sudo PATH=/usr/local/opt/gettext/bin:$PATH ./configure +# make +# make install +# git clone https://github.com/tgraf/bmon.git &&ammp; cd bmon +# ./autogen.sh +# ./configure +# make +# sudo make install +``` + +The first five lines will install **libconfuse** and the second five will grab and install **bmon** itself. + +### Using bmon + +The simplest way to start **bmon** is simply to type **bmon** on the command line. Depending on the size of the window you are using, you will be able to see and bring up a variety of data. + +The top portion of your display will display stats on your network interfaces – the loopback (lo) and network-accessible (e.g., eth0). If you terminal window has few lines, this is all you may see, and it will look something like this: + +[RELATED: 11 pointless but awesome Linux terminal tricks][2] + +``` +lo bmon 4.0 +Interfaces x RX bps pps %x TX bps pps % + >lo x 4B0 x0 0 0 4B 0 + qdisc none (noqueue) x 0 0 x 0 0 + enp0s25 x 244B0 x1 0 0 470B 2 + qdisc none (fq_codel) x 0 0 x 0 0 462B 2 +q Increase screen height to see graphical statistics qq + + +q Press d to enable detailed statistics qq +q Press i to enable additional information qq + Wed Oct 23 14:36:27 2019 Press ? for help +``` + +In this example, the network interface is enp0s25. Notice the helpful "Increase screen height" hint below the listed interfaces. Stretch your screen to add sufficient lines (no need to restart bmon) and you will see some graphs: + +``` +Interfaces x RX bps pps %x TX bps pps % + >lo x 0 0 x 0 0 + qdisc none (noqueue) x 0 0 x 0 0 + enp0s25 x 253B 3 x 2.65KiB 6 + qdisc none (fq_codel) x 0 0 x 2.62KiB 6 +qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq + (RX Bytes/second) + 0.00 ............................................................ + 0.00 ............................................................ + 0.00 ............................................................ + 0.00 ............................................................ + 0.00 ............................................................ + 0.00 ............................................................ + 1 5 10 15 20 25 30 35 40 45 50 55 60 + (TX Bytes/second) + 0.00 ............................................................ + 0.00 ............................................................ + 0.00 ............................................................ + 0.00 ............................................................ + 0.00 ............................................................ + 0.00 ............................................................ + 1 5 10 15 20 25 30 35 40 45 50 55 60 +``` + +Notice, however, that the graphs are not showing values. This is because it is displaying the loopback **>lo** interface. Arrow your way down to the public network interface and you will see some traffic. + +``` +Interfaces x RX bps pps %x TX bps pps % + lo x 0 0 x 0 0 + qdisc none (noqueue) x 0 0 x 0 0 + >enp0s25 x 151B 2 x 1.61KiB 3 + qdisc none (fq_codel) x 0 0 x 1.60KiB 3 +qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq + B (RX Bytes/second) + 635.00 ...............................|............................ + 529.17 .....|.........................|....|....................... + 423.33 .....|................|..|..|..|..|.|....................... + 317.50 .|..||.|..||.|..|..|..|..|..|..||.||||...................... + 211.67 .|..||.|..||.|..||||.||.|||.||||||||||...................... + 105.83 ||||||||||||||||||||||||||||||||||||||...................... + 1 5 10 15 20 25 30 35 40 45 50 55 60 + KiB (TX Bytes/second) + 4.59 .....................................|...................... + 3.83 .....................................|...................... + 3.06 ....................................||...................... + 2.30 ....................................||...................... + 1.53 |||..............|..|||.|...|.|||.||||...................... + 0.77 ||||||||||||||||||||||||||||||||||||||...................... + 1 5 10 15 20 25 30 35 40 45 50 55 60 + + +q Press d to enable detailed statistics qq +q Press i to enable additional information qq + Wed Oct 23 16:42:06 2019 Press ? for help +``` + +The change allows you to view a graph displaying network traffic. Note, however, that the default is to display bytes per second. To display bits per second instead, you would start the tool using **bmon -b** + +Detailed statistics on network traffic can be displayed if your window is large enough and you press **d**. An example of the stats you will see is displayed below. This display was split into left and right portions because of its width. + +##### left side: + +``` +RX TX │ RX TX │ + Bytes 11.26MiB 11.26MiB│ Packets 25.91K 25.91K │ + Collisions - 0 │ Compressed 0 0 │ + Errors 0 0 │ FIFO Error 0 0 │ + ICMPv6 2 2 │ ICMPv6 Checksu 0 - │ + Ip6 Broadcast 0 0 │ Ip6 Broadcast 0 0 │ + Ip6 Delivers 8 - │ Ip6 ECT(0) Pac 0 - │ + Ip6 Header Err 0 - │ Ip6 Multicast 0 152B │ + Ip6 Non-ECT Pa 8 - │ Ip6 Reasm/Frag 0 0 │ + Ip6 Reassembly 0 - │ Ip6 Too Big Er 0 - │ + Ip6Discards 0 0 │ Ip6Octets 530B 530B │ + Missed Error 0 - │ Multicast - 0 │ + Window Error - 0 │ │ +``` + +##### right side + +``` +│ RX TX │ RX TX +│ Abort Error - 0 │ Carrier Error - 0 +│ CRC Error 0 - │ Dropped 0 0 +│ Frame Error 0 - │ Heartbeat Erro - +│ ICMPv6 Errors 0 0 │ Ip6 Address Er 0 - +│ Ip6 CE Packets 0 - │ Ip6 Checksum E 0 - +│ Ip6 ECT(1) Pac 0 - │ Ip6 Forwarded - 0 +│ Ip6 Multicast 0 2 │ Ip6 No Route 0 0 +│ Ip6 Reasm/Frag 0 0 │ Ip6 Reasm/Frag 0 0 +│ Ip6 Truncated 0 - │ Ip6 Unknown Pr 0 - +│ Ip6Pkts 8 8 │ Length Error 0 +│ No Handler 0 - │ Over Error 0 - +``` + +Additional information on the network interface will be displayed if you press **i** + +##### left side: + +``` +MTU 1500 | Flags broadcast,multicast,up | +Address 00:1d:09:77:9d:08 | Broadcast ff:ff:ff:ff:ff:ff | +Family unspec | Alias | +``` + +##### right side: + +``` +| Operstate up | IfIndex 2 | +| Mode default | TXQlen 1000 | +| Qdisc fq_codel | +``` + +A help menu will appear if you press **?** with brief descriptions of how to move around the screen, select data to be displayed and control the graphs. + +To quit **bmon**, you would type **q** and then **y** in response to the prompt to confirm your choice to exit. + +Some of the important things to note are that: + + * **bmon** adjusts its display to the size of the terminal window + * some of the choices shown at the bottom of the display will only function if the window is large enough to accomodate the data + * the display is updated every second unless you slow this down using the **-R** (e.g., **bmon -R 5)** option + + + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447936/viewing-network-bandwidth-usage-with-bmon.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/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.networkworld.com/article/2926630/linux/11-pointless-but-awesome-linux-terminal-tricks.html#tk.nww-fsb +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From be553400ae3ab74318ce24bc22799da9a4a7bcdd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 01:07:05 +0800 Subject: [PATCH 214/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191029=20How=20?= =?UTF-8?q?SD-WAN=20is=20evolving=20into=20Secure=20Access=20Service=20Edg?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191029 How SD-WAN is evolving into Secure Access Service Edge.md --- ...volving into Secure Access Service Edge.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/talk/20191029 How SD-WAN is evolving into Secure Access Service Edge.md diff --git a/sources/talk/20191029 How SD-WAN is evolving into Secure Access Service Edge.md b/sources/talk/20191029 How SD-WAN is evolving into Secure Access Service Edge.md new file mode 100644 index 0000000000..bc841758be --- /dev/null +++ b/sources/talk/20191029 How SD-WAN is evolving into Secure Access Service Edge.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How SD-WAN is evolving into Secure Access Service Edge) +[#]: via: (https://www.networkworld.com/article/3449136/how-sd-wan-is-evolving-into-secure-access-service-edge.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +How SD-WAN is evolving into Secure Access Service Edge +====== +SASE, pronounced 'sassy,' combines elements of SD-WAN and network security into a single cloud-based service. +Anya Berkut / Getty Images + +SASE, pronounced "sassy," stands for secure access service edge, and it's being positioned by Gartner as the next big thing in enterprise networking. The technology category, which Gartner and other network experts first introduced earlier this year, converges the WAN edge and network security into a cloud-based, as-a-service delivery model. [According to Gartner][1], the convergence is driven by customer demands for simplicity, scalability, flexibility, low latency, and pervasive security. + +### SASE brings together security and networking + +A SASE implementation requires a comprehensive technology portfolio that only a few vendors can currently deliver. The technology is still in its infancy, with less than 1% adoption. There are a handful of existing [SD-WAN][2] providers, including Cato Networks, Juniper, Fortinet and Versa, that are expected to compete in the emerging SASE market. There will be other SD-WAN vendors jumping on this wagon, and the industry is likely to see another wave of startups.  + +**READ MORE:** [Gartner's top 10 strategic technology trends for 2020][3] + +When networking and security devices are procured from different vendors, as is typical, the result is a complex network architecture that relies on the data center as the hub for enterprise applications. But with growing digital business and edge computing requirements, organizations are no longer primarily accessing their apps and services from within the data center. This approach is ineffective for organizations that are shifting to cloud services. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +### Existing network and security models to become obsolete? Not so fast + +An architectural transformation of the traditional data center-centric networking and security is underway to better meet the needs of today’s mobile workforces. Gartner predicts that the adoption of SASE will take place over the next five to 10 years, rendering existing network and security models obsolete. + +In my opinion, the term "obsolete" is a bit aggressive, but I do agree there is a need to bring networking and security together. Having them be procured and managed by separate teams is inefficient and leads to inconsistencies and blind spots. SD-WANs enable a number of new design principals, such as direct to cloud or user access, and necessitate the need for a new architecture – enter SASE. + +SASE combines elements of SD-WAN and network security into a single cloud-based service. It supports all types of edges, including WAN, mobile, cloud, and edge computing. So, instead of connecting a branch to the central office, it connects individual users and devices to a centralized cloud-based service. With this model, the endpoint is the individual user, device, or application, not the data center. + +### Cloud delivery benefits + +The cloud delivery-based approach benefits providers with many points of presence. Gartner highlighted a number of advantages of this approach, such as: + + * There are limited endpoint functions like routing and path selection, with the rest delivered as a service from the cloud. + * Due to the thinner stack, functions can be provided via software without requiring dedicated hardware. + * New endpoints such as pop-up stores can be added quickly. + * Since SASE favors cloud-based delivery, vendors can add new services to the stack faster. + * Common policies are shared by branch offices and individual devices. The policies are also more consistent and can be managed through a cloud-based console from one vendor. + * The overall infrastructure is simpler and less expensive for an organization to manage. + * Emerging latency-sensitive apps, such as the IoT edge to edge, can be supported even if the endpoints have minimal local resources. + * Malware, decryption, and management is performed within SASE, and organizations can scale up or down based on their needs. + + + +### Agility is the biggest benefit SASE brings + +These advantages are all true, but Gartner missed the biggest advantage, and that’s increased agility to accelerate business velocity. SASE makes security intrinsic in the network and, if architected correctly, organizations should not have to hold up the rollout of new apps and services while the security implications are being figured out. Instead, with security being "baked in," companies can be as aggressive as they want and know the environment is secure. Speed is the new currency of business, and SASE lets companies move faster.  + +### SASE is identify driven instead of location driven + +In addition to being cloud native, SASE is identity driven instead of location driven. An identity is attached to every person, application, service, or device within an organization. The convergence of networking and security allows an identity to follow a person or device wherever they need access and makes the experience seamless for the user. + +Think of this scenario: An employee working remotely on an unmanaged laptop needs to connect to Salesforce, which is hosted on its own cloud. Traditionally, an administrator would go through many steps to authenticate a user and connect them to a virtual private network (VPN). But with a single identity, a remote employee could access Salesforce or any other app seamlessly, regardless of their device, location, or network. + +SASE addresses new security demands networks face from a variety of sources. The core capabilities of SASE include multifactor authentication and access to applications and services controlled by firewall policies. Therefore, users can only access authorized applications without entering the general network. SASE can also detect sensitive data and stop it from leaving the network by applying specific data loss prevention rules. + +In the [report][1], Gartner does caution that some vendors will attempt to satisfy customers by combining separate products together or by acquiring appliance-based point products that are then hosted in the cloud, which is likely to result in higher latency and poor performance. This shouldn’t be a surprise as this is how legacy vendors have attacked new markets in the past. Industry people often refer to this as “sheet metal” integration, where a vendor essentially tosses a number of capabilities into a single appliance and makes it looks integrated – but it’s not. Buyers need to ensure the vendor is delivering an integrated, cloud-native set of services to be delivered on demand. Organizations can begin transitioning to SASE with a WAN makeover and by gradually retiring their legacy network security appliance. + +(Gartner defines and discusses demand for SASE in its 2019 [Hype Cycle for Enterprise Networking][1]; this post by [Cato][5] effectively summarizes SASE without having to read the entire Gartner report.) + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3449136/how-sd-wan-is-evolving-into-secure-access-service-edge.html + +作者:[Zeus Kerravala][a] +选题:[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/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.gartner.com/doc/3947237 +[2]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[3]: https://www.networkworld.com/article/3447401/gartner-top-10-strategic-technology-trends-for-2020.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.catonetworks.com/blog/the-secure-access-service-edge-sase-as-described-in-gartners-hype-cycle-for-enterprise-networking-2019/ +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 840993e25134cda952efd2c03d11332274966e24 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 30 Oct 2019 01:09:06 +0800 Subject: [PATCH 215/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191023=20MPLS?= =?UTF-8?q?=20Migration:=20How=20a=20KISS=20Transformed=20the=20WANs=20of?= =?UTF-8?q?=204=20IT=20Managers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191023 MPLS Migration- How a KISS Transformed the WANs of 4 IT Managers.md --- ...S Transformed the WANs of 4 IT Managers.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/talk/20191023 MPLS Migration- How a KISS Transformed the WANs of 4 IT Managers.md diff --git a/sources/talk/20191023 MPLS Migration- How a KISS Transformed the WANs of 4 IT Managers.md b/sources/talk/20191023 MPLS Migration- How a KISS Transformed the WANs of 4 IT Managers.md new file mode 100644 index 0000000000..3e6ebc8f61 --- /dev/null +++ b/sources/talk/20191023 MPLS Migration- How a KISS Transformed the WANs of 4 IT Managers.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (MPLS Migration: How a KISS Transformed the WANs of 4 IT Managers) +[#]: via: (https://www.networkworld.com/article/3447383/mpls-migration-how-a-kiss-transformed-the-wans-of-4-it-managers.html) +[#]: author: (Cato Networks https://www.networkworld.com/author/Matt-Conran/) + +MPLS Migration: How a KISS Transformed the WANs of 4 IT Managers +====== +WAN transformation is challenging; learning from the experiences of others can help. Here are practical insights from four IT managers who migrated to SD-WAN. +flytosky11 + +Back in 1960, a Lockheed engineer named Kelly Johnson coined the acronym KISS for “keep it simple stupid.” His wise—and simple—advice was that systems tend to work better when they’re simple than when they’re complex. KISS became an essential U.S. Navy design principle and captures the crux of any WAN transformation initiative. + +So many of the challenges of today’s WANs stem from the sheer number of components involved. Each location may require one or more routers, firewalls, WAN optimizers, VPN concentrators, and other devices just to connect safely and effectively with other locations or the cloud. The result: multiple points of failure and a potential uptime and troubleshooting nightmare. Simply understanding the state of the WAN can be difficult with information spread across so many devices and components. Managing all the updates required to protect the network from new and evolving threats can be overwhelming. + +Simplifying the enterprise backbone addresses those challenges. According to four IT managers, the key is to create a single global enterprise backbone that connects all users–mobile or fixed–and all locations–cloud or physical. The backbone’s software should include a complete security stack and WAN optimization to protect and enhance the performance of all “edges” everywhere. Such an approach avoids the complexity that comes with all the appliances and other solutions forming today enterprise networks. + +The four IT managers did not use every aspect of this approach. Some focused on the global performance benefits and cost savings, others on security. But they all gained from the agility and visibility that result. Here are their stories. + +**Pharmaceutical Firm Improves China Connectivity, Reduced Costs by Eliminating MPLS** + +For [Centrient Pharmaceuticals][1], [SD-WAN][2] looked at first as if it might be just as complex as the company’s tangled Web of global MPLS and Internet VPNs. A global leader in sustainable antibiotics, next-generation statins, and antifungals, Centrient had relied on MPLS to connect its Netherlands data center with nine manufacturing and office locations across China, India, Netherlands, Spain, and Mexico. SAP, VoIP, and other Internet applications had to be backhauled through the data center. Local Internet breakouts secured by firewall hardware provided access to the public Internet, Office 365, and some other SaaS applications. Five smaller global locations had to connect via VPN to India or the Netherlands office. + +Over time, MPLS became congested and performance suffered. “It took a long time for users to open documents,” said Mattheiu Cijsouw, Global IT Manager. + +Agility suffered as well, as it typically took three to four months to move a location. “One time we needed to move a sales office and the MPLS connection was simply not ready in time,” Cijsouw said. + +Cijsouw looked toward SD-WAN to simplify connectivity and cut costs but found that the typical solution of SD-WAN appliances at every location secured by firewalls and Secure Web Gateway (SWGs) was also complex, expensive, and dependent on the fickleness of the Internet middle mile. For him, the simplicity of a global, distributed, SLA-backed network of PoPS interconnected by an enterprise backbone seemed appealing. All it required was a simple, zero-touch appliance at each location to connect to the local PoP. + +Cijsouw went with simple. “We migrated in stages, gaining confidence along the way,” he said. + +The 6 Mbits/s of MPLS was replaced by 20 Mbits/s per site, burstable to 40 Mbits/s, and 50 Mbits/s burstable to 100 Mbits/s at the data center, all at lower cost than MPLS.  Immediately applications became more responsive, China connectivity worked as well or better than with MPLS, and the cloud-based SD-WAN solution gave Cijsouw better visibility into the network. + +**Paysafe Achieves Fast Application Access at Every Location** + +Similarly, [Paysafe, a global provider of end-to-end payment solutions][3], had been connecting its 21 globally dispersed locations with a combination of MPLS and local Internet access at six locations and VPNs at the other 15. Depending on where staff members were, Internet connectivity could range from 25 Mbits/s to 500 Mbits/sec. + +“We wanted the same access everywhere,” said Stuart Gall, then PaySafe’s Infrastructure Architect in its Network and Systems Groups. “If I’m in Calgary and go to any other office, the access must be the same—no need to RDP into a machine or VPN into the network.” + +The lack of a fully meshed network also made Active Directory operation erratic, with users sometimes locked out of some accounts at one location but not another. Rolling out new locations took two to three months. + +As with Centrient, a cloud-based SD-WAN solution using global PoPS and an enterprise backbone seemed a much simpler, less expensive, and more secure approach than the typical SD-WAN services offered by competing providers. + +Paysafe has connected 11 sites to its enterprise backbone. “We found latency to be 45 percent less than with the public Internet,” said Gall. “New site deployment takes 30 minutes instead of weeks. Full meshing problems are no longer, as all locations instantly mesh once they connect.” + +**Sanne Group Cleans Up WAN and Reduces Latency in the Process** + +[Sanne Group, a global provider of alternative asset and corporate administrative services][4], had two data centers in Jersey and Guernsey UK connected by two 1Gbits/s fiber links, with seven locations connecting to the data centers via the public Internet. A Malta office connected via an IPsec VPN to Cape Town, which connected to Jersey via MPLS. A business continuity site in HIlgrove and two other UK locations connected to the data centers via dedicated fiber. Access for small office users consisted of a combination of Internet broadband, a small firewall appliance, and Citrix VDI. + +Printing PDFs took forever, according to Nathan Trevor, Sanne Group’s IT Director, and the remote desktop architectures suffered from high latency and packet loss. Traffic from the Hong Kong office took 12 to 15 hops to get to the UK. + +The company tried MPLS but found it too expensive. Deploying a site took up to 120 days. Trevor started looking at SD-WAN, but it was also complex. + +“Even with zero-touch provisioning configuration was complicated,” he said. “IT professionals new to SD-WAN would definitely need handholding.” + +The simplicity of the cloud-based global enterprise backbone solution was obvious. “Just looking at an early screen share I could understand how to connect my sites,” said Trevor. + +Sanne connected its locations big and small to the enterprise backbone, eliminating the mess of Internet and MPLS connections. Performance improved immediately, with latency down by 20 percent. All users have to do to connect is log into their computers, and the solution has saved Sanne “an absolute fortune,” according to Trevor. + +**Humphrey’s Eliminates MPLS and Embraces Freedom Easily** + +As for [Humphrey’s and Partners, an architectural services firm][5], eight regional offices connected to its Dallas headquarters via a hybrid WAN and a ninth connected over the Internet. Three offices ran SD-WAN appliances connected to MPLS and the Internet. Another three connected via MPLS only. Two connected with SD-WAN and the Internet, and an office in Vietnam had to rely on file sharing and transfer to move data across the Internet to Dallas. + +With MPLS, Humphrey’s needed three months to deploy at a new site. Even simple network changes took 24 hours, frequently requiring off-hours work. “Often the process involved waking me up in the middle of the night,” said IT Director Paul Burns. + +Burns had tried deploying SD-WAN appliances in some locations, but “the configuration pages of the SD-WAN appliance were insane,” said Burns, and it was sometimes difficult to get WAN connections working properly. “Sometimes Dallas could connect to two sites, but they couldn’t connect to each other,” he said. + +Burns deployed a global enterprise backbone solution at most locations, including Vietnam. Getting sites up and running took minutes or hours. “We dropped shipped devices to New Orleans, and I flew out to install the stuff. Took less than a day and the performance was great,” said Burns. “We set up Uruguay in less than 10 minutes. [The solution] gave us freedom.” + +MPLS and VPNs can be very complex, but so can an SD-WAN replacement if it’s not architected carefully. For many organizations, a simpler approach is to connect and secure all users and locations with a global private backbone and software providing WAN optimization and a complete security stack. Such an approach fulfills the goals of KISS: performance, agility, and low cost. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3447383/mpls-migration-how-a-kiss-transformed-the-wans-of-4-it-managers.html + +作者:[Cato Networks][a] +选题:[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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.catonetworks.com/customers/pharmaceutical-leader-replaces-mpls-with-cato-cloud-cutting-costs-while-quadrupling-capacity?utm_source=idg +[2]: https://www.catonetworks.com/sd-wan?utm_source=idg +[3]: https://www.catonetworks.com/customers/paysafe-replaces-global-mpls-network-and-internet-vpn-with-cato-cloud?utm_source=idg +[4]: https://www.catonetworks.com/customers/sanne-group-replaces-internet-and-mpls-simplifying-citrix-access-and-improving-performance-with-cato-cloud?utm_source=idg +[5]: https://www.catonetworks.com/customers/humphreys-replaces-mpls-sd-wan-appliances-and-mobile-vpn-with-cato-cloud?utm_source=idg From ba32b5a0f52faa8aaefed13795f8849d7aea8deb Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Oct 2019 07:02:26 +0800 Subject: [PATCH 216/800] translating --- ...w to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md b/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md index d959b30d0c..718f41ebc9 100644 --- a/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md +++ b/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d4409e829d068e6b7f620ee9dec34cd2597b6054 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 30 Oct 2019 09:08:27 +0800 Subject: [PATCH 217/800] PRF --- ...ner images with the ansible-bender tool.md | 44 +++++++++---------- 1 file changed, 20 insertions(+), 24 deletions(-) rename {translated/tech => published}/20191023 Building container images with the ansible-bender tool.md (71%) diff --git a/translated/tech/20191023 Building container images with the ansible-bender tool.md b/published/20191023 Building container images with the ansible-bender tool.md similarity index 71% rename from translated/tech/20191023 Building container images with the ansible-bender tool.md rename to published/20191023 Building container images with the ansible-bender tool.md index a085b51c5f..da85e3c796 100644 --- a/translated/tech/20191023 Building container images with the ansible-bender tool.md +++ b/published/20191023 Building container images with the ansible-bender tool.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Building container images with the ansible-bender tool) @@ -9,18 +9,19 @@ 使用 ansible-bender 构建容器镜像 ====== -了解如何使用 Ansible 在容器中执行命令。 -![Blocks for building][1] -容器和 [Ansible][2] 很好地融合在一起-从管理和编排到供应和构建。在本文中,我们将重点介绍构建部分。 +> 了解如何使用 Ansible 在容器中执行命令。 -如果你熟悉 Ansible,就会知道你可以编写一系列任务,**ansible-playbook** 命令将为你执行这些任务。你知道吗,你还可以在容器环境中执行此类命令,并获得与编写 Dockerfile 并运行 **podman build** 相同​​的结果。 +![](https://img.linux.net.cn/data/attachment/album/201910/30/090738vzbifzfpa6qz9bij.jpg) + +容器和 [Ansible][2] 可以很好地融合在一起:从管理和编排到供应和构建。在本文中,我们将重点介绍构建部分。 + +如果你熟悉 Ansible,就会知道你可以编写一系列任务,`ansible-playbook` 命令将为你执行这些任务。你知道吗,如果你编写 Dockerfile 并运行 `podman build`,你还可以在容器环境中执行此类命令,并获得相同​​的结果。 这是一个例子: - ``` -\- name: Serve our file using httpd +- name: Serve our file using httpd hosts: all tasks: - name: Install httpd @@ -33,24 +34,22 @@ dest: /var/www/html/ ``` -你可以在 Web 服务器上或容器中本地执行这个 playbook,并且只要你记得先创建 **our-file.txt**,它就可以工作。 +你可以在 Web 服务器本地或容器中执行这个剧本,并且只要你记得先创建 `our-file.txt`,它就可以工作。 -但是缺少了一些东西。你需要启动(并配置)httpd 以便提供文件。这是容器构建和基础架构供应之间的区别:构建镜像时,你只需准备内容;运行容器是另一项任务。另一方面,你可以将元数据附加到容器镜像,它会默认运行命令。 - -这有个工具可以帮助。试试看 **ansible-bender** 怎么样? +但是这里缺少了一些东西。你需要启动(并配置)httpd 以便提供文件。这是容器构建和基础架构供应之间的区别:构建镜像时,你只需准备内容;而运行容器是另一项任务。另一方面,你可以将元数据附加到容器镜像,它会默认运行命令。 +这有个工具可以帮助。试试看 `ansible-bender` 怎么样? ``` -`$ ansible-bender build the-playbook.yaml fedora:30 our-httpd` +$ ansible-bender build the-playbook.yaml fedora:30 our-httpd ``` -该脚本使用 ansible-bender 对 Fedora 30 容器镜像执行 playbook,并将生成的容器镜像命名为 “our-httpd”。 - -但是,当你运行该容器时,它不会启动 httpd,因为它不知道如何操作。你可以通过向 playbook 添加一些元数据来解决此问题: +该脚本使用 `ansible-bender` 对 Fedora 30 容器镜像执行该剧本,并将生成的容器镜像命名为 `our-httpd`。 +但是,当你运行该容器时,它不会启动 httpd,因为它不知道如何操作。你可以通过向该剧本添加一些元数据来解决此问题: ``` -\- name: Serve our file using httpd +- name: Serve our file using httpd hosts: all vars: ansible_bender: @@ -74,8 +73,7 @@ dest: /var/www/html ``` -现在你可以构建镜像(从这里开始,请以 root 用户身份运行所有命令。目前,Buildah 和 Podman 不会为无根容器创建专用网络): - +现在你可以构建镜像(从这里开始,请以 root 用户身份运行所有命令。目前,Buildah 和 Podman 不会为无 root 容器创建专用网络): ``` # ansible-bender build the-playbook.yaml @@ -117,7 +115,6 @@ AH00558: httpd: Could not reliably determine the server's fully qualified domain 是否提供文件了?首先,找出你容器的 IP: - ``` # podman inspect -f '{{ .NetworkSettings.IPAddress }}' 7418570ba5a0 10.88.2.106 @@ -125,15 +122,14 @@ AH00558: httpd: Could not reliably determine the server's fully qualified domain 你现在可以检查了: - ``` -$ curl +$ curl http://10.88.2.106/our-file.txt Ansible is ❤ ``` 你文件内容是什么? -这只是使用 Ansible 构建容器镜像的介绍。如果你想了解有关 ansible-bender 可以做什么的更多信息,请查看它的 [GitHub][3] 页面。构建快乐! +这只是使用 Ansible 构建容器镜像的介绍。如果你想了解有关 `ansible-bender` 可以做什么的更多信息,请查看它的 [GitHub][3] 页面。构建快乐! -------------------------------------------------------------------------------- @@ -142,7 +138,7 @@ via: https://opensource.com/article/19/10/building-container-images-ansible 作者:[Tomas Tomecek][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/) 荣誉推出 @@ -150,4 +146,4 @@ via: https://opensource.com/article/19/10/building-container-images-ansible [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/blocks_building.png?itok=eMOT-ire (Blocks for building) [2]: https://www.ansible.com/ -[3]: https://github.com/ansible-community/ansible-bender \ No newline at end of file +[3]: https://github.com/ansible-community/ansible-bender From 6e769c0a8698685dc1414b2cab88a6b2059663f7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 30 Oct 2019 09:09:05 +0800 Subject: [PATCH 218/800] PUB @geekpi https://linux.cn/article-11518-1.html --- ... Building container images with the ansible-bender tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20191023 Building container images with the ansible-bender tool.md b/published/20191023 Building container images with the ansible-bender tool.md index da85e3c796..b4cd0fce3c 100644 --- a/published/20191023 Building container images with the ansible-bender tool.md +++ b/published/20191023 Building container images with the ansible-bender tool.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11518-1.html) [#]: subject: (Building container images with the ansible-bender tool) [#]: via: (https://opensource.com/article/19/10/building-container-images-ansible) [#]: author: (Tomas Tomecek https://opensource.com/users/tomastomecek) From 1e66422cb92af49a4ce91fafcb8cc5c493cb7077 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Oct 2019 09:22:08 +0800 Subject: [PATCH 219/800] Rename sources/tech/20191029 5 reasons why I love Python.md to sources/talk/20191029 5 reasons why I love Python.md --- sources/{tech => talk}/20191029 5 reasons why I love Python.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191029 5 reasons why I love Python.md (100%) diff --git a/sources/tech/20191029 5 reasons why I love Python.md b/sources/talk/20191029 5 reasons why I love Python.md similarity index 100% rename from sources/tech/20191029 5 reasons why I love Python.md rename to sources/talk/20191029 5 reasons why I love Python.md From 8f3a57e21a8324c46958b18c41d0fb624cca7cc9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Oct 2019 09:46:00 +0800 Subject: [PATCH 220/800] Rename sources/tech/20191029 The best (and worst) ways to influence your open community.md to sources/talk/20191029 The best (and worst) ways to influence your open community.md --- ... The best (and worst) ways to influence your open community.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191029 The best (and worst) ways to influence your open community.md (100%) diff --git a/sources/tech/20191029 The best (and worst) ways to influence your open community.md b/sources/talk/20191029 The best (and worst) ways to influence your open community.md similarity index 100% rename from sources/tech/20191029 The best (and worst) ways to influence your open community.md rename to sources/talk/20191029 The best (and worst) ways to influence your open community.md From 1fbf6f091874df8c9456b432aa5c88d578132af2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 30 Oct 2019 10:47:55 +0800 Subject: [PATCH 221/800] Rename sources/tech/20191029 Fedora 31 is officially here.md to sources/news/20191029 Fedora 31 is officially here.md --- sources/{tech => news}/20191029 Fedora 31 is officially here.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191029 Fedora 31 is officially here.md (100%) diff --git a/sources/tech/20191029 Fedora 31 is officially here.md b/sources/news/20191029 Fedora 31 is officially here.md similarity index 100% rename from sources/tech/20191029 Fedora 31 is officially here.md rename to sources/news/20191029 Fedora 31 is officially here.md From 142b50eb22d2b0773e141999b0313223ca9522fb Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 30 Oct 2019 13:37:07 +0800 Subject: [PATCH 222/800] translating --- ...rojects to try in COPR for October 2019.md | 93 ------------------ ...rojects to try in COPR for October 2019.md | 94 +++++++++++++++++++ 2 files changed, 94 insertions(+), 93 deletions(-) delete mode 100644 sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md create mode 100644 translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md diff --git a/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md b/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md deleted file mode 100644 index 196d4f40ea..0000000000 --- a/sources/tech/20191025 4 cool new projects to try in COPR for October 2019.md +++ /dev/null @@ -1,93 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 cool new projects to try in COPR for October 2019) -[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/) -[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) - -4 cool new projects to try in COPR for October 2019 -====== - -![][1] - -[COPR][2] is a collection 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. - -### Nu - -[Nu][4], or Nushell, is a shell inspired by PowerShell and modern CLI tools. Using a structured data based approach, Nu makes it easy to work with commands that output data, piping through other commands. The results are then displayed in tables that can be sorted or filtered easily and may serve as inputs for further commands. Finally, Nu provides several builtin commands, multiple shells and support for plugins. - -#### Installation instructions - -The [repo][5] currently provides Nu for Fedora 30, 31 and Rawhide. To install Nu, use these commands: - -``` -sudo dnf copr enable atim/nushell -sudo dnf install nushell -``` - -### NoteKit - -[NoteKit][6] is a program for note-taking. It supports Markdown for formatting notes, and the ability to create hand-drawn notes using mouse. In NoteKit, notes are sorted and organized in a tree structure. - -#### Installation instructions - -The [repo][7] currently provides NoteKit for Fedora 29, 30, 31 and Rawhide. To install NoteKit, use these commands: - -``` -sudo dnf copr enable lyessaadi/notekit -sudo dnf install notekit -``` - -### Crow Translate - -[Crow Translate][8] is a program for translating. It can translate text as well as speak both the input and result, and offers a command line interface as well. For translation, Crow Translate uses Google, Yandex or Bing translate API. - -#### Installation instructions - -The [repo][9] currently provides Crow Translate for Fedora 30, 31 and Rawhide, and for Epel 8. To install Crow Translate, use these commands: - -``` -sudo dnf copr enable faezebax/crow-translate -sudo dnf install crow-translate -``` - -### dnsmeter - -[dnsmeter][10] is a command-line tool for testing performance of a nameserver and its infrastructure. For this, it sends DNS queries and counts the replies, measuring various statistics. Among other features, dnsmeter can use different load steps, use payload from PCAP files and spoof sender addresses. - -#### Installation instructions - -The repo currently provides dnsmeter for Fedora 29, 30, 31 and Rawhide, and EPEL 7. To install dnsmeter, use these commands: - -``` -sudo dnf copr enable @dnsoarc/dnsmeter -sudo dnf install dnsmeter -``` - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/ - -作者:[Dominik Turecek][a] -选题:[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/dturecek/ -[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/nushell/nushell -[5]: https://copr.fedorainfracloud.org/coprs/atim/nushell/ -[6]: https://github.com/blackhole89/notekit -[7]: https://copr.fedorainfracloud.org/coprs/lyessaadi/notekit/ -[8]: https://github.com/crow-translate/crow-translate -[9]: https://copr.fedorainfracloud.org/coprs/faezebax/crow-translate/ -[10]: https://github.com/DNS-OARC/dnsmeter diff --git a/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md b/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md new file mode 100644 index 0000000000..24cdca0fb8 --- /dev/null +++ b/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 cool new projects to try in COPR for October 2019) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/) +[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) + +COPR 仓库中 4 个很酷的新项目(2019.10) +====== + +![][1] + +COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 + +本文介绍了 COPR 中一些有趣的新项目。如果你第一次使用 COPR,请参阅 [COPR 用户文档][3]。 + +### Nu + +[Nu][4] 或称为 Nushell 是受 PowerShell 和现代 CLI 工具启发的 shell。通过使用基于结构化数据的方法,Nu 可轻松处理命令的输出,并通过管道传输其他命令。然后将结果显示在可以轻松排序或过滤的表中,并可以用作其他命令的输入。最后,Nu 提供了几个内置命令、多 shell 和对插件的支持。 + + +#### 安装说明 + +该[仓库][5]目前为 Fedora 30、31 和 Rawhide 提供 Nu。要安装 Nu,请使用以下命令: + +``` +sudo dnf copr enable atim/nushell +sudo dnf install nushell +``` + +### NoteKit + +[NoteKit][6] 是一个笔记程序。它支持 Markdown 来格式化笔记,并支持使用鼠标创建手绘笔记的功能。在 NoteKit 中,笔记以树状结构进行排序和组织。 + +#### 安装说明 + +该[仓库][7]目前为 Fedora 29、30、31 和 Rawhide 提供 NoteKit。要安装 NoteKit,请使用以下命令: + +``` +sudo dnf copr enable lyessaadi/notekit +sudo dnf install notekit +``` + +### Crow Translate + +[Crow Translate][8] 是一个翻译程序。它可以翻译文本并且可以对输入和结果发音,它还提供命令行界面。对于翻译,Crow Translate 使用 Google、Yandex 或 Bing 的翻译 API。 + +#### 安装说明 + +该[仓库][9]目前为 Fedora 30、31 和 Rawhide 以及 Epel 8 提供 Crow Translate。要安装 Crow Translate,请使用以下命令: + +``` +sudo dnf copr enable faezebax/crow-translate +sudo dnf install crow-translate +``` + +### dnsmeter + +[dnsmeter][10] 是用于测试域名服务器及其基础设施性能的命令行工具。为此,它发送 DNS 查询并计算答复数,从而测量各种统计数据。除此之外,dnsmeter 可以使用不同的加载步骤,使用 PCAP 文件中的 payload 和欺骗发送者地址。 + +#### 安装说明 + +该仓库目前为 Fedora 29、30、31、Rawhide 以及 Epel 7 提供 dnsmeter。要安装 dnsmeter,请使用以下命令: + +``` +sudo dnf copr enable @dnsoarc/dnsmeter +sudo dnf install dnsmeter +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/ + +作者:[Dominik Turecek][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/dturecek/ +[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/nushell/nushell +[5]: https://copr.fedorainfracloud.org/coprs/atim/nushell/ +[6]: https://github.com/blackhole89/notekit +[7]: https://copr.fedorainfracloud.org/coprs/lyessaadi/notekit/ +[8]: https://github.com/crow-translate/crow-translate +[9]: https://copr.fedorainfracloud.org/coprs/faezebax/crow-translate/ +[10]: https://github.com/DNS-OARC/dnsmeter \ No newline at end of file From bd757170624fd236159fa6a4564088c0f72ef487 Mon Sep 17 00:00:00 2001 From: libo <1594914459@qq.com> Date: Wed, 30 Oct 2019 20:02:17 +0800 Subject: [PATCH 223/800] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ans, infrastructure predictions, and more industry trends.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md index e915fe74d9..f1d2b48d0d 100644 --- a/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md +++ b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (warmfrog) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c38e84650493ecf7eed3a9615175bdd7857fe3bc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 30 Oct 2019 23:25:24 +0800 Subject: [PATCH 224/800] PRF @geekpi --- ...riented Programming and Essential State.md | 45 +++++++++---------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/translated/tech/20191013 Object-Oriented Programming and Essential State.md b/translated/tech/20191013 Object-Oriented Programming and Essential State.md index caacee3372..625c6237e9 100644 --- a/translated/tech/20191013 Object-Oriented Programming and Essential State.md +++ b/translated/tech/20191013 Object-Oriented Programming and Essential State.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Object-Oriented Programming and Essential State) @@ -10,42 +10,41 @@ 面向对象编程和根本状态 ====== -早在 2015 年,Brian Will 撰写了一篇有挑衅性的博客:[面向对象编程:一个灾难故事][1]。他随后发布了一个名为[面向对象编程很糟糕][2]的视频,该视频更加详细。我建议你花些时间观看视频,但这是我的一小段摘要: +![](https://img.linux.net.cn/data/attachment/album/201910/30/232452kvdivhgb9b2yi0ug.jpg) -OOP 的柏拉图式理想是一堆相互解耦的对象,它们彼此之间发送无状态消息。没有人真的像这样制作软件,Brian 指出这甚至没有意义:对象需要知道向哪个对象发送消息,这意味着它们需要相互引用。视频大部分讲述的是人们试图将对象耦合以实现控制流,同时假装它们是通过设计解耦的。 +早在 2015 年,Brian Will 撰写了一篇有挑衅性的博客:[面向对象编程:一个灾难故事][1]。他随后发布了一个名为[面向对象编程很糟糕][2]的视频,该视频更加详细。我建议你花些时间观看视频,下面是我的一段总结: -总的来说,他的想法与我自己的 OOP 经验产生了共鸣:对象没有问题,但是我从来没有对_面向_对象建立程序控制流满意,而试图使代码“正确地”面向对象似乎总是在创建不必要的复杂性。 +> OOP 的柏拉图式理想是一堆相互解耦的对象,它们彼此之间发送无状态消息。没有人真的像这样制作软件,Brian 指出这甚至没有意义:对象需要知道向哪个对象发送消息,这意味着它们需要相互引用。该视频大部分讲述的是这样一个痛点:人们试图将对象耦合以实现控制流,同时假装它们是通过设计解耦的。 -我认为他无法完全解释一件事。他直截了当地说“封装没有作用”,但在脚注后面加上“在细粒度的代码级别”,并继续承认对象有时可以奏效,并且在库和文件级别可以封装。但是他没有确切解释为什么有时会奏效,有时却没有奏效,以及如何/在何处划清界限。有人可能会说这使他的“ OOP不好”的说法有缺陷,但是我认为他的观点是正确的,并且可以在根本状态和偶发状态之间划清界限。 +总的来说,他的想法与我自己的 OOP 经验产生了共鸣:对象没有问题,但是我一直不满意的是*面向*对象建模程序控制流,并且试图使代码“正确地”面向对象似乎总是在创建不必要的复杂性。 -如果你以前从未听说过“根本”和“偶发”这两个术语的使用,那么你应该阅读 Fred Brooks 的经典文章[没有银弹][3]。 (顺便说一句,他写了许多有关构建软件系统的很棒的文章。)我以前曾写过[关于根本和偶发的复杂性的文章][4],但是这里有一个简短的摘要:软件很复杂。部分原因是因为我们希望软件能够解决混乱的现实世界问题,因此我们将其称为“根本复杂性”。“偶发复杂性”是所有其他复杂性,因为我们正尝试使用硅和金属来解决与硅和金属无关的问题。例如,对于大多数程序而言,用于内存管理或在内存与磁盘之间传输数据或解析文本格式的代码都是“偶发的复杂性”。 +有一件事我认为他无法完全解释。他直截了当地说“封装没有作用”,但在脚注后面加上“在细粒度的代码级别”,并继续承认对象有时可以奏效,并且在库和文件级别封装是可以的。但是他没有确切解释为什么有时会奏效,有时却没有奏效,以及如何和在何处划清界限。有人可能会说这使他的 “OOP 不好”的说法有缺陷,但是我认为他的观点是正确的,并且可以在根本状态和偶发状态之间划清界限。 -假设你正在构建一个支持多个频道的聊天应用。消息可以随时到达任何频道。有些频道特别有趣,当有新消息传入时,用户希望得到通知。其他频道静音:消息被存储,但用户不会受到打扰。你需要跟踪每个频道的用户首选设置。 +如果你以前从未听说过“根本essential”和“偶发accidental”这两个术语的使用,那么你应该阅读 Fred Brooks 的经典文章《[没有银弹][3]》。(顺便说一句,他写了许多很棒的有关构建软件系统的文章。)我以前曾写过[关于根本和偶发的复杂性的文章][4],这里有一个简短的摘要:软件是复杂的。部分原因是因为我们希望软件能够解决混乱的现实世界问题,因此我们将其称为“根本复杂性”。“偶发复杂性”是所有其它的复杂性,因为我们正尝试使用硅和金属来解决与硅和金属无关的问题。例如,对于大多数程序而言,用于内存管理或在内存与磁盘之间传输数据或解析文本格式的代码都是“偶发的复杂性”。 -一种实现方法是在频道和频道设置之间使用映射(也称为哈希表,字典或关联数组)。注意,映射是 Brian Will 所说的可以用作对象的抽象数据类型(ADT)。 +假设你正在构建一个支持多个频道的聊天应用。消息可以随时到达任何频道。有些频道特别有趣,当有新消息传入时,用户希望得到通知。而其他频道静音:消息被存储,但用户不会受到打扰。你需要跟踪每个频道的用户首选设置。 -如果我们有一个调试器并查看内存中的 map 对象,我们将看到什么?我们当然会找到频道 ID 和频道设置数据(或至少指向它们的指针)。但是我们还会找到其他数据。如果 map 是使用红黑树实现的,我们将看到带有红/黑标签和指向其他节点的指针的树节点对象。与频道相关的数据是根本状态,而树节点是偶发状态。不过,请注意以下几点:该映射有效地封装了它的偶发状态-你可以用 AVL 树实现的另一个映射替换该映射,并且你的聊天程序仍然可以使用。另一方面,映射没有封装根本状态(仅使用 `get()` 和 `set()`方法访问数据不是封装)。事实上,映射与根本状态是尽可能不可知的,你可以使用基本相同的映射数据结构来存储与频道或通知无关的其他映射。 +一种实现方法是在频道和频道设置之间使用映射map(也称为哈希表、字典或关联数组)。注意,映射是 Brian Will 所说的可以用作对象的抽象数据类型(ADT)。 +如果我们有一个调试器并查看内存中的映射对象,我们将看到什么?我们当然会找到频道 ID 和频道设置数据(或至少指向它们的指针)。但是我们还会找到其它数据。如果该映射是使用红黑树实现的,我们将看到带有红/黑标签和指向其他节点的指针的树节点对象。与频道相关的数据是根本状态,而树节点是偶发状态。不过,请注意以下几点:该映射有效地封装了它的偶发状态 —— 你可以用 AVL 树实现的另一个映射替换该映射,并且你的聊天程序仍然可以使用。另一方面,映射没有封装根本状态(仅使用 `get()` 和 `set()` 方法访问数据并不是封装)。事实上,映射与根本状态是尽可能不可知的,你可以使用基本相同的映射数据结构来存储与频道或通知无关的其他映射。 -这就是映射 ADT 如此成功的原因:它封装了偶发状态,并与根本状态解耦。如果你考虑一下,Brian 描述的封装问题就是尝试封装根本状态。其他描述的好处是封装偶发状态的好处。 +这就是映射 ADT 如此成功的原因:它封装了偶发状态,并与根本状态解耦。如果你思考一下,Brian 用封装描述的问题就是尝试封装根本状态。其他描述的好处是封装偶发状态的好处。 -要使整个软件系统都达到这一理想相当困难,但扩展开来,我认为它看起来像这样: +要使整个软件系统都达到这一理想状况相当困难,但扩展开来,我认为它看起来像这样: - * 没有全局的可变状态 - * 封装了偶发状态(在对象或模块或以其他任何形式) - * 无状态偶发复杂性封装在单独函数中,与数据解耦 - * 使用诸如依赖注入之类的技巧使输入和输出变得明确 - * 完全拥有组件,并从易于识别的位置进行控制 +* 没有全局的可变状态 +* 封装了偶发状态(在对象或模块或以其他任何形式) +* 无状态偶发复杂性封装在单独函数中,与数据解耦 +* 使用诸如依赖注入之类的技巧使输入和输出变得明确 +* 组件可由易于识别的位置完全拥有和控制 +其中有些违反了我很久以来的直觉。例如,如果你有一个数据库查询函数,如果数据库连接处理隐藏在该函数内部,并且唯一的参数是查询参数,那么接口会看起来会更简单。但是,当你使用这样的函数构建软件系统时,协调数据库的使用实际上变得更加复杂。组件不仅以自己的方式做事,而且还试图将自己所做的事情隐藏为“实现细节”。数据库查询需要数据库连接这一事实从来都不是实现细节。如果无法隐藏某些内容,那么显露它是更合理的。 +我对将面向对象编程和函数式编程放在对立的两极非常警惕,但我认为从函数式编程进入面向对象编程的另一极端是很有趣的:OOP 试图封装事物,包括无法封装的根本复杂性,而纯函数式编程往往会使事情变得明确,包括一些偶发复杂性。在大多数时候,这没什么问题,但有时候(比如[在纯函数式语言中构建自我指称的数据结构][5])设计更多的是为了函数编程,而不是为了简便(这就是为什么 [Haskell 包含了一些“逃生出口escape hatches”][6])。我之前写过一篇[所谓“弱纯性weak purity”的中间立场][7]。 -其中有些违反了我很久以前的本能。例如,如果你有一个数据库查询函数,如果数据库连接处理隐藏在该函数内部,并且唯一的参数是查询参数,那么接口会看起来会更简单。但是,当你使用这样的函数构建软件系统时,协调数据库的使用实际上变得更加复杂。组件不仅以自己的方式做事,而且还试图将自己所做的事情隐藏为“实现细节”。数据库查询需要数据库连接这一事实从来都不是实现细节。如果无法隐藏某些内容,那么显露它是更合理的。 +Brian 发现封装对更大规模有效,原因有几个。一个是,由于大小的原因,较大的组件更可能包含偶发状态。另一个是“偶发”与你要解决的问题有关。从聊天程序用户的角度来看,“偶发的复杂性”是与消息、频道和用户等无关的任何事物。但是,当你将问题分解为子问题时,更多的事情就变得“根本”。例如,在解决“构建聊天应用”问题时,可以说频道名称和频道 ID 之间的映射是偶发的复杂性,而在解决“实现 `getChannelIdByName()` 函数”子问题时,这是根本复杂性。因此,封装对于子组件的作用比对父组件的作用要小。 -我警惕将面向对象编程和函数式编程放在两极,但我认为从函数式编程进入面向对象编程的另一极端是很有趣的:OOP 试图封装事物,包括无法封装的根本复杂性,而纯函数式编程往往会使事情变得明确,包括一些偶发复杂性。在大多数时候,没什么问题,但有时候(比如[在纯函数式语言中构建自我指称的数据结构][5])设计更多的是为了函数编程,而不是为了简便(这就是为什么 [Haskell 包含了一些“逃生出口”( escape hatches)][6])。我之前写过一篇[中立的所谓的“弱纯性” (weak purity)][7] - -Brian 发现封装对更大规模有效,原因有几个。一个是,由于大小的原因,较大的组件更可能包含偶发状态。另一个是“偶发”与你要解决的问题有关。从聊天程序用户的角度来看,“偶发的复杂性”是与消息,频道和用户等无关的任何事物。但是,当你将问题分解为子问题时,更多的事情就变得重要。例如,在解决“构建聊天应用”问题时,可以说频道名称和频道 ID 之间的映射是偶发的复杂性,而在解决“实现 `getChannelIdByName()` 函数”子问题时,这是根本复杂性。因此,封装对于子组件的作用比对父组件的作用要小。 - -顺便说一句,在影片的结尾,Brian Will 想知道是否有任何语言支持_无法_访问它们所作用的范围的匿名函数。[D][8] 语言可以。 D 中的匿名 Lambda 通常是闭包,但是如果你想要的话,也可以声明匿名无状态函数: +顺便说一句,在视频的结尾,Brian Will 想知道是否有任何语言支持*无法*访问它们所作用的范围的匿名函数。[D][8] 语言可以。 D 中的匿名 Lambda 通常是闭包,但是如果你想要的话,也可以声明匿名无状态函数: ``` import std.stdio; @@ -83,7 +82,7 @@ via: https://theartofmachinery.com/2019/10/13/oop_and_essential_state.html 作者:[Simon Arneaud][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 d0f9841989592533cc14a042a2447f73f71aed77 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 30 Oct 2019 23:30:17 +0800 Subject: [PATCH 225/800] PUB @geekpi https://linux.cn/article-11519-1.html --- ...0191013 Object-Oriented Programming and Essential State.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191013 Object-Oriented Programming and Essential State.md (99%) diff --git a/translated/tech/20191013 Object-Oriented Programming and Essential State.md b/published/20191013 Object-Oriented Programming and Essential State.md similarity index 99% rename from translated/tech/20191013 Object-Oriented Programming and Essential State.md rename to published/20191013 Object-Oriented Programming and Essential State.md index 625c6237e9..2847253e32 100644 --- a/translated/tech/20191013 Object-Oriented Programming and Essential State.md +++ b/published/20191013 Object-Oriented Programming and Essential State.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11519-1.html) [#]: subject: (Object-Oriented Programming and Essential State) [#]: via: (https://theartofmachinery.com/2019/10/13/oop_and_essential_state.html) [#]: author: (Simon Arneaud https://theartofmachinery.com) From 00a142c8b288f0e2be74c82fb83fbf19056c249b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 31 Oct 2019 07:24:52 +0800 Subject: [PATCH 226/800] APL --- sources/news/20191029 Fedora 31 is officially here.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191029 Fedora 31 is officially here.md b/sources/news/20191029 Fedora 31 is officially here.md index 0818e7015d..ce41e3a9c6 100644 --- a/sources/news/20191029 Fedora 31 is officially here.md +++ b/sources/news/20191029 Fedora 31 is officially here.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 34295d8e8eb569e581e16bbdafb39d84db066d30 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 31 Oct 2019 08:18:04 +0800 Subject: [PATCH 227/800] PRF --- .../20191029 Fedora 31 is officially here.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sources/news/20191029 Fedora 31 is officially here.md b/sources/news/20191029 Fedora 31 is officially here.md index ce41e3a9c6..0ee50fb27d 100644 --- a/sources/news/20191029 Fedora 31 is officially here.md +++ b/sources/news/20191029 Fedora 31 is officially here.md @@ -7,50 +7,50 @@ [#]: via: (https://fedoramagazine.org/announcing-fedora-31/) [#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) -Fedora 31 is officially here! +Fedora 31 正式发布 ====== ![][1] -It’s here! We’re proud to announce the release of Fedora 31. Thanks to the hard work of thousands of Fedora community members and contributors, we’re celebrating yet another on-time release. This is getting to be a habit! +这里,我们很荣幸地宣布 Fedora 31 的发布。感谢成千上万的 Fedora 社区成员和贡献者的辛勤工作,我们现在正在庆祝又一次的准时发布。这已成为一种惯例! -If you just want to get to the bits without delay, go to right now. For details, read on! +如果你只想立即获取它,请立即访问 。要了解详细信息,请继续阅读! -### Toolbox +### 工具箱 -If you haven’t used the [Fedora Toolbox][2], this is a great time to try it out. This is a simple tool for launching and managing personal workspace containers, so you can do development or experiment in an isolated experience. It’s as simple as running “toolbox enter” from the command line. +如果你还没有使用过 [Fedora 工具箱][2],那么现在是尝试一下的好时机。这是用于启动和管理个人工作区容器的简单工具,你可以在一个单独的环境中进行开发或试验。它只需要在命令行运行 `toolbox enter` 就行。 -This containerized workflow is vital for users of the ostree-based Fedora variants like CoreOS, IoT, and Silverblue, but is also extremely useful on any workstation or even server system. Look for many more enhancements to this tool and the user experience around it in the next few months — your feedback is very welcome. +这种容器化的工作流程对于基于 ostree 的 Fedora 变体(如 CoreOS、IoT 和 Silverblue)的用户至关重要,但在任何工作站甚至服务器系统上也非常有用。在接下来的几个月中,希望对该工具及其相关的用户体验进行更多增强,非常欢迎你提供反馈。 -### All of Fedora’s Flavors +### Fedora 风味版 -Fedora Editions are targeted outputs geared toward specific “showcase” uses. +Fedora 的“版本”是针对特定的“展示柜”用途输出的。 -Fedora Workstation focuses on the desktop, and particular software developers who want a “just works” Linux operating system experience. This release features GNOME 3.34, which brings significant performance enhancements which will be especially noticeable on lower-powered hardware. +Fedora 工作站版本专注于台式机,以及希望获得“可以工作的” Linux 操作系统体验的特定软件开发人员。此版本具有 GNOME 3.34,它带来了显著的性能增强,在功耗较低的硬件上尤其明显。 -Fedora Server brings the latest in cutting-edge open source server software to systems administrators in an easy-to-deploy fashion. +Fedora 服务器版本以易于部署的方式为系统管理员带来了最新的、最先进的开源服务器软件。 -And, in preview state, we have Fedora CoreOS, a category-defining operating system made for the modern container world, and [Fedora IoT][3] for “edge computing” use cases. (Stay tuned for a planned contest to find a shiny name for the IoT edition!) +而且,我们还有处于预览状态下的 Fedora CoreOS(一个定义了现代容器世界分类的操作系统)和[Fedora IoT][3](用于“边缘计算”用例)。(敬请期待计划中的给该物联网版本的征集名称的活动!) -Of course, we produce more than just the editions. [Fedora Spins][4] and [Labs][5] target a variety of audiences and use cases, including the [Fedora Astronomy][6], which brings a complete open source toolchain to both amateur and professional astronomers, and desktop environments like [KDE Plasma][7] and [Xfce][8]. +当然,我们不仅仅提供的是各种版本。还有面向各种受众和用例的 [Fedora Spins][4] 和 [Labs][5],包括 [Fedora 天文学][6] 版本,为业余和专业的天文学家带来了完整的开源工具链,以及支持各种桌面环境(例如 [KDE Plasma][7] 和 [Xfce][8])。 -And, don’t forget our alternate architectures, [ARM AArch64, Power, and S390x][9]. Of particular note, we have improved support for the Rockchip system-on-a-chip devices including the Rock960, RockPro64,  and Rock64, plus initial support for “[panfrost][10]”, an open source 3D accelerated graphics driver for newer Arm Mali “midgard” GPUs. +而且,请不要忘记我们的替代架构 [ARM AArch64、Power 和 S390x][9]。特别要注意的是,我们对包括 Rock960、RockPro64 和 Rock64 在内的 Rockchip 片上系统设备的支持得到了改善,并初步支持了 “[panfrost][10]”,这是一种较新的开源 3D 加速图形驱动程序 Arm Mali "midgard" GPU。 -If you’re using an older 32-bit only i686 system, though, it’s time to find an alternative — [we bid farewell to 32-bit Intel architecture as a base system][11] this release. +不过,如果你使用的是只支持 32 位的 i686 旧系统,那么该找个替代方案了,[我们的基本系统告别了 32 位 Intel 架构][11]。 -### 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][12]” foundation, we’re enabling CgroupsV2 (if you’re using Docker, [make sure to check this out][13]). Glibc 2.30  and NodeJS 12 are among the many updated packages in Fedora 31. And, we’ve switched the “python” command to by Python 3 — remember, Python 2 is end-of-life at the [end of this year][14]. +无论你使用哪种 Fedora 版本,你都将获得开源世界所提供的最新版本。遵循 “[First][12]” 准则,我们启用了 CgroupsV2(如果你使用的是 Docker,[请确保检查一下][13])。Glibc 2.30 和 NodeJS 12 是 Fedora 31 中许多更新的软件包之一。而且,我们已经将 `python` 命令切换为 Python 3,请记住,Python 2 在[今年年底][14]生命期就终止了。 -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][15]. +我们很高兴你能试用新版本!转到 并立即下载吧。或者,如果你已经在运行 Fedora 操作系统,请遵循简单的[升级说明][15]就行。 -### In the unlikely event of a problem…. +### 万一出现问题…… -If you run into a problem, check out the [Fedora 31 Common Bugs][16] page, and if you have questions, visit our [Ask Fedora][17] user-support platform. +如果遇到问题,请查看 [Fedora 31 常见错误][16]页面,如果有疑问,请访问我们的 [Ask Fedora][17] 用户支持平台。 -### 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. And if you’re in Portland for [USENIX LISA][18] this week, stop by the expo floor and visit me at the Red Hat, Fedora, and CentOS booth. +感谢在此发行周期中成千上万为 Fedora 项目做出贡献的人们,尤其是那些为使该发行版再次按时发行而付出更多努力的人。而且,如果你本周在波特兰参加 [USENIX LISA][18],请在博览会大厅,在 Red Hat、Fedora 和 CentOS 展位找到我。 -------------------------------------------------------------------------------- @@ -58,8 +58,8 @@ via: https://fedoramagazine.org/announcing-fedora-31/ 作者:[Matthew Miller][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 5a70a11570549aedea7c8dbd07a1f945be730200 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 31 Oct 2019 08:18:59 +0800 Subject: [PATCH 228/800] TSL&PRF --- .../news/20191029 Fedora 31 is officially here.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {sources => translated}/news/20191029 Fedora 31 is officially here.md (99%) diff --git a/sources/news/20191029 Fedora 31 is officially here.md b/translated/news/20191029 Fedora 31 is officially here.md similarity index 99% rename from sources/news/20191029 Fedora 31 is officially here.md rename to translated/news/20191029 Fedora 31 is officially here.md index 0ee50fb27d..3d880492ca 100644 --- a/sources/news/20191029 Fedora 31 is officially here.md +++ b/translated/news/20191029 Fedora 31 is officially here.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Fedora 31 is officially here!) From aea4f5e26566ea0f569b92468352c0b9e108546b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 31 Oct 2019 08:20:19 +0800 Subject: [PATCH 229/800] PUB @wxy https://linux.cn/article-11522-1.html --- .../20191029 Fedora 31 is officially here.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191029 Fedora 31 is officially here.md (98%) diff --git a/translated/news/20191029 Fedora 31 is officially here.md b/published/20191029 Fedora 31 is officially here.md similarity index 98% rename from translated/news/20191029 Fedora 31 is officially here.md rename to published/20191029 Fedora 31 is officially here.md index 3d880492ca..d3af75f5cd 100644 --- a/translated/news/20191029 Fedora 31 is officially here.md +++ b/published/20191029 Fedora 31 is officially here.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11522-1.html) [#]: subject: (Fedora 31 is officially here!) [#]: via: (https://fedoramagazine.org/announcing-fedora-31/) [#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) From 714ea39672b8e15a02ed90909c742c083292551f Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 31 Oct 2019 08:51:09 +0800 Subject: [PATCH 230/800] translated --- ...est Password Managers For Linux Desktop.md | 201 ------------------ ...est Password Managers For Linux Desktop.md | 201 ++++++++++++++++++ 2 files changed, 201 insertions(+), 201 deletions(-) delete mode 100644 sources/tech/20191008 5 Best Password Managers For Linux Desktop.md create mode 100644 translated/tech/20191008 5 Best Password Managers For Linux Desktop.md diff --git a/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md b/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md deleted file mode 100644 index e350fbe81c..0000000000 --- a/sources/tech/20191008 5 Best Password Managers For Linux Desktop.md +++ /dev/null @@ -1,201 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 Best Password Managers For Linux Desktop) -[#]: via: (https://itsfoss.com/password-managers-linux/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -5 Best Password Managers For Linux Desktop -====== - -_**A password manager is a useful tool for creating unique passwords and storing them securely so that you don’t have to remember them. Check out the best password managers available for Linux desktop.**_ - -Passwords are everywhere. Websites, forums, web apps and what not, you need to create accounts and password for them. The trouble comes with the password. Keeping the same password for various accounts poses a security risk because [if one of the websites is compromised, hackers try the same email-password combination on other websites][1] as well. - -But keeping unique passwords for all the new accounts means that you have to remember all of them and it’s not possible for normal humans. This is where password managers come to your help. - -Password managing apps suggest/create strong passwords for you and store them in an encrypted database. You just need to remember the master password for the password manager. - -Mainstream modern web browsers like Mozilla Firefox and Google Chrome have built in password manager. This helps but you are restricted to use it on their web browser only. - -There are third party, dedicated password managers and some of them also provide native desktop applications for Linux. In this article, we filter out the best password managers available for Linux. - -Before you see that, I would also advise going through the list of [free password generators for Linux][2] to generate strong, unique passwords for you. - -### Password Managers for Linux - -Possible non-FOSS alert! - -We’ve given priority to the ones which are open source (with some proprietary options, don’t hate me!) and also offer a standalone desktop app (GUI) for Linux. The proprietary options have been highlighted. - -#### 1\. Bitwarden - -![][3] - -Key Highlights: - - * Open Source - * Free for personal use (paid options available for upgrade) - * End-to-end encryption for Cloud servers - * Cross-platform - * Browser Extensions available - * Command-line tools - - - -Bitwarden is one of the most impressive password managers for Linux. I’ll be honest that I didn’t know about this until now – and I’m already making the switch from [LastPass][4]. I was able to easily import the data from LastPass without any issues and had no trouble whatsoever. - -The premium version costs just $10/year – which seems to be worth it (I’ve upgraded for my personal usage). - -It is an open source solution – so there’s nothing shady about it. You can even host it on your own server and create a password solution for your organization. - -In addition to that, you get all the necessary features like 2FA for login, import/export options for your credentials, fingerprint phrase (a unique key), password generator, and more. - -You can upgrade your account as an organization account for free to be able to share your information with 2 users in total. However, if you want additional encrypted vault storage and the ability to share passwords with 5 users, premium upgrades are available starting from as low as $1 per month. I think it’s definitely worth a shot! - -[Bitwarden][5] - -#### 2\. Buttercup - -![][6] - -Key Highlights: - - * Open Source - * Free, with no premium options. - * Cross-platform - * Browser Extensions available - - - -Yet another open-source password manager for Linux. Buttercup may not be a very popular solution – but if you are looking for a simpler alternative to store your credentials, this would be a good start. - -Unlike some others, you do not have to be skeptical about its cloud servers because it sticks to offline usage only and supports connecting cloud sources like [Dropbox][7], [OwnCloud][8], [Nextcloud][9], and [WebDAV][10]. - -So, you can opt for the cloud source if you need to sync the data. You’ve got the choice for it. - -[Buttercup][11] - -#### 4\. KeePassXC - -![][12] - -Key Highlights: - - * Open Source - * Simple password manager - * Cross-platform - * No mobile support - - - -KeePassXC is a community fork of [KeePassX][13] – which was originally a Linux port for [KeePass][14] on Windows. - -Unless you’re not aware, KeePassX hasn’t been maintained for years – so KeePassXC is a good alternative if you are looking for a dead-simple password manager. KeePassXC may not be the most prettiest or fanciest password manager, but it does the job. - -It is secure and open source as well. I think that makes it worth a shot, what say? - -[KeePassXC][15] - -#### 4\. Enpass (not open source) - -![][16] - -Key Highlights: - - * Proprietary - * A lot of features – including ‘Wearable’ device support. - * Completely free for Linux (with premium features) - - - -Enpass is a quite popular password manager across multiple platforms. Even though it’s not an open source solution, a lot of people rely on it – so you can be sure that it works, at least. - -It offers a great deal of features and if you have a wearable device, it will support that too – which is rare. - -It’s great to see that Enpass manages the package for Linux distros actively. Also, note that it works for 64-bit systems only. You can find the [official instructions for installation][17] on their website. It will require utilizing the terminal, but I followed the steps to test it out and it worked like a charm. - -[Enpass][18] - -#### 5\. myki (not open source) - -![][19] - -Key Highlights: - - * Proprietary - * Avoids cloud servers for storing passwords - * Focuses on local peer-to-peer syncing - * Ability to replace passwords with Fingerprint IDs on mobile - - - -This may not be a popular recommendation – but I found it very interesting. It is a proprietary password manager which lets you avoid cloud servers and relies on peer-to-peer sync. - -So, if you do not want to utilize any cloud servers to store your information, this is for you. It is also interesting to note that the app available for Android and iOS helps you replace passwords with your fingerprint ID. If you want convenience on your mobile phone along with the basic functionality on a desktop password manager – this looks like a good option. - -However, if you are opting for a premium upgrade, the pricing plans are for you to judge, definitely not cheap. - -Do try it out and let us know how it goes! - -[myki][20] - -### Some Other Password Managers Worth Pointing Out - -Even without offering a standalone app for Linux, there are some password managers that may deserve a mention. - -If you need to utilize browser-based (extensions) password managers, we would recommend trying out [LastPass][21], [Dashlane][22], and [1Password][23]. LastPass even offers a [Linux client (and a command-line tool)][24]. - -If you are looking for CLI password managers, you should check out [Pass][25]. - -[Password Safe][26] is also an option – but the Linux client is in beta. I wouldn’t recommend relying on “beta” applications for storing passwords. [Universal Password Manager][27] exists but it’s no longer maintained. You may have also heard about [Password Gorilla][28] but it isn’t actively maintained. - -**Wrapping Up** - -Bitwarden seems to be my personal favorite for now. However, there are several options to choose from on Linux. You can either opt for something that offers a native app or just a browser extension – the choice is yours. - -If we missed listing out a password manager worth trying out, let us know about it in the comments below. As always, we’ll extend our list with your suggestion. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/password-managers-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://medium.com/@computerphonedude/one-of-my-old-passwords-was-hacked-on-6-different-sites-and-i-had-no-clue-heres-how-to-quickly-ced23edf3b62 -[2]: https://itsfoss.com/password-generators-linux/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/bitward.png?ssl=1 -[4]: https://www.lastpass.com/ -[5]: https://bitwarden.com/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/buttercup.png?ssl=1 -[7]: https://www.dropbox.com/ -[8]: https://owncloud.com/ -[9]: https://nextcloud.com/ -[10]: https://en.wikipedia.org/wiki/WebDAV -[11]: https://buttercup.pw/ -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/KeePassXC.png?ssl=1 -[13]: https://www.keepassx.org/ -[14]: https://keepass.info/ -[15]: https://keepassxc.org -[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/enpass.png?ssl=1 -[17]: https://www.enpass.io/support/kb/general/how-to-install-enpass-on-linux/ -[18]: https://www.enpass.io/ -[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/myki.png?ssl=1 -[20]: https://myki.com/ -[21]: https://lastpass.com/ -[22]: https://www.dashlane.com/ -[23]: https://1password.com/ -[24]: https://lastpass.com/misc_download2.php -[25]: https://www.passwordstore.org/ -[26]: https://pwsafe.org/ -[27]: http://upm.sourceforge.net/ -[28]: https://github.com/zdia/gorilla/wiki diff --git a/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md b/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md new file mode 100644 index 0000000000..63f9c21656 --- /dev/null +++ b/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Best Password Managers For Linux Desktop) +[#]: via: (https://itsfoss.com/password-managers-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +5 个 Linux 桌面上的最佳密码管理器 +====== + +_ **密码管理器是创建唯一密码并安全存储它们的有用工具,这样你无需记住密码。了解适用于 Linux 桌面的最佳密码管理器。** _ + +密码无处不在。网站、论坛、Web 应用等,你需要为其创建帐户和密码。麻烦的是密码。为各个帐户使用相同的密码会带来安全风险,因为[如果其中一个网站遭到入侵,黑客也会在其他网站上尝试相同的电子邮件密码组合][1]。 + +但是,为所有新帐户设置唯一的密码意味着你必须记住所有密码,这对普通人而言不太可能。这就是密码管理器可以提供帮助的地方。 + +密码管理应用会为你建议/创建强密码,并将其存储在加密的数据库中。你只需要记住密码管理器的主密码即可。 + +主流的现代浏览器(例如 Mozilla Firefox 和 Google Chrome)内置了密码管理器。这有帮助,但是你只能在浏览器上使用它。 + +有一些第三方专门的密码管理器,其中一些还提供 Linux 的原生桌面应用。在本文中,我们将筛选出可用于 Linux 的最佳密码管理器。 + +继续之前,我还建议你仔细阅读 [Linux 的免费密码生成器][2],来为你生成强大的唯一密码。 + +### Linux 密码管理器 + +可能的非 FOSS 警报! + +我们优先考虑开源软件(有一些专有软件,请不要讨厌我!),并提供适用于 Linux 的独立桌面应用(GUI)。专有软件已高亮显示。 + +#### 1\. Bitwarden + +![][3] + +主要亮点: + + * 开源 +  * 免费供个人使用(可选付费升级) +  * 云服务器的端到端加密 +  * 跨平台 +  * 有浏览器扩展 +  * 命令行工具 + + + +Bitwarden 是 Linux 上最令人印象深刻的密码管理器之一。老实说,直到现在我才知道它。我已经从 [LastPass][4] 切换到了它。我能够轻松地从 LastPass 导入数据,而没有任何问题和困难。 + +高级版本的价格仅为每年 10 美元。这似乎是值得的(我已经为个人使用进行了升级)。 + +它是一个开源解决方案,因此没有任何可疑之处。你甚至可以将其托管在自己的服务器上,并为你的组织创建密码解决方案。 + +除此之外,你还将获得所有必需的功能,例如用于登录的两步验证、导入/导出凭据,指纹短语(唯一键),密码生成器等等。 + +你可以免费将帐户升级为组织帐户,以便最多与 2 个用户共享你的信息。但是,如果你想要额外的加密存储以及与 5 个用户共享密码的功能,那么高级升级的费用低至每月 1 美元。我认为绝对值得一试! + +[Bitwarden][5] + +#### 2\. Buttercup + +![][6] + +主要亮点: + + * 开源 +  * 免费,没有高级选项。 +  * 跨平台 +  * 有浏览器扩展 + + + +Linux 中的另一个开源密码管理器。Buttercup 可能不是一个非常流行的解决方案。但是,如果你在寻找一种更简单的方法来保存凭据,那么这将是一个不错的开始。 + +与其他软件不同,你不必对其云服务器持怀疑态度,因为它只支持离线使用并支持连接 [Dropbox][7]、[OwnCloud] [8]、[Nextcloud][9] 和 [WebDAV][10] 等云服务。 + +因此,如果需要同步数据,那么可以选择云服务。你有不同选择。 + +[Buttercup][11] + +#### 3\. KeePassXC + +![][12] + +主要亮点: + + * 开源 +  * 简单的密码管理器 +  * 跨平台 +  * 没有移动支持 + + + +KeePassXC 是 [KeePassX][13] 的社区分支,它最初是 Windows 上 [KeePass][14] 的 Linux 移植。 + +除非你没意识到,KeePassX 已经多年没有维护。因此,如果你在寻找简单易用的密码管理器,那么 KeePassXC 是一个不错的选择。KeePassXC 可能不是最漂亮或最好的密码管理器,但它确实可以做到该做的事。 + +它也是安全和开源的。我认为这值得一试,你说呢? + +[KeePassXC][15] + +#### 4\. Enpass (非开源) + +![][16] + +主要亮点: + + * 专有 +  * 许多功能-包括“可穿戴”设备支持。 +  * Linux 完全免费(具有高级功能) + + + +Enpass 是非常流行的跨平台密码管理器。即使它不是开源解决方案,但还是有很多人依赖它。因此,至少可以肯定它是可行的。 + +它提供了很多功能,如果你有可穿戴设备,它也将支持它,这点很少见。 + +很高兴看到 Enpass 积极管理 Linux 发行版的软件包。另外,请注意,它仅适用于 64 位系统。你可以在它的网站上找到[官方的安装说明] [17]。它需要使用终端,但是我按照步骤进行了测试,它非常好用。 + +[Enpass][18] + +#### 5\. myki (非开源) + +![][19] + +主要亮点: + + * 专有 +  * 不使用云服务器存储密码 +  * 专注于本地点对点同步 +  * 能够在移动设备上用指纹 ID 替换密码 + + + +这可能不是一个受欢迎的建议,但我发现它很有趣。它是专有的密码管理器,它让你避免使用云服务器,并依靠点对点同步。 + +因此,如果你不想使用任何云服务器来存储你的信息,那么它适合你。另外值得注意的是,用于 Android 和 iOS 的程序可帮助你用指纹 ID 替换密码。如果你希望在手机上使用方便,还有桌面密码管理器的基本功能,这似乎是个不错的选择。 + +但是,如果你选择升级到高级版,这有个付费计划供你判断,绝对不便宜。 + +尝试一下,让我们知道它如何! + +[myki][20] + +### 其他一些值得说的密码管理器 + +即使没有为 Linux 提供独立的应用,但仍有一些密码管理器值得一提。 + +如果你需要使用基于浏览器的(扩展)密码管理器,建议你尝试使用 [LastPass][21]、[Dashlane][22] 和 [1Password][23]。LastPass 甚至提供了 [Linux 客户端(和命令行工具)][24]。 + +如果你正在寻找命令行密码管理器,那你应该试试 [Pass][25]。 + +[Password Safe][26] 也是种选择,但它的 Linux 客户端还处于 beta。我不建议依靠 “beta” 程序来存储密码。还有 [Universal Password Manager][27],但它不再维护。你可能也听说过 [Password Gorilla][28],但并它没有积极维护。 + +**总结** + +目前,Bitwarden 似乎是我个人的最爱。但是,在 Linux 上有几个选项可供选择。你可以选择提供原生应用的程序,也可选择浏览器插件,选择权在你。 + +如果有错过值得尝试的密码管理器,请在下面的评论中告诉我们。与往常一样,我们会根据你的建议扩展列表。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/password-managers-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://medium.com/@computerphonedude/one-of-my-old-passwords-was-hacked-on-6-different-sites-and-i-had-no-clue-heres-how-to-quickly-ced23edf3b62 +[2]: https://itsfoss.com/password-generators-linux/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/bitward.png?ssl=1 +[4]: https://www.lastpass.com/ +[5]: https://bitwarden.com/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/buttercup.png?ssl=1 +[7]: https://www.dropbox.com/ +[8]: https://owncloud.com/ +[9]: https://nextcloud.com/ +[10]: https://en.wikipedia.org/wiki/WebDAV +[11]: https://buttercup.pw/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/KeePassXC.png?ssl=1 +[13]: https://www.keepassx.org/ +[14]: https://keepass.info/ +[15]: https://keepassxc.org +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/enpass.png?ssl=1 +[17]: https://www.enpass.io/support/kb/general/how-to-install-enpass-on-linux/ +[18]: https://www.enpass.io/ +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/myki.png?ssl=1 +[20]: https://myki.com/ +[21]: https://lastpass.com/ +[22]: https://www.dashlane.com/ +[23]: https://1password.com/ +[24]: https://lastpass.com/misc_download2.php +[25]: https://www.passwordstore.org/ +[26]: https://pwsafe.org/ +[27]: http://upm.sourceforge.net/ +[28]: https://github.com/zdia/gorilla/wiki From 05b9130f7eb249c12888b58ef65bc95266c51038 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 31 Oct 2019 09:01:41 +0800 Subject: [PATCH 231/800] translating --- sources/tech/20191028 SQLite is really easy to compile.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191028 SQLite is really easy to compile.md b/sources/tech/20191028 SQLite is really easy to compile.md index 6004299e2f..3201612f3d 100644 --- a/sources/tech/20191028 SQLite is really easy to compile.md +++ b/sources/tech/20191028 SQLite is really easy to compile.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ce53bccd8a8c287db5542b530efc4f63a89b88d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 31 Oct 2019 13:15:05 +0800 Subject: [PATCH 232/800] translating translating --- ...20190906 6 Open Source Paint Applications for Linux Users.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md b/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md index d1523f33c3..d1c4ce50a6 100644 --- a/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md +++ b/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f281a35aa7d7c30d5400c573ec88c18ca0bca273 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 31 Oct 2019 18:27:42 +0800 Subject: [PATCH 233/800] PRF @wxy --- ...ur Linux Desktop With GNOME Tweaks Tool.md | 47 +++++++++---------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md b/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md index 44ccc28328..44c8d68722 100644 --- a/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md +++ b/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool) @@ -10,7 +10,8 @@ 使用 GNOME 优化工具自定义 Linux 桌面的 10 种方法 ====== -![GNOME Tweak Tool Icon][1] + +![][7] 你可以通过多种方法来调整 Ubuntu,以自定义其外观和行为。我发现最简单的方法是使用 [GNOME 优化工具][2]。它也被称为 GNOME Tweak 或简单地称为 Tweak(优化)。 @@ -20,11 +21,11 @@ ### 在 Ubuntu 18.04 或其它版本上安装 GNOME 优化工具 -Gnome 优化工具可从 [Ubuntu 中的 Universe 存储库][3]中安装,因此请确保已在“软件和更新”工具中启用了该工具: +GNOME 优化工具可从 [Ubuntu 中的 Universe 存储库][3]中安装,因此请确保已在“软件和更新”工具中启用了该仓库: ![在 Ubuntu 中启用 Universe 存储库][4] -之后,你可以从软件中心安装 GNOME 优化工具。只需打开软件中心并搜索 “GNOME Tweaks”并从那里安装它: +之后,你可以从软件中心安装 GNOME 优化工具。只需打开软件中心并搜索 “GNOME Tweaks” 并从那里安装它: ![从软件中心安装 GNOME 优化工具][5] @@ -36,45 +37,43 @@ sudo apt install gnome-tweaks ### 用优化工具定制 GNOME 桌面 -![][7] - GNOME 优化工具使你可以进行许多设置更改。其中的某些更改(例如墙纸更改、启动应用程序等)也可以在官方的“系统设置”工具中找到。我将重点介绍默认情况下“设置”中不可用的优化。 #### 1、改变主题 你可以通过各种方式[在 Ubuntu 中安装新主题][8]。但是,如果要更改为新安装的主题,则必须安装GNOME 优化工具。 -你可以在外观部分找到主题和图标设置。你可以浏览可用的主题和图标并设置所需的主题和图标。更改将立即生效。 +你可以在“外观Appearance”部分找到主题和图标设置。你可以浏览可用的主题和图标并设置你喜欢的主题和图标。更改将立即生效。 ![通过 GNOME 优化更改主题][9] -#### 2\、禁用动画以提速你的桌面体验 +#### 2、禁用动画以提速你的桌面体验 -应用程序窗口的打开、关闭、最大化等都有一些细微的动画。你可以禁用这些动画以稍微加快系统的速度,因为它会使用较少的资源。 +应用程序窗口的打开、关闭、最大化等操作都有一些细微的动画。你可以禁用这些动画以稍微加快系统的速度,因为它会稍微使用一点资源。 ![禁用动画以获得稍快的桌面体验][10] #### 3、控制桌面图标 -至少在 Ubuntu 中,你会在桌面上看到“主目录”和“垃圾箱”图标。如果你不喜欢,可以选择禁用它。你还可以选择要在桌面上显示的图标。 +至少在 Ubuntu 中,你会在桌面上看到“家目录Home”和“垃圾箱Trash”图标。如果你不喜欢,可以选择禁用它。你还可以选择要在桌面上显示的图标。 ![在 Ubuntu 中控制桌面图标][11] #### 4、管理 GNOME 扩展 -我想可能知道 [GNOME 扩展][12]。这些是用于桌面的小型“插件”,可扩展 GNOME 桌面的功能。有[大量的 GNOME 扩展][13],可用于在顶部面板中查看 CPU 消耗、获取剪贴板历史记录等。 +我想你可能知道 [GNOME 扩展][12]。这些是用于桌面的小型“插件”,可扩展 GNOME 桌面的功能。有[大量的 GNOME 扩展][13],可用于在顶部面板中查看 CPU 消耗、获取剪贴板历史记录等等。 -我已经写了一篇[安装和使用 GNOME 扩展][14]的详细文章。在这里,我假设你已经在使用它们,如果是这种情况,那么可以从 GNOME 优化工具中对其进行管理。 +我已经写了一篇[安装和使用 GNOME 扩展][14]的详细文章。在这里,我假设你已经在使用它们,如果是这样,可以从 GNOME 优化工具中对其进行管理。 ![管理 GNOME 扩展][15] #### 5、改变字体和缩放比例 -你可以[在 Ubuntu 中安装新字体][16],并使用优化工具在系统范围应用字体更改。如果你认为桌面上的图标和文本太小,也可以更改缩放比例。 +你可以[在 Ubuntu 中安装新字体][16],并使用这个优化工具在系统范围应用字体更改。如果你认为桌面上的图标和文本太小,也可以更改缩放比例。 ![更改字体和缩放比例][17] -#### 6、控制触摸板行为,例如在键入时禁用触摸板,右键单击触摸板即可正常工作 +#### 6、控制触摸板行为,例如在键入时禁用触摸板,使触摸板右键单击可以工作 GNOME 优化工具还允许你在键入时禁用触摸板。如果你在笔记本电脑上快速键入,这将很有用。手掌底部可能会触摸触摸板,并导致光标移至屏幕上不需要的位置。 @@ -84,35 +83,35 @@ GNOME 优化工具还允许你在键入时禁用触摸板。如果你在笔记 你还会注意到[当你按下触摸板的右下角以进行右键单击时,什么也没有发生][19]。你的触摸板并没有问题。这是一项系统设置,可对没有实体右键按钮的任何触摸板(例如旧的 Thinkpad 笔记本电脑)禁用这种右键单击功能。两指点击可为你提供右键单击操作。 -你也可以通过在“鼠标单击模拟”下的“区域”中而不是“手指”中找到它。 +你也可以通过在“鼠标单击模拟Mouse Click Simulation”下设置为“区域Area”中而不是“手指Fingers”来找回这项功能。 ![修复右键单击问题][20] -你可能必须[重新启动 Ubuntu][21] 才能生效。如果你是 Emacs 爱好者,还可以从 Emacs 强制进行键盘绑定。 +你可能必须[重新启动 Ubuntu][21] 来使这项更改生效。如果你是 Emacs 爱好者,还可以强制使用 Emacs 键盘绑定。 #### 7、改变电源设置 -电源这里只有一个设置。盖上盖子后,你可以将笔记本电脑置于挂起模式。 +电源这里只有一个设置。它可以让你在盖上盖子后将笔记本电脑置于挂起模式。 ![GNOME 优化工具中的电源设置][22] #### 8、决定什么显示在顶部面板 -桌面的顶部面板显示了一些重要的信息。在这里有日历、网络图标、系统设置和“活动”选项。 +桌面的顶部面板显示了一些重要的信息。在这里有日历、网络图标、系统设置和“活动Activities”选项。 -你还可以[显示电池百分比][23]、添加日期以及日期和时间,并显示星期数。你还可以启用鼠标热点,以便将鼠标移至屏幕的左上角时可以获得所有正在运行的应用程序的活动视图。 +你还可以[显示电池百分比][23]、添加日期及时间,并显示星期数。你还可以启用鼠标热角,以便将鼠标移至屏幕的左上角时可以获得所有正在运行的应用程序的活动视图。 ![GNOME 优化工具中的顶部面板设置][24] -如果将鼠标将焦点放在应用程序窗口上,则会注意到其菜单显示在顶部面板中。如果你不喜欢这样,可以将其关闭,然后应用程序菜单将显示应用程序本身。 +如果将鼠标焦点放在应用程序窗口上,你会注意到其菜单显示在顶部面板中。如果你不喜欢这样,可以将其关闭,然后应用程序菜单将显示应用程序本身。 #### 9、配置应用窗口 -你可以决定是否在应用程序窗口中显示最大化和最小化选项(右上角的按钮)。你也可以在左右两边改变它们的位置。 +你可以决定是否在应用程序窗口中显示最大化和最小化选项(右上角的按钮)。你也可以改变它们的位置到左边或右边。 ![应用程序窗口配置][25] -还有其他一些配置选项。我不使用它们,但你可以自行探索。 +这里还有其他一些配置选项。我不使用它们,但你可以自行探索。 #### 10、配置工作区 @@ -122,7 +121,7 @@ GNOME 优化工具还允许你围绕工作区配置一些内容。 ### 总结 -对于任何 GNOME 用户,GNOME 优化(Tweaks)工具都是必备工具。它可以帮助你配置桌面的外观和功能。 我感到惊讶的是,该工具甚至没有出现在 Ubuntu 的主存储库中。我认为应该默认安装它,要不,你将需得在 Ubuntu 中手动安装 GNOME 优化工具。 +对于任何 GNOME 用户,GNOME 优化(Tweaks)工具都是必备工具。它可以帮助你配置桌面的外观和功能。 我感到惊讶的是,该工具甚至没有出现在 Ubuntu 的主存储库中。我认为应该默认安装它,要不,你就得在 Ubuntu 中手动安装 GNOME 优化工具。 如果你在 GNOME 优化工具中发现了一些此处没有讨论的隐藏技巧,为什么不与大家分享呢? @@ -133,7 +132,7 @@ via: https://itsfoss.com/gnome-tweak-tool/ 作者:[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 7a6cfe02862414de393552e1c779e17f3e193128 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 31 Oct 2019 18:28:09 +0800 Subject: [PATCH 234/800] PUB @wxy https://linux.cn/article-11523-1.html --- ... to Customize Your Linux Desktop With GNOME Tweaks Tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md (99%) diff --git a/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md b/published/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md similarity index 99% rename from translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md rename to published/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md index 44c8d68722..c9adda9a5d 100644 --- a/translated/tech/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md +++ b/published/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11523-1.html) [#]: subject: (10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool) [#]: via: (https://itsfoss.com/gnome-tweak-tool/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 1211f48ad85711835d70edfcd32c6ba5f2f1d4a1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 31 Oct 2019 18:34:58 +0800 Subject: [PATCH 235/800] APL --- ...9 Collapse OS - An OS Created to Run After the World Ends.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md index 456372ab38..0d8075602a 100644 --- a/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md +++ b/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 8ae0e1ff98d1edb2656162721449a8f6464166fa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 31 Oct 2019 21:41:31 +0800 Subject: [PATCH 236/800] TSL&PRF --- ... OS Created to Run After the World Ends.md | 104 ------------------ ... OS Created to Run After the World Ends.md | 100 +++++++++++++++++ 2 files changed, 100 insertions(+), 104 deletions(-) delete mode 100644 sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md create mode 100644 translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md diff --git a/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md deleted file mode 100644 index 0d8075602a..0000000000 --- a/sources/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Collapse OS – An OS Created to Run After the World Ends) -[#]: via: (https://itsfoss.com/collapse-os/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Collapse OS – An OS Created to Run After the World Ends -====== - -When most people think about preparing for a post-apocalyptic world, the first time that comes to mind is food and other living essentials. Recently, a programmer has decided that it would be just as important to create a versatile and survivable operating system after the collapse of society. We will be taking a look at it today, as best we can. - -### Collapse OS – For when the fecal matter hits the rotating device - -![][1] - -The operating system in question is called [Collapse OS][2]. According to the website, Collapse OS is a “z80 kernel and a collection of programs, tools and documentation”. It would allow you to: - - * Run on minimal and improvised machines. - * Interface through improvised means (serial, keyboard, display). - * Edit text files. - * Compile assembler source files for a wide range of MCUs and CPUs. - * Read and write from a wide range of storage devices. - * Replicate itself. - - - -The creator, [Virgil Dupras][3], started the project because [he sees][4] “our global supply chain to collapse before we reach 2030”. He bases this conclusion on the works of Pablo Servigne. He seems to understand that not everyone shares [his views][4]. “That being said, I don’t consider it unreasonable to not believe that collapse is likely to happen by 2030, so please, don’t feel attacked by my beliefs.” - -The overall goal of the project is to jumpstart a post-collapse civilization’s return to the computer age. The production of electronics depends on a very complex supply chain. Once that supply chain crumbles, man will go back to a less technical age. It would take decades to regain our previous technical position. Dupras hopes to jump several steps by creating an ecosystem that will work with simpler chips that can be scavenged from a wide variety of sources. - -### What is the z80? - -The initial CollapseOS kernel is written for the [z80 chip][5]. As a retro computing history buff, I am familiar with [Zilog][6] and it’s z80 chip. In the late 1970s, Zilog introduced the z80 to compete with [Intel’s 8080][7] CPU. The z80 was used in a whole bunch of early personal computers, such as the [Sinclair ZX Spectrum][8] and the [Tandy TRS-80][9]. The majority of these systems used the [CP/M operating system][10], which was the top operating system of the time. (Interestingly, Dupras was originally looking to use an [open-source implementation o][11][f][11] [CP/M][11], but ultimately decided to [start from scratch][12].) - -Both the z80 and CP/M started to decline in popularity after the [IBM PC][13] was released in 1981. Zilog did release several other microprocessors (Z8000 and Z80000), but these did not take off. The company switched its focus to microcontrollers. Today, an updated descendant of the z80 can be found in graphic calculators, embedded devices and consumer electronics. - -Dupras said on [Reddit][14] that he wrote Collapse OS for the z80 because “it’s been in production for so long and because it’s been used in so many machines, scavenger have good chances of getting their hands on it.” - -### Current status and future of the project - -Collapse OS has a pretty decent start. It can self replicate with enough RAM and storage. It is capable of running on an [RC2014 homebrew computer][15] or a Sega Master System/MegaDrive (Genesis). It can read SD cards. It has a simple text editor. The kernel is made up of modules that are connected with glue code. This is designed to make the system flexible and adaptable. - -There is also a detailed [roadmap][16] laying out the direction of the project. Listed goals include: - - * Support for other CPUs, such as 8080 and [6502][17] - * Support for improvised peripherals, such as LCD screens, E-ink displays, and [ACIA devices][18]. - * Support for more storage options, such as floppys, CDs, SPI RAM/ROMs, and AVR MCUs - * Get it to work on other z80 machines, such as [TI-83+][19] and [TI-84+][20] graphing calculators and TRS-80s - - - -If you are interested in helping out or just taking a peek at the project, be sure to visit their [GitHub page][21]. - -### Final Thoughts - -To put it bluntly, I see Collapse OS as more of a fun hobby project (for those who like building operating systems), than something useful. When a collapse does come, how will Collapse OS get distributed, since I imagine that GitHub will be down? I can’t imagine more than a handful of skill people being able to create a system from scavenged parts. There is a whole new generation of makers out there, but most of them are used to picking up an Arduino or a Raspberry Pi and building their project than starting from scratch. - -Contrary to Dupras, my biggest concern is the use of [EMPs][22]. These things fry all electrical systems, meaning there would be nothing left to scavenge to build system. If that doesn’t happen, I imagine that we would be able to find enough x86 components made over the past 30 years to keep things going. - -That being said, Collapse OS sounds like a fun and challenging project to people who like to program in low-level code for strange applications. If you are such a person, check out [Collapse OS][2]. - -Hypothetical question: what is your post-apocalyptic operating system of choice? 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][23]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/collapse-os/ - -作者:[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/2019/10/Collapse_OS.jpg?ssl=1 -[2]: https://collapseos.org/ -[3]: https://github.com/hsoft -[4]: https://collapseos.org/why.html -[5]: https://en.m.wikipedia.org/wiki/Z80 -[6]: https://en.wikipedia.org/wiki/Zilog -[7]: https://en.wikipedia.org/wiki/Intel_8080 -[8]: https://en.wikipedia.org/wiki/ZX_Spectrum -[9]: https://en.wikipedia.org/wiki/TRS-80 -[10]: https://en.wikipedia.org/wiki/CP/M -[11]: https://github.com/davidgiven/cpmish -[12]: https://github.com/hsoft/collapseos/issues/52 -[13]: https://en.wikipedia.org/wiki/IBM_Personal_Computer -[14]: https://old.reddit.com/r/collapse/comments/dejmvz/collapse_os_bootstrap_postcollapse_technology/f2w3sid/?st=k1gujoau&sh=1b344da9 -[15]: https://rc2014.co.uk/ -[16]: https://collapseos.org/roadmap.html -[17]: https://en.wikipedia.org/wiki/MOS_Technology_6502 -[18]: https://en.wikipedia.org/wiki/MOS_Technology_6551 -[19]: https://en.wikipedia.org/wiki/TI-83_series#TI-83_Plus -[20]: https://en.wikipedia.org/wiki/TI-84_Plus_series -[21]: https://github.com/hsoft/collapseos -[22]: https://en.wikipedia.org/wiki/Electromagnetic_pulse -[23]: https://reddit.com/r/linuxusersgroup diff --git a/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md new file mode 100644 index 0000000000..c539ee20c0 --- /dev/null +++ b/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Collapse OS – An OS Created to Run After the World Ends) +[#]: via: (https://itsfoss.com/collapse-os/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Collapse OS:为世界末日创建的操作系统 +====== + +当大多数人考虑为末日后的世界做准备时,想到的第一件事就是准备食物和其他生活必需品。最近,有一个程序员觉得,在社会崩溃之后,创建一个多功能的、且可生存的操作系统同样重要。我们今天将尽我们所能地来看看它。 + +### Collapse OS:当文明被掩埋在垃圾中 + +![][1] + +这里说的操作系统称为 [Collapse OS(崩溃操作系统)][2]。根据该网站的说法,Collapse OS 是 “z80 内核以及一系列程序、工具和文档的集合”。 它可以让你: + +* 可在最小的和临时拼凑的机器上运行。 +* 通过临时拼凑的方式(串行、键盘、显示)进行接口。 +* 可编辑文本文件。 +* 编译适用于各种 MCU 和 CPU 的汇编源代码文件。 +* 从各种存储设备读取和写入。 +* 自我复制。 + +其创造者 [Virgil Dupras][3] 之所以开始这个项目,是因为[他认为][4]“我们的全球供应链在我们到达 2030 年之前就会崩溃”。他根据巴勃罗·塞维尼Pablo Servigne的作品得出了这一结论。他似乎了解并非所有人都会认可[他的观点][4],“话虽如此,我认为不相信到 2030 年可能会发生崩溃也是可以理解的,所以请不要为我的信念而感到受到了攻击。” + +该项目的总体目标是迅速让瓦解崩溃后的文明重新回到计算机时代。电子产品的生产取决于非常复杂的供应链。一旦供应链崩溃,人类将回到一个技术水平较低的时代。要恢复我们以前的技术水平,将需要数十年的时间。Dupras 希望通过创建一个生态系统来跨越几个步骤,该生态系统将与可以从各种来源搜寻到的更简单的芯片一起工作。 + +### z80 是什么? + +最初的 Collapse OS 内核是为 [z80 芯片][5]编写的。作为复古的计算机历史爱好者,我对 [Zilog][6] 和 z80 芯片很熟悉。在 1970 年代后期,Zilog 公司推出了 z80,以和 [Intel 的 8080][7] CPU 竞争。z80 被用于许多早期的个人计算机中,例如 [Sinclair ZX Spectrum][8] 和 [Tandy TRS-80][9]。这些系统中的大多数使用了 [CP/M 操作系统] [10],这是当时最流行的操作系统。(有趣的是,Dupras 最初希望使用[一个开源版本的 CP/M][11],但最终决定[从头开始][12]。) + +在 1981 年 [IBM PC][13] 发布之后,z80 和 CP/M 的普及率开始下降。Zilog 确实发布了其它几种微处理器(Z8000 和 Z80000),但并没有获得成功。该公司将重点转移到了微控制器上。今天,更新后的 z80 后代产品可以在图形计算器、嵌入式设备和消费电子产品中找到。 + +Dupras 在 [Reddit][14] 上说,他为 z80 编写了 Collapse OS,因为“它已经投入生产很长时间了,并且因为它被用于许多机器上,所以拾荒者有很大的机会拿到它。” + +### 该项目的当前状态和未来发展 + +Collapse OS 的起步相当不错。有足够的内存和存储空间它就可以进行自我复制。它可以在 [RC2014 家用计算机][15]或世嘉 Master System / MegaDrive(Genesis)上运行。它可以读取 SD 卡。它有一个简单的文本编辑器。其内核由与粘合代码相连接的模块组成。这是为了使系统具有灵活性和适应性。 + +还有一个详细的[路线图][16]列出了该项目的方向。列出的目标包括: + +* 支持其他 CPU,例如 8080 和 [6502][17]。 +* 支持临时拼凑的外围设备,例如 LCD 屏幕、电子墨水显示器和 [ACIA 设备][18]。 +* 支持更多的存储方式,例如软盘、CD、SPI RAM/ROM 和 AVR MCU。 +* 使它可以在其他 z80 机器上工作,例如 [TI-83+][19] 和 [TI-84+][20 ]图形计算器和 TRS-80s。 + +如果你有兴趣帮助或只是想窥视一下这个项目,请访问其 [GitHub 页面][21]。 + +### 最后的思考 + +坦率地说,我认为 Collapse OS 与其说是一个有用的项目,倒不如说更像是一个有趣的爱好项目(对于那些喜欢构建操作系统的人来说)。当崩溃真的到来时,我认为 GitHub 也会宕机,那么 Collapse OS 将如何分发?我无法想像,得具有多少技能的人才能够从捡来的零件中创建出一个系统。到时候会有新一代的创客们,但大多数创客们会习惯于选择 Arduino 或树莓派来构建项目,而不是从头开始。 + +与 Dupras 相反,我最担心的是[电磁脉冲炸弹(EMP)][22] 的使用。这些东西会炸毁所有的电气系统,这意味着将没有任何构建系统的可能。如果没有发生这种事情,我想我们将能够找到过去 30 年制造的那么多的 x86 组件,以保持它们运行下去。 + +话虽如此,对于那些喜欢为奇奇怪怪的应用编写低级代码的人来说,Collapse OS 听起来是一个有趣且具有度挑战性的项目。如果你是这样的人,去检出 [Collapse OS][2] 代码吧。 + +让我提个假设的问题:你选择的世界末日操作系统是什么?请在下面的评论中告诉我们。 + +如果你觉得这篇文章有趣,请花一点时间在社交媒体、Hacker News 或 [Reddit][23] 上分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/collapse-os/ + +作者:[John Paul][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/john/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/Collapse_OS.jpg?ssl=1 +[2]: https://collapseos.org/ +[3]: https://github.com/hsoft +[4]: https://collapseos.org/why.html +[5]: https://en.m.wikipedia.org/wiki/Z80 +[6]: https://en.wikipedia.org/wiki/Zilog +[7]: https://en.wikipedia.org/wiki/Intel_8080 +[8]: https://en.wikipedia.org/wiki/ZX_Spectrum +[9]: https://en.wikipedia.org/wiki/TRS-80 +[10]: https://en.wikipedia.org/wiki/CP/M +[11]: https://github.com/davidgiven/cpmish +[12]: https://github.com/hsoft/collapseos/issues/52 +[13]: https://en.wikipedia.org/wiki/IBM_Personal_Computer +[14]: https://old.reddit.com/r/collapse/comments/dejmvz/collapse_os_bootstrap_postcollapse_technology/f2w3sid/?st=k1gujoau&sh=1b344da9 +[15]: https://rc2014.co.uk/ +[16]: https://collapseos.org/roadmap.html +[17]: https://en.wikipedia.org/wiki/MOS_Technology_6502 +[18]: https://en.wikipedia.org/wiki/MOS_Technology_6551 +[19]: https://en.wikipedia.org/wiki/TI-83_series#TI-83_Plus +[20]: https://en.wikipedia.org/wiki/TI-84_Plus_series +[21]: https://github.com/hsoft/collapseos +[22]: https://en.wikipedia.org/wiki/Electromagnetic_pulse +[23]: https://reddit.com/r/linuxusersgroup From fad572b277426e3d41f9a8805439b299c0858e0e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 00:57:37 +0800 Subject: [PATCH 237/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191031=20Why=20?= =?UTF-8?q?you=20don't=20have=20to=20be=20afraid=20of=20Kubernetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191031 Why you don-t have to be afraid of Kubernetes.md --- ...u don-t have to be afraid of Kubernetes.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20191031 Why you don-t have to be afraid of Kubernetes.md diff --git a/sources/tech/20191031 Why you don-t have to be afraid of Kubernetes.md b/sources/tech/20191031 Why you don-t have to be afraid of Kubernetes.md new file mode 100644 index 0000000000..8d9d67e1bd --- /dev/null +++ b/sources/tech/20191031 Why you don-t have to be afraid of Kubernetes.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why you don't have to be afraid of Kubernetes) +[#]: via: (https://opensource.com/article/19/10/kubernetes-complex-business-problem) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +Why you don't have to be afraid of Kubernetes +====== +Kubernetes is absolutely the simplest, easiest way to meet the needs of +complex web applications. +![Digital creative of a browser on the internet][1] + +It was fun to work at a large web property in the late 1990s and early 2000s. My experience takes me back to American Greetings Interactive, where on Valentine's Day, we had one of the top 10 sites on the internet (measured by web traffic). We delivered e-cards for [AmericanGreetings.com][2], [BlueMountain.com][3], and others, as well as providing e-cards for partners like MSN and AOL. Veterans of the organization fondly remember epic stories of doing great battle with other e-card sites like Hallmark. As an aside, I also ran large web properties for Holly Hobbie, Care Bears, and Strawberry Shortcake. + +I remember like it was yesterday the first time we had a real problem. Normally, we had about 200Mbps of traffic coming in our front doors (routers, firewalls, and load balancers). But, suddenly, out of nowhere, the Multi Router Traffic Grapher (MRTG) graphs spiked to 2Gbps in a few minutes. I was running around, scrambling like crazy. I understood our entire technology stack, from the routers, switches, firewalls, and load balancers, to the Linux/Apache web servers, to our Python stack (a meta version of FastCGI), and the Network File System (NFS) servers. I knew where all of the config files were, I had access to all of the admin interfaces, and I was a seasoned, battle-hardened sysadmin with years of experience troubleshooting complex problems. + +But, I couldn't figure out what was happening... + +Five minutes feels like an eternity when you are frantically typing commands across a thousand Linux servers. I knew the site was going to go down any second because it's fairly easy to overwhelm a thousand-node cluster when it's divided up and compartmentalized into smaller clusters. + +I quickly _ran_ over to my boss's desk and explained the situation. He barely looked up from his email, which frustrated me. He glanced up, smiled, and said, "Yeah, marketing probably ran an ad campaign. This happens sometimes." He told me to set a special flag in the application that would offload traffic to Akamai. I ran back to my desk, set the flag on a thousand web servers, and within minutes, the site was back to normal. Disaster averted. + +I could share 50 more stories similar to this one, but the curious part of your mind is probably asking, "Where this is going?" + +The point is, we had a business problem. Technical problems become business problems when they stop you from being able to do business. Stated another way, you can't handle customer transactions if your website isn't accessible. + +So, what does all of this have to do with Kubernetes? Everything. The world has changed. Back in the late 1990s and early 2000s, only large web properties had large, web-scale problems. Now, with microservices and digital transformation, every business has a large, web-scale problem—likely multiple large, web-scale problems. + +Your business needs to be able to manage a complex web-scale property with many different, often sophisticated services built by many different people. Your web properties need to handle traffic dynamically, and they need to be secure. These properties need to be API-driven at all layers, from the infrastructure to the application layer. + +### Enter Kubernetes + +Kubernetes isn't complex; your business problems are. When you want to run applications in production, there is a minimum level of complexity required to meet the performance (scaling, jitter, etc.) and security requirements. Things like high availability (HA), capacity requirements (N+1, N+2, N+100), and eventually consistent data technologies become a requirement. These are production requirements for every company that has digitally transformed, not just the large web properties like Google, Facebook, and Twitter. + +In the old world, I lived at American Greetings, every time we onboarded a new service, it looked something like this. All of this was handled by the web operations team, and none of it was offloaded to other teams using ticket systems, etc. This was DevOps before there was DevOps: + + 1. Configure DNS (often internal service layers and external public-facing) + 2. Configure load balancers (often internal services and public-facing) + 3. Configure shared access to files (large NFS servers, clustered file systems, etc.) + 4. Configure clustering software (databases, service layers, etc.) + 5. Configure webserver cluster (could be 10 or 50 servers) + + + +Most of this was automated with configuration management, but configuration was still complex because every one of these systems and services had different configuration files with completely different formats. We investigated tools like [Augeas][4] to simplify this but determined that it was an anti-pattern to try and normalize a bunch of different configuration files with a translator. + +Today with Kubernetes, onboarding a new service essentially looks like: + + 1. Configure Kubernetes YAML/JSON. + 2. Submit it to the Kubernetes API (**kubectl create -f service.yaml**). + + + +Kubernetes vastly simplifies onboarding and management of services. The service owner, be it a sysadmin, developer, or architect, can create a YAML/JSON file in the Kubernetes format. With Kubernetes, every system and every user speaks the same language. All users can commit these files in the same Git repository, enabling GitOps. + +Moreover, deprecating and removing a service is possible. Historically, it was terrifying to remove DNS entries, load-balancer entries, web-server configurations, etc. because you would almost certainly break something. With Kubernetes, everything is namespaced, so an entire service can be removed with a single command. You can be much more confident that removing your service won't break the infrastructure environment, although you still need to make sure other applications don't use it (a downside with microservices and function-as-a-service [FaaS]). + +### Building, managing, and using Kubernetes + +Too many people focus on building and managing Kubernetes instead of using it (see [_Kubernetes is a_ _dump truck_][5]). + +Building a simple Kubernetes environment on a single node isn't markedly more complex than installing a LAMP stack, yet we endlessly debate the build-versus-buy question. It's not Kubernetes that's hard; it's running applications at scale with high availability. Building a complex, highly available Kubernetes cluster is hard because building any cluster at this scale is hard. It takes planning and a lot of software. Building a simple dump truck isn't that complex, but building one that can carry [10 tons of dirt and handle pretty well at 200mph][6] is complex. + +Managing Kubernetes can be complex because managing large, web-scale clusters can be complex. Sometimes it makes sense to manage this infrastructure; sometimes it doesn't. Since Kubernetes is a community-driven, open source project, it gives the industry the ability to manage it in many different ways. Vendors can sell hosted versions, while users can decide to manage it themselves if they need to. (But you should question whether you actually need to.) + +Using Kubernetes is the easiest way to run a large-scale web property that has ever been invented. Kubernetes is democratizing the ability to run a set of large, complex web services—like Linux did with Web 1.0. + +Since time and money is a zero-sum game, I recommend focusing on using Kubernetes. Spend your very limited time and money on [mastering Kubernetes primitives][7] or the best way to handle [liveness and readiness probes][8] (another example demonstrating that large, complex services are hard). Don't focus on building and managing Kubernetes. A lot of vendors can help you with that. + +### Conclusion + +I remember troubleshooting countless problems like the one I described at the beginning of this article—NFS in the Linux kernel at that time, our homegrown CFEngine, redirect problems that only surfaced on certain web servers, etc. There was no way a developer could help me troubleshoot any of these problems. In fact, there was no way a developer could even get into the system and help as a second set of eyes unless they had the skills of a senior sysadmin. There was no console with graphics or "observability"—observability was in my brain and the brains of the other sysadmins. Today, with Kubernetes, Prometheus, Grafana, and others, that's all changed. + +The point is: + + 1. The world is different. All web applications are now large, distributed systems. As complex as AmericanGreetings.com was back in the day, the scaling and HA requirements of that site are now expected for every website. + 2. Running large, distributed systems is hard. Period. This is the business requirement, not Kubernetes. Using a simpler orchestrator isn't the answer. + + + +Kubernetes is absolutely the simplest, easiest way to meet the needs of complex web applications. This is the world we live in and where Kubernetes excels. You can debate whether you should build or manage Kubernetes yourself. There are plenty of vendors that can help you with building and managing it, but it's pretty difficult to deny that it's the easiest way to run complex web applications at scale. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/kubernetes-complex-business-problem + +作者:[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/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: http://AmericanGreetings.com +[3]: http://BlueMountain.com +[4]: http://augeas.net/ +[5]: https://opensource.com/article/19/6/kubernetes-dump-truck +[6]: http://crunchtools.com/kubernetes-10-ton-dump-truck-handles-pretty-well-200-mph/ +[7]: https://opensource.com/article/19/6/kubernetes-basics +[8]: https://srcco.de/posts/kubernetes-liveness-probes-are-dangerous.html From 1703cf3ad3c34eaad5013b905372664a6d3b08de Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 00:58:28 +0800 Subject: [PATCH 238/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191031=204=20Py?= =?UTF-8?q?thon=20tools=20for=20getting=20started=20with=20astronomy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191031 4 Python tools for getting started with astronomy.md --- ...ools for getting started with astronomy.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/tech/20191031 4 Python tools for getting started with astronomy.md diff --git a/sources/tech/20191031 4 Python tools for getting started with astronomy.md b/sources/tech/20191031 4 Python tools for getting started with astronomy.md new file mode 100644 index 0000000000..79e64651b3 --- /dev/null +++ b/sources/tech/20191031 4 Python tools for getting started with astronomy.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 Python tools for getting started with astronomy) +[#]: via: (https://opensource.com/article/19/10/python-astronomy-open-data) +[#]: author: (Gina Helfrich, Ph.D. https://opensource.com/users/ginahelfrich) + +4 Python tools for getting started with astronomy +====== +Explore the universe with NumPy, SciPy, Scikit-Image, and Astropy. +![Person looking up at the stars][1] + +NumFOCUS is a nonprofit charity that supports amazing open source toolkits for scientific computing and data science. As part of the effort to connect Opensource.com readers with the NumFOCUS community, we are republishing some of the most popular articles from [our blog][2]. To learn more about our mission and programs, please visit [numfocus.org][3]. If you're interested in participating in the NumFOCUS community in person, check out a local [PyData event][4] happening near you. + +* * * + +### Astronomy with Python + +Python is a great language for science, and specifically for astronomy. The various packages such as [NumPy][5], [SciPy][6], [Scikit-Image][7] and [Astropy][8] (to name but a few) are all a great testament to the suitability of Python for astronomy, and there are plenty of use cases. [NumPy, Astropy, and SciPy are NumFOCUS fiscally sponsored projects; Scikit-Image is an affiliated project.] Since leaving the field of astronomical research behind more than 10 years ago to start a second career as software developer, I have always been interested in the evolution of these packages. Many of my former colleagues in astronomy used most if not all of these packages for their research work. I have since worked on implementing professional astronomy software packages for instruments for the Very Large Telescope (VLT) in Chile, for example. + +It struck me recently that the Python packages have evolved to such an extent that it is now fairly easy for anyone to build [data reduction][9] scripts that can provide high-quality data products. Astronomical data is ubiquitous, and what is more, it is almost all publicly available—you just need to look for it. + +For example, ESO, which runs the VLT, offers the data for download on their site. Head over to [www.eso.org/UserPortal][10] and create a user name for their portal. If you look for data from the instrument SPHERE you can download a full dataset for any of the nearby stars that have exoplanet or proto-stellar discs. It is a fantastic and exciting project for any Pythonista to reduce that data and make the planets or discs that are deeply hidden in the noise visible. + +I encourage you to download the ESO or any other astronomy imaging dataset and go on that adventure. Here are a few tips: + + 1. Start off with a good dataset. Have a look at papers about nearby stars with discs or exoplanets and then search, for example: . Notice that some data on this site is marked as red and some as green. The red data is not publicly available yet — it will say under “release date” when it will be available. + 2. Read something about the instrument you are using the data from. Try and get a basic understanding of how the data is obtained and what the standard data reduction should look like. All telescopes and instruments have publicly available documents about this. + 3. You will need to consider the standard problems with astronomical data and correct for them: + 1. Data comes in FITS files. You will need **pyfits** or **astropy** (which contains pyfits) to read them into **NumPy** arrays. In some cases the data comes in a cube and you should to use **numpy.median **along the z-axis to turn them into 2-D arrays. For some SPHERE data you get two copies of the same piece of sky on the same image (each has a different filter) which you will need to extract using **indexing and slicing.** + 2. The master dark and bad pixel map. All instruments will have specific images taken as “dark frames” that contain images with the shutter closed (no light at all). Use these to extract a mask of bad pixels using **NumPy masked arrays** for this. This mask of bad pixels will be very important — you need to keep track of it as you process the data to get a clean combined image in the end. In some cases it also helps to subtract this master dark from all scientific raw images. + 3. Instruments will typically also have a master flat frame. This is an image or series of images taken with a flat uniform light source. You will need to divide all scientific raw images by this (again, using numpy masked array makes this an easy division operation). + 4. For planet imaging, the fundamental technique to make planets visible against a bright star rely on using a coronagraph and a technique known as angular differential imaging. To that end, you need to identify the optical centre on the images. This is one of the most tricky steps and requires finding some artificial helper images embedded in the images using **skimage.feature.blob_dog**. + 4. Be patient. It can take a while to understand the data format and how to handle it. Making some plots and histograms of the pixel data can help you to understand it. It is well worth it to be persistent! You will learn a lot about imaging data and processing. + + + +Using the tools offered by NumPy, SciPy, Astropy, scikit-image and more in combination, with some patience and persistence, it is possible to analyse the vast amount of available astronomical data to produce some stunning results. And who knows, maybe you will be the first one to find a planet that was previously overlooked! Good luck! + +_This article was originally published on the NumFOCUS blog and is republished with permission. It is based on [a talk][11] by [Ole Moeller-Nilsson][12], CTO at Pivigo. If you want to support NumFOCUS, you can donate [here][13] or find your local [PyData event][4] happening around the world._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/python-astronomy-open-data + +作者:[Gina Helfrich, Ph.D.][a] +选题:[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/ginahelfrich +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmos_person.jpg?itok=XUtz_LyY (Person looking up at the stars) +[2]: https://numfocus.org/blog +[3]: https://numfocus.org +[4]: https://pydata.org/ +[5]: http://numpy.scipy.org/ +[6]: http://www.scipy.org/ +[7]: http://scikit-image.org/ +[8]: http://www.astropy.org/ +[9]: https://en.wikipedia.org/wiki/Data_reduction +[10]: http://www.eso.org/UserPortal +[11]: https://www.slideshare.net/OleMoellerNilsson/pydata-lonon-finding-planets-with-python +[12]: https://twitter.com/olly_mn +[13]: https://numfocus.org/donate From c912f09fb6711846927dd52d8441d69550e8b55e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 00:59:10 +0800 Subject: [PATCH 239/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191031=20Advanc?= =?UTF-8?q?e=20your=20awk=20skills=20with=20two=20easy=20tutorials?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191031 Advance your awk skills with two easy tutorials.md --- ...your awk skills with two easy tutorials.md | 287 ++++++++++++++++++ 1 file changed, 287 insertions(+) create mode 100644 sources/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 new file mode 100644 index 0000000000..f84e4ebe3a --- /dev/null +++ b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md @@ -0,0 +1,287 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: 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 From 1fc3b1914a8f47326d970e69f39e1ae8a85fe850 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 01:00:29 +0800 Subject: [PATCH 240/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191030=20Gettin?= =?UTF-8?q?g=20started=20with=20awk,=20a=20powerful=20text-parsing=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md --- ... with awk, a powerful text-parsing tool.md | 168 ++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md diff --git a/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md b/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md new file mode 100644 index 0000000000..82f2e1c76e --- /dev/null +++ b/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with awk, a powerful text-parsing tool) +[#]: via: (https://opensource.com/article/19/10/intro-awk) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Getting started with awk, a powerful text-parsing tool +====== +Let's jump in and start using it. +![Woman programming][1] + +Awk is a powerful text-parsing tool for Unix and Unix-like systems, but because it has programmed functions that you can use to perform common parsing tasks, it's also considered a programming language. You probably won't be developing your next GUI application with awk, and it likely won't take the place of your default scripting language, but it's a powerful utility for specific tasks. + +What those tasks may be is surprisingly diverse. The best way to discover which of your problems might be best solved by awk is to learn awk; you'll be surprised at how awk can help you get more done but with a lot less effort. + +Awk's basic syntax is: + + +``` +`awk [options] 'pattern {action}' file` +``` + +To get started, create this sample file and save it as **colours.txt** + + +``` +name       color  amount +apple      red    4 +banana     yellow 6 +strawberry red    3 +grape      purple 10 +apple      green  8 +plum       purple 2 +kiwi       brown  4 +potato     brown  9 +pineapple  yellow 5 +``` + +This data is separated into columns by one or more spaces. It's common for data that you are analyzing to be organized in some way. It may not always be columns separated by whitespace, or even a comma or semicolon, but especially in log files or data dumps, there's generally a predictable pattern. You can use patterns of data to help awk extract and process the data that you want to focus on. + +### Printing a column + +In awk, the **print** function displays whatever you specify. There are many predefined variables you can use, but some of the most common are integers designating columns in a text file. Try it out: + + +``` +$ awk '{print $2;}' colours.txt +color +red +yellow +red +purple +green +purple +brown +brown +yellow +``` + +In this case, awk displays the second column, denoted by **$2**. This is relatively intuitive, so you can probably guess that **print $1** displays the first column, and **print $3** displays the third, and so on. + +To display _all_ columns, use **$0**. + +The number after the dollar sign (**$**) is an _expression_, so **$2** and **$(1+1)** mean the same thing. + +### Conditionally selecting columns + +The example file you're using is very structured. It has a row that serves as a header, and the columns relate directly to one another. By defining _conditional_ requirements, you can qualify what you want awk to return when looking at this data. For instance, to view items in column 2 that match "yellow" and print the contents of column 1: + + +``` +awk '$2=="yellow"{print $1}' file1.txt +banana +pineapple +``` + +Regular expressions work as well. This conditional looks at **$2** for approximate matches to the letter **p** followed by any number of (one or more) characters, which are in turn followed by the letter **p**: + + +``` +$ awk '$2 ~ /p.+p/ {print $0}' colours.txt +grape   purple  10 +plum    purple  2 +``` + +Numbers are interpreted naturally by awk. For instance, to print any row with a third column containing an integer greater than 5: + + +``` +awk '$3>5 {print $1, $2}' colours.txt +name    color +banana  yellow +grape   purple +apple   green +potato  brown +``` + +### Field separator + +By default, awk uses whitespace as the field separator. Not all text files use whitespace to define fields, though. For example, create a file called **colours.csv** with this content: + + +``` +name,color,amount +apple,red,4 +banana,yellow,6 +strawberry,red,3 +grape,purple,10 +apple,green,8 +plum,purple,2 +kiwi,brown,4 +potato,brown,9 +pineapple,yellow,5 +``` + +Awk can treat the data in exactly the same way, as long as you specify which character it should use as the field separator in your command. Use the **\--field-separator** (or just **-F** for short) option to define the delimiter: + + +``` +$ awk -F"," '$2=="yellow" {print $1}' file1.csv +banana +pineapple +``` + +### Saving output + +Using output redirection, you can write your results to a file. For example: + + +``` +`$ awk -F, '$3>5 {print $1, $2} colours.csv > output.txt` +``` + +This creates a file with the contents of your awk query. + +You can also split a file into multiple files grouped by column data. For example, if you want to split colours.txt into multiple files according to what color appears in each row, you can cause awk to redirect _per query_ by including the redirection in your awk statement: + + +``` +`$ awk '{print > $2".txt"}' colours.txt` +``` + +This produces files named **yellow.txt**, **red.txt**, and so on. + +In the next article, you'll learn more about fields, records, and some powerful awk variables. + +* * * + +This article is adapted from an episode of [Hacker Public Radio][2], a community technology podcast. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/intro-awk + +作者:[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/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: http://hackerpublicradio.org/eps.php?id=2114 From 711854ed9951646b3074a4dfc03e2127376e78fd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 01:01:01 +0800 Subject: [PATCH 241/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191030=20Test?= =?UTF-8?q?=20automation=20without=20assertions=20for=20web=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191030 Test automation without assertions for web development.md --- ... without assertions for web development.md | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 sources/tech/20191030 Test automation without assertions for web development.md diff --git a/sources/tech/20191030 Test automation without assertions for web development.md b/sources/tech/20191030 Test automation without assertions for web development.md new file mode 100644 index 0000000000..7940402936 --- /dev/null +++ b/sources/tech/20191030 Test automation without assertions for web development.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Test automation without assertions for web development) +[#]: via: (https://opensource.com/article/19/10/test-automation-without-assertions) +[#]: author: (Jeremias Roessler https://opensource.com/users/roesslerj) + +Test automation without assertions for web development +====== +Recheck-web promises the benefits of golden master-based testing without +the drawbacks. +![Coding on a computer][1] + +Graphical user interface (GUI) test automation is broken. Regression testing is not testing; it's version control for a software's behavior. Here's my assertion: test automation _without_ _assertions_ works better! + +In software development and test automation, an assertion is a means to check the result of a calculation, typically by comparing it to a singular expected value. While this is very well suited for unit-based test automation (i.e. testing the system from within), applying it to testing an interface (specifically the user interface) has proven to be problematic, as this post will explain. + +The number of tools that work according to the [golden master][2] approach to testing, characterization testing, and approval testing—such as [Approval Tests][3], [Jest][4], or [recheck-web][5] ([retest][6])—is constantly increasing. This approach promises more robust tests with less effort (for both creation and maintenance) while testing more thoroughly. + +The examples in this article are available on [GitHub][7]. + +### A basic Selenium test + +Here's a simple example of a traditional test running against a web application's login page. Using [Selenium][8] as the testing framework, the code could look like this: + + +``` +public class MySeleniumTest { + +        RemoteWebDriver driver; + +        @Before +        public void setup() { +                driver =  new ChromeDriver(); +        } + +        @Test +        public void login() throws Exception { +                driver.get(""); + +                driver.findElement(By.id("username")).sendKeys("Simon"); +                driver.findElement(By.id("password")).sendKeys("secret"); +                driver.findElement(By.id("sign-in")).click(); + +                assertEquals(driver.findElement(By.tagName("h4")).getText(), "Success!"); +        } + +        @After +        public void tearDown() throws InterruptedException { +                driver.quit(); +        } +} +``` + +This is a very simple test. It opens a specific URL, then finds input fields by their invisible element IDs. It enters the user name and password, then clicks the login button. + +As is currently best practice, this test then uses a unit-test library to check the correct outcome by means of an _assert_ statement. + +In this example, the test determines whether the text "Success!" is displayed. + +You can run the test a few times to verify success, but it's important to experience failure, as well. To create an error, change the HTML of the website being tested. You could, for instance, edit the CSS declaration: + + +``` +`` +``` + +Changing or removing as much as a single character of the URL (e.g. change "main" to "min") changes the website to display as raw HTML without a layout. + +![Website login form displayed as raw HTML][9] + +This small change is definitely an error. However, when the test is executed, it shows no problem and still passes. To outright ignore such a blatant error clearly is not what you would expect of your tests. They should guard against you involuntarily breaking your website after all. + +Now instead, change or remove the element IDs of the input fields. Since these IDs are invisible, this change doesn't have any impact on the website from a user's perspective. But when the test executes, it fails with a **NoSuchElementException**. This essentially means that this irrelevant change _broke the test_. Tests that ignore major changes but fail on invisible and hence irrelevant ones are the current standard in test automation. This is basically the _opposite_ of how a test should behave. + +Now, take the original test and wrap the driver in a RecheckDriver: + + +``` +`driver = new RecheckDriver( new ChromeDriver() );` +``` + +Then either replace the assertion with a call to **driver.capTest();** at the end of the test or add a Junit 5 rule: **@ExtendWith(RecheckExtension.class)**. If you remove the CSS from the website, the test fails, as it should: + +![Failed test][10] + +But if you change or remove the element IDs instead, the test still passes. + +This surprising ability, coming from the "unbreakable" feature of recheck-web, is explained in detail below. This is how a test should behave: detect changes important to the user, and do not break on changes that are irrelevant to the user. + +### How it works + +The [recheck-web][5] project is a free, open source tool that operates on top of Selenium. It is golden master-based, which essentially means that it creates a copy of the rendered website the first time the test is executed, and subsequent runs of the test compare the current state against that copy (the golden master). This is how it can detect that the website has changed in unfavorable ways. It is also how it can still identify an element after its ID has changed: It simply peeks into the golden master (where the ID is still present) and finds the element there. Using additional properties like XPath, HTML name, and CSS classes, recheck-web identifies the element on the changed website and returns it to Selenium. The test can then interact with the element, just as before, and report the change. + +![recheck-web's process][11] + +#### Problems with golden master testing + +Golden master testing, in general, has two essential drawbacks: + + 1. It is often difficult to ignore irrelevant changes. Many changes are not problematic (e.g., date and time changes, random IDs, etc.). For the same reason that Git features the **.gitignore** file, recheck-web features the **recheck.ignore** file. And its Git-like syntax makes it easy to specify which differences to ignore. + 2. It is often cumbersome to maintain redundancy. Golden masters usually have quite an overlap. Often, the same change has to be approved multiple times, nullifying the efficiency gained during the fast test creation. For that, recheck comes complete with its own [command-line interface (CLI)][12] that takes care of this annoying task. The CLI (and the [commercial GUI][13]) lets users easily apply the same change to the same element in all instances or simply apply or ignore all changes at once. + + + +The example above illustrates both drawbacks and their respective solutions: the changed ID was detected, but not reported because the ID attribute in the **recheck.ignore** file was specified to be ignored with **attribute=id**. Removing that rule makes the test fail, but it does not _break_ (the test still executes and reports the changed ID). + +The example test uses the implicit checking mechanism, which automatically checks the result after every action. (Note that if you prefer to do explicit checking (e.g. by calling **re.check**) this is entirely possible.) Opening the URL, entering the user name, and entering the password are three actions that are being performed on the same page, therefore three golden masters are created for the same page. The changed ID thus is reported three times. All three instances can be treated with a single call to **recheck commit --all tests.report** on the command line. Applying the change makes the recheck-web test fail because the ID is removed from the golden master. This calls for anther neat feature of recheck-web: the **retestId**. + +### Virtual constant IDs + +The basic idea of the **retestId** is to introduce an additional attribute in the copy of the website. Since this attribute lives only in the website copy, not on the live site, it can never be affected by a change (unless the element is completely removed). This is called a _virtual constant ID_. + +Now, this **retestId** can be referred to in the test. Simply replace the call to, for instance, **By._id_("username")** with **By._retestId_("username")**, and this problem is solved for good. This also addresses instances where elements are hard to reference because they have no ID to begin with. + +### Filter mechanism + +What would Git be without the **.gitignore** file? Filtering out irrelevant changes is one of the most important features of a version-control system. Traditional assertion-based testing ignores more than 99% of the changes. Instead, similar to Git without a **.gitignore** file, recheck-web reports any and all changes. + +It's up to the user to ignore changes that aren't of interest. Recheck-web can be used for cross-browser testing, cross-device testing, deep visual regression testing, and functional regression testing, depending on what you do or do not ignore. + +The filtering mechanism is as simple (based on the **.gitignore** file) as it is powerful. Single attributes can be filtered globally or for certain elements. Single elements—or even whole parts of the page—can be ignored. If this is not powerful enough, you can implement filter rules in JavaScript to, for example, ignore different URLs with the same base or position differences of less than five pixels. + +A good starting point for understanding this is the [predefined filter files][14] that are distributed with recheck-web. Ignoring element positioning is usually a good idea. If you want to learn more about how to maintain your **recheck.ignore** file or create your own filters, see the [documentation][15]. + +### Summary + +Recheck-web is one of the few golden master-based testing tools available; alternatives include Approval Tests and Jest. + +Recheck-web provides the ability to quickly and easily create tests that are more complete and robust than traditional tests. Because it compares rendered websites (or parts of them) with each other, cross-browser testing, cross-platform testing, and other test scenarios can be realized. Also, this kind of testing is an "enabler" technology that will enable artificial intelligence to generate additional tests. + +Recheck-web is free and open source, so please [try it out][5]. The company's business model is to offer additional services (e.g., storing golden masters and reports as well as an AI to generate tests) and to have a commercial GUI on top of the CLI for maintaining the golden masters. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/test-automation-without-assertions + +作者:[Jeremias Roessler][a] +选题:[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/roesslerj +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://opensource.com/article/19/7/what-golden-image +[3]: https://approvaltests.com +[4]: https://jestjs.io/ +[5]: https://github.com/retest/recheck-web +[6]: http://retest.de +[7]: https://github.com/retest/recheck-web-example +[8]: https://www.seleniumhq.org/ +[9]: https://opensource.com/sites/default/files/uploads/webformerror.png (Website login form displayed as raw HTML) +[10]: https://opensource.com/sites/default/files/uploads/testfails.png (Failed test) +[11]: https://opensource.com/sites/default/files/uploads/recheck-web-process.png (recheck-web's process) +[12]: https://github.com/retest/recheck.cli +[13]: https://retest.de/review/ +[14]: https://github.com/retest/recheck/tree/master/src/main/resources/filter/web +[15]: https://docs.retest.de/recheck/usage/filter From df37879bdb9b210a6ac7e2df3d14db3dd54116a7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 01:01:40 +0800 Subject: [PATCH 242/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191031=20Wirele?= =?UTF-8?q?ss=20noise=20protocol=20can=20extend=20IoT=20range?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191031 Wireless noise protocol can extend IoT range.md --- ...ess noise protocol can extend IoT range.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/talk/20191031 Wireless noise protocol can extend IoT range.md diff --git a/sources/talk/20191031 Wireless noise protocol can extend IoT range.md b/sources/talk/20191031 Wireless noise protocol can extend IoT range.md new file mode 100644 index 0000000000..bafa9c53e1 --- /dev/null +++ b/sources/talk/20191031 Wireless noise protocol can extend IoT range.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Wireless noise protocol can extend IoT range) +[#]: via: (https://www.networkworld.com/article/3449819/wireless-noise-protocol-can-extend-iot-range.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Wireless noise protocol can extend IoT range +====== +On-off noise power communication (ONPC) protocol creates a long-distance carrier of noise energy in Wi-Fi to ping IoT devices. +Thinkstock + +The effective range of [Wi-Fi][1], and other wireless communications used in [Internet of Things][2] networks could be increased significantly by adding wireless noise, say scientists. + +This counter-intuitive solution could extend the range of an off-the-shelf Wi-Fi radio by 73 yards, a group led by Brigham Young University says. Wireless noise, a disturbance in the signal, is usually unwanted. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +The remarkably simple concept sends wireless noise-energy over-the-top of Wi-Fi data traffic in an additional, unrelated channel. That second channel, or carrier, which is albeit at a much lower data rate than the native Wi-Fi, travels further, and when encoded can be used to ping a sensor, say, to find out if the device is alive when the Wi-Fi link itself may have lost association through distance-caused, poor handshaking. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The independent, additional noise channel travels further than the native Wi-Fi. “It works beyond the range of Wi-Fi,” [the scientists say in their paper][5]. + +Applications could be found in hard-to-reach sensor locations where the sensor might still be usefully collecting data, just be offline on the network through an iffy Wi-Fi link. Ones-and-zeroes can be encoded in the add-on channel to switch sensors on and off too. + +### How it works + +The on-off noise power communication (ONPC) protocol, as it’s called, works via a software hack on commodity Wi-Fi access points. Through software, part of the transmitter is converted to an RF power source, and then elements in the receiver are turned into a power measuring device. Noise energy, created by the power source is encoded, emitted and picked up by the measuring setup at the other end. + +“If the access point, [or] router hears this code, it says, ‘OK, I know the sensor is still alive and trying to reach me, it’s just out of range,’” Neal Patwari of Washington University says in a Brigham Young University (BYU) [press release][6]. “It’s basically sending one bit of information that says it’s alive.” + +The noise channel is much leaner than the Wi-Fi one, BYU explains. “While Wi-Fi requires speeds of at least one megabit per second to maintain a signal, ONPC can maintain a signal on as low as one bit per second—one millionth of the data speed required by Wi-Fi.” That’s enough for IoT sensor housekeeping, conceivably. Additionally, “one bit of information is sufficient for many Wi-Fi enabled devices that simply need an on [and] off message,” the school says. It uses the example of an irrigation system. + +Assuring up-time, though, in hard-to-reach, dynamic environments, is where the school got the idea from. Researchers found that they were continually implementing sensors for environmental IoT experiments in hard to reach spots. + +The team use an example of a sensor placed in a student’s bedroom where the occupant had placed a laundry basket in front of the important device. It had blocked the native Wi-Fi signal. The scientists, then, couldn’t get a site appointment for some weeks due to the vagaries of the subject student’s life, and they didn’t know if the trouble issue was sensor or link during that crucial time. ONPC would have allowed them to be reassured that data was still being collected and stored—or not—without the tricky-to-obtain site visit. + +The researchers reckon cellular, [Bluetooth][7] and also [LoRa][8] could use ONPC, too. “We can send and receive data regardless of what Wi-Fi is doing; all we need is the ability to transmit energy and then receive noise measurements,” Phil Lundrigan of BYU says. + +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/3449819/wireless-noise-protocol-can-extend-iot-range.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://www.networkworld.com/article/3258807/what-is-802-11ax-wi-fi-and-what-will-it-mean-for-802-11ac.html +[2]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://dl.acm.org/citation.cfm?id=3345436 +[6]: https://news.byu.edu/byu-created-software-could-significantly-extend-wi-fi-range-for-smart-home-devices +[7]: https://www.networkworld.com/article/3434526/bluetooth-finds-a-role-in-the-industrial-internet-of-things.html +[8]: https://www.networkworld.com/article/3211390/lorawan-key-to-building-full-stack-production-iot-networks.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world From d087df4c286f67c00da3bbf9d5b263998814989e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 01:02:15 +0800 Subject: [PATCH 243/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191031=20Loopin?= =?UTF-8?q?g=20your=20way=20through=20bash?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191031 Looping your way through bash.md --- .../20191031 Looping your way through bash.md | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 sources/tech/20191031 Looping your way through bash.md diff --git a/sources/tech/20191031 Looping your way through bash.md b/sources/tech/20191031 Looping your way through bash.md new file mode 100644 index 0000000000..f53d3c8089 --- /dev/null +++ b/sources/tech/20191031 Looping your way through bash.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Looping your way through bash) +[#]: via: (https://www.networkworld.com/article/3449116/looping-your-way-through-bash.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Looping your way through bash +====== +There are many ways to loop through data in a bash script and on the command line. Which way is best depends on what you're trying to do. +[Alan Levine / Flickr][1] [(CC BY 2.0)][2] + +There are a lot of options for looping in bash whether on the command line or in a script. The choice depends on what you're trying to do. + +You may want to loop indefinitely or quickly run through the days of the week. You might want to loop once for every file in a directory or for every account on a server. You might want to loop through every line in a file or have the number of loops be a choice when the script is run. Let's check out some of the options. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +### Simple loops + +Probably the simplest loop is a **for** loop like the one below. It loops as many times as there are pieces of text on the line. We could as easily loop through the words **cats are smart** as the numbers 1, 2, 3 and 4. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +#!/bin/bash + +for num in 1 2 3 4 +do + echo $num +done +``` + +And, to prove it, here's a similar loop run on the command line: + +``` +$ for word in cats are smart +> do +> echo $word +> done +cats +are +smart +``` + +### for vs while + +Bash provides both a **for** and a **while** looping command. In **while** loops, some condition is tested each time through the loop to determine whether the loop should continue. This example is practically the same as the one before in how it works, but imagine what a difference it would make if we wanted to loop 444 times instead of just 4. + +``` +#!/bin/bash + +n=1 + +while [ $n -le 4 ] +do + echo $n + ((n++)) +done +``` + +### Looping through value ranges + +If you want to loop through every letter of the alphabet or some more restricted range of letters, you can use syntax like this: + +``` +#!/bin/bash + +for x in {a..z} +do + echo $x +done +``` + +If you used **{d..f}**, you would only loop three times. + +### Looping inside loops + +There's also nothing stopping you from looping inside a loop. In this example, we're using a **for** loop inside a **while** loop. + +``` +#!/bin/bash + +n=1 + +while [ $n -lt 6 ] +do + for l in {a..d} + do + echo $n$l + done + ((n++)) +done +``` + +The output would in this example include 1a, 1b, 1c, 1d, 2a and so on, ending at 5d. Note that **((n++))** is used to increment the value of $n so that **while** has a stopping point. + +### Looping through variable data + +If you want to loop through every account on the system, every file in a directory or some other kind of variable data, you can issue a command within your loop to generate the list of values to loop through. In this example, we loop through every account (actually every file) in **/home** – assuming, as we should expect, that there are no other files or directories in **/home**. + +``` +#!/bin/bash + +for user in `ls /home` +do + echo $user +done +``` + +If the command were **date** instead of **ls /home**, we'd run through each of the 7 pieces of text in the output of the date command. + +``` +$ for word in `date` +> do +> echo $word +> done +Thu +31 +Oct +2019 +11:59:59 +PM +EDT +``` + +### Looping by request + +It's also very easy to allow the person running the script to determine how many times a loop should run. If you want to do this, however, you should test the response provided to be sure that it's numeric. This example shows three ways to do that. + +``` +#!/bin/bash + +echo -n "How many times should I say hello? " +read ans + +if [ "$ans" -eq "$ans" ]; then + echo ok1 +fi + +if [[ $ans = *[[:digit:]]* ]]; then + echo ok2 +fi + +if [[ "$ans" =~ ^[0-9]+$ ]]; then + echo ok3 +fi +``` + +The first option above shown might look a little odd, but it works because the **-eq** test only works if the values being compared are numeric. If the test came down to asking if **"f" -eq "f"**, it would fail. The second test uses the bash character class for digits. The third tests the variable to ensure that it contains only digits. + +Of course, once you've selected how you prefer to test a user response to be sure that it's numeric, you need to follow through on the loop. In this next example, we'll print "hello" as many times as the user wants to see it. The **le** does a "less than or equal" test. + +``` +#!/bin/bash + +echo -n "How many times should I say hello? " +read ans + +if [ "$ans" -eq "$ans" ]; then + n=1 + while [ $n -le $ans ] + do + echo hello + ((n++)) + done +fi +``` + +### Looping through the lines in a file + +If you want to loop through the contents of a file line by line (i.e., NOT word by word), you can use a loop like this one: + +``` +#!/bin/bash + +echo -n "File> " +read file +n=0 + +while read line; do + ((n++)) + echo "$n: $line" +done < $file +``` + +The word "line" used in the above script is for clarity, but you could use any variable name. The **while read** and the redirection of the file content on the last line of the script is what provides the line-by-line reading. + +### Looping forever + +If you want to loop forever or until, well, someone gets tired of seeing the script's output and decides to kill it, you can simple use the **while true** syntax. + +``` +#!/bin/bash + +while true +do + echo -n "Still running at " + date + sleep 10 +done +``` + +The examples shown above are basically only (excuse the pun) "shells" for the kind of real work that you might need to do and are meant simply to provide the basic syntax for running undoubtedly far more useful commands. + +### Now see: + +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/3449116/looping-your-way-through-bash.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.flickr.com/photos/cogdog/7778741378/in/photolist-cRo5NE-8HFUGG-e1kzG-4TFXrc-D3mM8-Lzx7h-LzGRB-fN3CY-LzwRo-8mWuUB-2jJ2j8-AABU8-eNrDET-eND7Nj-eND6Co-pNq3ZR-3bndB2-dNobDn-3brHfC-eNrSXv-4z4dNn-R1i2P5-eNDvyQ-agaw5-eND55q-4KQnc9-eXg6mo-eNscpF-eNryR6-dTGEqg-8uq9Wm-eND54j-eNrKD2-cynYp-eNrJsk-eNCSSj-e9uAD5-25xTWb-eNrJ3e-eNCW8s-7nKXtJ-5URF1j-8Y253Z-oaNVEQ-4AUK9b-6SJiLP-7GL54w-25yEqLa-fN3gL-dEgidW +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From d56ceaca38370ac6c49b5984b9e17f3e7bf464cf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 01:03:46 +0800 Subject: [PATCH 244/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191030=20Watson?= =?UTF-8?q?=20IoT=20chief:=20AI=20can=20broaden=20IoT=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191030 Watson IoT chief- AI can broaden IoT services.md --- ... IoT chief- AI can broaden IoT services.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/talk/20191030 Watson IoT chief- AI can broaden IoT services.md diff --git a/sources/talk/20191030 Watson IoT chief- AI can broaden IoT services.md b/sources/talk/20191030 Watson IoT chief- AI can broaden IoT services.md new file mode 100644 index 0000000000..eaab58b886 --- /dev/null +++ b/sources/talk/20191030 Watson IoT chief- AI can broaden IoT services.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Watson IoT chief: AI can broaden IoT services) +[#]: via: (https://www.networkworld.com/article/3449243/watson-iot-chief-ai-can-broaden-iot-services.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Watson IoT chief: AI can broaden IoT services +====== +IBM’s Kareem Yusuf talks smart maintenance systems, workforce expertise and some IoT use cases you might not have thought of. +IBM + +IBM thrives on the complicated, asset-intensive part of the enterprise [IoT][1] market, according to Kareem Yusuf, GM of the company’s Watson IoT business unit. From helping seaports manage shipping traffic to keeping technical knowledge flowing within an organization, Yusuf said that the idea is to teach [artificial intelligence][2] to provide insights from the reams of data generated by such complex systems. + +[Predictive maintenance][3] is probably the headliner in terms of use cases around asset-intensive IoT, and Yusuf said that it’s a much more complicated task than many people might think. It isn’t simply a matter of monitoring, say, pressure levels in a pipe somewhere and throwing an alert when they move outside of norms. It’s about aggregate information on failure rates and asset planning, that a company can have replacements and contingency plans ready for potential failures. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +“It’s less to do with ‘Is that thing going to fail on that day?’ more to do with, because I'm now leveraging all these technologies, I have more insights to make the decision to say, ‘this is my more optimal work-management route,’” he said. “And that’s how I save money.” + +For that to work, of course, AI has to be trained. Yusuf uses the example of a drone-based system to detect worrisome cracks in bridges, a process that usually involves sending technicians out to look at the bridge in person. Allowing AI to differentiate between serious and trivial damage means showing it reams of images of both types, and sourcing that kind of information isn’t always straightforward. + +“So when a client says they want that [service], often clients themselves will say, ‘Here's some training data sets we’d like you to start with,’” he said, noting that there are also open-source and government data sets available for some applications. + +IBM itself collects a huge amount of data from its various AI implementations, and, with the explicit permission of its existing clients, uses some of that information to train new systems that do similar things. + +“You get this kind of collaborative cohesion going on,” said Yusuf. “So when you think about, say[, machine-learning][5] models to help predict foot traffic for space planning and building usage … we can build that against data we have, because we already drive a lot of that kind of test data through our systems.” + +Another non-traditional use case is for the design of something fantastically complicated, like an autonomous car. There are vast amounts of engineering requirements involved in such a process, governing the software, orchestration, hardware specs, regulatory compliance and more. A system with a particular strength in natural-language processing (NLP) could automatically understand what the various requirements actually mean and relate them to one another, detecting conflicts and impossibilities, said Yusuf. + +“We’ve trained up Watson using discovery services and NLP to be able to tell you whether your requirements are clear,” he said. “It will find duplicates or conflicting requirements.” + +Nor is it simply a matter of enabling AI-based IoT systems on the back end. Helping technicians do work is a critical part of IBM’s strategy in the IoT sector, and the company has taken aim at the problem of knowledge transfer via mobility solutions. + +Take, for example, a newer technician dispatched to repair an elevator or other complex piece of machinery. With a mobile assistant app on his or her smartphone, the tech can do more than simply referencing error codes – an AI-driven system can cross reference an error code against the history of a specific elevator, noting what, in the past, has tended to be the root of a given problem, and what needs to be done to fix it. + +The key, said Yusuf, is to enable that kind of functionality without disrupting the standard workflow that’s already in place. + +“When we think about leveraging AI, it has to like seamlessly integrate into the [existing] way of working,” he said. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3449243/watson-iot-chief-ai-can-broaden-iot-services.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/3207535/what-is-iot-how-the-internet-of-things-works.html +[2]: https://www.networkworld.com/article/3243925/artificial-intelligence-may-not-need-networks-at-all.html +[3]: https://www.networkworld.com/article/3340132/why-predictive-maintenance-hasn-t-taken-off-as-expected.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/3202701/the-inextricable-link-between-iot-and-machine-learning.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 037874e62c0a8fec6128ef52b9d0b8b5b27a557d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 01:06:35 +0800 Subject: [PATCH 245/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191031=20A=20Bi?= =?UTF-8?q?rd=E2=80=99s=20Eye=20View=20of=20Big=20Data=20for=20Enterprises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md --- ...-s Eye View of Big Data for Enterprises.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md diff --git a/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md b/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md new file mode 100644 index 0000000000..c62169b830 --- /dev/null +++ b/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Bird’s Eye View of Big Data for Enterprises) +[#]: via: (https://opensourceforu.com/2019/10/a-birds-eye-view-of-big-data-for-enterprises/) +[#]: author: (Swapneel Mehta https://opensourceforu.com/author/swapneel-mehta/) + +A Bird’s Eye View of Big Data for Enterprises +====== + +[![][1]][2] + +_Entrepreneurial decisions are made using data and business acumen. Big Data is today a tool that helps to maximise revenue and customer engagement. Open source tools like Hadoop, Apache Spark and Apache Storm are the popular choices when it comes to analysing Big Data. As the volume and variety of data in the world grows by the day, there is great scope for the discovery of trends as well as for innovation in data analysis and storage._ + +In the past five years, the spate of research focused on machine learning has resulted in a boom in the nature and quality of heterogeneous data sources that are being tapped by providers for their customers. Cheaper compute and widespread storage makes it so much easier to apply bulk data processing techniques, and derive insights from existing and unexplored sources of rich user data including logs and traces of activity whilst using software products. Business decision making and strategy has been primarily dictated by data and is usually supported by business acumen. But in recent times it has not been uncommon to see data providing conclusions seemingly in contrast with conventional business logic. + +One could take the simple example of the baseball movie ‘Moneyball’, in which the protagonist defies all notions of popular wisdom in looking solely at performance statistics to evaluate player viability, eventually building a winning team of players – a team that would otherwise never have come together. The advantage of Big Data for enterprises, then, becomes a no brainer for most corporate entities looking to maximise revenue and engagement. At the back-end, this is accomplished by popular combinations of existing tools specially designed for large scale, multi-purpose data analysis. Apache, Hadoop and Spark are some of the most widespread open source tools used in this space in the industry. Concomitantly, it is easy to imagine that there are a number of software providers offering B2B services to corporate clients looking to outsource specific portions of their analytics. Therefore, there is a bustling market with customisable, proprietary technological solutions in this space as well. + +Traditionally, Big Data refers to the large volumes of unstructured and heterogeneous data that is often subject to processing in order to provide insights and improve decision-making regarding critical business processes. The McKinsey Global institute estimates that data volumes have been growing at 40 per cent per year and will grow 44x between the years 2009 and 2020. But there is more to Big Data than just its immense volume. The rate of data production is an important factor given that smaller data streams generated at faster rates produce larger pools than their counterparts. Social media is a great example of how small networks can expand rapidly to become rich sources of information — up to massive, billion-node scales. + +Structure in data is a highly variable attribute given that data is now extracted from across the entire spectrum of user activity. Conventional formats of storage, including relational databases, have been virtually replaced by massively unstructured data pools designed to be leveraged in manners unique to their respective use cases. In fact, there has been a huge body of work on data storage in order to leverage various write formats, compression algorithms, access methods and data structures to arrive at the best combination for improving productivity of the workflow reliant on that data. A variety of these combinations has emerged to set the industry standards in their respective verticals, with the benefits ranging from efficient storage to faster access. + +Finally, we have the latent value in these data pools that remains to be exploited by the use of emerging trends in artificial intelligence and machine learning. Personalised advertising recommendations are a huge factor driving revenue for social media giants like Facebook and companies like Google that offer a suite of products and an ecosystem to use them. The well-known Silicon Valley giant started out as a search provider, but now controls a host of apps and most of the entry points for the data generated in the course of people using a variety of electronic devices across the world. Established financial institutions are now exploring the possibility of a portion of user data being put on an immutable public ledger to introduce a blockchain-like structure that can open the doors to innovation. The pace is picking up as product offerings improve in quality and expand in variety. Let’s get a bird’s eye view of this subject to understand where the market stands. + +The idea behind building better frameworks is increasingly turning into a race to provide more add-on features and simplify workflows for the end user to engage with. This means the categories have many blurred lines because most products and tools present themselves as end-to-end platforms to manage Big Data analytics. However, we’ll attempt to divide this broadly into a few categories and examine some providers in each of these. + +**Big Data storage and processing** +Infrastructure is the key to building a reliable workflow when it comes to enterprise use cases. Earlier, relational databases were worthwhile to invest in for small and mid-sized firms. However, when the data starts pouring in, it is usually the scalability that is put to the test first. Building a flexible infrastructure comes at the cost of complexity. It is likely to have more moving parts that can cause failure in the short-term. However, if done right – something that will not be easy because it has to be tailored exactly to your company – it can result in life-changing improvements for both users and the engineers working with the said infrastructure to build and deliver state-of-the-art products. + +There are many alternatives to SQL, with the NoSQL paradigm being adopted and modified for building different types of systems. Cassandra, MongoDB and CouchDB are some well-known alternatives. Most emerging options can be distinguished based on their disruption, which is aimed at the fundamental ACID properties of databases. To recall, a transaction in a database system must maintain atomicity, consistency, isolation, and durability − commonly known as ACID properties − in order to ensure accuracy, completeness, and data integrity (from Tutorialspoint). For instance, CockroachDB, an open source offshoot of Google’s Spanner database system, has gained traction due to its support for being distributed. Redis and HBase offer a sort of hybrid storage solution while Neo4j remains a flag bearer for graph structured databases. However, traditional areas aside, there are always new challenges on the horizon for building enterprise software. + +![Figure 1: A crowded landscape to follow \(Source: Forbes\)][3] + +Backups are one such area where startups have found viable disruption points to enter the market. Cloud backups for enterprise software are expensive, non-trivial procedures and offloading this work to proprietary software offers a lucrative business opportunity. Rubrik and Cohesity are two companies that originally started out in this space and evolved to offer added services atop their primary offerings. Clumio is a recent entrant, purportedly creating a data fabric that the promoters expect will serve as a foundational layer to run analytics on top of. It is interesting to follow recent developments in this burgeoning space as we see competitors enter the market and attempt to carve a niche for themselves with their product offerings. + +**Big Data analytics in the cloud** +Apache Hadoop remains the popular choice for many organisations. However, many successors have emerged to offer a set of additional analytical capabilities: Apache Spark, commonly hailed as an improvement to the Hadoop ecosystem; Apache Storm that offers real-time data processing capabilities; and Google’s BigQuery, which is supposedly a full-fledged platform for Big Data analytics. + +Typically, cloud providers such as Amazon Web Services and Google Cloud Platform tend to build in-house products leveraging these capabilities, or replicate them entirely and offer them as hosted services to businesses. This helps them provide enterprise offerings that are closely integrated within their respective cloud computing ecosystem. There has been some discussion about the moral consequences of replicating open source products to profit off closed source versions of the same, but there has been no consensus on the topic, nor any severe consequences suffered on account of this questionable approach to boost revenue. + +Another hosted service offering a plethora of Big Data analytics tools is Cloudera which has an established track record in the market. It has been making waves since its merger with Hortonworks earlier this year, giving it added fuel to compete with the giants in its bid to become the leading enterprise cloud provider in the market. + +Overall, we’ve seen interesting developments in the Big Data storage and analysis domain and as the volume and variety of data grows, so do the opportunities to innovate in the field. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/a-birds-eye-view-of-big-data-for-enterprises/ + +作者:[Swapneel Mehta][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/swapneel-mehta/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-Big-Data-analytics-and-processing-for-the-enterprise.jpg?resize=696%2C449&ssl=1 (Figure 1 Big Data analytics and processing for the enterprise) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-1-Big-Data-analytics-and-processing-for-the-enterprise.jpg?fit=900%2C580&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Figure-2-A-crowded-landscape-to-follow.jpg?resize=350%2C254&ssl=1 From 38c0fa889d85d5e7f8d18e03d6e020c9035f32b4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 1 Nov 2019 01:07:19 +0800 Subject: [PATCH 246/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191031=20The=20?= =?UTF-8?q?Best=20Reasons=20To=20Use=20Enterprise=20Network=20Management?= =?UTF-8?q?=20Software?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191031 The Best Reasons To Use Enterprise Network Management Software.md --- ... Enterprise Network Management Software.md | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 sources/talk/20191031 The Best Reasons To Use Enterprise Network Management Software.md diff --git a/sources/talk/20191031 The Best Reasons To Use Enterprise Network Management Software.md b/sources/talk/20191031 The Best Reasons To Use Enterprise Network Management Software.md new file mode 100644 index 0000000000..654078f72a --- /dev/null +++ b/sources/talk/20191031 The Best Reasons To Use Enterprise Network Management Software.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Best Reasons To Use Enterprise Network Management Software) +[#]: via: (https://opensourceforu.com/2019/10/the-best-reasons-to-use-enterprise-network-management-software/) +[#]: author: (Ruby Hamilton https://opensourceforu.com/author/ruby-hamilton/) + +The Best Reasons To Use Enterprise Network Management Software +====== + +[![][1]][2] + +_Your company has workers in the field all day every day. You have sent them out with tablets, phones, and minicomputers, but you need to connect these devices back to the home network. When you begin shopping for enterprise software, you will find that it should provide you with all five benefits listed below. You can reorganize your business, streamline all the things that you do, and reduce the headaches that come along with mobile device management._ + +**1\. Increased Security** + +When you begin shopping for [_Micro Focus enterprise network management software_][3], you will improve security instantly. Devices that are not managed are inherently unsafe. The device becomes a security risk every time it logs on to a new WiFi network or it uses Bluetooth in a new place. + +If a hacker wanted access to your network, they could hack a mobile device for each access. You may have staff members who use Bluetooth, and Bluetooth could cause security concerns for you. This is especially important if your company has a lot of sensitive information on each device. + +**2\. Easier Workflow** + +Workflow improves instantly when all your mobile devices are connected. Your staff can access all their assignments, appointments, and numbers for the day. You can send messages to your staff, and you can check on their progress using the enterprise software. Your staff members can ask you questions through the system instead of sending emails that are too difficult to check. Plus, you can hand out only mobile devices so that your staff members are not carrying too many devices. + +If your staff members need to communicate with each other to complete a project, they can share information with ease. You can load all your manuals and pricing charts so that your staff can access this information, and you can offer fast service to each customer. Your company can use its quick service and abundance of information as selling points for customers. + +**3\. Your Staff Can Go Anywhere** + +Your staff can go anywhere while still working diligently. The phone, tablet, or computer that they are using will still receive all the information that you would get if you were in the office. You can send your staff on trips to work on behalf of the company, and they will have all the information that is required to handle big projects. + +When your staff members need to present information to clients, they can pull that information from the cloud on their devices. This is a much easier way for you to store information, and you do not need to carry a massive laptop around. Plus, you can give everyone on your staff a mobile device instead of filling your office with clunky computers. + +**4\. Lower Costs** + +The [_enterprise software_][4] that you use will instantly lower your costs. You save time when managing these devices because the software does so much of it for you. You do not lose money due to hacking, and you can create reports from the information on each device. + +Your company will spend less time selling new services or products to customers, and you will find that the devices last longer because they are consistently updated. The software is updated online when the developer builds a new version, and you can hand out just one device to everyone on your staff. There is no need for you to spend extra money on new devices, extra security software, or more man-hours. + +**5\. Lower IT Demands** + +Your IT team is not swamped by the amount of activity on your network. When your IT demands are lower, your carbon footprint drops. The servers in your office will not work as hard as they once did, and you can easily upgrade your servers without bogging them down with information. + +The enterprise system can clean up junk files on every device, and you will not need to hire extra people in the IT department just to manage these devices. It is very easy for you to maintain the IT network, and you will save money on hardware. If your company has a small budget, you need to use the enterprise system to cut back on costs. + +**Conclusion** + +It is very easy for you to install enterprise software when your company is using mobile devices every day. The best part of using enterprise software is that you can streamline what you do, only use mobile devices, and reduce your costs over time. You can send your staff into the field with mobile devices, and you also have the capacity to send information to your staff instead of forcing them to use papers all day every day. You can save money on devices, and you can maintain your system using the software instead of forcing your IT team to do all the work for you. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/the-best-reasons-to-use-enterprise-network-management-software/ + +作者:[Ruby Hamilton][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/ruby-hamilton/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2016/08/Computer-network-connectivity.jpg?resize=696%2C391&ssl=1 (Computer network connectivity) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2016/08/Computer-network-connectivity.jpg?fit=800%2C449&ssl=1 +[3]: https://www.microfocus.com/en-us/products/network-operations-management-suite/overview +[4]: https://en.wikipedia.org/wiki/Enterprise_software From 50bda0a544f153fc69079bda6bbf4dc3f9addb4d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 1 Nov 2019 06:54:26 +0800 Subject: [PATCH 247/800] PRF --- ... An OS Created to Run After the World Ends.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md index c539ee20c0..dcc27aa82d 100644 --- a/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md +++ b/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md @@ -10,13 +10,13 @@ Collapse OS:为世界末日创建的操作系统 ====== -当大多数人考虑为末日后的世界做准备时,想到的第一件事就是准备食物和其他生活必需品。最近,有一个程序员觉得,在社会崩溃之后,创建一个多功能的、且可生存的操作系统同样重要。我们今天将尽我们所能地来看看它。 +当大多数人考虑为末日后的世界做准备时,想到的第一件事就是准备食物和其他生活必需品。最近,有一个程序员觉得,在社会崩溃之后,创建一个多功能的、且可生存的操作系统同样重要。我们今天将尽我们所能地来了解一下它。 ### Collapse OS:当文明被掩埋在垃圾中 ![][1] -这里说的操作系统称为 [Collapse OS(崩溃操作系统)][2]。根据该网站的说法,Collapse OS 是 “z80 内核以及一系列程序、工具和文档的集合”。 它可以让你: +这里说的操作系统称为 [Collapse OS(崩溃操作系统)][2]。根据该官方网站的说法,Collapse OS 是 “z80 内核以及一系列程序、工具和文档的集合”。 它可以让你: * 可在最小的和临时拼凑的机器上运行。 * 通过临时拼凑的方式(串行、键盘、显示)进行接口。 @@ -25,13 +25,13 @@ Collapse OS:为世界末日创建的操作系统 * 从各种存储设备读取和写入。 * 自我复制。 -其创造者 [Virgil Dupras][3] 之所以开始这个项目,是因为[他认为][4]“我们的全球供应链在我们到达 2030 年之前就会崩溃”。他根据巴勃罗·塞维尼Pablo Servigne的作品得出了这一结论。他似乎了解并非所有人都会认可[他的观点][4],“话虽如此,我认为不相信到 2030 年可能会发生崩溃也是可以理解的,所以请不要为我的信念而感到受到了攻击。” +其创造者 [Virgil Dupras][3] 之所以开始这个项目,是因为[他认为][4]“我们的全球供应链在我们到达 2030 年之前就会崩溃”。他是根据巴勃罗·塞维尼Pablo Servigne的作品得出了这一结论的。他似乎也觉得并非所有人都会认可[他的观点][4],“话虽如此,我认为不相信到 2030 年可能会发生崩溃也是可以理解的,所以请不要为我的信念而感到受到了冲击。” -该项目的总体目标是迅速让瓦解崩溃后的文明重新回到计算机时代。电子产品的生产取决于非常复杂的供应链。一旦供应链崩溃,人类将回到一个技术水平较低的时代。要恢复我们以前的技术水平,将需要数十年的时间。Dupras 希望通过创建一个生态系统来跨越几个步骤,该生态系统将与可以从各种来源搜寻到的更简单的芯片一起工作。 +该项目的总体目标是迅速让瓦解崩溃后的文明重新回到计算机时代。电子产品的生产取决于非常复杂的供应链。一旦供应链崩溃,人类将回到一个技术水平较低的时代。要恢复我们以前的技术水平,将需要数十年的时间。Dupras 希望通过创建一个生态系统来跨越几个步骤,该生态系统将与从各种来源搜寻到的更简单的芯片一起工作。 ### z80 是什么? -最初的 Collapse OS 内核是为 [z80 芯片][5]编写的。作为复古的计算机历史爱好者,我对 [Zilog][6] 和 z80 芯片很熟悉。在 1970 年代后期,Zilog 公司推出了 z80,以和 [Intel 的 8080][7] CPU 竞争。z80 被用于许多早期的个人计算机中,例如 [Sinclair ZX Spectrum][8] 和 [Tandy TRS-80][9]。这些系统中的大多数使用了 [CP/M 操作系统] [10],这是当时最流行的操作系统。(有趣的是,Dupras 最初希望使用[一个开源版本的 CP/M][11],但最终决定[从头开始][12]。) +最初的 Collapse OS 内核是为 [z80 芯片][5]编写的。作为复古计算机历史的爱好者,我对 [Zilog][6] 和 z80 芯片很熟悉。在 1970 年代后期,Zilog 公司推出了 z80,以和 [Intel 的 8080][7] CPU 竞争。z80 被用于许多早期的个人计算机中,例如 [Sinclair ZX Spectrum][8] 和 [Tandy TRS-80][9]。这些系统中的大多数使用了 [CP/M 操作系统] [10],这是当时最流行的操作系统。(有趣的是,Dupras 最初希望使用[一个开源版本的 CP/M][11],但最终决定[从头开始][12]。) 在 1981 年 [IBM PC][13] 发布之后,z80 和 CP/M 的普及率开始下降。Zilog 确实发布了其它几种微处理器(Z8000 和 Z80000),但并没有获得成功。该公司将重点转移到了微控制器上。今天,更新后的 z80 后代产品可以在图形计算器、嵌入式设备和消费电子产品中找到。 @@ -39,14 +39,14 @@ Dupras 在 [Reddit][14] 上说,他为 z80 编写了 Collapse OS,因为“它 ### 该项目的当前状态和未来发展 -Collapse OS 的起步相当不错。有足够的内存和存储空间它就可以进行自我复制。它可以在 [RC2014 家用计算机][15]或世嘉 Master System / MegaDrive(Genesis)上运行。它可以读取 SD 卡。它有一个简单的文本编辑器。其内核由与粘合代码相连接的模块组成。这是为了使系统具有灵活性和适应性。 +Collapse OS 的起步相当不错。有足够的内存和存储空间它就可以进行自我复制。它可以在 [RC2014 家用计算机][15]或世嘉 Master System / MegaDrive(Genesis)上运行。它可以读取 SD 卡。它有一个简单的文本编辑器。其内核由用粘合代码连接起来的模块组成。这是为了使系统具有灵活性和适应性。 还有一个详细的[路线图][16]列出了该项目的方向。列出的目标包括: * 支持其他 CPU,例如 8080 和 [6502][17]。 * 支持临时拼凑的外围设备,例如 LCD 屏幕、电子墨水显示器和 [ACIA 设备][18]。 * 支持更多的存储方式,例如软盘、CD、SPI RAM/ROM 和 AVR MCU。 -* 使它可以在其他 z80 机器上工作,例如 [TI-83+][19] 和 [TI-84+][20 ]图形计算器和 TRS-80s。 +* 使它可以在其他 z80 机器上工作,例如 [TI-83+][19] 和 [TI-84+][20] 图形计算器和 TRS-80s。 如果你有兴趣帮助或只是想窥视一下这个项目,请访问其 [GitHub 页面][21]。 @@ -56,7 +56,7 @@ Collapse OS 的起步相当不错。有足够的内存和存储空间它就可 与 Dupras 相反,我最担心的是[电磁脉冲炸弹(EMP)][22] 的使用。这些东西会炸毁所有的电气系统,这意味着将没有任何构建系统的可能。如果没有发生这种事情,我想我们将能够找到过去 30 年制造的那么多的 x86 组件,以保持它们运行下去。 -话虽如此,对于那些喜欢为奇奇怪怪的应用编写低级代码的人来说,Collapse OS 听起来是一个有趣且具有度挑战性的项目。如果你是这样的人,去检出 [Collapse OS][2] 代码吧。 +话虽如此,对于那些喜欢为奇奇怪怪的应用编写低级代码的人来说,Collapse OS 听起来是一个有趣且具有高度挑战性的项目。如果你是这样的人,去检出 [Collapse OS][2] 代码吧。 让我提个假设的问题:你选择的世界末日操作系统是什么?请在下面的评论中告诉我们。 From 1c3e12c414b67caf8302fa29b36461fb00551145 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 1 Nov 2019 06:55:06 +0800 Subject: [PATCH 248/800] PUB @wxy https://linux.cn/article-11525-1.html --- ...Collapse OS - An OS Created to Run After the World Ends.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191029 Collapse OS - An OS Created to Run After the World Ends.md (98%) diff --git a/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/published/20191029 Collapse OS - An OS Created to Run After the World Ends.md similarity index 98% rename from translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md rename to published/20191029 Collapse OS - An OS Created to Run After the World Ends.md index dcc27aa82d..9044248779 100644 --- a/translated/tech/20191029 Collapse OS - An OS Created to Run After the World Ends.md +++ b/published/20191029 Collapse OS - An OS Created to Run After the World Ends.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11525-1.html) [#]: subject: (Collapse OS – An OS Created to Run After the World Ends) [#]: via: (https://itsfoss.com/collapse-os/) [#]: author: (John Paul https://itsfoss.com/author/john/) From 21465f4f9934033e81222038b35b7374429140ce Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 1 Nov 2019 06:57:22 +0800 Subject: [PATCH 249/800] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201910?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ging Digital Files (e.g., Photographs) in Files and Folders.md | 0 .../{ => 201910}/20180706 Building a Messenger App- OAuth.md | 0 .../{ => 201910}/20180906 What a shell dotfile can do for you.md | 0 ... Linux Distros- Before Mainstream Distros Became So Popular.md | 0 .../20190301 Guide to Install VMware Tools on Linux.md | 0 .../20190320 Move your dotfiles to version control.md | 0 .../20190404 How writers can get work done better with Git.md | 0 ...lockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md | 0 published/{ => 201910}/20190614 What is a Java constructor.md | 0 published/{ => 201910}/20190627 RPM packages explained.md | 0 ...n how to Record and Replay Linux Terminal Sessions Activity.md | 0 published/{ => 201910}/20190719 Buying a Linux-ready laptop.md | 0 .../20190805 How to Install and Configure PostgreSQL on Ubuntu.md | 0 .../20190809 Mutation testing is the evolution of TDD.md | 0 ...sed Open Source Tablet is in Making and it-s Called CutiePi.md | 0 .../20190823 The lifecycle of Linux kernel testing.md | 0 .../20190824 How to compile a Linux kernel in the 21st century.md | 0 .../20190826 Introduction to the Linux chown command.md | 0 .../{ => 201910}/20190830 How to Install Linux on Intel NUC.md | 0 .../20190901 Best Linux Distributions For Everyone in 2019.md | 0 .../{ => 201910}/20190911 4 open source cloud security tools.md | 0 ...916 Copying large files with Rsync, and some misconceptions.md | 0 ...0190916 Linux commands to display your hardware information.md | 0 .../{ => 201910}/20190918 Adding themes and plugins to Zsh.md | 0 .../20190920 Hone advanced Bash skills by building Minesweeper.md | 0 ...lation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md | 0 ...190923 Mutation testing by example- How to leverage failure.md | 0 published/{ => 201910}/20190924 Fedora and CentOS Stream.md | 0 ...0924 How DevOps professionals can become security champions.md | 0 ...ava still relevant, Linux desktop, and more industry trends.md | 0 ...924 Mutation testing by example- Failure as experimentation.md | 0 .../20190925 3 quick tips for working with Linux files.md | 0 .../20190925 Essential Accessories for Intel NUC Mini PC.md | 0 ... Mirror your Android screen on your computer with Guiscrcpy.md | 0 ...926 How to Execute Commands on Remote Linux System over SSH.md | 0 ...You Can Now Use OneDrive in Linux Natively Thanks to Insync.md | 0 .../20190927 CentOS 8 Installation Guide with Screenshots.md | 0 ...0929 Bash Script to Generate System Uptime Reports on Linux.md | 0 ...0190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md | 0 ...20191002 3 command line games for learning Bash the fun way.md | 0 .../20191002 7 Bash history shortcuts you will actually use.md | 0 .../20191003 How to Run the Top Command in Batch Mode.md | 0 published/{ => 201910}/20191004 9 essential GNU binutils tools.md | 0 ...0191004 All That You Can Do with Google Analytics, and More.md | 0 .../{ => 201910}/20191004 In Fedora 31, 32-bit i686 is 86ed.md | 0 ...005 Use GameHub to Manage All Your Linux Games in One Place.md | 0 ...ow to Install and Configure VNC Server on Centos 8 - RHEL 8.md | 0 published/{ => 201910}/20191007 IceWM - A really cool desktop.md | 0 .../20191008 7 steps to securing your Linux server.md | 0 .../{ => 201910}/20191008 How to manage Go projects with GVM.md | 0 ...ne quick tips- Locate and process files with find and xargs.md | 0 .../20191009 Top 10 open source video players for Linux.md | 0 ...191010 DevSecOps pipelines and tools- What you need to know.md | 0 .../20191010 Viewing files and processes as trees on Linux.md | 0 ...91011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md | 0 .../20191011 How to use IoT devices to keep children safe.md | 0 .../20191013 Object-Oriented Programming and Essential State.md | 0 .../20191014 Use sshuttle to build a poor man-s VPN.md | 0 ...Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md | 0 ...1015 4 Free and Open Source Alternatives to Adobe Photoshop.md | 0 ...Script to Delete Files-Folders Older Than -X- Days in Linux.md | 0 ...0191016 Linux sudo flaw can lead to unauthorized privileges.md | 0 ...191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md | 0 ...netes networking, OpenStack Train, and more industry trends.md | 0 .../20191021 Pylint- Making your Python code consistent.md | 0 published/{ => 201910}/20191021 Transition to Nftables.md | 0 .../20191022 How to Get the Size of a Directory in Linux.md | 0 ...1023 Building container images with the ansible-bender tool.md | 0 .../{ => 201910}/20191023 Using SSH port forwarding on Fedora.md | 0 ... 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md | 0 published/{ => 201910}/20191029 Fedora 31 is officially here.md | 0 71 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201910}/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md (100%) rename published/{ => 201910}/20180706 Building a Messenger App- OAuth.md (100%) rename published/{ => 201910}/20180906 What a shell dotfile can do for you.md (100%) rename published/{ => 201910}/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md (100%) rename published/{ => 201910}/20190301 Guide to Install VMware Tools on Linux.md (100%) rename published/{ => 201910}/20190320 Move your dotfiles to version control.md (100%) rename published/{ => 201910}/20190404 How writers can get work done better with Git.md (100%) rename published/{ => 201910}/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md (100%) rename published/{ => 201910}/20190614 What is a Java constructor.md (100%) rename published/{ => 201910}/20190627 RPM packages explained.md (100%) rename published/{ => 201910}/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md (100%) rename published/{ => 201910}/20190719 Buying a Linux-ready laptop.md (100%) rename published/{ => 201910}/20190805 How to Install and Configure PostgreSQL on Ubuntu.md (100%) rename published/{ => 201910}/20190809 Mutation testing is the evolution of TDD.md (100%) rename published/{ => 201910}/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md (100%) rename published/{ => 201910}/20190823 The lifecycle of Linux kernel testing.md (100%) rename published/{ => 201910}/20190824 How to compile a Linux kernel in the 21st century.md (100%) rename published/{ => 201910}/20190826 Introduction to the Linux chown command.md (100%) rename published/{ => 201910}/20190830 How to Install Linux on Intel NUC.md (100%) rename published/{ => 201910}/20190901 Best Linux Distributions For Everyone in 2019.md (100%) rename published/{ => 201910}/20190911 4 open source cloud security tools.md (100%) rename published/{ => 201910}/20190916 Copying large files with Rsync, and some misconceptions.md (100%) rename published/{ => 201910}/20190916 Linux commands to display your hardware information.md (100%) rename published/{ => 201910}/20190918 Adding themes and plugins to Zsh.md (100%) rename published/{ => 201910}/20190920 Hone advanced Bash skills by building Minesweeper.md (100%) rename published/{ => 201910}/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md (100%) rename published/{ => 201910}/20190923 Mutation testing by example- How to leverage failure.md (100%) rename published/{ => 201910}/20190924 Fedora and CentOS Stream.md (100%) rename published/{ => 201910}/20190924 How DevOps professionals can become security champions.md (100%) rename published/{ => 201910}/20190924 Java still relevant, Linux desktop, and more industry trends.md (100%) rename published/{ => 201910}/20190924 Mutation testing by example- Failure as experimentation.md (100%) rename published/{ => 201910}/20190925 3 quick tips for working with Linux files.md (100%) rename published/{ => 201910}/20190925 Essential Accessories for Intel NUC Mini PC.md (100%) rename published/{ => 201910}/20190925 Mirror your Android screen on your computer with Guiscrcpy.md (100%) rename published/{ => 201910}/20190926 How to Execute Commands on Remote Linux System over SSH.md (100%) rename published/{ => 201910}/20190926 You Can Now Use OneDrive in Linux Natively Thanks to Insync.md (100%) rename published/{ => 201910}/20190927 CentOS 8 Installation Guide with Screenshots.md (100%) rename published/{ => 201910}/20190929 Bash Script to Generate System Uptime Reports on Linux.md (100%) rename published/{ => 201910}/20190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md (100%) rename published/{ => 201910}/20191002 3 command line games for learning Bash the fun way.md (100%) rename published/{ => 201910}/20191002 7 Bash history shortcuts you will actually use.md (100%) rename published/{ => 201910}/20191003 How to Run the Top Command in Batch Mode.md (100%) rename published/{ => 201910}/20191004 9 essential GNU binutils tools.md (100%) rename published/{ => 201910}/20191004 All That You Can Do with Google Analytics, and More.md (100%) rename published/{ => 201910}/20191004 In Fedora 31, 32-bit i686 is 86ed.md (100%) rename published/{ => 201910}/20191005 Use GameHub to Manage All Your Linux Games in One Place.md (100%) rename published/{ => 201910}/20191006 How to Install and Configure VNC Server on Centos 8 - RHEL 8.md (100%) rename published/{ => 201910}/20191007 IceWM - A really cool desktop.md (100%) rename published/{ => 201910}/20191008 7 steps to securing your Linux server.md (100%) rename published/{ => 201910}/20191008 How to manage Go projects with GVM.md (100%) rename published/{ => 201910}/20191009 Command line quick tips- Locate and process files with find and xargs.md (100%) rename published/{ => 201910}/20191009 Top 10 open source video players for Linux.md (100%) rename published/{ => 201910}/20191010 DevSecOps pipelines and tools- What you need to know.md (100%) rename published/{ => 201910}/20191010 Viewing files and processes as trees on Linux.md (100%) rename published/{ => 201910}/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md (100%) rename published/{ => 201910}/20191011 How to use IoT devices to keep children safe.md (100%) rename published/{ => 201910}/20191013 Object-Oriented Programming and Essential State.md (100%) rename published/{ => 201910}/20191014 Use sshuttle to build a poor man-s VPN.md (100%) rename published/{ => 201910}/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md (100%) rename published/{ => 201910}/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md (100%) rename published/{ => 201910}/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md (100%) rename published/{ => 201910}/20191016 Linux sudo flaw can lead to unauthorized privileges.md (100%) rename published/{ => 201910}/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md (100%) rename published/{ => 201910}/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md (100%) rename published/{ => 201910}/20191021 Pylint- Making your Python code consistent.md (100%) rename published/{ => 201910}/20191021 Transition to Nftables.md (100%) rename published/{ => 201910}/20191022 How to Get the Size of a Directory in Linux.md (100%) rename published/{ => 201910}/20191023 Building container images with the ansible-bender tool.md (100%) rename published/{ => 201910}/20191023 Using SSH port forwarding on Fedora.md (100%) rename published/{ => 201910}/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md (100%) rename published/{ => 201910}/20191029 Fedora 31 is officially here.md (100%) diff --git a/published/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md b/published/201910/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md similarity index 100% rename from published/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md rename to published/201910/20140510 Managing Digital Files (e.g., Photographs) in Files and Folders.md diff --git a/published/20180706 Building a Messenger App- OAuth.md b/published/201910/20180706 Building a Messenger App- OAuth.md similarity index 100% rename from published/20180706 Building a Messenger App- OAuth.md rename to published/201910/20180706 Building a Messenger App- OAuth.md diff --git a/published/20180906 What a shell dotfile can do for you.md b/published/201910/20180906 What a shell dotfile can do for you.md similarity index 100% rename from published/20180906 What a shell dotfile can do for you.md rename to published/201910/20180906 What a shell dotfile can do for you.md diff --git a/published/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md b/published/201910/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md similarity index 100% rename from published/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md rename to published/201910/20190214 The Earliest Linux Distros- Before Mainstream Distros Became So Popular.md diff --git a/published/20190301 Guide to Install VMware Tools on Linux.md b/published/201910/20190301 Guide to Install VMware Tools on Linux.md similarity index 100% rename from published/20190301 Guide to Install VMware Tools on Linux.md rename to published/201910/20190301 Guide to Install VMware Tools on Linux.md diff --git a/published/20190320 Move your dotfiles to version control.md b/published/201910/20190320 Move your dotfiles to version control.md similarity index 100% rename from published/20190320 Move your dotfiles to version control.md rename to published/201910/20190320 Move your dotfiles to version control.md diff --git a/published/20190404 How writers can get work done better with Git.md b/published/201910/20190404 How writers can get work done better with Git.md similarity index 100% rename from published/20190404 How writers can get work done better with Git.md rename to published/201910/20190404 How writers can get work done better with Git.md diff --git a/published/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md b/published/201910/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md similarity index 100% rename from published/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md rename to published/201910/20190513 Blockchain 2.0 - Introduction To Hyperledger Fabric -Part 10.md diff --git a/published/20190614 What is a Java constructor.md b/published/201910/20190614 What is a Java constructor.md similarity index 100% rename from published/20190614 What is a Java constructor.md rename to published/201910/20190614 What is a Java constructor.md diff --git a/published/20190627 RPM packages explained.md b/published/201910/20190627 RPM packages explained.md similarity index 100% rename from published/20190627 RPM packages explained.md rename to published/201910/20190627 RPM packages explained.md diff --git a/published/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md b/published/201910/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md similarity index 100% rename from published/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md rename to published/201910/20190701 Learn how to Record and Replay Linux Terminal Sessions Activity.md diff --git a/published/20190719 Buying a Linux-ready laptop.md b/published/201910/20190719 Buying a Linux-ready laptop.md similarity index 100% rename from published/20190719 Buying a Linux-ready laptop.md rename to published/201910/20190719 Buying a Linux-ready laptop.md diff --git a/published/20190805 How to Install and Configure PostgreSQL on Ubuntu.md b/published/201910/20190805 How to Install and Configure PostgreSQL on Ubuntu.md similarity index 100% rename from published/20190805 How to Install and Configure PostgreSQL on Ubuntu.md rename to published/201910/20190805 How to Install and Configure PostgreSQL on Ubuntu.md diff --git a/published/20190809 Mutation testing is the evolution of TDD.md b/published/201910/20190809 Mutation testing is the evolution of TDD.md similarity index 100% rename from published/20190809 Mutation testing is the evolution of TDD.md rename to published/201910/20190809 Mutation testing is the evolution of TDD.md diff --git a/published/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md b/published/201910/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md similarity index 100% rename from published/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md rename to published/201910/20190822 A Raspberry Pi Based Open Source Tablet is in Making and it-s Called CutiePi.md diff --git a/published/20190823 The lifecycle of Linux kernel testing.md b/published/201910/20190823 The lifecycle of Linux kernel testing.md similarity index 100% rename from published/20190823 The lifecycle of Linux kernel testing.md rename to published/201910/20190823 The lifecycle of Linux kernel testing.md diff --git a/published/20190824 How to compile a Linux kernel in the 21st century.md b/published/201910/20190824 How to compile a Linux kernel in the 21st century.md similarity index 100% rename from published/20190824 How to compile a Linux kernel in the 21st century.md rename to published/201910/20190824 How to compile a Linux kernel in the 21st century.md diff --git a/published/20190826 Introduction to the Linux chown command.md b/published/201910/20190826 Introduction to the Linux chown command.md similarity index 100% rename from published/20190826 Introduction to the Linux chown command.md rename to published/201910/20190826 Introduction to the Linux chown command.md diff --git a/published/20190830 How to Install Linux on Intel NUC.md b/published/201910/20190830 How to Install Linux on Intel NUC.md similarity index 100% rename from published/20190830 How to Install Linux on Intel NUC.md rename to published/201910/20190830 How to Install Linux on Intel NUC.md diff --git a/published/20190901 Best Linux Distributions For Everyone in 2019.md b/published/201910/20190901 Best Linux Distributions For Everyone in 2019.md similarity index 100% rename from published/20190901 Best Linux Distributions For Everyone in 2019.md rename to published/201910/20190901 Best Linux Distributions For Everyone in 2019.md diff --git a/published/20190911 4 open source cloud security tools.md b/published/201910/20190911 4 open source cloud security tools.md similarity index 100% rename from published/20190911 4 open source cloud security tools.md rename to published/201910/20190911 4 open source cloud security tools.md diff --git a/published/20190916 Copying large files with Rsync, and some misconceptions.md b/published/201910/20190916 Copying large files with Rsync, and some misconceptions.md similarity index 100% rename from published/20190916 Copying large files with Rsync, and some misconceptions.md rename to published/201910/20190916 Copying large files with Rsync, and some misconceptions.md diff --git a/published/20190916 Linux commands to display your hardware information.md b/published/201910/20190916 Linux commands to display your hardware information.md similarity index 100% rename from published/20190916 Linux commands to display your hardware information.md rename to published/201910/20190916 Linux commands to display your hardware information.md diff --git a/published/20190918 Adding themes and plugins to Zsh.md b/published/201910/20190918 Adding themes and plugins to Zsh.md similarity index 100% rename from published/20190918 Adding themes and plugins to Zsh.md rename to published/201910/20190918 Adding themes and plugins to Zsh.md diff --git a/published/20190920 Hone advanced Bash skills by building Minesweeper.md b/published/201910/20190920 Hone advanced Bash skills by building Minesweeper.md similarity index 100% rename from published/20190920 Hone advanced Bash skills by building Minesweeper.md rename to published/201910/20190920 Hone advanced Bash skills by building Minesweeper.md diff --git a/published/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md b/published/201910/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md similarity index 100% rename from published/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md rename to published/201910/20190923 Installation Guide of Manjaro 18.1 (KDE Edition) with Screenshots.md diff --git a/published/20190923 Mutation testing by example- How to leverage failure.md b/published/201910/20190923 Mutation testing by example- How to leverage failure.md similarity index 100% rename from published/20190923 Mutation testing by example- How to leverage failure.md rename to published/201910/20190923 Mutation testing by example- How to leverage failure.md diff --git a/published/20190924 Fedora and CentOS Stream.md b/published/201910/20190924 Fedora and CentOS Stream.md similarity index 100% rename from published/20190924 Fedora and CentOS Stream.md rename to published/201910/20190924 Fedora and CentOS Stream.md diff --git a/published/20190924 How DevOps professionals can become security champions.md b/published/201910/20190924 How DevOps professionals can become security champions.md similarity index 100% rename from published/20190924 How DevOps professionals can become security champions.md rename to published/201910/20190924 How DevOps professionals can become security champions.md diff --git a/published/20190924 Java still relevant, Linux desktop, and more industry trends.md b/published/201910/20190924 Java still relevant, Linux desktop, and more industry trends.md similarity index 100% rename from published/20190924 Java still relevant, Linux desktop, and more industry trends.md rename to published/201910/20190924 Java still relevant, Linux desktop, and more industry trends.md diff --git a/published/20190924 Mutation testing by example- Failure as experimentation.md b/published/201910/20190924 Mutation testing by example- Failure as experimentation.md similarity index 100% rename from published/20190924 Mutation testing by example- Failure as experimentation.md rename to published/201910/20190924 Mutation testing by example- Failure as experimentation.md diff --git a/published/20190925 3 quick tips for working with Linux files.md b/published/201910/20190925 3 quick tips for working with Linux files.md similarity index 100% rename from published/20190925 3 quick tips for working with Linux files.md rename to published/201910/20190925 3 quick tips for working with Linux files.md diff --git a/published/20190925 Essential Accessories for Intel NUC Mini PC.md b/published/201910/20190925 Essential Accessories for Intel NUC Mini PC.md similarity index 100% rename from published/20190925 Essential Accessories for Intel NUC Mini PC.md rename to published/201910/20190925 Essential Accessories for Intel NUC Mini PC.md diff --git a/published/20190925 Mirror your Android screen on your computer with Guiscrcpy.md b/published/201910/20190925 Mirror your Android screen on your computer with Guiscrcpy.md similarity index 100% rename from published/20190925 Mirror your Android screen on your computer with Guiscrcpy.md rename to published/201910/20190925 Mirror your Android screen on your computer with Guiscrcpy.md diff --git a/published/20190926 How to Execute Commands on Remote Linux System over SSH.md b/published/201910/20190926 How to Execute Commands on Remote Linux System over SSH.md similarity index 100% rename from published/20190926 How to Execute Commands on Remote Linux System over SSH.md rename to published/201910/20190926 How to Execute Commands on Remote Linux System over SSH.md diff --git a/published/20190926 You Can Now Use OneDrive in Linux Natively Thanks to Insync.md b/published/201910/20190926 You Can Now Use OneDrive in Linux Natively Thanks to Insync.md similarity index 100% rename from published/20190926 You Can Now Use OneDrive in Linux Natively Thanks to Insync.md rename to published/201910/20190926 You Can Now Use OneDrive in Linux Natively Thanks to Insync.md diff --git a/published/20190927 CentOS 8 Installation Guide with Screenshots.md b/published/201910/20190927 CentOS 8 Installation Guide with Screenshots.md similarity index 100% rename from published/20190927 CentOS 8 Installation Guide with Screenshots.md rename to published/201910/20190927 CentOS 8 Installation Guide with Screenshots.md diff --git a/published/20190929 Bash Script to Generate System Uptime Reports on Linux.md b/published/201910/20190929 Bash Script to Generate System Uptime Reports on Linux.md similarity index 100% rename from published/20190929 Bash Script to Generate System Uptime Reports on Linux.md rename to published/201910/20190929 Bash Script to Generate System Uptime Reports on Linux.md diff --git a/published/20190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md b/published/201910/20190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md similarity index 100% rename from published/20190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md rename to published/201910/20190929 How to Install and Use Cockpit on CentOS 8 - RHEL 8.md diff --git a/published/20191002 3 command line games for learning Bash the fun way.md b/published/201910/20191002 3 command line games for learning Bash the fun way.md similarity index 100% rename from published/20191002 3 command line games for learning Bash the fun way.md rename to published/201910/20191002 3 command line games for learning Bash the fun way.md diff --git a/published/20191002 7 Bash history shortcuts you will actually use.md b/published/201910/20191002 7 Bash history shortcuts you will actually use.md similarity index 100% rename from published/20191002 7 Bash history shortcuts you will actually use.md rename to published/201910/20191002 7 Bash history shortcuts you will actually use.md diff --git a/published/20191003 How to Run the Top Command in Batch Mode.md b/published/201910/20191003 How to Run the Top Command in Batch Mode.md similarity index 100% rename from published/20191003 How to Run the Top Command in Batch Mode.md rename to published/201910/20191003 How to Run the Top Command in Batch Mode.md diff --git a/published/20191004 9 essential GNU binutils tools.md b/published/201910/20191004 9 essential GNU binutils tools.md similarity index 100% rename from published/20191004 9 essential GNU binutils tools.md rename to published/201910/20191004 9 essential GNU binutils tools.md diff --git a/published/20191004 All That You Can Do with Google Analytics, and More.md b/published/201910/20191004 All That You Can Do with Google Analytics, and More.md similarity index 100% rename from published/20191004 All That You Can Do with Google Analytics, and More.md rename to published/201910/20191004 All That You Can Do with Google Analytics, and More.md diff --git a/published/20191004 In Fedora 31, 32-bit i686 is 86ed.md b/published/201910/20191004 In Fedora 31, 32-bit i686 is 86ed.md similarity index 100% rename from published/20191004 In Fedora 31, 32-bit i686 is 86ed.md rename to published/201910/20191004 In Fedora 31, 32-bit i686 is 86ed.md diff --git a/published/20191005 Use GameHub to Manage All Your Linux Games in One Place.md b/published/201910/20191005 Use GameHub to Manage All Your Linux Games in One Place.md similarity index 100% rename from published/20191005 Use GameHub to Manage All Your Linux Games in One Place.md rename to published/201910/20191005 Use GameHub to Manage All Your Linux Games in One Place.md diff --git a/published/20191006 How to Install and Configure VNC Server on Centos 8 - RHEL 8.md b/published/201910/20191006 How to Install and Configure VNC Server on Centos 8 - RHEL 8.md similarity index 100% rename from published/20191006 How to Install and Configure VNC Server on Centos 8 - RHEL 8.md rename to published/201910/20191006 How to Install and Configure VNC Server on Centos 8 - RHEL 8.md diff --git a/published/20191007 IceWM - A really cool desktop.md b/published/201910/20191007 IceWM - A really cool desktop.md similarity index 100% rename from published/20191007 IceWM - A really cool desktop.md rename to published/201910/20191007 IceWM - A really cool desktop.md diff --git a/published/20191008 7 steps to securing your Linux server.md b/published/201910/20191008 7 steps to securing your Linux server.md similarity index 100% rename from published/20191008 7 steps to securing your Linux server.md rename to published/201910/20191008 7 steps to securing your Linux server.md diff --git a/published/20191008 How to manage Go projects with GVM.md b/published/201910/20191008 How to manage Go projects with GVM.md similarity index 100% rename from published/20191008 How to manage Go projects with GVM.md rename to published/201910/20191008 How to manage Go projects with GVM.md diff --git a/published/20191009 Command line quick tips- Locate and process files with find and xargs.md b/published/201910/20191009 Command line quick tips- Locate and process files with find and xargs.md similarity index 100% rename from published/20191009 Command line quick tips- Locate and process files with find and xargs.md rename to published/201910/20191009 Command line quick tips- Locate and process files with find and xargs.md diff --git a/published/20191009 Top 10 open source video players for Linux.md b/published/201910/20191009 Top 10 open source video players for Linux.md similarity index 100% rename from published/20191009 Top 10 open source video players for Linux.md rename to published/201910/20191009 Top 10 open source video players for Linux.md diff --git a/published/20191010 DevSecOps pipelines and tools- What you need to know.md b/published/201910/20191010 DevSecOps pipelines and tools- What you need to know.md similarity index 100% rename from published/20191010 DevSecOps pipelines and tools- What you need to know.md rename to published/201910/20191010 DevSecOps pipelines and tools- What you need to know.md diff --git a/published/20191010 Viewing files and processes as trees on Linux.md b/published/201910/20191010 Viewing files and processes as trees on Linux.md similarity index 100% rename from published/20191010 Viewing files and processes as trees on Linux.md rename to published/201910/20191010 Viewing files and processes as trees on Linux.md diff --git a/published/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md b/published/201910/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md similarity index 100% rename from published/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md rename to published/201910/20191011 How to Unzip a Zip File in Linux -Beginner-s Tutorial.md diff --git a/published/20191011 How to use IoT devices to keep children safe.md b/published/201910/20191011 How to use IoT devices to keep children safe.md similarity index 100% rename from published/20191011 How to use IoT devices to keep children safe.md rename to published/201910/20191011 How to use IoT devices to keep children safe.md diff --git a/published/20191013 Object-Oriented Programming and Essential State.md b/published/201910/20191013 Object-Oriented Programming and Essential State.md similarity index 100% rename from published/20191013 Object-Oriented Programming and Essential State.md rename to published/201910/20191013 Object-Oriented Programming and Essential State.md diff --git a/published/20191014 Use sshuttle to build a poor man-s VPN.md b/published/201910/20191014 Use sshuttle to build a poor man-s VPN.md similarity index 100% rename from published/20191014 Use sshuttle to build a poor man-s VPN.md rename to published/201910/20191014 Use sshuttle to build a poor man-s VPN.md diff --git a/published/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md b/published/201910/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md similarity index 100% rename from published/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md rename to published/201910/20191015 10 Ways to Customize Your Linux Desktop With GNOME Tweaks Tool.md diff --git a/published/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md b/published/201910/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md similarity index 100% rename from published/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md rename to published/201910/20191015 4 Free and Open Source Alternatives to Adobe Photoshop.md diff --git a/published/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md b/published/201910/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md similarity index 100% rename from published/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md rename to published/201910/20191015 Bash Script to Delete Files-Folders Older Than -X- Days in Linux.md diff --git a/published/20191016 Linux sudo flaw can lead to unauthorized privileges.md b/published/201910/20191016 Linux sudo flaw can lead to unauthorized privileges.md similarity index 100% rename from published/20191016 Linux sudo flaw can lead to unauthorized privileges.md rename to published/201910/20191016 Linux sudo flaw can lead to unauthorized privileges.md diff --git a/published/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md b/published/201910/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md similarity index 100% rename from published/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md rename to published/201910/20191018 How to Configure Rsyslog Server in CentOS 8 - RHEL 8.md diff --git a/published/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md b/published/201910/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md similarity index 100% rename from published/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md rename to published/201910/20191021 Kubernetes networking, OpenStack Train, and more industry trends.md diff --git a/published/20191021 Pylint- Making your Python code consistent.md b/published/201910/20191021 Pylint- Making your Python code consistent.md similarity index 100% rename from published/20191021 Pylint- Making your Python code consistent.md rename to published/201910/20191021 Pylint- Making your Python code consistent.md diff --git a/published/20191021 Transition to Nftables.md b/published/201910/20191021 Transition to Nftables.md similarity index 100% rename from published/20191021 Transition to Nftables.md rename to published/201910/20191021 Transition to Nftables.md diff --git a/published/20191022 How to Get the Size of a Directory in Linux.md b/published/201910/20191022 How to Get the Size of a Directory in Linux.md similarity index 100% rename from published/20191022 How to Get the Size of a Directory in Linux.md rename to published/201910/20191022 How to Get the Size of a Directory in Linux.md diff --git a/published/20191023 Building container images with the ansible-bender tool.md b/published/201910/20191023 Building container images with the ansible-bender tool.md similarity index 100% rename from published/20191023 Building container images with the ansible-bender tool.md rename to published/201910/20191023 Building container images with the ansible-bender tool.md diff --git a/published/20191023 Using SSH port forwarding on Fedora.md b/published/201910/20191023 Using SSH port forwarding on Fedora.md similarity index 100% rename from published/20191023 Using SSH port forwarding on Fedora.md rename to published/201910/20191023 Using SSH port forwarding on Fedora.md diff --git a/published/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md b/published/201910/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md similarity index 100% rename from published/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md rename to published/201910/20191025 MX Linux 19 Released With Debian 10.1 ‘Buster- - Other Improvements.md diff --git a/published/20191029 Fedora 31 is officially here.md b/published/201910/20191029 Fedora 31 is officially here.md similarity index 100% rename from published/20191029 Fedora 31 is officially here.md rename to published/201910/20191029 Fedora 31 is officially here.md From ca8eb7cd71411faaf5835076587ab224e12995d6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 1 Nov 2019 08:52:35 +0800 Subject: [PATCH 250/800] translating --- ...epository on CentOS 8 and RHEL 8 Server.md | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) rename {sources => translated}/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md (62%) diff --git a/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md b/translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md similarity index 62% rename from sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md rename to translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md index 718f41ebc9..9b0d320a79 100644 --- a/sources/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md +++ b/translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md @@ -7,59 +7,59 @@ [#]: via: (https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) -How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server +如何在 CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库 ====== -**EPEL** Stands for Extra Packages for Enterprise Linux, it is a free and opensource additional packages repository available for **CentOS** and **RHEL** servers. As the name suggests, EPEL repository provides extra and additional packages which are not available in the default package repositories of [CentOS 8][1] and [RHEL 8][2]. +**EPEL** 代表 “Extra Packages for Enterprise Linux”,它是一个免费的开源附加软件包仓库,可用于 **CentOS** 和 **RHEL** 服务器。顾名思义,EPEL 仓库提供了额外的软件包,它们在 [CentOS 8][1]和 [RHEL 8][2] 的默认软件包仓库中不可用。 -In this article we will demonstrate how to enable and use epel repository on CentOS 8 and RHEL 8 Server. +在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 服务器上启用和使用 epel 存储库。 [![EPEL-Repo-CentOS8-RHEL8][3]][4] -### Prerequisites of EPEL Repository +### EPEL 仓库的先决条件 - * Minimal CentOS 8 and RHEL 8 Server - * Root or sudo admin privileges - * Internet Connection + * Minimal CentOS 8 和 RHEL 8 服务器 + * root 或 sudo 管理员权限 + * 网络连接 -### Install and Enable EPEL Repository on RHEL 8.x Server +### 在 RHEL 8.x 服务器上安装并启用 EPEL 仓库 -Login or ssh to your RHEL 8.x server and execute the following dnf command to install EPEL rpm package, +登录或 SSH 到你的 RHEL 8.x 服务器并执行以下 dnf 命令来安装 EPEL rpm 包, ``` [root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y ``` -Output of above command would be something like below, +上面命令的输出将如下所示, ![dnf-install-epel-repo-rehl8][3] -Once epel rpm package is installed successfully then it will automatically enable and configure its yum / dnf repository.  Run following dnf or yum command to verify whether EPEL repository is enabled or not, +epel rpm 包成功安装后,它将自动启用并配置其 yum/dnf 仓库。运行以下 dnf 或 yum 命令,以验证是否启用了 EPEL 仓库, ``` [root@linuxtechi ~]# dnf repolist epel -Or +或者 [root@linuxtechi ~]# dnf repolist epel -v ``` ![epel-repolist-rhel8][3] -### Install and Enable EPEL Repository on CentOS 8.x Server +### 在 CentOS 8.x 服务器上安装并启用 EPEL 仓库 -Login or ssh to your CentOS 8 server and execute following dnf or yum command to install ‘**epel-release**‘ rpm package. In CentOS 8 server, epel rpm package is available in its default package repository. +登录或 SSH 到你的 CentOS 8 服务器,并执行以下 dnf 或 yum 命令来安装 “**epel-release**” rpm 软件包。在 CentOS 8 服务器中,epel rpm 在其默认软件包仓库中。 ``` [root@linuxtechi ~]# dnf install epel-release -y -Or +或者 [root@linuxtechi ~]# yum install epel-release -y ``` -Execute the following commands to verify the status of epel repository on CentOS 8 server, +执行以下命令来验证 CentOS 8 服务器上 epel 仓库的状态, ``` - [root@linuxtechi ~]# dnf repolist epel +[root@linuxtechi ~]# dnf repolist epel Last metadata expiration check: 0:00:03 ago on Sun 13 Oct 2019 04:18:05 AM BST. repo id repo name status *epel Extra Packages for Enterprise Linux 8 - x86_64 1,977 @@ -82,11 +82,11 @@ Total packages: 1,977 [root@linuxtechi ~]# ``` -Above command’s output confirms that we have successfully enabled epel repo. Let’s perform some basic operations on EPEL repo. +以上命令的输出说明我们已经成功启用了epel 仓库。 让我们在 EPEL 仓库上执行一些基本操作。 -### List all available packages from epel repository +### 列出 epel 仓库种所有可用包 -If you want to list all the packages from epel repository then run the following dnf command, +如果要列出 epel 仓库中的所有的软件包,请运行以下 dnf 命令, ``` [root@linuxtechi ~]# dnf repository-packages epel list @@ -116,23 +116,23 @@ zvbi-fonts.noarch 0.2.35-9.el8 epel [root@linuxtechi ~]# ``` -### Search a package from epel repository +### 从 epel 仓库中搜索软件包 -Let’s assume if we want to search Zabbix package in epel repository, execute the following dnf command, +假设我们要搜索 epel 仓库中的 Zabbix 包,请执行以下 dnf 命令, ``` [root@linuxtechi ~]# dnf repository-packages epel list | grep -i zabbix ``` -Output of above command would be something like below, +上面命令的输出类似下面这样, ![epel-repo-search-package-centos8][3] -### Install a package from epel repository +### 从 epel 仓库安装软件包 -Let’s assume we want to install htop package from epel repo, then issue the following dnf command, +假设我们要从 epel 仓库安装 htop 包,运行以下 dnf 命令, -Syntax: +语法: # dnf –enablerepo=”epel” install <pkg_name> @@ -140,9 +140,9 @@ Syntax: [root@linuxtechi ~]# dnf --enablerepo="epel" install htop -y ``` -**Note:** If we don’t specify the “**–enablerepo=epel**” in above command then it will look for htop package in all available package repositories. +**注意:**如果我们在上面的命令中未指定 “**–enablerepo=epel**”,那么它将在所有可用的软件包仓库中查找 htop 包。 -That’s all from this article, I hope above steps helps you to enable and configure EPEL repository on CentOS 8 and RHEL 8 Server, please don’t hesitate to share your comments and feedback in below comments section. +本文就是这些内容了,我希望上面的步骤能帮助你在 CentOS 8 和 RHEL 8 服务器上启用并配置 EPEL 仓库,请在下面的评论栏分享你的评论和反馈。 -------------------------------------------------------------------------------- @@ -150,7 +150,7 @@ via: https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/ 作者:[Pradeep Kumar][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 09054ae579749c8f7f785020d14dad311d477eb6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 1 Nov 2019 08:57:47 +0800 Subject: [PATCH 251/800] translating --- sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md b/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md index 4e27e83d0d..e67f26d320 100644 --- a/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md +++ b/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9e8cd6ef1a87c204d2aa2f9e03159efb59b5f95a Mon Sep 17 00:00:00 2001 From: laingke Date: Fri, 1 Nov 2019 19:27:15 +0800 Subject: [PATCH 252/800] 20191022-initializing-arrays-java translated --- .../20191022 Initializing arrays in Java.md | 389 ------------------ .../20191022 Initializing arrays in Java.md | 378 +++++++++++++++++ 2 files changed, 378 insertions(+), 389 deletions(-) delete mode 100644 sources/tech/20191022 Initializing arrays in Java.md create mode 100644 translated/tech/20191022 Initializing arrays in Java.md diff --git a/sources/tech/20191022 Initializing arrays in Java.md b/sources/tech/20191022 Initializing arrays in Java.md deleted file mode 100644 index 7971ec104b..0000000000 --- a/sources/tech/20191022 Initializing arrays in Java.md +++ /dev/null @@ -1,389 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (laingke) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Initializing arrays in Java) -[#]: via: (https://opensource.com/article/19/10/initializing-arrays-java) -[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) - -Initializing arrays in Java -====== -Arrays are a helpful data type for managing collections elements best -modeled in contiguous memory locations. Here's how to use them -effectively. -![Coffee beans and a cup of coffee][1] - -People who have experience programming in languages like C or FORTRAN are familiar with the concept of arrays. They’re basically a contiguous block of memory where each location is a certain type: integers, floating-point numbers, or what-have-you. - -The situation in Java is similar, but with a few extra wrinkles. - -### An example array - -Let’s make an array of 10 integers in Java: - - -``` -int[] ia = new int[10]; -``` - -What’s going on in the above piece of code? From left to right: - - 1. The **int[]** to the extreme left declares the _type_ of the variable as an array (denoted by the **[]**) of **int**. - - 2. To the right is the _name_ of the variable, which in this case is **ia**. - - 3. Next, the **=** tells us that the variable defined on the left side is set to what’s to the right side. - - 4. To the right of the **=** we see the word **new**, which in Java indicates that an object is being _initialized_, meaning that storage is allocated and its constructor is called ([see here for more information][2]). - - 5. Next, we see **int[10]**, which tells us that the specific object being initialized is an array of 10 integers. - - - - -Since Java is strongly-typed, the type of the variable **ia** must be compatible with the type of the expression on the right-hand side of the **=**. - -### Initializing the example array - -Let’s put this simple array in a piece of code and try it out. Save the following in a file called **Test1.java**, use **javac** to compile it, and use **java** to run it (in the terminal of course): - - -``` -import java.lang.*; - -public class Test1 { - -    public static void main([String][3][] args) { -        int[] ia = new int[10];                              // See note 1 below -        [System][4].out.println("ia is " + ia.getClass());        // See note 2 below -        for (int i = 0; i < ia.length; i++)                  // See note 3 below -            [System][4].out.println("ia[" + i + "] = " + ia[i]);  // See note 4 below -    } - -} -``` - -Let’s work through the most important bits. - - 1. Our declaration and initialization of the array of 10 integers, **ia**, is easy to spot. - 2. In the line just following, we see the expression **ia.getClass()**. That’s right, **ia** is an _object_ belonging to a _class_, and this code will let us know which class that is. - 3. In the next line following that, we see the start of the loop **for (int i = 0; i < ia.length; i++)**, which defines a loop index variable **i** that runs through a sequence from zero to one less than **ia.length**, which is an expression that tells us how many elements are defined in the array **ia**. - 4. Next, the body of the loop prints out the values of each element of **ia**. - - - -When this program is compiled and run, it produces the following results: - - -``` -me@mydesktop:~/Java$ javac Test1.java -me@mydesktop:~/Java$ java Test1 -ia is class [I -ia[0] = 0 -ia[1] = 0 -ia[2] = 0 -ia[3] = 0 -ia[4] = 0 -ia[5] = 0 -ia[6] = 0 -ia[7] = 0 -ia[8] = 0 -ia[9] = 0 -me@mydesktop:~/Java$ -``` - -The string representation of the output of **ia.getClass()** is **[I**, which is shorthand for "array of integer." Similar to the C programming language, Java arrays begin with element zero and extend up to element **<array size> – 1**. We can see above that each of the elements of **ia** are set to zero (by the array constructor, it seems). - -So, is that it? We declare the type, use the appropriate initializer, and we’re done? - -Well, no. There are many other ways to initialize an array in Java.  - -### Why do I want to initialize an array, anyway? - -The answer to this question, like that of all good questions, is "it depends." In this case, the answer depends on what we expect to do with the array once it is initialized. - -In some cases, arrays emerge naturally as a type of accumulator. For example, suppose we are writing code for counting the number of calls received and made by a set of telephone extensions in a small office. There are eight extensions, numbered one through eight, plus the operator’s extension, numbered zero. So we might declare two arrays: - - -``` -int[] callsMade; -int[] callsReceived; -``` - -Then, whenever we start a new period of accumulating call statistics, we initialize each array as: - - -``` -callsMade = new int[9]; -callsReceived = new int[9]; -``` - -At the end of each period of accumulating call statistics, we can print out the stats. In very rough terms, we might see: - - -``` -import java.lang.*; -import java.io.*; - -public class Test2 { - -    public static void main([String][3][] args) { - -        int[] callsMade; -        int[] callsReceived; - -        // initialize call counters - -        callsMade = new int[9]; -        callsReceived = new int[9]; - -        // process calls... -        //   an extension makes a call: callsMade[ext]++ -        //   an extension receives a call: callsReceived[ext]++ - -        // summarize call statistics - -        [System][4].out.printf("%3s%25s%25s\n","ext"," calls made", -            "calls received"); -        for (int ext = 0; ext < callsMade.length; ext++) -            [System][4].out.printf("%3d%25d%25d\n",ext, -                callsMade[ext],callsReceived[ext]); - -    } - -} -``` - -Which would produce output something like this: - - -``` -me@mydesktop:~/Java$ javac Test2.java -me@mydesktop:~/Java$ java Test2 -ext               calls made           calls received -  0                        0                        0 -  1                        0                        0 -  2                        0                        0 -  3                        0                        0 -  4                        0                        0 -  5                        0                        0 -  6                        0                        0 -  7                        0                        0 -  8                        0                        0 -me@mydesktop:~/Java$ -``` - -Not a very busy day in the call center. - -In the above example of an accumulator, we see that the starting value of zero as set by the array initializer is satisfactory for our needs. But in other cases, this starting value may not be the right choice. - -For example, in some kinds of geometric computations, we might need to initialize a two-dimensional array to the identity matrix (all zeros except for the ones along the main diagonal). We might choose to do this as: - - -``` - double[][] m = new double[3][3]; -        for (int d = 0; d < 3; d++) -            m[d][d] = 1.0; -``` - -In this case, we rely on the array initializer **new double[3][3]** to set the array to zeros, and then use a loop to set the diagonal elements to ones. In this simple case, we might use a shortcut that Java provides: - - -``` - double[][] m = { -         {1.0, 0.0, 0.0}, -         {0.0, 1.0, 0.0}, -         {0.0, 0.0, 1.0}}; -``` - -This type of visual structure is particularly appropriate in this sort of application, where it can be a useful double-check to see the actual layout of the array. But in the case where the number of rows and columns is only determined at run time, we might instead see something like this: - - -``` - int nrc; - // some code determines the number of rows & columns = nrc - double[][] m = new double[nrc][nrc]; - for (int d = 0; d < nrc; d++) -     m[d][d] = 1.0; -``` - -It’s worth mentioning that a two-dimensional array in Java is actually an array of arrays, and there’s nothing stopping the intrepid programmer from having each one of those second-level arrays be a different length. That is, something like this is completely legitimate: - - -``` -int [][] differentLengthRows = { -     { 1, 2, 3, 4, 5}, -     { 6, 7, 8, 9}, -     {10,11,12}, -     {13,14}, -     {15}}; -``` - -There are various linear algebra applications that involve irregularly-shaped matrices, where this type of structure could be applied (for more information see [this Wikipedia article][5] as a starting point). Beyond that, now that we understand that a two-dimensional array is actually an array of arrays, it shouldn’t be too much of a surprise that: - - -``` -differentLengthRows.length -``` - -tells us the number of rows in the two-dimensional array **differentLengthRows**, and: - - -``` -differentLengthRows[i].length -``` - -tells us the number of columns in row **i** of **differentLengthRows**. - -### Taking the array further - -Considering this idea of array size that is determined at run time, we see that arrays still require us to know that size before instantiating them. But what if we don’t know the size until we’ve processed all of the data? Does that mean we have to process it once to figure out the size of the array, and then process it again? That could be hard to do, especially if we only get one chance to consume the data. - -The [Java Collections Framework][6] solves this problem in a nice way. One of the things provided there is the class **ArrayList**, which is like an array but dynamically extensible. To demonstrate the workings of **ArrayList**, let’s create one and initialize it to the first 20 [Fibonacci numbers][7]: - - -``` -import java.lang.*; -import java.util.*; - -public class Test3 { -        -        public static void main([String][3][] args) { - -                ArrayList<Integer> fibos = new ArrayList<Integer>(); - -                fibos.add(0); -                fibos.add(1); -                for (int i = 2; i < 20; i++) -                        fibos.add(fibos.get(i-1) + fibos.get(i-2)); - -                for (int i = 0; i < fibos.size(); i++) -                        [System][4].out.println("fibonacci " + i + -                       " = " + fibos.get(i)); - -        } -} -``` - -Above, we see: - - * The declaration and instantiation of an **ArrayList** that is used to store **Integer**s. - * The use of **add()** to append to the **ArrayList** instance. - * The use of **get()** to retrieve an element by index number. - * The use of **size()** to determine how many elements are already in the **ArrayList** instance. - - - -Not shown is the **put()** method, which places a value at a given index number. - -The output of this program is: - - -``` -fibonacci 0 = 0 -fibonacci 1 = 1 -fibonacci 2 = 1 -fibonacci 3 = 2 -fibonacci 4 = 3 -fibonacci 5 = 5 -fibonacci 6 = 8 -fibonacci 7 = 13 -fibonacci 8 = 21 -fibonacci 9 = 34 -fibonacci 10 = 55 -fibonacci 11 = 89 -fibonacci 12 = 144 -fibonacci 13 = 233 -fibonacci 14 = 377 -fibonacci 15 = 610 -fibonacci 16 = 987 -fibonacci 17 = 1597 -fibonacci 18 = 2584 -fibonacci 19 = 4181 -``` - -**ArrayList** instances can also be initialized by other techniques. For example, an array can be supplied to the **ArrayList** constructor, or the **List.of()** and **Arrays.asList()** methods can be used when the initial elements are known at compile time. I don’t find myself using these options all that often since my primary use case for an **ArrayList** is when I only want to read the data once. - -Moreover, an **ArrayList** instance can be converted to an array using its **toArray()** method, for those who prefer to work with an array once the data is loaded; or, returning to the current topic, once the **ArrayList** instance is initialized. - -The Java Collections Framework provides another kind of array-like data structure called a **Map**. What I mean by "array-like" is that a **Map** defines a collection of objects whose values can be set or retrieved by a key, but unlike an array (or an **ArrayList**), this key need not be an integer; it could be a **String** or any other complex object. - -For example, we can create a **Map** whose keys are **String**s and whose values are **Integer**s as follows: - - -``` -Map<[String][3],Integer> stoi = new Map<[String][3],Integer>(); -``` - -Then we can initialize this **Map** as follows: - - -``` -stoi.set("one",1); -stoi.set("two",2); -stoi.set("three",3); -``` - -And so on. Later, when we want to know the numeric value of **"three"**, we can retrieve it as: - - -``` -stoi.get("three"); -``` - -In my world, a **Map** is useful for converting strings occurring in third-party datasets into coherent code values in my datasets. As a part of a [data transformation pipeline][8], I will often build a small standalone program to clean the data before processing it; for this, I will almost always use one or more **Map**s. - -Worth mentioning is that it’s quite possible, and sometimes reasonable, to have **ArrayLists** of **ArrayLists** and **Map**s of **Map**s. For example, let’s assume we’re looking at trees, and we’re interested in accumulating the count of the number of trees by tree species and age range. Assuming that the age range definition is a set of string values ("young," "mid," "mature," and "old") and that the species are string values like "Douglas fir," "western red cedar," and so forth, then we might define a **Map** of **Map**s as: - - -``` -Map<[String][3],Map<[String][3],Integer>> counter = -        new Map<[String][3],Map<[String][3],Integer>>(); -``` - -One thing to watch out for here is that the above only creates storage for the _rows_ of **Map**s. So, our accumulation code might look like: - - -``` -// assume at this point we have figured out the species -// and age range -if (!counter.containsKey(species)) -        counter.put(species,new Map<[String][3],Integer>()); -if (!counter.get(species).containsKey(ageRange)) -        counter.get(species).put(ageRange,0); -``` - -At which point, we can start accumulating as: - - -``` -counter.get(species).put(ageRange, -        counter.get(species).get(ageRange) + 1); -``` - -Finally, it’s worth mentioning that the (new in Java 8) Streams facility can also be used to initialize arrays, **ArrayList** instances, and **Map** instances. A nice discussion of this feature can be found [here][9] and [here][10]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/initializing-arrays-java - -作者:[Chris Hermansen][a] -选题:[lujun9972][b] -译者:[laingke](https://github.com/laingke) -校对:[校对者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/19/8/what-object-java -[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string -[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system -[5]: https://en.wikipedia.org/wiki/Irregular_matrix -[6]: https://en.wikipedia.org/wiki/Java_collections_framework -[7]: https://en.wikipedia.org/wiki/Fibonacci_number -[8]: https://towardsdatascience.com/data-science-for-startups-data-pipelines-786f6746a59a -[9]: https://stackoverflow.com/questions/36885371/lambda-expression-to-initialize-array -[10]: https://stackoverflow.com/questions/32868665/how-to-initialize-a-map-using-a-lambda diff --git a/translated/tech/20191022 Initializing arrays in Java.md b/translated/tech/20191022 Initializing arrays in Java.md new file mode 100644 index 0000000000..839346336e --- /dev/null +++ b/translated/tech/20191022 Initializing arrays in Java.md @@ -0,0 +1,378 @@ +[#]: collector: (lujun9972) +[#]: translator: (laingke) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Initializing arrays in Java) +[#]: via: (https://opensource.com/article/19/10/initializing-arrays-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Java 中初始化数组 +====== +数组是一种有用的数据类型,用于管理在连续内存位置中建模最好的集合元素。下面是如何有效地使用它们。 +![Coffee beans and a cup of coffee][1] + +有使用 C 或者 FORTRAN 语言编程经验的人会对数组的概念很熟悉。它们基本上是一个连续的内存块,其中每个位置都是某种数据类型:整型、浮点型或者诸如此类的数据类型。 + +Java 的情况与此类似,但是有一些额外的问题。 + +### 一个数组的示例 + +让我们在 Java 中创建一个长度为 10 的整型数组: + + +``` +int[] ia = new int[10]; +``` + +上面的代码片段会发生什么?从左到右依次是: + + 1. 最左边的 **int[]** 将数组变量的 _类型_ 声明为 **int**(由 **[]**表示)。 + + 2. 它的右边是变量的名称,当前为 **ia**。 + + 3. 接下来,**=** 告诉我们,左侧定义的变量赋值为右侧的内容。 + + 4. 在 **=** 的右侧,我们看到了 **new**,它在 Java 中表示一个对象正在 _被初始化_ 中,这意味着已为其分配存储空间并调用了其构造函数([请参见此处以获取更多信息][2])。 + + 5. 然后,我们看到 **int[10]**,它告诉我们正在初始化的这个对象是包含 10 个整型的数组。 + + +因为 Java 是强类型的,所以变量 **ia** 的类型必须跟 **=** 右侧表达式的类型兼容。 + +### 初始化示例数组 + +让我们把这个简单的数组放在一段代码中,并尝试运行一下。将以下内容保存到一个名为 **Test1.java** 的文件中,使用 **javac** 编译,使用 **java** 运行(当然是在终端中): + +``` +import java.lang.*; + +public class Test1 { + + public static void main(String[] args) { + int[] ia = new int[10]; // 见下文注 1 + System.out.println("ia is " + ia.getClass()); // 见下文注 2 + for (int i = 0; i < ia.length; i++) // 见下文注 3 + System.out.println("ia[" + i + "] = " + ia[i]); // 见下文注 4 + } + +} +``` + +让我们来看看最重要的部分。 + + 1. 我们很容易发现长度为 10 的整型数组,**ia** 的声明和初始化。 + 2. 在下面的行中,我们看到表达式 **ia.getClass()**。没错,**ia** 是属于一个 _类_ 的 _对象_,这行代码将告诉我们是哪个类。 + 3. 在紧接的下一行中,我们看到了一个循环 **for (int i = 0; i < ia.length; i++)**,它定义了一个循环索引变量 **i**,该变量运行的序列从 0 到比 **ia.length** 小 1,这个表达式告诉我们在数组 **ia** 中定义了多少个元素。 + 4. 接下来,循环体打印出 **ia** 的每个元素的值。 + + + +当这个程序被编译和运行时,它产生以下结果: + + +``` +me@mydesktop:~/Java$ javac Test1.java +me@mydesktop:~/Java$ java Test1 +ia is class [I +ia[0] = 0 +ia[1] = 0 +ia[2] = 0 +ia[3] = 0 +ia[4] = 0 +ia[5] = 0 +ia[6] = 0 +ia[7] = 0 +ia[8] = 0 +ia[9] = 0 +me@mydesktop:~/Java$ +``` + +**ia.getClass()** 的输出的字符串表示形式是 **[I**,它是“整数数组”的简写。与 C 语言类似,Java 数组以第 0 个元素开始,扩展到第 **<数组大小> - 1** 个元素。我们可以在上面看到数组 ia 的每个元素都设置为零(看来是数组构造函数)。 + +所以,就这些吗?声明类型,使用适当的初始化器,就完成了吗? + +好吧,并没有。在 Java 中有许多其它方法来初始化数组。 + +### 为什么我要初始化一个数组,有其它方式吗? + +像所有好的问题一样,这个问题的答案是“视情况而定”。在这种情况下,答案取决于初始化后我们希望对数组做什么。 + +在某些情况下,数组自然会作为一种累加器出现。例如,假设我们正在编程实现计算小型办公室中一组电话分机接收和拨打的电话数量。一共有 8 个分机,编号为 1 到 8,加上话务员的分机,编号为 0。 因此,我们可以声明两个数组: + +``` +int[] callsMade; +int[] callsReceived; +``` + +然后,每当我们开始一个新的累积呼叫统计数据的周期时,我们就将每个数组初始化为: + +``` +callsMade = new int[9]; +callsReceived = new int[9]; +``` + +在每个累积通话统计数据的最后阶段,我们可以打印出统计数据。粗略地说,我们可能会看到: + + +``` +import java.lang.*; +import java.io.*; + +public class Test2 { + + public static void main(String[] args) { + + int[] callsMade; + int[] callsReceived; + + // 初始化呼叫计数器 + + callsMade = new int[9]; + callsReceived = new int[9]; + + // 处理呼叫…… + // 分机拨打电话:callsMade[ext]++ + // 分机接听电话:callsReceived[ext]++ + + // 汇总通话统计 + + System.out.printf("%3s%25s%25s\n", "ext", " calls made", + "calls received"); + for (int ext = 0; ext < callsMade.length; ext++) { + System.out.printf("%3d%25d%25d\n", ext, + callsMade[ext], callsReceived[ext]); + } + + } + +} +``` + +这会产生这样的输出: + + +``` +me@mydesktop:~/Java$ javac Test2.java +me@mydesktop:~/Java$ java Test2 +ext calls made calls received + 0 0 0 + 1 0 0 + 2 0 0 + 3 0 0 + 4 0 0 + 5 0 0 + 6 0 0 + 7 0 0 + 8 0 0 +me@mydesktop:~/Java$ +``` + +呼叫中心不是很忙的一天。 + +在上面的累加器示例中,我们看到由数组初始化程序设置的零起始值可以满足我们的需求。但是在其它情况下,这个起始值可能不是正确的选择。 + +例如,在某些几何计算中,我们可能需要将二维数组初始化为单位矩阵(除沿主对角线的那些零以外的所有零)。我们可以选择这样做: + + +``` +double[][] m = new double[3][3]; +for (int d = 0; d < 3; d++) { + m[d][d] = 1.0; +} +``` + +在这种情况下,我们依靠数组初始化器 **new double[3][3]** 将数组设置为零,然后使用循环将对角元素设置为 1。 在这种简单情况下,我们可以使用 Java 提供的快捷方式: + +``` +double[][] m = { + {1.0, 0.0, 0.0}, + {0.0, 1.0, 0.0}, + {0.0, 0.0, 1.0}}; +``` + +这种可视结构特别适用于这种应用程序,在这种应用程序中,可以通过双重检查查看数组的实际布局。但是在这种情况下,行数和列数只在运行时确定,我们可能会看到这样的东西: + +``` +int nrc; +// 一些代码确定行数和列数 = nrc +double[][] m = new double[nrc][nrc]; +for (int d = 0; d < nrc; d++) { + m[d][d] = 1.0; +} +``` + +值得一提的是,Java 中的二维数组实际上是数组的数组,没有什么能阻止无畏的程序员让这些第二级数组中的每个数组的长度都不同。也就是说,下面这样的事情是完全合法的: + + +``` +int [][] differentLengthRows = { + {1, 2, 3, 4, 5}, + {6, 7, 8, 9}, + {10, 11, 12}, + {13, 14}, + {15}}; +``` + +在涉及不规则形状矩阵的各种线性代数应用中,可以应用这种类型的结构(有关更多信息,请参见[此 Wikipedia 文章][5])。除此之外,既然我们了解到二维数组实际上是数组的数组,那么以下内容也就不足为奇了: + +``` +differentLengthRows.length +``` + +告诉我们二维数组 **differentLengthRows** 的行数,并且: + +``` +differentLengthRows[i].length +``` + +告诉我们 **differentLengthRows** 第 **i** 行的列数。 + +### 深入理解数组 + +考虑到在运行时确定数组大小的想法,我们看到数组在实例化之前仍需要我们知道该大小。但是,如果在处理完所有数据之前我们不知道大小怎么办?这是否意味着我们必须先处理一次以找出数组的大小,然后再次处理?这可能很难做到,尤其是如果我们只有一次机会使用数据时。 + +[Java 集合框架][6]很好地解决了这个问题。提供的其中一项是 **ArrayList** 类,它类似于数组,但可以动态扩展。为了演示 **ArrayList** 的工作原理,让我们创建一个 ArrayList 并将其初始化为前 20 个[斐波那契数字][7]: + +``` +import java.lang.*; +import java.util.*; + +public class Test3 { + + public static void main(String[] args) { + + ArrayList fibos = new ArrayList(); + + fibos.add(0); + fibos.add(1); + for (int i = 2; i < 20; i++) { + fibos.add(fibos.get(i - 1) + fibos.get(i - 2)); + } + + for (int i = 0; i < fibos.size(); i++) { + System.out.println("fibonacci " + i + " = " + fibos.get(i)); + } + + } +} +``` + +上面的代码中,我们看到: + + * 用于存储多个 **Integer** 的 **ArrayList** 的声明和实例化。 + * 使用 **add()** 附加到 **ArrayList** 实例。 + * 使用 **get()** 通过索引号检索元素。 + * 使用 **size()** 来确定 **ArrayList** 实例中已经有多少个元素。 + + + +没有显示 **put()** 方法,它的作用是将一个值放在给定的索引号上。 + +该程序的输出为: + + +``` +fibonacci 0 = 0 +fibonacci 1 = 1 +fibonacci 2 = 1 +fibonacci 3 = 2 +fibonacci 4 = 3 +fibonacci 5 = 5 +fibonacci 6 = 8 +fibonacci 7 = 13 +fibonacci 8 = 21 +fibonacci 9 = 34 +fibonacci 10 = 55 +fibonacci 11 = 89 +fibonacci 12 = 144 +fibonacci 13 = 233 +fibonacci 14 = 377 +fibonacci 15 = 610 +fibonacci 16 = 987 +fibonacci 17 = 1597 +fibonacci 18 = 2584 +fibonacci 19 = 4181 +``` + +**ArrayList** 实例也可以通过其它方式初始化。例如,一个数组可以提供给 **ArrayList** 构造器,或者 **List.of()** 和 **array.aslist()** 方法可以在编译过程中知道初始元素时使用。我发现自己并不经常使用这些选项,因为我对 **ArrayList** 的主要用途是我只想读取一次数据。 + +此外,对于那些喜欢在加载数据后使用数组的人,可以使用 **ArrayList** 的 **toArray()** 方法将其实例转换为数组;或者,在初始化 **ArrayList** 实例之后,返回到当前数组本身。 + +Java 集合框架提供了另一种类似数组的数据结构,称为 **Map**。我所说的“类似数组”是指 **Map** 定义了一个对象集合,它的值可以通过一个键来设置或检索,但与数组(或 **ArrayList**)不同,这个键不需要是整型数;它可以是 **String** 或任何其它复杂对象。 + +例如,我们可以创建一个 **Map**,其键为 **String**,其值为 **Integer** 类型,如下: + +``` +Map stoi = new Map(); +``` + +然后我们可以对这个 **Map** 进行如下初始化: + + +``` +stoi.set("one",1); +stoi.set("two",2); +stoi.set("three",3); +``` + +等类似操作。稍后,当我们想要知道 **"three"** 的数值时,我们可以通过下面的方式将其检索出来: + + +``` +stoi.get("three"); +``` + +在我的认知中,**Map** 对于将第三方数据集中出现的字符串转换为我的数据集中的一致代码值非常有用。作为[数据转换管道][8]的一部分,我经常会构建一个小型的独立程序,用作在处理数据之前清理数据;为此,我几乎总是会使用一个或多个 **Map**。 + +值得一提的是,内部定义有 **ArrayList** 的 **ArrayLists** 和 **Map** 的 **Maps** 是很可能的,有时也是合理的。例如,假设我们在看树,我们对按树种和年龄范围累积树的数目感兴趣。假设年龄范围定义是一组字符串值(“young”、“mid”、“mature” 和 “old”),物种是 “Douglas fir”、“western red cedar” 等字符串值,那么我们可以将这个 **Map** 中的 **Map** 定义为: + +``` +Map> counter = new Map>(); +``` + +One thing to watch out for here is that the above only creates storage for the _rows_ of **Map**s. So, our accumulation code might look like: +这里需要注意的一件事是,以上内容仅为 **Map** 的 _行_ 创建存储。 因此,我们的累加代码可能类似于: + +``` +// 假设我们已经知道了物种和年龄范围 +if (!counter.containsKey(species)) { + counter.put(species,new Map()); +} +if (!counter.get(species).containsKey(ageRange)) { + counter.get(species).put(ageRange,0); +} +``` + +此时,我们可以开始累加: + + +``` +counter.get(species).put(ageRange, counter.get(species).get(ageRange) + 1); +``` + +最后,值得一提的是(Java 8 中的新特性)Streams 还可以用来初始化数组、**ArrayList** 实例和 **Map** 实例。关于此特性的详细讨论可以在[此处][9]和[此处][10]中找到。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/initializing-arrays-java + +作者:[Chris Hermansen][a] +选题:[lujun9972][b] +译者:[laingke](https://github.com/laingke) +校对:[校对者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/19/8/what-object-java +[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[5]: https://en.wikipedia.org/wiki/Irregular_matrix +[6]: https://en.wikipedia.org/wiki/Java_collections_framework +[7]: https://en.wikipedia.org/wiki/Fibonacci_number +[8]: https://towardsdatascience.com/data-science-for-startups-data-pipelines-786f6746a59a +[9]: https://stackoverflow.com/questions/36885371/lambda-expression-to-initialize-array +[10]: https://stackoverflow.com/questions/32868665/how-to-initialize-a-map-using-a-lambda From 316765d8034914518719099eec1e34692610d7b1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 1 Nov 2019 21:42:20 +0800 Subject: [PATCH 253/800] Rename sources/tech/20191031 Why you don-t have to be afraid of Kubernetes.md to sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md --- .../20191031 Why you don-t have to be afraid of Kubernetes.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191031 Why you don-t have to be afraid of Kubernetes.md (100%) diff --git a/sources/tech/20191031 Why you don-t have to be afraid of Kubernetes.md b/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md similarity index 100% rename from sources/tech/20191031 Why you don-t have to be afraid of Kubernetes.md rename to sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md From 0131746babc15430a35854e0c4226a8ecdc87960 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 1 Nov 2019 22:48:45 +0800 Subject: [PATCH 254/800] APL --- .../tech/20190826 How RPM packages are made- the source RPM.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190826 How RPM packages are made- the source RPM.md b/sources/tech/20190826 How RPM packages are made- the source RPM.md index 4629db3580..c65bf22e96 100644 --- a/sources/tech/20190826 How RPM packages are made- the source RPM.md +++ b/sources/tech/20190826 How RPM packages are made- the source RPM.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c8d0bdb1af9342222fe712860c7ca028634aa152 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 2 Nov 2019 08:50:42 +0800 Subject: [PATCH 255/800] translated --- ...191028 SQLite is really easy to compile.md | 116 ------------------ ...191028 SQLite is really easy to compile.md | 116 ++++++++++++++++++ 2 files changed, 116 insertions(+), 116 deletions(-) delete mode 100644 sources/tech/20191028 SQLite is really easy to compile.md create mode 100644 translated/tech/20191028 SQLite is really easy to compile.md diff --git a/sources/tech/20191028 SQLite is really easy to compile.md b/sources/tech/20191028 SQLite is really easy to compile.md deleted file mode 100644 index 3201612f3d..0000000000 --- a/sources/tech/20191028 SQLite is really easy to compile.md +++ /dev/null @@ -1,116 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (SQLite is really easy to compile) -[#]: via: (https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/) -[#]: author: (Julia Evans https://jvns.ca/) - -SQLite is really easy to compile -====== - -In the last week I’ve been working on another SQL website (, a list of SQL examples). I’m running all the queries on that site with sqlite, and I wanted to use window functions in one of the examples ([this one][1]). - -But I’m using the version of sqlite from Ubuntu 18.04, and that version is too old and doesn’t support window functions. So I needed to upgrade sqlite! - -This turned to out be surprisingly annoying (as usual), but in a pretty interesting way! I was reminded of some things about how executables and shared libraries work and it had a very satisfying conclusion. So I wanted to write it up here. - -(spoiler: the summary is that explains how to compile SQLite and it takes like 5 seconds to do and it’s 20x easier than my usual experiences compiling software from source) - -### attempt 1: download a SQLite binary from their website - -The [SQLite download page][2] has a link to a Linux binary for the SQLite command line tool. I downloaded it, it worked on my laptop, and I thought I was done. - -But then I tried to run it on a build server I was using (Netlify), and I got this extremely strange error message: “File not found”. I straced it, and sure enough `execve` was returning the error code ENOENT, which means “File not found”. This was kind of maddening because the file was DEFINITELY there and it had the correct permissions and everything. - -I googled this problem (by searching “execve enoent”), found [this stack overflow answer][3], which pointed out that to run a binary, you don’t just need the binary to exist! You also need its **loader** to exist. (the path to the loader is inside the binary) - -To see the path for the loader you can use `ldd`, like this: - -``` -$ ldd sqlite3 - linux-gate.so.1 (0xf7f9d000) - libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7f70000) - libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7e6e000) - libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf7e4f000) - libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7c73000) - /lib/ld-linux.so.2 -``` - -So `/lib/ld-linux.so.2` is the loader,and that file doesn’t exist on the build server, probably because that Xenial installation didn’t have support for 32-bit binaries (?), and I needed to try something different. - -### attempt 2: install the Debian sqlite3 package - -Okay, I thought, maybe I can install the [sqlite package from debian testing][4]. Trying to install a package from a different Debian version that I’m not using is literally never a good idea, but for some reason I decided to try it anyway. - -Doing this completely unsurprisingly broke the sqlite installation on my computer (which also broke git), but I managed to recover from that with a bunch of `sudo dpkg --purge --force-all libsqlite3-0` and make everything that depended on sqlite work again. - -### attempt 3: extract the Debian sqlite3 package - -I also briefly tried to just extract the sqlite3 binary from the Debian sqlite package and run it. Unsurprisingly, this also didn’t work, but in a more understandable way: I had an older version of libreadline (.so.7) and it wanted .so.8. - -``` -$ ./usr/bin/sqlite3 -./usr/bin/sqlite3: error while loading shared libraries: libreadline.so.8: cannot open shared object file: No such file or directory -``` - -### attempt 4: compile it from source - -The whole reason I spent all this time trying to download sqlite binaries is that I assumed it would be annoying or time consuming to compile sqlite from source. But obviously downloading random sqlite binaries was not working for me at all, so I finally decided to try to compile it myself. - -Here are the directions: [How to compile SQLite][5]. And they’re the EASIEST THING IN THE UNIVERSE. Often compiling things feels like this: - - * run `./configure` - * realize i’m missing a dependency - * run `./configure` again - * run `make` - * the compiler fails because actually i have the wrong version of some dependency - * go do something else and try to find a binary - - - -Compiling SQLite works like this: - - * download an [amalgamation tarball from the download page][2] - * run `gcc shell.c sqlite3.c -lpthread -ldl` - * that’s it!!! - - - -All the code is in one file (`sqlite.c`), and there are no weird dependencies! It’s amazing. - -For my specific use case I didn’t actually need threading support or readline support or anything, so I used the instructions on the compile page to create a very simple binary that only used libc and no other shared libraries. - -``` -$ ldd sqlite3 - linux-vdso.so.1 (0x00007ffe8e7e9000) - libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbea4988000) - /lib64/ld-linux-x86-64.so.2 (0x00007fbea4d79000) -``` - -### this is nice because it makes it easy to experiment with sqlite - -I think it’s cool that SQLite’s build process is so simple because in the past I’ve had fun [editing sqlite’s source code][6] to understand how its btree implementation works. - -This isn’t really super surprising given what I know about SQLite (it’s made to work really well in restricted / embedded contexts, so it makes sense that it would be possible to compile it in a really simple/minimal way). But it is super nice! - --------------------------------------------------------------------------------- - -via: https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/ - -作者:[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://sql-steps.wizardzines.com/lag.html -[2]: https://www.sqlite.org/download.html -[3]: https://stackoverflow.com/questions/5234088/execve-file-not-found-when-stracing-the-very-same-file -[4]: https://packages.debian.org/bullseye/amd64/sqlite3/download -[5]: https://www.sqlite.org/howtocompile.html -[6]: https://jvns.ca/blog/2014/10/02/how-does-sqlite-work-part-2-btrees/ diff --git a/translated/tech/20191028 SQLite is really easy to compile.md b/translated/tech/20191028 SQLite is really easy to compile.md new file mode 100644 index 0000000000..707616de02 --- /dev/null +++ b/translated/tech/20191028 SQLite is really easy to compile.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SQLite is really easy to compile) +[#]: via: (https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/) +[#]: author: (Julia Evans https://jvns.ca/) + +SQLite 真的很容易编译 +====== + +上周,我一直在做一个 SQL 网站(,一个 SQL 示例列表)。我使用 sqlite 运行网站上的所有查询,并且我想在其中一个例子([这个][1])中使用窗口函数。 + +但是我使用的是 Ubuntu 18.04 中的 sqlite 版本,它太旧了,不支持窗口函数。所以我需要升级 sqlite! + +事实证明,这令人讨厌(通常),但是非常有趣!我想起了一些有关可执行文件和共享库如何工作的信息,结论令人满意。所以我想在这里写下来。 + +(剧透: 中解释了如何编译 SQLite,它只需花费 5 秒左右,这比我平时从源码编译的经验容易了许多。) + +### 尝试 1:从它的网站下载 SQLite 二进制文件 + +[SQLite 的下载页面][2]有一个用于 Linux 的 SQLite 命令行工具的二进制文件的链接。我下载了它,它可以在笔记本电脑上运行,我以为这就完成了。 + +但是后来我尝试在构建服务器 (Netlify) 上运行它,得到了这个极其奇怪的错误消息:“File not found”。我进行了追踪,并确定 `execve` 返回错误代码 ENOENT,这意味着 “File not found”。这有点令人发狂,因为该文件确实存在,并且有正确的权限。 + + +我搜索了这个问题(通过搜索 “execve enoen”),找到了[这个 stackoverflow 中的答案][3],它指出要运行二进制文件,你不仅需要二进制文件存在!你还需要它的**加载程序**才能存在。 (加载程序的路径在二进制文件内部) + +要查看加载程序的路径,可以使用 `ldd`,如下所示: + +``` +$ ldd sqlite3 + linux-gate.so.1 (0xf7f9d000) + libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf7f70000) + libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf7e6e000) + libz.so.1 => /lib/i386-linux-gnu/libz.so.1 (0xf7e4f000) + libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf7c73000) + /lib/ld-linux.so.2 +``` + +所以 `/lib/ld-linux.so.2` 是加载程序,而该文件在构建服务器上不存在,可能是因为 Xenial 安装程序不支持 32 位二进制文​​件(?),因此我需要尝试一些不同的东西。 + +### 尝试 2:安装 Debian sqlite3 软件包 + +好吧,我想我也许可以安装来自 [debian testing 的 sqlite 软件包][4]。尝试从另一个我不使用的 Debian 版本安装软件包并不是一个好主意,但是出于某种原因,我还是决定尝试一下。 + +这次毫不意外地破坏了我计算机上的 sqlite(这也破坏了 git),但我设法通过 `sudo dpkg --purge --force-all libsqlite3-0` 从中恢复,并使所有依赖于 sqlite 的软件再次工作。 + +### 尝试 3:提取 Debian sqlite3 软件包 + +我还尝试仅从 Debian sqlite 软件包中提取 sqlite3 二进制文件并运行它。毫不意外,这也行不通,但这个更容易理解:我有旧版本的 libreadline(.so.7),但它需要 .so.8。 + +``` +$ ./usr/bin/sqlite3 +./usr/bin/sqlite3: error while loading shared libraries: libreadline.so.8: cannot open shared object file: No such file or directory +``` + +### 尝试 4:从源代码进行编译 + +我花费这么多时间尝试下载 sqlite 二进制的原因是我认为从源代码编译 sqlite 既烦人又耗时。但是显然,下载随机的 sqlite 二进制文件根本不适合我,因此我最终决定尝试自己编译它。 + +这有指导:[如何编译 SQLite][5]。它是宇宙中最简单的东西。通常,编译的感觉是类似这样的: + + * 运行 `./configure` + * 意识到我缺少依赖 + * 再次运行 `./configure` + * 运行 `make` + * 编译失败,因为我安装了错误版本的依赖 + * 去做其他事,之后找到二进制文件 + + + +编译 SQLite 的方式如下: + + * [从下载页面下载整合的 tarball][[2] + * 运行 `gcc shell.c sqlite3.c -lpthread -ldl` + * 完成!!! + + +所有代码都在一个文件(`sqlite.c`)中,并且没有奇怪的依赖项!太奇妙了。 + +对我而言,我实际上并不需要线程支持或 readline 支持,因此我用编译页面上的说明来创建了一个非常简单的二进制文件,它仅使用了 libc 而没有其他共享库。 + +``` +$ ldd sqlite3 + linux-vdso.so.1 (0x00007ffe8e7e9000) + libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fbea4988000) + /lib64/ld-linux-x86-64.so.2 (0x00007fbea4d79000) +``` + +### 这很好,因为它使体验 sqlite 变得容易 + +我认为 SQLite 的构建过程如此简单很酷,因为过去我很乐于[编辑 sqlite 的源码][6]来了解其 B 树的实现方式。 + +鉴于我对 SQLite 的了解,这并不令人感到意外(它在受限环境/嵌入式中确实可以很好地工作,因此可以以一种非常简单/最小的方式进行编译是有意义的)。 但这真是太好了! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/ + +作者:[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://sql-steps.wizardzines.com/lag.html +[2]: https://www.sqlite.org/download.html +[3]: https://stackoverflow.com/questions/5234088/execve-file-not-found-when-stracing-the-very-same-file +[4]: https://packages.debian.org/bullseye/amd64/sqlite3/download +[5]: https://www.sqlite.org/howtocompile.html +[6]: https://jvns.ca/blog/2014/10/02/how-does-sqlite-work-part-2-btrees/ From e78917a694e770557966271b9ae7433ce31d22a4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Sat, 2 Nov 2019 08:55:58 +0800 Subject: [PATCH 256/800] translating --- ...30 Getting started with awk, a powerful text-parsing tool.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md b/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md index 82f2e1c76e..387dcf8fcd 100644 --- a/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md +++ b/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d33d8ee999cc7c7d9740376bdd17ab0392729f24 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 2 Nov 2019 09:36:06 +0800 Subject: [PATCH 257/800] PRF @wxy --- ...w RPM packages are made- the source RPM.md | 238 ------------------ ...w RPM packages are made- the source RPM.md | 235 +++++++++++++++++ 2 files changed, 235 insertions(+), 238 deletions(-) delete mode 100644 sources/tech/20190826 How RPM packages are made- the source RPM.md create mode 100644 translated/tech/20190826 How RPM packages are made- the source RPM.md diff --git a/sources/tech/20190826 How RPM packages are made- the source RPM.md b/sources/tech/20190826 How RPM packages are made- the source RPM.md deleted file mode 100644 index c65bf22e96..0000000000 --- a/sources/tech/20190826 How RPM packages are made- the source RPM.md +++ /dev/null @@ -1,238 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How RPM packages are made: the source RPM) -[#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/) -[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) - -How RPM packages are made: the source RPM -====== - -![][1] - -In a [previous post, we looked at what RPM packages are][2]. They are archives that contain files and metadata. This metadata tells RPM where to create or remove files from when an RPM is installed or uninstalled. The metadata also contains information on “dependencies”, which you will remember from the previous post, can either be “runtime” or “build time”. - -As an example, we will look at _fpaste_. You can download the RPM using _dnf_. This will download the latest version of _fpaste_ that is available in the Fedora repositories. On Fedora 30, this is currently 0.3.9.2: - -``` -$ dnf download fpaste - -... -fpaste-0.3.9.2-2.fc30.noarch.rpm -``` - -Since this is the built RPM, it contains only files needed to use _fpaste_: - -``` -$ rpm -qpl ./fpaste-0.3.9.2-2.fc30.noarch.rpm -/usr/bin/fpaste -/usr/share/doc/fpaste -/usr/share/doc/fpaste/README.rst -/usr/share/doc/fpaste/TODO -/usr/share/licenses/fpaste -/usr/share/licenses/fpaste/COPYING -/usr/share/man/man1/fpaste.1.gz -``` - -### Source RPMs - -The next link in the chain is the source RPM. All software in Fedora must be built from its source code. We do not include pre-built binaries. So, for an RPM file to be made, RPM (the tool) needs to be: - - * given the files that have to be installed, - * told how to generate these files, if they are to be compiled, for example, - * told where these files must be installed, - * what other dependencies this particular software needs to work properly. - - - -The source RPM holds all of this information. Source RPMs are similar archives to RPM, but as the name suggests, instead of holding the built binary files, they contain the source files for a piece of software. Let’s download the source RPM for _fpaste_: - -``` -$ dnf download fpaste --source -... -fpaste-0.3.9.2-2.fc30.src.rpm -``` - -Notice how the file ends with “src.rpm”. All RPMs are built from source RPMs. You can easily check what source RPM a “binary” RPM comes from using dnf too: - -``` -$ dnf repoquery --qf "%{SOURCERPM}" fpaste -fpaste-0.3.9.2-2.fc30.src.rpm -``` - -Also, since this is the source RPM, it does not contain built files. Instead, it contains the sources and instructions on how to build the RPM from them: - -``` -$ rpm -qpl ./fpaste-0.3.9.2-2.fc30.src.rpm -fpaste-0.3.9.2.tar.gz -fpaste.spec -``` - -Here, the first file is simply the source code for _fpaste_. The second is the “spec” file. The spec file is the recipe that tells RPM (the tool) how to create the RPM (the archive) using the sources contained in the source RPM—all the information that RPM (the tool) needs to build RPMs (the archives) are contained in spec files. When we package maintainers add software to Fedora, most of our time is spent writing and perfecting the individual spec files. When a software package needs an update, we go back and tweak the spec file. You can see the spec files for ALL packages in Fedora at our source repository at - -Note that one source RPM may contain the instructions to build multiple RPMs. _fpaste_ is a very simple piece of software, where one source RPM generates one “binary” RPM. Python, on the other hand is more complex. While there is only one source RPM, it generates multiple binary RPMs: - -``` -$ sudo dnf repoquery --qf "%{SOURCERPM}" python3 -python3-3.7.3-1.fc30.src.rpm -python3-3.7.4-1.fc30.src.rpm - -$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-devel -python3-3.7.3-1.fc30.src.rpm -python3-3.7.4-1.fc30.src.rpm - -$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-libs -python3-3.7.3-1.fc30.src.rpm -python3-3.7.4-1.fc30.src.rpm - -$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-idle -python3-3.7.3-1.fc30.src.rpm -python3-3.7.4-1.fc30.src.rpm - -$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-tkinter -python3-3.7.3-1.fc30.src.rpm -python3-3.7.4-1.fc30.src.rpm -``` - -In RPM jargon, “python3” is the “main package”, and so the spec file will be called “python3.spec”. All the other packages are “sub-packages”. You can download the source RPM for python3 and see what’s in it too. (Hint: patches are also part of the source code): - -``` -$ dnf download --source python3 -python3-3.7.4-1.fc30.src.rpm - -$ rpm -qpl ./python3-3.7.4-1.fc30.src.rpm -00001-rpath.patch -00102-lib64.patch -00111-no-static-lib.patch -00155-avoid-ctypes-thunks.patch -00170-gc-assertions.patch -00178-dont-duplicate-flags-in-sysconfig.patch -00189-use-rpm-wheels.patch -00205-make-libpl-respect-lib64.patch -00251-change-user-install-location.patch -00274-fix-arch-names.patch -00316-mark-bdist_wininst-unsupported.patch -Python-3.7.4.tar.xz -check-pyc-timestamps.py -idle3.appdata.xml -idle3.desktop -python3.spec -``` - -### Building an RPM from a source RPM - -Now that we have the source RPM, and know what’s in it, we can rebuild our RPM from it. Before we do so, though, we should set our system up to build RPMs. First, we install the required tools: - -``` -$ sudo dnf install fedora-packager -``` - -This will install the rpmbuild tool. rpmbuild requires a default layout so that it knows where each required component of the source rpm is. Let’s see what they are: - -``` -# Where should the spec file go? -$ rpm -E %{_specdir} -/home/asinha/rpmbuild/SPECS - -# Where should the sources go? -$ rpm -E %{_sourcedir} -/home/asinha/rpmbuild/SOURCES - -# Where is temporary build directory? -$ rpm -E %{_builddir} -/home/asinha/rpmbuild/BUILD - -# Where is the buildroot? -$ rpm -E %{_buildrootdir} -/home/asinha/rpmbuild/BUILDROOT - -# Where will the source rpms be? -$ rpm -E %{_srcrpmdir} -/home/asinha/rpmbuild/SRPMS - -# Where will the built rpms be? -$ rpm -E %{_rpmdir} -/home/asinha/rpmbuild/RPMS -``` - -I have all of this set up on my system already: - -``` -$ cd -$ tree -L 1 rpmbuild/ -rpmbuild/ -├── BUILD -├── BUILDROOT -├── RPMS -├── SOURCES -├── SPECS -└── SRPMS - -6 directories, 0 files -``` - -RPM provides a tool that sets it all up for you too: - -``` -$ rpmdev-setuptree -``` - -Then we ensure that we have all the build dependencies for _fpaste_ installed: - -``` -sudo dnf builddep fpaste-0.3.9.2-3.fc30.src.rpm -``` - -For _fpaste_ you only need Python and that must already be installed on your system (dnf uses Python too). The builddep command can also be given a spec file instead of an source RPM. Read more in the man page: - -``` -$ man dnf.plugin.builddep -``` - -Now that we have all that we need, building an RPM from a source RPM is as simple as: - -``` -$ rpmbuild --rebuild fpaste-0.3.9.2-3.fc30.src.rpm -.. -.. - -$ tree ~/rpmbuild/RPMS/noarch/ -/home/asinha/rpmbuild/RPMS/noarch/ -└── fpaste-0.3.9.2-3.fc30.noarch.rpm - -0 directories, 1 file -``` - -rpmbuild will install the source RPM and build your RPM from it. You can now install the RPM to use it as you do–using dnf. Of course, as said before, if you want to change anything in the RPM, you must modify the spec file—we’ll cover spec files in next post. - -### Summary - -To summarise this post in two short points: - - * the RPMs we generally install to use software are “binary” RPMs that contain built versions of the software - * these are built from source RPMs that include the source code and the spec file that are needed to generate the binary RPMs. - - - -If you’d like to get started with building RPMs, and help the Fedora community maintain the massive amount of software we provide, you can start here: - -For any queries, post to the [Fedora developers mailing list][3]—we’re always happy to help! - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/ - -作者:[Ankur Sinha "FranciscoD"][a] -选题:[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/ankursinha/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg -[2]: https://fedoramagazine.org/rpm-packages-explained/ -[3]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ diff --git a/translated/tech/20190826 How RPM packages are made- the source RPM.md b/translated/tech/20190826 How RPM packages are made- the source RPM.md new file mode 100644 index 0000000000..1d2e1a53db --- /dev/null +++ b/translated/tech/20190826 How RPM packages are made- the source RPM.md @@ -0,0 +1,235 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How RPM packages are made: the source RPM) +[#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/) +[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) + +RPM 包是如何从源 RPM 制作的 +====== + +![][1] + +在[上一篇文章中,我们研究了什么是 RPM 软件包][2]。它们是包含文件和元数据的档案文件。当安装或卸载 RPM 时,此元数据告诉 RPM 在哪里创建或删除文件。正如你将在上一篇文章中记住的,元数据还包含有关“依赖项”的信息,它可以是“运行时”或“构建时”的依赖信息。 + +例如,让我们来看看 `fpaste`。你可以使用 `dnf` 下载该 RPM。这将下载 Fedora 存储库中可用的 `fpaste` 最新版本。在 Fedora 30 上,当前版本为 0.3.9.2: + +``` +$ dnf download fpaste + +... +fpaste-0.3.9.2-2.fc30.noarch.rpm +``` + +由于这是个构建 RPM,因此它仅包含使用 `fpaste` 所需的文件: + +``` +$ rpm -qpl ./fpaste-0.3.9.2-2.fc30.noarch.rpm +/usr/bin/fpaste +/usr/share/doc/fpaste +/usr/share/doc/fpaste/README.rst +/usr/share/doc/fpaste/TODO +/usr/share/licenses/fpaste +/usr/share/licenses/fpaste/COPYING +/usr/share/man/man1/fpaste.1.gz +``` + +### 源 RPM + +在此链条中的下一个环节是源 RPM。Fedora 中的所有软件都必须从其源代码构建。我们不包括预构建的二进制文件。因此,要制作一个 RPM 文件,RPM(工具)需要: + +* 给出必须要安装的文件, +* 例如,如果要编译出这些文件,则告诉它们如何生成这些文件, +* 告知必须在何处安装这些文件, +* 该特定软件需要其他哪些依赖才能正常工作。 + +源 RPM 拥有所有这些信息。源 RPM 与构建 RPM 相似,但顾名思义,它们不包含已构建的二进制文件,而是包含某个软件的源文件。让我们下载 `fpaste` 的源 RPM: + +``` +$ dnf download fpaste --source + +... +fpaste-0.3.9.2-2.fc30.src.rpm +``` + +注意文件的结尾是 `src.rpm`。所有的 RPM 都是从源 RPM 构建的。你也可以使用 `dnf` 轻松检查“二进制” RPM 的源 RPM: + +``` +$ dnf repoquery --qf "%{SOURCERPM}" fpaste +fpaste-0.3.9.2-2.fc30.src.rpm +``` + +另外,由于这是源 RPM,因此它不包含构建的文件。相反,它包含有关如何从中构建 RPM 的源代码和指令: + +``` +$ rpm -qpl ./fpaste-0.3.9.2-2.fc30.src.rpm +fpaste-0.3.9.2.tar.gz +fpaste.spec +``` + +这里,第一个文件只是 `fpaste` 的源代码。第二个是 spec 文件。spec 文件是个配方,可告诉 RPM(工具)如何使用源 RPM 中包含的源代码创建 RPM(档案文件)— 它包含 RPM(工具)构建 RPM(档案文件)所需的所有信息。在 spec 文件中。当我们软件包维护人员添加软件到 Fedora 中时,我们大部分时间都花在编写和完善 spec 文件上。当软件包需要更新时,我们会回过头来调整 spec 文件。你可以在 的源代码存储库中查看 Fedora 中所有软件包的 spec 文件。 + +请注意,一个源 RPM 可能包含构建多个 RPM 的说明。`fpaste` 是一款非常简单的软件,一个源 RPM 生成一个“二进制” RPM。而 Python 则更复杂。虽然只有一个源 RPM,但它会生成多个二进制 RPM: + +``` +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3 +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-devel +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-libs +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-idle +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm + +$ sudo dnf repoquery --qf "%{SOURCERPM}" python3-tkinter +python3-3.7.3-1.fc30.src.rpm +python3-3.7.4-1.fc30.src.rpm +``` + +用 RPM 行话来讲,“python3” 是“主包”,因此该 spec 文件将称为 `python3.spec`。所有其他软件包均为“子软件包”。你可以下载 python3 的源 RPM,并查看其中的内容。(提示:补丁也是源代码的一部分): + +``` +$ dnf download --source python3 +python3-3.7.4-1.fc30.src.rpm + +$ rpm -qpl ./python3-3.7.4-1.fc30.src.rpm +00001-rpath.patch +00102-lib64.patch +00111-no-static-lib.patch +00155-avoid-ctypes-thunks.patch +00170-gc-assertions.patch +00178-dont-duplicate-flags-in-sysconfig.patch +00189-use-rpm-wheels.patch +00205-make-libpl-respect-lib64.patch +00251-change-user-install-location.patch +00274-fix-arch-names.patch +00316-mark-bdist_wininst-unsupported.patch +Python-3.7.4.tar.xz +check-pyc-timestamps.py +idle3.appdata.xml +idle3.desktop +python3.spec +``` + +### 从源 RPM 构建 RPM + +现在我们有了源 RPM,并且其中有什么内容,我们可以从中重建 RPM。但是,在执行此操作之前,我们应该设置系统以构建 RPM。首先,我们安装必需的工具: + +``` +$ sudo dnf install fedora-packager +``` + +这将安装 `rpmbuild` 工具。`rpmbuild` 需要一个默认布局,以便它知道源 RPM 中每个必需组件的位置。让我们看看它们是什么: + +``` +# spec 文件将出现在哪里? +$ rpm -E %{_specdir} +/home/asinha/rpmbuild/SPECS + +# 源代码将出现在哪里? +$ rpm -E %{_sourcedir} +/home/asinha/rpmbuild/SOURCES + +# 临时构建目录是哪里? +$ rpm -E %{_builddir} +/home/asinha/rpmbuild/BUILD + +# 构建根目录是哪里? +$ rpm -E %{_buildrootdir} +/home/asinha/rpmbuild/BUILDROOT + +# 源 RPM 将放在哪里? +$ rpm -E %{_srcrpmdir} +/home/asinha/rpmbuild/SRPMS + +# 构建的 RPM 将放在哪里? +$ rpm -E %{_rpmdir} +/home/asinha/rpmbuild/RPMS +``` + +我已经在系统上设置了所有这些目录: + +``` +$ cd +$ tree -L 1 rpmbuild/ +rpmbuild/ +├── BUILD +├── BUILDROOT +├── RPMS +├── SOURCES +├── SPECS +└── SRPMS + +6 directories, 0 files +``` + +RPM 还提供了一个为你全部设置好的工具: + +``` +$ rpmdev-setuptree +``` + +然后,确保已安装 `fpaste` 的所有构建依赖项: + +``` +sudo dnf builddep fpaste-0.3.9.2-3.fc30.src.rpm +``` + +对于 `fpaste`,你只需要 Python,并且它肯定已经安装在你的系统上(`dnf` 也使用 Python)。还可以给 `builddep` 命令一个 spec 文件,而不是源 RPM。在手册页中了解更多信息: + +``` +$ man dnf.plugin.builddep +``` + +现在我们有了所需的一切,从源 RPM 构建一个 RPM 就像这样简单: + +``` +$ rpmbuild --rebuild fpaste-0.3.9.2-3.fc30.src.rpm +.. +.. + +$ tree ~/rpmbuild/RPMS/noarch/ +/home/asinha/rpmbuild/RPMS/noarch/ +└── fpaste-0.3.9.2-3.fc30.noarch.rpm + +0 directories, 1 file +``` + +`rpmbuild` 将安装源 RPM 并从中构建你的 RPM。现在,你可以使用 `dnf` 安装 RPM 以使用它。当然,如前所述,如果你想在 RPM 中进行任何更改,则必须修改 spec 文件,我们将在下一篇文章中介绍 spec 文件。 + +### 总结 + +总结一下这篇文章有两点: + +* 我们通常安装使用的 RPM 是包含软件的构建版本的 “二进制” RPM +* 构建 RPM 来自于源 RPM,源 RPM 包括用于生成二进制 RPM 所需的源代码和规范文件。 + +如果你想开始构建 RPM,并帮助 Fedora 社区维护我们提供的大量软件,则可以从这里开始: + +如有任何疑问,请发邮件到 [Fedora 开发人员邮件列表][3],我们随时乐意为你提供帮助! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/ + +作者:[Ankur Sinha "FranciscoD"][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/ankursinha/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg +[2]: https://linux.cn/article-11452-1.html +[3]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ From 09d5a541a458ede01dca1c61ae4a9d136202a582 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 2 Nov 2019 09:37:24 +0800 Subject: [PATCH 258/800] PUB @wxy https://linux.cn/article-11527-1.html --- .../20190826 How RPM packages are made- the source RPM.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20190826 How RPM packages are made- the source RPM.md (98%) diff --git a/translated/tech/20190826 How RPM packages are made- the source RPM.md b/published/20190826 How RPM packages are made- the source RPM.md similarity index 98% rename from translated/tech/20190826 How RPM packages are made- the source RPM.md rename to published/20190826 How RPM packages are made- the source RPM.md index 1d2e1a53db..222ec93038 100644 --- a/translated/tech/20190826 How RPM packages are made- the source RPM.md +++ b/published/20190826 How RPM packages are made- the source RPM.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11527-1.html) [#]: subject: (How RPM packages are made: the source RPM) [#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/) [#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) From 4281a494b0d234b2c4bfeedbf1ede56305ce5709 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 2 Nov 2019 10:11:37 +0800 Subject: [PATCH 259/800] PRF @geekpi --- ...ol new projects to try in COPR for October 2019.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md b/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md index 24cdca0fb8..19fb03219b 100644 --- a/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md +++ b/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (4 cool new projects to try in COPR for October 2019) @@ -18,8 +18,7 @@ COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某 ### Nu -[Nu][4] 或称为 Nushell 是受 PowerShell 和现代 CLI 工具启发的 shell。通过使用基于结构化数据的方法,Nu 可轻松处理命令的输出,并通过管道传输其他命令。然后将结果显示在可以轻松排序或过滤的表中,并可以用作其他命令的输入。最后,Nu 提供了几个内置命令、多 shell 和对插件的支持。 - +[Nu][4] 也被称为 Nushell,是受 PowerShell 和现代 CLI 工具启发的 shell。通过使用基于结构化数据的方法,Nu 可轻松处理命令的输出,并通过管道传输其他命令。然后将结果显示在可以轻松排序或过滤的表中,并可以用作其他命令的输入。最后,Nu 提供了几个内置命令、多 shell 和对插件的支持。 #### 安装说明 @@ -58,7 +57,7 @@ sudo dnf install crow-translate ### dnsmeter -[dnsmeter][10] 是用于测试域名服务器及其基础设施性能的命令行工具。为此,它发送 DNS 查询并计算答复数,从而测量各种统计数据。除此之外,dnsmeter 可以使用不同的加载步骤,使用 PCAP 文件中的 payload 和欺骗发送者地址。 +[dnsmeter][10] 是用于测试域名服务器及其基础设施性能的命令行工具。为此,它发送 DNS 查询并计算答复数,从而测量各种统计数据。除此之外,dnsmeter 可以使用不同的加载步骤,使用 PCAP 文件中的载荷和欺骗发送者地址。 #### 安装说明 @@ -76,7 +75,7 @@ via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2 作者:[Dominik Turecek][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/) 荣誉推出 @@ -91,4 +90,4 @@ via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2 [7]: https://copr.fedorainfracloud.org/coprs/lyessaadi/notekit/ [8]: https://github.com/crow-translate/crow-translate [9]: https://copr.fedorainfracloud.org/coprs/faezebax/crow-translate/ -[10]: https://github.com/DNS-OARC/dnsmeter \ No newline at end of file +[10]: https://github.com/DNS-OARC/dnsmeter From 78e5115bf04a77baf76f29bbc834ce48529cdbf3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 2 Nov 2019 10:12:11 +0800 Subject: [PATCH 260/800] PUB @geekpi https://linux.cn/article-11528-1.html --- ...025 4 cool new projects to try in COPR for October 2019.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191025 4 cool new projects to try in COPR for October 2019.md (98%) diff --git a/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md b/published/20191025 4 cool new projects to try in COPR for October 2019.md similarity index 98% rename from translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md rename to published/20191025 4 cool new projects to try in COPR for October 2019.md index 19fb03219b..73682ef6e5 100644 --- a/translated/tech/20191025 4 cool new projects to try in COPR for October 2019.md +++ b/published/20191025 4 cool new projects to try in COPR for October 2019.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11528-1.html) [#]: subject: (4 cool new projects to try in COPR for October 2019) [#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-october-2019/) [#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) From 6b59a140da154a4d8d1b2d7e5969b4ec29499256 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 2 Nov 2019 10:20:59 +0800 Subject: [PATCH 261/800] APL --- ...orked GIMP into Glimpse Because Gimp is an Offensive Word.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md b/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md index ab1ad90fe7..387840ded7 100644 --- a/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md +++ b/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 74ebb01812611165829d096b19ba2fb6d381ae54 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 2 Nov 2019 11:14:50 +0800 Subject: [PATCH 262/800] TSL&PRF --- ...impse Because Gimp is an Offensive Word.md | 92 ------------------- ...impse Because Gimp is an Offensive Word.md | 84 +++++++++++++++++ 2 files changed, 84 insertions(+), 92 deletions(-) delete mode 100644 sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md create mode 100644 translated/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md diff --git a/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md b/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md deleted file mode 100644 index 387840ded7..0000000000 --- a/sources/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word) -[#]: via: (https://itsfoss.com/gimp-fork-glimpse/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word -====== - -In the world of open source applications, forking is common when members of the community want to take an application in a different direction than the rest. The latest newsworthy fork is named [Glimpse][1] and is intended to fix certain issues that users have with the [GNU Image Manipulation Program][2], commonly known as GIMP. - -### Why create a fork of GIMP? - -![][3] - -When you visit the [homepage][1] of the Glimpse app, it says that the goal of the project is to “experiment with other design directions and fix longstanding bugs.” That doesn’t sound too much out of the ordinary. However, if you start reading the project’s blog posts, a different image appears. - -According to the project’s [first blog post][4], they created this fork because they did not like the GIMP name. According to the post, “A number of us disagree that the name of the software is suitable for all users, and after 13 years of the project refusing to budge on this have decided to fork!” - -If you are wondering why these people find the work GIMP disagreeable they answer that question on the [About page][5]: - -> “If English is not your first language, then you may not have realised that the word “gimp” is problematic. In some countries it is considered a slur against disabled people and a playground insult directed at unpopular children. It can also be linked to certain “after dark” activities performed by consenting adults.” - -They also point out that they are not making this move out of political correctness or being oversensitive. “In addition to the pain it can cause to marginalized communities many of us have our own free software advocacy stories about the GNU Image Manipulation Program not being taken seriously as an option by bosses or colleagues in professional settings.” - -As if to answer many questions, they also said, “It is unfortunate that we have to fork the whole project to change the name, but we feel that discussions about the issue are at an impasse and that this is the most positive way forward.” - -[][6] - -Suggested read  After 6 Years, GIMP 2.10 is Here With Ravishing New Looks and Tons of New Features - -It looks like the Glimpse name is not written in stone. There is [an issue][7] on their GitHub page about possibly picking another name. Maybe they should just drop GNU. I don’t think the word IMP has a bad connotation. - -### A diverging path - -![GIMP 2.10][8] - -[GIMP][6] has been around for over twenty years, so any kind of fork is a big task. Currently, [they are planning][9] to start by releasing Glimpse 0.1 in September 2019. This will be a soft fork, meaning that changes will be mainly cosmetic as they migrate to a new identity. - -Glimpse 1.0 will be a hard fork where they will be actively changing the codebase and adding to it. They want 1.0 to be a port to GTK3 and have its own documentation. They estimate that this will not take place until GIMP 3 is released in 2020. - -Beyond the 1.0, the Glimpse team has plans to forge their own identity. They plan to work on a “front-end UI rewrite”. They are currently discussing [which language][10] they should use for the rewrite. There seems to be a lot of push for D and Rust. They also [hope to][4] “add new functionality that addresses common user complaints” as time goes on. - -### Final Thoughts - -I have used GIMP a little bit in the past but was never too bothered by the name. To be honest, I didn’t know what it meant for quite a while. Interestingly, when I searched Wikipedia for GIMP, I came across an entry for the [GIMP Project][11], which is a modern dance project in New York that includes disabled people. I guess gimp isn’t considered a derogatory term by everyone. - -To me, it seems like a lot of work to go through to change a name. It also seems like the idea of rewriting the UI was tacked to make the project look more worthwhile. I wonder if they will tweak it to bring a more classic UI like [using Ctrl+S to save in GIMP][12]/Glimpse. Let’s wait and watch. - -[][13] - -Suggested read  Finally! WPS Office Has A New Release for Linux - -If you are interested in the project, you can follow them on [Twitter][14], check out their [GitHub account][15], or take a look at their [Patreon page][16]. - -Are you offended by the GIMP name? Do you think it is worthwhile to fork an application, just so you can rename it? 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][17]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/gimp-fork-glimpse/ - -作者:[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://getglimpse.app/ -[2]: https://www.gimp.org/ -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/gimp-fork-glimpse.png?resize=800%2C450&ssl=1 -[4]: https://getglimpse.app/posts/so-it-begins/ -[5]: https://getglimpse.app/about/ -[6]: https://itsfoss.com/gimp-2-10-release/ -[7]: https://github.com/glimpse-editor/Glimpse/issues/92 -[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/08/gimp-screenshot.jpg?resize=800%2C508&ssl=1 -[9]: https://getglimpse.app/posts/six-week-checkpoint/ -[10]: https://github.com/glimpse-editor/Glimpse/issues/70 -[11]: https://en.wikipedia.org/wiki/The_Gimp_Project -[12]: https://itsfoss.com/how-to-solve-gimp-2-8-does-not-save-in-jpeg-or-png-format/ -[13]: https://itsfoss.com/wps-office-2016-linux/ -[14]: https://twitter.com/glimpse_editor -[15]: https://github.com/glimpse-editor/Glimpse -[16]: https://www.patreon.com/glimpse -[17]: https://reddit.com/r/linuxusersgroup diff --git a/translated/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md b/translated/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md new file mode 100644 index 0000000000..64327117e2 --- /dev/null +++ b/translated/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word) +[#]: via: (https://itsfoss.com/gimp-fork-glimpse/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +由于 GIMP 是令人反感的字眼,有人将它复刻了 +====== + +在开源应用程序世界中,当社区成员希望以与其他人不同的方向来开发应用程序时,复刻fork是很常见的。最新的具有新闻价值的一个复刻称为 [Glimpse][1],旨在解决用户在使用 [GNU 图像处理程序][2]GNU Image Manipulation Program(通常称为 GIMP)时遇到的某些问题。 + +### 为什么创建 GIMP 的复刻? + +![][3] + +当你访问 Glimpse 应用的[主页][1]时,它表示该项目的目标是“尝试其他设计方向并修复长期存在的错误。”这听起来并不奇怪。但是,如果你开始阅读该项目的博客文章,则是另外一种印象。 + +根据该项目的[第一篇博客文章][4],他们创建了这个复刻是因为他们不喜欢 GIMP 这个名称。根据该帖子,“我们中的许多人不认为该软件的名称适用于所有用户,并且在拒绝该项目的 13 年后,我们决定复刻!” + +如果你想知道为什么这些人认为 GIMP 令人讨厌,他们在[关于页面][5]中回答该问题: + +> “如果英语不是你的母语,那么你可能没有意识到 ‘gimp’ 一词有问题。在某些国家,这被视为针对残疾人的侮辱和针对不受欢迎儿童的操场侮辱。它也可以与成年人同意的某些‘天黑后’活动联系起来。” + +他们还指出,他们并没有使这一举动脱离政治正确或过于敏感。“除了可能给边缘化社区带来的痛苦外,我们当中许多人都有过倡导自由软件的故事,比如在 GNU 图像处理程序没有被专业环境中的老板或同事视为可选项这件事上。” + +他们似乎在回答许多质疑,“不幸的是,我们不得不复刻整个项目来更改其名称,我们认为有关此问题的讨论陷入了僵局,而这是最积极的前进方向。 ” + +看起来 Glimpse 这个名称不是确定不变的。他们的 GitHub 页面上有个关于可能选择其他名称的[提案][7]。也许他们应该放弃 GNU 这个词,我认为 IMP 这个词没有不好的含义。(LCTT 译注:反讽) + +### 分叉之路 + +![GIMP 2.10][8] + +[GIMP][6] 已经存在了 20 多年,因此任何形式的复刻都是一项艰巨的任务。当前,[他们正在计划][9]首先在 2019 年 9 月发布 Glimpse 0.1。这将是一个软复刻,这意味着在迁移到新身份时的更改将主要是装饰性的。(LCTT 译注:事实上到本译文发布时,该项目仍然处于蛋疼的 0.1 beta,也许 11 月,也许 12 月,才能发布 0.1 的正式版本。) + +Glimpse 1.0 将是一个硬复刻,他们将积极更改代码库并将其添加到代码库中。他们想将 1.0 移植到 GTK3 并拥有自己的文档。他们估计,直到 2020 年 GIMP 3 发布之后才能做到。 + +除了 1.0,Glimpse 团队还计划打响自己的名声。他们计划进行“前端 UI 重写”。他们目前正在讨论[改用哪种语言][10]。D 和 Rust 似乎有很多支持者。随着时间的流逝,他们也[希望][4]“添加新功能以解决普通用户的抱怨”。 + +### 最后的思考 + +我过去曾经使用过一点 GIMP,但从来没有对它的名称感到困扰。老实说,我很长一段时间都不知道这意味着什么。有趣的是,当我在 Wikipedia 上搜索 GIMP 时,看到了一个 [GIMP 项目][11]的条目,这是纽约的一个现代舞蹈项目,其中包括残疾人。我想 gimp 并不是每个人视为一个贬低词汇的。 + +对我来说,更改名称似乎需要大量工作。似乎改写 UI 的想法会使项目看起来更有价值一些。我想知道他们是否会调整它以带来更经典的 UI,例如[使用 Ctrl + S 保存到 GIMP][12] / Glimpse。让我们拭目以待。 + +如果你对该项目感兴趣,可以在 [Twitter][14] 上关注他们,查看其 [GitHub 帐户][15],或查看其 [Patreon 页面][16]。 + +你觉得被 GIMP 名称冒犯了吗?你是否认为值得对应用程序进行复刻,以便你可以对其进行重命名?在下面的评论中让我们知道。 + +如果你觉得这篇文章有趣,请花一点时间在社交媒体、Hacker News 或 [Reddit][17] 上分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gimp-fork-glimpse/ + +作者:[John Paul][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/john/ +[b]: https://github.com/lujun9972 +[1]: https://getglimpse.app/ +[2]: https://www.gimp.org/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/08/gimp-fork-glimpse.png?resize=800%2C450&ssl=1 +[4]: https://getglimpse.app/posts/so-it-begins/ +[5]: https://getglimpse.app/about/ +[6]: https://itsfoss.com/gimp-2-10-release/ +[7]: https://github.com/glimpse-editor/Glimpse/issues/92 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/08/gimp-screenshot.jpg?resize=800%2C508&ssl=1 +[9]: https://getglimpse.app/posts/six-week-checkpoint/ +[10]: https://github.com/glimpse-editor/Glimpse/issues/70 +[11]: https://en.wikipedia.org/wiki/The_Gimp_Project +[12]: https://itsfoss.com/how-to-solve-gimp-2-8-does-not-save-in-jpeg-or-png-format/ +[13]: https://itsfoss.com/wps-office-2016-linux/ +[14]: https://twitter.com/glimpse_editor +[15]: https://github.com/glimpse-editor/Glimpse +[16]: https://www.patreon.com/glimpse +[17]: https://reddit.com/r/linuxusersgroup From be3a0e024c8a19d690efbc8f707b61d960938281 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 2 Nov 2019 11:24:10 +0800 Subject: [PATCH 263/800] PUB @wxy https://linux.cn/article-11529-1.html --- ...ked GIMP into Glimpse Because Gimp is an Offensive Word.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md (98%) diff --git a/translated/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md b/published/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md similarity index 98% rename from translated/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md rename to published/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md index 64327117e2..70abe7d3c9 100644 --- a/translated/talk/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md +++ b/published/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11529-1.html) [#]: subject: (Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word) [#]: via: (https://itsfoss.com/gimp-fork-glimpse/) [#]: author: (John Paul https://itsfoss.com/author/john/) From e53d37ac778ee1547c341139f6a37c37a24b5e4a Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sat, 2 Nov 2019 11:48:01 +0800 Subject: [PATCH 264/800] Translated --- ...leased with New features for Publishers.md | 90 ++++++++++--------- 1 file changed, 48 insertions(+), 42 deletions(-) diff --git a/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md index 60f5d8f421..6869d8add2 100644 --- a/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md +++ b/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md @@ -7,90 +7,96 @@ [#]: via: (https://itsfoss.com/ghost-3-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -Open Source CMS Ghost 3.0 Released with New features for Publishers +开源 CMS Ghost 3.0发布新功能 ====== -[Ghost][1] is a free and open source content management system (CMS). If you are not aware of the term, a CMS is a software that allows you to build a website that is primarily focused on creating content without knowledge of HTML and other web-related technologies. +[Ghost][1]是一个免费的开源内容管理系统(CMS)。 如果你还不了CMS,那我在此解释一下。CMS 是一款软件,用它可以构建专注于创建内容的网站,而无需了解 HTML 和其他与 Web 相关的技术。 -Ghost is in fact one of the [best open source CMS][2] out there. It’s main focus is on creating lightweight, fast loading and good looking blogs. -It has a modern intuitive editor with built-in SEO features. You also have native desktop (Linux including) and mobile apps. If you like terminal, you can also use the CLI tools it provides. +事实上,Ghost 是目前[最好的开源 CMS][2] 之一。 它主要聚焦于创建轻量级、快速加载、界面美观的博客。 -Let’s see what new feature Ghost 3.0 brings. -### New Features in Ghost 3.0 +Ghost 系统有一个现代直观的编辑器,该编辑器内置 SEO(搜索引擎优化)功能。 你也可以用本地桌面(包括Linux 系统)和移动应用程序。 如果你喜欢终端,也可以使用其提供的 CLI(命令行界面)工具。 + +让我们看看Ghost 3.0带来了什么新功能。 + + + +### Ghost 3.0 的新功能 ![][3] -I’m usually intrigued by open source CMS solutions – so after reading the official announcement post, I went ahead and gave it a try by installing a new Ghost instance via [Digital Ocean cloud server][4]. +我通常对开源的 CMS 解决方案很感兴趣。因此,在阅读了官方公告后,我继续尝试通过[Digital Ocean 云服务器][4]来安装新的 Ghost 实例。 +与以前的版本相比,Ghost 3.0 在功能和用户界面上的改进给我留下了深刻的印象。 -I was really impressed with the improvements they’ve made with the features and the UI compared to the previous version. +在此,我将列出一些值得一提的关键点。 -Here, I shall list out the key changes/additions worth mentioning. - -#### Bookmark Cards +#### 书签卡 ![][5] -In addition to all the subtle change to the editor, it now lets you add a beautiful bookmark card by just entering the URL. +除了编辑器的所有细微更改之外,3.0版本现在支持通过输入 URL 添加漂亮的书签卡。 -If you have used WordPress – you may have noticed that you need to have a plugin in order to add a card like that – so it is definitely a useful addition in Ghost 3.0. +如果你使用过WordPress(你可能已经注意到,WordPress 需要添加一个插件才能添加类似的卡片),所以该功能绝对是Ghost 3.0 系统的一个最大改进。 -#### Improved WordPress Migration Plugin -I haven’t tested this in particular but they have updated their WordPress migration plugin to let you easily clone the posts (with images) to Ghost CMS. +#### 改进的 WordPress 迁移插件 -Basically, with the plugin, you will be able to create an archive (with images) and import it to Ghost CMS. +我还未对 WordPress 进行特别测试,但它已经对 WordPress 的迁移插件进行了更新,可以让你轻松地将帖子(带有图片)克隆到 Ghost CMS。 -#### Responsive Image Galleries & Images +基本上,使用该插件,你就能够创建一个存档(包含图片)并将其导入到Ghost CMS。 -To make the user experience better, they have also updated the image galleries (which is now responsive) to present your picture collection comfortably across all devices. -In addition, the images in post/pages are now responsive as well. -#### Members & Subscriptions option +#### 响应式图像库和图片 + +为了使用户体验更好,Ghost 团队还更新了图像库(现已为响应式),以便在所有设备上舒适地呈现你的图片集。 + +此外,帖子和页面中的图片也更改为响应式的了。 + + + +#### 添加成员和订阅选项 ![Ghost Subscription Model][6] -Even though the feature is still in the beta phase, it lets you add members and a subscription model for your blog if you choose to make it a premium publication to sustain your business. +虽然,该功能目前还处于测试阶段,但如果你是以此平台作为维持你业务关系的重要发布平台,你可以为你的博客添加成员,订阅选项。 +该功能可以确保只有订阅的成员才能访问你的博客,你也可以选择让未订阅者也可以访问。 -With this feature, you can make sure that your blog can only be accessed by the subscribed members or choose to make it available to the public in addition to the subscription. -#### Stripe: Payment Integration +#### 条纹(美国公司):支付整合 -It supports Stripe payment gateway by default to help you easily enable the subscription (or any type of payments) with no additional fee charged by Ghost. +默认情况下,该版本支持 Stripe 付款网关,帮助你轻松订阅(或使用任何类型的付款的付款方式),而 Ghost 不再收取任何额外费用。 -#### New App Integrations +#### 新的应用程序集成 ![][7] -You can now integrate a variety of popular applications/services with your blog on Ghost 3.0. It could come in handy to automate a lot of things. +你现在可以在 Ghost 3.0 的博客中集成各种流行的应用程序/服务。 它可以使很多事情自动化。 -#### Default Theme Improvement +#### 默认主题改进 -The default theme (design) that comes baked in has improved and now offers a dark mode as well. +引入的默认主题(设计)已得到改进,现在也提供了夜间模式。 +你也可以随时选择创建自定义主题(如果没有可用的预置主题)。 -You can always choose to create a custom theme as well (if not pre-built themes available). +#### 其他小改进 -#### Other Minor Improvements -In addition to all the key highlights, the visual editor to create posts/pages has improved as well (with some drag and drop capabilities). +除了所有关键亮点以外,用于创建帖子/页面的可视编辑器也得到了改进(具有某些拖放功能)。 +我确定还有很多技术方面的更改-如果你对此感兴趣,可以在他们的[更改日志][8] 中查看。 -I’m sure there’s a lot of technical changes as well – which you can check it out in their [changelog][8] if you’re interested. -### Ghost is gradually getting good traction +### Ghost 逐渐获得好的影响力 -It’s not easy to make your mark in a world dominated by WordPress. But Ghost has gradually formed a dedicated community of publishers around it. +要在以 WordPress 为主导的世界中获得认可并不是一件容易的事。 但 Ghost逐渐形成了一个专门的发布者社区。 +不仅如此,它的托管服务 [Ghost Pro][9] 现在拥有像 NASA,Mozilla 和 DuckDuckGo 这样的客户。 -Not only that, their managed hosting service [Ghost Pro][9] now has customers like NASA, Mozilla and DuckDuckGo. -In last six years, Ghost has made $5 million in revenue from their Ghost Pro customers . Considering that they are a non-profit organization working on open source solution, this is indeed an achievement. +在过去的六年中,Ghost 从其 Ghost Pro 客户那里获得了500万美元的收入。 就从它是致力于开源系统解决方案的非营利组织这一点来讲,这确实是一项成就。 +这些收入有助于它们保持独立,避免风险投资家的外部资金投入。Ghost CMS 的 托管客户越多,投入到免费和开源的 CMS 的研发款就越多。 +总体而言,Ghost 3.0 是迄今为止提供的最好的升级版本。 这些功能给我留下了深刻的印象。 +如果你拥有自己的网站,你会使用什么CMS吗? 你曾经使用过Ghost吗? 你的体验如何? 请在评论部分分享你的想法。 -This helps them remain independent by avoiding external funding from venture capitalists. The more customers for managed Ghost CMS hosting, the more funds goes into the development of the free and open source CMS. - -Overall, Ghost 3.0 is by far the best upgrade they’ve offered. I’m personally impressed with the features. - -If you have websites of your own, what CMS do you use? Have you ever used Ghost? How’s your experience with it? Do share your thoughts in the comment section. -------------------------------------------------------------------------------- @@ -98,7 +104,7 @@ via: https://itsfoss.com/ghost-3-release/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[Morisun029](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From fd422813a9bfac51967702a3109967c97e58a97d Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sat, 2 Nov 2019 11:50:59 +0800 Subject: [PATCH 265/800] Translated --- ...rce CMS Ghost 3.0 Released with New features for Publishers.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md (100%) diff --git a/sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md similarity index 100% rename from sources/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md rename to translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md From a04bdbf91de421df716e0ce1a9c77fbb27f0a1e5 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Sat, 2 Nov 2019 11:52:29 +0800 Subject: [PATCH 266/800] translated --- ...CMS Ghost 3.0 Released with New features for Publishers.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md index 6869d8add2..6ed5b8b71a 100644 --- a/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md +++ b/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md @@ -83,6 +83,7 @@ Ghost 系统有一个现代直观的编辑器,该编辑器内置 SEO(搜索 除了所有关键亮点以外,用于创建帖子/页面的可视编辑器也得到了改进(具有某些拖放功能)。 + 我确定还有很多技术方面的更改-如果你对此感兴趣,可以在他们的[更改日志][8] 中查看。 @@ -93,8 +94,11 @@ Ghost 系统有一个现代直观的编辑器,该编辑器内置 SEO(搜索 在过去的六年中,Ghost 从其 Ghost Pro 客户那里获得了500万美元的收入。 就从它是致力于开源系统解决方案的非营利组织这一点来讲,这确实是一项成就。 + 这些收入有助于它们保持独立,避免风险投资家的外部资金投入。Ghost CMS 的 托管客户越多,投入到免费和开源的 CMS 的研发款就越多。 + 总体而言,Ghost 3.0 是迄今为止提供的最好的升级版本。 这些功能给我留下了深刻的印象。 + 如果你拥有自己的网站,你会使用什么CMS吗? 你曾经使用过Ghost吗? 你的体验如何? 请在评论部分分享你的想法。 From 59536d389715704f7f5ab94c7894bb0215c58463 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 3 Nov 2019 10:25:58 +0800 Subject: [PATCH 267/800] PRF @geekpi --- ...est Password Managers For Linux Desktop.md | 118 ++++++++---------- 1 file changed, 55 insertions(+), 63 deletions(-) diff --git a/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md b/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md index 63f9c21656..a49d66d98d 100644 --- a/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md +++ b/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 Best Password Managers For Linux Desktop) @@ -10,11 +10,13 @@ 5 个 Linux 桌面上的最佳密码管理器 ====== -_ **密码管理器是创建唯一密码并安全存储它们的有用工具,这样你无需记住密码。了解适用于 Linux 桌面的最佳密码管理器。** _ +> 密码管理器是创建唯一密码并安全存储它们的有用工具,这样你无需记住密码。了解一下适用于 Linux 桌面的最佳密码管理器。 -密码无处不在。网站、论坛、Web 应用等,你需要为其创建帐户和密码。麻烦的是密码。为各个帐户使用相同的密码会带来安全风险,因为[如果其中一个网站遭到入侵,黑客也会在其他网站上尝试相同的电子邮件密码组合][1]。 +![](https://img.linux.net.cn/data/attachment/album/201911/03/102528e97mr0ls89lz9rrr.jpg) -但是,为所有新帐户设置唯一的密码意味着你必须记住所有密码,这对普通人而言不太可能。这就是密码管理器可以提供帮助的地方。 +密码无处不在。网站、论坛、Web 应用等,你需要为其创建帐户和密码。麻烦在于密码,为各个帐户使用相同的密码会带来安全风险,因为[如果其中一个网站遭到入侵,黑客也会在其他网站上尝试相同的电子邮件密码组合][1]。 + +但是,为所有新帐户设置独有的密码意味着你必须记住所有密码,这对普通人而言不太可能。这就是密码管理器可以提供帮助的地方。 密码管理应用会为你建议/创建强密码,并将其存储在加密的数据库中。你只需要记住密码管理器的主密码即可。 @@ -26,121 +28,111 @@ _ **密码管理器是创建唯一密码并安全存储它们的有用工具, ### Linux 密码管理器 -可能的非 FOSS 警报! +> 可能的非 FOSS 警报! -我们优先考虑开源软件(有一些专有软件,请不要讨厌我!),并提供适用于 Linux 的独立桌面应用(GUI)。专有软件已高亮显示。 +> 我们优先考虑开源软件(有一些专有软件,请不要讨厌我!),并提供适用于 Linux 的独立桌面应用(GUI)。专有软件已高亮显示。 -#### 1\. Bitwarden +#### 1、Bitwarden ![][3] 主要亮点: - * 开源 -  * 免费供个人使用(可选付费升级) -  * 云服务器的端到端加密 -  * 跨平台 -  * 有浏览器扩展 -  * 命令行工具 - - +* 开源 +* 免费供个人使用(可选付费升级) +* 云服务器的端到端加密 +* 跨平台 +* 有浏览器扩展 +* 命令行工具 Bitwarden 是 Linux 上最令人印象深刻的密码管理器之一。老实说,直到现在我才知道它。我已经从 [LastPass][4] 切换到了它。我能够轻松地从 LastPass 导入数据,而没有任何问题和困难。 -高级版本的价格仅为每年 10 美元。这似乎是值得的(我已经为个人使用进行了升级)。 +付费版本的价格仅为每年 10 美元。这似乎是值得的(我已经为个人使用进行了升级)。 它是一个开源解决方案,因此没有任何可疑之处。你甚至可以将其托管在自己的服务器上,并为你的组织创建密码解决方案。 -除此之外,你还将获得所有必需的功能,例如用于登录的两步验证、导入/导出凭据,指纹短语(唯一键),密码生成器等等。 +除此之外,你还将获得所有必需的功能,例如用于登录的两步验证、导入/导出凭据、指纹短语(唯一键)、密码生成器等等。 -你可以免费将帐户升级为组织帐户,以便最多与 2 个用户共享你的信息。但是,如果你想要额外的加密存储以及与 5 个用户共享密码的功能,那么高级升级的费用低至每月 1 美元。我认为绝对值得一试! +你可以免费将帐户升级为组织帐户,以便最多与 2 个用户共享你的信息。但是,如果你想要额外的加密存储以及与 5 个用户共享密码的功能,那么付费升级的费用低至每月 1 美元。我认为绝对值得一试! -[Bitwarden][5] +- [Bitwarden][5] -#### 2\. Buttercup +#### 2、Buttercup ![][6] 主要亮点: - * 开源 -  * 免费,没有高级选项。 -  * 跨平台 -  * 有浏览器扩展 +* 开源 +* 免费,没有付费方式。 +* 跨平台 +* 有浏览器扩展 +这是 Linux 中的另一个开源密码管理器。Buttercup 可能不是一个非常流行的解决方案。但是,如果你在寻找一种更简单的保存凭据的方法,那么这将是一个不错的开始。 - -Linux 中的另一个开源密码管理器。Buttercup 可能不是一个非常流行的解决方案。但是,如果你在寻找一种更简单的方法来保存凭据,那么这将是一个不错的开始。 - -与其他软件不同,你不必对其云服务器持怀疑态度,因为它只支持离线使用并支持连接 [Dropbox][7]、[OwnCloud] [8]、[Nextcloud][9] 和 [WebDAV][10] 等云服务。 +与其他软件不同,你不必对怀疑其云服务器的安全,因为它只支持离线使用并支持连接 [Dropbox][7]、[OwnCloud] [8]、[Nextcloud][9] 和 [WebDAV][10] 等云服务。 因此,如果需要同步数据,那么可以选择云服务。你有不同选择。 -[Buttercup][11] +- [Buttercup][11] -#### 3\. KeePassXC +#### 3、KeePassXC ![][12] 主要亮点: - * 开源 -  * 简单的密码管理器 -  * 跨平台 -  * 没有移动支持 +* 开源 +* 简单的密码管理器 +* 跨平台 +* 没有移动设备支持 - - -KeePassXC 是 [KeePassX][13] 的社区分支,它最初是 Windows 上 [KeePass][14] 的 Linux 移植。 +KeePassXC 是 [KeePassX][13] 的社区分支,它最初是 Windows 上 [KeePass][14] 的 Linux 移植版本。 除非你没意识到,KeePassX 已经多年没有维护。因此,如果你在寻找简单易用的密码管理器,那么 KeePassXC 是一个不错的选择。KeePassXC 可能不是最漂亮或最好的密码管理器,但它确实可以做到该做的事。 它也是安全和开源的。我认为这值得一试,你说呢? -[KeePassXC][15] +- [KeePassXC][15] -#### 4\. Enpass (非开源) +#### 4、Enpass (非开源) ![][16] 主要亮点: - * 专有 -  * 许多功能-包括“可穿戴”设备支持。 -  * Linux 完全免费(具有高级功能) - - +* 专有软件 +* 有许多功能,包括对“可穿戴”设备支持。 +* Linux 完全免费(具有付费支持) Enpass 是非常流行的跨平台密码管理器。即使它不是开源解决方案,但还是有很多人依赖它。因此,至少可以肯定它是可行的。 -它提供了很多功能,如果你有可穿戴设备,它也将支持它,这点很少见。 +它提供了很多功能,如果你有可穿戴设备,它也可以支持它,这点很少见。 -很高兴看到 Enpass 积极管理 Linux 发行版的软件包。另外,请注意,它仅适用于 64 位系统。你可以在它的网站上找到[官方的安装说明] [17]。它需要使用终端,但是我按照步骤进行了测试,它非常好用。 +很高兴能看到 Enpass 积极管理 Linux 发行版的软件包。另外,请注意,它仅适用于 64 位系统。你可以在它的网站上找到[官方的安装说明] [17]。它需要使用终端,但是我按照步骤进行了测试,它非常好用。 -[Enpass][18] +- [Enpass][18] -#### 5\. myki (非开源) +#### 5、myki (非开源) ![][19] 主要亮点: - * 专有 -  * 不使用云服务器存储密码 -  * 专注于本地点对点同步 -  * 能够在移动设备上用指纹 ID 替换密码 +* 专有软件 +* 不使用云服务器存储密码 +* 专注于本地点对点同步 +* 能够在移动设备上用指纹 ID 替换密码 +这可能不是一个受欢迎的建议,但我发现它很有趣。它是专有软件密码管理器,它让你避免使用云服务器,而是依靠点对点同步。 +因此,如果你不想使用任何云服务器来存储你的信息,那么它适合你。另外值得注意的是,用于 Android 和 iOS 的程序可让你用指纹 ID 替换密码。如果你希望便于在手机上使用,又有桌面密码管理器的基本功能,这似乎是个不错的选择。 -这可能不是一个受欢迎的建议,但我发现它很有趣。它是专有的密码管理器,它让你避免使用云服务器,并依靠点对点同步。 - -因此,如果你不想使用任何云服务器来存储你的信息,那么它适合你。另外值得注意的是,用于 Android 和 iOS 的程序可帮助你用指纹 ID 替换密码。如果你希望在手机上使用方便,还有桌面密码管理器的基本功能,这似乎是个不错的选择。 - -但是,如果你选择升级到高级版,这有个付费计划供你判断,绝对不便宜。 +但是,如果你选择升级到付费版,这有个付费计划供你判断,绝对不便宜。 尝试一下,让我们知道它如何! -[myki][20] +- [myki][20] ### 其他一些值得说的密码管理器 @@ -150,13 +142,13 @@ Enpass 是非常流行的跨平台密码管理器。即使它不是开源解决 如果你正在寻找命令行密码管理器,那你应该试试 [Pass][25]。 -[Password Safe][26] 也是种选择,但它的 Linux 客户端还处于 beta。我不建议依靠 “beta” 程序来存储密码。还有 [Universal Password Manager][27],但它不再维护。你可能也听说过 [Password Gorilla][28],但并它没有积极维护。 +[Password Safe][26] 也是种选择,但它的 Linux 客户端还处于 beta 阶段。我不建议依靠 “beta” 程序来存储密码。还有 [Universal Password Manager][27],但它不再维护。你可能也听说过 [Password Gorilla][28],但并它没有积极维护。 -**总结** +### 总结 -目前,Bitwarden 似乎是我个人的最爱。但是,在 Linux 上有几个选项可供选择。你可以选择提供原生应用的程序,也可选择浏览器插件,选择权在你。 +目前,Bitwarden 似乎是我个人的最爱。但是,在 Linux 上有几个替代品可供选择。你可以选择提供原生应用的程序,也可选择浏览器插件,选择权在你。 -如果有错过值得尝试的密码管理器,请在下面的评论中告诉我们。与往常一样,我们会根据你的建议扩展列表。 +如果我有错过值得尝试的密码管理器,请在下面的评论中告诉我们。与往常一样,我们会根据你的建议扩展列表。 -------------------------------------------------------------------------------- @@ -165,7 +157,7 @@ via: https://itsfoss.com/password-managers-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 c549f6a68470d9ad2be57fba8c1df41c25abcac0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 3 Nov 2019 10:26:44 +0800 Subject: [PATCH 268/800] PUB @geekpi https://linux.cn/article-11531-1.html --- .../20191008 5 Best Password Managers For Linux Desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191008 5 Best Password Managers For Linux Desktop.md (99%) diff --git a/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md b/published/20191008 5 Best Password Managers For Linux Desktop.md similarity index 99% rename from translated/tech/20191008 5 Best Password Managers For Linux Desktop.md rename to published/20191008 5 Best Password Managers For Linux Desktop.md index a49d66d98d..ebdda1f376 100644 --- a/translated/tech/20191008 5 Best Password Managers For Linux Desktop.md +++ b/published/20191008 5 Best Password Managers For Linux Desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11531-1.html) [#]: subject: (5 Best Password Managers For Linux Desktop) [#]: via: (https://itsfoss.com/password-managers-linux/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From a2fa04a254ae248a986f4a21aae5ffab14d8ec45 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 3 Nov 2019 13:39:25 +0800 Subject: [PATCH 269/800] PRF @laingke --- .../20191022 Initializing arrays in Java.md | 107 ++++++++---------- 1 file changed, 45 insertions(+), 62 deletions(-) diff --git a/translated/tech/20191022 Initializing arrays in Java.md b/translated/tech/20191022 Initializing arrays in Java.md index 839346336e..a6b01458f4 100644 --- a/translated/tech/20191022 Initializing arrays in Java.md +++ b/translated/tech/20191022 Initializing arrays in Java.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Initializing arrays in Java) @@ -9,7 +9,9 @@ Java 中初始化数组 ====== -数组是一种有用的数据类型,用于管理在连续内存位置中建模最好的集合元素。下面是如何有效地使用它们。 + +> 数组是一种有用的数据类型,用于管理在连续内存位置中建模最好的集合元素。下面是如何有效地使用它们。 + ![Coffee beans and a cup of coffee][1] 有使用 C 或者 FORTRAN 语言编程经验的人会对数组的概念很熟悉。它们基本上是一个连续的内存块,其中每个位置都是某种数据类型:整型、浮点型或者诸如此类的数据类型。 @@ -20,29 +22,23 @@ Java 的情况与此类似,但是有一些额外的问题。 让我们在 Java 中创建一个长度为 10 的整型数组: - ``` int[] ia = new int[10]; ``` 上面的代码片段会发生什么?从左到右依次是: - 1. 最左边的 **int[]** 将数组变量的 _类型_ 声明为 **int**(由 **[]**表示)。 + 1. 最左边的 `int[]` 将变量的*类型*声明为 `int` 数组(由 `[]` 表示)。 + 2. 它的右边是变量的名称,当前为 `ia`。 + 3. 接下来,`=` 告诉我们,左侧定义的变量赋值为右侧的内容。 + 4. 在 `=` 的右侧,我们看到了 `new`,它在 Java 中表示一个对象正在*被初始化中*,这意味着已为其分配存储空间并调用了其构造函数([请参见此处以获取更多信息][2])。 + 5. 然后,我们看到 `int[10]`,它告诉我们正在初始化的这个对象是包含 10 个整型的数组。 - 2. 它的右边是变量的名称,当前为 **ia**。 - - 3. 接下来,**=** 告诉我们,左侧定义的变量赋值为右侧的内容。 - - 4. 在 **=** 的右侧,我们看到了 **new**,它在 Java 中表示一个对象正在 _被初始化_ 中,这意味着已为其分配存储空间并调用了其构造函数([请参见此处以获取更多信息][2])。 - - 5. 然后,我们看到 **int[10]**,它告诉我们正在初始化的这个对象是包含 10 个整型的数组。 - - -因为 Java 是强类型的,所以变量 **ia** 的类型必须跟 **=** 右侧表达式的类型兼容。 +因为 Java 是强类型的,所以变量 `ia` 的类型必须跟 `=` 右侧表达式的类型兼容。 ### 初始化示例数组 -让我们把这个简单的数组放在一段代码中,并尝试运行一下。将以下内容保存到一个名为 **Test1.java** 的文件中,使用 **javac** 编译,使用 **java** 运行(当然是在终端中): +让我们把这个简单的数组放在一段代码中,并尝试运行一下。将以下内容保存到一个名为 `Test1.java` 的文件中,使用 `javac` 编译,使用 `java` 运行(当然是在终端中): ``` import java.lang.*; @@ -61,15 +57,12 @@ public class Test1 { 让我们来看看最重要的部分。 - 1. 我们很容易发现长度为 10 的整型数组,**ia** 的声明和初始化。 - 2. 在下面的行中,我们看到表达式 **ia.getClass()**。没错,**ia** 是属于一个 _类_ 的 _对象_,这行代码将告诉我们是哪个类。 - 3. 在紧接的下一行中,我们看到了一个循环 **for (int i = 0; i < ia.length; i++)**,它定义了一个循环索引变量 **i**,该变量运行的序列从 0 到比 **ia.length** 小 1,这个表达式告诉我们在数组 **ia** 中定义了多少个元素。 - 4. 接下来,循环体打印出 **ia** 的每个元素的值。 - - - -当这个程序被编译和运行时,它产生以下结果: + 1. 我们声明和初始化了长度为 10 的整型数组,即 `ia`,这显而易见。 + 2. 在下面的行中,我们看到表达式 `ia.getClass()`。没错,`ia` 是属于一个*类*的*对象*,这行代码将告诉我们是哪个类。 + 3. 在紧接的下一行中,我们看到了一个循环 `for (int i = 0; i < ia.length; i++)`,它定义了一个循环索引变量 `i`,该变量遍历了从 0 到比 `ia.length` 小 1 的序列,这个表达式告诉我们在数组 `ia` 中定义了多少个元素。 + 4. 接下来,循环体打印出 `ia` 的每个元素的值。 +当这个程序编译和运行时,它产生以下结果: ``` me@mydesktop:~/Java$ javac Test1.java @@ -88,7 +81,7 @@ ia[9] = 0 me@mydesktop:~/Java$ ``` -**ia.getClass()** 的输出的字符串表示形式是 **[I**,它是“整数数组”的简写。与 C 语言类似,Java 数组以第 0 个元素开始,扩展到第 **<数组大小> - 1** 个元素。我们可以在上面看到数组 ia 的每个元素都设置为零(看来是数组构造函数)。 +`ia.getClass()` 的输出的字符串表示形式是 `[I`,它是“整数数组”的简写。与 C 语言类似,Java 数组以第 0 个元素开始,扩展到第 `<数组大小> - 1` 个元素。如上所见,我们可以看到数组 `ia` 的每个元素都(似乎由数组构造函数)设置为零。 所以,就这些吗?声明类型,使用适当的初始化器,就完成了吗? @@ -105,15 +98,14 @@ int[] callsMade; int[] callsReceived; ``` -然后,每当我们开始一个新的累积呼叫统计数据的周期时,我们就将每个数组初始化为: +然后,每当我们开始一个新的累计呼叫统计数据的周期时,我们就将每个数组初始化为: ``` callsMade = new int[9]; callsReceived = new int[9]; ``` -在每个累积通话统计数据的最后阶段,我们可以打印出统计数据。粗略地说,我们可能会看到: - +在每个累计通话统计数据的最后阶段,我们可以打印出统计数据。粗略地说,我们可能会看到: ``` import java.lang.*; @@ -151,7 +143,6 @@ public class Test2 { 这会产生这样的输出: - ``` me@mydesktop:~/Java$ javac Test2.java me@mydesktop:~/Java$ java Test2 @@ -168,11 +159,11 @@ ext calls made calls received me@mydesktop:~/Java$ ``` -呼叫中心不是很忙的一天。 +看来这一天呼叫中心不是很忙。 在上面的累加器示例中,我们看到由数组初始化程序设置的零起始值可以满足我们的需求。但是在其它情况下,这个起始值可能不是正确的选择。 -例如,在某些几何计算中,我们可能需要将二维数组初始化为单位矩阵(除沿主对角线的那些零以外的所有零)。我们可以选择这样做: +例如,在某些几何计算中,我们可能需要将二维数组初始化为单位矩阵(除沿主对角线———左上角到右下角——以外所有全是零)。我们可以选择这样做: ``` @@ -182,7 +173,7 @@ for (int d = 0; d < 3; d++) { } ``` -在这种情况下,我们依靠数组初始化器 **new double[3][3]** 将数组设置为零,然后使用循环将对角元素设置为 1。 在这种简单情况下,我们可以使用 Java 提供的快捷方式: +在这种情况下,我们依靠数组初始化器 `new double[3][3]` 将数组设置为零,然后使用循环将主对角线上的元素设置为 1。在这种简单情况下,我们可以使用 Java 提供的快捷方式: ``` double[][] m = { @@ -191,7 +182,7 @@ double[][] m = { {0.0, 0.0, 1.0}}; ``` -这种可视结构特别适用于这种应用程序,在这种应用程序中,可以通过双重检查查看数组的实际布局。但是在这种情况下,行数和列数只在运行时确定,我们可能会看到这样的东西: +这种可视结构特别适用于这种应用程序,在这种应用程序中,它便于复查数组的实际布局。但是在这种情况下,行数和列数只在运行时确定时,我们可能会看到这样的东西: ``` int nrc; @@ -202,8 +193,7 @@ for (int d = 0; d < nrc; d++) { } ``` -值得一提的是,Java 中的二维数组实际上是数组的数组,没有什么能阻止无畏的程序员让这些第二级数组中的每个数组的长度都不同。也就是说,下面这样的事情是完全合法的: - +值得一提的是,Java 中的二维数组实际上是数组的数组,没有什么能阻止无畏的程序员让这些第二层数组中的每个数组的长度都不同。也就是说,下面这样的事情是完全合法的: ``` int [][] differentLengthRows = { @@ -220,19 +210,19 @@ int [][] differentLengthRows = { differentLengthRows.length ``` -告诉我们二维数组 **differentLengthRows** 的行数,并且: +可以告诉我们二维数组 `differentLengthRows` 的行数,并且: ``` differentLengthRows[i].length ``` -告诉我们 **differentLengthRows** 第 **i** 行的列数。 +告诉我们 `differentLengthRows` 第 `i` 行的列数。 ### 深入理解数组 考虑到在运行时确定数组大小的想法,我们看到数组在实例化之前仍需要我们知道该大小。但是,如果在处理完所有数据之前我们不知道大小怎么办?这是否意味着我们必须先处理一次以找出数组的大小,然后再次处理?这可能很难做到,尤其是如果我们只有一次机会使用数据时。 -[Java 集合框架][6]很好地解决了这个问题。提供的其中一项是 **ArrayList** 类,它类似于数组,但可以动态扩展。为了演示 **ArrayList** 的工作原理,让我们创建一个 ArrayList 并将其初始化为前 20 个[斐波那契数字][7]: +[Java 集合框架][6]很好地解决了这个问题。提供的其中一项是 `ArrayList` 类,它类似于数组,但可以动态扩展。为了演示 `ArrayList` 的工作原理,让我们创建一个 `ArrayList` 对象并将其初始化为前 20 个[斐波那契数字][7]: ``` import java.lang.*; @@ -258,20 +248,17 @@ public class Test3 { } ``` -上面的代码中,我们看到: +上面的代码中,我们看到: - * 用于存储多个 **Integer** 的 **ArrayList** 的声明和实例化。 - * 使用 **add()** 附加到 **ArrayList** 实例。 - * 使用 **get()** 通过索引号检索元素。 - * 使用 **size()** 来确定 **ArrayList** 实例中已经有多少个元素。 + * 用于存储多个 `Integer` 的 `ArrayList` 的声明和实例化。 + * 使用 `add()` 附加到 `ArrayList` 实例。 + * 使用 `get()` 通过索引号检索元素。 + * 使用 `size()` 来确定 `ArrayList` 实例中已经有多少个元素。 - - -没有显示 **put()** 方法,它的作用是将一个值放在给定的索引号上。 +这里没有展示 `put()` 方法,它的作用是将一个值放在给定的索引号上。 该程序的输出为: - ``` fibonacci 0 = 0 fibonacci 1 = 1 @@ -295,20 +282,19 @@ fibonacci 18 = 2584 fibonacci 19 = 4181 ``` -**ArrayList** 实例也可以通过其它方式初始化。例如,一个数组可以提供给 **ArrayList** 构造器,或者 **List.of()** 和 **array.aslist()** 方法可以在编译过程中知道初始元素时使用。我发现自己并不经常使用这些选项,因为我对 **ArrayList** 的主要用途是我只想读取一次数据。 +`ArrayList` 实例也可以通过其它方式初始化。例如,可以给 `ArrayList` 构造器提供一个数组,或者在编译过程中知道初始元素时也可以使用 `List.of()` 和 `array.aslist()` 方法。我发现自己并不经常使用这些方式,因为我对 `ArrayList` 的主要用途是当我只想读取一次数据时。 -此外,对于那些喜欢在加载数据后使用数组的人,可以使用 **ArrayList** 的 **toArray()** 方法将其实例转换为数组;或者,在初始化 **ArrayList** 实例之后,返回到当前数组本身。 +此外,对于那些喜欢在加载数据后使用数组的人,可以使用 `ArrayList` 的 `toArray()` 方法将其实例转换为数组;或者,在初始化 `ArrayList` 实例之后,返回到当前数组本身。 -Java 集合框架提供了另一种类似数组的数据结构,称为 **Map**。我所说的“类似数组”是指 **Map** 定义了一个对象集合,它的值可以通过一个键来设置或检索,但与数组(或 **ArrayList**)不同,这个键不需要是整型数;它可以是 **String** 或任何其它复杂对象。 +Java 集合框架提供了另一种类似数组的数据结构,称为 `Map`(映射)。我所说的“类似数组”是指 `Map` 定义了一个对象集合,它的值可以通过一个键来设置或检索,但与数组(或 `ArrayList`)不同,这个键不需要是整型数;它可以是 `String` 或任何其它复杂对象。 -例如,我们可以创建一个 **Map**,其键为 **String**,其值为 **Integer** 类型,如下: +例如,我们可以创建一个 `Map`,其键为 `String`,其值为 `Integer` 类型,如下: ``` Map stoi = new Map(); ``` -然后我们可以对这个 **Map** 进行如下初始化: - +然后我们可以对这个 `Map` 进行如下初始化: ``` stoi.set("one",1); @@ -316,23 +302,21 @@ stoi.set("two",2); stoi.set("three",3); ``` -等类似操作。稍后,当我们想要知道 **"three"** 的数值时,我们可以通过下面的方式将其检索出来: - +等类似操作。稍后,当我们想要知道 `"three"` 的数值时,我们可以通过下面的方式将其检索出来: ``` stoi.get("three"); ``` -在我的认知中,**Map** 对于将第三方数据集中出现的字符串转换为我的数据集中的一致代码值非常有用。作为[数据转换管道][8]的一部分,我经常会构建一个小型的独立程序,用作在处理数据之前清理数据;为此,我几乎总是会使用一个或多个 **Map**。 +在我的认知中,`Map` 对于将第三方数据集中出现的字符串转换为我的数据集中的一致代码值非常有用。作为[数据转换管道][8]的一部分,我经常会构建一个小型的独立程序,用作在处理数据之前清理数据;为此,我几乎总是会使用一个或多个 `Map`。 -值得一提的是,内部定义有 **ArrayList** 的 **ArrayLists** 和 **Map** 的 **Maps** 是很可能的,有时也是合理的。例如,假设我们在看树,我们对按树种和年龄范围累积树的数目感兴趣。假设年龄范围定义是一组字符串值(“young”、“mid”、“mature” 和 “old”),物种是 “Douglas fir”、“western red cedar” 等字符串值,那么我们可以将这个 **Map** 中的 **Map** 定义为: +值得一提的是,`ArrayList` 的 `ArrayList` 和 `Map` 的 `Map` 是很可能的,有时也是合理的。例如,假设我们在看树,我们对按树种和年龄范围累计树的数目感兴趣。假设年龄范围定义是一组字符串值(“young”、“mid”、“mature” 和 “old”),物种是 “Douglas fir”、“western red cedar” 等字符串值,那么我们可以将这个 `Map` 中的 `Map` 定义为: ``` Map> counter = new Map>(); ``` -One thing to watch out for here is that the above only creates storage for the _rows_ of **Map**s. So, our accumulation code might look like: -这里需要注意的一件事是,以上内容仅为 **Map** 的 _行_ 创建存储。 因此,我们的累加代码可能类似于: +这里需要注意的一件事是,以上内容仅为 `Map` 的*行*创建存储。因此,我们的累加代码可能类似于: ``` // 假设我们已经知道了物种和年龄范围 @@ -344,14 +328,13 @@ if (!counter.get(species).containsKey(ageRange)) { } ``` -此时,我们可以开始累加: - +此时,我们可以这样开始累加: ``` counter.get(species).put(ageRange, counter.get(species).get(ageRange) + 1); ``` -最后,值得一提的是(Java 8 中的新特性)Streams 还可以用来初始化数组、**ArrayList** 实例和 **Map** 实例。关于此特性的详细讨论可以在[此处][9]和[此处][10]中找到。 +最后,值得一提的是(Java 8 中的新特性)Streams 还可以用来初始化数组、`ArrayList` 实例和 `Map` 实例。关于此特性的详细讨论可以在[此处][9]和[此处][10]中找到。 -------------------------------------------------------------------------------- @@ -360,7 +343,7 @@ via: https://opensource.com/article/19/10/initializing-arrays-java 作者:[Chris Hermansen][a] 选题:[lujun9972][b] 译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f520cd5f79fd8a45f02f5f34637f50f8ef8846a5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 3 Nov 2019 13:40:07 +0800 Subject: [PATCH 270/800] PUB @laingke https://linux.cn/article-11533-1.html --- .../20191022 Initializing arrays in Java.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191022 Initializing arrays in Java.md (99%) diff --git a/translated/tech/20191022 Initializing arrays in Java.md b/published/20191022 Initializing arrays in Java.md similarity index 99% rename from translated/tech/20191022 Initializing arrays in Java.md rename to published/20191022 Initializing arrays in Java.md index a6b01458f4..80177952cb 100644 --- a/translated/tech/20191022 Initializing arrays in Java.md +++ b/published/20191022 Initializing arrays in Java.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11533-1.html) [#]: subject: (Initializing arrays in Java) [#]: via: (https://opensource.com/article/19/10/initializing-arrays-java) [#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) From 5c4ed4a1995b756dc3f177ffc8761f90a84406aa Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 3 Nov 2019 13:57:35 +0800 Subject: [PATCH 271/800] PRF @Morisun029 --- ...leased with New features for Publishers.md | 70 ++++++++----------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md index 6ed5b8b71a..57c7d78f15 100644 --- a/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md +++ b/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md @@ -1,52 +1,46 @@ [#]: collector: (lujun9972) -[#]: translator: ( Morisun029) -[#]: reviewer: ( ) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Open Source CMS Ghost 3.0 Released with New features for Publishers) [#]: via: (https://itsfoss.com/ghost-3-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -开源 CMS Ghost 3.0发布新功能 +开源 CMS Ghost 3.0 发布,带来新功能 ====== -[Ghost][1]是一个免费的开源内容管理系统(CMS)。 如果你还不了CMS,那我在此解释一下。CMS 是一款软件,用它可以构建专注于创建内容的网站,而无需了解 HTML 和其他与 Web 相关的技术。 +[Ghost][1] 是一个自由开源的内容管理系统(CMS)。如果你还不了解 CMS,那我在此解释一下。CMS 是一种软件,用它可以构建主要专注于创建内容的网站,而无需了解 HTML 和其他与 Web 相关的技术。 +事实上,Ghost 是目前[最好的开源 CMS][2] 之一。它主要聚焦于创建轻量级、快速加载、界面美观的博客。 -事实上,Ghost 是目前[最好的开源 CMS][2] 之一。 它主要聚焦于创建轻量级、快速加载、界面美观的博客。 - - -Ghost 系统有一个现代直观的编辑器,该编辑器内置 SEO(搜索引擎优化)功能。 你也可以用本地桌面(包括Linux 系统)和移动应用程序。 如果你喜欢终端,也可以使用其提供的 CLI(命令行界面)工具。 - -让我们看看Ghost 3.0带来了什么新功能。 - +Ghost 系统有一个现代直观的编辑器,该编辑器内置 SEO(搜索引擎优化)功能。你也可以用本地桌面(包括 Linux 系统)和移动应用程序。如果你喜欢终端,也可以使用其提供的 CLI(命令行界面)工具。 +让我们看看 Ghost 3.0 带来了什么新功能。 ### Ghost 3.0 的新功能 ![][3] -我通常对开源的 CMS 解决方案很感兴趣。因此,在阅读了官方公告后,我继续尝试通过[Digital Ocean 云服务器][4]来安装新的 Ghost 实例。 +我通常对开源的 CMS 解决方案很感兴趣。因此,在阅读了官方公告后,我通过在 Digital Ocean 云服务器上安装新的 Ghost 实例来进一步尝试它。 + 与以前的版本相比,Ghost 3.0 在功能和用户界面上的改进给我留下了深刻的印象。 在此,我将列出一些值得一提的关键点。 - #### 书签卡 + ![][5] -除了编辑器的所有细微更改之外,3.0版本现在支持通过输入 URL 添加漂亮的书签卡。 - -如果你使用过WordPress(你可能已经注意到,WordPress 需要添加一个插件才能添加类似的卡片),所以该功能绝对是Ghost 3.0 系统的一个最大改进。 +除了编辑器的所有细微更改之外,3.0 版本现在支持通过输入 URL 添加漂亮的书签卡。 +如果你使用过 WordPress(你可能已经注意到,WordPress 需要添加一个插件才能添加类似的卡片),所以该功能绝对是 Ghost 3.0 系统的一个最大改进。 #### 改进的 WordPress 迁移插件 -我还未对 WordPress 进行特别测试,但它已经对 WordPress 的迁移插件进行了更新,可以让你轻松地将帖子(带有图片)克隆到 Ghost CMS。 - -基本上,使用该插件,你就能够创建一个存档(包含图片)并将其导入到Ghost CMS。 - +我没有专门对此进行测试,但它更新了 WordPress 的迁移插件,可以让你轻松地将帖子(带有图片)克隆到 Ghost CMS。 +基本上,使用该插件,你就能够创建一个存档(包含图片)并将其导入到 Ghost CMS。 #### 响应式图像库和图片 @@ -54,53 +48,49 @@ Ghost 系统有一个现代直观的编辑器,该编辑器内置 SEO(搜索 此外,帖子和页面中的图片也更改为响应式的了。 - - #### 添加成员和订阅选项 ![Ghost Subscription Model][6] -虽然,该功能目前还处于测试阶段,但如果你是以此平台作为维持你业务关系的重要发布平台,你可以为你的博客添加成员,订阅选项。 +虽然,该功能目前还处于测试阶段,但如果你是以此平台作为维持你业务关系的重要发布平台,你可以为你的博客添加成员、订阅选项。 + 该功能可以确保只有订阅的成员才能访问你的博客,你也可以选择让未订阅者也可以访问。 +#### Stripe:集成支付功能 -#### 条纹(美国公司):支付整合 - -默认情况下,该版本支持 Stripe 付款网关,帮助你轻松订阅(或使用任何类型的付款的付款方式),而 Ghost 不再收取任何额外费用。 +默认情况下,该版本支持 Stripe 付款网关,帮助你轻松启用订阅功能(或使用任何类型的付款的付款方式),而 Ghost 不收取任何额外费用。 #### 新的应用程序集成 ![][7] -你现在可以在 Ghost 3.0 的博客中集成各种流行的应用程序/服务。 它可以使很多事情自动化。 +你现在可以在 Ghost 3.0 的博客中集成各种流行的应用程序/服务。它可以使很多事情自动化。 #### 默认主题改进 引入的默认主题(设计)已得到改进,现在也提供了夜间模式。 + 你也可以随时选择创建自定义主题(如果没有可用的预置主题)。 #### 其他小改进 - 除了所有关键亮点以外,用于创建帖子/页面的可视编辑器也得到了改进(具有某些拖放功能)。 -我确定还有很多技术方面的更改-如果你对此感兴趣,可以在他们的[更改日志][8] 中查看。 +我确定还有很多技术方面的更改,如果你对此感兴趣,可以在他们的[更改日志][8]中查看。 +### Ghost 影响力渐增 -### Ghost 逐渐获得好的影响力 +要在以 WordPress 为主导的世界中获得认可并不是一件容易的事。但 Ghost 逐渐形成了它的一个专门的发布者社区。 -要在以 WordPress 为主导的世界中获得认可并不是一件容易的事。 但 Ghost逐渐形成了一个专门的发布者社区。 -不仅如此,它的托管服务 [Ghost Pro][9] 现在拥有像 NASA,Mozilla 和 DuckDuckGo 这样的客户。 +不仅如此,它的托管服务 [Ghost Pro][9] 现在拥有像 NASA、Mozilla 和 DuckDuckGo 这样的客户。 +在过去的六年中,Ghost 从其 Ghost Pro 客户那里获得了 500 万美元的收入。就从它是致力于开源系统解决方案的非营利组织这一点来讲,这确实是一项成就。 -在过去的六年中,Ghost 从其 Ghost Pro 客户那里获得了500万美元的收入。 就从它是致力于开源系统解决方案的非营利组织这一点来讲,这确实是一项成就。 +这些收入有助于它们保持独立,避免风险投资家的外部资金投入。Ghost CMS 的托管客户越多,投入到免费和开源的 CMS 的研发款项就越多。 -这些收入有助于它们保持独立,避免风险投资家的外部资金投入。Ghost CMS 的 托管客户越多,投入到免费和开源的 CMS 的研发款就越多。 - -总体而言,Ghost 3.0 是迄今为止提供的最好的升级版本。 这些功能给我留下了深刻的印象。 - -如果你拥有自己的网站,你会使用什么CMS吗? 你曾经使用过Ghost吗? 你的体验如何? 请在评论部分分享你的想法。 +总体而言,Ghost 3.0 是迄今为止提供的最好的升级版本。这些功能给我留下了深刻的印象。 +如果你拥有自己的网站,你会使用什么 CMS?你曾经使用过 Ghost 吗?你的体验如何?请在评论部分分享你的想法。 -------------------------------------------------------------------------------- @@ -108,8 +98,8 @@ via: https://itsfoss.com/ghost-3-release/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 1b99a02e04e9b274e0e56cc308e9fc4da0bce410 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 3 Nov 2019 13:58:17 +0800 Subject: [PATCH 272/800] PUB @Morisun029 https://linux.cn/article-11534-1.html --- ...CMS Ghost 3.0 Released with New features for Publishers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md (98%) diff --git a/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/published/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md similarity index 98% rename from translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md rename to published/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md index 57c7d78f15..1879697316 100644 --- a/translated/tech/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md +++ b/published/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11534-1.html) [#]: subject: (Open Source CMS Ghost 3.0 Released with New features for Publishers) [#]: via: (https://itsfoss.com/ghost-3-release/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 9a32ed0d397a5c2743edad7bd2103c11feb788b7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 00:54:33 +0800 Subject: [PATCH 273/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191104=20How=20?= =?UTF-8?q?To=20Update=20a=20Fedora=20Linux=20System=20[Beginner=E2=80=99s?= =?UTF-8?q?=20Tutorial]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md --- ...edora Linux System -Beginner-s Tutorial.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md diff --git a/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md b/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md new file mode 100644 index 0000000000..d102d5b89f --- /dev/null +++ b/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Update a Fedora Linux System [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/update-fedora/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +How To Update a Fedora Linux System [Beginner’s Tutorial] +====== + +_**This quick tutorial shows various ways to update a Fedora Linux install.**_ + +So, the other day, I installed the [newly released Fedora 31][1]. I’ll be honest with you, it was my first time with a [non-Ubuntu distribution][2]. + +The first thing I did after installing Fedora was to try and install some software. I opened the software center and found that the software center was ‘broken’. I couldn’t install any application from it. + +I wasn’t sure what went wrong with my installation. Discussing within the team, Abhishek advised me to update the system first. I did that and poof! everything was back to normal. After updating the [Fedora][3] system, the software center worked as it should. + +Sometimes we just ignore the updates and keep troubleshooting the issue we face. No matter how big/small the issue is – to avoid them, you should keep your system up-to-date. + +In this article, I’ll show you various possible methods to update your Fedora Linux system. + + * [Update Fedora using software center][4] + * [Update Fedora using command line][5] + * [Update Fedora from system settings][6] + + + +Keep in mind that updating Fedora means installing the security patches, kernel updates and software updates. If you want to update from one version of Fedora to another, it is called version upgrade and you can [read about Fedora version upgrade procedure here][7]. + +### Updating Fedora From The Software Center + +![Software Center][8] + +You will most likely be notified that you have some system updates to look at, you should end up launching the software center when you click on that notification. + +All you have to do is – hit ‘Update’ and verify the root password to start updating. + +In case you did not get a notification for the available updates, you can simply launch the software center and head to the “Updates” tab. Now, you just need to proceed with the updates listed. + +### Updating Fedora Using The Terminal + +If you cannot load up the software center for some reason, you can always utilize the dnf package managing commands to easily update your system. + +Simply launch the terminal and type in the following command to start updating (you should be prompted to verify the root password): + +``` +sudo dnf upgrade +``` + +**dnf update vs dnf upgrade +** +You’ll find that there are two dnf commands available: dnf update and dnf upgrade. +Both command do the same job and that is to install all the updates provided by Fedora. +Then why there is dnf update and dnf upgrade and which one should you use? +Well, dnf update is basically an alias to dnf upgrade. While dnf update may still work, the good practice is to use dnf upgrade because that is the real command. + +### Updating Fedora From System Settings + +![][9] + +If nothing else works (or if you’re already in the System settings for a reason), navigate your way to the “Details” option at the bottom of your settings. + +This should show up the details of your OS and hardware along with a “Check for Updates” button as shown in the image above. You just need to click on it and provide the root/admin password to proceed to install the available updates. + +**Wrapping Up** + +As explained above, it is quite easy to update your Fedora installation. You’ve got three available methods to choose from – so you have nothing to worry about. + +If you notice any issue in following the instructions mentioned above, feel free to let me know in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/update-fedora/ + +作者:[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/fedora-31-release/ +[2]: https://itsfoss.com/non-ubuntu-beginner-linux/ +[3]: https://getfedora.org/ +[4]: tmp.Lqr0HBqAd9#software-center +[5]: tmp.Lqr0HBqAd9#command-line +[6]: tmp.Lqr0HBqAd9#system-settings +[7]: https://itsfoss.com/upgrade-fedora-version/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/software-center.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/system-settings-fedora-1.png?ssl=1 From a7de90b68522b628a4df32c38b4d886c92c19212 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 00:55:52 +0800 Subject: [PATCH 274/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191102=206=20re?= =?UTF-8?q?markable=20features=20of=20the=20new=20United=20Nations=20open?= =?UTF-8?q?=20source=20initiative?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191102 6 remarkable features of the new United Nations open source initiative.md --- ...w United Nations open source initiative.md | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 sources/tech/20191102 6 remarkable features of the new United Nations open source initiative.md diff --git a/sources/tech/20191102 6 remarkable features of the new United Nations open source initiative.md b/sources/tech/20191102 6 remarkable features of the new United Nations open source initiative.md new file mode 100644 index 0000000000..a5394515d4 --- /dev/null +++ b/sources/tech/20191102 6 remarkable features of the new United Nations open source initiative.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 remarkable features of the new United Nations open source initiative) +[#]: via: (https://opensource.com/article/19/11/united-nations-goes-open-source) +[#]: author: (Frank Karlitschek https://opensource.com/users/frankkarlitschek) + +6 remarkable features of the new United Nations open source initiative +====== +What does it mean when the UN goes open source? +![Globe up in the clouds][1] + +Three months, ago the United Nations asked me to join a new advisory board to help them develop their open source strategy and policy. I’m honored to have the opportunity to work together with a group of established experts in open source licensing and policy areas. + +The United Nations wants to make technology, software, and intellectual property available to everyone, including developing countries. Open source and free software are great tools to achieve this goal since open source is all about empowering people and global collaboration while protecting the personal data and privacy of users. So, the United Nations and the open source community share the same values. + +This new open source strategy and policy is developed by the [United Nations Technology Innovation Labs][2] (UNTIL). Last month, we had our first in-person meeting in Helsinki in the UNTIL offices. I find this initiative remarkable for several reasons: + + * **Sharing:** The United Nations wants to have a positive impact on everyone on this planet. For that goal, it is important that software, data, and services are available for everyone independent of their language, budget, education, or other factors. Open source is perfect to guarantee that result. + + * **Contributing:** It should be possible that everyone can contribute to the software, data, and services of the United Nations. The goal is to not depend on a single software vendor alone, but instead, build a bigger ecosystem that drives innovation together. + + * **Empowering:** Open source makes it possible for underdeveloped countries and regions to foster local companies and expertise by building on top of existing open source software—standing on the shoulders of giants. + + * **Sustainability:** Open source guarantees more sustainable software, data, and services by not relying on a single entity to support, maintain, and develop it. Open source helps to avoid a single point of failure by creating an equal playing field for everyone. + + * **Security:** Open source software is more secure than proprietary software because the code can be constantly reviewed and audited. This fact is especially important for security-sensitive applications that require [transparency and openness][3]. + + * **Decentralization:** An open source strategy enables decentralized hosting of software and data. This fact makes it possible to be compliant with all data protection and privacy regulations and enables a more free and open internet. + + + + +We discussed that a fair business model like the one from Nextcloud should be encouraged and recommended. Specifically, we discussed that that 100% of the code should be placed under an [OSI-approved open source license][4]. There should be no open core, proprietary extensions, dual licensing, or other limited-access components to ensure that everyone is on the same playing field. + +I’m excited to have the opportunity to advise the United Nations in this matter, and I hope to have a positive influence on the future of IT, especially in developing countries. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/united-nations-goes-open-source + +作者:[Frank Karlitschek][a] +选题:[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/frankkarlitschek +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://until.un.org +[3]: https://until.un.org/content/governance +[4]: https://opensource.org/licenses From 31889ee7febff6593789ce0bc65ffeb14cac9207 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 00:56:57 +0800 Subject: [PATCH 275/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191101=20Awk=20?= =?UTF-8?q?one-liners=20and=20scripts=20to=20help=20you=20sort=20text=20fi?= =?UTF-8?q?les?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md --- ...and scripts to help you sort text files.md | 254 ++++++++++++++++++ 1 file changed, 254 insertions(+) create mode 100644 sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md diff --git a/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md b/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md new file mode 100644 index 0000000000..2ce53e1d7e --- /dev/null +++ b/sources/tech/20191101 Awk one-liners and scripts to help you sort text files.md @@ -0,0 +1,254 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Awk one-liners and scripts to help you sort text files) +[#]: via: (https://opensource.com/article/19/11/how-sort-awk) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Awk one-liners and scripts to help you sort text files +====== +Awk is a powerful tool for doing tasks that might otherwise be left to +other common utilities, including sort. +![Green graph of measurements][1] + +Awk is the ubiquitous Unix command for scanning and processing text containing predictable patterns. However, because it features functions, it's also justifiably called a programming language. + +Confusingly, there is more than one awk. (Or, if you believe there can be only one, then there are several clones.) There's **awk**, the original program written by Aho, Weinberger, and Kernighan, and then there's **nawk**, **mawk**, and the GNU version, **gawk**. The GNU version of awk is a highly portable, free software version of the utility with several unique features, so this article is about GNU awk. + +While its official name is gawk, on GNU+Linux systems it's aliased to awk and serves as the default version of that command. On other systems that don't ship with GNU awk, you must install it and refer to it as gawk, rather than awk. This article uses the terms awk and gawk interchangeably. + +Being both a command and a programming language makes awk a powerful tool for tasks that might otherwise be left to **sort**, **cut**, **uniq**, and other common utilities. Luckily, there's lots of room in open source for redundancy, so if you're faced with the question of whether or not to use awk, the answer is probably a solid "maybe." + +The beauty of awk's flexibility is that if you've already committed to using awk for a task, then you can probably stay in awk no matter what comes up along the way. This includes the eternal need to sort data in a way other than the order it was delivered to you. + +### Sample set + +Before exploring awk's sorting methods, generate a sample dataset to use. Keep it simple so that you don't get distracted by edge cases and unintended complexity. This is the sample set this article uses: + + +``` +Aptenodytes;forsteri;Miller,JF;1778;Emperor +Pygoscelis;papua;Wagler;1832;Gentoo +Eudyptula;minor;Bonaparte;1867;Little Blue +Spheniscus;demersus;Brisson;1760;African +Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +Torvaldis;linux;Ewing,L;1996;Tux +``` + +It's a small dataset, but it offers a good variety of data types: + + * A genus and species name, which are associated with one another but considered separate + * A surname, sometimes with first initials after a comma + * An integer representing a date + * An arbitrary term + * All fields separated by semi-colons + + + +Depending on your educational background, you may consider this a 2D array or a table or just a line-delimited collection of data. How you think of it is up to you, because awk doesn't expect anything more than text. It's up to you to tell awk how you want to parse it. + +### The sort cheat + +If you just want to sort a text dataset by a specific, definable field (think of a "cell" in a spreadsheet), then you can use the [sort command][2]. + +### Fields and records + +Regardless of the format of your input, you must find patterns in it so that you can focus on the parts of the data that are important to you. In this example, the data is delimited by two factors: lines and fields. Each new line represents a new _record_, as you would likely see in a spreadsheet or database dump. Within each line, there are distinct _fields_ (think of them as cells in a spreadsheet) that are separated by semicolons (;). + +Awk processes one record at a time, so while you're structuring the instructions you will give to awk, you can focus on just one line. Establish what you want to do with one line, then test it (either mentally or with awk) on the next line and a few more. You'll end up with a good hypothesis on what your awk script must do in order to provide you with the data structure you want. + +In this case, it's easy to see that each field is separated by a semicolon. For simplicity's sake, assume you want to sort the list by the very first field of each line. + +Before you can sort, you must be able to focus awk on just the first field of each line, so that's the first step. The syntax of an awk command in a terminal is **awk**, followed by relevant options, followed by your awk command, and ending with the file of data you want to process. + + +``` +$ awk --field-separator=";" '{print $1;}' penguins.list +Aptenodytes +Pygoscelis +Eudyptula +Spheniscus +Megadyptes +Eudyptes +Torvaldis +``` + +Because the field separator is a character that has special meaning to the Bash shell, you must enclose the semicolon in quotes or precede it with a backslash. This command is useful only to prove that you can focus on a specific field. You can try the same command using the number of another field to view the contents of another "column" of your data: + + +``` +$ awk --field-separator=";" '{print $3;}' penguins.list +Miller,JF +Wagler +Bonaparte +Brisson +Milne-Edwards +Viellot +Ewing,L +``` + +Nothing has been sorted yet, but this is good groundwork. + +### Scripting + +Awk is more than just a command; it's a programming language with indices and arrays and functions. That's significant because it means you can grab a list of fields you want to sort by, store the list in memory, process it, and then print the resulting data. For a complex series of actions such as this, it's easier to work in a text file, so create a new file called **sort.awk** and enter this text: + + +``` +#!/bin/gawk -f + +BEGIN { +        FS=";"; +} +``` + +This establishes the file as an awk script that executes the lines contained in the file. + +The **BEGIN** statement is a special setup function provided by awk for tasks that need to occur only once. Defining the built-in variable **FS**, which stands for _field separator_ and is the same value you set in your awk command with **\--field-separator**, only needs to happen once, so it's included in the **BEGIN** statement. + +#### Arrays in awk + +You already know how to gather the values of a specific field by using the **$** notation along with the field number, but in this case, you need to store it in an array rather than print it to the terminal. This is done with an awk array. The important thing about an awk array is that it contains keys and values. Imagine an array about this article; it would look something like this: **author:"seth",title:"How to sort with awk",length:1200**. Elements like **author** and **title** and **length** are keys, with the following contents being values. + +The advantage to this in the context of sorting is that you can assign any field as the key and any record as the value, and then use the built-in awk function **asorti()** (sort by index) to sort by the key. For now, assume arbitrarily that you _only_ want to sort by the second field. + +Awk statements _not_ preceded by the special keywords **BEGIN** or **END** are loops that happen at each record. This is the part of the script that scans the data for patterns and processes it accordingly. Each time awk turns its attention to a record, statements in **{}** (unless preceded by **BEGIN** or **END**) are executed. + +To add a key and value to an array, create a variable (in this example script, I call it **ARRAY**, which isn't terribly original, but very clear) containing an array, and then assign it a key in brackets and a value with an equals sign (**=**). + + +``` +{   # dump each field into an array +    ARRAY[$2] = $R; +} +``` + +In this statement, the contents of the second field (**$2**) are used as the key term, and the current record (**$R**) is used as the value. + +### The asorti() function + +In addition to arrays, awk has several basic functions that you can use as quick and easy solutions for common tasks. One of the functions introduced in GNU awk, **asorti()**, provides the ability to sort an array by key (or _index_) or value. + +You can only sort the array once it has been populated, meaning that this action must not occur with every new record but only the final stage of your script. For this purpose, awk provides the special **END** keyword. The inverse of **BEGIN**, an **END** statement happens only once and only after all records have been scanned. + +Add this to your script: + + +``` +END { +    asorti(ARRAY,SARRAY); +    # get length +    j = length(SARRAY); +    +    for (i = 1; i <= j; i++) { +        printf("%s %s\n", SARRAY[i],ARRAY[SARRAY[i]]) +    } +} +``` + +The **asorti()** function takes the contents of **ARRAY**, sorts it by index, and places the results in a new array called **SARRAY** (an arbitrary name I invented for this article, meaning _Sorted ARRAY_). + +Next, the variable **j** (another arbitrary name) is assigned the results of the **length()** function, which counts the number of items in **SARRAY**. + +Finally, use a **for** loop to iterate through each item in **SARRAY** using the **printf()** function to print each key, followed by the corresponding value of that key in **ARRAY**. + +### Running the script + +To run your awk script, make it executable: + + +``` +`$ chmod +x sorter.awk` +``` + +And then run it against the **penguin.list** sample data: + + +``` +$ ./sorter.awk penguins.list +antipodes Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +chrysocome Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +demersus Spheniscus;demersus;Brisson;1760;African +forsteri Aptenodytes;forsteri;Miller,JF;1778;Emperor +linux Torvaldis;linux;Ewing,L;1996;Tux +minor Eudyptula;minor;Bonaparte;1867;Little Blue +papua Pygoscelis;papua;Wagler;1832;Gentoo +``` + +As you can see, the data is sorted by the second field. + +This is a little restrictive. It would be better to have the flexibility to choose at runtime which field you want to use as your sorting key so you could use this script on any dataset and get meaningful results. + +### Adding command options + +You can add a command variable to an awk script by using the literal value **var** in your script. Change your script so that your iterative clause uses **var** when creating your array: + + +``` +{ # dump each field into an array +    ARRAY[$var] = $R; +} +``` + +Try running the script so that it sorts by the third field by using the **-v var** option when you execute it: + + +``` +$ ./sorter.awk -v var=3 penguins.list +Bonaparte Eudyptula;minor;Bonaparte;1867;Little Blue +Brisson Spheniscus;demersus;Brisson;1760;African +Ewing,L Torvaldis;linux;Ewing,L;1996;Tux +Miller,JF Aptenodytes;forsteri;Miller,JF;1778;Emperor +Milne-Edwards Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Viellot Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +Wagler Pygoscelis;papua;Wagler;1832;Gentoo +``` + +### Fixes + +This article has demonstrated how to sort data in pure GNU awk. The script can be improved so, if it's useful to you, spend some time researching [awk functions][3] on gawk's man page and customizing the script for better output. + +Here is the complete script so far: + + +``` +#!/usr/bin/awk -f +# GPLv3 appears here +# usage: ./sorter.awk -v var=NUM FILE + +BEGIN { FS=";"; } + +{ # dump each field into an array +    ARRAY[$var] = $R; +} + +END { +    asorti(ARRAY,SARRAY); +    # get length +    j = length(SARRAY); +    +    for (i = 1; i <= j; i++) { +        printf("%s %s\n", SARRAY[i],ARRAY[SARRAY[i]]) +    } +} +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/how-sort-awk + +作者:[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/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements) +[2]: https://opensource.com/article/19/10/get-sorted-sort +[3]: https://www.gnu.org/software/gawk/manual/html_node/Built_002din.html#Built_002din From 9af4bfe8bb692b475aed7af881532ee1e91e7c6f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 00:58:18 +0800 Subject: [PATCH 276/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191101=20Retro?= =?UTF-8?q?=20computing=20with=20FPGAs=20and=20MiSTer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191101 Retro computing with FPGAs and MiSTer.md --- ...1 Retro computing with FPGAs and MiSTer.md | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 sources/tech/20191101 Retro computing with FPGAs and MiSTer.md diff --git a/sources/tech/20191101 Retro computing with FPGAs and MiSTer.md b/sources/tech/20191101 Retro computing with FPGAs and MiSTer.md new file mode 100644 index 0000000000..8674863561 --- /dev/null +++ b/sources/tech/20191101 Retro computing with FPGAs and MiSTer.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Retro computing with FPGAs and MiSTer) +[#]: via: (https://opensource.com/article/19/11/fpga-mister) +[#]: author: (Sarah Thornton https://opensource.com/users/sarah-thornton) + +Retro computing with FPGAs and MiSTer +====== +Field-programmable gate arrays are used in devices like smartphones, +medical devices, aircraft, and—here—emulating an old-school Amiga. +![Mesh networking connected dots][1] + +Another weekend rolls around, and I can spend some time working on my passion projects, including working with single-board computers, playing with emulators, and general tinkering with a soldering iron. Earlier this year, I wrote about [resurrecting the Commodore Amiga on the Raspberry Pi][2]. A colleague referred to our shared obsession with old technology as a "[passion for preserving our digital culture][3]." + +In my travels in the world of "digital archeology," I heard about a new way to emulate old systems by using [field-programmable gate arrays][4] (FPGAs). I was intrigued by the concept, so I dedicated a weekend to learn more. Specifically, I wanted to know if I could use an FPGA to emulate a Commodore Amiga. + +### What is an FPGA? + +When you build a circuit board, everything is literally etched in silicon. You can change the software that runs on it, but the physical circuit is immutable. So if you want to add a new component to it or modify it later, you are limited by the physical nature of the hardware. With an FPGA, you can program the hardware to simulate new components or change existing ones. This is achieved through programmable logic gates (hence the name). This provides a lot of flexibility for Internet-of-Things (IoT) devices, as they can be changed later to meet new requirements. + +![Terasic DE10-Nano][5] + +FPGAs are used in many devices today, including smartphones, medical devices, motor vehicles, and aircraft. Because FPGAs can be easily modified and generally have low power requirements, these devices are everywhere! They are also inexpensive to manufacture and can be configured for multiple uses. + +The Commodore Amiga was designed with chips that had specific uses and fun names. For example, "Gary" was a gate array that later became "Fat Gary" when "he" was upgraded on the A3000 and A4000. "Bridgette" was an integrated bus buffer, and the delightful "Amber" was a "flicker fixer" on the A3000. The ability to simulate these chips with programmable gates makes an ideal platform for Amiga emulation. + +When you use an emulator, you are tricking an application into using software to find the architecture it expects. The primary limitations are the accuracy of the emulation and the sequential nature of how the commands are processed through the CPU. With an FPGA, you can teach the hardware what chips are in play, and software can talk to each chip as if it was native and in parallel. It also means applications can thread as if they were running on the original hardware. This makes FGPAs especially good for emulating old systems. + +### Introducing the MiSTer project + +The board I have been working with is [Terasic][6]'s [DE10-Nano][7]. Out of the box, this device is excellent for learning how FPGAs work and gives you access to tools to get you started. + +![Terasic DE10-Nano][8] + +The [MiSTer project][9] is built on top of this board and employs daughter boards to provide memory expansion, SDRAM, and improved I/O, all built on a Linux-based distribution. To use it as a platform for emulation, it's expanded through the use of "cores" that define the architecture the board will emulate. + +Once you have flashed the device with the MiSTer distro, you can load a "core," which is a combination of a definition for the chips you want to use and the associated menus to manage the emulated system. + +![Terasic DE10-Nano][10] + +Compared to a Raspberry Pi running emulation software, these cores provide a more native experience for emulation, and often apps that don't run perfectly on software-based emulators will run fine on a MiSTer. + +### How to get started + +There are excellent resources online to help get you started. The first stop is the [documentation][11] on MiSTer's [GitHub page][12], which has step-by-step instructions on putting everything together. If you prefer a visual walkthrough of the board, check out [this video][13] from the [Retro Man Cave][14] YouTube channel. For more information on configuring the [Minimig][15] (short for mini Amiga) core to load disks or using Amiga's classic [Workbench][16] and [WHDLoad][17], check out this great [tutorial][18] from [Phil's Computer Lab][19] on YouTube. + +### Cores + +MiSTer has cores available for a multitude of systems; my main interest is in Amiga emulation, which is provided by the Minimig core. I'm also interested in the Commodore 64 and PET and the BBC microcomputer, which I used at college. I also have a soft spot for playing [Space Invaders on the Commodore PET][20], which I will admit (many years later!) was the real reason I booked time in the college computer lab at the end of the week. + +Once a core is loaded, you can interact with it through a connected keyboard and by pressing F12 to access the "core" menu. To access a shell, you can log in by using the F9 key, which presents you with a login prompt. You will need a [kickstart ROM][21] (the equivalent of a PC's BIOS), to get your Amiga running. You can obtain these from [Cloanto][22], which sells the [Amiga Forever][23] kickstart that contains the ROMs required to boot a system as well as games, demos, and hard drive files that can be used on your MiSTer. Store the kickstart ROM in the root of your SD card and name it "KICK.ROM." + +On my MiSTer board, I can run Amiga demos that don't run on my Raspberry Pi, even though my Pi has much more memory available. The emulation is more accurate and runs more efficiently. Through the expansion board, I can even use old hardware, such as an original Commodore monitor and Amiga joysticks. + +### Source code + +All code for the MiSTer project is available in its [GitHub repo][12]. You have access to the cores as well as the main MiSTer setup, associated scripts, and menu files. These are actively updated, and there is a solid community actively developing, bug fixing, and improving all contributions, so check back regularly for updates. The repo has a wealth of information available to help get you up and running. + +### Security considerations + +With the flexibility of customization comes the potential for [security vulnerabilities][24]. All MiSTer installs come with a preset password on the root account, so one of the first things you want to do is to change the password. If you are using the device to build a cabinet for a game and you have given the device access to your network, it can be exploited using the default login credentials, and that can lead to giving a third party access to your network. + +For non-MiSTer projects, FPGAs expose the ability for one process to be able to listen in on another process, so limiting access to the device should be one of the first things you do. When you build your application, you should isolate processes to prevent unwanted access. This is especially important if you intend to deploy your board where access is open to other users or with shared applications. + +### Find more information + +There is a lot of information about this type of project online. Here are some of the resources you may find helpful. + +#### Community + + * [MiSTer wiki][9] + * [Setup guide][11] + * [Internet connections on supporting cores][25] + * [Discussion forums][26] + * [MiSTer add-ons][27] (public Facebook group) + + + +#### Daughter boards + + * [SDRAM board][28] + * [I/O board][29] + * [RTC board][30] + * [USB hub][31] + + + +#### Videos and walkthroughs + + * [Exploring the MiSTer and DE-10 Nano FPGA][32]: Is this the future of retro? + * [FPGA emulation MiSTer project on the Terasic DE10-Nano][33] + * [Amiga OS 3.1 on FPGA—DE10-Nano running MisTer][34] + + + +#### Where to buy the hardware + +##### MiSTer project + + * [DE10-Nano][35] (Amazon) + * [Ultimate Mister][36] + * [MiSTer Add-ons][37] + + + +##### Other FPGAs + + * [TinyFPGA BX—ICE40 FPGA development board with USB][38] (Adafruit) + * [Terasic][6], makers of the DE10-Nano and other high-performance FPGAs + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/fpga-mister + +作者:[Sarah Thornton][a] +选题:[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/sarah-thornton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mesh_networking_dots_connected.png?itok=ovINTRR3 (Mesh networking connected dots) +[2]: https://opensource.com/article/19/3/amiga-raspberry-pi +[3]: https://www.linkedin.com/pulse/passion-preserving-digital-culture-%C3%B8ivind-ekeberg/ +[4]: https://en.wikipedia.org/wiki/Field-programmable_gate_array +[5]: https://opensource.com/sites/default/files/uploads/image5_0.jpg (Terasic DE10-Nano) +[6]: https://www.terasic.com.tw/en/ +[7]: https://www.terasic.com.tw/cgi-bin/page/archive.pl?Language=English&CategoryNo=165&No=1046 +[8]: https://opensource.com/sites/default/files/uploads/image2_0.jpg (Terasic DE10-Nano) +[9]: https://github.com/MiSTer-devel/Main_MiSTer/wiki +[10]: https://opensource.com/sites/default/files/uploads/image1_0.jpg (Terasic DE10-Nano) +[11]: https://github.com/MiSTer-devel/Main_MiSTer/wiki/Setup-Guide +[12]: https://github.com/MiSTer-devel +[13]: https://www.youtube.com/watch?v=e5yPbzD-W-I&t=2s +[14]: https://www.youtube.com/channel/UCLEoyoOKZK0idGqSc6Pi23w +[15]: https://github.com/MiSTer-devel/Minimig-AGA_MiSTer +[16]: https://en.wikipedia.org/wiki/Workbench_%28AmigaOS%29 +[17]: https://en.wikipedia.org/wiki/WHDLoad +[18]: https://www.youtube.com/watch?v=VFespp1adI0 +[19]: https://www.youtube.com/channel/UCj9IJ2QvygoBJKSOnUgXIRA +[20]: https://www.youtube.com/watch?v=hqs6gIZbpxo +[21]: https://en.wikipedia.org/wiki/Kickstart_(Amiga) +[22]: https://cloanto.com/ +[23]: https://www.amigaforever.com/ +[24]: https://www.helpnetsecurity.com/2019/06/03/vulnerability-in-fpgas/ +[25]: https://github.com/MiSTer-devel/Main_MiSTer/wiki/Internet-and-console-connection-from-supported-cores +[26]: http://www.atari-forum.com/viewforum.php?f=117 +[27]: https://www.facebook.com/groups/251655042432052/ +[28]: https://github.com/MiSTer-devel/Main_MiSTer/wiki/SDRAM-Board +[29]: https://github.com/MiSTer-devel/Main_MiSTer/wiki/IO-Board +[30]: https://github.com/MiSTer-devel/Main_MiSTer/wiki/RTC-board +[31]: https://github.com/MiSTer-devel/Main_MiSTer/wiki/USB-Hub-daughter-board +[32]: https://www.youtube.com/watch?v=e5yPbzD-W-I +[33]: https://www.youtube.com/watch?v=1jb8YPXc8DA +[34]: https://www.youtube.com/watch?v=tAz8VRAv7ig +[35]: https://www.amazon.com/Terasic-Technologies-P0496-DE10-Nano-Kit/dp/B07B89YHSB/ +[36]: https://ultimatemister.com/ +[37]: https://misteraddons.com/ +[38]: https://www.adafruit.com/product/4038 From 04073d65602c8b0bdc79a76d0d6e9e4815cca4df Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 00:58:50 +0800 Subject: [PATCH 277/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191101=20Produc?= =?UTF-8?q?t=20vs.=20project=20in=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191101 Product vs. project in open source.md --- ...1101 Product vs. project in open source.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/tech/20191101 Product vs. project in open source.md diff --git a/sources/tech/20191101 Product vs. project in open source.md b/sources/tech/20191101 Product vs. project in open source.md new file mode 100644 index 0000000000..f4fb128368 --- /dev/null +++ b/sources/tech/20191101 Product vs. project in open source.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Product vs. project in open source) +[#]: via: (https://opensource.com/article/19/11/product-vs-project) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +Product vs. project in open source +====== +What's the difference between an open source product and an open source +project? Not all open source is created (and maintained) equal. +![Bees on a hive, connected by dots][1] + +Open source is a good thing. Open source is a particularly good thing for security. I've written about this before (notably in [_Disbelieving the many eyes hypothesis_][2] and [_The commonwealth of open source_][3]), and I'm going to keep writing about it. In this article, however, I want to talk a little more about a feature of open source that is arguably both a possible disadvantage and a benefit: the difference between a project and a product. I'll come down firmly on one side (spoiler alert: for organisations, it's "product"), but I'd like to start with a little disclaimer. I am employed by Red Hat, and we are a company that makes money from supporting open source. I believe this is a good thing, and I approve of the model that we use, but I wanted to flag any potential bias early in the article. + +The main reason that open source is good for security is that you can see what's going on when there's a problem, and you have a chance to fix it. Or, more realistically, unless you're a security professional with particular expertise in the open source project in which the problem arises, somebody _else_ has a chance to fix it. We hope that there are sufficient security folks with the required expertise to fix security problems and vulnerabilities in software projects about which we care. + +It's a little more complex than that, however. As an organisation, there are two main ways to consume open source: + + * As a **project**: you take the code, choose which version to use, compile it yourself, test it, and then manage it. + * As a **product**: a vendor takes the project, chooses which version to package, compiles it, tests it, and then sells support for the package, typically including docs, patching, and updates. + + + +Now, there's no denying that consuming a project "raw" gives you more options. You can track the latest version, compiling and testing as you go, and you can take security patches more quickly than the product version may supply them, selecting those that seem most appropriate for your business and use cases. On the whole, this seems like a good thing. There are, however, downsides that are specific to security. These include: + + 1. Some security fixes come with an [embargo][4], to which only a small number of organisations (typically the vendors) have access. Although you may get access to fixes at the same time as the wider ecosystem, you will need to check and test them (unless you blindly apply them—don't do that), which will already have been performed by the vendors. + 2. The _huge_ temptation to make changes to the code that don't necessarily—or immediately—make it into the upstream project means that you are likely to be running a fork of the code. Even if you _do_ manage to get these upstream in time, during the period that you're running the changes but they're not upstream, you run a major risk that any security patches will not be immediately applicable to your version. (This is, of course, true for non-security patches, but security patches are typically more urgent.) One option, of course, if you believe that your version is likely to consumed by others, is to make an _official_ fork of the project and try to encourage a community to grow around that; but in the end, you will still have to decide whether to support the _new_ version internally or externally. + 3. Unless you ensure that _all_ instances of the software are running the same version in your deployment, any back-porting of security fixes to older versions will require you to invest in security expertise equal (or close to equal) to that of the people who created the fix in the first place. In this case, you are giving up the "commonwealth" benefit of open source, as you need to pay experts who duplicate the skills of the community. + + + +What you are basically doing, by choosing to deploy a _project_ rather than a _product_ is taking the decision to do _internal productisation_ of the project. You lose not only the commonwealth benefit of security fixes but also the significant _economies of scale_ that are intrinsic to the vendor-supported product model. There may also be _economies of scope_ that you miss: many vendors will have multiple products that they support and will be able to apply security expertise across those products in ways that may not be possible for an organisation whose core focus is not on product support. + +These economies are reflected in another possible benefit to the commonwealth of using a vendor: The very fact that multiple customers are consuming their products means that vendors have an incentive and a revenue stream to spend on security fixes and general features. There are other types of fixes and improvements on which they may apply resources, but the relative scarcity of skilled security experts means that the [principle of comparative advantage][5] suggests that they should be in the best position to apply them for the benefit of the wider community.[1][6] + +What if a vendor you use to provide a productised version of an open source project goes bust or decides to drop support for that product? Well, this is a problem in the world of proprietary software as well, of course. But in the case of proprietary software, there are three likely outcomes: + + * You now have no access to the software source, and therefore no way to make improvements. + * You _are_ provided access to the software source, but it is not available to the wider world, and therefore you are on your own. + * _Everyone_ is provided with the software source, but no existing community exists to improve it, and it either dies or takes significant time for a community to build around it. + + + +In the case of open source, however, if the vendor you have chosen goes out of business, there is always the option to use another vendor, encourage a new vendor to take it on, productise it yourself (and supply it to other organisations), or, if the worst comes to the worst, take the internal productisation route while you search for a scalable long-term solution. + +In the modern open source world, we (the community) have gotten quite good at managing these options, as the growth of open source consortia[2][7] shows. In a consortium, groups of organisations and individuals cluster around a software project or a set of related projects to encourage community growth, alignment around feature and functionality additions, general security work, and productisation for use cases that may as yet be ill-defined, all the while trying to exploit the economies of scale and scope outlined above. An example of this would be the Linux Foundation's [Confidential Computing Consortium][8], to which the [Enarx project][9] aims to be contributed. + +Choosing to consume open source software as a product instead of as a project involves some trade-offs, but, from a security point of view at least, the economics for organisations are fairly clear: unless you are in a position to employ ample security experts, products are most likely to suit your needs. + +* * * + +1\. Note: I'm not an economist, but I believe that this holds in this case. Happy to have comments explaining why I'm wrong (if I am…). + +2\. "Consortiums" if you _really_ must. + +* * * + +_This article was originally published on [Alice, Eve, and Bob][10] and is reprinted with the author's permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/product-vs-project + +作者:[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/OSDC_bees_network.png?itok=NFNRQpJi (Bees on a hive, connected by dots) +[2]: https://opensource.com/article/17/10/many-eyes +[3]: https://opensource.com/article/17/11/commonwealth-open-source +[4]: https://aliceevebob.com/2018/01/09/meltdown-and-spectre-thinking-about-embargoes-and-disclosures/ +[5]: https://en.wikipedia.org/wiki/Comparative_advantage +[6]: tmp.ov8Yhb4jS4#1 +[7]: tmp.ov8Yhb4jS4#2 +[8]: https://confidentialcomputing.io/ +[9]: https://enarx.io/ +[10]: https://aliceevebob.com/2019/10/15/of-projects-products-and-security-community/ From 5b318f2edaa0b1123819a1fefb3712552cdf4149 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 00:59:40 +0800 Subject: [PATCH 278/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191101=20Micron?= =?UTF-8?q?=20finally=20delivers=20its=20answer=20to=20Optane?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191101 Micron finally delivers its answer to Optane.md --- ...n finally delivers its answer to Optane.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/talk/20191101 Micron finally delivers its answer to Optane.md diff --git a/sources/talk/20191101 Micron finally delivers its answer to Optane.md b/sources/talk/20191101 Micron finally delivers its answer to Optane.md new file mode 100644 index 0000000000..84b63007ec --- /dev/null +++ b/sources/talk/20191101 Micron finally delivers its answer to Optane.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Micron finally delivers its answer to Optane) +[#]: via: (https://www.networkworld.com/article/3449576/micron-finally-delivers-its-answer-to-optane.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Micron finally delivers its answer to Optane +====== +New drive offers DRAM-like performance and is targeted at analytics and transaction workloads. +Intel + +Micron Technology partnered with Intel back in 2015 to develop 3D XPoint, a new type of memory that has the storage capability of NAND flash but speed almost equal to DRAM. However, the two companies parted ways in 2018 before either of them could bring a product to market. They had completed the first generation, agreed to work on the second generation together, and decided to part after that and do their own thing for the third generation. + +Intel released its product under the [Optane][1] brand name. Now Micron is hitting the market with its own product under the QuantX brand. At its Insight 2019 show in San Francisco, Micron unveiled the X100, a new solid-state drive the company claims is the fastest in the world. + +On paper, this thing is fast: + + * Up to 2.5 million IOPS, which it claims is the fastest in the world. + * More than 9GB per second bandwidth for read, write, and mixed workloads, which it claims is three times faster than comparable NAND drives. + * Read-write latency of less than 8 microseconds, which it claims is 11 times better than NAND-based SSDs. + + + +Micron sees the X100 serving data to the world’s most demanding analytics and transactional applications, “a role that’s befitting the world’s fastest drive,” it said in a statement. + +The company also launched the Micron 7300, a NVMe SSD for data center use with capacities from 400GB to 8TB, depending on the form factor. It comes in SATA and U.2 form factors, the latter of which is like the M.2 PCI Express drives that are the size of a stick of gum and mount on the motherboard. + +Also released is the Micron 5300, a SATA drive with capacities from 240GB to nearly 8TB. This drive is the first to use 96-layer 3D TLC NAND, hence its high capacity. It can deliver random read performance of up to 95K IOPS and random write IOPS of 75K. + +Micron also announced it had acquired FWDNXT, an AI startup that develop deep learning solutions. Micron says it’s integrating the compute, memory, tools, and software from FWDNXT into a “comprehensive AI development platform,” which it calls the Micron Deep Learning Accelerator (DLA). + + * [Backup vs. archive: Why it’s important to know the difference][2] + * [How to pick an off-site data-backup method][3] + * [Tape vs. disk storage: Why isn’t tape dead yet?][4] + * [The correct levels of backup save time, bandwidth, space][5] + + + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3449576/micron-finally-delivers-its-answer-to-optane.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/3387117/intel-formally-launches-optane-for-data-center-memory-caching.html +[2]: https://www.networkworld.com/article/3285652/storage/backup-vs-archive-why-its-important-to-know-the-difference.html +[3]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html +[4]: https://www.networkworld.com/article/3315156/storage/tape-vs-disk-storage-why-isnt-tape-dead-yet.html +[5]: https://www.networkworld.com/article/3302804/storage/the-correct-levels-of-backup-save-time-bandwidth-space.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From afda84f8b95aee0aafcc515c4ba1ef06260c1304 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 01:01:25 +0800 Subject: [PATCH 279/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191101=20Big=20?= =?UTF-8?q?Four=20carriers=20want=20to=20rule=20IoT=20by=20simplifying=20i?= =?UTF-8?q?t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191101 Big Four carriers want to rule IoT by simplifying it.md --- ...iers want to rule IoT by simplifying it.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/talk/20191101 Big Four carriers want to rule IoT by simplifying it.md diff --git a/sources/talk/20191101 Big Four carriers want to rule IoT by simplifying it.md b/sources/talk/20191101 Big Four carriers want to rule IoT by simplifying it.md new file mode 100644 index 0000000000..4194e97438 --- /dev/null +++ b/sources/talk/20191101 Big Four carriers want to rule IoT by simplifying it.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Big Four carriers want to rule IoT by simplifying it) +[#]: via: (https://www.networkworld.com/article/3449820/big-four-carriers-want-to-rule-iot-by-simplifying-it.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Big Four carriers want to rule IoT by simplifying it +====== +A look at some of the pros and cons of IoT services from AT&T, Sprint, T-Mobile and Verizon +Natalya Burova / Getty Images + +The [Internet of Things][1] promises a transformative impact on a wide range of industries, but along with that promise comes an enormous new level of complexity for the network and those in charge of maintaining it. For the major mobile data carriers in the U.S., that fact suggests an opportunity. + +The core of the carriers’ appeal for IoT users is simplicity. Opting for Verizon or AT&T instead of in-house connectivity removes a huge amount of the work involved in pulling an IoT implementation together. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Operationally, it’s the same story. The carrier is handling the network management and security functionality, and everything involved in the connectivity piece is available through a centralized management console. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The carriers’ approach to the IoT market is two-pronged, in that they sell connectivity services directly to end-users as well as selling connectivity wholesale to device makers. For example, one customer might buy a bunch of sensors directly from Verizon, while another might buy equipment from a specialist manufacturer that contracts with Verizon to provide connectivity. + +There are, experts agree, numerous advantages to simply handing off the wireless networking of an IoT project to a major carrier. Licensed networks are largely free of interference – the carriers own the exclusive rights to the RF spectrum being used in a designated area, so no one else is allowed to use it without risking the wrath of the FCC. In contrast, a company using unlicensed technologies like Wi-Fi might be competing for the same spectrum area with half a dozen other organizations. + +It’s also better-secured than most unlicensed technologies or at least easier to secure, according to former chair of the IEEE’s IoT [smart cities][4] working group Shawn Chandler. Buying connectivity services that will have to be managed and secured in-house can be a lot more work than letting one of the carriers take care of it. + +“If you’re going to use mesh networks and RF networks,” he said, “then the enterprise is looking at [buying] a full security solution.” + +There are, of course, downsides as well. Plenty of businesses with a lot of institutional experience on the networking side are going to have trust issues with handing over control of mission-critical networks to a third party, said 451 Research vice president Christian Renaud. + +“For someone to come in over the top with, ‘Oh we’ll manage everything for you,’” he said, might draw a response along the lines of, “Wait, what?” from the networking staff. Carriers promise a lot of visibility into the logical relationships between endpoints, edge modules and the cloud – but the actual topology of the network itself may be abstracted out. + +And despite a generally higher level of security, carrier networks aren’t completely bulletproof. Several research teams have demonstrated attack techniques that, although unlikely to be seen in the wild, at least have the potential to compromise modern LTE networks. An example: researchers at Ruhr-University Bochum in 2018 [published a paper detailing potential attack vectors][5] that could allow a bad actor to target unencrypted metadata, which details users connected to a given mobile node, in order to spoof DNS requests. + +Nevertheless, carriers are set to play a crucially important part in the future evolution of enterprise IoT, and each of the big four U.S. carriers has a robust suite of offerings. + +### T-Mobile + +T-Mobile’s focus is on asset tracking, smart city technology, smart buildings and vehicular fleet management, which makes sense, given that those areas are a natural fit for carrier-based IoT. All except smart buildings require a large geographical coverage area, and the ability to bring a large number of diverse endpoints from diverse sources onto the network is a strength. + +The company also runs the CONNECT partner program, aimed at makers of IoT solutions who want to use T-Mobile’s network for connectivity. It offers the option to sell hardware, software or specialist IoT platforms through the main T-Mobile for Business program, as well as, of course, close technical integration with T-Mobile’s network. + +Finally, T-Mobile offers the option of using [narrow-band IoT technology, or NB-IoT][6]. This refers to the practice of using a small slice of the network’s spectrum to provide low-throughput connectivity to a large number of devices at the same time. It’s purpose-built for IoT, and although it won’t work for something like streaming video, where a lot of data has to be moved quickly, it’s well-suited to an asset tracking system that merely has to send brief status reports. The company even sells five-dollar systems-on-a-chip in bulk for organizations that want to integrate existing hardware or sensors into T-Mobile’s network. + +### AT&T + +Like the rest of the big four, AT&T does business both by selling their own IoT services – most of it under the umbrella of the Multi-Network Connect platform, a single pane of glass offering designed to streamline the management of many types of IoT product – and by partnering with an array of hardware and other product makers who want to use the company’s network. + +Along with NB-IoT, AT&T provides LTE-M connectivity, a similar but slightly more capable IoT-focused network technology that adds voice support and more throughput to the NB-IoT playbook. David Allen, director of advanced product development at AT&T’s advanced mobility and enterprise solutions division, said that LTE-M and NB-IoT are powerful tools in the company’s IoT arsenal. + +“These are small slivers of spectrum that offer an instant national footprint,” he said. + +MNC is advertised as a broad-based platform that can bring together input from nearly any type of licensed network, from 2G up through satellite, and even integrate with other connectivity management platforms – so a company that uses multiple operators could bring trhem all under the roof of MNC. + +### Verizon + +Verizon’s IoT platform, and the focus of its efforts to do business in the IoT realm is Thingspace, which is similar to AT&T’s MNC in many respects. The company also offers both NB-IoT and LTE-M for flexible IoT-specific connectivity options, as well as support for traditional SIM-based networking. As with the rest of the big four, Verizon also sells connectivity services to third parties. + +While the company said that it doesn’t break down its IoT business into third-party/first-party sales, Verizon says it has had success in several verticals, including telematics for the energy and healthcare industries. The first use case involves using current sensors on the grid and smart meters at the home to study sustainability and track usage more closely. The second involves working on remote monitoring of patient data, and the company said it will hav announcements around that in the future. + +While the focus is obviously on connectivity, Verizon also does something slightly unusual for the carrier IoT market by selling a one-size-fits-most sensor of its own creation, called the Critical Asset Sensor. This is a small sensor module that contains acceleration, temperature, pressure, light, humidity and shock sensors, along with GPS and network connectivity, so that it can fit a huge variety of IoT use cases. The idea is that they can be bought in bulk for an IoT implementation direct from Verizon, obviating the need to deal with a separate sensor vendor. + +### Sprint + +Sprint’s IoT offerings are partially provided under the umbrella of the company’s IoT Factory store, and the emphasis has been on various types of sensor-based service, including restaurant and food-service storage temperatures, smart building solutions for offices and other commercial property, as well as fleet management for terrestrial and marine vehicles. + +Most of these are offered through Sprint via partnerships with vertical specialists in those areas, like Apptricity, CU Trak, M2M in Motion and Rently, among many others. + +The company also has a dedicated IoT platform offering called Curiosity IoT, which leans on [Arm’s][7] platform security and connectivity management for basic functionality, but it promises most of the same functionality as the other Big Four vendors’ platforms. It provides a single pane of glass that integrates management and monitoring for every sensor on the network and shapes data into a standardized format for analysis on the back end. + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3449820/big-four-carriers-want-to-rule-iot-by-simplifying-it.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/3207535/what-is-iot-how-the-internet-of-things-works.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.networkworld.com/article/3411561/report-smart-city-iot-isnt-smart-enough-yet.html +[5]: https://alter-attack.net/media/breaking_lte_on_layer_two.pdf +[6]: https://www.networkworld.com/article/3227206/faq-what-is-nb-iot.html +[7]: https://www.networkworld.com/article/3294781/arm-flexes-flexibility-with-pelion-iot-announcement.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From d0c1a0701233b3a77e1953980c53272c541324d9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 01:04:44 +0800 Subject: [PATCH 280/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191102=20Can=20?= =?UTF-8?q?Data=20Scientists=20be=20Replaced=20by=20Automation=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191102 Can Data Scientists be Replaced by Automation.md --- ...ta Scientists be Replaced by Automation.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/talk/20191102 Can Data Scientists be Replaced by Automation.md diff --git a/sources/talk/20191102 Can Data Scientists be Replaced by Automation.md b/sources/talk/20191102 Can Data Scientists be Replaced by Automation.md new file mode 100644 index 0000000000..89b4e8b77a --- /dev/null +++ b/sources/talk/20191102 Can Data Scientists be Replaced by Automation.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Can Data Scientists be Replaced by Automation?) +[#]: via: (https://opensourceforu.com/2019/11/can-data-scientists-be-replaced-by-automation/) +[#]: author: (Preet Gandhi https://opensourceforu.com/author/preet-gandhi/) + +Can Data Scientists be Replaced by Automation? +====== + +[![][1]][2] + +_The advent of AI, automation and smart bots triggers the question: Is it possible that data scientists will become redundant in the future? Are they indispensable? The ideal approach appears to be automation complementing the work data scientists do. This would better utilise the tremendous data being generated throughout the world every day._ + +Data scientists are currently very much in demand. But there is the question about whether they can automate themselves out of their jobs. Can artificial intelligence replace data scientists? If so, up to what extent can their tasks be automated? Gartner recently reported that 40 per cent of data science tasks will be automated by 2020. So what kind of skills can be efficiently handled by automation? All this speculation adds fuel to the ongoing ‘Man vs Machine’ debate. + +Data scientists need a strong mathematical mind, quantitative skills, computer programming skills and business acumen to make decisions. They need to gather large unstructured data and transform it into results and insights, which can be understood by laymen or business executives. The whole process is highly customised, depending on the type of application domain. Some degree of human interaction will always be needed due to the subjective nature of the process, and what percentage of the task is automated depends in the specific use case and is open to debate. To understand how much or what parts can be automated, we need to have a deep understanding of the process. + +Data scientists are expensive to hire and there is a shortage of this skill in the industry as it’s a relatively new field. Many companies try to look for alternative solutions. Several AI algorithms have now been developed, which can analyse data and provide insights similar to a data scientist. The algorithm has to provide the data output and make accurate predictions, which can be done by using Natural Language Processing (NLP). + +NLP can be used to communicate with AI in the same way that laymen interact with data scientists to put forth their demands. For example, IBM Watson has NLP facilities which interact with business intelligence (BI) tools to perform data science tasks. Microsoft’s Cortana also has a powerful BI tool, and users can process Big Data sets by just speaking to it. All these are simple forms of automation which are widely available already. Data engineering tasks such as cleansing, normalisation, skewness removal, transformation, etc, as well as modelling methods like champion model selection, feature selection, algorithm selection, fitness metric selection, etc, are tasks for which automated tools are currently available in the market. + +Automation in data science will squeeze some manual labour out of the workflow instead of completely replacing the data scientists. Low-level functions can be efficiently handled by AI systems. There are many technologies to do this. The Alteryx Designer tool automatically generates customised REST APIs and Docker images around machine learning models during the promotion and deployment stage. + +Designer workflows can also be set up to automatically retrain machine learning models, using fresh data, and then to automatically redeploy them. Data integration, model building, and optimising model hyper parameters are areas where automation can be helpful. Data integration combines data from multiple sources to provide a uniform data set. Automation here can pull trusted data from multiple sources for a data scientist to analyse. Collecting data, searching for patterns and making predictions are required for model building, which can be automated as machines can collect data to find patterns. + +Machines are getting smarter everyday due to the integration of AI principles that help them learn from the types of patterns they were historically trying to detect. An added advantage here is that machines will not make the kinds of errors that humans do. + +Automation has its own set of limitations, however. It can only go so far. Artificial intelligence can automate data engineering and machine learning processes but AI can’t automate itself. Data wrangling (data munging) consists of manually converting raw data to an easily consumable form. The process still requires human judgment to turn raw data into insights that make sense for an organisation, and take all of an organisation’s complexities into account. Even unsupervised learning is not entirely automated. Data scientists still prepare sets, clean them, specify which algorithms to use, and interpret the findings. Data visualisation, most of the time, needs a human as the findings to be presented to laymen have to be highly customised, depending on the technical knowledge of the audience. A machine can’t possibly be trained to do that. + +Low-level visualisations can be automated, but human intelligence would be required to interpret and explain the data. It will also be needed to write AI algorithms that can handle mundane visualisation tasks. Moreover, intangibles like human curiosity, intuition or the desire to create/validate experiments can’t be simulated by AI. This aspect of data science probably won’t be ever handled by AI in the near future as the technology hasn’t evolved to that extent. + +While thinking about automation, we should also consider the quality of the output. Here, output means the validity or relevance of the insights. With automation, the quantity and throughput of data science artefacts will increase, but that doesn’t translate to an increase in quality. The process of extracting insights and applying them within the context of particular data driven applications is still inherently a creative, exploratory process that demands human judgment. To get a deeper understanding of the data, feature engineering is a very essential portion of the process. It allows us to make maximum use of the data available to us. Automating feature engineering is really difficult as it requires human domain knowledge and a real-world understanding, which is tough for a machine to acquire. Even if AI is used, it can’t provide the same level of feedback that a human expert in that domain can. While automation can help identify patterns in an organisation, machines cannot truly understand what data means for an organisation and its relationships between different, unconnected operations. + +You can’t teach a machine to be creative. After getting results from a pipeline, a data scientist can seek further domain knowledge in order to add value and improve the pipeline.Collaborating alongside marketing, sales and engineering teams, solutions will need to be implemented and deployed based on these findings to improve the model. It’s an iterative process and after each iteration, the creativity with which data scientists plan on adding to the next phase is what differentiates them from bots. The interactions and conversations driving these initiatives, which are fuelled by abstract, creative thinking, surpass the capabilities of any modern-day machine. + +Current data scientists shouldn’t be worried about losing their jobs to computers due to automation, as they are an amalgamation of thought leaders, coders and statisticians. A successful data science project will always need a strong team of humans to work together and collaborate to synergistically solve a problem. AI will have a tough time collaborating, which is essential in order to transform data to actionable data. Even if automation is used to some extent, a data scientist will always have to manually validate the results of a pipeline in order to make sure it makes sense in the real world. Automation can be thought of as a supplementary tool which will help scale data science and make the work more efficient. Bots can handle lower-level tasks and leave the problem-solving tasks to human experts. The combination of automation with human problem-solving will actually empower, rather than threaten, the jobs of data scientists as bots will be like assistants to the former. + +Automation can never completely replace a data scientist because no amount of advanced AI can emulate the most important quality a skilful data scientist must possess – intuition. + +![Avatar][3] + +[Preet Gandhi][4] + +The author is an avid Big Data and data science enthusiast. You can contact her at [gandhipreet1995@gmail.com][5]. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/can-data-scientists-be-replaced-by-automation/ + +作者:[Preet Gandhi][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/preet-gandhi/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Data-Scientist-automation.jpg?resize=696%2C458&ssl=1 (Data Scientist automation) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Data-Scientist-automation.jpg?fit=727%2C478&ssl=1 +[3]: https://secure.gravatar.com/avatar/4603e91c8ba6455d0d817c912a8985bf?s=100&r=g +[4]: https://opensourceforu.com/author/preet-gandhi/ +[5]: mailto:gandhipreet1995@gmail.com From ff450bd65699b2bf52e853ccf622f10d2f81ab82 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 4 Nov 2019 01:09:54 +0800 Subject: [PATCH 281/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191101=20Keyboa?= =?UTF-8?q?rd=20Shortcuts=20to=20Speed=20Up=20Your=20Work=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md --- ...hortcuts to Speed Up Your Work in Linux.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/talk/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md diff --git a/sources/talk/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/sources/talk/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md new file mode 100644 index 0000000000..9151c9eb84 --- /dev/null +++ b/sources/talk/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keyboard Shortcuts to Speed Up Your Work in Linux) +[#]: via: (https://opensourceforu.com/2019/11/keyboard-shortcuts-to-speed-up-your-work-in-linux/) +[#]: author: (S Sathyanarayanan https://opensourceforu.com/author/s-sathyanarayanan/) + +Keyboard Shortcuts to Speed Up Your Work in Linux +====== + +[![Google Keyboard][1]][2] + +_Manipulating the mouse, keyboard and menus takes up a lot of our time, which could be saved by using keyboard shortcuts. These not only save time, but also make the computer user more efficient._ + +Did you realise that switching from the keyboard to the mouse while typing takes up to two seconds each time? If a person works for eight hours every day, switching from the keyboard to the mouse once a minute, and there are around 240 working days in a year, the amount of time wasted (as per calculations done by Brainscape) is: +_[2 wasted seconds/min] x [480 minutes per day] x 240 working days per year = 64 wasted hours per year_ +This is equal to eight working days lost and hence learning keyboard shortcuts will increase productivity by 3.3 per cent (__). + +Keyboard shortcuts provide a quicker way to do a task, which otherwise would have had to be done in multiple steps using the mouse and/or the menu. Figure 1 gives a list of a few most frequently used shortcuts in Ubuntu 18.04 Linux OS and the Web browsers. I am omitting the very well-known shortcuts like copy, paste, etc, and the ones which are not used frequently. The readers can refer to online resources for a comprehensive list of shortcuts. Note that the Windows key is renamed as Super key in Linux. + +**General shortcuts** +A list of general shortcuts is given below. + +[![][3]][4] +**Print Screen and video recording of the screen** +The following shortcuts can be used to print the screen or take a video recording of the screen. +[![][5]][6]**Switching between applications** +The shortcut keys listed here can be used to switch between applications. + +[![][7]][8] +**Tile windows** +The windows can be tiled in different ways using the shortcuts given below. + +[![][9]][10] + +**Browser shortcuts** +The most frequently used shortcuts for browsers are listed here. Most of the shortcuts are common to the Chrome/Firefox browsers. + +**Key combination** | **Action** +---|--- +Ctrl + T | Opens a new tab. +Ctrl + Shift + T | Opens the most recently closed tab. +Ctrl + D | Adds a new bookmark. +Ctrl + W | Closes the browser tab. +Alt + D | Positions the cursor in the browser’s address bar. +F5 or Ctrl-R | Refreshes a page. +Ctrl + Shift + Del | Clears private data and history. +Ctrl + N | Opens a new window. +Home | Scrolls to the top of the page. +End | Scrolls to the bottom of the page. +Ctrl + J | Opens the Downloads folder +(in Chrome) +F11 | Full-screen view (toggle effect) + +**Terminal shortcuts** +Here is a list of terminal shortcuts. +[![][11]][12]You can also configure your own custom shortcuts in Ubuntu, as follows: + + * Click on Settings in Ubuntu Dash. + * Select the Devices tab in the left menu of the Settings window. + * Select the Keyboard tab in the Devices menu. + * The ‘+’ button is displayed at the bottom of the right panel. Click on the ‘+’ sign to open the custom shortcut dialogue box and configure a new shortcut. + + + +Learning three shortcuts mentioned in this article can save a lot of time and make you more productive. + +**Reference** +_Cohen, Andrew. How keyboard shortcuts could revive America’s economy; [www.brainscape.com][13]. [Online] Brainscape, 26 May 2017; _ + +![Avatar][14] + +[S Sathyanarayanan][15] + +The author is currently working with Sri Sathya Sai University for Human Excellence, Gulbarga. He has more than 25 years of experience in systems management and in teaching IT courses. He is an enthusiastic promoter of FOSS and can be reached at [sathyanarayanan.brn@gmail.com][16]. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/keyboard-shortcuts-to-speed-up-your-work-in-linux/ + +作者:[S Sathyanarayanan][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/s-sathyanarayanan/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/12/Google-Keyboard.jpg?resize=696%2C418&ssl=1 (Google Keyboard) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/12/Google-Keyboard.jpg?fit=750%2C450&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/1.png?resize=350%2C319&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/1.png?ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/NW.png?resize=350%2C326&ssl=1 +[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/NW.png?ssl=1 +[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/2.png?resize=350%2C264&ssl=1 +[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/2.png?ssl=1 +[9]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/3.png?resize=350%2C186&ssl=1 +[10]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/3.png?ssl=1 +[11]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/7.png?resize=350%2C250&ssl=1 +[12]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/7.png?ssl=1 +[13]: http://www.brainscape.com +[14]: https://secure.gravatar.com/avatar/736684a2707f2ed7ae72675edf7bb3ee?s=100&r=g +[15]: https://opensourceforu.com/author/s-sathyanarayanan/ +[16]: mailto:sathyanarayanan.brn@gmail.com From 652cd7723237fd0f52fbac278eafa4ec108f0395 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Nov 2019 08:53:49 +0800 Subject: [PATCH 282/800] Rename sources/talk/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md to sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md --- .../20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => tech}/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md (100%) diff --git a/sources/talk/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md similarity index 100% rename from sources/talk/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md rename to sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md From 95671b9fca6e6464cc03ed16dad0c63d44328d4d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Nov 2019 08:55:30 +0800 Subject: [PATCH 283/800] Rename sources/tech/20191102 6 remarkable features of the new United Nations open source initiative.md to sources/talk/20191102 6 remarkable features of the new United Nations open source initiative.md --- ...e features of the new United Nations open source initiative.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191102 6 remarkable features of the new United Nations open source initiative.md (100%) diff --git a/sources/tech/20191102 6 remarkable features of the new United Nations open source initiative.md b/sources/talk/20191102 6 remarkable features of the new United Nations open source initiative.md similarity index 100% rename from sources/tech/20191102 6 remarkable features of the new United Nations open source initiative.md rename to sources/talk/20191102 6 remarkable features of the new United Nations open source initiative.md From d053e2625c2dd192c83943b12c9239b990cea982 Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Mon, 4 Nov 2019 10:34:35 +0800 Subject: [PATCH 284/800] translating --- ...How to Find Out Top Memory Consuming Processes in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md b/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md index 9e30fad132..fe5bafeb5c 100644 --- a/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md +++ b/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lnrCoder) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -204,7 +204,7 @@ via: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lnrCoder](https://github.com/lnrCoder) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6453f08a2a3f197cf9e52538d2934e26f7bb228f Mon Sep 17 00:00:00 2001 From: laingke Date: Mon, 4 Nov 2019 10:41:18 +0800 Subject: [PATCH 285/800] 20191031-kubernetes-complex-business-problem translating --- .../20191031 Why you don-t have to be afraid of Kubernetes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md b/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md index 8d9d67e1bd..68cd594b58 100644 --- a/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md +++ b/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -89,7 +89,7 @@ via: https://opensource.com/article/19/10/kubernetes-complex-business-problem 作者:[Scott McCarty][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 41f29169c4cc4a5de61b54e08309874ea1e78e84 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 4 Nov 2019 11:33:24 +0800 Subject: [PATCH 286/800] PRF @geekpi --- ...epository on CentOS 8 and RHEL 8 Server.md | 48 ++++++++++--------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md b/translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md index 9b0d320a79..6b1a42558d 100644 --- a/translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md +++ b/translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server) @@ -10,23 +10,21 @@ 如何在 CentOS 8 和 RHEL 8 服务器上启用 EPEL 仓库 ====== -**EPEL** 代表 “Extra Packages for Enterprise Linux”,它是一个免费的开源附加软件包仓库,可用于 **CentOS** 和 **RHEL** 服务器。顾名思义,EPEL 仓库提供了额外的软件包,它们在 [CentOS 8][1]和 [RHEL 8][2] 的默认软件包仓库中不可用。 +EPEL 代表 “Extra Packages for Enterprise Linux”,它是一个自由开源的附加软件包仓库,可用于 CentOS 和 RHEL 服务器。顾名思义,EPEL 仓库提供了额外的软件包,这些软件在 [CentOS 8][1] 和 [RHEL 8][2] 的默认软件包仓库中不可用。 -在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 服务器上启用和使用 epel 存储库。 +在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 服务器上启用和使用 EPEL 存储库。 -[![EPEL-Repo-CentOS8-RHEL8][3]][4] +![](https://img.linux.net.cn/data/attachment/album/201911/04/113307wz4y3lnczzlxzn2j.jpg) ### EPEL 仓库的先决条件 - * Minimal CentOS 8 和 RHEL 8 服务器 + * 最小化安装的 CentOS 8 和 RHEL 8 服务器 * root 或 sudo 管理员权限 * 网络连接 - - ### 在 RHEL 8.x 服务器上安装并启用 EPEL 仓库 -登录或 SSH 到你的 RHEL 8.x 服务器并执行以下 dnf 命令来安装 EPEL rpm 包, +登录或 SSH 到你的 RHEL 8.x 服务器,并执行以下 `dnf` 命令来安装 EPEL rpm 包, ``` [root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y @@ -34,9 +32,9 @@ 上面命令的输出将如下所示, -![dnf-install-epel-repo-rehl8][3] +![dnf-install-epel-repo-rehl8][5] -epel rpm 包成功安装后,它将自动启用并配置其 yum/dnf 仓库。运行以下 dnf 或 yum 命令,以验证是否启用了 EPEL 仓库, +EPEL rpm 包成功安装后,它将自动启用并配置其 yum/dnf 仓库。运行以下 `dnf` 或 `yum` 命令,以验证是否启用了 EPEL 仓库, ``` [root@linuxtechi ~]# dnf repolist epel @@ -44,11 +42,11 @@ epel rpm 包成功安装后,它将自动启用并配置其 yum/dnf 仓库。 [root@linuxtechi ~]# dnf repolist epel -v ``` -![epel-repolist-rhel8][3] +![epel-repolist-rhel8][6] ### 在 CentOS 8.x 服务器上安装并启用 EPEL 仓库 -登录或 SSH 到你的 CentOS 8 服务器,并执行以下 dnf 或 yum 命令来安装 “**epel-release**” rpm 软件包。在 CentOS 8 服务器中,epel rpm 在其默认软件包仓库中。 +登录或 SSH 到你的 CentOS 8 服务器,并执行以下 `dnf` 或 `yum` 命令来安装 `epel-release` rpm 软件包。在 CentOS 8 服务器中,EPEL rpm 在其默认软件包仓库中。 ``` [root@linuxtechi ~]# dnf install epel-release -y @@ -56,7 +54,7 @@ epel rpm 包成功安装后,它将自动启用并配置其 yum/dnf 仓库。 [root@linuxtechi ~]# yum install epel-release -y ``` -执行以下命令来验证 CentOS 8 服务器上 epel 仓库的状态, +执行以下命令来验证 CentOS 8 服务器上 EPEL 仓库的状态, ``` [root@linuxtechi ~]# dnf repolist epel @@ -82,11 +80,11 @@ Total packages: 1,977 [root@linuxtechi ~]# ``` -以上命令的输出说明我们已经成功启用了epel 仓库。 让我们在 EPEL 仓库上执行一些基本操作。 +以上命令的输出说明我们已经成功启用了 EPEL 仓库。让我们在 EPEL 仓库上执行一些基本操作。 -### 列出 epel 仓库种所有可用包 +### 列出 EPEL 仓库种所有可用包 -如果要列出 epel 仓库中的所有的软件包,请运行以下 dnf 命令, +如果要列出 EPEL 仓库中的所有的软件包,请运行以下 `dnf` 命令, ``` [root@linuxtechi ~]# dnf repository-packages epel list @@ -116,9 +114,9 @@ zvbi-fonts.noarch 0.2.35-9.el8 epel [root@linuxtechi ~]# ``` -### 从 epel 仓库中搜索软件包 +### 从 EPEL 仓库中搜索软件包 -假设我们要搜索 epel 仓库中的 Zabbix 包,请执行以下 dnf 命令, +假设我们要搜索 EPEL 仓库中的 Zabbix 包,请执行以下 `dnf` 命令, ``` [root@linuxtechi ~]# dnf repository-packages epel list | grep -i zabbix @@ -128,19 +126,21 @@ zvbi-fonts.noarch 0.2.35-9.el8 epel ![epel-repo-search-package-centos8][3] -### 从 epel 仓库安装软件包 +### 从 EPEL 仓库安装软件包 -假设我们要从 epel 仓库安装 htop 包,运行以下 dnf 命令, +假设我们要从 EPEL 仓库安装 htop 包,运行以下 `dnf` 命令, 语法: -# dnf –enablerepo=”epel” install <pkg_name> +``` +# dnf –enablerepo=”epel” install <包名> +``` ``` [root@linuxtechi ~]# dnf --enablerepo="epel" install htop -y ``` -**注意:**如果我们在上面的命令中未指定 “**–enablerepo=epel**”,那么它将在所有可用的软件包仓库中查找 htop 包。 +注意:如果我们在上面的命令中未指定 `–enablerepo=epel`,那么它将在所有可用的软件包仓库中查找 htop 包。 本文就是这些内容了,我希望上面的步骤能帮助你在 CentOS 8 和 RHEL 8 服务器上启用并配置 EPEL 仓库,请在下面的评论栏分享你的评论和反馈。 @@ -151,7 +151,7 @@ via: https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/ 作者:[Pradeep Kumar][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/) 荣誉推出 @@ -161,3 +161,5 @@ via: https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/ [2]: https://www.linuxtechi.com/install-configure-kvm-on-rhel-8/ [3]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 [4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/EPEL-Repo-CentOS8-RHEL8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/10/dnf-install-epel-repo-rehl8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/10/epel-repolist-rhel8.jpg From ef7e64f0b928affeba7af5b3f26c0144073c73e5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 4 Nov 2019 11:34:12 +0800 Subject: [PATCH 287/800] PUB @geekpi https://linux.cn/article-11535-1.html --- ...to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md (98%) diff --git a/translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md b/published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md similarity index 98% rename from translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md rename to published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md index 6b1a42558d..02a58edaf6 100644 --- a/translated/tech/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md +++ b/published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11535-1.html) [#]: subject: (How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server) [#]: via: (https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) From 7759f93568249002190ddfc0517c99b70a2919f4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 4 Nov 2019 11:43:37 +0800 Subject: [PATCH 288/800] PRF --- ... to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md b/published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md index 02a58edaf6..c71aa58995 100644 --- a/published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md +++ b/published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md @@ -124,7 +124,7 @@ zvbi-fonts.noarch 0.2.35-9.el8 epel 上面命令的输出类似下面这样, -![epel-repo-search-package-centos8][3] +![epel-repo-search-package-centos8][7] ### 从 EPEL 仓库安装软件包 @@ -163,3 +163,4 @@ via: https://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/ [4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/EPEL-Repo-CentOS8-RHEL8.jpg [5]: https://www.linuxtechi.com/wp-content/uploads/2019/10/dnf-install-epel-repo-rehl8.jpg [6]: https://www.linuxtechi.com/wp-content/uploads/2019/10/epel-repolist-rhel8.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/10/epel-repo-search-package-centos8.jpg From 17c8594b5f90f0d96feb8c7e06cbadf61ed07a96 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Nov 2019 11:46:04 +0800 Subject: [PATCH 289/800] Rename sources/tech/20191101 Product vs. project in open source.md to sources/talk/20191101 Product vs. project in open source.md --- .../{tech => talk}/20191101 Product vs. project in open source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191101 Product vs. project in open source.md (100%) diff --git a/sources/tech/20191101 Product vs. project in open source.md b/sources/talk/20191101 Product vs. project in open source.md similarity index 100% rename from sources/tech/20191101 Product vs. project in open source.md rename to sources/talk/20191101 Product vs. project in open source.md From f69a0466139ac8d47c53a19535453e8b8d5fe59a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 4 Nov 2019 11:46:53 +0800 Subject: [PATCH 290/800] Rename sources/tech/20191101 Retro computing with FPGAs and MiSTer.md to sources/talk/20191101 Retro computing with FPGAs and MiSTer.md --- .../20191101 Retro computing with FPGAs and MiSTer.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191101 Retro computing with FPGAs and MiSTer.md (100%) diff --git a/sources/tech/20191101 Retro computing with FPGAs and MiSTer.md b/sources/talk/20191101 Retro computing with FPGAs and MiSTer.md similarity index 100% rename from sources/tech/20191101 Retro computing with FPGAs and MiSTer.md rename to sources/talk/20191101 Retro computing with FPGAs and MiSTer.md From 3e240f187fcb149ab20425e5b797e7cf2ddf93e8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 4 Nov 2019 12:07:11 +0800 Subject: [PATCH 291/800] PRF @geekpi --- ...191028 SQLite is really easy to compile.md | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/translated/tech/20191028 SQLite is really easy to compile.md b/translated/tech/20191028 SQLite is really easy to compile.md index 707616de02..325584c4df 100644 --- a/translated/tech/20191028 SQLite is really easy to compile.md +++ b/translated/tech/20191028 SQLite is really easy to compile.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (SQLite is really easy to compile) @@ -10,22 +10,23 @@ SQLite 真的很容易编译 ====== +![](https://img.linux.net.cn/data/attachment/album/201911/04/120656cedfznzenxxvmxq1.jpg) + 上周,我一直在做一个 SQL 网站(,一个 SQL 示例列表)。我使用 sqlite 运行网站上的所有查询,并且我想在其中一个例子([这个][1])中使用窗口函数。 但是我使用的是 Ubuntu 18.04 中的 sqlite 版本,它太旧了,不支持窗口函数。所以我需要升级 sqlite! -事实证明,这令人讨厌(通常),但是非常有趣!我想起了一些有关可执行文件和共享库如何工作的信息,结论令人满意。所以我想在这里写下来。 +事实证明,这个过程超麻烦(如通常一样),但是非常有趣!我想起了一些有关可执行文件和共享库如何工作的信息,结论令人满意。所以我想在这里写下来。 -(剧透: 中解释了如何编译 SQLite,它只需花费 5 秒左右,这比我平时从源码编译的经验容易了许多。) +(剧透: 中解释了如何编译 SQLite,它只需花费 5 秒左右,这比我平时从源码编译的体验容易了许多。) ### 尝试 1:从它的网站下载 SQLite 二进制文件 [SQLite 的下载页面][2]有一个用于 Linux 的 SQLite 命令行工具的二进制文件的链接。我下载了它,它可以在笔记本电脑上运行,我以为这就完成了。 -但是后来我尝试在构建服务器 (Netlify) 上运行它,得到了这个极其奇怪的错误消息:“File not found”。我进行了追踪,并确定 `execve` 返回错误代码 ENOENT,这意味着 “File not found”。这有点令人发狂,因为该文件确实存在,并且有正确的权限。 +但是后来我尝试在构建服务器(Netlify) 上运行它,得到了这个极其奇怪的错误消息:“File not found”。我进行了追踪,并确定 `execve` 返回错误代码 ENOENT,这意味着 “File not found”。这有点令人发狂,因为该文件确实存在,并且有正确的权限。 - -我搜索了这个问题(通过搜索 “execve enoen”),找到了[这个 stackoverflow 中的答案][3],它指出要运行二进制文件,你不仅需要二进制文件存在!你还需要它的**加载程序**才能存在。 (加载程序的路径在二进制文件内部) +我搜索了这个问题(通过搜索 “execve enoen”),找到了[这个 stackoverflow 中的答案][3],它指出要运行二进制文件,你不仅需要二进制文件存在!你还需要它的**加载程序**才能存在。(加载程序的路径在二进制文件内部) 要查看加载程序的路径,可以使用 `ldd`,如下所示: @@ -39,17 +40,17 @@ $ ldd sqlite3 /lib/ld-linux.so.2 ``` -所以 `/lib/ld-linux.so.2` 是加载程序,而该文件在构建服务器上不存在,可能是因为 Xenial 安装程序不支持 32 位二进制文​​件(?),因此我需要尝试一些不同的东西。 +所以 `/lib/ld-linux.so.2` 是加载程序,而该文件在构建服务器上不存在,可能是因为 Xenial(Xenial 是 Ubuntu 16.04,本文应该使用的是 18.04 “Bionic Beaver”)安装程序不支持 32 位二进制文​​件(?),因此我需要尝试一些不同的东西。 ### 尝试 2:安装 Debian sqlite3 软件包 好吧,我想我也许可以安装来自 [debian testing 的 sqlite 软件包][4]。尝试从另一个我不使用的 Debian 版本安装软件包并不是一个好主意,但是出于某种原因,我还是决定尝试一下。 -这次毫不意外地破坏了我计算机上的 sqlite(这也破坏了 git),但我设法通过 `sudo dpkg --purge --force-all libsqlite3-0` 从中恢复,并使所有依赖于 sqlite 的软件再次工作。 +这次毫不意外地破坏了我计算机上的 sqlite(这也破坏了 git),但我设法通过 `sudo dpkg --purge --force-all libsqlite3-0` 恢复了,并使所有依赖于 sqlite 的软件再次工作。 ### 尝试 3:提取 Debian sqlite3 软件包 -我还尝试仅从 Debian sqlite 软件包中提取 sqlite3 二进制文件并运行它。毫不意外,这也行不通,但这个更容易理解:我有旧版本的 libreadline(.so.7),但它需要 .so.8。 +我还尝试仅从 Debian sqlite 软件包中提取 sqlite3 二进制文件并运行它。毫不意外,这也行不通,但这个更容易理解:我有旧版本的 libreadline(`.so.7`),但它需要 `.so.8`。 ``` $ ./usr/bin/sqlite3 @@ -58,7 +59,7 @@ $ ./usr/bin/sqlite3 ### 尝试 4:从源代码进行编译 -我花费这么多时间尝试下载 sqlite 二进制的原因是我认为从源代码编译 sqlite 既烦人又耗时。但是显然,下载随机的 sqlite 二进制文件根本不适合我,因此我最终决定尝试自己编译它。 +我花费这么多时间尝试下载 sqlite 二进制的原因是我认为从源代码编译 sqlite 既烦人又耗时。但是显然,下载随便一个 sqlite 二进制文件根本不适合我,因此我最终决定尝试自己编译它。 这有指导:[如何编译 SQLite][5]。它是宇宙中最简单的东西。通常,编译的感觉是类似这样的: @@ -69,15 +70,12 @@ $ ./usr/bin/sqlite3 * 编译失败,因为我安装了错误版本的依赖 * 去做其他事,之后找到二进制文件 - - 编译 SQLite 的方式如下: - * [从下载页面下载整合的 tarball][[2] + * [从下载页面下载整合的 tarball][2] * 运行 `gcc shell.c sqlite3.c -lpthread -ldl` * 完成!!! - 所有代码都在一个文件(`sqlite.c`)中,并且没有奇怪的依赖项!太奇妙了。 对我而言,我实际上并不需要线程支持或 readline 支持,因此我用编译页面上的说明来创建了一个非常简单的二进制文件,它仅使用了 libc 而没有其他共享库。 @@ -102,7 +100,7 @@ via: https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/ 作者:[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 0e5ef53a05b2540475a967908df10d701021ca89 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 4 Nov 2019 12:07:49 +0800 Subject: [PATCH 292/800] PUB @geekpi https://linux.cn/article-11536-1.html --- .../20191028 SQLite is really easy to compile.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191028 SQLite is really easy to compile.md (98%) diff --git a/translated/tech/20191028 SQLite is really easy to compile.md b/published/20191028 SQLite is really easy to compile.md similarity index 98% rename from translated/tech/20191028 SQLite is really easy to compile.md rename to published/20191028 SQLite is really easy to compile.md index 325584c4df..54afd887f0 100644 --- a/translated/tech/20191028 SQLite is really easy to compile.md +++ b/published/20191028 SQLite is really easy to compile.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11536-1.html) [#]: subject: (SQLite is really easy to compile) [#]: via: (https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/) [#]: author: (Julia Evans https://jvns.ca/) From 5782684f4f6f3f2c5ddacf70e3ddb46fe682efde Mon Sep 17 00:00:00 2001 From: laingke Date: Mon, 4 Nov 2019 18:18:12 +0800 Subject: [PATCH 293/800] 20191031-kubernetes-complex-business-problem translated --- ...u don-t have to be afraid of Kubernetes.md | 79 +++++++++---------- 1 file changed, 39 insertions(+), 40 deletions(-) diff --git a/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md b/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md index 68cd594b58..940b2279b2 100644 --- a/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md +++ b/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md @@ -7,81 +7,80 @@ [#]: via: (https://opensource.com/article/19/10/kubernetes-complex-business-problem) [#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) -Why you don't have to be afraid of Kubernetes +为什么你不必害怕 Kubernetes ====== -Kubernetes is absolutely the simplest, easiest way to meet the needs of -complex web applications. +Kubernetes 绝对是满足复杂 web 应用程序需求的最简单,最容易的方法。 ![Digital creative of a browser on the internet][1] -It was fun to work at a large web property in the late 1990s and early 2000s. My experience takes me back to American Greetings Interactive, where on Valentine's Day, we had one of the top 10 sites on the internet (measured by web traffic). We delivered e-cards for [AmericanGreetings.com][2], [BlueMountain.com][3], and others, as well as providing e-cards for partners like MSN and AOL. Veterans of the organization fondly remember epic stories of doing great battle with other e-card sites like Hallmark. As an aside, I also ran large web properties for Holly Hobbie, Care Bears, and Strawberry Shortcake. +在 90 年代末和 00 年代初,在大型网络媒体资源上工作很有趣。我的经历让我想起了 American Greetings Interactive,在情人节那天,我们拥有互联网上排名前 10 位之一的网站(以网络访问量衡量)。我们为 [AmericanGreetings.com][2],[BlueMountain.com][3] 等公司提供了电子贺卡,并为 MSN 和 AOL 等合作伙伴提供了电子贺卡。该组织的老员工仍然深切地记得与 Hallmark 等其它电子贺卡网站进行大战的史诗般的故事。 顺便说一句,我还为 Holly Hobbie,Care Bears 和 Strawberry Shortcake 经营大型网站。 -I remember like it was yesterday the first time we had a real problem. Normally, we had about 200Mbps of traffic coming in our front doors (routers, firewalls, and load balancers). But, suddenly, out of nowhere, the Multi Router Traffic Grapher (MRTG) graphs spiked to 2Gbps in a few minutes. I was running around, scrambling like crazy. I understood our entire technology stack, from the routers, switches, firewalls, and load balancers, to the Linux/Apache web servers, to our Python stack (a meta version of FastCGI), and the Network File System (NFS) servers. I knew where all of the config files were, I had access to all of the admin interfaces, and I was a seasoned, battle-hardened sysadmin with years of experience troubleshooting complex problems. +我记得就像那是昨天发生的一样,这是我们第一次遇到真正的问题。通常,我们的前门(路由器,防火墙和负载均衡器)有大约 200Mbps 的流量进入。但是,突然之间,Multi Router Traffic Grapher(MRTG)图示突然在几分钟内飙升至 2Gbps。我疯了似地东奔西跑。我了解了我们的整个技术堆栈,从路由器,交换机,防火墙和负载平衡器,到 Linux/Apache web 服务器,到我们的 Python 堆栈(FastCGI 的元版本),以及网络文件系统(NFS)服务器。我知道所有配置文件在哪里,我可以访问所有管理界面,并且我是一位经验丰富的,经验丰富的系统管理员,具有多年解决复杂问题的经验。 -But, I couldn't figure out what was happening... +但是,我无法弄清楚发生了什么…… -Five minutes feels like an eternity when you are frantically typing commands across a thousand Linux servers. I knew the site was going to go down any second because it's fairly easy to overwhelm a thousand-node cluster when it's divided up and compartmentalized into smaller clusters. +当你在一千个 Linux 服务器上疯狂地键入命令时,五分钟的感觉就像是永恒。我知道站点可能会在任何时候崩溃,因为当它被划分成更小的集群时,压垮上千个节点的集群是那么的容易。 -I quickly _ran_ over to my boss's desk and explained the situation. He barely looked up from his email, which frustrated me. He glanced up, smiled, and said, "Yeah, marketing probably ran an ad campaign. This happens sometimes." He told me to set a special flag in the application that would offload traffic to Akamai. I ran back to my desk, set the flag on a thousand web servers, and within minutes, the site was back to normal. Disaster averted. +我迅速 _跑到_ 老板的办公桌前,解释了情况。他几乎没有从电子邮件中抬头,这使我感到沮丧。他抬头看了看,笑了笑,说道:“是的,市场营销可能会开展广告活动。有时会发生这种情况。”他告诉我在应用程序中设置一个特殊标志,以减轻 Akamai 的访问量。 我跑回我的办公桌,在上千台 web 服务器上设置了标志,几分钟后,该站点恢复正常。灾难也就被避免了。 -I could share 50 more stories similar to this one, but the curious part of your mind is probably asking, "Where this is going?" +我可以再分享 50 个类似的故事,但你脑海中可能会有一点好奇:“这种运维方式将走向何方?” -The point is, we had a business problem. Technical problems become business problems when they stop you from being able to do business. Stated another way, you can't handle customer transactions if your website isn't accessible. +关键是,我们遇到了业务问题。当技术问题使你无法开展业务时,它们就变成了业务问题。换句话说,如果你的网站无法访问,你就不能处理客户交易。 -So, what does all of this have to do with Kubernetes? Everything. The world has changed. Back in the late 1990s and early 2000s, only large web properties had large, web-scale problems. Now, with microservices and digital transformation, every business has a large, web-scale problem—likely multiple large, web-scale problems. +那么,所有这些与 Kubernetes 有什么关系?一切。世界已经改变。早在 90 年代末和 00 年代初,只有大型网站才出现大型网络规模级的问题。现在,有了微服务和数字化转型,每个企业都面临着一个大型的网络规模级的问题——可能是多个大型的网络规模级的问题。 -Your business needs to be able to manage a complex web-scale property with many different, often sophisticated services built by many different people. Your web properties need to handle traffic dynamically, and they need to be secure. These properties need to be API-driven at all layers, from the infrastructure to the application layer. +你的企业需要能够通过许多不同的人构建的许多不同的,通常是复杂的服务来管理复杂的网络规模的资产。你的网站需要动态地处理流量,并且它们必须是安全的。这些属性需要在所有层(从基础结构到应用程序层)上由 API 驱动。 -### Enter Kubernetes +### 进入 Kubernetes -Kubernetes isn't complex; your business problems are. When you want to run applications in production, there is a minimum level of complexity required to meet the performance (scaling, jitter, etc.) and security requirements. Things like high availability (HA), capacity requirements (N+1, N+2, N+100), and eventually consistent data technologies become a requirement. These are production requirements for every company that has digitally transformed, not just the large web properties like Google, Facebook, and Twitter. +Kubernetes 并不复杂;你的业务问题才是。当你想在生产环境中运行应用程序时,要满足性能(伸缩性,抖动等)和安全性要求,就需要最低程度的复杂性。诸如高可用性(HA),容量要求(N+1,N+2,N+100)以及保证最终一致性的数据技术等就会成为必需。这些是每家进行数字化转型的公司的生产要求,而不仅仅是 Google,Facebook 和 Twitter 这样的大型网站。 -In the old world, I lived at American Greetings, every time we onboarded a new service, it looked something like this. All of this was handled by the web operations team, and none of it was offloaded to other teams using ticket systems, etc. This was DevOps before there was DevOps: +在旧时代,我还在 American Greetings 任职时,每次我们加入一个新的服务,它看起来像这样:所有这些都是由网络运营团队来处理的,没有一个是通过标签系统转移给其他团队来处理的。这是在 DevOps 出现之前的 DevOps: - 1. Configure DNS (often internal service layers and external public-facing) - 2. Configure load balancers (often internal services and public-facing) - 3. Configure shared access to files (large NFS servers, clustered file systems, etc.) - 4. Configure clustering software (databases, service layers, etc.) - 5. Configure webserver cluster (could be 10 or 50 servers) + 1. 配置DNS(通常是内部服务层和面向外部的公众) + 2. 配置负载均衡器(通常是内部服务和面向公众的) + 3. 配置对文件的共享访问(大型 NFS 服务器,群集文件系统等) + 4. 配置集群软件(数据库,服务层等) + 5. 配置 web 服务器群集(可以是 10 或 50 个服务器) -Most of this was automated with configuration management, but configuration was still complex because every one of these systems and services had different configuration files with completely different formats. We investigated tools like [Augeas][4] to simplify this but determined that it was an anti-pattern to try and normalize a bunch of different configuration files with a translator. +大多数配置是通过配置管理自动完成的,但是配置仍然很复杂,因为每个系统和服务都有不同的配置文件,而且格式完全不同。我们研究了像 [Augeas][4] 这样的工具来简化它,但是我们认为使用转换器来尝试和标准化一堆不同的配置文件是一种反模式。 -Today with Kubernetes, onboarding a new service essentially looks like: +如今,借助Kubernetes,启动一项新服务本质上看起来如下: - 1. Configure Kubernetes YAML/JSON. - 2. Submit it to the Kubernetes API (**kubectl create -f service.yaml**). + 1. 配置 Kubernetes YAML/JSON。 + 2. 提交给 Kubernetes API(```kubectl create -f service.yaml```)。 -Kubernetes vastly simplifies onboarding and management of services. The service owner, be it a sysadmin, developer, or architect, can create a YAML/JSON file in the Kubernetes format. With Kubernetes, every system and every user speaks the same language. All users can commit these files in the same Git repository, enabling GitOps. +Kubernetes 大大简化了服务的启动和管理。服务所有者(无论是系统管理员,开发人员还是架构师)都可以创建 Kubernetes 格式的 YAML/JSON 文件。使用 Kubernetes,每个系统和每个用户都说相同的语言。所有用户都可以在同一 Git 存储库中提交这些文件,从而启用 GitOps。 -Moreover, deprecating and removing a service is possible. Historically, it was terrifying to remove DNS entries, load-balancer entries, web-server configurations, etc. because you would almost certainly break something. With Kubernetes, everything is namespaced, so an entire service can be removed with a single command. You can be much more confident that removing your service won't break the infrastructure environment, although you still need to make sure other applications don't use it (a downside with microservices and function-as-a-service [FaaS]). +而且,可以弃用和删除服务。从历史上看,删除 DNS 条目,负载平衡器条目,web 服务器配置等是非常可怕的,因为你几乎肯定会破坏某些东西。使用 Kubernetes,所有内容都被命名为名称空间,因此可以通过单个命令删除整个服务。尽管你仍然需要确保其它应用程序不使用它(微服务和功能即服务(FaaS)的缺点),但你可以更加确信:删除服务不会破坏基础架构环境。 -### Building, managing, and using Kubernetes +### 构建,管理和使用 Kubernetes -Too many people focus on building and managing Kubernetes instead of using it (see [_Kubernetes is a_ _dump truck_][5]). +太多的人专注于构建和管理 Kubernetes 而不是使用它(详见 [_Kubernetes 是一辆翻斗车_][5]). -Building a simple Kubernetes environment on a single node isn't markedly more complex than installing a LAMP stack, yet we endlessly debate the build-versus-buy question. It's not Kubernetes that's hard; it's running applications at scale with high availability. Building a complex, highly available Kubernetes cluster is hard because building any cluster at this scale is hard. It takes planning and a lot of software. Building a simple dump truck isn't that complex, but building one that can carry [10 tons of dirt and handle pretty well at 200mph][6] is complex. +在单个节点上构建一个简单的 Kubernetes 环境并不比安装 LAMP 堆栈复杂得多,但是我们无休止地争论着构建与购买的问题。不是Kubernetes很难;它以高可用性大规模运行应用程序。建立一个复杂的,高可用性的 Kubernetes 集群很困难,因为要建立如此规模的任何集群都是很困难的。它需要规划和大量软件。建造一辆简单的翻斗车并不复杂,但是建造一辆可以运载 [10 吨灰尘并能以 200mph 的速度稳定行驶的卡车][6]则很复杂。 -Managing Kubernetes can be complex because managing large, web-scale clusters can be complex. Sometimes it makes sense to manage this infrastructure; sometimes it doesn't. Since Kubernetes is a community-driven, open source project, it gives the industry the ability to manage it in many different ways. Vendors can sell hosted versions, while users can decide to manage it themselves if they need to. (But you should question whether you actually need to.) +管理 Kubernetes 可能很复杂,因为管理大型网络规模的集群可能很复杂。有时,管理此基础架构很有意义;而有时不是。由于 Kubernetes 是一个社区驱动的开源项目,它使行业能够以多种不同方式对其进行管理。供应商可以出售托管版本,而用户可以根据需要自行决定对其进行管理。(但是你应该质疑是否确实需要。) -Using Kubernetes is the easiest way to run a large-scale web property that has ever been invented. Kubernetes is democratizing the ability to run a set of large, complex web services—like Linux did with Web 1.0. +使用 Kubernetes 是迄今为止运行大规模网络资源的最简单方法。Kubernetes 正在普及运行一组大型、复杂的 Web 服务的能力——就像当年 Linux 在 Web 1.0 中所做的那样。 -Since time and money is a zero-sum game, I recommend focusing on using Kubernetes. Spend your very limited time and money on [mastering Kubernetes primitives][7] or the best way to handle [liveness and readiness probes][8] (another example demonstrating that large, complex services are hard). Don't focus on building and managing Kubernetes. A lot of vendors can help you with that. +由于时间和金钱是一个零和游戏,因此我建议将重点放在使用 Kubernetes 上。将你的时间和金钱花费在[掌握 Kubernetes 原语][7]或处理[活跃度和就绪性探针][8]的最佳方法上(另一个例子表明大型、复杂的服务很难)。不要专注于构建和管理 Kubernetes。(在构建和管理上)许多供应商可以为你提供帮助。 -### Conclusion +### 结论 -I remember troubleshooting countless problems like the one I described at the beginning of this article—NFS in the Linux kernel at that time, our homegrown CFEngine, redirect problems that only surfaced on certain web servers, etc. There was no way a developer could help me troubleshoot any of these problems. In fact, there was no way a developer could even get into the system and help as a second set of eyes unless they had the skills of a senior sysadmin. There was no console with graphics or "observability"—observability was in my brain and the brains of the other sysadmins. Today, with Kubernetes, Prometheus, Grafana, and others, that's all changed. +我记得对无数的问题进行了故障排除,比如我在这篇文章的开头所描述的问题——当时 Linux 内核中的 NFS,我们自产的 CFEngine,仅在某些 web 服务器上出现的重定向问题等)。开发人员无法帮助我解决所有这些问题。实际上,除非开发人员具备高级系统管理员的技能,否则他们甚至不可能进入系统并作为第二组眼睛提供帮助。没有带有图形或“可观察性”的控制台——可观察性在我和其他系统管理员的大脑中。如今,有了 Kubernetes,Prometheus,Grafana 等,一切都改变了。 -The point is: +关键是: - 1. The world is different. All web applications are now large, distributed systems. As complex as AmericanGreetings.com was back in the day, the scaling and HA requirements of that site are now expected for every website. - 2. Running large, distributed systems is hard. Period. This is the business requirement, not Kubernetes. Using a simpler orchestrator isn't the answer. + 1. 时代不一样了。现在,所有 web 应用程序都是大型的分布式系统。就像 AmericanGreetings.com 过去一样复杂,现在每个网站都需要该站点的扩展性和 HA 要求。 + 2. 运行大型的分布式系统是很困难的。(维护)周期,这是业务需求,不是 Kubernetes 的。使用更简单的协调器并不是解决方案。 -Kubernetes is absolutely the simplest, easiest way to meet the needs of complex web applications. This is the world we live in and where Kubernetes excels. You can debate whether you should build or manage Kubernetes yourself. There are plenty of vendors that can help you with building and managing it, but it's pretty difficult to deny that it's the easiest way to run complex web applications at scale. +Kubernetes绝对是满足复杂Web应用程序需求的最简单,最简单的方法。这是我们生活的时代,而 Kubernetes 擅长于此。你可以讨论是否应该自己构建或管理 Kubernetes。有很多供应商可以帮助你构建和管理它,但是很难否认这是大规模运行复杂 web 应用程序的最简单方法。 -------------------------------------------------------------------------------- @@ -100,7 +99,7 @@ via: https://opensource.com/article/19/10/kubernetes-complex-business-problem [2]: http://AmericanGreetings.com [3]: http://BlueMountain.com [4]: http://augeas.net/ -[5]: https://opensource.com/article/19/6/kubernetes-dump-truck +[5]: https://linux.cn/article-11011-1.html [6]: http://crunchtools.com/kubernetes-10-ton-dump-truck-handles-pretty-well-200-mph/ -[7]: https://opensource.com/article/19/6/kubernetes-basics +[7]: https://linux.cn/article-11036-1.html [8]: https://srcco.de/posts/kubernetes-liveness-probes-are-dangerous.html From bc6de02126d48a12edb2038a1c3a7923b0560ad8 Mon Sep 17 00:00:00 2001 From: laingke Date: Mon, 4 Nov 2019 18:20:15 +0800 Subject: [PATCH 294/800] 20191031-kubernetes-complex-business-problem move to translated directory --- .../20191031 Why you don-t have to be afraid of Kubernetes.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/talk/20191031 Why you don-t have to be afraid of Kubernetes.md (100%) diff --git a/sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md b/translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md similarity index 100% rename from sources/talk/20191031 Why you don-t have to be afraid of Kubernetes.md rename to translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md From cb0431b7dbbb56282f09113674e613e94bc76e54 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 4 Nov 2019 22:38:23 +0800 Subject: [PATCH 295/800] APL --- .../tech/20190902 How RPM packages are made- the spec file.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190902 How RPM packages are made- the spec file.md b/sources/tech/20190902 How RPM packages are made- the spec file.md index c5dace0332..01f9941aa3 100644 --- a/sources/tech/20190902 How RPM packages are made- the spec file.md +++ b/sources/tech/20190902 How RPM packages are made- the spec file.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5f6691cb1e4dd31edfbd59ebbc96d621175cdc18 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Mon, 4 Nov 2019 22:49:32 +0800 Subject: [PATCH 296/800] translating --- ... How To Update a Fedora Linux System -Beginner-s Tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md b/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md index d102d5b89f..41ac02c6c5 100644 --- a/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md +++ b/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 23af7aced1aa303833698fe131829d61585d0f2c Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 5 Nov 2019 08:57:01 +0800 Subject: [PATCH 297/800] translated --- ...191029 Upgrading Fedora 30 to Fedora 31.md | 96 ------------------- ...191029 Upgrading Fedora 30 to Fedora 31.md | 96 +++++++++++++++++++ 2 files changed, 96 insertions(+), 96 deletions(-) delete mode 100644 sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md create mode 100644 translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md diff --git a/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md b/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md deleted file mode 100644 index e67f26d320..0000000000 --- a/sources/tech/20191029 Upgrading Fedora 30 to Fedora 31.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Upgrading Fedora 30 to Fedora 31) -[#]: via: (https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/) -[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) - -Upgrading Fedora 30 to Fedora 31 -====== - -![][1] - -Fedora 31 [is available now][2]. You’ll likely want to upgrade your system to get the latest features available in Fedora. Fedora Workstation has a graphical upgrade method. Alternatively, Fedora offers a command-line method for upgrading Fedora 30 to Fedora 31. - -### Upgrading Fedora 30 Workstation to Fedora 31 - -Soon after release time, a notification appears to tell you an upgrade is available. You can click the notification to launch the **GNOME Software** app. Or you can choose Software from GNOME Shell. - -Choose the _Updates_ tab in GNOME Software and you should see a screen informing you that Fedora 31 is Now Available. - -If you don’t see anything on this screen, try using the reload button at the top left. It may take some time after release for all systems to be able to see an upgrade available. - -Choose _Download_ to fetch the upgrade packages. You can continue working until you reach a stopping point, and the download is complete. Then use GNOME Software to restart your system and apply the upgrade. Upgrading takes time, so you may want to grab a coffee and come back to the system later. - -### Using the command line - -If you’ve upgraded from past Fedora releases, you are likely familiar with the _dnf upgrade_ plugin. This method is the recommended and supported way to upgrade from Fedora 30 to Fedora 31. Using this plugin will make your upgrade to Fedora 31 simple and easy. - -#### 1\. Update software and back up your system - -Before you do start the upgrade process, make sure you have the latest software for Fedora 30. This is particularly important if you have modular software installed; the latest versions of dnf and GNOME Software include improvements to the upgrade process for some modular streams. To update your software, use _GNOME Software_ or enter the following command in a terminal. - -``` -sudo dnf upgrade --refresh -``` - -Additionally, make sure you back up your system before proceeding. For help with taking a backup, see [the backup series][3] on the Fedora Magazine. - -#### 2\. Install the DNF plugin - -Next, open a terminal and type the following command to install the plugin: - -``` -sudo dnf install dnf-plugin-system-upgrade -``` - -#### 3\. Start the update with DNF - -Now that your system is up-to-date, backed up, and you have the DNF plugin installed, you can begin the upgrade by using the following command in a terminal: - -``` -sudo dnf system-upgrade download --releasever=31 -``` - -This command will begin downloading all of the upgrades for your machine locally to prepare for the upgrade. If you have issues when upgrading because of packages without updates, broken dependencies, or retired packages, add the _‐‐allowerasing_ flag when typing the above command. This will allow DNF to remove packages that may be blocking your system upgrade. - -#### 4\. Reboot and upgrade - -Once the previous command finishes downloading all of the upgrades, your system will be ready for rebooting. To boot your system into the upgrade process, type the following command in a terminal: - -``` -sudo dnf system-upgrade reboot -``` - -Your system will restart after this. Many releases ago, the _fedup_ tool would create a new option on the kernel selection / boot screen. With the _dnf-plugin-system-upgrade_ package, your system reboots into the current kernel installed for Fedora 30; this is normal. Shortly after the kernel selection screen, your system begins the upgrade process. - -Now might be a good time for a coffee break! Once it finishes, your system will restart and you’ll be able to log in to your newly upgraded Fedora 31 system. - -![][4] - -### Resolving upgrade problems - -On occasion, there may be unexpected issues when you upgrade your system. If you experience any issues, please visit the [DNF system upgrade quick docs][5] for more information on troubleshooting. - -If you are having issues upgrading and have third-party repositories installed on your system, you may need to disable these repositories while you are upgrading. For support with repositories not provided by Fedora, please contact the providers of the repositories. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/ - -作者:[Ben Cotton][a] -选题:[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/bcotton/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/f30-f31-816x345.jpg -[2]: https://fedoramagazine.org/announcing-fedora-31/ -[3]: https://fedoramagazine.org/taking-smart-backups-duplicity/ -[4]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png -[5]: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/#Resolving_post-upgrade_issues diff --git a/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md b/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md new file mode 100644 index 0000000000..9d0da9a1f6 --- /dev/null +++ b/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Upgrading Fedora 30 to Fedora 31) +[#]: via: (https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +将 Fedora 30 升级到 Fedora 31 +====== + +![][1] + +Fedora 31 [目前发布了][2]。你也许想要升级系统来获得 Fedora 中的最新功能。Fedora 工作站有图形化的升级方式。另外,Fedora 提供了一种命令行方式来将 Fedora 30 升级到 Fedora 31。 + +### 将 Fedora 30 工作站升级到 Fedora 31 + +在发布不久之后,就会有通知告诉你有可用升级。你可以点击通知打开 **GNOME Software**。或者在 GNOME Shell 选择 Software。 + +在 GNOME Software 中选择_更新_,你应该会看到告诉你有 Fedora 31 更新的提示。 + +如果你在屏幕上看不到任何内容,请尝试使用左上方的重新加载按钮。在发布后,所有系统可能需要一段时间才能看到可用的升级。 + +选择_下载_以获取升级包。你可以继续工作,直到下载完成。然后使用 GNOME Software 重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再返回系统。 + +### 使用命令行 + +如果你是从 Fedora 以前的版本升级的,那么你可能对 _dnf upgrade_ 插件很熟悉。这是推荐且支持的从 Fedora 30 升级到 Fedora 31 的方法。使用此插件能让你轻松地升级到 Fedora 31。 + +#### 1\. 更新软件并备份系统 + +在开始升级之前,请确保你安装了 Fedora 30 的最新软件。如果你安装了模块化软件,这点尤为重要。dnf 和 GNOME Software 的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用 _GNOME Software_ 或在终端中输入以下命令。 + +``` +sudo dnf upgrade --refresh +``` + +此外,在继续操作之前,请确保备份系统。有关备份的帮助,请参阅 Fedora Magazine 上的[备份系列][3]。 + +#### 2\. 安装 DNF 插件 + +接下来,打开终端并输入以下命令安装插件: + +``` +sudo dnf install dnf-plugin-system-upgrade +``` + +#### 3\. 使用 DNF 开始更新 + +现在,你的系统是最新的,已经备份并且安装了 DNF 插件,你可以通过在终端中使用以下命令来开始升级: + +``` +sudo dnf system-upgrade download --releasever=31 +``` + +该命令将开始在本地下载计算机的所有升级。如果由于缺乏更新包、损坏的依赖项或已淘汰的软件包而在升级时遇到问题,请在输入上面的命令时添加 _‐-allowerasing_ 标志。这将使 DNF 删除可能阻止系统升级的软件包。 + +#### 4\. 重启并升级 + +上面的命令下载更新完成后,你的系统就可以重启了。要将系统引导至升级过程,请在终端中输入以下命令: + +``` +sudo dnf system-upgrade reboot +``` + +此后,你的系统将重启。在许多版本之前,_fedup_ 工具会在内核选择/引导页面上创建一个新选项。使用 _dnf-plugin-system-upgrade_ 软件包,你的系统将重新引导到当前 Fedora 30 使用的内核。这很正常。在内核选择页面之后不久,你的系统会开始升级过程。 + +现在也许可以喝杯咖啡休息下!升级完成后,系统将重启,你将能够登录到新升级的 Fedora 31 系统。 + +![][4] + +### 解决升级问题 + +有时,升级系统时可能会出现意外问题。如果遇到任何问题,请访问 [DNF 系统升级文档][5],以获取有关故障排除的更多信息。 + +如果升级时遇到问题,并且系统上安装了第三方仓库,那么在升级时可能需要禁用这些仓库。对于 Fedora 不提供的仓库的支持,请联系仓库的提供者。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/ + +作者:[Ben Cotton][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/bcotton/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/f30-f31-816x345.jpg +[2]: https://fedoramagazine.org/announcing-fedora-31/ +[3]: https://fedoramagazine.org/taking-smart-backups-duplicity/ +[4]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png +[5]: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/#Resolving_post-upgrade_issues From 13604d718717bf74e329db032454b35ab80504e5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 5 Nov 2019 09:03:05 +0800 Subject: [PATCH 298/800] translating --- ...0191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md index 9151c9eb84..d340764151 100644 --- a/sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md +++ b/sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 57a756efbd01b163b8029ca9ee9b268b9cb99644 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 Nov 2019 09:07:56 +0800 Subject: [PATCH 299/800] TSL&PRF --- ...ow RPM packages are made- the spec file.md | 299 ------------------ ...ow RPM packages are made- the spec file.md | 289 +++++++++++++++++ 2 files changed, 289 insertions(+), 299 deletions(-) delete mode 100644 sources/tech/20190902 How RPM packages are made- the spec file.md create mode 100644 translated/tech/20190902 How RPM packages are made- the spec file.md diff --git a/sources/tech/20190902 How RPM packages are made- the spec file.md b/sources/tech/20190902 How RPM packages are made- the spec file.md deleted file mode 100644 index 01f9941aa3..0000000000 --- a/sources/tech/20190902 How RPM packages are made- the spec file.md +++ /dev/null @@ -1,299 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How RPM packages are made: the spec file) -[#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/) -[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) - -How RPM packages are made: the spec file -====== - -![][1] - -In the [previous article on RPM package building][2], you saw that source RPMS include the source code of the software, along with a “spec” file. This post digs into the spec file, which contains instructions on how to build the RPM. Again, this article uses _fpaste_ as an example. - -### Understanding the source code - -Before you can start writing a spec file, you need to have some idea of the software that you’re looking to package. Here, you’re looking at fpaste, a very simple piece of software. It is written in Python, and is a one file script. When a new version is released, it’s provided here on Pagure: - -The current version, as the archive shows, is 0.3.9.2. Download it so you can see what’s in the archive: - -``` -$ wget https://pagure.io/releases/fpaste/fpaste-0.3.9.2.tar.gz -$ tar -tvf fpaste-0.3.9.2.tar.gz -drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/ --rw-rw-r-- root/root 25 2018-07-25 02:58 fpaste-0.3.9.2/.gitignore --rw-rw-r-- root/root 3672 2018-07-25 02:58 fpaste-0.3.9.2/CHANGELOG --rw-rw-r-- root/root 35147 2018-07-25 02:58 fpaste-0.3.9.2/COPYING --rw-rw-r-- root/root 444 2018-07-25 02:58 fpaste-0.3.9.2/Makefile --rw-rw-r-- root/root 1656 2018-07-25 02:58 fpaste-0.3.9.2/README.rst --rw-rw-r-- root/root 658 2018-07-25 02:58 fpaste-0.3.9.2/TODO -drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/ -drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/ -drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/en/ --rw-rw-r-- root/root 3867 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/en/fpaste.1 --rwxrwxr-x root/root 24884 2018-07-25 02:58 fpaste-0.3.9.2/fpaste -lrwxrwxrwx root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/fpaste.py -> fpaste -``` - -The files you want to install are: - - * _fpaste.py_: which should go be installed to /usr/bin/. - * _docs/man/en/fpaste.1_: the manual, which should go to /usr/share/man/man1/. - * _COPYING_: the license text, which should go to /usr/share/license/fpaste/. - * _README.rst, TODO_: miscellaneous documentation that goes to /usr/share/doc/fpaste. - - - -Where these files are installed depends on the Filesystem Hierarchy Standard. To learn more about it, you can either read here: or look at the man page on your Fedora system: - -``` -$ man hier -``` - -#### Part 1: What are we building? - -Now that we know what files we have in the source, and where they are to go, let’s look at the spec file. You can see the full file here: - -Here is the first part of the spec file: - -``` -Name: fpaste -Version: 0.3.9.2 -Release: 3%{?dist} -Summary: A simple tool for pasting info onto sticky notes instances -BuildArch: noarch -License: GPLv3+ -URL: https://pagure.io/fpaste -Source0: https://pagure.io/releases/fpaste/fpaste-0.3.9.2.tar.gz - -Requires: python3 - -%description -It is often useful to be able to easily paste text to the Fedora -Pastebin at http://paste.fedoraproject.org and this simple script -will do that and return the resulting URL so that people may -examine the output. This can hopefully help folks who are for -some reason stuck without X, working remotely, or any other -reason they may be unable to paste something into the pastebin -``` - -_Name_, _Version_, and so on are called _tags_, and are defined in RPM. This means you can’t just make up tags. RPM won’t understand them if you do! The tags to keep an eye out for are: - - * _Source0_: tells RPM where the source archive for this software is located. - * _Requires_: lists run-time dependencies for the software. RPM can automatically detect quite a few of these, but in some cases they must be mentioned manually. A run-time dependency is a capability (often a package) that must be on the system for this package to function. This is how _[dnf][3]_ detects whether it needs to pull in other packages when you install this package. - * _BuildRequires_: lists the build-time dependencies for this software. These must generally be determined manually and added to the spec file. - * _BuildArch_: the computer architectures that this software is being built for. If this tag is left out, the software will be built for all supported architectures. The value _noarch_ means the software is architecture independent (like fpaste, which is written purely in Python). - - - -This section provides general information about fpaste: what it is, which version is being made into an RPM, its license, and so on. If you have fpaste installed, and look at its metadata, you can see this information included in the RPM: - -``` -$ sudo dnf install fpaste -$ rpm -qi fpaste -Name : fpaste -Version : 0.3.9.2 -Release : 2.fc30 -... -``` - -RPM adds a few extra tags automatically that represent things that it knows. - -At this point, we have the general information about the software that we’re building an RPM for. Next, we start telling RPM what to do. - -#### Part 2: Preparing for the build - -The next part of the spec is the preparation section, denoted by _%prep_: - -``` -%prep -%autosetup -``` - -For fpaste, the only command here is %autosetup. This simply extracts the tar archive into a new folder and keeps it ready for the next section where we build it. You can do more here, like apply patches, modify files for different purposes, and so on. If you did look at the contents of the source rpm for Python, you would have seen lots of patches there. These are all applied in this section. - -Typically anything in a spec file with the **%** prefix is a macro or label that RPM interprets in a special way. Often these will appear with curly braces, such as _%{example}_. - -#### Part 3: Building the software - -The next section is where the software is built, denoted by “%build”. Now, since fpaste is a simple, pure Python script, it doesn’t need to be built. So, here we get: - -``` -%build -#nothing required -``` - -Generally, though, you’d have build commands here, like: - -``` -configure; make -``` - -The build section is often the hardest section of the spec, because this is where the software is being built from source. This requires you to know what build system the tool is using, which could be one of many: Autotools, CMake, Meson, Setuptools (for Python) and so on. Each has its own commands and style. You need to know these well enough to get the software to build correctly. - -#### Part 4: Installing the files - -Once the software is built, it needs to be installed in the _%install_ section: - -``` -%install -mkdir -p %{buildroot}%{_bindir} -make install BINDIR=%{buildroot}%{_bindir} MANDIR=%{buildroot}%{_mandir} -``` - -RPM doesn’t tinker with your system files when building RPMs. It’s far too risky to add, remove, or modify files to a working installation. What if something breaks? So, instead RPM creates an artificial file system and works there. This is referred to as the _buildroot_. So, here in the buildroot, we create _/usr/bin_, represented by the macro _%{_bindir}_, and then install the files to it using the provided Makefile. - -At this point, we have a built version of fpaste installed in our artificial buildroot. - -#### Part 5: Listing all files to be included in the RPM - -The last section of the spec file is the files section, _%files_. This is where we tell RPM what files to include in the archive it creates from this spec file. The fpaste file section is quite simple: - -``` -%files -%{_bindir}/%{name} -%doc README.rst TODO -%{_mandir}/man1/%{name}.1.gz -%license COPYING -``` - -Notice how, here, we do not specify the buildroot. All of these paths are relative to it. The _%doc_ and _%license_ commands simply do a little more—they create the required folders and remember that these files must go there. - -RPM is quite smart. If you’ve installed files in the _%install_ section, but not listed them, it’ll tell you this, for example. - -#### Part 6: Document all changes in the change log - -Fedora is a community based project. Lots of contributors maintain and co-maintain packages. So it is imperative that there’s no confusion about what changes have been made to a package. To ensure this, the spec file contains the last section, the Changelog, _%changelog_: - -``` -%changelog -* Thu Jul 25 2019 Fedora Release Engineering < ...> - 0.3.9.2-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Thu Jan 31 2019 Fedora Release Engineering < ...> - 0.3.9.2-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Tue Jul 24 2018 Ankur Sinha - 0.3.9.2-1 -- Update to 0.3.9.2 - -* Fri Jul 13 2018 Fedora Release Engineering < ...> - 0.3.9.1-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Wed Feb 07 2018 Fedora Release Engineering < ..> - 0.3.9.1-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Sun Sep 10 2017 Vasiliy N. Glazov < ...> - 0.3.9.1-2 -- Cleanup spec - -* Fri Sep 08 2017 Ankur Sinha - 0.3.9.1-1 -- Update to latest release -- fixes rhbz 1489605 -... -.... -``` - -There must be a changelog entry for _every_ change to the spec file. As you see here, while I’ve updated the spec as the maintainer, others have too. Having the changes documented clearly helps everyone know what the current status of the spec is. For all packages installed on your system, you can use rpm to see their changelogs: - -``` -$ rpm -q --changelog fpaste -``` - -### Building the RPM - -Now we are ready to build the RPM. If you want to follow along and run the commands below, please ensure that you followed the steps [in the previous post][2] to set your system up for building RPMs. - -We place the fpaste spec file in _~/rpmbuild/SPECS_, the source code archive in _~/rpmbuild/SOURCES/_ and can now create the source RPM: - -``` -$ cd ~/rpmbuild/SPECS -$ wget https://src.fedoraproject.org/rpms/fpaste/raw/master/f/fpaste.spec - -$ cd ~/rpmbuild/SOURCES -$ wget https://pagure.io/fpaste/archive/0.3.9.2/fpaste-0.3.9.2.tar.gz - -$ cd ~/rpmbuild/SOURCES -$ rpmbuild -bs fpaste.spec -Wrote: /home/asinha/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm -``` - -Let’s have a look at the results: - -``` -$ ls ~/rpmbuild/SRPMS/fpaste* -/home/asinha/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm - -$ rpm -qpl ~/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm -fpaste-0.3.9.2.tar.gz -fpaste.spec -``` - -There we are — the source rpm has been built. Let’s build both the source and binary rpm together: - -``` -$ cd ~/rpmbuild/SPECS -$ rpmbuild -ba fpaste.spec -.. -.. -.. -``` - -RPM will show you the complete build output, with details on what it is doing in each section that we saw before. This “build log” is extremely important. When builds do not go as expected, we packagers spend lots of time going through them, tracing the complete build path to see what went wrong. - -That’s it really! Your ready-to-install RPMs are where they should be: - -``` -$ ls ~/rpmbuild/RPMS/noarch/ -fpaste-0.3.9.2-3.fc30.noarch.rpm -``` - -### Recap - -We’ve covered the basics of how RPMs are built from a spec file. This is by no means an exhaustive document. In fact, it isn’t documentation at all, really. It only tries to explain how things work under the hood. Here’s a short recap: - - * RPMs are of two types: _source_ and _binary_. - * Binary RPMs contain the files to be installed to use the software. - * Source RPMs contain the information needed to build the binary RPMs: the complete source code, and the instructions on how to build the RPM in the spec file. - * The spec file has various sections, each with its own purpose. - - - -Here, we’ve built RPMs locally, on our Fedora installations. While this is the basic process, the RPMs we get from repositories are built on dedicated servers with strict configurations and methods to ensure correctness and security. This Fedora packaging pipeline will be discussed in a future post. - -Would you like to get started with building packages, and help the Fedora community maintain the massive amount of software we provide? You can [start here by joining the package collection maintainers][4]. - -For any queries, post to the [Fedora developers mailing list][5]—we’re always happy to help! - -### References - -Here are some useful references to building RPMs: - - * - * - * - * - - - -* * * - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/ - -作者:[Ankur Sinha "FranciscoD"][a] -选题:[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/ankursinha/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg -[2]: https://fedoramagazine.org/how-rpm-packages-are-made-the-source-rpm/ -[3]: https://fedoramagazine.org/managing-packages-fedora-dnf/ -[4]: https://fedoraproject.org/wiki/Join_the_package_collection_maintainers -[5]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ diff --git a/translated/tech/20190902 How RPM packages are made- the spec file.md b/translated/tech/20190902 How RPM packages are made- the spec file.md new file mode 100644 index 0000000000..a9785d9dc9 --- /dev/null +++ b/translated/tech/20190902 How RPM packages are made- the spec file.md @@ -0,0 +1,289 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How RPM packages are made: the spec file) +[#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/) +[#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) + +如何编写 RPM 的 spec 文件 +====== + +![][1] + +在[关于 RPM 软件包构建的上一篇文章][2]中,你了解到了源 RPM 包括软件的源代码以及 spec 文件。这篇文章深入研究了 spec 文件,该文件中包含了有关如何构建 RPM 的指令。同样,本文以 `fpaste` 为例。 + +### 了解源代码 + +在开始编写 spec 文件之前,你需要对要打包的软件有所了解。在这里,你正在研究 `fpaste`,这是一个非常简单的软件。它是用 Python 编写的,并且是一个单文件脚本。当它发布新版本时,可在 Pagure 上找到:。 + +如该档案文件所示,当前版本为 0.3.9.2。下载它,以便你查看该档案文件中的内容: + +``` +$ wget https://pagure.io/releases/fpaste/fpaste-0.3.9.2.tar.gz +$ tar -tvf fpaste-0.3.9.2.tar.gz +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/ +-rw-rw-r-- root/root 25 2018-07-25 02:58 fpaste-0.3.9.2/.gitignore +-rw-rw-r-- root/root 3672 2018-07-25 02:58 fpaste-0.3.9.2/CHANGELOG +-rw-rw-r-- root/root 35147 2018-07-25 02:58 fpaste-0.3.9.2/COPYING +-rw-rw-r-- root/root 444 2018-07-25 02:58 fpaste-0.3.9.2/Makefile +-rw-rw-r-- root/root 1656 2018-07-25 02:58 fpaste-0.3.9.2/README.rst +-rw-rw-r-- root/root 658 2018-07-25 02:58 fpaste-0.3.9.2/TODO +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/ +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/ +drwxrwxr-x root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/en/ +-rw-rw-r-- root/root 3867 2018-07-25 02:58 fpaste-0.3.9.2/docs/man/en/fpaste.1 +-rwxrwxr-x root/root 24884 2018-07-25 02:58 fpaste-0.3.9.2/fpaste +lrwxrwxrwx root/root 0 2018-07-25 02:58 fpaste-0.3.9.2/fpaste.py -> fpaste +``` + +你要安装的文件是: + +* `fpaste.py`:应该安装到 `/usr/bin/`。 +* `docs/man/en/fpaste.1`:手册,应放到 `/usr/share/man/man1/`。 +* `COPYING`:许可证文本,应放到 `/usr/share/license/fpaste/`。 +* `README.rst`、`TODO`:放到 `/usr/share/doc/fpaste/` 下的其它文档。 + +这些文件的安装位置取决于文件系统层次结构标准(FHS)。要了解更多信息,可以在这里阅读: 或查看 Fedora 系统的手册页: + +``` +$ man hier +``` + +#### 第一部分:要构建什么? + +现在我们知道了源文件中有哪些文件,以及它们要存放的位置,让我们看一下 spec 文件。你可以在此处查看这个完整的文件:。 + +这是 spec 文件的第一部分: + +``` +Name: fpaste +Version: 0.3.9.2 +Release: 3%{?dist} +Summary: A simple tool for pasting info onto sticky notes instances +BuildArch: noarch +License: GPLv3+ +URL: https://pagure.io/fpaste +Source0: https://pagure.io/releases/fpaste/fpaste-0.3.9.2.tar.gz + +Requires: python3 + +%description +It is often useful to be able to easily paste text to the Fedora +Pastebin at http://paste.fedoraproject.org and this simple script +will do that and return the resulting URL so that people may +examine the output. This can hopefully help folks who are for +some reason stuck without X, working remotely, or any other +reason they may be unable to paste something into the pastebin +``` + +`Name`、`Version` 等称为*标签*,它们定义在 RPM 中。这意味着你不能只是随意写点标签,RPM 无法理解它们!需要注意的标签是: + +* `Source0`:告诉 RPM 该软件的源代码档案文件所在的位置。 +* `Requires`:列出软件的运行时依赖项。RPM 可以自动检测很多依赖项,但是在某些情况下,必须手动指明它们。运行时依赖项是系统上必须具有的功能(通常是软件包),才能使该软件包起作用。这是 [dnf][3] 在安装此软件包时检测是否需要拉取其他软件包的方式。 +* `BuildRequires`:列出了此软件的构建时依赖项。这些通常必须手动确定并添加到 spec 文件中。 +* `BuildArch`:此软件为该计算机体系结构所构建。如果省略此标签,则将为所有受支持的体系结构构建该软件。值 `noarch` 表示该软件与体系结构无关(例如 `fpaste`,它完全是用 Python 编写的)。 + +本节提供有关 `fpaste` 的常规信息:它是什么,正在将什么版本制作为 RPM,其许可证等等。如果你已安装 `fpaste`,并查看其元数据时,则可以看到该 RPM 中包含的以下信息: + +``` +$ sudo dnf install fpaste +$ rpm -qi fpaste +Name : fpaste +Version : 0.3.9.2 +Release : 2.fc30 +... +``` + +RPM 会自动添加一些其他标签,以代表它所知道的内容。 + +至此,我们掌握了要为其构建 RPM 的软件的一般信息。接下来,我们开始告诉 RPM 做什么。 + +#### 第二部分:准备构建 + +spec 文件的下一部分是准备部分,用 `%prep` 代表: + +``` +%prep +%autosetup +``` + +对于 `fpaste`,这里唯一的命令是 `%autosetup`。这只是将 tar 档案文件提取到一个新文件夹中,并为下一部分的构建阶段做好了准备。你可以在此处执行更多操作,例如应用补丁程序,出于不同目的修改文件等等。如果你查看过 Python 的源 RPM 的内容,那么你会在那里看到许多补丁。这些都将在本节中应用。 + +通常,spec 文件中带有 `%` 前缀的所有内容都是 RPM 以特殊方式解释的宏或标签。这些通常会带有大括号,例如 `%{example}`。 + +#### 第三部分:构建软件 + +下一部分是构建软件的位置,用 `%build` 表示。现在,由于 `fpaste` 是一个简单的纯 Python 脚本,因此无需构建。因此,这里是: + +``` +%build +#nothing required +``` + +不过,通常来说,你会在此处使用构建命令,例如: + +``` +configure; make +``` + +构建部分通常是 spec 文件中最难的部分,因为这是从源代码构建软件的地方。这要求你知道该工具使用的是哪个构建系统,该系统可能是许多构建系统之一:Autotools、CMake、Meson、Setuptools(用于 Python)等等。每个都有自己的命令和语法样式。你需要充分了解这些才能正确构建软件。 + +#### 第四部分:安装文件 + +软件构建后,需要在 `%install` 部分中安装它: + +``` +%install +mkdir -p %{buildroot}%{_bindir} +make install BINDIR=%{buildroot}%{_bindir} MANDIR=%{buildroot}%{_mandir} +``` + +在构建 RPM 时,RPM 不会修改你的系统文件。在一个可以正常运行的系统上添加、删除或修改文件的风险太大。如果发生故障怎么办?因此,RPM 会创建一个专门打造的文件系统并在其中工作。这称为 `buildroot`。 因此,在 `buildroot` 中,我们创建由宏 `%{_bindir}` 代表的 `/usr/bin` 目录,然后使用提供的 `Makefile` 将文件安装到其中。 + +至此,我们已经在专门打造的 `buildroot` 中安装了 `fpaste` 的构建版本。 + +#### 第五部分:列出所有要包括在 RPM 中的文件 + +spec 文件其后的一部分是文件部分:`%files`。在这里,我们告诉 RPM 从该 spec 文件创建的档案文件中包含哪些文件。`fpaste` 的文件部分非常简单: + +``` +%files +%{_bindir}/%{name} +%doc README.rst TODO +%{_mandir}/man1/%{name}.1.gz +%license COPYING +``` + +请注意,在这里,我们没有指定 `buildroot`。所有这些路径都是相对路径。`%doc` 和 `%license`命令做的稍微多一点,它们会创建所需的文件夹,并记住这些文件必须放在那里。 + +RPM 很聪明。例如,如果你在 `%install` 部分中安装了文件,但未列出它们,它会提醒你。 + +#### 第六部分:在变更日志中记录所有变更 + +Fedora 是一个基于社区的项目。许多贡献者维护或共同维护软件包。因此,当务之急是不要被软件包做了哪些更改所搞混。为了确保这一点,spec 文件包含的最后一部分是变更日志 `%changelog`: + +``` +%changelog +* Thu Jul 25 2019 Fedora Release Engineering < ...> - 0.3.9.2-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Thu Jan 31 2019 Fedora Release Engineering < ...> - 0.3.9.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild + +* Tue Jul 24 2018 Ankur Sinha - 0.3.9.2-1 +- Update to 0.3.9.2 + +* Fri Jul 13 2018 Fedora Release Engineering < ...> - 0.3.9.1-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild + +* Wed Feb 07 2018 Fedora Release Engineering < ..> - 0.3.9.1-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Sun Sep 10 2017 Vasiliy N. Glazov < ...> - 0.3.9.1-2 +- Cleanup spec + +* Fri Sep 08 2017 Ankur Sinha - 0.3.9.1-1 +- Update to latest release +- fixes rhbz 1489605 +... +.... +``` + +spec 文件的*每项*变更都必须有一个变更日志条目。如你在此处看到的,虽然我以维护者身份更新了该 spec 文件,但其他人也做过更改。清楚地记录变更内容有助于所有人知道该 spec 文件的当前状态。对于系统上安装的所有软件包,都可以使用 `rpm` 来查看其更改日志: + +``` +$ rpm -q --changelog fpaste +``` + +### 构建 RPM + +现在我们准备构建 RPM 包。如果要继续执行以下命令,请确保遵循[上一篇文章][2]中的步骤设置系统以构建 RPM。 + +我们将 `fpaste` 的 spec 文件放置在 `~/rpmbuild/SPECS` 中,将源代码档案文件存储在 `~/rpmbuild/SOURCES/` 中,现在可以创建源 RPM 了: + +``` +$ cd ~/rpmbuild/SPECS +$ wget https://src.fedoraproject.org/rpms/fpaste/raw/master/f/fpaste.spec + +$ cd ~/rpmbuild/SOURCES +$ wget https://pagure.io/fpaste/archive/0.3.9.2/fpaste-0.3.9.2.tar.gz + +$ cd ~/rpmbuild/SOURCES +$ rpmbuild -bs fpaste.spec +Wrote: /home/asinha/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm +``` + +让我们看一下结果: + +``` +$ ls ~/rpmbuild/SRPMS/fpaste* +/home/asinha/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm + +$ rpm -qpl ~/rpmbuild/SRPMS/fpaste-0.3.9.2-3.fc30.src.rpm +fpaste-0.3.9.2.tar.gz +fpaste.spec +``` + +我们看到源 RPM 已构建。让我们同时构建源 RPM 和二进制 RPM: + +``` +$ cd ~/rpmbuild/SPECS +$ rpmbuild -ba fpaste.spec +.. +.. +.. +``` + +RPM 将向你显示完整的构建输出,并在我们之前看到的每个部分中详细说明它的工作。此“构建日志”非常重要。当构建未按预期进行时,我们的打包人员将花费大量时间来遍历它们,以跟踪完整的构建路径来查看出了什么问题。 + +就是这样!准备安装的 RPM 应该位于以下位置: + +``` +$ ls ~/rpmbuild/RPMS/noarch/ +fpaste-0.3.9.2-3.fc30.noarch.rpm +``` + +### 概括 + +我们已经介绍了如何从 spec 文件构建 RPM 的基础知识。这绝不是一份详尽的文档。实际上,它根本不是文档。它只是试图解释幕后的运作方式。简短回顾一下: + +* RPM 有两种类型:源 RPM 和 二进制 RPM。 +* 二进制 RPM 包含要安装以使用该软件的文件。 +* 源 RPM 包含构建二进制 RPM 所需的信息:完整的源代码,以及 spec 文件中的有关如何构建 RPM 的说明。 +* spec 文件包含多个部分,每个部分都有其自己的用途。 +   +在这里,我们已经在安装好的 Fedora 系统中本地构建了 RPM。虽然这是个基本的过程,但我们从存储库中获得的 RPM 是建立在具有严格配置和方法的专用服务器上的,以确保正确性和安全性。这个 Fedora 打包流程将在以后的文章中讨论。 + +你想开始构建软件包,并帮助 Fedora 社区维护我们提供的大量软件吗?你可以[从这里开始加入软件包集合维护者][4]。 + +如有任何疑问,请发布到 [Fedora 开发人员邮件列表][5],我们随时乐意为你提供帮助! + +### 参考 + +这里有一些构建 RPM 的有用参考: + +* +* +* +* + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/ + +作者:[Ankur Sinha "FranciscoD"][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/ankursinha/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/06/rpm.png-816x345.jpg +[2]: https://linux.cn/article-11527-1.html +[3]: https://fedoramagazine.org/managing-packages-fedora-dnf/ +[4]: https://fedoraproject.org/wiki/Join_the_package_collection_maintainers +[5]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/ From 0fd25706f4c822b012c8362cdfdb9dfff41d0483 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Tue, 5 Nov 2019 09:16:58 +0800 Subject: [PATCH 300/800] =?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 20191021 How to program with Bash- Syntax and tools.md --- .../tech/20191021 How to program with Bash- Syntax and tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191021 How to program with Bash- Syntax and tools.md b/sources/tech/20191021 How to program with Bash- Syntax and tools.md index ae17b836d5..6d83ad53e3 100644 --- a/sources/tech/20191021 How to program with Bash- Syntax and tools.md +++ b/sources/tech/20191021 How to program with Bash- Syntax and tools.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (jdh8383) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From edee775772f5b44ffefb035d1f092e2d4a5286cf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 Nov 2019 09:23:22 +0800 Subject: [PATCH 301/800] PUB @wxy https://linux.cn/article-11538-1.html --- .../20190902 How RPM packages are made- the spec file.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190902 How RPM packages are made- the spec file.md (99%) diff --git a/translated/tech/20190902 How RPM packages are made- the spec file.md b/published/20190902 How RPM packages are made- the spec file.md similarity index 99% rename from translated/tech/20190902 How RPM packages are made- the spec file.md rename to published/20190902 How RPM packages are made- the spec file.md index a9785d9dc9..30542ef8de 100644 --- a/translated/tech/20190902 How RPM packages are made- the spec file.md +++ b/published/20190902 How RPM packages are made- the spec file.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11538-1.html) [#]: subject: (How RPM packages are made: the spec file) [#]: via: (https://fedoramagazine.org/how-rpm-packages-are-made-the-spec-file/) [#]: author: (Ankur Sinha "FranciscoD" https://fedoramagazine.org/author/ankursinha/) From fd48a74f20b3645892ca22fa699be590ad3bb810 Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Tue, 5 Nov 2019 09:52:01 +0800 Subject: [PATCH 302/800] translated --- ...Top Memory Consuming Processes in Linux.md | 54 +++++++++---------- 1 file changed, 27 insertions(+), 27 deletions(-) rename {sources => translated}/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md (75%) diff --git a/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md b/translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md similarity index 75% rename from sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md rename to translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md index fe5bafeb5c..bc2da3f7d0 100644 --- a/sources/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md +++ b/translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md @@ -7,34 +7,34 @@ [#]: via: (https://www.2daygeek.com/linux-find-top-memory-consuming-processes/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -How to Find Out Top Memory Consuming Processes in Linux +如何在 Linux 中找出内存消耗最高的进程 ====== -You may have seen your system consumes too much of memory many times. +你可能已经见过系统多次消耗过多的内存。 -If that’s the case, what would be the best thing you can do to identify processes that consume too much memory on a Linux machine. +如果是这种情况,那么最好的办法是识别出 Linux 机器上消耗过多内存的进程。 -I believe, you may have run one of the below commands to check it out. +我相信,你可能已经运行了以下命令以进行检查。 -If not, what is the other commands you tried? +如果没有,那你尝试过哪些其他的命令? -I would request you to update it in the comment section, it may help other users. +我请求你更新它在评论中进行更新,它可能会帮助其他用户。 -This can be easily identified using the **[top command][1]** and the **[ps command][2]**. +使用 **[top 命令][1]** 和 **[ps 命令][2]** 可以轻松的识别。 -I used to check both commands simultaneously, and both were given the same result. +我过去经常同时使用这两个命令,两个命令得到的结果是相同的。 -So i suggest you to use one of the command that you like. +所以我建议你从中选择一个喜欢的使用就可以。 -### 1) How to Find Top Memory Consuming Process in Linux Using the ps Command +### 1) 如何使用 ps 命令在 Linux 中查找内存消耗最大的进程 -The ps command is used to report a snapshot of the current processes. The ps command stands for process status. +ps 命令用于报告当前进程的快照。ps 命令代表进程状态。 -This is a standard Linux application that looks for information about running processes on a Linux system. +这是一个标准的 Linux 应用程序,用于查找有关在 Linux 系统上运行进程的信息。 -It is used to list the currently running processes and their process ID (PID), process owner name, process priority (PR), and the absolute path of the running command, etc,. +它用于列出当前正在运行的进程及其进程 ID(PID),进程所有者名称,进程优先级(PR)以及正在运行的命令的绝对路径等。 -The below ps command format provides you more information about top memory consumption process. +下面的 ps 命令格式为你提供有关内存消耗最大进程的更多信息。 ``` # ps aux --sort -rss | head @@ -51,7 +51,7 @@ root 1135 0.0 0.9 86708 37572 ? S 05:37 0:20 cwpsrv: worker root 1133 0.0 0.9 86708 37544 ? S 05:37 0:05 cwpsrv: worker process ``` -Use the below ps command format to include only specific information about the process of memory consumption in the output. +使用以下 ps 命令格式可在输出中仅展示有关内存消耗过程的特定信息。 ``` # ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%mem | head @@ -68,7 +68,7 @@ Use the below ps command format to include only specific information about the p 1135 3034 0.9 0.0 cwpsrv: worker process ``` -If you want to see only the command name instead of the absolute path of the command, use the ps command format below. +如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 ps 命令格式。 ``` # ps -eo pid,ppid,%mem,%cpu,comm --sort=-%mem | head @@ -85,15 +85,15 @@ If you want to see only the command name instead of the absolute path of the com 1133 3034 0.9 0.0 cwpsrv ``` -### 2) How to Find Out Top Memory Consuming Process in Linux Using the top Command +### 2) 如何使用 top 命令在 Linux 中查找内存消耗最大的进程 -The Linux top command is the best and most well known command that everyone uses to monitor Linux system performance. +Linux 的 top 命令是用来监视 Linux 系统性能的最好和最知名的命令。 -It displays a real-time view of the system process running on the interactive interface. +它在交互界面上显示运行的系统进程的实时视图。 -But if you want to find top memory consuming process then **[use the top command in the batch mode][3]**. +但是,如果要查找内存消耗最大的进程,请 **[在批处理模式下使用 top 命令][3]**。 -You should properly **[understand the top command output][4]** to fix the performance issue in system. +你应该正确地 **[了解 top 命令输出][4]** 以解决系统中的性能问题。 ``` # top -c -b -o +%MEM | head -n 20 | tail -15 @@ -114,7 +114,7 @@ You should properly **[understand the top command output][4]** to fix the perfor 968 nobody 20 0 1356216 30544 2348 S 0.0 0.8 0:19.95 /usr/local/apache/bin/httpd -k start ``` -If you only want to see the command name instead of the absolute path of the command, use the below top command format. +如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 top 命令格式。 ``` # top -b -o +%MEM | head -n 20 | tail -15 @@ -135,15 +135,15 @@ If you only want to see the command name instead of the absolute path of the com 968 nobody 20 0 1356216 30544 2348 S 0.0 0.8 0:19.95 httpd ``` -### 3) Bonus Tips: How to Find Out Top Memory Consuming Process in Linux Using the ps_mem Command +### 3) 温馨提示:如何使用 ps_mem 命令在 Linux 中查找内存消耗最大的进程 -The **[ps_mem utility][5]** is used to display the core memory used per program (not per process). +**[ps_mem 程序][5]** 用于显示每个程序(而不是每个进程)使用的核心内存。 -This utility allows you to check how much memory is used per program. +该程序允许你检查每个程序使用了多少内存。 -It calculates the amount of private and shared memory against a program and returns the total used memory in the most appropriate way. +它根据程序计算私有和共享内存的数量,并以最合适的方式返回已使用的总内存。 -It uses the following logic to calculate RAM usage. Total RAM = sum (private RAM for program processes) + sum (shared RAM for program processes) +它使用以下逻辑来计算内存使用量。 总内存使用量 = 用于程序处理的专用内存使用量 + 用于程序处理的共享内存使用量 ``` # ps_mem From aa14e04ca248be14487ab5d1e0a45c03ef70af4d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 Nov 2019 11:58:37 +0800 Subject: [PATCH 303/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @laingke 翻译的不错,用心了! --- ...u don-t have to be afraid of Kubernetes.md | 62 +++++++++---------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md b/translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md index 940b2279b2..3c12fa4bd4 100644 --- a/translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md +++ b/translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Why you don't have to be afraid of Kubernetes) @@ -9,78 +9,74 @@ 为什么你不必害怕 Kubernetes ====== -Kubernetes 绝对是满足复杂 web 应用程序需求的最简单,最容易的方法。 + +> Kubernetes 绝对是满足复杂 web 应用程序需求的最简单、最容易的方法。 + ![Digital creative of a browser on the internet][1] -在 90 年代末和 00 年代初,在大型网络媒体资源上工作很有趣。我的经历让我想起了 American Greetings Interactive,在情人节那天,我们拥有互联网上排名前 10 位之一的网站(以网络访问量衡量)。我们为 [AmericanGreetings.com][2],[BlueMountain.com][3] 等公司提供了电子贺卡,并为 MSN 和 AOL 等合作伙伴提供了电子贺卡。该组织的老员工仍然深切地记得与 Hallmark 等其它电子贺卡网站进行大战的史诗般的故事。 顺便说一句,我还为 Holly Hobbie,Care Bears 和 Strawberry Shortcake 经营大型网站。 +在 90 年代末和 2000 年代初,在大型网站工作很有趣。我的经历让我想起了 American Greetings Interactive,在情人节那天,我们拥有了互联网上排名前 10 位之一的网站(以网络访问量衡量)。我们为 [AmericanGreetings.com][2]、[BlueMountain.com][3] 等公司提供了电子贺卡,并为 MSN 和 AOL 等合作伙伴提供了电子贺卡。该组织的老员工仍然深切地记得与 Hallmark 等其它电子贺卡网站进行大战的史诗般的故事。顺便说一句,我还为 Holly Hobbie、Care Bears 和 Strawberry Shortcake 运营过大型网站。 -我记得就像那是昨天发生的一样,这是我们第一次遇到真正的问题。通常,我们的前门(路由器,防火墙和负载均衡器)有大约 200Mbps 的流量进入。但是,突然之间,Multi Router Traffic Grapher(MRTG)图示突然在几分钟内飙升至 2Gbps。我疯了似地东奔西跑。我了解了我们的整个技术堆栈,从路由器,交换机,防火墙和负载平衡器,到 Linux/Apache web 服务器,到我们的 Python 堆栈(FastCGI 的元版本),以及网络文件系统(NFS)服务器。我知道所有配置文件在哪里,我可以访问所有管理界面,并且我是一位经验丰富的,经验丰富的系统管理员,具有多年解决复杂问题的经验。 +我记得那就像是昨天发生的一样,这是我们第一次遇到真正的问题。通常,我们的前门(路由器、防火墙和负载均衡器)有大约 200Mbps 的流量进入。但是,突然之间,Multi Router Traffic Grapher(MRTG)图示突然在几分钟内飙升至 2Gbps。我疯了似地东奔西跑。我了解了我们的整个技术堆栈,从路由器、交换机、防火墙和负载平衡器,到 Linux/Apache web 服务器,到我们的 Python 堆栈(FastCGI 的元版本),以及网络文件系统(NFS)服务器。我知道所有配置文件在哪里,我可以访问所有管理界面,并且我是一位经验丰富的,打过硬仗的系统管理员,具有多年解决复杂问题的经验。 但是,我无法弄清楚发生了什么…… 当你在一千个 Linux 服务器上疯狂地键入命令时,五分钟的感觉就像是永恒。我知道站点可能会在任何时候崩溃,因为当它被划分成更小的集群时,压垮上千个节点的集群是那么的容易。 -我迅速 _跑到_ 老板的办公桌前,解释了情况。他几乎没有从电子邮件中抬头,这使我感到沮丧。他抬头看了看,笑了笑,说道:“是的,市场营销可能会开展广告活动。有时会发生这种情况。”他告诉我在应用程序中设置一个特殊标志,以减轻 Akamai 的访问量。 我跑回我的办公桌,在上千台 web 服务器上设置了标志,几分钟后,该站点恢复正常。灾难也就被避免了。 +我迅速*跑到*老板的办公桌前,解释了情况。他几乎没有从电子邮件中抬起头来,这使我感到沮丧。他抬头看了看,笑了笑,说道:“是的,市场营销可能会开展广告活动。有时会发生这种情况。”他告诉我在应用程序中设置一个特殊标志,以减轻 Akamai 的访问量。我跑回我的办公桌,在上千台 web 服务器上设置了标志,几分钟后,站点恢复正常。灾难也就被避免了。 我可以再分享 50 个类似的故事,但你脑海中可能会有一点好奇:“这种运维方式将走向何方?” 关键是,我们遇到了业务问题。当技术问题使你无法开展业务时,它们就变成了业务问题。换句话说,如果你的网站无法访问,你就不能处理客户交易。 -那么,所有这些与 Kubernetes 有什么关系?一切。世界已经改变。早在 90 年代末和 00 年代初,只有大型网站才出现大型网络规模级的问题。现在,有了微服务和数字化转型,每个企业都面临着一个大型的网络规模级的问题——可能是多个大型的网络规模级的问题。 +那么,所有这些与 Kubernetes 有什么关系?一切!世界已经改变。早在 90 年代末和 00 年代初,只有大型网站才出现大型的、规模级web-scale的问题。现在,有了微服务和数字化转型,每个企业都面临着一个大型的、规模级的问题——可能是多个大型的、规模级的问题。 -你的企业需要能够通过许多不同的人构建的许多不同的,通常是复杂的服务来管理复杂的网络规模的资产。你的网站需要动态地处理流量,并且它们必须是安全的。这些属性需要在所有层(从基础结构到应用程序层)上由 API 驱动。 +你的企业需要能够通过许多不同的人构建的许多不同的、通常是复杂的服务来管理复杂的规模级的网站。你的网站需要动态地处理流量,并且它们必须是安全的。这些属性需要在所有层(从基础结构到应用程序层)上由 API 驱动。 ### 进入 Kubernetes -Kubernetes 并不复杂;你的业务问题才是。当你想在生产环境中运行应用程序时,要满足性能(伸缩性,抖动等)和安全性要求,就需要最低程度的复杂性。诸如高可用性(HA),容量要求(N+1,N+2,N+100)以及保证最终一致性的数据技术等就会成为必需。这些是每家进行数字化转型的公司的生产要求,而不仅仅是 Google,Facebook 和 Twitter 这样的大型网站。 +Kubernetes 并不复杂;你的业务问题才复杂。当你想在生产环境中运行应用程序时,要满足性能(伸缩性、性能抖动等)和安全性要求,就需要最低程度的复杂性。诸如高可用性(HA)、容量要求(N+1、N+2、N+100)以及保证最终一致性的数据技术等就会成为必需。这些是每家进行数字化转型的公司的生产要求,而不仅仅是 Google、Facebook 和 Twitter 这样的大型网站。 -在旧时代,我还在 American Greetings 任职时,每次我们加入一个新的服务,它看起来像这样:所有这些都是由网络运营团队来处理的,没有一个是通过标签系统转移给其他团队来处理的。这是在 DevOps 出现之前的 DevOps: +在旧时代,我还在 American Greetings 任职时,每次我们加入一个新的服务,它看起来像这样:所有这些都是由网站运营团队来处理的,没有一个是通过订单系统转移给其他团队来处理的。这是在 DevOps 出现之前的 DevOps: - 1. 配置DNS(通常是内部服务层和面向外部的公众) + 1. 配置 DNS(通常是内部服务层和面向公众的外部) 2. 配置负载均衡器(通常是内部服务和面向公众的) - 3. 配置对文件的共享访问(大型 NFS 服务器,群集文件系统等) - 4. 配置集群软件(数据库,服务层等) + 3. 配置对文件的共享访问(大型 NFS 服务器、群集文件系统等) + 4. 配置集群软件(数据库、服务层等) 5. 配置 web 服务器群集(可以是 10 或 50 个服务器) - - 大多数配置是通过配置管理自动完成的,但是配置仍然很复杂,因为每个系统和服务都有不同的配置文件,而且格式完全不同。我们研究了像 [Augeas][4] 这样的工具来简化它,但是我们认为使用转换器来尝试和标准化一堆不同的配置文件是一种反模式。 -如今,借助Kubernetes,启动一项新服务本质上看起来如下: +如今,借助 Kubernetes,启动一项新服务本质上看起来如下: 1. 配置 Kubernetes YAML/JSON。 - 2. 提交给 Kubernetes API(```kubectl create -f service.yaml```)。 + 2. 提交给 Kubernetes API(`kubectl create -f service.yaml`)。 +Kubernetes 大大简化了服务的启动和管理。服务所有者(无论是系统管理员、开发人员还是架构师)都可以创建 Kubernetes 格式的 YAML/JSON 文件。使用 Kubernetes,每个系统和每个用户都说相同的语言。所有用户都可以在同一 Git 存储库中提交这些文件,从而启用 GitOps。 +而且,可以弃用和删除服务。从历史上看,删除 DNS 条目、负载平衡器条目和 Web 服务器的配置等是非常可怕的,因为你几乎肯定会破坏某些东西。使用 Kubernetes,所有内容都处于命名空间下,因此可以通过单个命令删除整个服务。尽管你仍然需要确保其它应用程序不使用它(微服务和函数即服务 [FaaS] 的缺点),但你可以更加确信:删除服务不会破坏基础架构环境。 -Kubernetes 大大简化了服务的启动和管理。服务所有者(无论是系统管理员,开发人员还是架构师)都可以创建 Kubernetes 格式的 YAML/JSON 文件。使用 Kubernetes,每个系统和每个用户都说相同的语言。所有用户都可以在同一 Git 存储库中提交这些文件,从而启用 GitOps。 +### 构建、管理和使用 Kubernetes -而且,可以弃用和删除服务。从历史上看,删除 DNS 条目,负载平衡器条目,web 服务器配置等是非常可怕的,因为你几乎肯定会破坏某些东西。使用 Kubernetes,所有内容都被命名为名称空间,因此可以通过单个命令删除整个服务。尽管你仍然需要确保其它应用程序不使用它(微服务和功能即服务(FaaS)的缺点),但你可以更加确信:删除服务不会破坏基础架构环境。 +太多的人专注于构建和管理 Kubernetes 而不是使用它(详见 [Kubernetes 是一辆翻斗车][5])。 -### 构建,管理和使用 Kubernetes +在单个节点上构建一个简单的 Kubernetes 环境并不比安装 LAMP 堆栈复杂得多,但是我们无休止地争论着构建与购买的问题。不是 Kubernetes 很难;它以高可用性大规模运行应用程序。建立一个复杂的、高可用性的 Kubernetes 集群很困难,因为要建立如此规模的任何集群都是很困难的。它需要规划和大量软件。建造一辆简单的翻斗车并不复杂,但是建造一辆可以运载 [10 吨垃圾并能以 200 迈的速度稳定行驶的卡车][6]则很复杂。 -太多的人专注于构建和管理 Kubernetes 而不是使用它(详见 [_Kubernetes 是一辆翻斗车_][5]). +管理 Kubernetes 可能很复杂,因为管理大型的、规模级的集群可能很复杂。有时,管理此基础架构很有意义;而有时不是。由于 Kubernetes 是一个社区驱动的开源项目,它使行业能够以多种不同方式对其进行管理。供应商可以出售托管版本,而用户可以根据需要自行决定对其进行管理。(但是你应该质疑是否确实需要。) -在单个节点上构建一个简单的 Kubernetes 环境并不比安装 LAMP 堆栈复杂得多,但是我们无休止地争论着构建与购买的问题。不是Kubernetes很难;它以高可用性大规模运行应用程序。建立一个复杂的,高可用性的 Kubernetes 集群很困难,因为要建立如此规模的任何集群都是很困难的。它需要规划和大量软件。建造一辆简单的翻斗车并不复杂,但是建造一辆可以运载 [10 吨灰尘并能以 200mph 的速度稳定行驶的卡车][6]则很复杂。 +使用 Kubernetes 是迄今为止运行大规模网站的最简单方法。Kubernetes 正在普及运行一组大型、复杂的 Web 服务的能力——就像当年 Linux 在 Web 1.0 中所做的那样。 -管理 Kubernetes 可能很复杂,因为管理大型网络规模的集群可能很复杂。有时,管理此基础架构很有意义;而有时不是。由于 Kubernetes 是一个社区驱动的开源项目,它使行业能够以多种不同方式对其进行管理。供应商可以出售托管版本,而用户可以根据需要自行决定对其进行管理。(但是你应该质疑是否确实需要。) - -使用 Kubernetes 是迄今为止运行大规模网络资源的最简单方法。Kubernetes 正在普及运行一组大型、复杂的 Web 服务的能力——就像当年 Linux 在 Web 1.0 中所做的那样。 - -由于时间和金钱是一个零和游戏,因此我建议将重点放在使用 Kubernetes 上。将你的时间和金钱花费在[掌握 Kubernetes 原语][7]或处理[活跃度和就绪性探针][8]的最佳方法上(另一个例子表明大型、复杂的服务很难)。不要专注于构建和管理 Kubernetes。(在构建和管理上)许多供应商可以为你提供帮助。 +由于时间和金钱是一个零和游戏,因此我建议将重点放在使用 Kubernetes 上。将你的时间和金钱花费在[掌握 Kubernetes 原语][7]或处理[活跃度和就绪性探针][8]的最佳方法上(表明大型、复杂的服务很难的另一个例子)。不要专注于构建和管理 Kubernetes。(在构建和管理上)许多供应商可以为你提供帮助。 ### 结论 -我记得对无数的问题进行了故障排除,比如我在这篇文章的开头所描述的问题——当时 Linux 内核中的 NFS,我们自产的 CFEngine,仅在某些 web 服务器上出现的重定向问题等)。开发人员无法帮助我解决所有这些问题。实际上,除非开发人员具备高级系统管理员的技能,否则他们甚至不可能进入系统并作为第二组眼睛提供帮助。没有带有图形或“可观察性”的控制台——可观察性在我和其他系统管理员的大脑中。如今,有了 Kubernetes,Prometheus,Grafana 等,一切都改变了。 +我记得对无数的问题进行了故障排除,比如我在这篇文章的开头所描述的问题——当时 Linux 内核中的 NFS、我们自产的 CFEngine、仅在某些 Web 服务器上出现的重定向问题等)。开发人员无法帮助我解决所有这些问题。实际上,除非开发人员具备高级系统管理员的技能,否则他们甚至不可能进入系统并作为第二双眼睛提供帮助。没有带有图形或“可观察性”的控制台——可观察性在我和其他系统管理员的大脑中。如今,有了 Kubernetes、Prometheus、Grafana 等,一切都改变了。 关键是: - 1. 时代不一样了。现在,所有 web 应用程序都是大型的分布式系统。就像 AmericanGreetings.com 过去一样复杂,现在每个网站都需要该站点的扩展性和 HA 要求。 - 2. 运行大型的分布式系统是很困难的。(维护)周期,这是业务需求,不是 Kubernetes 的。使用更简单的协调器并不是解决方案。 + 1. 时代不一样了。现在,所有 Web 应用程序都是大型的分布式系统。就像 AmericanGreetings.com 过去一样复杂,现在每个网站都有扩展性和 HA 的要求。 + 2. 运行大型的分布式系统是很困难的。绝对是。这是业务的需求,不是 Kubernetes 的问题。使用更简单的编排系统并不是解决方案。 - - -Kubernetes绝对是满足复杂Web应用程序需求的最简单,最简单的方法。这是我们生活的时代,而 Kubernetes 擅长于此。你可以讨论是否应该自己构建或管理 Kubernetes。有很多供应商可以帮助你构建和管理它,但是很难否认这是大规模运行复杂 web 应用程序的最简单方法。 +Kubernetes 绝对是满足复杂 Web 应用程序需求的最简单,最容易的方法。这是我们生活的时代,而 Kubernetes 擅长于此。你可以讨论是否应该自己构建或管理 Kubernetes。有很多供应商可以帮助你构建和管理它,但是很难否认这是大规模运行复杂 Web 应用程序的最简单方法。 -------------------------------------------------------------------------------- @@ -89,7 +85,7 @@ via: https://opensource.com/article/19/10/kubernetes-complex-business-problem 作者:[Scott McCarty][a] 选题:[lujun9972][b] 译者:[laingke](https://github.com/laingke) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 05c568a8925561c11f421e4311260c17f9fd3e8b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 Nov 2019 11:59:08 +0800 Subject: [PATCH 304/800] PUB @laingke https://linux.cn/article-11539-1.html --- .../20191031 Why you don-t have to be afraid of Kubernetes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20191031 Why you don-t have to be afraid of Kubernetes.md (99%) diff --git a/translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md b/published/20191031 Why you don-t have to be afraid of Kubernetes.md similarity index 99% rename from translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md rename to published/20191031 Why you don-t have to be afraid of Kubernetes.md index 3c12fa4bd4..1d2f7711ce 100644 --- a/translated/talk/20191031 Why you don-t have to be afraid of Kubernetes.md +++ b/published/20191031 Why you don-t have to be afraid of Kubernetes.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (laingke) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11539-1.html) [#]: subject: (Why you don't have to be afraid of Kubernetes) [#]: via: (https://opensource.com/article/19/10/kubernetes-complex-business-problem) [#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) From 8db7c024f5b8077f03fc407bf84af6183b22baf9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 Nov 2019 12:20:08 +0800 Subject: [PATCH 305/800] PRF @geekpi --- ...191029 Upgrading Fedora 30 to Fedora 31.md | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md b/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md index 9d0da9a1f6..de21cc7e11 100644 --- a/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md +++ b/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Upgrading Fedora 30 to Fedora 31) @@ -12,25 +12,25 @@ ![][1] -Fedora 31 [目前发布了][2]。你也许想要升级系统来获得 Fedora 中的最新功能。Fedora 工作站有图形化的升级方式。另外,Fedora 提供了一种命令行方式来将 Fedora 30 升级到 Fedora 31。 +Fedora 31 [日前发布了][2]。你也许想要升级系统来获得 Fedora 中的最新功能。Fedora 工作站有图形化的升级方式。另外,Fedora 提供了一种命令行方式来将 Fedora 30 升级到 Fedora 31。 ### 将 Fedora 30 工作站升级到 Fedora 31 -在发布不久之后,就会有通知告诉你有可用升级。你可以点击通知打开 **GNOME Software**。或者在 GNOME Shell 选择 Software。 +在该发布不久之后,就会有通知告诉你有可用升级。你可以点击通知打开 GNOME “软件”。或者在 GNOME Shell 选择“软件”。 -在 GNOME Software 中选择_更新_,你应该会看到告诉你有 Fedora 31 更新的提示。 +在 GNOME 软件中选择*更新*,你应该会看到告诉你有 Fedora 31 更新的提示。 如果你在屏幕上看不到任何内容,请尝试使用左上方的重新加载按钮。在发布后,所有系统可能需要一段时间才能看到可用的升级。 -选择_下载_以获取升级包。你可以继续工作,直到下载完成。然后使用 GNOME Software 重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再返回系统。 +选择*下载*以获取升级包。你可以继续工作,直到下载完成。然后使用 GNOME “软件”重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再返回系统。 ### 使用命令行 -如果你是从 Fedora 以前的版本升级的,那么你可能对 _dnf upgrade_ 插件很熟悉。这是推荐且支持的从 Fedora 30 升级到 Fedora 31 的方法。使用此插件能让你轻松地升级到 Fedora 31。 +如果你是从 Fedora 以前的版本升级的,那么你可能对 `dnf upgrade` 插件很熟悉。这是推荐且支持的从 Fedora 30 升级到 Fedora 31 的方法。使用此插件能让你轻松地升级到 Fedora 31。 -#### 1\. 更新软件并备份系统 +#### 1、更新软件并备份系统 -在开始升级之前,请确保你安装了 Fedora 30 的最新软件。如果你安装了模块化软件,这点尤为重要。dnf 和 GNOME Software 的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用 _GNOME Software_ 或在终端中输入以下命令。 +在开始升级之前,请确保你安装了 Fedora 30 的最新软件。如果你安装了模块化软件,这点尤为重要。`dnf` 和 GNOME “软件”的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用 GNOME “软件” 或在终端中输入以下命令: ``` sudo dnf upgrade --refresh @@ -38,7 +38,7 @@ sudo dnf upgrade --refresh 此外,在继续操作之前,请确保备份系统。有关备份的帮助,请参阅 Fedora Magazine 上的[备份系列][3]。 -#### 2\. 安装 DNF 插件 +#### 2、安装 DNF 插件 接下来,打开终端并输入以下命令安装插件: @@ -46,7 +46,7 @@ sudo dnf upgrade --refresh sudo dnf install dnf-plugin-system-upgrade ``` -#### 3\. 使用 DNF 开始更新 +#### 3、使用 DNF 开始更新 现在,你的系统是最新的,已经备份并且安装了 DNF 插件,你可以通过在终端中使用以下命令来开始升级: @@ -54,9 +54,9 @@ sudo dnf install dnf-plugin-system-upgrade sudo dnf system-upgrade download --releasever=31 ``` -该命令将开始在本地下载计算机的所有升级。如果由于缺乏更新包、损坏的依赖项或已淘汰的软件包而在升级时遇到问题,请在输入上面的命令时添加 _‐-allowerasing_ 标志。这将使 DNF 删除可能阻止系统升级的软件包。 +该命令将开始在本地下载计算机的所有升级。如果由于缺乏更新包、损坏的依赖项或已淘汰的软件包而在升级时遇到问题,请在输入上面的命令时添加 `‐-allowerasing` 标志。这将使 DNF 删除可能阻止系统升级的软件包。 -#### 4\. 重启并升级 +#### 4、重启并升级 上面的命令下载更新完成后,你的系统就可以重启了。要将系统引导至升级过程,请在终端中输入以下命令: @@ -64,7 +64,7 @@ sudo dnf system-upgrade download --releasever=31 sudo dnf system-upgrade reboot ``` -此后,你的系统将重启。在许多版本之前,_fedup_ 工具会在内核选择/引导页面上创建一个新选项。使用 _dnf-plugin-system-upgrade_ 软件包,你的系统将重新引导到当前 Fedora 30 使用的内核。这很正常。在内核选择页面之后不久,你的系统会开始升级过程。 +此后,你的系统将重启。在许多版本之前,`fedup` 工具会在内核选择/引导页面上创建一个新选项。使用 `dnf-plugin-system-upgrade` 软件包,你的系统将重新引导到当前 Fedora 30 使用的内核。这很正常。在内核选择页面之后不久,你的系统会开始升级过程。 现在也许可以喝杯咖啡休息下!升级完成后,系统将重启,你将能够登录到新升级的 Fedora 31 系统。 @@ -83,14 +83,14 @@ via: https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/ 作者:[Ben Cotton][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://fedoramagazine.org/author/bcotton/ [b]: https://github.com/lujun9972 [1]: https://fedoramagazine.org/wp-content/uploads/2019/10/f30-f31-816x345.jpg -[2]: https://fedoramagazine.org/announcing-fedora-31/ +[2]: https://linux.cn/article-11522-1.html [3]: https://fedoramagazine.org/taking-smart-backups-duplicity/ [4]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png [5]: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/#Resolving_post-upgrade_issues From 5c05ac6625d766d11410f8971406acbc69b972b3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 Nov 2019 12:20:40 +0800 Subject: [PATCH 306/800] PUB @geekpi https://linux.cn/article-11541-1.html --- .../20191029 Upgrading Fedora 30 to Fedora 31.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191029 Upgrading Fedora 30 to Fedora 31.md (98%) diff --git a/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md b/published/20191029 Upgrading Fedora 30 to Fedora 31.md similarity index 98% rename from translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md rename to published/20191029 Upgrading Fedora 30 to Fedora 31.md index de21cc7e11..b6b1d4793c 100644 --- a/translated/tech/20191029 Upgrading Fedora 30 to Fedora 31.md +++ b/published/20191029 Upgrading Fedora 30 to Fedora 31.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11541-1.html) [#]: subject: (Upgrading Fedora 30 to Fedora 31) [#]: via: (https://fedoramagazine.org/upgrading-fedora-30-to-fedora-31/) [#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) From cd37555cb09a2e487de58dbbfbf2ec9698e7a1db Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Tue, 5 Nov 2019 22:04:55 +0800 Subject: [PATCH 307/800] translated --- ...edora Linux System -Beginner-s Tutorial.md | 95 ------------------- ...edora Linux System -Beginner-s Tutorial.md | 95 +++++++++++++++++++ 2 files changed, 95 insertions(+), 95 deletions(-) delete mode 100644 sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md create mode 100644 translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md diff --git a/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md b/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md deleted file mode 100644 index 41ac02c6c5..0000000000 --- a/sources/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md +++ /dev/null @@ -1,95 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Update a Fedora Linux System [Beginner’s Tutorial]) -[#]: via: (https://itsfoss.com/update-fedora/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -How To Update a Fedora Linux System [Beginner’s Tutorial] -====== - -_**This quick tutorial shows various ways to update a Fedora Linux install.**_ - -So, the other day, I installed the [newly released Fedora 31][1]. I’ll be honest with you, it was my first time with a [non-Ubuntu distribution][2]. - -The first thing I did after installing Fedora was to try and install some software. I opened the software center and found that the software center was ‘broken’. I couldn’t install any application from it. - -I wasn’t sure what went wrong with my installation. Discussing within the team, Abhishek advised me to update the system first. I did that and poof! everything was back to normal. After updating the [Fedora][3] system, the software center worked as it should. - -Sometimes we just ignore the updates and keep troubleshooting the issue we face. No matter how big/small the issue is – to avoid them, you should keep your system up-to-date. - -In this article, I’ll show you various possible methods to update your Fedora Linux system. - - * [Update Fedora using software center][4] - * [Update Fedora using command line][5] - * [Update Fedora from system settings][6] - - - -Keep in mind that updating Fedora means installing the security patches, kernel updates and software updates. If you want to update from one version of Fedora to another, it is called version upgrade and you can [read about Fedora version upgrade procedure here][7]. - -### Updating Fedora From The Software Center - -![Software Center][8] - -You will most likely be notified that you have some system updates to look at, you should end up launching the software center when you click on that notification. - -All you have to do is – hit ‘Update’ and verify the root password to start updating. - -In case you did not get a notification for the available updates, you can simply launch the software center and head to the “Updates” tab. Now, you just need to proceed with the updates listed. - -### Updating Fedora Using The Terminal - -If you cannot load up the software center for some reason, you can always utilize the dnf package managing commands to easily update your system. - -Simply launch the terminal and type in the following command to start updating (you should be prompted to verify the root password): - -``` -sudo dnf upgrade -``` - -**dnf update vs dnf upgrade -** -You’ll find that there are two dnf commands available: dnf update and dnf upgrade. -Both command do the same job and that is to install all the updates provided by Fedora. -Then why there is dnf update and dnf upgrade and which one should you use? -Well, dnf update is basically an alias to dnf upgrade. While dnf update may still work, the good practice is to use dnf upgrade because that is the real command. - -### Updating Fedora From System Settings - -![][9] - -If nothing else works (or if you’re already in the System settings for a reason), navigate your way to the “Details” option at the bottom of your settings. - -This should show up the details of your OS and hardware along with a “Check for Updates” button as shown in the image above. You just need to click on it and provide the root/admin password to proceed to install the available updates. - -**Wrapping Up** - -As explained above, it is quite easy to update your Fedora installation. You’ve got three available methods to choose from – so you have nothing to worry about. - -If you notice any issue in following the instructions mentioned above, feel free to let me know in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/update-fedora/ - -作者:[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/fedora-31-release/ -[2]: https://itsfoss.com/non-ubuntu-beginner-linux/ -[3]: https://getfedora.org/ -[4]: tmp.Lqr0HBqAd9#software-center -[5]: tmp.Lqr0HBqAd9#command-line -[6]: tmp.Lqr0HBqAd9#system-settings -[7]: https://itsfoss.com/upgrade-fedora-version/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/software-center.png?ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/system-settings-fedora-1.png?ssl=1 diff --git a/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md b/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md new file mode 100644 index 0000000000..e6dd96aced --- /dev/null +++ b/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How To Update a Fedora Linux System [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/update-fedora/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何更新 Fedora Linux 系统[入门教程] +====== + +_**本快速教程介绍了更新 Fedora Linux 安装的多种方法。**_ + + +前几天,我安装了[新发布的 Fedora 31][1]。老实说,这是我第一次使用[非 Ubuntu 发行版][2]。 + +安装 Fedora 之后,我做的第一件事就是尝试安装一些软件。 我打开软件中心,发现该软件中心已“损坏”。 我无法从中安装任何应用程序。 + +我不确定我的安装出了什么问题。 在团队内部讨论时,Abhishek 建议我先更新系统。 我更新了, 更新后一切恢复正常。 更新[Fedora][3]系统后,软件中心也能正常工作了。 + +有时我们只是忽略了对系统的更新,而继续对我们所面临的问题进行故障排除。 不管问题有多大或多小,为了避免它们,你都应该保持系统更新。 + +在本文中,我将向你展示更新Fedora Linux系统的多种方法。 + + * [使用软件中心更新 Fedora][4] + * [使用命令行更新 Fedora][5] + * [从系统设置更新 Fedora][6] + + + +请记住,更新 Fedora 意味着安装安全补丁,更新内核和软件。 如果要从 Fedora 的一个版本更新到另一个版本,这称为版本升级,你可以[在此处阅读有关 Fedora 版本升级过程的信息][7]。 + +### 从软件中心更新 Fedora + +![软件中心][8] + +您很可能会收到通知,通知您有一些系统更新需要查看,您应该在单击该通知时启动软件中心。 + +您所要做的就是–点击“更新”,并验证 root 密码开始更新。 + +如果您没有收到更新的通知,则只需启动软件中心并转到“更新”选项卡即可。 现在,您只需要继续更新。 + +### 使用终端更新 Fedora + +如果由于某种原因无法加载软件中心,则可以使用dnf 软件包管理命令轻松地更新系统。 +只需启动终端并输入以下命令即可开始更新(系统将提示你确认root密码): + + +``` +sudo dnf upgrade +``` + +**dnf 更新 vs dnf 升级 +** +你会发现有两个可用的 dnf 命令:dnf 更新和 dnf 升级。 这两个命令执行相同的工作,即安装 Fedora 提供的所有更新。 那么,为什么要会有 dnf 更新和 dnf 升级,你应该使用哪一个呢? dnf 更新基本上是 dnf 升级的别名。 尽管 dnf 更新可能仍然有效,但最好使用 dnf 升级,因为这是真正的命令。 + +### 从系统设置中更新 Fedora + +![][9] + +如果其它方法都不行(或者由于某种原因已经进入系统设置),请导航至设置底部的“详细信息”选项。 + +如上图所示,改选项中显示操作系统和硬件的详细信息以及一个“检查更新”按钮,如上图中所示。 您只需要单击它并提供root / admin密码即可继续安装可用的更新。 + + +**总结** + +如上所述,更新Fedora安装非常容易。 有三种方法供你选择,因此无需担心。 + +如果你按上述说明操作时发现任何问题,请随时在下面的评论部分告诉我。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/update-fedora/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[Morisun029](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/fedora-31-release/ +[2]: https://itsfoss.com/non-ubuntu-beginner-linux/ +[3]: https://getfedora.org/ +[4]: tmp.Lqr0HBqAd9#software-center +[5]: tmp.Lqr0HBqAd9#command-line +[6]: tmp.Lqr0HBqAd9#system-settings +[7]: https://itsfoss.com/upgrade-fedora-version/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/software-center.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/system-settings-fedora-1.png?ssl=1 From 9e0638ed9ddc317b61ee78bc9964ebcdff09990e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 5 Nov 2019 22:39:07 +0800 Subject: [PATCH 308/800] APL --- .../20191025 Understanding system calls on Linux with strace.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191025 Understanding system calls on Linux with strace.md b/sources/tech/20191025 Understanding system calls on Linux with strace.md index 7628cfa545..443791a1f4 100644 --- a/sources/tech/20191025 Understanding system calls on Linux with strace.md +++ b/sources/tech/20191025 Understanding system calls on Linux with strace.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 035bfb74186d6b41c0a3c62f32ee0abee3291553 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:52:26 +0800 Subject: [PATCH 309/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191106=20Bash?= =?UTF-8?q?=20Script=20to=20Generate=20Patching=20Compliance=20Report=20on?= =?UTF-8?q?=20CentOS/RHEL=20Systems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md --- ...ompliance Report on CentOS-RHEL Systems.md | 221 ++++++++++++++++++ 1 file changed, 221 insertions(+) create mode 100644 sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md diff --git a/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md b/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md new file mode 100644 index 0000000000..ecab2ad704 --- /dev/null +++ b/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to Generate Patching Compliance Report on CentOS/RHEL Systems) +[#]: via: (https://www.2daygeek.com/bash-script-to-generate-patching-compliance-report-on-centos-rhel-systems/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to Generate Patching Compliance Report on CentOS/RHEL Systems +====== + +If you are running a large Linux environment you may have already integrated your Red Hat systems with the Satellite. + +If yes, there is a way to export this from the Satellite Server so you don’t have to worry about patching compliance reports. + +But if you are running a small Red Hat environment without satellite integration, or if it is CentOS systems, this script will help you to create a report. + +The patching compliance report is usually created monthly once or three months once, depending on the company’s needs. + +Add a cronjob based on your needs to automate this. + +This **[bash script][1]** is generally good to run with less than 50 systems, but there is no limit. + +Keeping the system up-to-date is an important task for Linux administrators, keeping your computer very stable and secure. + +The following articles may help you to learn more about installing security patches on Red Hat (RHEL) and CentOS systems. + + * **[How to check available security updates on Red Hat (RHEL) and CentOS system][2]** + * **[Four ways to install security updates on Red Hat (RHEL) & CentOS systems][3]** + * **[Two methods to check or list out installed security updates on Red Hat (RHEL) & CentOS system][4]** + + + +Four **[shell scripts][5]** are included in this tutorial and pick the suitable one for you. + +### Method-1: Bash Script to Generate Patching Compliance Report for Security Errata on CentOS/RHEL Systems + +This script allows you to create a security errata patch compliance report only. It sends the output via a mail in a plain text. + +``` +# vi /opt/scripts/small-scripts/sec-errata.sh + +#!/bin/sh +/tmp/sec-up.txt +SUBJECT="Patching Reports on "date"" +MESSAGE="/tmp/sec-up.txt" +TO="[email protected]" +echo "+---------------+-----------------------------+" >> $MESSAGE +echo "| Server_Name | Security Errata |" >> $MESSAGE +echo "+---------------+-----------------------------+" >> $MESSAGE +for server in `more /opt/scripts/server.txt` +do +sec=`ssh $server yum updateinfo summary | grep 'Security' | grep -v 'Important|Moderate' | tail -1 | awk '{print $1}'` +echo "$server $sec" >> $MESSAGE +done +echo "+---------------------------------------------+" >> $MESSAGE +mail -s "$SUBJECT" "$TO" < $MESSAGE +``` + +Run the script file once you have added the above script. + +``` +# sh /opt/scripts/small-scripts/sec-errata.sh +``` + +You get an output like the one below. + +``` +# cat /tmp/sec-up.txt + ++---------------+-------------------+ +| Server_Name | Security Errata | ++---------------+-------------------+ +server1 +server2 +server3 21 +server4 ++-----------------------------------+ +``` + +Add the following cronjob to get the patching compliance report once a month. + +``` +# crontab -e + +@monthly /bin/bash /opt/scripts/system-uptime-script-1.sh +``` + +### Method-1a: Bash Script to Generate Patching Compliance Report for Security Errata on CentOS/RHEL Systems + +This script allows you to generate a security errata patch compliance report. It sends the output through a mail with the CSV file. + +``` +# vi /opt/scripts/small-scripts/sec-errata-1.sh + +#!/bin/sh +echo "Server Name, Security Errata" > /tmp/sec-up.csv +for server in `more /opt/scripts/server.txt` +do +sec=`ssh $server yum updateinfo summary | grep 'Security' | grep -v 'Important|Moderate' | tail -1 | awk '{print $1}'` +echo "$server, $sec" >> /tmp/sec-up.csv +done +echo "Patching Report for `date +"%B %Y"`" | mailx -s "Patching Report on `date`" -a /tmp/sec-up.csv [email protected] +rm /tmp/sec-up.csv +``` + +Run the script file once you have added the above script. + +``` +# sh /opt/scripts/small-scripts/sec-errata-1.sh +``` + +You get an output like the one below. + +![][6] + +### Method-2: Bash Script to Generate Patching Compliance Report for Security Errata, Bugfix, and Enhancement on CentOS/RHEL Systems + +This script allows you to generate patching compliance reports for Security Errata, Bugfix, and Enhancement. It sends the output via a mail in a plain text. + +``` +# vi /opt/scripts/small-scripts/sec-errata-bugfix-enhancement.sh + +#!/bin/sh +/tmp/sec-up.txt +SUBJECT="Patching Reports on "`date`"" +MESSAGE="/tmp/sec-up.txt" +TO="[email protected]" +echo "+---------------+-------------------+--------+---------------------+" >> $MESSAGE +echo "| Server_Name | Security Errata | Bugfix | Enhancement |" >> $MESSAGE +echo "+---------------+-------------------+--------+---------------------+" >> $MESSAGE +for server in `more /opt/scripts/server.txt` +do +sec=`ssh $server yum updateinfo summary | grep 'Security' | grep -v 'Important|Moderate' | tail -1 | awk '{print $1}'` +bug=`ssh $server yum updateinfo summary | grep 'Bugfix' | tail -1 | awk '{print $1}'` +enhance=`ssh $server yum updateinfo summary | grep 'Enhancement' | tail -1 | awk '{print $1}'` +echo "$server $sec $bug $enhance" >> $MESSAGE +done +echo "+------------------------------------------------------------------+" >> $MESSAGE +mail -s "$SUBJECT" "$TO" < $MESSAGE +``` + +Run the script file once you have added the above script. + +``` +# sh /opt/scripts/small-scripts/sec-errata-bugfix-enhancement.sh +``` + +You get an output like the one below. + +``` +# cat /tmp/sec-up.txt + ++---------------+-------------------+--------+---------------------+ +| Server_Name | Security Errata | Bugfix | Enhancement | ++---------------+-------------------+--------+---------------------+ +server01 16 +server02 5 16 +server03 21 266 20 +server04 16 ++------------------------------------------------------------------+ +``` + +Add the following cronjob to get the patching compliance report once every three months. This script is scheduled to run on the 1’st of January, April, July and October months. + +``` +# crontab -e + +0 0 01 */3 * /bin/bash /opt/scripts/system-uptime-script-1.sh +``` + +### Method-2a: Bash Script to Generate Patching Compliance Report for Security Errata, Bugfix, and Enhancement on CentOS/RHEL Systems + +This script allows you to generate patching compliance reports for Security Errata, Bugfix, and Enhancement. It sends the output through a mail with the CSV file. + +``` +# vi /opt/scripts/small-scripts/sec-errata-bugfix-enhancement-1.sh + +#!/bin/sh +echo "Server Name, Security Errata,Bugfix,Enhancement" > /tmp/sec-up.csv +for server in `more /opt/scripts/server.txt` +do +sec=`ssh $server yum updateinfo summary | grep 'Security' | grep -v 'Important|Moderate' | tail -1 | awk '{print $1}'` +bug=`ssh $server yum updateinfo summary | grep 'Bugfix' | tail -1 | awk '{print $1}'` +enhance=`ssh $server yum updateinfo summary | grep 'Enhancement' | tail -1 | awk '{print $1}'` +echo "$server,$sec,$bug,$enhance" >> /tmp/sec-up.csv +done +echo "Patching Report for `date +"%B %Y"`" | mailx -s "Patching Report on `date`" -a /tmp/sec-up.csv [email protected] +rm /tmp/sec-up.csv +``` + +Run the script file once you have added the above script. + +``` +# sh /opt/scripts/small-scripts/sec-errata-bugfix-enhancement-1.sh +``` + +You get an output like the one below. + +![][6] + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-script-to-generate-patching-compliance-report-on-centos-rhel-systems/ + +作者:[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/category/bash-script/ +[2]: https://www.2daygeek.com/check-list-view-find-available-security-updates-on-redhat-rhel-centos-system/ +[3]: https://www.2daygeek.com/install-security-updates-on-redhat-rhel-centos-system/ +[4]: https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/ +[5]: https://www.2daygeek.com/category/shell-script/ +[6]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 From a1a52642d433ad1132da7698ec058e910bc94b7a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:52:53 +0800 Subject: [PATCH 310/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191104=20Clonin?= =?UTF-8?q?g=20a=20MAC=20address=20to=20bypass=20a=20captive=20portal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md --- ... MAC address to bypass a captive portal.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md diff --git a/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md b/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md new file mode 100644 index 0000000000..a52ca3d142 --- /dev/null +++ b/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cloning a MAC address to bypass a captive portal) +[#]: via: (https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal/) +[#]: author: (Esteban Wilson https://fedoramagazine.org/author/swilson/) + +Cloning a MAC address to bypass a captive portal +====== + +![][1] + +If you ever attach to a WiFi system outside your home or office, you often see a portal page. This page may ask you to accept terms of service or some other agreement to get access. But what happens when you can’t connect through this kind of portal? This article shows you how to use NetworkManager on Fedora to deal with some failure cases so you can still access the internet. + +### How captive portals work + +Captive portals are web pages offered when a new device is connected to a network. When the user first accesses the Internet, the portal captures all web page requests and redirects them to a single portal page. + +The page then asks the user to take some action, typically agreeing to a usage policy. Once the user agrees, they may authenticate to a RADIUS or other type of authentication system. In simple terms, the captive portal registers and authorizes a device based on the device’s MAC address and end user acceptance of terms. (The MAC address is [a hardware-based value][2] attached to any network interface, like a WiFi chip or card.) + +Sometimes a device doesn’t load the captive portal to authenticate and authorize the device to use the location’s WiFi access. Examples of this situation include mobile devices and gaming consoles (Switch, Playstation, etc.). They usually won’t launch a captive portal page when connecting to the Internet. You may see this situation when connecting to hotel or public WiFi access points. + +You can use NetworkManager on Fedora to resolve these issues, though. Fedora will let you temporarily clone the connecting device’s MAC address and authenticate to the captive portal on the device’s behalf. You’ll need the MAC address of the device you want to connect. Typically this is printed somewhere on the device and labeled. It’s a six-byte hexadecimal value, so it might look like _4A:1A:4C:B0:38:1F_. You can also usually find it through the device’s built-in menus. + +### Cloning with NetworkManager + +First, open _**nm-connection-editor**_, or open the WiFI settings via the Settings applet. You can then use NetworkManager to clone as follows: + + * For Ethernet – Select the connected Ethernet connection. Then select the _Ethernet_ tab. Note or copy the current MAC address. Enter the MAC address of the console or other device in the _Cloned MAC address_ field. + * For WiFi – Select the WiFi profile name. Then select the WiFi tab. Note or copy the current MAC address. Enter the MAC address of the console or other device in the _Cloned MAC address_ field. + + + +### **Bringing up the desired device** + +Once the Fedora system connects with the Ethernet or WiFi profile, the cloned MAC address is used to request an IP address, and the captive portal loads. Enter the credentials needed and/or select the user agreement. The MAC address will then get authorized. + +Now, disconnect the WiFi or Ethernet profile, and change the Fedora system’s MAC address back to its original value. Then boot up the console or other device. The device should now be able to access the Internet, because its network interface has been authorized via your Fedora system. + +This isn’t all that NetworkManager can do, though. For instance, check out this article on [randomizing your system’s hardware address][3] for better privacy. + +> [Randomize your MAC address using NetworkManager][3] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal/ + +作者:[Esteban Wilson][a] +选题:[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/swilson/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/clone-mac-nm-816x345.jpg +[2]: https://en.wikipedia.org/wiki/MAC_address +[3]: https://fedoramagazine.org/randomize-mac-address-nm/ From 03b09da977155de7b91907b0a2e0f59aea767210 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:55:17 +0800 Subject: [PATCH 311/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191104=20How=20?= =?UTF-8?q?to=20Add=20Windows=20and=20Linux=20host=20to=20Nagios=20Server?= =?UTF-8?q?=20for=20Monitoring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191104 How to Add Windows and Linux host to Nagios Server for Monitoring.md --- ...ux host to Nagios Server for Monitoring.md | 308 ++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 sources/tech/20191104 How to Add Windows and Linux host to Nagios Server for Monitoring.md diff --git a/sources/tech/20191104 How to Add Windows and Linux host to Nagios Server for Monitoring.md b/sources/tech/20191104 How to Add Windows and Linux host to Nagios Server for Monitoring.md new file mode 100644 index 0000000000..6f49e48f98 --- /dev/null +++ b/sources/tech/20191104 How to Add Windows and Linux host to Nagios Server for Monitoring.md @@ -0,0 +1,308 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Add Windows and Linux host to Nagios Server for Monitoring) +[#]: via: (https://www.linuxtechi.com/add-windows-linux-host-to-nagios-server/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to Add Windows and Linux host to Nagios Server for Monitoring +====== + +In the previous article, we demonstrated how to install [Nagios Core on CentOS 8 / RHEL 8][1] server. In this guide, we will dive deeper and add Linux and Windows hosts to the Nagios Core server for monitoring. + +![Add-Linux-Windows-Host-Nagios-Server][2] + +### Adding a Remote Windows Host to Nagios Server + +In this section, you will learn how to add a **Windows host** system to the **Nagios server**. For this to be possible, you need to install **NSClient++** agent on the Windows Host system. In this guide, we are going to install the NSClient++ on a Windows Server 2019 Datacenter edition. + +On the Windows host system,  head out to the download link as specified and download NSClient ++ agent. + +Once downloaded, double click on the downloaded installation file to launch the installation wizard. + +[![NSClient-installer-Windows][2]][3] + +On the first step on the installation procedure click ‘**Next**’ + +[![click-nex-to-install-NSClient][2]][4] + +In the next section, check off the ‘**I accept the terms in the license Agreement**’ checkbox and click ‘**Next**’ + +[![Accept-terms-conditions-NSClient][2]][5] + +Next, click on the ‘**Typical**’ option from the list of options and click ‘**Next**’ + +[![click-on-Typical-option-NSClient-Installation][2]][6] + +In the next step, leave the default settings as they are and click ‘**Next**’. + +[![Define-path-NSClient-Windows][2]][7] + +On the next page, specify your Nagios Server core’s IP address and tick off all the modules and click ‘**Next**’ as shown below. + +[![Specify-Nagios-Server-IP-address-NSClient-Windows][2]][8] + +Next, click on the ‘**Install**’ option to commence the installation process.[![Click-install-to-being-the-installation-NSClient][2]][9] + +The installation process will start and will take a couple of seconds to complete. On the last step. Click ‘**Finish**’ to complete the installation and exit the Wizard. + +[![Click-finish-NSClient-Windows][2]][10] + +To start the NSClient service, click on the **Start** menu and click on the ‘**Start NSClient ++**’ option. + +[![Click-start-NSClient-service-windows][2]][11] + +To confirm that indeed the service is running, press **Windows Key + R**, type services.msc and hit **ENTER**. Scroll and search for the **NSClient** service and ensure it’s running + +[![NSClient-running-windows][2]][12] + +At this point, we have successfully installed NSClient++ on Windows Server 2019 host and verified that it’s running. + +### Configure Nagios Server to monitor Windows host + +After the successful installation of the NSClient ++ on the Windows host PC, log in to the Nagios server Core system and configure it to monitor the Windows host system. + +Open the windows.cfg file using your favorite text editor + +``` +# vim /usr/local/nagios/etc/objects/windows.cfg +``` + +In the configuration file, ensure that the host_name attribute matches the hostname of your Windows client system. In our case, the hostname for the Windows server PC is windows-server. This hostname should apply for all the host_name attributes. + +For the address attribute, specify your Windows host IP address. , In our case, this was 10.128.0.52. + +![Specify-hostname-IP-Windows][2] + +After you are done, save the changes and exit the text editor. + +Next, open the Nagios configuration file. + +``` +# vim /usr/local/nagios/etc/nagios.cfg +``` + +Uncomment the line below and save the changes. + +cfg_file=/usr/local/nagios/etc/objects/windows.cfg + +![Uncomment-Windows-cfg-Nagios][2] + +Finally, to verify that Nagios configuration is free from any errors, run the command: + +``` +# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg +``` + +Output + +![Verify-configuration-for-errors-Nagios][2] + +As you can see from the output, there are no warnings or errors. + +Now browse your Nagios Server IP address, log in and click on Hosts. Your Windows hostname, in this case, windows-server will appear on the dashboard. + +![Windows-Host-added-Nagios][2] + +### Adding a remote Linux Host to Nagios Server + +Having added a Windows host to the Nagios server, let’s add a Linux host system. In our case, we are going to add a **Ubuntu 18.04 LTS** to the Nagios monitoring server. To monitor a Linux host, we need to install an agent on the remote Linux system called **NRPE**. NRPE is short for **Nagios Remote Plugin Executor**. This is the plugin that will allow you to monitor Linux host systems. It allows you to monitor resources such as Swap, memory usage, and CPU load to mention a few on remote Linux hosts. So the first step is to install NRPE on Ubuntu 18.04 LTS remote system. + +But first, update Ubuntu system + +``` +# sudo apt update +``` + +Next,  install Nagios NRPE by running the command as shown: + +``` +# sudo apt install nagios-nrpe-server nagios-plugins +``` + +![Install-nrpe-server-nagios-plugins][2] + +After the successful installation of  NRPE and Nagios plugins, configure NRPE by opening its configuration file in /etc/nagios/nrpe.cfg + +``` +# vim /etc/nagios/nrpe.cfg +``` + +Append the Linux host IP address to the **server_address** attribute. In this case, 10.128.0.53 is the IP address of the Ubuntu 18.04 LTS system. + +![Specify-server-address-Nagios][2] + +Next, add Nagios server IP address in the ‘allowed_hosts’ attribute, in this case, 10.128.0.50 + +![Allowed-hosts-Nagios][2] + +Save and exit the configuration file. + +Next, restart NRPE service and verify its status + +``` +# systemctl restart nagios-nrpe-server +# systemctl enable nagios-nrpe-server +# systemctl status nagios-nrpe-server +``` + +![Restart-nrpe-check-status][2] + +### Configure Nagios Server to monitor Linux host + +Having successfully installed NRPE and nagios plugins on the remote linux server, log in to Nagios Server and install EPEL (Extra packages for Enterprise Linux) package. + +``` +# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm +``` + +Next, install NRPE plugin on the server + +``` +# dnf install nagios-plugins-nrpe -y +``` + +After the installation of the NRPE plugin, open the Nagios configuration file “/usr/local/nagios/etc/nagios.cfg” + +``` +# vim /usr/local/nagios/etc/nagios.cfg +``` + +Next, uncomment the line below in the configuration file + +cfg_dir=/usr/local/nagios/etc/servers + +![uncomment-servers-line-Nagios-Server-CentOS8][2] + +Next, create a configuration directory + +``` +# mkdir /usr/local/nagios/etc/servers +``` + +Then create client configuration file + +``` +# vim /usr/local/nagios/etc/servers/ubuntu-host.cfg +``` + +Copy and paste the configuration below to the file. This configuration monitors swap space, system load, total processes, logged in users, and disk usage. + +``` +define host{ + use linux-server + host_name ubuntu-nagios-client + alias ubuntu-nagios-client + address 10.128.0.53 + +} + +define hostgroup{ + hostgroup_name linux-server + alias Linux Servers + members ubuntu-nagios-client +} + +define service{ + use local-service + host_name ubuntu-nagios-client + service_description SWAP Uasge + check_command check_nrpe!check_swap + +} + +define service{ + use local-service + host_name ubuntu-nagios-client + service_description Root / Partition + check_command check_nrpe!check_root + +} + +define service{ + use local-service + host_name ubuntu-nagios-client + service_description Current Users + check_command check_nrpe!check_users +} + +define service{ + use local-service + host_name ubuntu-nagios-client + service_description Total Processes + check_command check_nrpe!check_total_procs +} + +define service{ + use local-service + host_name ubuntu-nagios-client + service_description Current Load + check_command check_nrpe!check_load +} +``` + +Save and exit the configuration file. + +Next, verify that there are no errors in Nagios configuration + +``` +# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg +``` + +Now restart Nagios service and ensure that it is up and running. + +``` +# systemctl restart nagios +``` + +Remember to open port 5666 which is used by NRPE plugin on the firewall of the Nagios server. + +``` +# firewall-cmd --permanent --add-port=5666/tcp +# firewall-cmd --reload +``` + +![Allow-firewall-Nagios-server][2] + +Likewise, head out to your Linux host (Ubuntu 18.04 LTS) and allow the port on UFW firewall + +``` +# ufw allow 5666/tcp +# ufw reload +``` + +![Allow-NRPE-service][2] + +Finally, head out to the Nagios Server’s URL and click on ‘**Hosts**’. Your Ubuntu system will be displayed on the dashboard alongside the Windows host machine we added earlier on. + +![Linux-host-added-monitored-Nagios][2] + +And this wraps up our 2-part series on Nagios installation and adding remote hosts. Feel free to get back to us with your feedback. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/add-windows-linux-host-to-nagios-server/ + +作者:[James Kiarie][a] +选题:[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/james/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/NSClient-installer-Windows.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/click-nex-to-install-NSClient.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Accept-terms-conditions-NSClient.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/click-on-Typical-option-NSClient-Installation.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Define-path-NSClient-Windows.png +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Specify-Nagios-Server-IP-address-NSClient-Windows.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Click-install-to-being-the-installation-NSClient.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Click-finish-NSClient-Windows.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Click-start-NSClient-service-windows.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/11/NSClient-running-windows.jpg From 38af0ccb6961ec707e3e6a1d3d3a400e0bb2ebbe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:55:59 +0800 Subject: [PATCH 312/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191105=20My=20f?= =?UTF-8?q?irst=20contribution=20to=20open=20source:=20Making=20a=20decisi?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191105 My first contribution to open source- Making a decision.md --- ...ution to open source- Making a decision.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/tech/20191105 My first contribution to open source- Making a decision.md diff --git a/sources/tech/20191105 My first contribution to open source- Making a decision.md b/sources/tech/20191105 My first contribution to open source- Making a decision.md new file mode 100644 index 0000000000..0640ff1cf4 --- /dev/null +++ b/sources/tech/20191105 My first contribution to open source- Making a decision.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: 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) + +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." + +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 + +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. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions + +作者:[Galen Corey][a] +选题:[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/galenemco +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb) +[2]: https://opensource.com/article/19/10/my-first-open-source-contribution-mistakes +[3]: https://github.blog/2018-02-08-open-source-project-trends-for-2018/ +[4]: https://www.gatsbyjs.org/contributing/ From 9c47d98db699bce3549366fcdc9464db7d42b630 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:56:16 +0800 Subject: [PATCH 313/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191105=20System?= =?UTF-8?q?76=20introduces=20laptops=20with=20open=20source=20BIOS=20coreb?= =?UTF-8?q?oot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191105 System76 introduces laptops with open source BIOS coreboot.md --- ... laptops with open source BIOS coreboot.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/tech/20191105 System76 introduces laptops with open source BIOS coreboot.md diff --git a/sources/tech/20191105 System76 introduces laptops with open source BIOS coreboot.md b/sources/tech/20191105 System76 introduces laptops with open source BIOS coreboot.md new file mode 100644 index 0000000000..4d9c336304 --- /dev/null +++ b/sources/tech/20191105 System76 introduces laptops with open source BIOS coreboot.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (System76 introduces laptops with open source BIOS coreboot) +[#]: via: (https://opensource.com/article/19/11/coreboot-system76-laptops) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +System76 introduces laptops with open source BIOS coreboot +====== +The company answers open hardware fans by revealing two laptops powered +with open source firmware coreboot. +![Guy on a laptop on a building][1] + +In mid-October, [System76][2] made an exciting announcement for open source hardware fans: It would soon begin shipping two of its laptop models, [Galago Pro][3] and [Darter Pro][4], with the open source BIOS [coreboot][5]. + +The coreboot project [says][6] its open source firmware "is a replacement for your BIOS / UEFI with a strong focus on boot speed, security, and flexibility. It is designed to boot your operating system as fast as possible without any compromise to security, with no back doors, and without any cruft from the '80s." Coreboot was previously known as LinuxBIOS, and the engineers who work on coreboot have also contributed to the Linux kernel. + +Most firmware on computers sold today is proprietary, which means even if you are running an open source operating system, you have no access to your machine's BIOS. This is not so with coreboot. Its developers share the improvements they make, rather than keeping them secret from other vendors. Coreboot's source code can be inspected, learned from, and modified, just like any other open source code. + +[Joshua Woolery][7], marketing director at System76, says coreboot differs from a proprietary BIOS in several important ways. "Traditional firmware is closed source and impossible to review and inspect. It's bloated with unnecessary features and unnecessarily complex [ACPI][8] implementations that lead to PCs operating in unpredictable ways. System76 Open Firmware, on the other hand, is lightweight, fast, and cleanly written." This means your computer boots faster and is more secure, he says. + +I asked Joshua about the impact of coreboot on open hardware overall. "The combination of open hardware and open firmware empowers users beyond what's possible when one or the other is proprietary," he says. "Imagine an open hardware controller like [System76's] [Thelio Io][9] without open source firmware. One could read the schematic and write software to control it, but why? With open firmware, the user starts from functioning hardware and software and can expand from there. Open hardware and firmware enable the community to learn from, adapt, and expand on our work, thus moving technology forward as a whole rather than requiring individuals to constantly re-implement what's already been accomplished." + +Joshua says System76 is working to open source all aspects of the computer, and we will see coreboot on other System76 machines. The hardware and firmware in Thelio Io, the controller board in the company's Thelio desktops, are both open. Less than a year after System76 introduced Thelio, the company is now marketing two laptops with open firmware. + +If you would like to see System76's firmware contributions to the coreboot project, visit the code repository on [GitHub][10]. You can also see the schematics for any supported System76 model by sending an [email][11] with the subject line: _Schematics for <MODEL>_. (Bear in mind that the only currently supported models are darp6 and galp4.) Using the coreboot firmware on other devices is not supported and may render them inoperable, + +Coreboot is licensed under the GNU Public License. You can view the [documentation][12] on the project's website and find out how to [contribute][13] to the project on GitHub. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/coreboot-system76-laptops + +作者:[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_code_programming_laptop.jpg?itok=ormv35tV (Guy on a laptop on a building) +[2]: https://opensource.com/article/19/5/system76-secret-sauce +[3]: https://system76.com/laptops/galago +[4]: https://system76.com/laptops/darter +[5]: https://www.coreboot.org/ +[6]: https://www.coreboot.org/users.html +[7]: https://www.linkedin.com/in/joshuawoolery +[8]: https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface +[9]: https://opensource.com/article/18/11/system76-thelio-desktop-computer +[10]: https://github.com/system76/firmware-open +[11]: mailto:productdev@system76.com +[12]: https://doc.coreboot.org/index.html +[13]: https://github.com/coreboot/coreboot From 0856e566ca154b3757cc89ebd5f7f771e17d9ab7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:56:41 +0800 Subject: [PATCH 314/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191105=20Conque?= =?UTF-8?q?ring=20documentation=20challenges=20on=20a=20massive=20project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191105 Conquering documentation challenges on a massive project.md --- ...ntation challenges on a massive project.md | 155 ++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 sources/tech/20191105 Conquering documentation challenges on a massive project.md diff --git a/sources/tech/20191105 Conquering documentation challenges on a massive project.md b/sources/tech/20191105 Conquering documentation challenges on a massive project.md new file mode 100644 index 0000000000..79dab63e8a --- /dev/null +++ b/sources/tech/20191105 Conquering documentation challenges on a massive project.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Conquering documentation challenges on a massive project) +[#]: via: (https://opensource.com/article/19/11/documentation-challenges-tom-caswell-matplotlib) +[#]: author: (Gina Helfrich, Ph.D. https://opensource.com/users/ginahelfrich) + +Conquering documentation challenges on a massive project +====== +Learn more about documentation at scale in this interview with Tom +Caswell, Matplotlib lead developer. +![Files in a folder][1] + +Given the recent surge in popularity of open source data science projects like pandas, NumPy, and [Matplotlib][2], it’s probably no surprise that the increased level of interest is generating user complaints about documentation. To help shed light on what’s at stake, we talked to someone who knows a lot about the subject: [Thomas Caswell][3], the lead developer of Matplotlib. + +Matplotlib is a flexible and customizable tool for producing static and interactive data visualizations since 2001 and is a foundational project in the scientific Python stack. Matplotlib became a [NumFOCUS-sponsored project][4] in 2015. + +Tom has been working on Matplotlib for the past five years and got his start answering questions about the project on Stack Overflow. Answering questions became submitting bug reports, which became writing patches, which became maintaining the project, which ultimately led to him becoming the lead developer. + +**Fun fact:** Tom’s advancement through the open source community follows exactly the [path described by Brett Cannon][5], a core Python maintainer. + +NumFOCUS Communications Director, Gina Helfrich, sat down with Tom to discuss the challenges of managing documentation on a project as massive and as fundamental as Matplotlib. + +**Gina Helfrich:** Thanks so much for taking the time to talk with us about Matplotlib and open source documentation, Tom. To contextualize our conversation a bit, can you speak a little to your impression of the [back-and-forth][6] on Twitter with Wes McKinney about pandas and user complaints about the documentation? + +**Thomas Caswell:** I only kind of saw the edges, but I see both sides. On one hand, I think something Mike Pope said was, "if it’s not documented, it doesn’t exist." If you are writing open source tools, + +part of that work is documenting them, and doing so clearly in a way that users can discover and actually use, short of going to the source [code]. It’s not good enough to dump code on the internet—you have to do the whole thing. + +On the other hand, if you’re not paying [for the software], you don’t get to make demands. The attitude I think Wes was reacting to, which you see a lot, is: "You built this tool that is useful to me, therefore I expect enterprise-grade paid support because it’s obviously critical to what I’m doing." + +But I think the part Eric O. Lebigot was responding to is the first part. Part of building a tool is the documentation, not just the code. But Wes is responding to the entitlement, the expectation of free work, so I see both sides. + +**GH:** Looking at Matplotlib specifically, which is facing many of the same issues as pandas, I know you have some big challenges with your documentation. I get the impression that there’s this notion out there from new users that getting started with Matplotlib is super frustrating and the docs don’t really help. Can you tell me about the history there and how the project came to have this problem? + +**TC:** So, Matplotlib is a humongous library. I’ve been working on it for five years, and around once a month (or every other month), there’s a bug report where my first reaction is, "Wait… we do _what_?" + +A lot of the library is under-documented. This library survived at least two generations of partial conversion to standardized docstring formats. As I understand it (I wasn’t around at the time), we were one of the first projects outside of core Python to adopt Sphinx to build our docs—possibly a little too early. We have a lot of weird customizations since Sphinx didn’t have those features yet [at the time]. Other people have built better versions of those features since then, but because Matplotlib is so huge, migrating them is hard. + +I think if you build the PDF version of our docs, it’s around 3,000 pages, and I would say that the library has maybe half the documentation it really needs. + +We are woefully under-documented in the sense that not every feature has good docs. On the other hand, we are over-documented in that what we have is not well organized and there’s no clear entry point. If I want to find out how to do something, even I have a hard time finding where something is documented. And if _I_ [the lead developer] have issues finding that information, there’s no prayer of new users finding it. So in that sense, we are both drastically under-documented and drastically over-documented. + +**[Read next: [Syadmins: Poor documentation is not a job insurance strategy][7]]** + +**GH:** Given that Matplotlib is over 15 years old, do you have a sense of who has been writing the documentation? How does your documentation actually get developed? + +**TC:** Historically, much like the code, the documentation was organically developed. We’ve had a lot of investment in examples and docstrings, and a few entries labeled as tutorials that teach you one specific skill. For example, we’ve got prose on the "rough theory of colormaps," and how to make a colormap. + +A lot of Matplotlib’s documentation is examples, and the examples overlap. Over the past few years, when I see interesting examples go by on the mailing list or on Stack Overflow, I’ll say, "Can you put this example in the docs?" So, I guess I’ve been actively contributing to the problem that there’s too much stuff to wade through. + +Part of the issue is that people will do a six-hour tutorial and then some of those examples end up in the docs. Then, someone _else_ will do a six-hour tutorial (you can’t cover the whole library in six hours) and the basics are probably similar, but they may format the tutorial differently. + +**GH:** Wow, that sounds pretty challenging to inherit and try to maintain. What kinds of improvements have you been working on for the documentation? + +**TC:** There’s been an effort over the past couple of years to move to numpydoc format, away from the home-grown scheme we had previously. Also, [Nelle Varoquaux][8] recently did a tremendous amount of work and led the effort to move from how we were doing examples to using Sphinx-Gallery, which makes it much easier to put good prose into examples. This practice was picked up by [Chris Holdgraf][9] recently, as well. Sphinx-Gallery went live on our main docs with Matplotlib 2.1, which was a huge improvement for users. Nelle also organized a distributed [docathon][10]. + +We’ve been trying to get better about new features. When there’s a new feature, you must add an example to the docs for that feature, which helps make things discoverable. We’ve been trying to get better about making sure docstrings exist, are accurate, and that they document all of the parameters. + +**GH:** If you could wave a magic wand and have the Matplotlib docs that you want, what would they look like? + +**TC:** Well, as I mentioned, the docs grew organically, and that means we have no consistent voice across them. It also means there’s no single point of truth for various things. When you write an example, how far back down the basics do you go? So, it’s not clear what you need to know before you can understand the example. Either you explain just enough, all the way back (so we’ve got a random assortment of the basics smeared everywhere), or you have examples that, unless you’re already a heavy user, make no sense. + +So, to answer the question, having someone who can actually _write_ and has empathy for users go through and write a 200-page intro to Matplotlib book, and have that be the main entry to the docs. That’s my current vision of what I want. + +**GH:** If you were introducing a new user to Matplotlib today, what would you have her read? Where would you point her in the docs? + +**TC:** Well, there isn’t a good, clear option for, "You’ve been told you need to use Matplotlib. Go spend an afternoon and read this." I’m not sure where I’d point people to for that right now. [Nicolas Rougier][11] has written some [good][12] [stuff][13] on that front, such as a tutorial for beginners, and some of that has migrated into the docs. + +There’s a lot out there, but it’s not collated centrally, or linked from our docs as "START HERE." I should also add that I might not have the best view of this issue anymore because I haven’t actively gone looking for this information, so maybe I just never found it because I don’t need it. I don’t know that it exists. (This topic actually [came up recently][14] on the mailing list.) + +The place we do point people to is: Go look at the gallery and click on the thumbnail that looks closest to what you want to do. + +Ben Root presented an [Anatomy of Matplotlib tutorial][15] at SciPy several times. There’s a number of Matplotlib books that exist. It’s mixed whether the authors were contributors [to the project]. Ben Root recently wrote one about [interactive figures][16]. I’ve been approached and have turned this task down a couple of times, just because I don’t have time to write a book. So my thought for getting a technical writer was to get a technical writer to write the book, and instead of publishing the result as a book, put it in the online docs. + +**GH:** Is there anyone in the Matplotlib contributor community who specializes in the documentation part of things, or takes a lot of ownership around documentation? + +Nelle was doing this for Matplotlib for a bit but has stepped back. Chris Holdgraf is taking the lead on some doc-related things now. Nicholas Rougier has written a number of [extremely good tutorials][17] outside of the project's documentation. + +I mean, no one uses _just_ Matplotlib. You don’t use us but not use SciPy, NumPy, or pandas. You have to be using something else to do the actual work that you now need to visualize. There are many "clean" introductions to Matplotlib in other places. For example, both Jake VanderPlas’s [analysis book][18] and Katy Huff and Anthony Scopatz’s [book][19] have introductions to Matplotlib that cover this topic to the degree they felt was needed for their purposes. + +**GH:** I’d love to hear your thoughts on the role of Stack Overflow in all of this. + +**TC:** That actually is how I got into the project. My Stack Overflow number is large, and it’s almost all Matplotlib questions. And how I got started is that I answered questions. A lot of the questions on Stack Overflow are, "Please read the docs for me." Which, fine. But actually, a great way to learn the library is to answer questions on Stack Overflow, because people who have problems that you don’t personally have will ask, "How do I do this?" and now you have to go figure out how to do it. It’s kind of fun. + +But sometimes people ask questions and they’ve actually found a bug. And in determining that they’ve actually found a bug, I tried to figure out how to fix the bugs. So, I started some reports, which led to, "Here’s a pull request to fix the bug I found." And then when I started entering a lot of PRs, they were like, "You need to start reviewing them now," so they gave me commit rights and made me review things. And then they put me in charge. + +I do like Stack Overflow. I think that to a large extent, what it replaced is the mailing list. If I have any criticism of Stack Overflow, I think it’s convincing people who are answering questions to upstream more of the results. + +There are some good examples on Stack Overflow. Here’s a complex one: You have to touch these seven different functions, each of which are relatively well documented, but you have to put them together in just the right way. Some of those answers should probably go in the gallery with our annotations about how they work. Basically, if you go through Joe Kington’s top 50 answers, they should probably all go in the docs. + +In other cases, the question is asked because the docstring is not clear. We need to convince people who are answering those questions to use those moments as a survey of where our documentation is not clear, instead of just answering [on Stack Overflow], and then move those answers back [to the docs]. + +**GH:** What’s it like managing PRs for documentation as opposed to patches and bug fixes? + +**TC:** We’ve tried to streamline how we do documentation PRs. Writing documentation PRs is the most painful thing ever in open source because you get copyediting via pull request. You get picky proofreading and copyediting via GitHub comments. Like, "there’s a missing comma," or "two spaces!" And again, I keep using myself as a weird outlier benchmark, _I_ get disheartened when I write doc pull requests and then I get 50 comments regarding picky little things. + +What I’ve started trying to push as the threshold on docs is, "Did [the change] make it worse?" If it didn’t make it worse, merge the change. Frequently, it takes more time to leave a GitHub comment than to fix the problem. + +> "If you can use Matplotlib, you are qualified to contribute to it." +>      — Tom Caswell, Matplotlib lead developer + +**GH:** What’s one action you’d like members of the community who are reading this interview to take? What is one way they could make a difference on this issue? + +**TC:** One thing I’d like to see more of—and I acknowledge that how to contribute to open source is a big hurdle to get over—I’ve said previously that if you can use Matplotlib, you are qualified to contribute to it. That’s a message I would like to get out more broadly. + +If you’re a user and you read the docstring to something and it doesn’t make sense, and then you play around a bit and you understand that function well enough to use it—you could then start clarifying docstrings. + +Because one of the things I have the hardest time with is that I personally am bad at putting myself in other people’s shoes when writing docs. I don’t know from a user’s point of view—and this sounds obnoxious but I’m deep enough in the code—what they know coming into the library as a new person. I don’t know the right things to tell them in the docstring that will actually help them. I can try to guess and I’ll probably write too much, or the wrong things. Or worse, I’ll write a bunch of stuff that refers to things they don’t know about, and now I’ve just made the function more confusing. + +Whereas a user who has just encountered this function for the first time, and sorted out how to make it do what they need it to do for their purposes, is in the right mindset to write what they wish the docs had said that would have saved them an hour. + +**GH:** That’s a great message, I think. Thanks for talking with me, Tom! + +**TC:** You’re welcome. Thank you. + +_This article was originally published on the [NumFOCUS blog][20] in 2017 and is just as relevant today. It’s republished with permission by the original interviewer and has been lightly edited for style, length, and clarity. If you want to support NumFOCUS in person, attend one of the local [PyData events][21] happening around the world. Learn more about NumFOCUS on our website: [numfocus.org][22]_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/documentation-challenges-tom-caswell-matplotlib + +作者:[Gina Helfrich, Ph.D.][a] +选题:[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/ginahelfrich +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://matplotlib.org +[3]: https://twitter.com/tacaswell +[4]: https://numfocus.org/sponsored-projects +[5]: https://snarky.ca/why-i-took-october-off-from-oss-volunteering/ +[6]: https://twitter.com/wesmckinn/status/909772652532953088 +[7]: https://www.redhat.com/sysadmin/poor-documentation +[8]: https://twitter.com/nvaroqua +[9]: https://twitter.com/choldgraf +[10]: https://www.numfocus.org/blog/numfocus-projects-participate-in-docathon-2017/ +[11]: https://twitter.com/NPRougier +[12]: https://github.com/rougier/matplotlib-tutorial +[13]: http://www.labri.fr/perso/nrougier/teaching/matplotlib/matplotlib.html +[14]: https://mail.python.org/pipermail/matplotlib-users/2017-September/001031.html +[15]: https://github.com/matplotlib/AnatomyOfMatplotlib +[16]: https://www.amazon.com/Interactive-Applications-using-Matplotlib-Benjamin/dp/1783988843 +[17]: http://www.labri.fr/perso/nrougier/teaching/ +[18]: http://shop.oreilly.com/product/0636920034919.do +[19]: http://shop.oreilly.com/product/0636920033424.do +[20]: https://numfocus.org/blog/matplotlib-lead-developer-explains-why-he-cant-fix-the-docs-but-you-can +[21]: https://pydata.org/ +[22]: https://numfocus.org From 026f86853ac676514cfa8e9a46675fe6aa745cf3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:57:21 +0800 Subject: [PATCH 315/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191105=20Open?= =?UTF-8?q?=20by=20nature:=20What=20building=20a=20platform=20for=20activi?= =?UTF-8?q?sts=20taught=20me=20about=20playful=20development?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191105 Open by nature- What building a platform for activists taught me about playful development.md --- ...sts taught me about playful development.md | 100 ++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 sources/tech/20191105 Open by nature- What building a platform for activists taught me about playful development.md diff --git a/sources/tech/20191105 Open by nature- What building a platform for activists taught me about playful development.md b/sources/tech/20191105 Open by nature- What building a platform for activists taught me about playful development.md new file mode 100644 index 0000000000..2f594f2abe --- /dev/null +++ b/sources/tech/20191105 Open by nature- What building a platform for activists taught me about playful development.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open by nature: What building a platform for activists taught me about playful development) +[#]: via: (https://opensource.com/open-organization/19/11/open-by-nature) +[#]: author: (Laura Hilliger https://opensource.com/users/laurahilliger) + +Open by nature: What building a platform for activists taught me about playful development +====== +Building a global platform for environmental activists revealed a spirit +of openness that's central to human nature—and taught me how to design +for it. +![The Open Organization at Greenpeace][1] + +"Open" isn't just a way we can build software. It's an attitude we can adopt toward anything we do. + +And when we adopt it, we can move mountains. + +Participating in a design sprint with colleagues at Greenpeace reminded me of that. As I explained in the first [two][2] [parts][3] of this [series][4], learning to think, plan, and work the open way is helping us build something truly great—a new, global platform for engaging activists who want to take action on behalf of our planet. + +The sprint experience (part of a collaboration with Red Hat) reinforced several lessons about openness I've learned throughout my career as an advocate for open source, an architect of change, and a community organizer. + +It also taught me a few new ones. + +### An open nature + +The design sprint experience reminded me just how central "openness" is to human nature. We all cook, sew, construct, write, play music, tinker, paint, tell stories—engage in the world through the creation of thousands of artifacts that allow others to understand our outlooks and worldviews. We express ourselves through our creations. We always have. + +We express ourselves through our creations. We always have. + +And throughout all of our expressive making, we reflect on and _share_ what we've created. We ask for feedback: _"Do you like my new recipe?" "What do you think of my painting?"_ + +We learn. Through trial and error (and ever-important failure), we learn what to do and what _not_ to do. Learning to make something work involves discovery and wonder in a spiral of [intrinsic motivation][5]; each new understanding unlocks new questions. We improve our skills as we create, and when we share. + +I noticed something critically important while our teams were collaborating: learning to work openly can liberate a certain playfulness that often gets ignored (or buried) in many organizations today—and that playfulness can help us solve complex problems. When we're having fun learning, creating, and sharing, we're often in a flow, truly interested in our work, creating environments that others want to join. Openness can be a fount of innovation. + +While our mission is a serious one, the more joy we find in it, the more people we'll attract to it. Discovery is a delightful process, and agency is empowering. The design sprint allowed us to finish with something that spurred reflection of our project—and do so with both humor and passion. The sprint left a lot of room for play, connection between participants, collaboration to solve problems, and decision-making. + +### Positively open + +Watching Red Hatters and Greenpeacers interact—many just having met one another for the first time—also crystallized for me some important impressions of open leadership. + +Open leadership took many forms throughout the sprint. The Red Hat team showed open leadership when they adapted the agenda on the first day. Greenpeace was further ahead than other groups they'd planned for, so their plan wouldn't work. Greenpeacers were transparent about certain internal politics (because it's no use planning something that's impossible to build). + +Open leaders are beacons of positivity. They assume best intentions in others. They truly listen. They live open principles. They build people up. + +People left their baggage at the door. We showed up, all of us, and were present together. + +Open leaders are beacons of positivity. They assume best intentions in others. They truly listen. They live open principles. They build people up. They remember to move as a collective, to ask for the insight of the collective, to thank the collective. + +And in the spirit of positive, open leadership, I want to offer my own thanks. + +Thanks to the Planet 4 team, a small group of people who kept pushing forward, despite the difficulties of a global project like this—a group that fought, made mistakes, and kept going despite them. They continue to pull together, and behind the scenes they're trying to be more open as they inspire the entire organization on an open journey with them (and build a piece of software at the same time!). + +Thanks to the others at Greenpeace who have supported this work and those who have participated in it. Thanks to the leaders in other departments, who saw the potential of this work and helped us socialize it. + +Thanks, too, to [the open organization community at Opensource.com][6] and [long-time colleagues][7] who modeled the behaviours and lent their open spirit to helping the Planet 4 team get started. + +### Open returns + +If openness is a way of being, then central to that way of being is [a spirit of reciprocity and exchange][8]. + +We belong to our communities and thus we contribute to them. We strive to be transparent so that our communities can grow and welcome new collaborators. When we infuse positivity into the world and into our projects, we create an atmosphere that invites innovation. + +Our success in open source means working to nurture those ecosystems of passionate contributors. Our success as a species demands the same kind of care for our natural ecosystems, too. + +Both Red Hat and Greenpeace understand the importance of ecosystems—and that shared understanding powered our collaboration on Planet 4. + +As an open source software company, Red Hat both benefits from and contributes to open source software communities across the world—communities forming a technological ecosystem of passionate contributors that must always be in delicate balance. Greenpeace is also focused on the importance of maintaining ecosystems—the natural ecosystems of which we are all, irrevocably, a part. Our success in open source means working to nurture those ecosystems of passionate contributors. Our success as a species demands the same kind of care for our natural ecosystems, too, and Planet 4 is a platform that helps everyone do exactly that. For both organizations, innovation is _social_ innovation; what we create _with_ others ultimately _benefits_ others, enhancing their lives. + +_Listen to Alexandra Machado of Red Hat explain social innovation._ + +So, really, the end of this story is just the beginning of so many others that will spawn from Planet 4. + +Yours can begin immediately. [Join the Planet 4 project][9] and advocate for a greener, more peaceful future—the open way. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/11/open-by-nature + +作者:[Laura Hilliger][a] +选题:[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/laurahilliger +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/images/open-org/open-org-greenpeace-article-3-blog-thumbnail-500x283.png?itok=aK5TOqSS +[2]: https://opensource.com/open-organization/19/10/open-platform-greenpeace +[3]: https://opensource.com/open-organization/19/10/collaboration-breakthrough-greenpeace +[4]: https://opensource.com/tags/open-organization-greenpeace +[5]: http://en.wikipedia.org/wiki/Motivation#Intrinsic_and_extrinsic_motivation +[6]: https://opensource.com/open-organization/resources/meet-ambassadors +[7]: https://medium.com/planet4/how-to-prepare-for-planet-4-user-interviews-a3a8cd627fe +[8]: https://opensource.com/open-organization/19/9/peanuts-community-reciprocity +[9]: https://planet4.greenpeace.org/create/contribute/ From 2552c50f8c63a78e8a41493331d6a320e88fdb28 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:57:57 +0800 Subject: [PATCH 316/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191104=20Hyperv?= =?UTF-8?q?isor=20comeback,=20Linus=20says=20no=20and=20reads=20email,=20a?= =?UTF-8?q?nd=20more=20industry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md --- ...d reads email, and more industry trends.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md diff --git a/sources/tech/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md b/sources/tech/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md new file mode 100644 index 0000000000..b8a6aafc80 --- /dev/null +++ b/sources/tech/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Hypervisor comeback, Linus says no and reads email, and more industry trends) +[#]: via: (https://opensource.com/article/19/11/hypervisor-stable-kernel-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Hypervisor comeback, Linus says no and reads email, and more industry trends +====== +A weekly look at open source community and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [Containers in 2019: They're calling it a [hypervisor] comeback][2] + +> So what does all this mean as we continue with rapid adoption and hyper-ecosystem growth around Kubernetes and containers? Let’s try and break that down into a few key areas and see what all the excitement is about. + +**The impact**: I'm pretty sure that the title of the article is an LL Cool J reference, which I wholeheartedly approve of. Even more important though is a robust unpacking of developments in the hypervisor space over the last year and how they square up against the trend towards cloud-native and container-based development. + +## [Linux kernel is getting more reliable, says Linus Torvalds. Plus: What do you need to do to be him?][3] + +> "In the end my job is to say no. Somebody has to be able to say no, because other developers know that if they do something bad I will say no. They hopefully in turn are more careful. But in order to be able to say no, I have to know the background, because otherwise I can't do my job. I spend all my time basically reading email about what people are working on. + +**The impact**: The rehabilitation of Linus as a much chiller guy continues; this one has some good advice for people leading distributed teams. + +## [Automated infrastructure in the on-premise datacenter—OpenShift 4.2 on OpenStack 15 (Stein)][4] + +> Up until now IPI (Installer Provision Infrastructure) has only supported public clouds: AWS, Azure, and Google. Now with OpenShift 4.2 it is supporting OpenStack. For the first time we can bring IPI into the on-premise datacenter where it is IMHO most needed. This single feature has the potential to revolutionize on-premise environments and bring them into the cloud-age with a single click and that promise is truly something to get excited about! + +**The impact**: So much tech press has started with the assumption that every company should run their infrastructure like a hyperscaler. The technology is catching up to make the user experience of that feasible. + +## [Kubernetes autoscaling 101: Cluster autoscaler, horizontal autoscaler, and vertical pod autoscaler][5] + +> I’m providing in this post a high-level overview of different scalability mechanisms inside Kubernetes and best ways to make them serve your needs. Remember, to truly master Kubernetes, you need to master different ways to manage the scale of cluster resources, that’s [the core of promise of Kubernetes][6]. +> +> _Configuring Kubernetes clusters to balance resources and performance can be challenging, and requires expert knowledge of the inner workings of Kubernetes. Just because your app or services’ workload isn’t constant, it rather fluctuates throughout the day if not the hour. Think of it as a journey and ongoing process._ + +**The impact**: You can tell whether someone knows what they're talking about if they can represent it in a simple diagram. Thanks to the excellent diagrams in this post, I know more day 2 concerns of Kubernetes operators than I ever wanted to. + +## [GitHub: All open source developers anywhere are welcome][7] + +> Eighty percent of all open-source contributions today, come from outside of the US. The top two markets for open source development outside of the US are China and India. These markets, although we have millions of developers in them, are continuing to grow faster than any others at about 30% year-over-year average. + +**The impact**: One of my open source friends likes to muse on the changing culture within the open source community. He posits that the old guard gatekeepers are already becoming irrelevant. I don't know if I completely agree, but I think you can look at the exponentially increasing contributions from places that haven't been on the open source map before and safely speculate that the open source culture of tomorrow will be radically different than that of today. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/hypervisor-stable-kernel-and-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.infoq.com/articles/containers-hypervisors-2019/ +[3]: https://www.theregister.co.uk/2019/10/30/linux_kernel_is_getting_more_reliable_says_linus_torvalds/ +[4]: https://keithtenzer.com/2019/10/29/automated-infrastructure-in-the-on-premise-datacenter-openshift-4-2-on-openstack-15-stein/ +[5]: https://www.cncf.io/blog/2019/10/29/kubernetes-autoscaling-101-cluster-autoscaler-horizontal-autoscaler-and-vertical-pod-autoscaler/ +[6]: https://speakerdeck.com/thockin/everything-you-ever-wanted-to-know-about-resource-scheduling-dot-dot-dot-almost +[7]: https://www.zdnet.com/article/github-all-open-source-developers-anywhere-are-welcome/#ftag=RSSbaffb68 From a34c9ad31e26ab1653849f9d76e3c6ba2f4e6e70 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:58:32 +0800 Subject: [PATCH 317/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191104=20My=20f?= =?UTF-8?q?irst=20contribution=20to=20open=20source:=20Impostor=20Syndrome?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191104 My first contribution to open source- Impostor Syndrome.md --- ...ution to open source- Impostor Syndrome.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 sources/tech/20191104 My first contribution to open source- Impostor Syndrome.md diff --git a/sources/tech/20191104 My first contribution to open source- Impostor Syndrome.md b/sources/tech/20191104 My first contribution to open source- Impostor Syndrome.md new file mode 100644 index 0000000000..645684e77f --- /dev/null +++ b/sources/tech/20191104 My first contribution to open source- Impostor Syndrome.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My first contribution to open source: Impostor Syndrome) +[#]: via: (https://opensource.com/article/19/11/my-first-open-source-contribution-impostor-syndrome) +[#]: author: (Galen Corey https://opensource.com/users/galenemco) + +My first contribution to open source: Impostor Syndrome +====== +A new open source contributor documents a series of five mistakes she +made starting out in open source. +![Dandelion held out over water][1] + +The story of my first mistake goes back to the beginning of my learn-to-code journey. I taught myself the basics through online resources. I was working through tutorials and projects, making progress but also looking for the next way to level up. Pretty quickly, I came across a blog post that told me the best way for beginners _just like me_ to take their coding skills to the next level was to contribute to open source. + +> "Anyone can do this," insisted the post, "and it is a crucial part of participating in the larger developer community." + +My internal impostor (who, for the purpose of this post, is the personification of my imposter syndrome) latched onto this idea. "Look, Galen," she said. "The only way to be a real developer is to contribute to open source." "Alrighty," I replied, and started following the instructions in the blog post to make a [GitHub][2] account. It took me under ten minutes to get so thoroughly confused that I gave up on the idea entirely. It wasn’t that I was unwilling to learn, but the resources that I was depending on expected me to have quite a bit of preexisting knowledge about [Git][3], GitHub, and how these tools allowed multiple developers to collaborate on a single project. + +"Maybe I’m not ready for this yet," I thought, and went back to my tutorials. "But the blog post said that anyone can do it, even beginners," my internal impostor nagged. Thus began a multi-year internal battle between the idea that contributing to open source was easy and valuable and I should be doing it, and the impression I was not yet _ready_ to write code for open source projects. + +Even once I became comfortable with Git, my internal impostor was always eager to remind me of why I was not yet ready to contribute to open source. When I was in coding Bootcamp, she whispered: "Sure, you know Git and you write code, but you’ve never written ‘real’ code before, only fake Bootcamp code. You’re not qualified to contribute to real projects that people use and depend on." When I was working my first year at work as a Software Engineer, she chided, "Okay maybe the code you write is 'real,' but you only work with one codebase! What makes you think you can write high-quality code somewhere else with different conventions, frameworks, or even languages?" + +It took me about a year and a half of fulltime work to finally feel confident enough to shut down my internal impostor’s arguments and go for my first pull request (PR). The irony here is that my internal imposter was the one talking me both into and out of contributing to open source. + +### Harmful myths + +There are two harmful myths here that I want to debunk. + +#### Myth 1: Contributing to open source is "easy" + +Throughout this journey, I frequently ran across the message that contributing to open source was supposed to be easy. This made me question my own skills when I found myself unable to "easily" get started. + +I understand why people might say that contributing to open source is easy, but I suspect what they actually mean is "it’s an attainable goal," "it’s accessible to beginners if they put in the work," or "it is possible to contribute to open source without writing a ton of really complex code." + +All of these things are true, but it is equally important to note that contributing to open source is difficult. It requires you to take the time to understand a new codebase _and_ understand the tools that developers use. + +I definitely don’t want to discourage beginners from trying. It is just important to remember that running into challenges is an expected part of the process. + +#### Myth 2: All "real" or "good" developers contribute to open source + +My internal impostor was continually reminding me that my lack of open source contributions was a blight on my developer career. In fact, even as I write this post, I feel guilty that I have not contributed more to open source. But while working on open source is a great way to learn and participate in the broader community of developers, it is not the only way to do this. You can also blog, attend meetups, work on side projects, read, mentor, or go home at the end of a long day at work and have a lovely relaxing evening. Contributing to open source is a challenge that can be fun and rewarding if it is the challenge you choose. + +Julia Evans wrote a blog post called [Don’t feel guilty about not contributing to open source][4], which is a healthy reminder that there are many productive ways to use your time as a developer. I highly recommend bookmarking it for any time you feel that guilt creeping in. + +### Mistake number one + +Mistake number one was letting my internal impostor guide me. I let her talk me out of contributing to open source for years by telling me I was not ready. Instead, I just did not understand the amount of work I would need to put in to get to the level where I felt confident in my ability to write code for an unfamiliar project (I am still working toward this). I also let her talk me into it, with the idea that I had to contribute to open source to prove my worth as a developer. The end result was still my first merged pull request in a widely used project, but the insecurity made my entire experience less enjoyable. + +### Don't let Git get you down + +If you want to learn more about Git, or if you are a beginner and Git is a blocker toward making your first open-source contribution, don’t panic. Git is very complicated, and you are not expected to know what it is already. Once you get the hang of it, you will find that Git is a handy tool that lets many different developers work on the same project at the same time, and then merge their individual changes together. + +There are many resources to help you learn about Git and Github (a site that hosts code so that people can collaborate on it with Git). Here are some suggestions on where to start: [_Hello World_ intro to GitHub][5] and _[Resources to learn Git][6]_. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/my-first-open-source-contribution-impostor-syndrome + +作者:[Galen Corey][a] +选题:[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/galenemco +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dandelion_blue_water_hand.jpg?itok=QggW8Wnw (Dandelion held out over water) +[2]: https://github.com +[3]: https://git-scm.com +[4]: https://jvns.ca/blog/2014/04/26/i-dont-feel-guilty-about-not-contributing-to-open-source/ +[5]: https://guides.github.com/activities/hello-world/ +[6]: https://try.github.io/ From a040ad18fb7137154f10504adaef891c93ebeeec Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 00:58:51 +0800 Subject: [PATCH 318/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191104=20Fields?= =?UTF-8?q?,=20records,=20and=20variables=20in=20awk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191104 Fields, records, and variables in awk.md --- ...4 Fields, records, and variables in awk.md | 252 ++++++++++++++++++ 1 file changed, 252 insertions(+) create mode 100644 sources/tech/20191104 Fields, records, and variables in awk.md diff --git a/sources/tech/20191104 Fields, records, and variables in awk.md b/sources/tech/20191104 Fields, records, and variables in awk.md new file mode 100644 index 0000000000..53d2bb7c55 --- /dev/null +++ b/sources/tech/20191104 Fields, records, and variables in awk.md @@ -0,0 +1,252 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fields, records, and variables in awk) +[#]: via: (https://opensource.com/article/19/11/fields-records-variables-awk) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Fields, records, and variables in awk +====== +In the second article in this intro to awk series, learn about fields, +records, and some powerful awk variables. +![Man at laptop on a mountain][1] + +Awk comes in several varieties: There is the original **awk**, written in 1977 at AT&T Bell Laboratories, and several reimplementations, such as **mawk**, **nawk**, and the one that ships with most Linux distributions, GNU awk, or **gawk**. On most Linux distributions, awk and gawk are synonyms referring to GNU awk, and typing either invokes the same awk command. See the [GNU awk user's guide][2] for the full history of awk and gawk. + +The [first article][3] in this series showed that awk is invoked on the command line with this syntax: + + +``` +`$ awk [options] 'pattern {action}' inputfile` +``` + +Awk is the command, and it can take options (such as **-F** to define the field separator). The action you want awk to perform is contained in single quotes, at least when it's issued in a terminal. To further emphasize which part of the awk command is the action you want it to take, you can precede your program with the **-e** option (but it's not required): + + +``` +$ awk -F, -e '{print $2;}' colours.txt +yellow +blue +green +[...] +``` + +### Records and fields + +Awk views its input data as a series of _records_, which are usually newline-delimited lines. In other words, awk generally sees each line in a text file as a new record. Each record contains a series of _fields_. A field is a component of a record delimited by a _field separator_. + +By default, awk sees whitespace, such as spaces, tabs, and newlines, as indicators of a new field. Specifically, awk treats multiple _space_ separators as one, so this line contains two fields: + + +``` +`raspberry red` +``` + +As does this one: + + +``` +`tuxedo                  black` +``` + +Other separators are not treated this way. Assuming that the field separator is a comma, the following example record contains three fields, with one probably being zero characters long (assuming a non-printable character isn't hiding in that field): + + +``` +`a,,b` +``` + +### The awk program + +The _program_ part of an awk command consists of a series of rules. Normally, each rule begins on a new line in the program (although this is not mandatory). Each rule consists of a pattern and one or more actions: + + +``` +`pattern { action }` +``` + +In a rule, you can define a pattern as a condition to control whether the action will run on a record. Patterns can be simple comparisons, regular expressions, combinations of the two, and more. + +For instance, this will print a record _only_ if it contains the word "raspberry": + + +``` +$ awk '/raspberry/ { print $0 }' colours.txt +raspberry red 99 +``` + +If there is no qualifying pattern, the action is applied to every record. + +Also, a rule can consist of only a pattern, in which case the entire record is written as if the action was **{ print }**. + +Awk programs are essentially _data-driven_ in that actions depend on the data, so they are quite a bit different from programs in many other programming languages. + +### The NF variable + +Each field has a variable as a designation, but there are special variables for fields and records, too. The variable **NF** stores the number of fields awk finds in the current record. This can be printed or used in tests. Here is an example using the [text file][3] from the previous article: + + +``` +$ awk '{ print $0 " (" NF ")" }' colours.txt +name       color  amount (3) +apple      red    4 (3) +banana     yellow 6 (3) +[...] +``` + +Awk's **print** function takes a series of arguments (which may be variables or strings) and concatenates them together. This is why, at the end of each line in this example, awk prints the number of fields as an integer enclosed by parentheses. + +### The NR variable + +In addition to counting the fields in each record, awk also counts input records. The record number is held in the variable **NR**, and it can be used in the same way as any other variable. For example, to print the record number before each line: + + +``` +$ awk '{ print NR ": " $0 }' colours.txt +1: name       color  amount +2: apple      red    4 +3: banana     yellow 6 +4: raspberry  red    3 +5: grape      purple 10 +[...] +``` + +Note that it's acceptable to write this command with no spaces other than the one after **print**, although it's more difficult for a human to parse: + + +``` +`$ awk '{print NR": "$0}' colours.txt` +``` + +### The printf() function + +For greater flexibility in how the output is formatted, you can use the awk **printf()** function. This is similar to **printf** in C, Lua, Bash, and other languages. It takes a _format_ argument followed by a comma-separated list of items. The argument list may be enclosed in parentheses. + + +``` +`$ printf format, item1, item2, ...` +``` + +The format argument (or _format string_) defines how each of the other arguments will be output. It uses _format specifiers_ to do this, including **%s** to output a string and **%d** to output a decimal number. The following **printf** statement outputs the record followed by the number of fields in parentheses: + + +``` +$ awk 'printf "%s (%d)\n",$0,NF}' colours.txt +name       color  amount (3) +raspberry  red    4 (3) +banana     yellow 6 (3) +[...] +``` + +In this example, **%s (%d)** provides the structure for each line, while **$0,NF** defines the data to be inserted into the **%s** and **%d** positions. Note that, unlike with the **print** function, no newline is generated without explicit instructions. The escape sequence **\n** does this. + +### Awk scripting + +All of the awk code in this article has been written and executed in an interactive Bash prompt. For more complex programs, it's often easier to place your commands into a file or _script_. The option **-f FILE** (not to be confused with **-F**, which denotes the field separator) may be used to invoke a file containing a program. + +For example, here is a simple awk script. Create a file called **example1.awk** with this content: + + +``` +/^a/ {print "A: " $0} +/^b/ {print "B: " $0} +``` + +It's conventional to give such files the extension **.awk** to make it clear that they hold an awk program. This naming is not mandatory, but it gives file managers and editors (and you) a useful clue about what the file is. + +Run the script: + + +``` +$ awk -f example1.awk colours.txt +A: raspberry  red    4 +B: banana     yellow 6 +A: apple      green  8 +``` + +A file containing awk instructions can be made into a script by adding a **#!** line at the top and making it executable. Create a file called **example2.awk** with these contents: + + +``` +#!/usr/bin/awk -f +# +# Print all but line 1 with the line number on the front +# + +NR > 1 { +    printf "%d: %s\n",NR,$0 +} +``` + +Arguably, there's no advantage to having just one line in a script, but sometimes it's easier to execute a script than to remember and type even a single line. A script file also provides a good opportunity to document what a command does. Lines starting with the **#** symbol are comments, which awk ignores. + +Grant the file executable permission: + + +``` +`$ chmod u+x example2.awk` +``` + +Run the script: + + +``` +$ ./example2.awk colours.txt +2: apple      red    4 +2: banana     yellow 6 +4: raspberry red    3 +5: grape      purple 10 +[...] +``` + +An advantage of placing your awk instructions in a script file is that it's easier to format and edit. While you can write awk on a single line in your terminal, it can get overwhelming when it spans several lines. + +### Try it + +You now know enough about how awk processes your instructions to be able to write a complex awk program. Try writing an awk script with more than one rule and at least one conditional pattern. If you want to try more functions than just **print** and **printf**, refer to [the gawk manual][4] online. + +Here's an idea to get you started: + + +``` +#!/usr/bin/awk -f +# +# Print each record EXCEPT +# IF the first record contains "raspberry", +# THEN replace "red" with "pi" + +$1 == "raspberry" { +        gsub(/red/,"pi") +} + +{ print } +``` + +Try this script to see what it does, and then try to write your own. + +The next article in this series will introduce more functions for even more complex (and useful!) scripts. + +* * * + +_This article is adapted from an episode of [Hacker Public Radio][5], a community technology podcast._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/fields-records-variables-awk + +作者:[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_laptop_code_programming_mountain_view.jpg?itok=yx5buqkr (Man at laptop on a mountain) +[2]: https://www.gnu.org/software/gawk/manual/html_node/History.html#History +[3]: https://opensource.com/article/19/10/intro-awk +[4]: https://www.gnu.org/software/gawk/manual/ +[5]: http://hackerpublicradio.org/eps.php?id=2129 From d613a50ff269177374065a69931e6f620eab0994 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 01:12:04 +0800 Subject: [PATCH 319/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191105=20Red=20?= =?UTF-8?q?Hat=20announces=20RHEL=208.1=20with=20predictable=20release=20c?= =?UTF-8?q?adence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md --- ...EL 8.1 with predictable release cadence.md | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 sources/talk/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md diff --git a/sources/talk/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md b/sources/talk/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md new file mode 100644 index 0000000000..9addd4102c --- /dev/null +++ b/sources/talk/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat announces RHEL 8.1 with predictable release cadence) +[#]: via: (https://www.networkworld.com/article/3451367/red-hat-announces-rhel-8-1-with-predictable-release-cadence.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Red Hat announces RHEL 8.1 with predictable release cadence +====== + +[Clkr / Pixabay][1] [(CC0)][2] + +[Red Hat][3] has just today announced the availability of Red Hat Enterprise Linux (RHEL) 8.1, promising improvements in manageability, security and performance. + +RHEL 8.1 will enhance the company’s open [hybrid-cloud][4] portfolio and continue to provide a consistent user experience between on-premises and public-cloud deployments. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][5] + +RHEL 8.1 is also the first release that will follow what Red Hat is calling its "predictable release cadence". Announced at Red Hat Summit 2019, this means that minor releases will be available every six months. The expectation is that this rhythmic release cycle will make it easier both for customer organizations and other software providers to plan their upgrades. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Red Hat Enterprise Linux 8.1 provides product enhancements in many areas. + +### Enhanced automation + +All supported RHEL subscriptions now include access to Red Hat's proactive analytics, **Red Hat Insights**. With more than 1,000 rules for operating RHEL systems whether on-premises or cloud deployments, Red Hat Insights help IT administrators flag potential configuration, security, performance, availability and stability issues before they impact production. + +### New system roles + +RHEL 8.1 streamlines the process for setting up subsystems to handle specific functions such as storage, networking, time synchronization, kdump and SELinux. This expands on the variety of Ansible system roles. + +### Live kernel patching + +RHEL 8.1 adds full support for live kernel patching. This critically important feature allows IT operations teams to deal with ongoing threats without incurring excessive system downtime. Kernel updates can be applied to remediate common vulnerabilities and exposures (CVE) while reducing the need for a system reboot. Additional security enhancements include enhanced CVE remediation, kernel-level memory protection and application whitelisting. + +### Container-centric SELinux profiles + +These profiles allow the creation of more tailored security policies to control how containerized services access host-system resources, making it easier to harden systems against security threats. + +### Enhanced hybrid-cloud application development + +A reliably consistent set of supported development tools is included, among them the latest stable versions of popular open-source tools and languages like golang and .NET Core as well as the ability to power modern data-processing workloads such as Microsoft SQL Server and SAP solutions. + +Red Hat Linux 8.1 is available now for RHEL subscribers via the [Red Hat Customer Portal][7]. Red Hat Developer program members may obtain the latest releases at no cost at the [Red Hat Developer][8] site. + +#### Additional resources + +Here are some links to  additional information: + + * More about [Red Hat Enterprise Linux][9] + * Get a [RHEL developer subscription][10] + * More about the latest features at [Red Hat Insights][11] + + + +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/3451367/red-hat-announces-rhel-8-1-with-predictable-release-cadence.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://pixabay.com/vectors/red-hat-fedora-fashion-style-26734/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3316960/ibm-closes-34b-red-hat-deal-vaults-into-multi-cloud.html +[4]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[5]: https://www.networkworld.com/newsletters/signup.html +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://access.redhat.com/ +[8]: https://developer.redhat.com +[9]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[10]: https://developers.redhat.com/ +[11]: https://www.redhat.com/en/blog/whats-new-red-hat-insights-november-2019 +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world From 4dad49832e876eadd5a52ab38fd4bd1267522fd4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 01:13:17 +0800 Subject: [PATCH 320/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191105=20AI=20a?= =?UTF-8?q?nd=205G:=20Entering=20a=20new=20world=20of=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191105 AI and 5G- Entering a new world of data.md --- ...AI and 5G- Entering a new world of data.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sources/talk/20191105 AI and 5G- Entering a new world of data.md diff --git a/sources/talk/20191105 AI and 5G- Entering a new world of data.md b/sources/talk/20191105 AI and 5G- Entering a new world of data.md new file mode 100644 index 0000000000..0edac458c9 --- /dev/null +++ b/sources/talk/20191105 AI and 5G- Entering a new world of data.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (AI and 5G: Entering a new world of data) +[#]: via: (https://www.networkworld.com/article/3451718/ai-and-5g-entering-a-new-world-of-data.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +AI and 5G: Entering a new world of data +====== +The deployment model of vendor-centric equipment cannot sustain this exponential growth in traffic. +[Stinging Eyes][1] [(CC BY-SA 2.0)][2] + +Today the telecom industry has identified the need for faster end-user-data rates. Previously users were happy to call and text each other. However, now mobile communication has converted our lives in such a dramatic way it is hard to imagine this type of communication anymore. + +Nowadays, we are leaning more towards imaging and VR/AR video-based communication. Therefore, considering such needs, these applications are looking for a new type of network. Immersive experiences with 360° video applications require a lot of data and a zero-lag network. + +To give you a quick idea, VR with a resolution equivalent to 4K TV resolution would require a bandwidth of 1Gbps for a smooth play or 2.5 Gbps for interactive; both requiring a minimal latency of 10ms and minimal delay. And that's for round-trip time. Soon these applications will target the smartphone, putting additional strains on networks. As AR/VR services grow in popularity, the proposed 5G networks will yield the speed and the needed performance. + +Every [IoT device][3] _[Disclaimer: The author works for Network Insight]_, no matter how dumb it is, will create data and this data is the fuel for the engine of AI. AI enables us to do more interesting things with the data. The ultimate goal of the massive amount of data we will witness is the ability to turn this data into value. The rise in data from the enablement of 5G represents the biggest opportunity for AI. + +There will be unprecedented levels of data that will have to move across the network for processing and in some cases be cached locally to ensure low latency. For this, we primarily need to move the processing closer to the user to utilize ultra-low latency and ultra-high throughput. + +### Some challenges with 5G + +The introduction of 5G is not without challenges. It's expensive and is distributed in ways that have not been distributed in the past. There is an extensive cost involved in building this type of network. Location is central to effective planning, deployment and optimization of 5G networks. + +Also, the 5G millimeter wave comes with its own challenges. There are techniques that allow you to take the signal and send it towards a specific customer instead of sending it to every direction. The old way would be similar to a light bulb that reaches all the parts of the room, as opposed to a flashlight that targets specific areas. + +[The time of 5G is almost here][4] + +So, choosing the right location plays a key role in the development and deployment of 5G networks. Therefore, you must analyze if you are building in the right place, and are marketing to the right targets. How many new subscribers do you expect to sign up for the services if you choose one area over the other? You need to take into account the population that travels around that area, the building structures and how easy it is to get the signal. + +Moreover, we must understand the potential of flooding and analyze real-time weather to predict changes in traffic. So, if there is a thunderstorm, we need to understand how such events influence the needs of the networks and then make predictive calculations. AI can certainly assist in predicting these events. + +### AI, a doorway to opportunity + +5G is introducing new challenges, but by integrating AI techniques into networks is one way the industry is addressing these complexities. AI techniques is a key component that needs to be adapted to the network to help manage and control this change. Another important use case for AI is for network planning and operations. + +With 5G, we will have 100,000s of small cells everywhere where each cell is connected to a fiber line. It has been predicted that we can have 10 million cells globally. Figuring out how to plan and design all these cells would be beyond human capability. This is where AI can do site evaluations and tell you what throughput you have with certain designs. + +AI can help build out the 5G infrastructure and map out the location of cell towers to pinpoint the best location for the 5G rollout. It can continuously monitor how the network is being used. If one of the cell towers is not functioning as expected, AI can signal to another cell tower to take over. + +### Vendor-centric equipment cannot sustain 5G + +With the enablement of 5G networks, we have a huge amount of data. In some cases, this could be high in the PB region per day; the majority of this will be due to video-based applications. A deployment model of vendor-centric equipment cannot sustain this exponential growth in traffic. + +We will witness a lot of open source in this area, with the movement of the processing and compute, storage and network functionality to the edge. Eventually, this will create a real-time network at the edge. + +### More processing at the edge + +Edge computing involves having the computer, server and network at the very edge of the network that is closer to the user. It provides intelligence at the edge, thereby reducing the amount of traffic going to the backbone. + +Edge computing can result in for example AI object identification to reach the target recognition in under .35 seconds. Essentially, we have the image recognition deep learning algorithm that is sitting on the edge. The algorithm sitting on the edge of the network will help to reduce the traffic sent to the backbone. + +However, this also opens up a new attack surface and luckily AI plays well with cybersecurity. A closed-loop system will collect data at the network edge, identity threats and take real-time action. + +### Edge and open source + +We have a few popular open-source options available at our disposal. Some examples of open source edge computing could be Akraino Edge Stack, ONAP Open Network Animation Platform and Airship Open Infrastructure Project. + +The Akraino Edge Stack creates an open-source software stack that supports high-availability cloud services. These services are optimized for edge computing systems and applications. + +The Akraino R1 release includes 10 “ready and proven” blueprints and delivers a fully functional edge stack for edge use cases. These range from Industrial IoT, Telco 5G Core & vRAN, uCPE, SDWAN, edge media processing and carrier edge media processing. + +The ONAP (Open Network Platform) provides a comprehensive platform for real-time, policy-driven orchestration and automation of physical and virtual network functions. It is an open-source networking project hosted by the Linux Foundation. + +Finally, the Airship Open Infrastructure Project is a collection of open-source tools for automating cloud provisioning and management. These tools include OpenStack for virtual machines, Kubernetes for container orchestration and MaaS for bare metal, with planned support for OpenStack Ironic. + +**This article is published as part of the IDG Contributor Network. [Want to Join?][5]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3451718/ai-and-5g-entering-a-new-world-of-data.html + +作者:[Matt Conran][a] +选题:[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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.flickr.com/photos/martinlatter/4233363677 +[2]: https://creativecommons.org/licenses/by-sa/2.0/legalcode +[3]: https://network-insight.net/2017/10/internet-things-iot-dissolving-cloud/ +[4]: https://www.networkworld.com/article/3354477/mobile-world-congress-the-time-of-5g-is-almost-here.html +[5]: https://www.networkworld.com/contributor-network/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From d3407f3afc9256029abf52cdd84254cc2a263798 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 01:14:51 +0800 Subject: [PATCH 321/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191105=20Forres?= =?UTF-8?q?ter:=20Edge=20computing=20is=20about=20to=20bloom?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191105 Forrester- Edge computing is about to bloom.md --- ...ester- Edge computing is about to bloom.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/talk/20191105 Forrester- Edge computing is about to bloom.md diff --git a/sources/talk/20191105 Forrester- Edge computing is about to bloom.md b/sources/talk/20191105 Forrester- Edge computing is about to bloom.md new file mode 100644 index 0000000000..c483ef661c --- /dev/null +++ b/sources/talk/20191105 Forrester- Edge computing is about to bloom.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Forrester: Edge computing is about to bloom) +[#]: via: (https://www.networkworld.com/article/3451532/forrester-edge-computing-is-about-to-bloom.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Forrester: Edge computing is about to bloom +====== +2020 is set to be a “breakout year” for edge computing technology, according to the latest research from Forrester Research +Getty Images + +The next calendar year will be the one that propels [edge computing][1] into the enterprise technology limelight for good, according to a set of predictions from Forrester Research. + +While edge computing is primarily an [IoT][2]-related phenomenon, Forrester said that addressing the need for on-demand compute and real-time app engagements will also play a role in driving the growth of edge computing in 2020. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +What it all boils down to, in some ways, is that form factors will shift sharply away from traditional rack, blade or tower servers in the coming year, depending on where the edge technology is deployed. An autonomous car, for example, won’t be able to run a traditionally constructed server. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +It’ll also mean that telecom companies will begin to feature a lot more heavily in the cloud and distributed-computing markets. Forrester said that CDNs and [colocation vendors][5] could become juicy acquisition targets for big telecom, which missed the boat on cloud computing to a certain extent, and is eager to be a bigger part of the edge. They’re also investing in open-source projects like Akraino, an edge software stack designed to support carrier availability. + +But the biggest carrier impact on edge computing in 2020 will undoubtedly be the growing availability of [5G][6] network coverage, Forrester says. While that availability will still mostly be confined to major cities, that should be enough to prompt reconsideration of edge strategies by businesses that want to take advantage of capabilities like smart, real-time video processing, 3D mapping for worker productivity and use cases involving autonomous robots or drones. + +Beyond the carriers, there’s a huge range of players in the edge computing, all of which have their eyes firmly on the future. Operational-device makers in every field from medicine to utilities to heavy industry will need custom edge devices for connectivity and control, huge cloud vendors will look to consolidate their hold over that end of the market and AI/ML startups will look to enable brand-new levels of insight and functionality. + +What’s more, the average edge-computing implementation will often use many of them at the same time, according to Forrester, which noted that integrators who can pull products and services from many different vendors into a single system will be highly sought-after in the coming year. Multivendor solutions are likely to be much more popular than single-vendor, in large part because few individual companies have products that address all parts of the edge and IoT stacks. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3451532/forrester-edge-computing-is-about-to-bloom.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/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[2]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3407756/colocation-facilities-buck-the-cloud-data-center-trend.html +[6]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 082aa55ad3c9e1cb4ec18fcd2278a567f1119976 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 01:20:22 +0800 Subject: [PATCH 322/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191105=20A=20Bi?= =?UTF-8?q?rd=E2=80=99s=20Eye=20View=20of=20Big=20Data=20for=20Enterprises?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191105 A Bird-s Eye View of Big Data for Enterprises.md --- ...-s Eye View of Big Data for Enterprises.md | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sources/talk/20191105 A Bird-s Eye View of Big Data for Enterprises.md diff --git a/sources/talk/20191105 A Bird-s Eye View of Big Data for Enterprises.md b/sources/talk/20191105 A Bird-s Eye View of Big Data for Enterprises.md new file mode 100644 index 0000000000..efca1529ab --- /dev/null +++ b/sources/talk/20191105 A Bird-s Eye View of Big Data for Enterprises.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Bird’s Eye View of Big Data for Enterprises) +[#]: via: (https://opensourceforu.com/2019/11/a-birds-eye-view-of-big-data-for-enterprises-2/) +[#]: author: (Swapneel Mehta https://opensourceforu.com/author/swapneel-mehta/) + +A Bird’s Eye View of Big Data for Enterprises +====== + +[![][1]][2] + +_Entrepreneurial decisions are made using data and business acumen. Big Data is today a tool that helps to maximise revenue and customer engagement. Open source tools like Hadoop, Apache Spark and Apache Storm are the popular choices when it comes to analysing Big Data. As the volume and variety of data in the world grows by the day, there is great scope for the discovery of trends as well as for innovation in data analysis and storage._ + +In the past five years, the spate of research focused on machine learning has resulted in a boom in the nature and quality of heterogeneous data sources that are being tapped by providers for their customers. Cheaper compute and widespread storage makes it so much easier to apply bulk data processing techniques, and derive insights from existing and unexplored sources of rich user data including logs and traces of activity whilst using software products. Business decision making and strategy has been primarily dictated by data and is usually supported by business acumen. But in recent times it has not been uncommon to see data providing conclusions seemingly in contrast with conventional business logic. + +One could take the simple example of the baseball movie ‘Moneyball’, in which the protagonist defies all notions of popular wisdom in looking solely at performance statistics to evaluate player viability, eventually building a winning team of players – a team that would otherwise never have come together. The advantage of Big Data for enterprises, then, becomes a no brainer for most corporate entities looking to maximise revenue and engagement. At the back-end, this is accomplished by popular combinations of existing tools specially designed for large scale, multi-purpose data analysis. Apache, Hadoop and Spark are some of the most widespread open source tools used in this space in the industry. Concomitantly, it is easy to imagine that there are a number of software providers offering B2B services to corporate clients looking to outsource specific portions of their analytics. Therefore, there is a bustling market with customisable, proprietary technological solutions in this space as well. + +![Figure 1: A crowded landscape to follow \(Source: Forbes\)][3] + +Traditionally, Big Data refers to the large volumes of unstructured and heterogeneous data that is often subject to processing in order to provide insights and improve decision-making regarding critical business processes. The McKinsey Global institute estimates that data volumes have been growing at 40 per cent per year and will grow 44x between the years 2009 and 2020. But there is more to Big Data than just its immense volume. The rate of data production is an important factor given that smaller data streams generated at faster rates produce larger pools than their counterparts. Social media is a great example of how small networks can expand rapidly to become rich sources of information — up to massive, billion-node scales. + +Structure in data is a highly variable attribute given that data is now extracted from across the entire spectrum of user activity. Conventional formats of storage, including relational databases, have been virtually replaced by massively unstructured data pools designed to be leveraged in manners unique to their respective use cases. In fact, there has been a huge body of work on data storage in order to leverage various write formats, compression algorithms, access methods and data structures to arrive at the best combination for improving productivity of the workflow reliant on that data. A variety of these combinations has emerged to set the industry standards in their respective verticals, with the benefits ranging from efficient storage to faster access. + +Finally, we have the latent value in these data pools that remains to be exploited by the use of emerging trends in artificial intelligence and machine learning. Personalised advertising recommendations are a huge factor driving revenue for social media giants like Facebook and companies like Google that offer a suite of products and an ecosystem to use them. The well-known Silicon Valley giant started out as a search provider, but now controls a host of apps and most of the entry points for the data generated in the course of people using a variety of electronic devices across the world. Established financial institutions are now exploring the possibility of a portion of user data being put on an immutable public ledger to introduce a blockchain-like structure that can open the doors to innovation. The pace is picking up as product offerings improve in quality and expand in variety. Let’s get a bird’s eye view of this subject to understand where the market stands. +The idea behind building better frameworks is increasingly turning into a race to provide more add-on features and simplify workflows for the end user to engage with. This means the categories have many blurred lines because most products and tools present themselves as end-to-end platforms to manage Big Data analytics. However, we’ll attempt to divide this broadly into a few categories and examine some providers in each of these. + +**Big Data storage and processing** +Infrastructure is the key to building a reliable workflow when it comes to enterprise use cases. Earlier, relational databases were worthwhile to invest in for small and mid-sized firms. However, when the data starts pouring in, it is usually the scalability that is put to the test first. Building a flexible infrastructure comes at the cost of complexity. It is likely to have more moving parts that can cause failure in the short-term. However, if done right – something that will not be easy because it has to be tailored exactly to your company – it can result in life-changing improvements for both users and the engineers working with the said infrastructure to build and deliver state-of-the-art products. + +There are many alternatives to SQL, with the NoSQL paradigm being adopted and modified for building different types of systems. Cassandra, MongoDB and CouchDB are some well-known alternatives. Most emerging options can be distinguished based on their disruption, which is aimed at the fundamental ACID properties of databases. To recall, a transaction in a database system must maintain atomicity, consistency, isolation, and durability − commonly known as ACID properties − in order to ensure accuracy, completeness, and data integrity (from Tutorialspoint). For instance, CockroachDB, an open source offshoot of Google’s Spanner database system, has gained traction due to its support for being distributed. Redis and HBase offer a sort of hybrid storage solution while Neo4j remains a flag bearer for graph structured databases. However, traditional areas aside, there are always new challenges on the horizon for building enterprise software. + +Backups are one such area where startups have found viable disruption points to enter the market. Cloud backups for enterprise software are expensive, non-trivial procedures and offloading this work to proprietary software offers a lucrative business opportunity. Rubrik and Cohesity are two companies that originally started out in this space and evolved to offer added services atop their primary offerings. Clumio is a recent entrant, purportedly creating a data fabric that the promoters expect will serve as a foundational layer to run analytics on top of. It is interesting to follow recent developments in this burgeoning space as we see competitors enter the market and attempt to carve a niche for themselves with their product offerings. + +**Big Data analytics in the cloud** +Apache Hadoop remains the popular choice for many organisations. However, many successors have emerged to offer a set of additional analytical capabilities: Apache Spark, commonly hailed as an improvement to the Hadoop ecosystem; Apache Storm that offers real-time data processing capabilities; and Google’s BigQuery, which is supposedly a full-fledged platform for Big Data analytics. + +Typically, cloud providers such as Amazon Web Services and Google Cloud Platform tend to build in-house products leveraging these capabilities, or replicate them entirely and offer them as hosted services to businesses. This helps them provide enterprise offerings that are closely integrated within their respective cloud computing ecosystem. There has been some discussion about the moral consequences of replicating open source products to profit off closed source versions of the same, but there has been no consensus on the topic, nor any severe consequences suffered on account of this questionable approach to boost revenue. + +Another hosted service offering a plethora of Big Data analytics tools is Cloudera which has an established track record in the market. It has been making waves since its merger with Hortonworks earlier this year, giving it added fuel to compete with the giants in its bid to become the leading enterprise cloud provider in the market. + +Overall, we’ve seen interesting developments in the Big Data storage and analysis domain and as the volume and variety of data grows, so do the opportunities to innovate in the field. + +![Avatar][4] + +[Swapneel Mehta][5] + +The author has worked at Microsoft Research, CERN and startups in AI and cyber security. He is an open source enthusiast who enjoys spending time organising software development workshops for school and college students. You can contact him at ; or . + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/a-birds-eye-view-of-big-data-for-enterprises-2/ + +作者:[Swapneel Mehta][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/swapneel-mehta/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Big-Data-analytics-and-processing-for-the-enterprise.jpg?resize=696%2C449&ssl=1 (Figure 1 Big Data analytics and processing for the enterprise) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Big-Data-analytics-and-processing-for-the-enterprise.jpg?fit=900%2C580&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-A-crowded-landscape-to-follow.jpg?resize=350%2C254&ssl=1 +[4]: https://secure.gravatar.com/avatar/2ba7abaf240a1f6166d506dccdcda00f?s=100&r=g +[5]: https://opensourceforu.com/author/swapneel-mehta/ From 0b1b5cc9bdaeb93a85a58929be4d5f5b2f4c2d0b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 6 Nov 2019 01:39:09 +0800 Subject: [PATCH 323/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191104=20Open?= =?UTF-8?q?=20Source=20Big=20Data=20Solutions=20Support=20Digital=20Transf?= =?UTF-8?q?ormation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191104 Open Source Big Data Solutions Support Digital Transformation.md --- ...olutions Support Digital Transformation.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/talk/20191104 Open Source Big Data Solutions Support Digital Transformation.md diff --git a/sources/talk/20191104 Open Source Big Data Solutions Support Digital Transformation.md b/sources/talk/20191104 Open Source Big Data Solutions Support Digital Transformation.md new file mode 100644 index 0000000000..e8c2073444 --- /dev/null +++ b/sources/talk/20191104 Open Source Big Data Solutions Support Digital Transformation.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source Big Data Solutions Support Digital Transformation) +[#]: via: (https://opensourceforu.com/2019/11/open-source-big-data-solutions-support-digital-transformation/) +[#]: author: (Vinayak Ramachandra Adkoli https://opensourceforu.com/author/vinayak-adkoli/) + +Open Source Big Data Solutions Support Digital Transformation +====== + +[![][1]][2] + +_The digital transformation (DT) of enterprises is enabled by the judicious use of Big Data. And it’s open source technologies that are the driving force behind the power of Big Data and DT._ + +Digital Transformation (DT) and Big Data combine to offer several advantages. Big Data based digitally transformed systems make life easier and smarter, whether in the field of home automation or industrial automation. The digital world tracks Big Data generated by IoT devices, etc. It tries to make this data more productive and hence, DT should be taken for granted as the world progresses. + +For example, NASA ‘s rover ‘Curiosity’ is sending Big Data from Mars to the Earth. As compared to data sent by NASA’s satellites that are revolving around Mars, this data is nothing but digitally transformed Big Data, which works with DT to provide a unique platform for open source applications. Today, ‘Curiosity’ has its own Twitter account with four million followers. + +A Digital Transformation isn’t complete unless a business adopts Big Data. The phrase “Data is the new crude oil,” is not new. However, crude oil itself has no value, unless it is refined into petrol, diesel, tar, wax, etc. Similarly, in our daily lives, we deal with tons of data. If this data is refined to a useful form, only then is it of some real use. + +As an example, we can see the transformation televisions have undergone, in appearance. We once had picture tube based TVs. Today, we have LEDs, OLEDs, LCD based TVs, curved TVs, Internet enabled TVs, and so on. Such transformation is also quite evident in the digital world. + +In a hospital, several patients may be diagnosed with cancer, each year. The patient data generated is voluminous, including treatment methods, diverse drug therapies, patient responses, genetic histories, etc. But such vast pools of information, i.e., Big Data, would serve no useful purpose without proper analysis. So DT, coupled with Big Data and open source applications, can create a more patient-focused and effective treatment – one that might have higher recovery rates. + +Big Data combines structured data with unstructured data to give us new business insights that we’ve never had before. Structured data may be traditional spreadsheets, your customer list, information about your products and business processes, etc. Unstructured data may include Google Trends data, feeds from IoT sensors, etc. When a layer of unstructured data is placed on top of structured data and analysed, that’s where the magic happens. + +Let’s look into a typical business situation. Let’s suppose a century old car-making company asks its data team to use Big Data concepts to find an efficient way to make safe sales forecasts. In the past, the team would look at the number of products it had sold in the previous month, as well as the number of cars it had sold a year ago and use that data to make a safe forecast. But now the Big Data teams use sentiment analysis on Twitter and look at what people are saying about its products and brand. They also look at Google Trends to see which similar products and brands are being searched the most. Then they correlate such data from the preceding few months with the actual current sales figures to check if the former was predictive – i.e., had Google Trends over the past few months actually predicted the firm’s current sales figures? + +In the case of the car company, while making sales forecasts, the team used structured data (how many cars sold last month, a year ago, etc) and layers of unstructured data (sentiment analysis from Twitter and Google Trends) and it resulted in a smart forecast. Thus, Big Data is today becoming more effective in business situations like sales planning, promotions, market campaigns, etc. + +**Open source is the key to DT** + +Open source, nowadays, clearly dominates domains like Big Data, mobile and cloud platforms. Once open source becomes a key component that delivers a good financial performance, the momentum is unstoppable. Open source (often coupled with the cloud) is giving Big Data based companies like Google, Facebook and other Web giants flexibility to innovate faster. + +Big Data companies are using DT to understand their processes, so that they can employ technologies like IoT, Big Data analytics, AI, etc, better. The journey of enterprises migrating from old digital infrastructure to new platforms is an exciting trend in the open source environment. +Organisations are relying on data warehouses and business intelligence applications to help make important data driven business decisions. Different types of data, such as audio, video or unstructured data, is organised in formats to help identify it for making future decisions. + +**Open source tools used in DT** +Several open source tools are becoming popular for dealing with Big Data and DT. Some of them are listed below. + + * **Hadoop** is known for the ability to process extremely large data volumes in both structured and unstructured formats, reliably placing Big Data to nodes in the group and making it available locally on the processing machine. + * **MapReduce** happens to be a crucial component of Hadoop. It works rapidly to process vast amounts of data in parallel on large clusters of computer nodes. It was originally developed by Google. + * **Storm** is different from other tools with its distributed, real-time, fault-tolerant processing system, unlike the batch processing of Hadoop. It is fast and highly scalable. It is now owned by Twitter. + * **Apache Cassandra** is used by many organisations with large, active data sets, including Netflix, Twitter, Urban Airship, Cisco and Digg. Originally developed by Facebook, it is now managed by the Apache Foundation. + * **Kaggle** is the world’s largest Big Data community. It helps organisations and researchers to post their data and statistics. It is an open source Big Data tool that allows programmers to analyse large data sets on Hadoop. It helps with querying and managing large data sets really fast. + + + +**DT: A new innovation** +DT is the result of IT innovation. It is driven by well-planned business strategies, with the goal of inventing new business models. Today, any organisation can undergo business transformation because of three main business-focused essentials — intelligence, the ability to decide more quickly and a customer-centric outlook. + +DT, which includes establishing Big Data analytics capabilities, poses considerable challenges for traditional manufacturing organisations, such as car companies. The successful introduction of Big Data analytics often requires substantial organisational transformation including new organisational structures and business processes. + +Retail is one of the most active sectors when it comes to DT. JLab is an innovative DT venture by retail giant John Lewis, which offers lots of creativity and entrepreneurial dynamism. It is even encouraging five startups each year and helps them to bring their technologies to market. For example, Digital Bridge, a startup promoted by JLab, has developed a clever e-commerce website that allows shoppers to snap photos of their rooms and see what furniture and other products would look like in their own homes. It automatically detects walls and floors, and creates a photo realistic virtual representation of the customer’s room. Here, lighting and decoration can be changed and products can be placed, rotated and repositioned with a realistic perspective. + +Companies across the globe are going through digital business transformation as it helps to improve their business processes and leads to new business opportunities. The importance of Big Data in the business world can’t be ignored. Nowadays, it is a key factor for success. There is a huge amount of valuable data which companies can use to improve their results and strategies. Today, every important decision can and should be supported by the application of data analytics. + +Big Data and open source help DT do more for businesses. DT helps companies become digitally mature and gain a solid presence on the Internet. It helps companies to identify any drawbacks that may exist in their e-commerce system. + +**Big Data in DT** +Data is critical, but it can’t be used as a replacement for creativity. In other words, DT is not all about creativity versus data, but it’s about creativity enhanced by data. + +Companies gather data to analyse and improve the customer experience, and then to create targeted messages emphasising the brand promise. But emotion, story-telling and human connections remain as essential as ever. The DT world today is dominated by Big Data. This is inevitable given the fact that business organisations always want DT based Big Data, so that data is innovative, appealing, useful to attract customers and hence to increase their sales. + +Tesla cars today are equipped with sensors and IoT connections to gather a vast amount of data. Improvements based on this data are then fed back into the cars, creating a better driving experience. + +**DT in India** +DT can transform businesses across every vertical in India. Data analytics has changed from being a good-to-have to a must-have technology. + +According to a survey by Microsoft in partnership with International Data Corporation (IDC), by 2021, DT will add an estimated US$ 154 billion to India’s GDP and increase the growth rate by 1 per cent annually. Ninety per cent of Indian organisations are in the midst of their DT journey. India is the biggest user and contributor to open source technology. DT has created a new ripple across the whole of India and is one of the major drivers for the growth of open source. The government of India has encouraged the adoption of this new technology in the Digital India initiative, and this has further encouraged the CEOs of enterprises and other government organisations to make a move towards this technology. + +The continuous DT in India is being driven faster with the adoption of emerging technologies like Big Data. That’s one of the reasons why organisations today are investing in these technological capabilities. Businesses in India are recognising the challenges of DT and embracing them. Overall, it may be said that the new DT concept is more investor and technology friendly, in tune with the ‘Make in India’ programme of the present government. + +From finding ways to increase business efficiency and trimming costs, to retaining high-value customers, determining new revenue opportunities and preventing fraud, advanced analytics is playing an important role in the DT of Big Data based companies. + +**The way forward** +Access to Big Data has changed the game for small and large businesses alike. Big Data can help businesses to solve almost every problem. DT helps companies to embrace a culture of change and remain competitive in a global environment. Losing weight is a life style change and so is the incorporation of Big Data into business strategies. + +Big Data is the currency of tomorrow, and today, it is the fuel running a business. DT can harness it to a greater level. + +![Avatar][3] + +[Vinayak Ramachandra Adkoli][4] + +The author is a B.E. in industrial production, and has been a lecturer in the mechanical engineering department for ten years at three different polytechnics. He is also a freelance writer and cartoonist. He can be contacted at [karnatakastory@gmail.com][5] or [vradkoli@rediffmail.com][6]. + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/open-source-big-data-solutions-support-digital-transformation/ + +作者:[Vinayak Ramachandra Adkoli][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/vinayak-adkoli/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Big-Data-.jpg?resize=696%2C517&ssl=1 (Big Data) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Big-Data-.jpg?fit=800%2C594&ssl=1 +[3]: https://secure.gravatar.com/avatar/7b4383616c8708e3417051b3afd64bbc?s=100&r=g +[4]: https://opensourceforu.com/author/vinayak-adkoli/ +[5]: mailto:karnatakastory@gmail.com +[6]: mailto:vradkoli@rediffmail.com From 5873e758a02d13bb8f36e6330534559519d746e9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 08:59:46 +0800 Subject: [PATCH 324/800] TSL --- ...nding system calls on Linux with strace.md | 452 ------------------ ...nding system calls on Linux with strace.md | 409 ++++++++++++++++ 2 files changed, 409 insertions(+), 452 deletions(-) delete mode 100644 sources/tech/20191025 Understanding system calls on Linux with strace.md create mode 100644 translated/tech/20191025 Understanding system calls on Linux with strace.md diff --git a/sources/tech/20191025 Understanding system calls on Linux with strace.md b/sources/tech/20191025 Understanding system calls on Linux with strace.md deleted file mode 100644 index 443791a1f4..0000000000 --- a/sources/tech/20191025 Understanding system calls on Linux with strace.md +++ /dev/null @@ -1,452 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Understanding system calls on Linux with strace) -[#]: via: (https://opensource.com/article/19/10/strace) -[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) - -Understanding system calls on Linux with strace -====== -Trace the thin layer between user processes and the Linux kernel with -strace. -![Hand putting a Linux file folder into a drawer][1] - -A system call is a programmatic way a program requests a service from the kernel, and **strace** is a powerful tool that allows you to trace the thin layer between user processes and the Linux kernel. - -To understand how an operating system works, you first need to understand how system calls work. One of the main functions of an operating system is to provide abstractions to user programs. - -An operating system can roughly be divided into two modes: - - * **Kernel mode:** A privileged and powerful mode used by the operating system kernel - * **User mode:** Where most user applications run - - - -Users mostly work with command-line utilities and graphical user interfaces (GUI) to do day-to-day tasks. System calls work silently in the background, interfacing with the kernel to get work done. - -System calls are very similar to function calls, which means they accept and work on arguments and return values. The only difference is that system calls enter a kernel, while function calls do not. Switching from user space to kernel space is done using a special [trap][2] mechanism. - -Most of this is hidden away from the user by using system libraries (aka **glibc** on Linux systems). Even though system calls are generic in nature, the mechanics of issuing a system call are very much machine-dependent. - -This article explores some practical examples by using some general commands and analyzing the system calls made by each command using **strace**. These examples use Red Hat Enterprise Linux, but the commands should work the same on other Linux distros: - - -``` -[root@sandbox ~]# cat /etc/redhat-release -Red Hat Enterprise Linux Server release 7.7 (Maipo) -[root@sandbox ~]# -[root@sandbox ~]# uname -r -3.10.0-1062.el7.x86_64 -[root@sandbox ~]# -``` - -First, ensure that the required tools are installed on your system. You can verify whether **strace** is installed using the RPM command below; if it is, you can check the **strace** utility version number using the **-V** option: - - -``` -[root@sandbox ~]# rpm -qa | grep -i strace -strace-4.12-9.el7.x86_64 -[root@sandbox ~]# -[root@sandbox ~]# strace -V -strace -- version 4.12 -[root@sandbox ~]# -``` - -If that doesn't work, install **strace** by running: - - -``` -`yum install strace` -``` - -For the purpose of this example, create a test directory within **/tmp** and create two files using the **touch** command using: - - -``` -[root@sandbox ~]# cd /tmp/ -[root@sandbox tmp]# -[root@sandbox tmp]# mkdir testdir -[root@sandbox tmp]# -[root@sandbox tmp]# touch testdir/file1 -[root@sandbox tmp]# touch testdir/file2 -[root@sandbox tmp]# -``` - -(I used the **/tmp** directory because everybody has access to it, but you can choose another directory if you prefer.) - -Verify that the files were created using the **ls** command on the **testdir** directory: - - -``` -[root@sandbox tmp]# ls testdir/ -file1  file2 -[root@sandbox tmp]# -``` - -You probably use the **ls** command every day without realizing system calls are at work underneath it. There is abstraction at play here; here's how this command works: - - -``` -`Command-line utility -> Invokes functions from system libraries (glibc) -> Invokes system calls` -``` - -The **ls** command internally calls functions from system libraries (aka **glibc**) on Linux. These libraries invoke the system calls that do most of the work. - -If you want to know which functions were called from the **glibc** library, use the **ltrace** command followed by the regular **ls testdir/** command: - - -``` -`ltrace ls testdir/` -``` - -If **ltrace** is not installed, install it by entering: - - -``` -`yum install ltrace` -``` - -A bunch of output will be dumped to the screen; don't worry about it—just follow along. Some of the important library functions from the output of the **ltrace** command that are relevant to this example include: - - -``` -opendir("testdir/")                                  = { 3 } -readdir({ 3 })                                       = { 101879119, "." } -readdir({ 3 })                                       = { 134, ".." } -readdir({ 3 })                                       = { 101879120, "file1" } -strlen("file1")                                      = 5 -memcpy(0x1665be0, "file1\0", 6)                      = 0x1665be0 -readdir({ 3 })                                       = { 101879122, "file2" } -strlen("file2")                                      = 5 -memcpy(0x166dcb0, "file2\0", 6)                      = 0x166dcb0 -readdir({ 3 })                                       = nil -closedir({ 3 })                       -``` - -By looking at the output above, you probably can understand what is happening. A directory called **testdir** is being opened by the **opendir** library function, followed by calls to the **readdir** function, which is reading the contents of the directory. At the end, there is a call to the **closedir** function, which closes the directory that was opened earlier. Ignore the other **strlen** and **memcpy** functions for now. - -You can see which library functions are being called, but this article will focus on system calls that are invoked by the system library functions. - -Similar to the above, to understand what system calls are invoked, just put **strace** before the **ls testdir** command, as shown below. Once again, a bunch of gibberish will be dumped to your screen, which you can follow along with here: - - -``` -[root@sandbox tmp]# strace ls testdir/ -execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 -brk(NULL)                               = 0x1f12000 -<<< truncated strace output >>> -write(1, "file1  file2\n", 13file1  file2 -)          = 13 -close(1)                                = 0 -munmap(0x7fd002c8d000, 4096)            = 0 -close(2)                                = 0 -exit_group(0)                           = ? -+++ exited with 0 +++ -[root@sandbox tmp]# -``` - -The output on the screen after running the **strace** command was simply system calls made to run the **ls** command. Each system call serves a specific purpose for the operating system, and they can be broadly categorized into the following sections: - - * Process management system calls - * File management system calls - * Directory and filesystem management system calls - * Other system calls - - - -An easier way to analyze the information dumped onto your screen is to log the output to a file using **strace**'s handy **-o** flag. Add a suitable file name after the **-o** flag and run the command again: - - -``` -[root@sandbox tmp]# strace -o trace.log ls testdir/ -file1  file2 -[root@sandbox tmp]# -``` - -This time, no output dumped to the screen—the **ls** command worked as expected by showing the file names and logging all the output to the file **trace.log**. The file has almost 100 lines of content just for a simple **ls** command: - - -``` -[root@sandbox tmp]# ls -l trace.log --rw-r--r--. 1 root root 7809 Oct 12 13:52 trace.log -[root@sandbox tmp]# -[root@sandbox tmp]# wc -l trace.log -114 trace.log -[root@sandbox tmp]# -``` - -Take a look at the first line in the example's trace.log: - - -``` -`execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0` -``` - - * The first word of the line, **execve**, is the name of a system call being executed. - * The text within the parentheses is the arguments provided to the system call. - * The number after the **=** sign (which is **0** in this case) is a value returned by the **execve** system call. - - - -The output doesn't seem too intimidating now, does it? And you can apply the same logic to understand other lines. - -Now, narrow your focus to the single command that you invoked, i.e., **ls testdir**. You know the directory name used by the command **ls**, so why not **grep** for **testdir** within your **trace.log** file and see what you get? Look at each line of the results in detail: - - -``` -[root@sandbox tmp]# grep testdir trace.log -execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 -stat("testdir/", {st_mode=S_IFDIR|0755, st_size=32, ...}) = 0 -openat(AT_FDCWD, "testdir/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 -[root@sandbox tmp]# -``` - -Thinking back to the analysis of **execve** above, can you tell what this system call does? - - -``` -`execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0` -``` - -You don't need to memorize all the system calls or what they do, because you can refer to documentation when you need to. Man pages to the rescue! Ensure the following package is installed before running the **man** command: - - -``` -[root@sandbox tmp]# rpm -qa | grep -i man-pages -man-pages-3.53-5.el7.noarch -[root@sandbox tmp]# -``` - -Remember that you need to add a **2** between the **man** command and the system call name. If you read **man**'s man page using **man man**, you can see that section 2 is reserved for system calls. Similarly, if you need information on library functions, you need to add a **3** between **man** and the library function name. - -The following are the manual's section numbers and the types of pages they contain: - - -``` -1\. Executable programs or shell commands -2\. System calls (functions provided by the kernel) -3\. Library calls (functions within program libraries) -4\. Special files (usually found in /dev) -``` - -Run the following **man** command with the system call name to see the documentation for that system call: - - -``` -`man 2 execve` -``` - -As per the **execve** man page, this executes a program that is passed in the arguments (in this case, that is **ls**). There are additional arguments that can be provided to **ls**, such as **testdir** in this example. Therefore, this system call just runs **ls** with **testdir** as the argument: - - -``` -'execve - execute program' - -'DESCRIPTION -       execve()  executes  the  program  pointed to by filename' -``` - -The next system call, named **stat**, uses the **testdir** argument: - - -``` -`stat("testdir/", {st_mode=S_IFDIR|0755, st_size=32, ...}) = 0` -``` - -Use **man 2 stat** to access the documentation. **stat** is the system call that gets a file's status—remember that everything in Linux is a file, including a directory. - -Next, the **openat** system call opens **testdir.** Keep an eye on the **3** that is returned. This is a file description, which will be used by later system calls: - - -``` -`openat(AT_FDCWD, "testdir/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3` -``` - -So far, so good. Now, open the **trace.log** file and go to the line following the **openat** system call. You will see the **getdents** system call being invoked, which does most of what is required to execute the **ls testdir** command. Now, **grep getdents** from the **trace.log** file: - - -``` -[root@sandbox tmp]# grep getdents trace.log -getdents(3, /* 4 entries */, 32768)     = 112 -getdents(3, /* 0 entries */, 32768)     = 0 -[root@sandbox tmp]# -``` - -The **getdents** man page describes it as **get directory entries**, which is what you want to do. Notice that the argument for **getdents** is **3**, which is the file descriptor from the **openat** system call above. - -Now that you have the directory listing, you need a way to display it in your terminal. So, **grep** for another system call, **write**, which is used to write to the terminal, in the logs: - - -``` -[root@sandbox tmp]# grep write trace.log -write(1, "file1  file2\n", 13)          = 13 -[root@sandbox tmp]# -``` - -In these arguments, you can see the file names that will be displayed: **file1** and **file2**. Regarding the first argument (**1**), remember in Linux that, when any process is run, three file descriptors are opened for it by default. Following are the default file descriptors: - - * 0 - Standard input - * 1 - Standard out - * 2 - Standard error - - - -So, the **write** system call is displaying **file1** and **file2** on the standard display, which is the terminal, identified by **1**. - -Now you know which system calls did most of the work for the **ls testdir/** command. But what about the other 100+ system calls in the **trace.log** file? The operating system has to do a lot of housekeeping to run a process, so a lot of what you see in the log file is process initialization and cleanup. Read the entire **trace.log** file and try to understand what is happening to make the **ls** command work. - -Now that you know how to analyze system calls for a given command, you can use this knowledge for other commands to understand what system calls are being executed. **strace** provides a lot of useful command-line flags to make it easier for you, and some of them are described below. - -By default, **strace** does not include all system call information. However, it has a handy **-v verbose** option that can provide additional information on each system call: - - -``` -`strace -v ls testdir` -``` - -It is good practice to always use the **-f** option when running the **strace** command. It allows **strace** to trace any child processes created by the process currently being traced: - - -``` -`strace -f ls testdir` -``` - -Say you just want the names of system calls, the number of times they ran, and the percentage of time spent in each system call. You can use the **-c** flag to get those statistics: - - -``` -`strace -c ls testdir/` -``` - -Suppose you want to concentrate on a specific system call, such as focusing on **open** system calls and ignoring the rest. You can use the **-e** flag followed by the system call name: - - -``` -[root@sandbox tmp]# strace -e open ls testdir -open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 -open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3 -open("/lib64/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3 -open("/lib64/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3 -open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 -open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3 -open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 -open("/lib64/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3 -open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 -open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 -file1  file2 -+++ exited with 0 +++ -[root@sandbox tmp]# -``` - -What if you want to concentrate on more than one system call? No worries, you can use the same **-e** command-line flag with a comma between the two system calls. For example, to see the **write** and **getdents** systems calls: - - -``` -[root@sandbox tmp]# strace -e write,getdents ls testdir -getdents(3, /* 4 entries */, 32768)     = 112 -getdents(3, /* 0 entries */, 32768)     = 0 -write(1, "file1  file2\n", 13file1  file2 -)          = 13 -+++ exited with 0 +++ -[root@sandbox tmp]# -``` - -The examples so far have traced explicitly run commands. But what about commands that have already been run and are in execution? What, for example, if you want to trace daemons that are just long-running processes? For this, **strace** provides a special **-p** flag to which you can provide a process ID. - -Instead of running a **strace** on a daemon, take the example of a **cat** command, which usually displays the contents of a file if you give a file name as an argument. If no argument is given, the **cat** command simply waits at a terminal for the user to enter text. Once text is entered, it repeats the given text until a user presses Ctrl+C to exit. - -Run the **cat** command from one terminal; it will show you a prompt and simply wait there (remember **cat** is still running and has not exited): - - -``` -`[root@sandbox tmp]# cat` -``` - -From another terminal, find the process identifier (PID) using the **ps** command: - - -``` -[root@sandbox ~]# ps -ef | grep cat -root      22443  20164  0 14:19 pts/0    00:00:00 cat -root      22482  20300  0 14:20 pts/1    00:00:00 grep --color=auto cat -[root@sandbox ~]# -``` - -Now, run **strace** on the running process with the **-p** flag and the PID (which you found above using **ps**). After running **strace**, the output states what the process was attached to along with the PID number. Now, **strace** is tracing the system calls made by the **cat** command. The first system call you see is **read**, which is waiting for input from 0, or standard input, which is the terminal where the **cat** command ran: - - -``` -[root@sandbox ~]# strace -p 22443 -strace: Process 22443 attached -read(0, -``` - -Now, move back to the terminal where you left the **cat** command running and enter some text. I entered **x0x0** for demo purposes. Notice how **cat** simply repeated what I entered; hence, **x0x0** appears twice. I input the first one, and the second one was the output repeated by the **cat** command: - - -``` -[root@sandbox tmp]# cat -x0x0 -x0x0 -``` - -Move back to the terminal where **strace** was attached to the **cat** process. You now see two additional system calls: the earlier **read** system call, which now reads **x0x0** in the terminal, and another for **write**, which wrote **x0x0** back to the terminal, and again a new **read**, which is waiting to read from the terminal. Note that Standard input (**0**) and Standard out (**1**) are both in the same terminal: - - -``` -[root@sandbox ~]# strace -p 22443 -strace: Process 22443 attached -read(0, "x0x0\n", 65536)                = 5 -write(1, "x0x0\n", 5)                   = 5 -read(0, -``` - -Imagine how helpful this is when running **strace** against daemons to see everything it does in the background. Kill the **cat** command by pressing Ctrl+C; this also kills your **strace** session since the process is no longer running. - -If you want to see a timestamp against all your system calls, simply use the **-t** option with **strace**: - - -``` -[root@sandbox ~]#strace -t ls testdir/ - -14:24:47 execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 -14:24:47 brk(NULL)                      = 0x1f07000 -14:24:47 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2530bc8000 -14:24:47 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) -14:24:47 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 -``` - -What if you want to know the time spent between system calls? **strace** has a handy **-r** command that shows the time spent executing each system call. Pretty useful, isn't it? - - -``` -[root@sandbox ~]#strace -r ls testdir/ - -0.000000 execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 -0.000368 brk(NULL)                 = 0x1966000 -0.000073 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb6b1155000 -0.000047 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) -0.000119 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 -``` - -### Conclusion - -The **strace** utility is very handy for understanding system calls on Linux. To learn about its other command-line flags, please refer to the man pages and online documentation. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/strace - -作者:[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://en.wikipedia.org/wiki/Trap_(computing) diff --git a/translated/tech/20191025 Understanding system calls on Linux with strace.md b/translated/tech/20191025 Understanding system calls on Linux with strace.md new file mode 100644 index 0000000000..80f4e87cd4 --- /dev/null +++ b/translated/tech/20191025 Understanding system calls on Linux with strace.md @@ -0,0 +1,409 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding system calls on Linux with strace) +[#]: via: (https://opensource.com/article/19/10/strace) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +在 Linux 上用 strace 来理解系统调用 +====== + +> 使用 strace 跟踪用户进程和 Linux 内核之间的薄层。 + +![Hand putting a Linux file folder into a drawer][1] + +系统调用system call是程序从内核请求服务的一种编程方式,而 `strace` 是一个功能强大的工具,可让你跟踪用户进程与 Linux 内核之间的薄层。 + +要了解操作系统的工作原理,首先需要了解系统调用的工作原理。操作系统的主要功能之一是为用户程序提供抽象。 + +操作系统可以大致分为两种模式: + +* 内核模式:操作系统内核使用的一种强大的特权模式 +* 用户模式:大多数用户应用程序运行的地方 +   +用户大多使用命令行实用程序和图形用户界面(GUI)来执行日常任务。系统调用在后台静默运行,与内核交互以完成工作。 + +系统调用与函数调用非常相似,这意味着它们接受并处理参数然后返回值。唯一的区别是系统调用进入内核,而函数调用不进入。从用户空间切换到内核空间是使用特殊的 [trap][2] 机制完成的。 + +通过使用系统库(在 Linux 系统上又称为 glibc),系统调用大部分对用户隐藏了。尽管系统调用本质上是通用的,但是发出系统调用的机制在很大程度上取决于机器。 + +本文通过使用一些常规命令并使用 `strace` 分析每个命令进行的系统调用来探索一些实际示例。这些示例使用 Red Hat Enterprise Linux,但是这些命令运行在其他 Linux 发行版上应该也是相同的: + +``` +[root@sandbox ~]# cat /etc/redhat-release +Red Hat Enterprise Linux Server release 7.7 (Maipo) +[root@sandbox ~]# +[root@sandbox ~]# uname -r +3.10.0-1062.el7.x86_64 +[root@sandbox ~]# +``` + +首先,确保在系统上安装了必需的工具。你可以使用下面的 `rpm` 命令来验证是否安装了 `strace`。如果安装了,则可以使用 `-V` 选项检查 `strace` 实用程序的版本号: + +``` +[root@sandbox ~]# rpm -qa | grep -i strace +strace-4.12-9.el7.x86_64 +[root@sandbox ~]# +[root@sandbox ~]# strace -V +strace -- version 4.12 +[root@sandbox ~]# +``` + +如果没有安装,运行命令安装: + +``` +yum install strace +``` + +出于本示例的目的,在 `/tmp` 中创建一个测试目录,并使用 `touch` 命令创建两个文件: + +``` +[root@sandbox ~]# cd /tmp/ +[root@sandbox tmp]# +[root@sandbox tmp]# mkdir testdir +[root@sandbox tmp]# +[root@sandbox tmp]# touch testdir/file1 +[root@sandbox tmp]# touch testdir/file2 +[root@sandbox tmp]# +``` + +(我使用 `/tmp` 目录是因为每个人都可以访问它,但是你可以根据需要选择另一个目录。) + +在 `testdir` 目录下使用 `ls` 命令验证文件已经创建: + +``` +[root@sandbox tmp]# ls testdir/ +file1  file2 +[root@sandbox tmp]# +``` + +你可能每天都使用`ls`命令,而没有意识到系统调用在其下面发生的作用。这里有抽象作用。该命令的工作方式如下: + +``` +Command-line utility -> Invokes functions from system libraries (glibc) -> Invokes system calls +``` + +`ls` 命令在 Linux 上从系统库(即 glibc)内部调用函数。这些库调用完成大部分工作的系统调用。 + +如果你想知道从 glibc 库中调用了哪些函数,请使用 `ltrace` 命令,然后跟上常规的 `ls testdir/`命令: + +``` +ltrace ls testdir/ +``` + +如果没有安装 `ltrace`,键入如下命令安装: + +``` +yum install ltrace +``` + +一堆输出会被显示到屏幕上;不必担心,只需继续就行。`ltrace` 命令输出中与该示例有关的一些重要库函数包括: + + +``` +opendir("testdir/") = { 3 } +readdir({ 3 }) = { 101879119, "." } +readdir({ 3 }) = { 134, ".." } +readdir({ 3 }) = { 101879120, "file1" } +strlen("file1") = 5 +memcpy(0x1665be0, "file1\0", 6) = 0x1665be0 +readdir({ 3 }) = { 101879122, "file2" } +strlen("file2") = 5 +memcpy(0x166dcb0, "file2\0", 6) = 0x166dcb0 +readdir({ 3 }) = nil +closedir({ 3 })                     +``` + +通过查看上面的输出,你或许可以了解正在发生的事情。`opendir` 库函数打开一个名为 `testdir` 的目录,然后调用 `readdir` 函数,该函数读取目录的内容。最后,有一个对 `closedir` 函数的调用,该函数将关闭先前打开的目录。现在先忽略其他 `strlen` 和 `memcpy` 功能。 + +你可以看到正在调用哪些库函数,但是本文将重点介绍由系统库函数调用的系统调用。 + +与上述类似,要了解调用了哪些系统调用,只需将 `strace` 放在 `ls testdir` 命令之前,如下所示。 再次,将一堆乱码丢到了你的屏幕上,你可以按照以下步骤进行操作: + +``` +[root@sandbox tmp]# strace ls testdir/ +execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +brk(NULL) = 0x1f12000 +<<< truncated strace output >>> +write(1, "file1 file2\n", 13file1 file2 +) = 13 +close(1) = 0 +munmap(0x7fd002c8d000, 4096) = 0 +close(2) = 0 +exit_group(0) = ? ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +运行 `strace` 命令后屏幕上的输出只是运行 `ls` 命令的系统调用。每个系统调用都为操作系统提供特定的用途,可以将它们大致分为以下几个部分: + +* 进程管理系统调用 +* 文件管理系统调用 +* 目录和文件系统管理系统调用 +* 其他系统调用 + +分析显示到屏幕上的信息的一种更简单的方法是使用 `strace` 方便使用的 `-o` 标志将输出记录到文件中。在 `-o` 标志后添加一个合适的文件名,然后再次运行命令: + +``` +[root@sandbox tmp]# strace -o trace.log ls testdir/ +file1  file2 +[root@sandbox tmp]# +``` + +这次,没有任何输出干扰屏幕显示,`ls` 命令如预期般工作,显示了文件名并将所有输出记录到文件 `trace.log` 中。仅仅是一个简单的 `ls` 命令,该文件就有近 100 行内容: + +``` +[root@sandbox tmp]# ls -l trace.log +-rw-r--r--. 1 root root 7809 Oct 12 13:52 trace.log +[root@sandbox tmp]# +[root@sandbox tmp]# wc -l trace.log +114 trace.log +[root@sandbox tmp]# +``` + +让我们看一下这个示例的 `trace.log` 文件的第一行: + +``` +execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +``` + +* 该行的第一个单词 `execve` 是正在执行的系统调用的名称。 +* 括号内的文本是提供给该系统调用的参数。 +* 符号 `=` 后的数字(在这种情况下为 `0`)是 `execve` 系统调用的返回值。 + +现在的输出似乎还不太吓人,不是吗?你可以应用相同的逻辑来理解其他行。 + +现在,将关注点集中在你调用的单个命令上,即 `ls testdir`。你知道命令 `ls` 使用的目录名称,那么为什么不在 `trace.log` 文件中使用 `grep` 查找 `testdir` 并查看得到的结果呢?让我们详细查看一下结果的每一行: + +``` +[root@sandbox tmp]# grep testdir trace.log +execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +stat("testdir/", {st_mode=S_IFDIR|0755, st_size=32, ...}) = 0 +openat(AT_FDCWD, "testdir/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 +[root@sandbox tmp]# +``` + +回顾一下上面对 `execve` 的分析,你能说一下这个系统调用的作用吗? + +``` +execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +``` + +你无需记住所有系统调用或它们所做的事情,因为你可以在需要时参考文档。手册页可以解救你!在运行 `man` 命令之前,请确保已安装以下软件包: + +``` +[root@sandbox tmp]# rpm -qa | grep -i man-pages +man-pages-3.53-5.el7.noarch +[root@sandbox tmp]# +``` + +请记住,你需要在 `man` 命令和系统调用名称之间添加 `2`。如果使用 `man man` 阅读 `man` 命令的手册页,你会看到第 2 节是为系统调用保留的。同样,如果你需要有关库函数的信息,则需要在 `man` 和库函数名称之间添加一个 `3`。 + +以下是手册的章节编号及其包含的页面类型: + +* `1`:可执行的程序或 shell 命令 +* `2`:系统调用(由内核提供的函数) +* `3`:库调用(在程序的库内的函数) +* `4`:特殊文件(通常出现在 `/dev`) + +使用系统调用名称运行以下 `man` 命令以查看该系统调用的文档: + +``` +man 2 execve +``` + +按照 `execve` 手册页,这将执行在参数中传递的程序(在本例中为 `ls`)。可以为 `ls` 提供其他参数,例如本例中的 `testdir`。因此,此系统调用仅以 `testdir` 作为参数运行 `ls`: + +``` +execve - execute program + +DESCRIPTION + execve() executes the program pointed to by filename +``` + +下一个系统调用,名为 `stat`,它使用 `testdir` 参数: + +``` +stat("testdir/", {st_mode=S_IFDIR|0755, st_size=32, ...}) = 0 +``` + +使用 `man 2 stat` 访问该文档。`stat` 是获取文件状态的系统调用,请记住,Linux 中的一切都是文件,包括目录。 + +接下来,`openat` 系统调用将打开 `testdir`。密切注意返回的 `3`。这是一个文件描述符,将在以后的系统调用中使用: + +``` +openat(AT_FDCWD, "testdir/", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 +``` + +到现在为止一切都挺好。现在,打开 `trace.log` 文件,并转到 `openat` 系统调用之后的行。你会看到 `getdents` 系统调用被调用,该调用完成了执行 `ls testdir` 命令所需的大部分操作。现在,从 `trace.log` 文件中用 `grep` 获取 `getdents`: + +``` +[root@sandbox tmp]# grep getdents trace.log +getdents(3, /* 4 entries */, 32768)     = 112 +getdents(3, /* 0 entries */, 32768)     = 0 +[root@sandbox tmp]# +``` + +`getdents` 的手册页将其描述为 “获取目录项”,这就是你要执行的操作。注意,`getdents` 的参数是 `3`,这是来自上面 `openat` 系统调用的文件描述符。 + +现在有了目录列表,你需要一种在终端中显示它的方法。因此,在日志中用 `grep` 搜索另一个用于写入终端的系统调用 `write`: + +``` +[root@sandbox tmp]# grep write trace.log +write(1, "file1  file2\n", 13)          = 13 +[root@sandbox tmp]# +``` + +在这些参数中,你可以看到将要显示的文件名:`file1` 和 `file2`。关于第一个参数(`1`),请记住在 Linux 中,当运行任何进程时,默认情况下会为其打开三个文件描述符。以下是默认的文件描述符: + +* `0`:标准输入 +* `1`:标准输出 +* `2`:标准错误 + +因此,`write` 系统调用将在标准显示(这就是终端,由 `1` 所标识的)上显示 `file1` 和 `file2`。 + +现在你知道哪个系统调用完成了 `ls testdir/` 命令的大部分工作。但是在 `trace.log` 文件中其它的 100 多个系统调用呢?操作系统必须做很多内务处理才能运行一个进程,因此,你在该日志文件中看到的很多内容都是进程初始化和清理。阅读整个 `trace.log` 文件,并尝试了解什么使 `ls` 命令可以工作。 + +既然你知道了如何分析给定命令的系统调用,那么就可以将该知识用于其他命令来了解正在执行哪些系统调用。`strace` 提供了许多有用的命令行标志,使你更容易使用,下面将对其中一些进行描述。 + +默认情况下,`strace` 并不包含所有系统调用信息。但是,它有一个方便的 `-v verbose` 选项,可以在每个系统调用中提供附加信息: + +``` +strace -v ls testdir +``` + +在运行 `strace` 命令时始终使用 `-f` 选项是一种好的作法。它允许 `strace` 跟踪由当前正在跟踪的进程创建的任何子进程: + +``` +strace -f ls testdir +``` + +假设你只需要系统调用的名称、运行的次数以及每个系统调用花费的时间百分比。你可以使用 `-c` 标志来获取这些统计信息: + +``` +strace -c ls testdir/ +``` + +假设你想专注于特定的系统调用,例如专注于 `open` 系统调用,而忽略其余部分。你可以使用`-e`标志跟上系统调用的名称: + +``` +[root@sandbox tmp]# strace -e open ls testdir +open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libselinux.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libacl.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3 +open("/lib64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 +open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 +file1  file2 ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +如果你想关注多个系统调用怎么办?不用担心,你同样可以使用 `-e` 命令行标志,并用逗号分隔开两个系统调用。例如,要查看 `write` 和 `getdents` 系统调用: + +``` +[root@sandbox tmp]# strace -e write,getdents ls testdir +getdents(3, /* 4 entries */, 32768)     = 112 +getdents(3, /* 0 entries */, 32768)     = 0 +write(1, "file1  file2\n", 13file1  file2 +)          = 13 ++++ exited with 0 +++ +[root@sandbox tmp]# +``` + +到目前为止,这些示例已明确跟踪了运行的命令。但是,要跟踪已经运行并正在执行的命令又怎么办呢?例如,如果要跟踪只是长时间运行的进程的守护程序,该怎么办?为此,`strace` 提供了一个特殊的 `-p` 标志,你可以向其提供进程 ID。 + +不用在守护程序上运行 `strace`,而是以 `cat` 命令为例,如果你将文件名作为参数,通常会显示文件的内容。如果没有给出参数,`cat` 命令会在终端上等待用户输入文本。输入文本后,它将重复给定的文本,直到用户按下 `Ctrl + C` 退出为止。 + +从一个终端运行 `cat` 命令;它会向你显示一个提示,而等待在那里(记住 `cat` 仍在运行且尚未退出): + +``` +[root@sandbox tmp]# cat +``` + +在另一个终端上,使用 `ps` 命令找到进程标识符(PID): + +``` +[root@sandbox ~]# ps -ef | grep cat +root      22443  20164  0 14:19 pts/0    00:00:00 cat +root      22482  20300  0 14:20 pts/1    00:00:00 grep --color=auto cat +[root@sandbox ~]# +``` + +现在,使用 `-p` 标志和 PID(在上面使用 `ps` 找到)对运行中的进程运行 `strace`。运行 `strace` 之后,其输出说明了所接驳的进程的内容及其 PID。现在,`strace` 正在跟踪 `cat` 命令进行的系统调用。看到的第一个系统调用是 `read`,它正在等待文件描述符 `0`(标准输入,这是运行 `cat` 命令的终端)的输入: + +``` +[root@sandbox ~]# strace -p 22443 +strace: Process 22443 attached +read(0, +``` + +现在,返回到你使 `cat` 命令运行的终端,并输入一些文本。我出于演示目的输入了 `x0x0`。注意 `cat` 是如何简单地重复我输入的内容。因此,`x0x0` 出现了两次。我输入了第一个,第二个是 `cat` 命令重复的输出: + +``` +[root@sandbox tmp]# cat +x0x0 +x0x0 +``` + +返回到将 `strace` 接驳到 `cat` 进程的终端。现在你会看到两个额外的系统调用:较早的 `read` 系统调用,现在在终端中读取 `x0x0`,另一个为 `write`,将 `x0x0` 写回到终端,然后是再一个新的 `read`,正在等待从终端读取。请注意,标准输入(`0`)和标准输出(`1`)都在同一终端中: + +``` +[root@sandbox ~]# strace -p 22443 +strace: Process 22443 attached +read(0, "x0x0\n", 65536)                = 5 +write(1, "x0x0\n", 5)                   = 5 +read(0, +``` + +想象一下,对守护进程运行 `strace` 以查看其在后台执行的所有操作时这有多大帮助。按下 `Ctrl + C` 杀死 `cat` 命令;由于该进程不再运行,因此这也会终止你的 `strace` 会话。 + +如果要查看所有的系统调用的时间戳,只需将 `-t` 选项与 `strace` 一起使用: + +``` +[root@sandbox ~]#strace -t ls testdir/ + +14:24:47 execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +14:24:47 brk(NULL)                      = 0x1f07000 +14:24:47 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2530bc8000 +14:24:47 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +14:24:47 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +``` + +如果你想知道两次系统调用之间所花费的时间怎么办?`strace` 有一个方便的 `-r` 命令,该命令显示执行每个系统调用所花费的时间。非常有用,不是吗? + +``` +[root@sandbox ~]#strace -r ls testdir/ + +0.000000 execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 +0.000368 brk(NULL)                 = 0x1966000 +0.000073 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb6b1155000 +0.000047 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +0.000119 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +``` + +### 总结 + +`strace` 实用程序非常有助于理解 Linux 上的系统调用。要了解它的其它命令行标志,请参考手册页和在线文档。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/strace + +作者:[Gaurav Kamathe][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/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://en.wikipedia.org/wiki/Trap_(computing) From 74a86929c5990550dae61e8f24c0198b55758926 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 6 Nov 2019 09:16:05 +0800 Subject: [PATCH 325/800] translated --- ... with awk, a powerful text-parsing tool.md | 168 ------------------ ... with awk, a powerful text-parsing tool.md | 165 +++++++++++++++++ 2 files changed, 165 insertions(+), 168 deletions(-) delete mode 100644 sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md create mode 100644 translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md diff --git a/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md b/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md deleted file mode 100644 index 387dcf8fcd..0000000000 --- a/sources/tech/20191030 Getting started with awk, a powerful text-parsing tool.md +++ /dev/null @@ -1,168 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with awk, a powerful text-parsing tool) -[#]: via: (https://opensource.com/article/19/10/intro-awk) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Getting started with awk, a powerful text-parsing tool -====== -Let's jump in and start using it. -![Woman programming][1] - -Awk is a powerful text-parsing tool for Unix and Unix-like systems, but because it has programmed functions that you can use to perform common parsing tasks, it's also considered a programming language. You probably won't be developing your next GUI application with awk, and it likely won't take the place of your default scripting language, but it's a powerful utility for specific tasks. - -What those tasks may be is surprisingly diverse. The best way to discover which of your problems might be best solved by awk is to learn awk; you'll be surprised at how awk can help you get more done but with a lot less effort. - -Awk's basic syntax is: - - -``` -`awk [options] 'pattern {action}' file` -``` - -To get started, create this sample file and save it as **colours.txt** - - -``` -name       color  amount -apple      red    4 -banana     yellow 6 -strawberry red    3 -grape      purple 10 -apple      green  8 -plum       purple 2 -kiwi       brown  4 -potato     brown  9 -pineapple  yellow 5 -``` - -This data is separated into columns by one or more spaces. It's common for data that you are analyzing to be organized in some way. It may not always be columns separated by whitespace, or even a comma or semicolon, but especially in log files or data dumps, there's generally a predictable pattern. You can use patterns of data to help awk extract and process the data that you want to focus on. - -### Printing a column - -In awk, the **print** function displays whatever you specify. There are many predefined variables you can use, but some of the most common are integers designating columns in a text file. Try it out: - - -``` -$ awk '{print $2;}' colours.txt -color -red -yellow -red -purple -green -purple -brown -brown -yellow -``` - -In this case, awk displays the second column, denoted by **$2**. This is relatively intuitive, so you can probably guess that **print $1** displays the first column, and **print $3** displays the third, and so on. - -To display _all_ columns, use **$0**. - -The number after the dollar sign (**$**) is an _expression_, so **$2** and **$(1+1)** mean the same thing. - -### Conditionally selecting columns - -The example file you're using is very structured. It has a row that serves as a header, and the columns relate directly to one another. By defining _conditional_ requirements, you can qualify what you want awk to return when looking at this data. For instance, to view items in column 2 that match "yellow" and print the contents of column 1: - - -``` -awk '$2=="yellow"{print $1}' file1.txt -banana -pineapple -``` - -Regular expressions work as well. This conditional looks at **$2** for approximate matches to the letter **p** followed by any number of (one or more) characters, which are in turn followed by the letter **p**: - - -``` -$ awk '$2 ~ /p.+p/ {print $0}' colours.txt -grape   purple  10 -plum    purple  2 -``` - -Numbers are interpreted naturally by awk. For instance, to print any row with a third column containing an integer greater than 5: - - -``` -awk '$3>5 {print $1, $2}' colours.txt -name    color -banana  yellow -grape   purple -apple   green -potato  brown -``` - -### Field separator - -By default, awk uses whitespace as the field separator. Not all text files use whitespace to define fields, though. For example, create a file called **colours.csv** with this content: - - -``` -name,color,amount -apple,red,4 -banana,yellow,6 -strawberry,red,3 -grape,purple,10 -apple,green,8 -plum,purple,2 -kiwi,brown,4 -potato,brown,9 -pineapple,yellow,5 -``` - -Awk can treat the data in exactly the same way, as long as you specify which character it should use as the field separator in your command. Use the **\--field-separator** (or just **-F** for short) option to define the delimiter: - - -``` -$ awk -F"," '$2=="yellow" {print $1}' file1.csv -banana -pineapple -``` - -### Saving output - -Using output redirection, you can write your results to a file. For example: - - -``` -`$ awk -F, '$3>5 {print $1, $2} colours.csv > output.txt` -``` - -This creates a file with the contents of your awk query. - -You can also split a file into multiple files grouped by column data. For example, if you want to split colours.txt into multiple files according to what color appears in each row, you can cause awk to redirect _per query_ by including the redirection in your awk statement: - - -``` -`$ awk '{print > $2".txt"}' colours.txt` -``` - -This produces files named **yellow.txt**, **red.txt**, and so on. - -In the next article, you'll learn more about fields, records, and some powerful awk variables. - -* * * - -This article is adapted from an episode of [Hacker Public Radio][2], a community technology podcast. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/intro-awk - -作者:[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/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) -[2]: http://hackerpublicradio.org/eps.php?id=2114 diff --git a/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md b/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md new file mode 100644 index 0000000000..fa1e4bd236 --- /dev/null +++ b/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with awk, a powerful text-parsing tool) +[#]: via: (https://opensource.com/article/19/10/intro-awk) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +awk 入门,强大的文本分析工具 +====== +让我们开始使用它。 +![Woman programming][1] + +awk 是用于 Unix 和类 Unix 系统的强大文本解析工具,但是由于它有可编程函数,因此你可以用它来执行常规解析任务,因此它也被视为一种编程语言。你可能不会使用 awk 开发下一个 GUI 应用,并且它可能不会代替你的默认脚本语言,但是它是用于特定任务的强大程序。 + +这些任务或许是惊人的多样化。了解 awk 可以很好解决你的哪些问题的最好方法是学习 awk。你会惊讶于 awk 如何帮助你完成更多工作,却花费更少的精力。 + +awk 的基本语法是: + +``` +`awk [options] 'pattern {action}' file` +``` + +首先,创建此示例文件并将其保存为 **colours.txt** + +``` +name       color  amount +apple      red    4 +banana     yellow 6 +strawberry red    3 +grape      purple 10 +apple      green  8 +plum       purple 2 +kiwi       brown  4 +potato     brown  9 +pineapple  yellow 5 +``` + +数据被一个或多个空格分隔为列。以某种方式组织要分析的数据是很常见的。它不一定总是由空格分隔的列,甚至不是逗号或分号,但尤其是在日志文件或数据转储中,通常有一个可预测的格式。你可以使用数据格式来帮助 awk 提取和处理你关注的数据。 + +### 打印列 + +在 awk 中,**print** 函数显示你指定的内容。你可以使用许多预定义的变量,但是最常见的是文本文件中指定的列数。试试看: + + +``` +$ awk '{print $2;}' colours.txt +color +red +yellow +red +purple +green +purple +brown +brown +yellow +``` + +在这里,awk 显示第二列,用 **$2** 表示。这是相对直观的,因此你可能会猜测 **print $1** 显示第一列,而 **print $3** 显示第三列,依此类推。 + +要显示_全部_列,请使用 **$0**。 + +美元符号(**$**)后的数字是_表达式_,因此 **$2**和 **$(1+1)** 是同一意思。 + +### 有条件地选择列 + +你使用的示例文件非常结构化。它有一行充当标题,并且各列直接相互关联。通过定义_条件_,你可以限定 awk 在找到此数据时返回的内容。例如,要查看第 2 列中与 “yellow” 匹配的项并打印第 1 列的内容: + +``` +awk '$2=="yellow"{print $1}' file1.txt +banana +pineapple +``` + +正则表达式也可以工作。此表达式近似匹配 **$2** 中以 **p** 开头跟上任意数量(一个或多个)字符后继续跟上 **p** 的值: + + +``` +$ awk '$2 ~ /p.+p/ {print $0}' colours.txt +grape   purple  10 +plum    purple  2 +``` + +数字能被 awk 自然解释。例如,要打印第三列包含大于 5 的整数的行: + + +``` +awk '$3>5 {print $1, $2}' colours.txt +name    color +banana  yellow +grape   purple +apple   green +potato  brown +``` + +### 字段分隔符 + +默认情况下,awk 使用空格作为字段分隔符。但是,并非所有文本文件都使用空格来定义字段。例如,用以下内容创建一个名为 **colours.csv** 的文件: + + +``` +name,color,amount +apple,red,4 +banana,yellow,6 +strawberry,red,3 +grape,purple,10 +apple,green,8 +plum,purple,2 +kiwi,brown,4 +potato,brown,9 +pineapple,yellow,5 +``` + +只要你指定将哪个字符用作命令中的字段分隔符,awk 就能以完全相同的方式处理数据。使用 **\--field-separator**(或简称为 **-F**)选项来定义分隔符: + + +``` +$ awk -F"," '$2=="yellow" {print $1}' file1.csv +banana +pineapple +``` + +### 保存输出 + +使用输出重定向,你可以将结果写入文件。例如: + + +``` +`$ awk -F, '$3>5 {print $1, $2} colours.csv > output.txt` +``` + +这将创建一个包含 awk 查询内容的文件。 + +你还可以将文件拆分为按列数据分组的多个文件。例如,如果要根据每行显示的颜色将 colours.txt 拆分为多个文件,你可以在 awk 中包含重定向语句来重定向_每条查询_: + + +``` +`$ awk '{print > $2".txt"}' colours.txt` +``` + +这将生成名为 **yellow.txt**,**red.txt** 等文件。 + +在下一篇文章中,你将了解有关字段,记录和一些强大的 awk 变量的更多信息。 + +* * * + +本文改编自社区技术播客 [Hacker Public Radio][2]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/intro-awk + +作者:[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/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: http://hackerpublicradio.org/eps.php?id=2114 From 037b7129c0dd3c9ff05ff6d1a205b6e5f4bf5402 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 6 Nov 2019 09:26:04 +0800 Subject: [PATCH 326/800] translating --- ...20191104 Cloning a MAC address to bypass a captive portal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md b/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md index a52ca3d142..065ee17339 100644 --- a/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md +++ b/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 85c19e9b0cc94ec6a4ef6fc96caeacdb74bd92b0 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Nov 2019 10:20:42 +0800 Subject: [PATCH 327/800] Rename sources/talk/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md to sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md --- ...Red Hat announces RHEL 8.1 with predictable release cadence.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => news}/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md (100%) diff --git a/sources/talk/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md b/sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md similarity index 100% rename from sources/talk/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md rename to sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md From b985ed08d1efdb7812328fc688e9b90a475a2d8a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Nov 2019 10:24:42 +0800 Subject: [PATCH 328/800] Rename sources/tech/20191105 System76 introduces laptops with open source BIOS coreboot.md to sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md --- ... System76 introduces laptops with open source BIOS coreboot.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191105 System76 introduces laptops with open source BIOS coreboot.md (100%) diff --git a/sources/tech/20191105 System76 introduces laptops with open source BIOS coreboot.md b/sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md similarity index 100% rename from sources/tech/20191105 System76 introduces laptops with open source BIOS coreboot.md rename to sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md From 95d7f627aaf3d4ec7e52c3632e632c45d134ec10 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Nov 2019 10:26:10 +0800 Subject: [PATCH 329/800] Rename sources/tech/20191105 Conquering documentation challenges on a massive project.md to sources/talk/20191105 Conquering documentation challenges on a massive project.md --- ...05 Conquering documentation challenges on a massive project.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191105 Conquering documentation challenges on a massive project.md (100%) diff --git a/sources/tech/20191105 Conquering documentation challenges on a massive project.md b/sources/talk/20191105 Conquering documentation challenges on a massive project.md similarity index 100% rename from sources/tech/20191105 Conquering documentation challenges on a massive project.md rename to sources/talk/20191105 Conquering documentation challenges on a massive project.md From fb8524571760d3e820cf2134fd6d98d9cdde01b9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Nov 2019 10:26:59 +0800 Subject: [PATCH 330/800] Rename sources/tech/20191105 Open by nature- What building a platform for activists taught me about playful development.md to sources/talk/20191105 Open by nature- What building a platform for activists taught me about playful development.md --- ... platform for activists taught me about playful development.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191105 Open by nature- What building a platform for activists taught me about playful development.md (100%) diff --git a/sources/tech/20191105 Open by nature- What building a platform for activists taught me about playful development.md b/sources/talk/20191105 Open by nature- What building a platform for activists taught me about playful development.md similarity index 100% rename from sources/tech/20191105 Open by nature- What building a platform for activists taught me about playful development.md rename to sources/talk/20191105 Open by nature- What building a platform for activists taught me about playful development.md From 1e056815213c30cd267a35d6ab30ad14492f346f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 6 Nov 2019 10:27:46 +0800 Subject: [PATCH 331/800] Rename sources/tech/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md to sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md --- ...ck, Linus says no and reads email, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md (100%) diff --git a/sources/tech/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md b/sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md similarity index 100% rename from sources/tech/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md rename to sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md From f53fa532c97cc0732aa114cb7ddce5b5a1436840 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 11:02:14 +0800 Subject: [PATCH 332/800] PRF @lnrCoder --- ...Top Memory Consuming Processes in Linux.md | 54 ++++++------------- 1 file changed, 17 insertions(+), 37 deletions(-) diff --git a/translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md b/translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md index bc2da3f7d0..c64c5a8a23 100644 --- a/translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md +++ b/translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md @@ -1,40 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Find Out Top Memory Consuming Processes in Linux) [#]: via: (https://www.2daygeek.com/linux-find-top-memory-consuming-processes/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -如何在 Linux 中找出内存消耗最高的进程 +如何在 Linux 中找出内存消耗最大的进程 ====== -你可能已经见过系统多次消耗过多的内存。 +![](https://img.linux.net.cn/data/attachment/album/201911/06/110149r81efjx12afjat7f.jpg) -如果是这种情况,那么最好的办法是识别出 Linux 机器上消耗过多内存的进程。 +很多次,你可能遇见过系统消耗了过多的内存。如果是这种情况,那么最好的办法是识别出 Linux 机器上消耗过多内存的进程。我相信,你可能已经运行了下文中的命令以进行检查。如果没有,那你尝试过哪些其他的命令?我希望你可以在评论中更新这篇文章,它可能会帮助其他用户。 -我相信,你可能已经运行了以下命令以进行检查。 - -如果没有,那你尝试过哪些其他的命令? - -我请求你更新它在评论中进行更新,它可能会帮助其他用户。 - -使用 **[top 命令][1]** 和 **[ps 命令][2]** 可以轻松的识别。 - -我过去经常同时使用这两个命令,两个命令得到的结果是相同的。 - -所以我建议你从中选择一个喜欢的使用就可以。 +使用 [top 命令][1] 和 [ps 命令][2] 可以轻松的识别这种情况。我过去经常同时使用这两个命令,两个命令得到的结果是相同的。所以我建议你从中选择一个喜欢的使用就可以。 ### 1) 如何使用 ps 命令在 Linux 中查找内存消耗最大的进程 -ps 命令用于报告当前进程的快照。ps 命令代表进程状态。 +`ps` 命令用于报告当前进程的快照。`ps` 命令的意思是“进程状态”。这是一个标准的 Linux 应用程序,用于查找有关在 Linux 系统上运行进程的信息。 -这是一个标准的 Linux 应用程序,用于查找有关在 Linux 系统上运行进程的信息。 +它用于列出当前正在运行的进程及其进程 ID(PID)、进程所有者名称、进程优先级(PR)以及正在运行的命令的绝对路径等。 -它用于列出当前正在运行的进程及其进程 ID(PID),进程所有者名称,进程优先级(PR)以及正在运行的命令的绝对路径等。 - -下面的 ps 命令格式为你提供有关内存消耗最大进程的更多信息。 +下面的 `ps` 命令格式为你提供有关内存消耗最大进程的更多信息。 ``` # ps aux --sort -rss | head @@ -51,7 +39,7 @@ root 1135 0.0 0.9 86708 37572 ? S 05:37 0:20 cwpsrv: worker root 1133 0.0 0.9 86708 37544 ? S 05:37 0:05 cwpsrv: worker process ``` -使用以下 ps 命令格式可在输出中仅展示有关内存消耗过程的特定信息。 +使用以下 `ps` 命令格式可在输出中仅展示有关内存消耗过程的特定信息。 ``` # ps -eo pid,ppid,%mem,%cpu,cmd --sort=-%mem | head @@ -68,7 +56,7 @@ root 1133 0.0 0.9 86708 37544 ? S 05:37 0:05 cwpsrv: worker 1135 3034 0.9 0.0 cwpsrv: worker process ``` -如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 ps 命令格式。 +如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 `ps` 命令格式。 ``` # ps -eo pid,ppid,%mem,%cpu,comm --sort=-%mem | head @@ -87,13 +75,9 @@ root 1133 0.0 0.9 86708 37544 ? S 05:37 0:05 cwpsrv: worker ### 2) 如何使用 top 命令在 Linux 中查找内存消耗最大的进程 -Linux 的 top 命令是用来监视 Linux 系统性能的最好和最知名的命令。 +Linux 的 `top` 命令是用来监视 Linux 系统性能的最好和最知名的命令。它在交互界面上显示运行的系统进程的实时视图。但是,如果要查找内存消耗最大的进程,请 [在批处理模式下使用 top 命令][3]。 -它在交互界面上显示运行的系统进程的实时视图。 - -但是,如果要查找内存消耗最大的进程,请 **[在批处理模式下使用 top 命令][3]**。 - -你应该正确地 **[了解 top 命令输出][4]** 以解决系统中的性能问题。 +你应该正确地 [了解 top 命令输出][4] 以解决系统中的性能问题。 ``` # top -c -b -o +%MEM | head -n 20 | tail -15 @@ -114,7 +98,7 @@ Linux 的 top 命令是用来监视 Linux 系统性能的最好和最知名的 968 nobody 20 0 1356216 30544 2348 S 0.0 0.8 0:19.95 /usr/local/apache/bin/httpd -k start ``` -如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 top 命令格式。 +如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 `top` 命令格式。 ``` # top -b -o +%MEM | head -n 20 | tail -15 @@ -137,13 +121,9 @@ Linux 的 top 命令是用来监视 Linux 系统性能的最好和最知名的 ### 3) 温馨提示:如何使用 ps_mem 命令在 Linux 中查找内存消耗最大的进程 -**[ps_mem 程序][5]** 用于显示每个程序(而不是每个进程)使用的核心内存。 +[ps_mem 程序][5] 用于显示每个程序(而不是每个进程)使用的核心内存。该程序允许你检查每个程序使用了多少内存。它根据程序计算私有和共享内存的数量,并以最合适的方式返回已使用的总内存。 -该程序允许你检查每个程序使用了多少内存。 - -它根据程序计算私有和共享内存的数量,并以最合适的方式返回已使用的总内存。 - -它使用以下逻辑来计算内存使用量。 总内存使用量 = 用于程序处理的专用内存使用量 + 用于程序处理的共享内存使用量 +它使用以下逻辑来计算内存使用量。总内存使用量 = sum(用于程序进程的专用内存使用量) + sum(用于程序进程的共享内存使用量)。 ``` # ps_mem @@ -205,7 +185,7 @@ via: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[lnrCoder](https://github.com/lnrCoder) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -213,6 +193,6 @@ via: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ [b]: https://github.com/lujun9972 [1]: https://www.2daygeek.com/linux-top-command-linux-system-performance-monitoring-tool/ [2]: https://www.2daygeek.com/linux-ps-command-find-running-process-monitoring/ -[3]: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/ +[3]: https://linux.cn/article-11491-1.html [4]: https://www.2daygeek.com/understanding-linux-top-command-output-usage/ [5]: https://www.2daygeek.com/ps_mem-report-core-memory-usage-accurately-in-linux/ From ddaed152d67188ebdbb42ddeaa950f4a226ad8cb Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 11:02:56 +0800 Subject: [PATCH 333/800] PUB @lnrCoder https://linux.cn/article-11542-1.html --- ...How to Find Out Top Memory Consuming Processes in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191030 How to Find Out Top Memory Consuming Processes in Linux.md (99%) diff --git a/translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md b/published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md similarity index 99% rename from translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md rename to published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md index c64c5a8a23..78d3bada80 100644 --- a/translated/tech/20191030 How to Find Out Top Memory Consuming Processes in Linux.md +++ b/published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (lnrCoder) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11542-1.html) [#]: subject: (How to Find Out Top Memory Consuming Processes in Linux) [#]: via: (https://www.2daygeek.com/linux-find-top-memory-consuming-processes/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 487407345210b2c20a5718175c8f37826a3a2da5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 11:05:00 +0800 Subject: [PATCH 334/800] PRF --- ...0 How to Find Out Top Memory Consuming Processes in Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md b/published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md index 78d3bada80..2268cb8f17 100644 --- a/published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md +++ b/published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md @@ -119,7 +119,7 @@ Linux 的 `top` 命令是用来监视 Linux 系统性能的最好和最知名的 968 nobody 20 0 1356216 30544 2348 S 0.0 0.8 0:19.95 httpd ``` -### 3) 温馨提示:如何使用 ps_mem 命令在 Linux 中查找内存消耗最大的进程 +### 3) 奖励技巧:如何使用 ps_mem 命令在 Linux 中查找内存消耗最大的进程 [ps_mem 程序][5] 用于显示每个程序(而不是每个进程)使用的核心内存。该程序允许你检查每个程序使用了多少内存。它根据程序计算私有和共享内存的数量,并以最合适的方式返回已使用的总内存。 From 17ab89724a175382be2526e176f26d468a178a64 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 11:44:40 +0800 Subject: [PATCH 335/800] PRF @geekpi --- ... with awk, a powerful text-parsing tool.md | 61 ++++++++----------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md b/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md index fa1e4bd236..55ce6b7651 100644 --- a/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md +++ b/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md @@ -1,28 +1,30 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with awk, a powerful text-parsing tool) [#]: via: (https://opensource.com/article/19/10/intro-awk) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -awk 入门,强大的文本分析工具 +awk 入门 —— 强大的文本分析工具 ====== -让我们开始使用它。 -![Woman programming][1] -awk 是用于 Unix 和类 Unix 系统的强大文本解析工具,但是由于它有可编程函数,因此你可以用它来执行常规解析任务,因此它也被视为一种编程语言。你可能不会使用 awk 开发下一个 GUI 应用,并且它可能不会代替你的默认脚本语言,但是它是用于特定任务的强大程序。 +> 让我们开始使用它。 -这些任务或许是惊人的多样化。了解 awk 可以很好解决你的哪些问题的最好方法是学习 awk。你会惊讶于 awk 如何帮助你完成更多工作,却花费更少的精力。 +![](https://img.linux.net.cn/data/attachment/album/201911/06/114421e006e9mbh0xxe8bb.jpg) -awk 的基本语法是: +`awk` 是用于 Unix 和类 Unix 系统的强大文本解析工具,但是由于它有可编程函数,因此你可以用它来执行常规解析任务,因此它也被视为一种编程语言。你可能不会使用 `awk` 开发下一个 GUI 应用,并且它可能不会代替你的默认脚本语言,但是它是用于特定任务的强大程序。 + +这些任务或许是惊人的多样化。了解 `awk` 可以解决你的哪些问题的最好方法是学习 `awk`。你会惊讶于 `awk` 如何帮助你完成更多工作,却花费更少的精力。 + +`awk` 的基本语法是: ``` -`awk [options] 'pattern {action}' file` +awk [options] 'pattern {action}' file ``` -首先,创建此示例文件并将其保存为 **colours.txt** +首先,创建此示例文件并将其保存为 `colours.txt`。 ``` name       color  amount @@ -37,12 +39,11 @@ potato     brown  9 pineapple  yellow 5 ``` -数据被一个或多个空格分隔为列。以某种方式组织要分析的数据是很常见的。它不一定总是由空格分隔的列,甚至不是逗号或分号,但尤其是在日志文件或数据转储中,通常有一个可预测的格式。你可以使用数据格式来帮助 awk 提取和处理你关注的数据。 +数据被一个或多个空格分隔为列。以某种方式组织要分析的数据是很常见的。它不一定总是由空格分隔的列,甚至可以不是逗号或分号,但尤其是在日志文件或数据转储中,通常有一个可预测的格式。你可以使用数据格式来帮助 `awk` 提取和处理你关注的数据。 ### 打印列 -在 awk 中,**print** 函数显示你指定的内容。你可以使用许多预定义的变量,但是最常见的是文本文件中指定的列数。试试看: - +在 `awk` 中,`print` 函数显示你指定的内容。你可以使用许多预定义的变量,但是最常见的是文本文件中以整数命名的列。试试看: ``` $ awk '{print $2;}' colours.txt @@ -58,15 +59,15 @@ brown yellow ``` -在这里,awk 显示第二列,用 **$2** 表示。这是相对直观的,因此你可能会猜测 **print $1** 显示第一列,而 **print $3** 显示第三列,依此类推。 +在这里,`awk` 显示第二列,用 `$2` 表示。这是相对直观的,因此你可能会猜测 `print $1` 显示第一列,而 `print $3` 显示第三列,依此类推。 -要显示_全部_列,请使用 **$0**。 +要显示*全部*列,请使用 `$0`。 -美元符号(**$**)后的数字是_表达式_,因此 **$2**和 **$(1+1)** 是同一意思。 +美元符号(`$`)后的数字是*表达式*,因此 `$2` 和 `$(1+1)` 是同一意思。 ### 有条件地选择列 -你使用的示例文件非常结构化。它有一行充当标题,并且各列直接相互关联。通过定义_条件_,你可以限定 awk 在找到此数据时返回的内容。例如,要查看第 2 列中与 “yellow” 匹配的项并打印第 1 列的内容: +你使用的示例文件非常结构化。它有一行充当标题,并且各列直接相互关联。通过定义*条件*,你可以限定 `awk` 在找到此数据时返回的内容。例如,要查看第二列中与 `yellow` 匹配的项并打印第一列的内容: ``` awk '$2=="yellow"{print $1}' file1.txt @@ -74,8 +75,7 @@ banana pineapple ``` -正则表达式也可以工作。此表达式近似匹配 **$2** 中以 **p** 开头跟上任意数量(一个或多个)字符后继续跟上 **p** 的值: - +正则表达式也可以工作。此表达式近似匹配 `$2` 中以 `p` 开头跟上任意数量(一个或多个)字符后继续跟上 `p` 的值: ``` $ awk '$2 ~ /p.+p/ {print $0}' colours.txt @@ -83,8 +83,7 @@ grape   purple  10 plum    purple  2 ``` -数字能被 awk 自然解释。例如,要打印第三列包含大于 5 的整数的行: - +数字能被 `awk` 自然解释。例如,要打印第三列包含大于 5 的整数的行: ``` awk '$3>5 {print $1, $2}' colours.txt @@ -97,8 +96,7 @@ potato  brown ### 字段分隔符 -默认情况下,awk 使用空格作为字段分隔符。但是,并非所有文本文件都使用空格来定义字段。例如,用以下内容创建一个名为 **colours.csv** 的文件: - +默认情况下,`awk` 使用空格作为字段分隔符。但是,并非所有文本文件都使用空格来定义字段。例如,用以下内容创建一个名为 `colours.csv` 的文件: ``` name,color,amount @@ -113,8 +111,7 @@ potato,brown,9 pineapple,yellow,5 ``` -只要你指定将哪个字符用作命令中的字段分隔符,awk 就能以完全相同的方式处理数据。使用 **\--field-separator**(或简称为 **-F**)选项来定义分隔符: - +只要你指定将哪个字符用作命令中的字段分隔符,`awk` 就能以完全相同的方式处理数据。使用 `--field-separator`(或简称为 `-F`)选项来定义分隔符: ``` $ awk -F"," '$2=="yellow" {print $1}' file1.csv @@ -126,26 +123,22 @@ pineapple 使用输出重定向,你可以将结果写入文件。例如: - ``` -`$ awk -F, '$3>5 {print $1, $2} colours.csv > output.txt` +$ awk -F, '$3>5 {print $1, $2} colours.csv > output.txt ``` -这将创建一个包含 awk 查询内容的文件。 - -你还可以将文件拆分为按列数据分组的多个文件。例如,如果要根据每行显示的颜色将 colours.txt 拆分为多个文件,你可以在 awk 中包含重定向语句来重定向_每条查询_: +这将创建一个包含 `awk` 查询内容的文件。 +你还可以将文件拆分为按列数据分组的多个文件。例如,如果要根据每行显示的颜色将 `colours.txt` 拆分为多个文件,你可以在 `awk` 中包含重定向语句来重定向*每条查询*: ``` -`$ awk '{print > $2".txt"}' colours.txt` +$ awk '{print > $2".txt"}' colours.txt ``` -这将生成名为 **yellow.txt**,**red.txt** 等文件。 +这将生成名为 `yellow.txt`、`red.txt` 等文件。 在下一篇文章中,你将了解有关字段,记录和一些强大的 awk 变量的更多信息。 -* * * - 本文改编自社区技术播客 [Hacker Public Radio][2]。 -------------------------------------------------------------------------------- @@ -155,7 +148,7 @@ via: https://opensource.com/article/19/10/intro-awk 作者:[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 44b94d57a0f4785a7eaed557b61a765a8f5996bf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 11:45:33 +0800 Subject: [PATCH 336/800] PUB @geekpi https://linux.cn/article-11543-1.html --- ... Getting started with awk, a powerful text-parsing tool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191030 Getting started with awk, a powerful text-parsing tool.md (98%) diff --git a/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md b/published/20191030 Getting started with awk, a powerful text-parsing tool.md similarity index 98% rename from translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md rename to published/20191030 Getting started with awk, a powerful text-parsing tool.md index 55ce6b7651..14571dd892 100644 --- a/translated/tech/20191030 Getting started with awk, a powerful text-parsing tool.md +++ b/published/20191030 Getting started with awk, a powerful text-parsing tool.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11543-1.html) [#]: subject: (Getting started with awk, a powerful text-parsing tool) [#]: via: (https://opensource.com/article/19/10/intro-awk) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 823334ef73d5bf5ab2da9231dc884e02b519ce9d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 13:13:51 +0800 Subject: [PATCH 337/800] PRF --- ...nding system calls on Linux with strace.md | 59 +++++++++---------- 1 file changed, 28 insertions(+), 31 deletions(-) diff --git a/translated/tech/20191025 Understanding system calls on Linux with strace.md b/translated/tech/20191025 Understanding system calls on Linux with strace.md index 80f4e87cd4..89db6d01db 100644 --- a/translated/tech/20191025 Understanding system calls on Linux with strace.md +++ b/translated/tech/20191025 Understanding system calls on Linux with strace.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Understanding system calls on Linux with strace) @@ -10,13 +10,13 @@ 在 Linux 上用 strace 来理解系统调用 ====== -> 使用 strace 跟踪用户进程和 Linux 内核之间的薄层。 +> 使用 strace 跟踪用户进程和 Linux 内核之间的交互。 ![Hand putting a Linux file folder into a drawer][1] -系统调用system call是程序从内核请求服务的一种编程方式,而 `strace` 是一个功能强大的工具,可让你跟踪用户进程与 Linux 内核之间的薄层。 +系统调用system call是程序从内核请求服务的一种编程方式,而 `strace` 是一个功能强大的工具,可让你跟踪用户进程与 Linux 内核之间的交互。 -要了解操作系统的工作原理,首先需要了解系统调用的工作原理。操作系统的主要功能之一是为用户程序提供抽象。 +要了解操作系统的工作原理,首先需要了解系统调用的工作原理。操作系统的主要功能之一是为用户程序提供抽象机制。 操作系统可以大致分为两种模式: @@ -25,9 +25,9 @@    用户大多使用命令行实用程序和图形用户界面(GUI)来执行日常任务。系统调用在后台静默运行,与内核交互以完成工作。 -系统调用与函数调用非常相似,这意味着它们接受并处理参数然后返回值。唯一的区别是系统调用进入内核,而函数调用不进入。从用户空间切换到内核空间是使用特殊的 [trap][2] 机制完成的。 +系统调用与函数调用非常相似,这意味着它们都接受并处理参数然后返回值。唯一的区别是系统调用进入内核,而函数调用不进入。从用户空间切换到内核空间是使用特殊的 [trap][2] 机制完成的。 -通过使用系统库(在 Linux 系统上又称为 glibc),系统调用大部分对用户隐藏了。尽管系统调用本质上是通用的,但是发出系统调用的机制在很大程度上取决于机器。 +通过使用系统库(在 Linux 系统上又称为 glibc),大部分系统调用对用户隐藏了。尽管系统调用本质上是通用的,但是发出系统调用的机制在很大程度上取决于机器(架构)。 本文通过使用一些常规命令并使用 `strace` 分析每个命令进行的系统调用来探索一些实际示例。这些示例使用 Red Hat Enterprise Linux,但是这些命令运行在其他 Linux 发行版上应该也是相同的: @@ -71,7 +71,7 @@ yum install strace (我使用 `/tmp` 目录是因为每个人都可以访问它,但是你可以根据需要选择另一个目录。) -在 `testdir` 目录下使用 `ls` 命令验证文件已经创建: +在 `testdir` 目录下使用 `ls` 命令验证该文件已经创建: ``` [root@sandbox tmp]# ls testdir/ @@ -79,13 +79,11 @@ file1  file2 [root@sandbox tmp]# ``` -你可能每天都使用`ls`命令,而没有意识到系统调用在其下面发生的作用。这里有抽象作用。该命令的工作方式如下: +你可能每天都在使用 `ls` 命令,而没有意识到系统调用在其下面发挥的作用。抽象地来说,该命令的工作方式如下: -``` -Command-line utility -> Invokes functions from system libraries (glibc) -> Invokes system calls -``` +> 命令行工具 -> 从系统库(glibc)调用函数 -> 调用系统调用 -`ls` 命令在 Linux 上从系统库(即 glibc)内部调用函数。这些库调用完成大部分工作的系统调用。 +`ls` 命令内部从 Linux 上的系统库(即 glibc)调用函数。这些库去调用完成大部分工作的系统调用。 如果你想知道从 glibc 库中调用了哪些函数,请使用 `ltrace` 命令,然后跟上常规的 `ls testdir/`命令: @@ -99,8 +97,7 @@ ltrace ls testdir/ yum install ltrace ``` -一堆输出会被显示到屏幕上;不必担心,只需继续就行。`ltrace` 命令输出中与该示例有关的一些重要库函数包括: - +大量的输出会被堆到屏幕上;不必担心,只需继续就行。`ltrace` 命令输出中与该示例有关的一些重要库函数包括: ``` opendir("testdir/") = { 3 } @@ -116,11 +113,11 @@ readdir({ 3 }) = nil closedir({ 3 })                     ``` -通过查看上面的输出,你或许可以了解正在发生的事情。`opendir` 库函数打开一个名为 `testdir` 的目录,然后调用 `readdir` 函数,该函数读取目录的内容。最后,有一个对 `closedir` 函数的调用,该函数将关闭先前打开的目录。现在先忽略其他 `strlen` 和 `memcpy` 功能。 +通过查看上面的输出,你或许可以了解正在发生的事情。`opendir` 库函数打开一个名为 `testdir` 的目录,然后调用 `readdir` 函数,该函数读取目录的内容。最后,有一个对 `closedir` 函数的调用,该函数将关闭先前打开的目录。现在请先忽略其他 `strlen` 和 `memcpy` 功能。 你可以看到正在调用哪些库函数,但是本文将重点介绍由系统库函数调用的系统调用。 -与上述类似,要了解调用了哪些系统调用,只需将 `strace` 放在 `ls testdir` 命令之前,如下所示。 再次,将一堆乱码丢到了你的屏幕上,你可以按照以下步骤进行操作: +与上述类似,要了解调用了哪些系统调用,只需将 `strace` 放在 `ls testdir` 命令之前,如下所示。 再次,一堆乱码丢到了你的屏幕上,你可以按照以下步骤进行操作: ``` [root@sandbox tmp]# strace ls testdir/ @@ -137,14 +134,14 @@ exit_group(0) = ? [root@sandbox tmp]# ``` -运行 `strace` 命令后屏幕上的输出只是运行 `ls` 命令的系统调用。每个系统调用都为操作系统提供特定的用途,可以将它们大致分为以下几个部分: +运行 `strace` 命令后屏幕上的输出就是运行 `ls` 命令的系统调用。每个系统调用都为操作系统提供了特定的用途,可以将它们大致分为以下几个部分: * 进程管理系统调用 * 文件管理系统调用 * 目录和文件系统管理系统调用 * 其他系统调用 -分析显示到屏幕上的信息的一种更简单的方法是使用 `strace` 方便使用的 `-o` 标志将输出记录到文件中。在 `-o` 标志后添加一个合适的文件名,然后再次运行命令: +分析显示到屏幕上的信息的一种更简单的方法是使用 `strace` 方便的 `-o` 标志将输出记录到文件中。在 `-o` 标志后添加一个合适的文件名,然后再次运行命令: ``` [root@sandbox tmp]# strace -o trace.log ls testdir/ @@ -173,7 +170,7 @@ execve("/usr/bin/ls", ["ls", "testdir/"], [/* 40 vars */]) = 0 * 括号内的文本是提供给该系统调用的参数。 * 符号 `=` 后的数字(在这种情况下为 `0`)是 `execve` 系统调用的返回值。 -现在的输出似乎还不太吓人,不是吗?你可以应用相同的逻辑来理解其他行。 +现在的输出似乎还不太吓人,对吧。你可以应用相同的逻辑来理解其他行。 现在,将关注点集中在你调用的单个命令上,即 `ls testdir`。你知道命令 `ls` 使用的目录名称,那么为什么不在 `trace.log` 文件中使用 `grep` 查找 `testdir` 并查看得到的结果呢?让我们详细查看一下结果的每一行: @@ -262,19 +259,19 @@ write(1, "file1  file2\n", 13)          = 13 * `1`:标准输出 * `2`:标准错误 -因此,`write` 系统调用将在标准显示(这就是终端,由 `1` 所标识的)上显示 `file1` 和 `file2`。 +因此,`write` 系统调用将在标准显示(就是这个终端,由 `1` 所标识的)上显示 `file1` 和 `file2`。 -现在你知道哪个系统调用完成了 `ls testdir/` 命令的大部分工作。但是在 `trace.log` 文件中其它的 100 多个系统调用呢?操作系统必须做很多内务处理才能运行一个进程,因此,你在该日志文件中看到的很多内容都是进程初始化和清理。阅读整个 `trace.log` 文件,并尝试了解什么使 `ls` 命令可以工作。 +现在你知道哪个系统调用完成了 `ls testdir/` 命令的大部分工作。但是在 `trace.log` 文件中其它的 100 多个系统调用呢?操作系统必须做很多内务处理才能运行一个进程,因此,你在该日志文件中看到的很多内容都是进程初始化和清理。阅读整个 `trace.log` 文件,并尝试了解 `ls` 命令是怎么工作起来的。 既然你知道了如何分析给定命令的系统调用,那么就可以将该知识用于其他命令来了解正在执行哪些系统调用。`strace` 提供了许多有用的命令行标志,使你更容易使用,下面将对其中一些进行描述。 -默认情况下,`strace` 并不包含所有系统调用信息。但是,它有一个方便的 `-v verbose` 选项,可以在每个系统调用中提供附加信息: +默认情况下,`strace` 并不包含所有系统调用信息。但是,它有一个方便的 `-v` 冗余选项,可以在每个系统调用中提供附加信息: ``` strace -v ls testdir ``` -在运行 `strace` 命令时始终使用 `-f` 选项是一种好的作法。它允许 `strace` 跟踪由当前正在跟踪的进程创建的任何子进程: +在运行 `strace` 命令时始终使用 `-f` 选项是一种好的作法。它允许 `strace` 对当前正在跟踪的进程创建的任何子进程进行跟踪: ``` strace -f ls testdir @@ -286,7 +283,7 @@ strace -f ls testdir strace -c ls testdir/ ``` -假设你想专注于特定的系统调用,例如专注于 `open` 系统调用,而忽略其余部分。你可以使用`-e`标志跟上系统调用的名称: +假设你想专注于特定的系统调用,例如专注于 `open` 系统调用,而忽略其余部分。你可以使用`-e` 标志跟上系统调用的名称: ``` [root@sandbox tmp]# strace -e open ls testdir @@ -305,7 +302,7 @@ file1  file2 [root@sandbox tmp]# ``` -如果你想关注多个系统调用怎么办?不用担心,你同样可以使用 `-e` 命令行标志,并用逗号分隔开两个系统调用。例如,要查看 `write` 和 `getdents` 系统调用: +如果你想关注多个系统调用怎么办?不用担心,你同样可以使用 `-e` 命令行标志,并用逗号分隔开两个系统调用的名称。例如,要查看 `write` 和 `getdents` 系统调用: ``` [root@sandbox tmp]# strace -e write,getdents ls testdir @@ -317,11 +314,11 @@ write(1, "file1  file2\n", 13file1  file2 [root@sandbox tmp]# ``` -到目前为止,这些示例已明确跟踪了运行的命令。但是,要跟踪已经运行并正在执行的命令又怎么办呢?例如,如果要跟踪只是长时间运行的进程的守护程序,该怎么办?为此,`strace` 提供了一个特殊的 `-p` 标志,你可以向其提供进程 ID。 +到目前为止,这些示例是明确地运行的命令进行了跟踪。但是,要跟踪已经运行并正在执行的命令又怎么办呢?例如,如果要跟踪用来长时间运行进程的守护程序,该怎么办?为此,`strace` 提供了一个特殊的 `-p` 标志,你可以向其提供进程 ID。 -不用在守护程序上运行 `strace`,而是以 `cat` 命令为例,如果你将文件名作为参数,通常会显示文件的内容。如果没有给出参数,`cat` 命令会在终端上等待用户输入文本。输入文本后,它将重复给定的文本,直到用户按下 `Ctrl + C` 退出为止。 +我们的示例不在守护程序上运行 `strace`,而是以 `cat` 命令为例,如果你将文件名作为参数,通常 `cat` 会显示文件的内容。如果没有给出参数,`cat` 命令会在终端上等待用户输入文本。输入文本后,它将重复给定的文本,直到用户按下 `Ctrl + C` 退出为止。 -从一个终端运行 `cat` 命令;它会向你显示一个提示,而等待在那里(记住 `cat` 仍在运行且尚未退出): +从一个终端运行 `cat` 命令;它会向你显示一个提示,并等待在那里(记住 `cat` 仍在运行且尚未退出): ``` [root@sandbox tmp]# cat @@ -344,7 +341,7 @@ strace: Process 22443 attached read(0, ``` -现在,返回到你使 `cat` 命令运行的终端,并输入一些文本。我出于演示目的输入了 `x0x0`。注意 `cat` 是如何简单地重复我输入的内容。因此,`x0x0` 出现了两次。我输入了第一个,第二个是 `cat` 命令重复的输出: +现在,返回到你运行 `cat` 命令的终端,并输入一些文本。我出于演示目的输入了 `x0x0`。注意 `cat` 是如何简单地重复我输入的内容的。因此,`x0x0` 出现了两次。我输入了第一个,第二个是 `cat` 命令重复的输出: ``` [root@sandbox tmp]# cat @@ -352,7 +349,7 @@ x0x0 x0x0 ``` -返回到将 `strace` 接驳到 `cat` 进程的终端。现在你会看到两个额外的系统调用:较早的 `read` 系统调用,现在在终端中读取 `x0x0`,另一个为 `write`,将 `x0x0` 写回到终端,然后是再一个新的 `read`,正在等待从终端读取。请注意,标准输入(`0`)和标准输出(`1`)都在同一终端中: +返回到将 `strace` 接驳到 `cat` 进程的终端。现在你会看到两个额外的系统调用:较早的 `read` 系统调用,现在在终端中读取 `x0x0`,另一个为 `write`,它将 `x0x0` 写回到终端,然后是再一个新的 `read`,正在等待从终端读取。请注意,标准输入(`0`)和标准输出(`1`)都在同一终端中: ``` [root@sandbox ~]# strace -p 22443 @@ -399,7 +396,7 @@ via: https://opensource.com/article/19/10/strace 作者:[Gaurav Kamathe][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 247c9ebbccd74dfe77ddc4936740ab6db7245c7f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 13:14:16 +0800 Subject: [PATCH 338/800] PUB @wxy https://linux.cn/article-11545-1.html --- ...0191025 Understanding system calls on Linux with strace.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191025 Understanding system calls on Linux with strace.md (99%) diff --git a/translated/tech/20191025 Understanding system calls on Linux with strace.md b/published/20191025 Understanding system calls on Linux with strace.md similarity index 99% rename from translated/tech/20191025 Understanding system calls on Linux with strace.md rename to published/20191025 Understanding system calls on Linux with strace.md index 89db6d01db..fd88408ae4 100644 --- a/translated/tech/20191025 Understanding system calls on Linux with strace.md +++ b/published/20191025 Understanding system calls on Linux with strace.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11545-1.html) [#]: subject: (Understanding system calls on Linux with strace) [#]: via: (https://opensource.com/article/19/10/strace) [#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) From 24e80372dee0a221172189ab560d59f8479f030d Mon Sep 17 00:00:00 2001 From: laingke Date: Wed, 6 Nov 2019 18:40:10 +0800 Subject: [PATCH 339/800] 20191004-open-source-name-origins translating --- sources/talk/20191004 What-s in an open source name.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/talk/20191004 What-s in an open source name.md b/sources/talk/20191004 What-s in an open source name.md index e15ac57a28..ae5ce6ee65 100644 --- a/sources/talk/20191004 What-s in an open source name.md +++ b/sources/talk/20191004 What-s in an open source name.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (laingke) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -152,7 +152,7 @@ via: https://opensource.com/article/19/10/open-source-name-origins 作者:[Joshua Allen Holm][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[laingke](https://github.com/laingke) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 55ca7b9f5ac3b7482b9442702d14733e5844bcf3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 6 Nov 2019 21:02:48 +0800 Subject: [PATCH 340/800] APL --- sources/tech/20190905 Building CI-CD pipelines with Jenkins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md b/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md index 44b4d6cd24..e30c3ac910 100644 --- a/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md +++ b/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 5fb4246f1bcd4213ffa2bd508e5eb291ae08a84a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 Nov 2019 00:05:23 +0800 Subject: [PATCH 341/800] TSL&PRF --- ...5 Building CI-CD pipelines with Jenkins.md | 255 ------------------ ...5 Building CI-CD pipelines with Jenkins.md | 246 +++++++++++++++++ 2 files changed, 246 insertions(+), 255 deletions(-) delete mode 100644 sources/tech/20190905 Building CI-CD pipelines with Jenkins.md create mode 100644 translated/tech/20190905 Building CI-CD pipelines with Jenkins.md diff --git a/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md b/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md deleted file mode 100644 index e30c3ac910..0000000000 --- a/sources/tech/20190905 Building CI-CD pipelines with Jenkins.md +++ /dev/null @@ -1,255 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Building CI/CD pipelines with Jenkins) -[#]: via: (https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins) -[#]: author: (Bryant Son https://opensource.com/users/brson) - -Building CI/CD pipelines with Jenkins -====== -Build continuous integration and continuous delivery (CI/CD) pipelines -with this step-by-step Jenkins tutorial. -![pipelines][1] - -In my article [_A beginner's guide to building DevOps pipelines with open source tools_][2], I shared a story about building a DevOps pipeline from scratch. The core technology driving that initiative was [Jenkins][3], an open source tool to build continuous integration and continuous delivery (CI/CD) pipelines. - -At Citi, there was a separate team that provided dedicated Jenkins pipelines with a stable master-slave node setup, but the environment was only used for quality assurance (QA), staging, and production environments. The development environment was still very manual, and our team needed to automate it to gain as much flexibility as possible while accelerating the development effort. This is the reason we decided to build a CI/CD pipeline for DevOps. And the open source version of Jenkins was the obvious choice due to its flexibility, openness, powerful plugin-capabilities, and ease of use. - -In this article, I will share a step-by-step walkthrough on how you can build a CI/CD pipeline using Jenkins. - -### What is a pipeline? - -Before jumping into the tutorial, it's helpful to know something about CI/CD pipelines. - -To start, it is helpful to know that Jenkins itself is not a pipeline. Just creating a new Jenkins job does not construct a pipeline. Think about Jenkins like a remote control—it's the place you click a button. What happens when you do click a button depends on what the remote is built to control. Jenkins offers a way for other application APIs, software libraries, build tools, etc. to plug into Jenkins, and it executes and automates the tasks. On its own, Jenkins does not perform any functionality but gets more and more powerful as other tools are plugged into it. - -A pipeline is a separate concept that refers to the groups of events or jobs that are connected together in a sequence: - -> A **pipeline** is a sequence of events or jobs that can be executed. - -The easiest way to understand a pipeline is to visualize a sequence of stages, like this: - -![Pipeline example][4] - -Here, you should see two familiar concepts: _Stage_ and _Step_. - - * **Stage:** A block that contains a series of steps. A stage block can be named anything; it is used to visualize the pipeline process. - * **Step:** A task that says what to do. Steps are defined inside a stage block. - - - -In the example diagram above, Stage 1 can be named "Build," "Gather Information," or whatever, and a similar idea is applied for the other stage blocks. "Step" simply says what to execute, and this can be a simple print command (e.g., **echo "Hello, World"**), a program-execution command (e.g., **java HelloWorld**), a shell-execution command (e.g., **chmod 755 Hello**), or any other command—as long as it is recognized as an executable command through the Jenkins environment. - -The Jenkins pipeline is provided as a _codified script_ typically called a **Jenkinsfile**, although the file name can be different. Here is an example of a simple Jenkins pipeline file. - - -``` -// Example of Jenkins pipeline script - -pipeline { -  stages { -    stage("Build") { -       steps { -          // Just print a Hello, Pipeline to the console -          echo "Hello, Pipeline!" -          // Compile a Java file. This requires JDKconfiguration from Jenkins -          javac HelloWorld.java -          // Execute the compiled Java binary called HelloWorld. This requires JDK configuration from Jenkins -          java HelloWorld -          // Executes the Apache Maven commands, clean then package. This requires Apache Maven configuration from Jenkins -          mvn clean package ./HelloPackage -          // List the files in current directory path by executing a default shell command -          sh "ls -ltr" -       } -   } -   // And next stages if you want to define further... - } // End of stages -} // End of pipeline -``` - -It's easy to see the structure of a Jenkins pipeline from this sample script. Note that some commands, like **java**, **javac**, and **mvn**, are not available by default, and they need to be installed and configured through Jenkins. Therefore: - -> A **Jenkins pipeline** is the way to execute a Jenkins job sequentially in a defined way by codifying it and structuring it inside multiple blocks that can include multiple steps containing tasks. - -OK. Now that you understand what a Jenkins pipeline is, I'll show you how to create and execute a Jenkins pipeline. At the end of the tutorial, you will have built a Jenkins pipeline like this: - -![Final Result][5] - -### How to build a Jenkins pipeline - -To make this tutorial easier to follow, I created a sample [GitHub repository][6] and a video tutorial. - -Before starting this tutorial, you'll need: - - * **Java Development Kit:** If you don't already have it, install a JDK and add it to the environment path so a Java command (like **java jar**) can be executed through a terminal. This is necessary to leverage the Java Web Archive (WAR) version of Jenkins that is used in this tutorial (although you can use any other distribution). - * **Basic computer operations:** You should know how to type some code, execute basic Linux commands through the shell, and open a browser. - - - -Let's get started. - -#### Step 1: Download Jenkins - -Navigate to the [Jenkins download page][7]. Scroll down to **Generic Java package (.war)** and click on it to download the file; save it someplace where you can locate it easily. (If you choose another Jenkins distribution, the rest of tutorial steps should be pretty much the same, except for Step 2.) The reason to use the WAR file is that it is a one-time executable file that is easily executable and removable. - -![Download Jenkins as Java WAR file][8] - -#### Step 2: Execute Jenkins as a Java binary - -Open a terminal window and enter the directory where you downloaded Jenkins with **cd <your path>**. (Before you proceed, make sure JDK is installed and added to the environment path.) Execute the following command, which will run the WAR file as an executable binary: - - -``` -`java -jar ./jenkins.war` -``` - -If everything goes smoothly, Jenkins should be up and running at the default port 8080. - -![Execute as an executable JAR binary][9] - -#### Step 3: Create a new Jenkins job - -Open a web browser and navigate to **localhost:8080**. Unless you have a previous Jenkins installation, it should go straight to the Jenkins dashboard. Click **Create New Jobs**. You can also click **New Item** on the left. - -![Create New Job][10] - -#### Step 4: Create a pipeline job - -In this step, you can select and define what type of Jenkins job you want to create. Select **Pipeline** and give it a name (e.g., TestPipeline). Click **OK** to create a pipeline job. - -![Create New Pipeline Job][11] - -You will see a Jenkins job configuration page. Scroll down to find** Pipeline section**. There are two ways to execute a Jenkins pipeline. One way is by _directly writing a pipeline script_ on Jenkins, and the other way is by retrieving the _Jenkins file from SCM_ (source control management). We will go through both ways in the next two steps. - -#### Step 5: Configure and execute a pipeline job through a direct script - -To execute the pipeline with a direct script, begin by copying the contents of the [sample Jenkinsfile][6] from GitHub. Choose **Pipeline script** as the **Destination** and paste the **Jenkinsfile** contents in **Script**. Spend a little time studying how the Jenkins file is structured. Notice that there are three Stages: Build, Test, and Deploy, which are arbitrary and can be anything. Inside each Stage, there are Steps; in this example, they just print some random messages. - -Click **Save** to keep the changes, and it should automatically take you back to the Job Overview. - -![Configure to Run as Jenkins Script][12] - -To start the process to build the pipeline, click **Build Now**. If everything works, you will see your first pipeline (like the one below). - -![Click Build Now and See Result][13] - -To see the output from the pipeline script build, click any of the Stages and click **Log**. You will see a message like this. - -![Visit sample GitHub with Jenkins get clone link][14] - -#### Step 6: Configure and execute a pipeline job with SCM - -Now, switch gears: In this step, you will Deploy the same Jenkins job by copying the **Jenkinsfile** from a source-controlled GitHub. In the same [GitHub repository][6], pick up the repository URL by clicking **Clone or download** and copying its URL. - -![Checkout from GitHub][15] - -Click **Configure** to modify the existing job. Scroll to the **Advanced Project Options** setting, but this time, select the **Pipeline script from SCM** option in the **Destination** dropdown. Paste the GitHub repo's URL in the **Repository URL**, and type **Jenkinsfile** in the **Script Path**. Save by clicking the **Save** button. - -![Change to Pipeline script from SCM][16] - -To build the pipeline, once you are back to the Task Overview page, click **Build Now** to execute the job again. The result will be the same as before, except you have one additional stage called **Declaration: Checkout SCM**. - -![Build again and verify][17] - -To see the pipeline's output from the SCM build, click the Stage and view the **Log** to check how the source control cloning process went. - -![Verify Checkout Procedure][18] - -### Do more than print messages - -Congratulations! You've built your first Jenkins pipeline! - -"But wait," you say, "this is very limited. I cannot really do anything with it except print dummy messages." That is OK. So far, this tutorial provided just a glimpse of what a Jenkins pipeline can do, but you can extend its capabilities by integrating it with other tools. Here are a few ideas for your next project: - - * Build a multi-staged Java build pipeline that takes from the phases of pulling dependencies from JAR repositories like Nexus or Artifactory, compiling Java codes, running the unit tests, packaging into a JAR/WAR file, and deploying to a cloud server. - * Implement the advanced code testing dashboard that will report back the health of the project based on the unit test, load test, and automated user interface test with Selenium.  - * Construct a multi-pipeline or multi-user pipeline automating the tasks of executing Ansible playbooks while allowing for authorized users to respond to task in progress. - * Design a complete end-to-end DevOps pipeline that pulls the infrastructure resource files and configuration files stored in SCM like GitHub and executing the scripts through various runtime programs. - - - -Follow any of the tutorials at the end of this article to get into these more advanced cases. - -#### Manage Jenkins - -From the main Jenkins dashboard, click **Manage Jenkins**. - -![Manage Jenkins][19] - -#### Global tool configuration - -There are many options available, including managing plugins, viewing the system log, etc. Click **Global Tool Configuration**. - -![Global Tools Configuration][20] - -#### Add additional capabilities - -Here, you can add the JDK path, Git, Gradle, and so much more. After you configure a tool, it is just a matter of adding the command into your Jenkinsfile or executing it through your Jenkins script. - -![See Various Options for Plugin][21] - -### Where to go from here? - -This article put you on your way to creating a CI/CD pipeline using Jenkins, a cool open source tool. To find out about many of the other things you can do with Jenkins, check out these other articles on Opensource.com: - - * [Getting started with Jenkins X][22] - * [Install an OpenStack cloud with Jenkins][23] - * [Running Jenkins builds in containers][24] - * [Getting started with Jenkins pipelines][25] - * [How to run JMeter with Jenkins][26] - * [Integrating OpenStack into your Jenkins workflow][27] - - - -You may be interested in some of the other articles I've written to supplement your open source journey: - - * [9 open source tools for building a fault-tolerant system][28] - * [Understanding software design patterns][29] - * [A beginner's guide to building DevOps pipelines with open source tools][2] - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins - -作者:[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/pipe-pipeline-grid.png?itok=kkpzKxKg (pipelines) -[2]: https://opensource.com/article/19/4/devops-pipeline -[3]: https://jenkins.io/ -[4]: https://opensource.com/sites/default/files/uploads/diagrampipeline.jpg (Pipeline example) -[5]: https://opensource.com/sites/default/files/uploads/0_endresultpreview_0.jpg (Final Result) -[6]: https://github.com/bryantson/CICDPractice -[7]: https://jenkins.io/download/ -[8]: https://opensource.com/sites/default/files/uploads/2_downloadwar.jpg (Download Jenkins as Java WAR file) -[9]: https://opensource.com/sites/default/files/uploads/3_runasjar.jpg (Execute as an executable JAR binary) -[10]: https://opensource.com/sites/default/files/uploads/4_createnewjob.jpg (Create New Job) -[11]: https://opensource.com/sites/default/files/uploads/5_createpipeline.jpg (Create New Pipeline Job) -[12]: https://opensource.com/sites/default/files/uploads/6_runaspipelinescript.jpg (Configure to Run as Jenkins Script) -[13]: https://opensource.com/sites/default/files/uploads/7_buildnow4script.jpg (Click Build Now and See Result) -[14]: https://opensource.com/sites/default/files/uploads/8_seeresult4script.jpg (Visit sample GitHub with Jenkins get clone link) -[15]: https://opensource.com/sites/default/files/uploads/9_checkoutfromgithub.jpg (Checkout from GitHub) -[16]: https://opensource.com/sites/default/files/uploads/10_runsasgit.jpg (Change to Pipeline script from SCM) -[17]: https://opensource.com/sites/default/files/uploads/11_seeresultfromgit.jpg (Build again and verify) -[18]: https://opensource.com/sites/default/files/uploads/12_verifycheckout.jpg (Verify Checkout Procedure) -[19]: https://opensource.com/sites/default/files/uploads/13_managingjenkins.jpg (Manage Jenkins) -[20]: https://opensource.com/sites/default/files/uploads/14_globaltoolsconfiguration.jpg (Global Tools Configuration) -[21]: https://opensource.com/sites/default/files/uploads/15_variousoptions4plugin.jpg (See Various Options for Plugin) -[22]: https://opensource.com/article/18/11/getting-started-jenkins-x -[23]: https://opensource.com/article/18/4/install-OpenStack-cloud-Jenkins -[24]: https://opensource.com/article/18/4/running-jenkins-builds-containers -[25]: https://opensource.com/article/18/4/jenkins-pipelines-with-cucumber -[26]: https://opensource.com/life/16/7/running-jmeter-jenkins-continuous-delivery-101 -[27]: https://opensource.com/business/15/5/interview-maish-saidel-keesing-cisco -[28]: https://opensource.com/article/19/3/tools-fault-tolerant-system -[29]: https://opensource.com/article/19/7/understanding-software-design-patterns diff --git a/translated/tech/20190905 Building CI-CD pipelines with Jenkins.md b/translated/tech/20190905 Building CI-CD pipelines with Jenkins.md new file mode 100644 index 0000000000..0fc57c47b2 --- /dev/null +++ b/translated/tech/20190905 Building CI-CD pipelines with Jenkins.md @@ -0,0 +1,246 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building CI/CD pipelines with Jenkins) +[#]: via: (https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +用 Jenkins 构建 CI/CD 流水线 +====== + +> 通过这份 Jenkins 分步教程,构建持续集成和持续交付(CI/CD)流水线。 + +![pipelines][1] + +在我的文章《[使用开源工具构建 DevOps 流水线的初学者指南][2]》中,我分享了一个从头开始构建 DevOps 流水线的故事。推动该计划的核心技术是 [Jenkins][3],这是一个用于建立持续集成和持续交付(CI/CD)流水线的开源工具。 + +在花旗,有一个单独的团队为专用的 Jenkins 流水线提供稳定的主从节点环境,但是该环境仅用于质量保证(QA)、构建阶段和生产环境。开发环境仍然是非常手动的,我们的团队需要对其进行自动化以在加快开发工作的同时获得尽可能多的灵活性。这就是我们决定为 DevOps 建立 CI/CD 流水线的原因。Jenkins 的开源版本由于其灵活性、开放性、强大的插件功能和易用性而成为显而易见的选择。 + +在本文中,我将分步演示如何使用 Jenkins 构建 CI/CD 流水线。 + +### 什么是流水线? + +在进入本教程之前,了解有关 CI/CD 流水线pipeline的知识会很有帮助。 + +首先,了解 Jenkins 本身并不是流水线这一点很有帮助。只是创建一个新的 Jenkins 作业并不能构建一条流水线。可以把 Jenkins 看做一个遥控器,在这里点击按钮即可。当你点击按钮时会发生什么取决于遥控器要控制的内容。Jenkins 为其他应用程序 API、软件库、构建工具等提供了一种插入 Jenkins 的方法,它可以执行并自动化任务。Jenkins 本身不执行任何功能,但是随着其它工具的插入而变得越来越强大。 + +流水线是一个单独的概念,指的是按顺序连接在一起的事件或作业组: + +> “流水线pipeline”是可以执行的一系列事件或作业。 + +理解流水线的最简单方法是可视化一系列阶段,如下所示: + +![Pipeline example][4] + +在这里,你应该看到两个熟悉的概念:阶段Stage步骤Step。 + +* 阶段:一个包含一系列步骤的块。阶段块可以命名为任何名称;它用于可视化流水线过程。 +* 步骤:表明要做什么的任务。步骤定义在阶段块内。 + +在上面的示例图中,阶段 1 可以命名为 “构建”、“收集信息”或其它名称,其它阶段块也可以采用类似的思路。“步骤”只是简单地说放上要执行的内容,它可以是简单的打印命令(例如,`echo "Hello, World"`)、程序执行命令(例如,`java HelloWorld`)、shell 执行命令( 例如,`chmod 755 Hello`)或任何其他命令,只要通过 Jenkins 环境将其识别为可执行命令即可。 + +Jenkins 流水线以**编码脚本**的形式提供,通常称为 “Jenkinsfile”,尽管可以用不同的文件名。下面这是一个简单的 Jenkins 流水线文件的示例: + +``` +// Example of Jenkins pipeline script + +pipeline { +  stages { +    stage("Build") { +      steps { +          // Just print a Hello, Pipeline to the console +          echo "Hello, Pipeline!" +          // Compile a Java file. This requires JDKconfiguration from Jenkins +          javac HelloWorld.java +          // Execute the compiled Java binary called HelloWorld. This requires JDK configuration from Jenkins +          java HelloWorld +          // Executes the Apache Maven commands, clean then package. This requires Apache Maven configuration from Jenkins +          mvn clean package ./HelloPackage +          // List the files in current directory path by executing a default shell command +          sh "ls -ltr" +      } +   } +   // And next stages if you want to define further... +  } // End of stages +} // End of pipeline +``` + +从此示例脚本很容易看到 Jenkins 流水线的结构。请注意,默认情况下某些命令(如 `java`、`javac`和 `mvn`)不可用,需要通过 Jenkins 进行安装和配置。 因此: + +> Jenkins 流水线是一种以定义的方式依次执行 Jenkins 作业的方法,方法是将其编码并在多个块中进行结构化,这些块可以包含多个任务的步骤。 + +好。既然你已经了解了 Jenkins 流水线是什么,我将向你展示如何创建和执行 Jenkins 流水线。在本教程的最后,你将建立一个 Jenkins 流水线,如下所示: + +![Final Result][5] + +### 如何构建 Jenkins 流水线 + +为了便于遵循本教程的步骤,我创建了一个示例 [GitHub 存储库][6]和一个视频教程。 + +- [视频](https://youtu.be/jDPwYgDVKlg) + +开始本教程之前,你需要: + +* Java 开发工具包(JDK):如果尚未安装,请安装 JDK 并将其添加到环境路径中,以便可以通过终端执行 Java 命令(如 `java jar`)。这是利用本教程中使用的 Java Web Archive(WAR)版本的 Jenkins 所必需的(尽管你可以使用任何其他发行版)。 +* 基本计算机操作能力:你应该知道如何键入一些代码、通过 shell 执行基本的 Linux 命令以及打开浏览器。 + +让我们开始吧。 + +#### 步骤一:下载 Jenkins + +导航到 [Jenkins 下载页面][7]。向下滚动到 “Generic Java package (.war)”,然后单击下载文件;将其保存在易于找到的位置。(如果你选择其他 Jenkins 发行版,除了步骤二之外,本教程的其余步骤应该几乎相同。)使用 WAR 文件的原因是它是个一次性可执行文件,可以轻松地执行和删除。 + +![Download Jenkins as Java WAR file][8] + +#### 步骤二:以 Java 二进制方式执行 Jenkins + +打开一个终端窗口,并使用 `cd ` 进入下载 Jenkins 的目录。(在继续之前,请确保已安装 JDK 并将其添加到环境路径。)执行以下命令,该命令将 WAR 文件作为可执行二进制文件运行: + +``` +java -jar ./jenkins.war +``` + +如果一切顺利,Jenkins 应该在默认端口 8080 上启动并运行。 + +![Execute as an executable JAR binary][9] + +#### 步骤三:创建一个新的 Jenkins 作业 + +打开一个 Web 浏览器并导航到 `localhost:8080`。除非你有以前安装的 Jenkins,否则应直接转到 Jenkins 仪表板。点击 “Create New Jobs”。你也可以点击左侧的 “New Item”。 + +![Create New Job][10] + +#### 步骤四:创建一个流水线作业 + +在此步骤中,你可以选择并定义要创建的 Jenkins 作业类型。选择 “Pipeline” 并为其命名(例如,“TestPipeline”)。单击 “OK” 创建流水线作业。 + +![Create New Pipeline Job][11] + +你将看到一个 Jenkins 作业配置页面。向下滚动以找到 “Pipeline” 部分。有两种执行 Jenkins 流水线的方法。一种方法是在 Jenkins 上直接编写流水线脚本,另一种方法是从 SCM(源代码管理)中检索 Jenkins 文件。在接下来的两个步骤中,我们将体验这两种方式。 + +#### 步骤五:通过直接脚本配置并执行流水线作业 + +要使用直接脚本执行流水线,请首先从 GitHub 复制该 [Jenkinsfile 示例][6]的内容。选择 “Pipeline script” 作为 “Destination”,然后将该 Jenkinsfile 的内容粘贴到 “Script” 中。花一些时间研究一下 Jenkins 文件的结构。注意,共有三个阶段:Build、Test 和 Deploy,它们是任意的,可以是任何一个。每个阶段中都有一些步骤;在此示例中,它们只是打印一些随机消息。 + +单击 “Save” 以保留更改,这将自动将你带回到 “Job Overview” 页面。 + +![Configure to Run as Jenkins Script][12] + +要开始构建流水线的过程,请单击 “Build Now”。如果一切正常,你将看到第一个流水线(如下面的这个)。 + +![Click Build Now and See Result][13] + +要查看流水线脚本构建的输出,请单击任何阶段,然后单击 “Log”。你会看到这样的消息。 + +![Visit sample GitHub with Jenkins get clone link][14] + +#### 步骤六:通过 SCM 配置并执行流水线作业 + +现在,换个方式:在此步骤中,你将通过从源代码控制的 GitHub 中复制 Jenkinsfile 来部署相同的 Jenkins 作业。在同一个 [GitHub 存储库][6]中,通过单击 “Clone or download” 并复制其 URL 来找到其存储库 URL。 + +![Checkout from GitHub][15] + +单击 “Configure” 以修改现有作业。滚动到 “Advanced Project Options” 设置,但这一次,从 “Destination” 下拉列表中选择 “Pipeline script from SCM” 选项。将 GitHub 存储库的 URL 粘贴到 “Repository URL” 中,然后在 “Script Path” 中键入 “Jenkinsfile”。 单击 “Save” 按钮保存。 + +![Change to Pipeline script from SCM][16] + +要构建流水线,回到 “Task Overview” 页面后,单击 “Build Now” 以再次执行作业。结果与之前相同,除了多了一个称为 “Declaration: Checkout SCM” 的阶段。 + +![Build again and verify][17] + +要查看来自 SCM 构建的流水线的输出,请单击该阶段并查看 “Log” 以检查源代码控制克隆过程的进行情况。 + +![Verify Checkout Procedure][18] + +### 除了打印消息,还能做更多 + +恭喜你!你已经建立了第一个 Jenkins 流水线! + +“但是等等”,你说,“这太有限了。除了打印无用的消息外,我什么都做不了。”那没问题。到目前为止,本教程仅简要介绍了 Jenkins 流水线可以做什么,但是你可以通过将其与其他工具集成来扩展其功能。以下是给你的下一个项目的一些思路: + +* 建立一个多阶段的 Java 构建流水线,从以下阶段开始:从 Nexus 或 Artifactory 之类的 JAR 存储库中拉取依赖项、编译 Java 代码、运行单元测试、打包为 JAR/WAR 文件,然后部署到云服务器。 +* 实现一个高级代码测试仪表板,该仪表板将基于 Selenium 的单元测试、负载测试和自动用户界面测试,报告项目的运行状况。 +* 构建多流水线或多用户流水线,以自动化执行 Ansible 剧本的任务,同时允许授权用户响应正在进行的任务。 +* 设计完整的端到端 DevOps 流水线,该流水线可提取存储在 SCM 中的基础设施资源文件和配置文件(例如 GitHub),并通过各种运行时程序执行该脚本。 + +学习本文结尾处的任何教程,以了解这些更高级的案例。 + +#### 管理 Jenkins + +在 Jenkins 主面板,点击 “Manage Jenkins”。 + +![Manage Jenkins][19] + +#### 全局工具配置 + +有许多可用工具,包括管理插件、查看系统日志等。单击 “Global Tool Configuration”。 + +![Global Tools Configuration][20] + +#### 增加附加能力 + +在这里,你可以添加 JDK 路径、Git、Gradle 等。配置工具后,只需将该命令添加到 Jenkinsfile 中或通过 Jenkins 脚本执行即可。 + +![See Various Options for Plugin][21] + +### 后继 + +本文为你介绍了使用酷炫的开源工具 Jenkins 创建 CI/CD 流水线的方法。要了解你可以使用 Jenkins 完成的许多其他操作,请在 Opensource.com 上查看以下其他文章: + +* [Jenkins X 入门][22] +* [使用 Jenkins 安装 OpenStack 云][23] +* [在容器中运行 Jenkins][24] +* [Jenkins 流水线入门][25] +* [如何与 Jenkins 一起运行 JMeter][26] +* [将 OpenStack 集成到你的 Jenkins 工作流中][27] + +你可能对我为你的开源之旅而写的其他一些文章感兴趣: + +* [9 个用于构建容错系统的开源工具][28] +* [了解软件设计模式][29] +* [使用开源工具构建 DevOps 流水线的初学者指南][2] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins + +作者:[Bryant Son][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/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pipe-pipeline-grid.png?itok=kkpzKxKg (pipelines) +[2]: https://linux.cn/article-11307-1.html +[3]: https://jenkins.io/ +[4]: https://opensource.com/sites/default/files/uploads/diagrampipeline.jpg (Pipeline example) +[5]: https://opensource.com/sites/default/files/uploads/0_endresultpreview_0.jpg (Final Result) +[6]: https://github.com/bryantson/CICDPractice +[7]: https://jenkins.io/download/ +[8]: https://opensource.com/sites/default/files/uploads/2_downloadwar.jpg (Download Jenkins as Java WAR file) +[9]: https://opensource.com/sites/default/files/uploads/3_runasjar.jpg (Execute as an executable JAR binary) +[10]: https://opensource.com/sites/default/files/uploads/4_createnewjob.jpg (Create New Job) +[11]: https://opensource.com/sites/default/files/uploads/5_createpipeline.jpg (Create New Pipeline Job) +[12]: https://opensource.com/sites/default/files/uploads/6_runaspipelinescript.jpg (Configure to Run as Jenkins Script) +[13]: https://opensource.com/sites/default/files/uploads/7_buildnow4script.jpg (Click Build Now and See Result) +[14]: https://opensource.com/sites/default/files/uploads/8_seeresult4script.jpg (Visit sample GitHub with Jenkins get clone link) +[15]: https://opensource.com/sites/default/files/uploads/9_checkoutfromgithub.jpg (Checkout from GitHub) +[16]: https://opensource.com/sites/default/files/uploads/10_runsasgit.jpg (Change to Pipeline script from SCM) +[17]: https://opensource.com/sites/default/files/uploads/11_seeresultfromgit.jpg (Build again and verify) +[18]: https://opensource.com/sites/default/files/uploads/12_verifycheckout.jpg (Verify Checkout Procedure) +[19]: https://opensource.com/sites/default/files/uploads/13_managingjenkins.jpg (Manage Jenkins) +[20]: https://opensource.com/sites/default/files/uploads/14_globaltoolsconfiguration.jpg (Global Tools Configuration) +[21]: https://opensource.com/sites/default/files/uploads/15_variousoptions4plugin.jpg (See Various Options for Plugin) +[22]: https://opensource.com/article/18/11/getting-started-jenkins-x +[23]: https://opensource.com/article/18/4/install-OpenStack-cloud-Jenkins +[24]: https://linux.cn/article-9741-1.html +[25]: https://opensource.com/article/18/4/jenkins-pipelines-with-cucumber +[26]: https://opensource.com/life/16/7/running-jmeter-jenkins-continuous-delivery-101 +[27]: https://opensource.com/business/15/5/interview-maish-saidel-keesing-cisco +[28]: https://opensource.com/article/19/3/tools-fault-tolerant-system +[29]: https://opensource.com/article/19/7/understanding-software-design-patterns From 4e37bc9c7df33e8ad7b79c333583da0fac505c7c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 Nov 2019 00:14:51 +0800 Subject: [PATCH 342/800] PUB @wxy https://linux.cn/article-11546-1.html --- .../20190905 Building CI-CD pipelines with Jenkins.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename {translated/tech => published}/20190905 Building CI-CD pipelines with Jenkins.md (98%) diff --git a/translated/tech/20190905 Building CI-CD pipelines with Jenkins.md b/published/20190905 Building CI-CD pipelines with Jenkins.md similarity index 98% rename from translated/tech/20190905 Building CI-CD pipelines with Jenkins.md rename to published/20190905 Building CI-CD pipelines with Jenkins.md index 0fc57c47b2..378ad6728a 100644 --- a/translated/tech/20190905 Building CI-CD pipelines with Jenkins.md +++ b/published/20190905 Building CI-CD pipelines with Jenkins.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11546-1.html) [#]: subject: (Building CI/CD pipelines with Jenkins) [#]: via: (https://opensource.com/article/19/9/intro-building-cicd-pipelines-jenkins) [#]: author: (Bryant Son https://opensource.com/users/brson) @@ -12,7 +12,7 @@ > 通过这份 Jenkins 分步教程,构建持续集成和持续交付(CI/CD)流水线。 -![pipelines][1] +![](https://img.linux.net.cn/data/attachment/album/201911/07/001349rbbbswpeqnnteeee.jpg) 在我的文章《[使用开源工具构建 DevOps 流水线的初学者指南][2]》中,我分享了一个从头开始构建 DevOps 流水线的故事。推动该计划的核心技术是 [Jenkins][3],这是一个用于建立持续集成和持续交付(CI/CD)流水线的开源工具。 @@ -79,7 +79,7 @@ pipeline { 为了便于遵循本教程的步骤,我创建了一个示例 [GitHub 存储库][6]和一个视频教程。 -- [视频](https://youtu.be/jDPwYgDVKlg) +- [视频](https://img.linux.net.cn/static/video/_-jDPwYgDVKlg.mp4) 开始本教程之前,你需要: From d6600dbf0edc17919b455086d477176921549164 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 Nov 2019 00:33:13 +0800 Subject: [PATCH 343/800] APL --- ...ewing network bandwidth usage with bmon.md | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/sources/tech/20191030 Viewing network bandwidth usage with bmon.md b/sources/tech/20191030 Viewing network bandwidth usage with bmon.md index d8d2b2e1c9..107583b187 100644 --- a/sources/tech/20191030 Viewing network bandwidth usage with bmon.md +++ b/sources/tech/20191030 Viewing network bandwidth usage with bmon.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,14 +7,15 @@ [#]: via: (https://www.networkworld.com/article/3447936/viewing-network-bandwidth-usage-with-bmon.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -Viewing network bandwidth usage with bmon +用 bmon 查看带宽使用情况 ====== + Introducing bmon, a monitoring and debugging tool that captures network statistics and makes them easily digestible. Sandra Henry-Stocker Bmon is a monitoring and debugging tool that runs in a terminal window and captures network statistics, offering options on how and how much data will be displayed and displayed in a form that is easy to understand. -To check if **bmon** is installed on your system, use the **which** command: +To check if `bmon` is installed on your system, use the `which` command: ``` $ which bmon @@ -23,7 +24,7 @@ $ which bmon ### Getting bmon -On Debian systems, use **sudo apt-get install bmon** to install the tool. +On Debian systems, use `sudo apt-get install bmon` to install the tool. [][1] @@ -33,7 +34,7 @@ BrandPost Sponsored by HPE Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. -For Red Hat and related distributions, you might be able to install with **yum install bmon** or **sudo dnf install bmon**. Alternately, you may have to resort to a more complex install with commands like these that first set up the required **libconfuse** using the root account or sudo: +For Red Hat and related distributions, you might be able to install with `yum install bmon` or `sudo dnf install bmon`. Alternately, you may have to resort to a more complex install with commands like these that first set up the required `libconfuse` using the root account or sudo: ``` # wget https://github.com/martinh/libconfuse/releases/download/v3.2.2/confuse-3.2.2.zip @@ -48,11 +49,11 @@ For Red Hat and related distributions, you might be able to install with **yum i # sudo make install ``` -The first five lines will install **libconfuse** and the second five will grab and install **bmon** itself. +The first five lines will install `libconfuse` and the second five will grab and install `bmon` itself. ### Using bmon -The simplest way to start **bmon** is simply to type **bmon** on the command line. Depending on the size of the window you are using, you will be able to see and bring up a variety of data. +The simplest way to start `bmon` is simply to type `bmon` on the command line. Depending on the size of the window you are using, you will be able to see and bring up a variety of data. The top portion of your display will display stats on your network interfaces – the loopback (lo) and network-accessible (e.g., eth0). If you terminal window has few lines, this is all you may see, and it will look something like this: @@ -100,7 +101,7 @@ qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqq 1 5 10 15 20 25 30 35 40 45 50 55 60 ``` -Notice, however, that the graphs are not showing values. This is because it is displaying the loopback **>lo** interface. Arrow your way down to the public network interface and you will see some traffic. +Notice, however, that the graphs are not showing values. This is because it is displaying the loopback `>lo` interface. Arrow your way down to the public network interface and you will see some traffic. ``` Interfaces x RX bps pps %x TX bps pps % @@ -132,9 +133,9 @@ q Press i to enable additional information qq Wed Oct 23 16:42:06 2019 Press ? for help ``` -The change allows you to view a graph displaying network traffic. Note, however, that the default is to display bytes per second. To display bits per second instead, you would start the tool using **bmon -b** +The change allows you to view a graph displaying network traffic. Note, however, that the default is to display bytes per second. To display bits per second instead, you would start the tool using `bmon -b` -Detailed statistics on network traffic can be displayed if your window is large enough and you press **d**. An example of the stats you will see is displayed below. This display was split into left and right portions because of its width. +Detailed statistics on network traffic can be displayed if your window is large enough and you press `d`. An example of the stats you will see is displayed below. This display was split into left and right portions because of its width. ##### left side: @@ -171,7 +172,7 @@ RX TX │ RX TX │ │ No Handler 0 - │ Over Error 0 - ``` -Additional information on the network interface will be displayed if you press **i** +Additional information on the network interface will be displayed if you press `i` ##### left side: @@ -189,15 +190,15 @@ Family unspec | Alias | | Qdisc fq_codel | ``` -A help menu will appear if you press **?** with brief descriptions of how to move around the screen, select data to be displayed and control the graphs. +A help menu will appear if you press `?` with brief descriptions of how to move around the screen, select data to be displayed and control the graphs. -To quit **bmon**, you would type **q** and then **y** in response to the prompt to confirm your choice to exit. +To quit `bmon`, you would type `q` and then `y` in response to the prompt to confirm your choice to exit. Some of the important things to note are that: - * **bmon** adjusts its display to the size of the terminal window + * `bmon` adjusts its display to the size of the terminal window * some of the choices shown at the bottom of the display will only function if the window is large enough to accomodate the data - * the display is updated every second unless you slow this down using the **-R** (e.g., **bmon -R 5)** option + * the display is updated every second unless you slow this down using the `-R` (e.g., `bmon -R 5)` option From 4a00f91a6c64713cdedd011f7764df3daad3f3e1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 Nov 2019 00:53:51 +0800 Subject: [PATCH 344/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191106=20How=20?= =?UTF-8?q?to=20Schedule=20and=20Automate=20tasks=20in=20Linux=20using=20C?= =?UTF-8?q?ron=20Jobs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md --- ...Automate tasks in Linux using Cron Jobs.md | 241 ++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md diff --git a/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md new file mode 100644 index 0000000000..a8ed75432c --- /dev/null +++ b/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md @@ -0,0 +1,241 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Schedule and Automate tasks in Linux using Cron Jobs) +[#]: via: (https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Schedule and Automate tasks in Linux using Cron Jobs +====== + +Sometimes, you may have tasks that need to be performed on a regular basis or at certain predefined intervals. Such tasks include backing up databases, updating the system, performing periodic reboots and so on. Such tasks are referred to as **cron jobs**. Cron jobs are used for **automation of tasks** that come in handy and help in simplifying the execution of repetitive and sometimes mundane tasks. **Cron** is a daemon that allows you to schedule these jobs which are then carried out at specified intervals. In this tutorial, you will learn how to schedule jobs using cron jobs. + +[![Schedule -tasks-in-Linux-using cron][1]][2] + +### The Crontab file + +A crontab file, also known as a **cron table**, is a simple text file that contains rules or commands that specify the time interval of execution of a task. There are two categories of crontab files: + +**1)  System-wide crontab file** + +These are usually used by Linux services & critical applications requiring root privileges. The system crontab file is located at **/etc/crontab** and can only be accessed and edited by the root user. It’s usually used for the configuration of system-wide daemons. The crontab file looks as shown: + +[![etc-crontab-linux][1]][3] + +**2) User-created crontab files** + +Linux users can also create their own cron jobs with the help of the crontab command. The cron jobs created will run as the user who created them. + +All cron jobs are stored in /var/spool/cron (For RHEL and CentOS distros) and /var/spool/cron/crontabs (For Debian and Ubuntu distros), the cron jobs are listed using the username of the user that created the cron job + +The **cron daemon** runs silently in the background checking the **/etc/crontab** file and **/var/spool/cron** and **/etc/cron.d*/** directories + +The **crontab** command is used for editing cron files. Let us take a look at the anatomy of a crontab file. + +### The anatomy of a crontab file + +Before we go further, it’s important that we first explore how a crontab file looks like. The basic syntax for a crontab file comprises 5 columns represented by asterisks followed by the command to be carried out. + +*    *    *    *    *    command + +This format can also be represented as shown below: + +m h d moy dow command + +OR + +m h d moy dow /path/to/script + +Let’s expound on each entry + + * **m**: This represents minutes. It’s specified from 0 to 59 + * **h**: This denoted the hour specified from 0 to 23 + * **d**:  This represents the day of the month. Specified between 1 to 31` + * **moy**: This is the month of the year. It’s specified between 1 to 12 + * **doy**:  This is the day of the week. It’s specified between 0 and 6 where 0 = Sunday + * **Command**: This is the command to be executed e.g backup command, reboot, & copy + + + +### Managing cron jobs + +Having looked at the architecture of a crontab file, let’s see how you can create, edit and delete cron jobs + +**Creating cron jobs** + +To create or edit a cron job as the root user, run the command + +# crontab -e + +To create a cron job or schedule a task as another user, use the syntax + +# crontab -u username -e + +For instance, to run a cron job as user Pradeep, issue the command: + +# crontab -u Pradeep -e + +If there is no preexisting crontab file, then you will get a blank text document. If a crontab file was existing, The  -e option allows  to edit the file, + +**Listing crontab files** + +To view the cron jobs that have been created, simply pass the -l option as shown + +# crontab -l + +**Deleting a  crontab file** + +To delete a cron file, simply run crontab -e and delete or the line of the cron job that you want and save the file. + +To remove all cron jobs, run the command: + +# crontab -r + +That said, let’s have a look at different ways that you can schedule tasks + +### Crontab examples in Scheduling tasks. + +All cron jobs being with a shebang header as shown + +#!/bin/bash + +This indicates the shell you are using, which, for this case, is bash shell. + +Next, specify the interval at which you want to schedule the tasks using the cron job entries we specified earlier on. + +To reboot a system daily at 12:30 pm, use the syntax: + +30  12 *  *  * /sbin/reboot + +To schedule the reboot at 4:00 am use the syntax: + +0  4  *  *  *  /sbin/reboot + +**NOTE:**  The asterisk * is used to match all records + +To run a script twice every day, for example, 4:00 am and 4:00 pm, use the syntax. + +0  4,16  *  *  *  /path/to/script + +To schedule a cron job to run every Friday at 5:00 pm  use the syntax: + +0  17  *  *  Fri  /path/to/script + +OR + +0 17  *  *  *  5  /path/to/script + +If you wish to run your cron job every 30 minutes then use: + +*/30  *  *  *  * /path/to/script + +To schedule cron to run after every 5 hours, run + +*  */5  *  *  *  /path/to/script + +To run a script on selected days, for example, Wednesday and Friday at 6.00 pm execute: + +0  18  *  *  wed,fri  /path/to/script + +To schedule multiple tasks to use a single cron job, separate the tasks using a semicolon for example: + +*  *  *  *  *  /path/to/script1 ; /path/to/script2 + +### Using special strings to save time on writing cron jobs + +Some of the cron jobs can easily be configured using special strings that correspond to certain time intervals. For example, + +1)  @hourly timestamp corresponds to  0 * * * * + +It will execute a task in the first minute of every hour. + +@hourly /path/to/script + +2) @daily timestamp is equivalent to  0 0 * * * + +It executes a task in the first minute of every day (midnight). It comes in handy when executing daily jobs. + +  @daily /path/to/script + +3) @weekly   timestamp is the equivalent to  0 0 1 * mon + +It executes a cron job in the first minute of every week where a week whereby, a  week starts on Monday. + + @weekly /path/to/script + +3) @monthly is similar to the entry 0 0 1 * * + +It carries out a task in the first minute of the first day of the month. + +  @monthly /path/to/script + +4) @yearly corresponds to 0 0 1 1 * + +It executes a task in the first minute of every year and is useful in sending New year greetings 🙂 + +@monthly /path/to/script + +### Crontab Restrictions + +As a Linux user, you can control who has the right to use the crontab command. This is possible using the **/etc/cron.deny** and **/etc/cron.allow** file. By default, only the /etc/cron.deny file exists and does not contain any entries. To restrict a user from using the crontab utility, simply add a user’s username to the file. When a user is added to this file, and the user tries to run the crontab command, he/she will encounter the error below. + +![restricted-cron-user][1] + +To allow the user to continue using the crontab utility,  simply remove the username from the /etc/cron.deny file. + +If /etc/cron.allow file is present, then only the users listed in the file can access and use the crontab utility. + +If neither file exists, then only the root user will have privileges to use the crontab command. + +### Backing up crontab entries + +It’s always advised to backup your crontab entries. To do so, use the syntax + +# crontab -l > /path/to/file.txt + +For example, + +``` +# crontab -l > /home/james/backup.txt +``` + +**Checking cron logs** + +Cron logs are stored in /var/log/cron file. To view the cron logs run the command: + +``` +# cat /var/log/cron +``` + +![view-cron-log-files-linux][1] + +To view live logs, use the tail command as shown: + +``` +# tail -f /var/log/cron +``` + +![view-live-cron-logs][1] + +**Conclusion** + +In this guide, you learned how to create cron jobs to automate repetitive tasks, how to backup as well as how to view cron logs. We hope that this article provided useful insights with regard to cron jobs. Please don’t hesitate to share your feedback and comments. + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/ + +作者:[Pradeep Kumar][a] +选题:[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/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Schedule-tasks-in-Linux-using-cron.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/etc-crontab-linux.png From 77f04655bc65229015d49aaa2f06ac71983682da Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 Nov 2019 00:55:56 +0800 Subject: [PATCH 345/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191106=20An=20i?= =?UTF-8?q?ntroduction=20to=20monitoring=20with=20Prometheus?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191106 An introduction to monitoring with Prometheus.md --- ...roduction to monitoring with Prometheus.md | 434 ++++++++++++++++++ 1 file changed, 434 insertions(+) create mode 100644 sources/tech/20191106 An introduction to monitoring with Prometheus.md diff --git a/sources/tech/20191106 An introduction to monitoring with Prometheus.md b/sources/tech/20191106 An introduction to monitoring with Prometheus.md new file mode 100644 index 0000000000..4a6db0757f --- /dev/null +++ b/sources/tech/20191106 An introduction to monitoring with Prometheus.md @@ -0,0 +1,434 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An introduction to monitoring with Prometheus) +[#]: via: (https://opensource.com/article/19/11/introduction-monitoring-prometheus) +[#]: author: (Yuri Grinshteyn https://opensource.com/users/yuri-grinshteyn) + +An introduction to monitoring with Prometheus +====== +Prometheus is a popular and powerful toolkit to monitor Kubernetes. This +is a tutorial on how to get started. +![Wheel of a ship][1] + +[Metrics are the primary way][2] to represent both the overall health of your system and any other specific information you consider important for monitoring and alerting or observability. [Prometheus][3] is a leading open source metric instrumentation, collection, and storage toolkit [built at SoundCloud][4] beginning in 2012. Since then, it's [graduated][5] from the Cloud Native Computing Foundation and become the de facto standard for Kubernetes monitoring. It has been covered in some detail in: + + * [Getting started with Prometheus][6] + * [5 examples of Prometheus monitoring success][7] + * [Achieve high-scale application monitoring with Prometheus][8] + * [Tracking the weather with Python and Prometheus][9] + + + +However, none of these articles focus on how to use Prometheus on Kubernetes. This article: + + * Describes the Prometheus architecture and data model to help you understand how it works and what it can do + * Provides a tutorial on setting Prometheus up in a Kubernetes cluster and using it to monitor clusters and applications + + + +### Architecture + +While knowing how Prometheus works may not be essential to using it effectively, it can be helpful, especially if you're considering using it for production. The [Prometheus documentation][10] provides this graphic and details about the essential elements of Prometheus and how the pieces connect together. + +[![Prometheus architecture][11]][10] + +For most use cases, you should understand three major components of Prometheus: + + 1. The Prometheus **server** scrapes and stores metrics. Note that it uses a **persistence** layer, which is part of the server and not expressly mentioned in the documentation. Each node of the server is autonomous and does not rely on distributed storage. I'll revisit this later when looking to use a dedicated time-series database to store Prometheus data, rather than relying on the server itself. + 2. The web **UI** allows you to access, visualize, and chart the stored data. Prometheus provides its own UI, but you can also configure other visualization tools, like [Grafana][12], to access the Prometheus server using PromQL (the Prometheus Query Language). + 3. **Alertmanager** sends alerts from client applications, especially the Prometheus server. It has advanced features for deduplicating, grouping, and routing alerts and can route through other services like PagerDuty and OpsGenie. + + + +The key to understanding Prometheus is that it fundamentally relies on **scraping**, or pulling, metrics from defined endpoints. This means that your application needs to expose an endpoint where metrics are available and instruct the Prometheus server how to scrape it (this is covered in the tutorial below). There are [exporters][13] for many applications that do not have an easy way to add web endpoints, such as [Kafka][14] and [Cassandra][15] (using the JMX exporter). + +### Data model + +Now that you understand how Prometheus works to scrape and store metrics, the next thing to learn is the kinds of metrics Prometheus supports. Some of the following information (noted with quotation marks) comes from the [metric types][16] section of the Prometheus documentation. + +#### Counters and gauges + +The two simplest metric types are **counter** and **gauge**. When getting started with Prometheus (or with time-series monitoring more generally), these are the easiest types to understand because it's easy to connect them to values you can imagine monitoring, like how much system resources your application is using or how many events it has processed. + +> "A **counter** is a cumulative metric that represents a single monotonically increasing counter whose value can only **increase** or be **reset** to zero on restart. For example, you can use a counter to represent the number of requests served, tasks completed, or errors." + +Because you cannot decrease a counter, it can and should be used only to represent cumulative metrics. + +> "A **gauge** is a metric that represents a single numerical value that can arbitrarily go up and down. Gauges are typically used for measured values like [CPU] or current memory usage, but also 'counts' that can go up and down, like the number of concurrent requests." + +#### Histograms and summaries + +Prometheus supports two more complex metric types: [**histograms**][17] [and][17] [**summaries**][17]. There is ample opportunity for confusion here, given that they both track the number of observations _and_ the sum of observed values. One of the reasons you might choose to use them is that you need to calculate an average of the observed values. Note that they create multiple time series in the database; for example, they each create a sum of the observed values with a **_sum** suffix. + +> "A **histogram** samples observations (usually things like request durations or response sizes) and counts them in configurable buckets. It also provides a sum of all observed values." + +This makes it an excellent candidate to track things like latency that might have a service level objective (SLO) defined against it. From the [documentation][17]: + +> You might have an SLO to serve 95% of requests within 300ms. In that case, configure a histogram to have a bucket with an upper limit of 0.3 seconds. You can then directly express the relative amount of requests served within 300ms and easily alert if the value drops below 0.95. The following expression calculates it by job for the requests served in the last 5 minutes. The request durations were collected with a histogram called **http_request_duration_seconds**. +> +> [code]`sum(rate(http_request_duration_seconds_bucket{le="0.3"}[5m])) by (job) / sum(rate(http_request_duration_seconds_count[5m])) by (job)` +``` +> +>   + +Returning to definitions: + +> "Similar to a histogram, a **summary** samples observations (usually things like request durations and response sizes). While it also provides a total count of observations and a sum of all observed values, it calculates configurable quantiles over a sliding time window." + +The essential difference between summaries and histograms is that summaries calculate streaming φ-quantiles on the client-side and expose them directly, while histograms expose bucketed observation counts, and the calculation of quantiles from the buckets of a histogram happens on the server-side using the **histogram_quantile()** function. + +If you are still confused, I suggest taking the following approach: + + * Use gauges most of the time for straightforward time-series metrics. + * Use counters for things you know to increase monotonically, e.g., if you are counting the number of times something happens. + * Use histograms for latency measurements with simple buckets, e.g., one bucket for "under SLO" and another for "over SLO." + + + +This should be sufficient for the overwhelming majority of use cases, and you should rely on a statistical analysis expert to help you with more advanced scenarios. + +Now that you have a basic understanding of what Prometheus is, how it works, and the kinds of data it can collect and store, you're ready to begin the tutorial. + +## Prometheus and Kubernetes hands-on tutorial + +This tutorial covers the following: + + * Installing Prometheus in your cluster + * Downloading the sample application and reviewing the code + * Building and deploying the app and generating load against it + * Accessing the Prometheus UI and reviewing the basic metrics + + + +This tutorial assumes: + + * You already have a Kubernetes cluster deployed. + * You have configured the **kubectl** command-line utility for access. + * You have the **cluster-admin** role (or at least sufficient privileges to create namespaces and deploy applications). + * You are running a Bash-based command-line interface. Adjust this tutorial if you run other operating systems or shell environments. + + + +If you don't have Kubernetes running yet, this [Minikube tutorial][18] is an easy way to set it up on your laptop. + +If you're ready now, let's go. + +### Install Prometheus + +In this section, you will clone the sample repository and use Kubernetes' configuration files to deploy Prometheus to a dedicated namespace. + + 1. Clone the sample repository locally and use it as your working directory: [code] $ git clone +$ cd  prometheus-demo +$ WORKDIR=$(pwd) +``` + 2. Create a dedicated namespace for the Prometheus deployment: [code]`$ kubectl create namespace prometheus` +``` + 3. Give your namespace the cluster reader role: [code] $ kubectl apply -f $WORKDIR/kubernetes/clusterRole.yaml +clusterrole.rbac.authorization.k8s.io/prometheus created +clusterrolebinding.rbac.authorization.k8s.io/prometheus created +``` + 4. Create a Kubernetes configmap with scraping and alerting rules: [code] $ kubectl apply -f $WORKDIR/kubernetes/configMap.yaml -n prometheus +configmap/prometheus-server-conf created +``` + 5. Deploy Prometheus: [code] $ kubectl create -f prometheus-deployment.yaml -n prometheus +deployment.extensions/prometheus-deployment created +``` + 6. Validate that Prometheus is running: [code] $ kubectl get pods -n prometheus +NAME                                     READY   STATUS    RESTARTS   AGE +prometheus-deployment-78fb5694b4-lmz4r   1/1     Running   0          15s +``` +### Review basic metrics + +In this section, you'll access the Prometheus UI and review the metrics being collected. + + 1. Use port forwarding to enable web access to the Prometheus UI locally: +**Note:** Your **prometheus-deployment** will have a different name than this example. Review and replace the name of the pod from the output of the previous command. [code] $ kubectl port-forward prometheus-deployment-7ddb99dcb-fkz4d 8080:9090 -n prometheus +Forwarding from 127.0.0.1:8080 -> 9090 +Forwarding from [::1]:8080 -> 9090 +``` + + 2. Go to in a browser: +![Prometheus console][19] + +You are now ready to query Prometheus metrics! + + + + 3. Some basic machine metrics (like the number of CPU cores and memory) are available right away. For example, enter **machine_memory_bytes** in the expression field, switch to the Graph view, and click Execute to see the metric charted: + + + +![Prometheus metric channel][20] + + 4. Containers running in the cluster are also automatically monitored. For example, enter **rate(container_cpu_usage_seconds_total{container_name="prometheus"}[1m])** as the expression and click Execute to see the rate of CPU usage by Prometheus: + + + +![CPU usage metric][21] + +Now that you know how to install Prometheus and use it to measure some out-of-the-box metrics, it's time for some real monitoring. + +#### Golden signals + +As described in the "[Monitoring Distributed Systems][22]" chapter of [Google's SRE][23] book: + +> "The four golden signals of monitoring are latency, traffic, errors, and saturation. If you can only measure four metrics of your user-facing system, focus on these four." + +The book offers thorough descriptions of all four, but this tutorial focuses on the three signals that most easily serve as proxies for user happiness: + + * **Traffic:** How many requests you're receiving + * **Error rate:** How many of those requests you can successfully serve + * **Latency:** How quickly you can serve successful requests + + + +As you probably realize by now, Prometheus does not measure any of these for you; you'll have to instrument any application you deploy to emit them. Following is an example implementation. + +Open the **$WORKDIR/node/golden_signals/app.js** file, which is a sample application written in Node.js (recall we cloned **yuriatgoogle/prometheus-demo** and exported **$WORKDIR** earlier). Start by reviewing the first section, where the metrics to be recorded are defined: + + +``` +// total requests - counter +const nodeRequestsCounter = new prometheus.Counter({ +    name: 'node_requests', +    help: 'total requests' +}); +``` + +The first metric is a counter that will be incremented for each request; this is how the total number of requests is counted: + + +``` +// failed requests - counter +const nodeFailedRequestsCounter = new prometheus.Counter({ +    name: 'node_failed_requests', +    help: 'failed requests' +}); +``` + +The second metric is another counter that increments for each error to track the number of failed requests: + + +``` +// latency - histogram +const nodeLatenciesHistogram = new prometheus.Histogram({ +    name: 'node_request_latency', +    help: 'request latency by path', +    labelNames: ['route'], +    buckets: [100, 400] +}); +``` + +The third metric is a histogram that tracks request latency. Working with a very basic assumption that the SLO for latency is 100ms, you will create two buckets: one for 100ms and the other 400ms latency. + +The next section handles incoming requests, increments the total requests metric for each one, increments failed requests when there is an (artificially induced) error, and records a latency histogram value for each successful request. I have chosen not to record latencies for errors; that implementation detail is up to you. + + +``` +app.get('/', (req, res) => { +    // start latency timer +    const requestReceived = new Date().getTime(); +    console.log('request made'); +    // increment total requests counter +    nodeRequestsCounter.inc(); +    // return an error 1% of the time +    if ((Math.floor(Math.random() * 100)) == 100) { +        // increment error counter +        nodeFailedRequestsCounter.inc(); +        // return error code +        res.send("error!", 500); +    } +    else { +        // delay for a bit +        sleep.msleep((Math.floor(Math.random() * 1000))); +        // record response latency +        const responseLatency = new Date().getTime() - requestReceived; +        nodeLatenciesHistogram +            .labels(req.route.path) +            .observe(responseLatency); +        res.send("success in " + responseLatency + " ms"); +    } +}) +``` + +#### Test locally + +Now that you've seen how to implement Prometheus metrics, see what happens when you run the application. + + 1. Install the required packages: [code] $ cd $WORKDIR/node/golden_signals +$ npm install --save +``` +2. Launch the app: [code]`$ node app.js` +``` + 3. Open two browser tabs: one to and another to . + 4. When you go to the **/metrics** page, you can see the Prometheus metrics being collected and updated every time you reload the home page: + + + +![Prometheus metrics being collected][24] + +You're now ready to deploy the sample application to your Kubernetes cluster and test your monitoring. + +#### Deploy monitoring to Prometheus on Kubernetes + +Now it's time to see how metrics are recorded and represented in the Prometheus instance deployed in your cluster by: + + * Building the application image + * Deploying it to your cluster + * Generating load against the app + * Observing the metrics recorded + + + +##### Build the application image + +The sample application provides a Dockerfile you'll use to build the image. This section assumes that you have: + + * Docker installed and configured locally + * A Docker Hub account + * Created a repository + + + +If you're using Google Kubernetes Engine to run your cluster, you can use Cloud Build and the Google Container Registry instead. + + 1. Switch to the application directory: [code]`$ cd $WORKDIR/node/golden_signals` +``` +2. Build the image with this command: [code]`$ docker build . --tag=/prometheus-demo-node:latest` +``` + 3. Make sure you're logged in to Docker Hub: [code]`$ docker login` +``` +4. Push the image to Docker Hub using this command: [code]`$ docker push /prometheus-demo-node:latest` +``` + 5. Verify that the image is available: [code]`$ docker images` +``` +#### Deploy the application + +Now that the application image is in the Docker Hub, you can deploy it to your cluster and run the application. + + 1. Modify the **$WORKDIR/node/golden_signals/prometheus-demo-node.yaml** file to pull the image from Docker Hub: [code] spec: +      containers: +      - image: docker.io/<Docker username>/prometheus-demo-node:latest +``` + 2. Deploy the image: [code] $ kubectl apply -f $WORKDIR/node/golden_signals/prometheus-demo-node.yaml +deployment.extensions/prometheus-demo-node created +``` + 3. Verify that the application is running: [code] $ kubectl get pods +NAME                                    READY   STATUS    RESTARTS   AGE +prometheus-demo-node-69688456d4-krqqr   1/1     Running   0          65s +``` + 4. Expose the application using a load balancer: [code] $ kubectl expose deployment prometheus-node-demo --type=LoadBalancer --name=prometheus-node-demo --port=8080 +service/prometheus-demo-node exposed +``` + 5. Confirm that your service has an external IP address: [code] $ kubectl get services +NAME                   TYPE           CLUSTER-IP      EXTERNAL-IP      PORT(S)          AGE +kubernetes             ClusterIP      10.39.240.1     <none>           443/TCP          23h +prometheus-demo-node   LoadBalancer   10.39.248.129   35.199.186.110   8080:31743/TCP   78m +``` + + + +##### Generate load to test monitoring + +Now that your service is up and running, generate some load against it by using [Apache Bench][25]. + + 1. Get the IP address of your service as a variable: [code]`$ export SERVICE_IP=$(kubectl get svc prometheus-demo-node -ojson | jq -r '.status.loadBalancer.ingress[].ip')` +``` +2. Use **ab** to generate some load. You may want to run this in a separate terminal window. [code]`$ ab -c 3 -n 1000 http://${SERVICE_IP}:8080/` +``` + + + +##### Review metrics + +While the load is running, access the Prometheus UI in the cluster again and confirm that the "golden signal" metrics are being collected. + + 1. Establish a connection to Prometheus: [code] + +$ kubectl get pods -n prometheus +NAME                                     READY   STATUS    RESTARTS   AGE +prometheus-deployment-78fb5694b4-lmz4r   1/1     Running   0          15s + +$ kubectl port-forward prometheus-deployment-78fb5694b4-lmz4r 8080:9090 -n prometheus +Forwarding from 127.0.0.1:8080 -> 9090 +Forwarding from [::1]:8080 -> 9090 + +``` +**Note:** Make sure to replace the name of the pod in the second command with the output of the first. + + 2. Open in a browser: + + + + +![Prometheus console][26] + + 3. Use this expression to measure the request rate: [code]`rate(node_requests[1m])` +``` + + + +![Measuring the request rate][27] + + 4. Use this expression to measure your error rate: [code]`rate(node_failed_requests[1m])` +``` +![Measuring the error rate][28] + + 5. Finally, use this expression to validate your latency SLO. Remember that you set up two buckets, 100ms and 400ms. This expression returns the percentage of requests that meet the SLO : [code]`sum(rate(node_request_latency_bucket{le="100"}[1h])) / sum(rate(node_request_latency_count[1h]))` +``` + + + +![SLO query graph][29] + +About 10% of the requests are within SLO. This is what you should expect since the code sleeps for a random number of milliseconds between 0 and 1,000. As such, about 10% of the time, it returns in more than 100ms, and this graph shows that you can't meet the latency SLO as a result. + +### Summary + +Congratulations! You've completed the tutorial and hopefully have a much better understanding of how Prometheus works, how to instrument your application with custom metrics, and how to use it to measure your SLO compliance. The next article in this series will look at another metric instrumentation approach using OpenCensus. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/introduction-monitoring-prometheus + +作者:[Yuri Grinshteyn][a] +选题:[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/yuri-grinshteyn +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kubernetes.png?itok=PqDGb6W7 (Wheel of a ship) +[2]: https://opensource.com/article/19/10/open-source-observability-kubernetes +[3]: https://prometheus.io/ +[4]: https://en.wikipedia.org/wiki/Prometheus_(software)#History +[5]: https://www.cncf.io/announcement/2018/08/09/prometheus-graduates/ +[6]: https://opensource.com/article/18/12/introduction-prometheus +[7]: https://opensource.com/article/18/9/prometheus-operational-advantage +[8]: https://opensource.com/article/19/10/application-monitoring-prometheus +[9]: https://opensource.com/article/19/4/weather-python-prometheus +[10]: https://prometheus.io/docs/introduction/overview/ +[11]: https://opensource.com/sites/default/files/uploads/prometheus-architecture.png (Prometheus architecture) +[12]: https://grafana.com/ +[13]: https://prometheus.io/docs/instrumenting/exporters/ +[14]: https://github.com/danielqsj/kafka_exporter +[15]: https://github.com/prometheus/jmx_exporter +[16]: https://prometheus.io/docs/concepts/metric_types/ +[17]: https://prometheus.io/docs/practices/histograms/ +[18]: https://opensource.com/article/18/10/getting-started-minikube +[19]: https://opensource.com/sites/default/files/uploads/prometheus-console.png (Prometheus console) +[20]: https://opensource.com/sites/default/files/uploads/prometheus-machine_memory_bytes.png (Prometheus metric channel) +[21]: https://opensource.com/sites/default/files/uploads/prometheus-cpu-usage.png (CPU usage metric) +[22]: https://landing.google.com/sre/sre-book/chapters/monitoring-distributed-systems/ +[23]: https://landing.google.com/sre/sre-book/toc/ +[24]: https://opensource.com/sites/default/files/uploads/prometheus-metrics-collected.png (Prometheus metrics being collected) +[25]: https://httpd.apache.org/docs/2.4/programs/ab.html +[26]: https://opensource.com/sites/default/files/uploads/prometheus-enable-query-history.png (Prometheus console) +[27]: https://opensource.com/sites/default/files/uploads/prometheus-request-rate.png (Measuring the request rate) +[28]: https://opensource.com/sites/default/files/uploads/prometheus-error-rate.png (Measuring the error rate) +[29]: https://opensource.com/sites/default/files/uploads/prometheus-slo-query.png (SLO query graph) From 752babff7a3c27c95b0e1db131e996cd43da756a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 Nov 2019 00:56:28 +0800 Subject: [PATCH 346/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191106=20Gettin?= =?UTF-8?q?g=20started=20with=20Pimcore:=20An=20open=20source=20alternativ?= =?UTF-8?q?e=20for=20product=20information=20management?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191106 Getting started with Pimcore- An open source alternative for product information management.md --- ...tive for product information management.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20191106 Getting started with Pimcore- An open source alternative for product information management.md diff --git a/sources/tech/20191106 Getting started with Pimcore- An open source alternative for product information management.md b/sources/tech/20191106 Getting started with Pimcore- An open source alternative for product information management.md new file mode 100644 index 0000000000..9e875a5019 --- /dev/null +++ b/sources/tech/20191106 Getting started with Pimcore- An open source alternative for product information management.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Pimcore: An open source alternative for product information management) +[#]: via: (https://opensource.com/article/19/11/pimcore-alternative-product-information-management) +[#]: author: (Dietmar Rietsch https://opensource.com/users/erinmcmahon) + +Getting started with Pimcore: An open source alternative for product information management +====== +PIM software enables sellers to centralize sales, marketing, and +technical product information to engage better with customers. +![Pair programming][1] + +Product information management (PIM) software enables sellers to consolidate product data into a centralized repository that acts as a single source of truth, minimizing errors and redundancies in product data. This, in turn, makes it easier to share high-quality, clear, and accurate product information across customer touchpoints, paving the way for rich, consistent, readily accessible content that's optimized for all the channels customers use, including websites, social platforms, marketplaces, apps, IoT devices, conversational interfaces, and even print catalogs and physical stores. Being able to engage with customers on their favorite platform is essential for increasing sales and expanding into new markets. For years, there have been proprietary products that address some of these needs, like Salsify for data management, Adobe Experience Manager, and SAP Commerce Cloud for experience management, but now there's an open source alternative called Pimcore. + +[Pimcore PIM][2] is an open source enterprise PIM, dual-[licensed][3] under GPLv3 and Pimcore Enterprise License (PEL) that enables sellers to centralize and harmonize sales, marketing, and technical product information. Pimcore can acquire, manage, and share any digital data and integrate easily into an existing IT system landscape. Its API-driven, service-oriented architecture enables fast and seamless connection to third-party software such as enterprise resource planning (ERP), customer relationship management (CRM), business intelligence (BI), and more. + +### Open source vs. proprietary PIM software + +There are at least four significant differences between open source and proprietary software that PIM users should consider. + + * **Vendor lock-in:** It is more difficult to customize proprietary software. If you want to develop a new feature or modify an existing one, proprietary software lock-in makes you dependent on the vendor. On the other hand, open source provides unlimited access and flexibility to modify the source code and leverage it to your advantage, as well as the opportunity to freely access contributions made by the community behind it. + * **Interoperability:** Open source PIM software offers greater interoperability capabilities with APIs for integration with third-party business applications. Since the source code is open and available, users can customize or build connectors to meet their needs, which is not possible with proprietary software. + * **Community:** Open source solutions are supported by vibrant communities of contributors, implementers, developers, and other enthusiasts working towards enhancing the solution. Proprietary PIM software typically depends on commercial partnerships for implementation assistance and customizations. + * **Total cost of ownership:** Proprietary software carries a significant license fee for deployment, which includes implementation, customization, and system maintenance. In contrast, open source software development can be done in-house or through an IT vendor. This becomes a huge advantage for enterprises with tight budgets, as it slashes PIM operating costs. + + + +### Pimcore features + +Pimcore's platform is divided into two core offerings: data management and experience management. In addition to being open source and free to download and use, its features include the following. + +#### Data modeling + +Pimcore's web-based data modeling engine has over 40 high-performance data types that can help companies easily manage zillions of products or other master data with thousands of attributes. It also offers multilingual data management, object relations, data classification, digital asset management (DAM), and data modeling supported by data inheritance. + +![Pimcore translations inheritance][4] + +#### Data management + +Pimcore enables efficient enterprise data management that focuses on ease of use; consistency in aggregation, organization, classification, and translation of product information; and sound data governance to enable optimization, flexibility, and scalability. + +![PIM batch change][5] + +#### Data quality + +Data quality management is the basis for analytics and business intelligence (BI). Pimcore supports data quality, completeness, and validation, and includes rich auditing and versioning features to help organizations meet revenue goals, compliance requirements, and productivity objectives. Pimcore also offers a configurable dashboard, custom reports capabilities, filtering, and export functionalities. + +![PIM data quality and completeness][6] + +#### Workflow management + +Pimcore's advanced workflow engine makes it easy to build and modify workflows to improve accuracy and productivity and reduce risks. Drop-downs enable enterprises to chalk out workflow paths to define business processes and editorial workflows with ease, and the customizable management and administration interface makes it easy to integrate workflows into an organization's application infrastructure. + +![Pimcore workflow management][7] + +#### Data consolidation + +Pimcore eliminates data silos by consolidating data in a central place and creating a single master data record or a single point of truth. It does this by gathering data lying in disparate systems spread across geographic locations, departments, applications, hard drives, vendors, suppliers, and more. By consolidating data, enterprises can get improved accuracy, reliability, and efficacy of information, lower cost of compliance, and decreased time-to-market. + +#### Synchronization across channels + +Pimcore's tools for gathering and managing digital data enable sellers to deliver it across any channel or device to reach individual customers on their preferred platforms. This helps enterprises enrich the user experience, leverage a single point of control to optimize performance, improve data governance, streamline product data lifecycle management, and boost productivity to reduce time-to-market and meet customers' expectations. + +### Installing, trying, and using Pimcore + +The best way to start exploring Pimcore is with a guided tour or demo; before you begin, make sure that you have the [system requirements][8] in place. + +#### Demo Pimcore + +Navigate to the [Pimcore demo][9] page and either register for a guided tour or click on one of the products in the "Try By Yourself" column for a self-guided demo. Enter the username **admin** and password **demo** to begin the demo. + +![Pimcore demo page][10] + +#### Download and install Pimcore + +If you want to take a deeper dive, you can [download Pimcore][11]; you can choose the data management or the experience management offering or both. You will need to enter your contact information and then immediately receive installation instructions. + +![Pimcore download interface][12] + +You can also choose from four installation packages: three are demo packages for beginners, and one is a skeleton for experienced developers. All contain: + + * Complete Pimcore platform + * Latest open source version + * Quick-start guide + * Demo data for getting started + + + +If you are installing Pimcore on a typical [LAMP][13] environment (which is recommended), see the [Pimcore installation guide][14]. If you're using another setup (e.g., Nginx), see the [installation, setup, and upgrade guide][15] for details. + +![Pimcore installation documentation][16] + +### Contribute to Pimcore + +As open source software, users are encouraged to engage with, [contribute][17] to, and fork Pimcore. For tracking bugs and features, as well as for software management, Pimcore relies exclusively on [GitHub][18], where contributions are assessed and carefully curated to uphold Pimcore's quality standards. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/pimcore-alternative-product-information-management + +作者:[Dietmar Rietsch][a] +选题:[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/erinmcmahon +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1 (Pair programming) +[2]: https://pimcore.com/en +[3]: https://github.com/pimcore/pimcore/blob/master/LICENSE.md +[4]: https://opensource.com/sites/default/files/uploads/pimcoretranslationinheritance.png (Pimcore translations inheritance) +[5]: https://opensource.com/sites/default/files/uploads/pimcorebatchchange.png (PIM batch change) +[6]: https://opensource.com/sites/default/files/uploads/pimcoredataquality.png (PIM data quality and completeness) +[7]: https://opensource.com/sites/default/files/pimcore-workflow-management.jpg (Pimcore workflow management) +[8]: https://pimcore.com/docs/5.x/Development_Documentation/Installation_and_Upgrade/System_Requirements.html +[9]: https://pimcore.com/en/try +[10]: https://opensource.com/sites/default/files/uploads/pimcoredemopage.png (Pimcore demo page) +[11]: https://pimcore.com/en/download +[12]: https://opensource.com/sites/default/files/uploads/pimcoredownload.png (Pimcore download interface) +[13]: https://en.wikipedia.org/wiki/LAMP_(software_bundle) +[14]: https://pimcore.com/docs/5.x/Development_Documentation/Getting_Started/Installation.html +[15]: https://pimcore.com/docs/5.x/Development_Documentation/Installation_and_Upgrade/index.html +[16]: https://opensource.com/sites/default/files/uploads/pimcoreinstall.png (Pimcore installation documentation) +[17]: https://github.com/pimcore/pimcore/blob/master/CONTRIBUTING.md +[18]: https://github.com/pimcore/pimcore From 837b6a90a5ad248f14045269deb951968949f393 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 Nov 2019 00:59:48 +0800 Subject: [PATCH 347/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191106=20My=20f?= =?UTF-8?q?irst=20contribution=20to=20open=20source:=20Make=20a=20fork=20o?= =?UTF-8?q?f=20the=20repo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md --- ...to open source- Make a fork of the repo.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md diff --git a/sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md b/sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md new file mode 100644 index 0000000000..a19be04897 --- /dev/null +++ b/sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md @@ -0,0 +1,50 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My first contribution to open source: Make a fork of the repo) +[#]: via: (https://opensource.com/article/19/11/first-open-source-contribution-fork-clone) +[#]: author: (Galen Corey https://opensource.com/users/galenemco) + +My first contribution to open source: Make a fork of the repo +====== +Which comes first, to clone or fork a repo? +![User experience vs. design][1] + +Previously, I explained [how I ultimately chose a project][2] for my contributions. Once I finally picked that project and a task to work on, I felt like the hard part was over, and I slid into cruise control. I knew what to do next, no question. Just clone the repository so that I have the code on my computer, make a new branch for my work, and get coding, right? + +It turns out I made a crucial mistake at this step. Unfortunately, I didn’t realize that I had made a mistake until several hours later when I tried to push my completed code back up to GitHub and got a permission denied error. My third mistake was trying to work directly from a clone of the repo. + +When you want to contribute to someone else’s repo, in most cases, you should not clone the repo directly. Instead, you should make a fork of the repo and clone that. You do all of your work on a branch of your fork. Then, when you are ready to make a pull request, you can compare your branch on the fork against the master branch of the original repo. + +Before this, I had only ever worked on repos that I either created or had collaborator permissions for, so I could work directly from a clone of the main repo. I did not realize that GitHub even offered the capability to make a pull request from a repo fork onto the original repo. Now that I’ve learned a bit about this option, it is a great feature that makes sense. Forking allows a project to open the ability to contribute to anyone with a GitHub account without having to add them all as "contributors." It also helps keep the main project clean by keeping most new branches on forks, so that they don’t create clutter. + +I would have preferred to know this before I started writing my code (or, in this case, finished writing my code, since I didn’t attempt to push any of my changes to GitHub until the end). Moving my changes over from the main repo that I originally worked on into the fork was non-trivial. + +For those of you getting started, here are the steps to make a PR on a repository that you do not own, or where you are not a collaborator. I highly recommend trying to push your code to GitHub and at least going through the steps of creating a PR before you get too deep into coding, just to make sure you have everything set up the right way: + + 1. Make a fork of the repo you’ve chosen for your contributions. + 2. From the fork, click **Clone or download** to create a copy on your computer. +**Optional:** [Add the base repository as a remote "upstream,"][3] which is helpful if you want to pull down new changes from the base repository into your fork. + 3. [Create a pull request from the branch on your fork into the master branch of the base repository.][4] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/first-open-source-contribution-fork-clone + +作者:[Galen Corey][a] +选题:[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/galenemco +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_DesirePath.png?itok=N_zLVWlK (User experience vs. design) +[2]: https://opensource.com/article/19/10/first-open-source-contribution-mistake-two +[3]: https://help.github.com/en/articles/configuring-a-remote-for-a-fork +[4]: https://help.github.com/en/articles/creating-a-pull-request-from-a-fork From 9cbb36e149b71f70589503ef4bc4d69ef043fb25 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 Nov 2019 01:03:13 +0800 Subject: [PATCH 348/800] TSL&PRF --- ...ewing network bandwidth usage with bmon.md | 75 ++++++++----------- 1 file changed, 31 insertions(+), 44 deletions(-) rename {sources => translated}/tech/20191030 Viewing network bandwidth usage with bmon.md (68%) diff --git a/sources/tech/20191030 Viewing network bandwidth usage with bmon.md b/translated/tech/20191030 Viewing network bandwidth usage with bmon.md similarity index 68% rename from sources/tech/20191030 Viewing network bandwidth usage with bmon.md rename to translated/tech/20191030 Viewing network bandwidth usage with bmon.md index 107583b187..f1de5e4ecd 100644 --- a/sources/tech/20191030 Viewing network bandwidth usage with bmon.md +++ b/translated/tech/20191030 Viewing network bandwidth usage with bmon.md @@ -1,40 +1,33 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Viewing network bandwidth usage with bmon) [#]: via: (https://www.networkworld.com/article/3447936/viewing-network-bandwidth-usage-with-bmon.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -用 bmon 查看带宽使用情况 +用 bmon 查看网络带宽使用情况 ====== -Introducing bmon, a monitoring and debugging tool that captures network statistics and makes them easily digestible. -Sandra Henry-Stocker +> 介绍一下 bmon,这是一个监视和调试工具,可捕获网络统计信息并使它们易于理解。 -Bmon is a monitoring and debugging tool that runs in a terminal window and captures network statistics, offering options on how and how much data will be displayed and displayed in a form that is easy to understand. +![](https://img.linux.net.cn/data/attachment/album/201911/07/010237a8gb5oqddvl3bnd0.jpg) -To check if `bmon` is installed on your system, use the `which` command: +`bmon` 是一种监视和调试工具,可在终端窗口中捕获网络统计信息,并提供了如何以易于理解的形式显示以及显示多少数据的选项。 + +要检查系统上是否安装了 `bmon`,请使用 `which` 命令: ``` $ which bmon /usr/bin/bmon ``` -### Getting bmon +### 获取 bmon -On Debian systems, use `sudo apt-get install bmon` to install the tool. +在 Debian 系统上,使用 `sudo apt-get install bmon` 安装该工具。 -[][1] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][1] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -For Red Hat and related distributions, you might be able to install with `yum install bmon` or `sudo dnf install bmon`. Alternately, you may have to resort to a more complex install with commands like these that first set up the required `libconfuse` using the root account or sudo: +对于 Red Hat 和相关发行版,你可以使用 `yum install bmon` 或 `sudo dnf install bmon` 进行安装。或者,你可能必须使用更复杂的安装方式,例如使用以下命令,这些命令首先使用 root 帐户或 sudo 来设置所需的 `libconfuse`: ``` # wget https://github.com/martinh/libconfuse/releases/download/v3.2.2/confuse-3.2.2.zip @@ -49,15 +42,13 @@ For Red Hat and related distributions, you might be able to install with `yum in # sudo make install ``` -The first five lines will install `libconfuse` and the second five will grab and install `bmon` itself. +前面五行会安装 `libconfuse`,而后面五行会获取并安装 `bmon` 本身。 -### Using bmon +### 使用 bmon -The simplest way to start `bmon` is simply to type `bmon` on the command line. Depending on the size of the window you are using, you will be able to see and bring up a variety of data. +启动 `bmon` 的最简单方法是在命令行中键入 `bmon`。根据你正在使用的窗口的大小,你能够查看并显示各种数据。 -The top portion of your display will display stats on your network interfaces – the loopback (lo) and network-accessible (e.g., eth0). If you terminal window has few lines, this is all you may see, and it will look something like this: - -[RELATED: 11 pointless but awesome Linux terminal tricks][2] +显示区域的顶部将显示你的网络接口的统计信息:环回接口(lo)和可通过网络访问的接口(例如 eth0)。如果你的终端窗口只有区区几行高,下面这就是你可能会看到的所有内容,它将看起来像这样: ``` lo bmon 4.0 @@ -74,7 +65,7 @@ q Press i to enable additional information qq Wed Oct 23 14:36:27 2019 Press ? for help ``` -In this example, the network interface is enp0s25. Notice the helpful "Increase screen height" hint below the listed interfaces. Stretch your screen to add sufficient lines (no need to restart bmon) and you will see some graphs: +在此示例中,网络接口是 enp0s25。请注意列出的接口下方的有用的 “Increase screen height” 提示。拉伸屏幕以增加足够的行(无需重新启动 bmon),你将看到一些图形: ``` Interfaces x RX bps pps %x TX bps pps % @@ -101,7 +92,7 @@ qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqq 1 5 10 15 20 25 30 35 40 45 50 55 60 ``` -Notice, however, that the graphs are not showing values. This is because it is displaying the loopback `>lo` interface. Arrow your way down to the public network interface and you will see some traffic. +但是请注意,该图形未显示值。这是因为它正在显示环回 “>lo” 接口。按下箭头键指向公共网络接口,你将看到一些流量。 ``` Interfaces x RX bps pps %x TX bps pps % @@ -133,11 +124,11 @@ q Press i to enable additional information qq Wed Oct 23 16:42:06 2019 Press ? for help ``` -The change allows you to view a graph displaying network traffic. Note, however, that the default is to display bytes per second. To display bits per second instead, you would start the tool using `bmon -b` +通过更改接口,你可以查看显示了网络流量的图表。但是请注意,默认值是按每秒字节数显示的。要按每秒位数来显示,你可以使用 `bmon -b` 启动该工具。 -Detailed statistics on network traffic can be displayed if your window is large enough and you press `d`. An example of the stats you will see is displayed below. This display was split into left and right portions because of its width. +如果你的窗口足够大并按下 `d` 键,则可以显示有关网络流量的详细统计信息。你看到的统计信息示例如下所示。由于其宽度太宽,该显示分为左右两部分。 -##### left side: +左侧: ``` RX TX │ RX TX │ @@ -155,7 +146,7 @@ RX TX │ RX TX │ Window Error - 0 │ │ ``` -##### right side +右侧: ``` │ RX TX │ RX TX @@ -172,9 +163,9 @@ RX TX │ RX TX │ │ No Handler 0 - │ Over Error 0 - ``` -Additional information on the network interface will be displayed if you press `i` +如果按下 `i` 键,将显示网络接口上的其他信息。 -##### left side: +左侧: ``` MTU 1500 | Flags broadcast,multicast,up | @@ -182,7 +173,7 @@ Address 00:1d:09:77:9d:08 | Broadcast ff:ff:ff:ff:ff:ff | Family unspec | Alias | ``` -##### right side: +右侧: ``` | Operstate up | IfIndex 2 | @@ -190,19 +181,15 @@ Family unspec | Alias | | Qdisc fq_codel | ``` -A help menu will appear if you press `?` with brief descriptions of how to move around the screen, select data to be displayed and control the graphs. +如果你按下 `?` 键,将会出现一个帮助菜单,其中简要介绍了如何在屏幕上移动光标、选择要显示的数据以及控制图形如何显示。 -To quit `bmon`, you would type `q` and then `y` in response to the prompt to confirm your choice to exit. +要退出 `bmon`,输入 `q`,然后输入 `y` 以响应提示来确认退出。 -Some of the important things to note are that: +需要注意的一些重要事项是: - * `bmon` adjusts its display to the size of the terminal window - * some of the choices shown at the bottom of the display will only function if the window is large enough to accomodate the data - * the display is updated every second unless you slow this down using the `-R` (e.g., `bmon -R 5)` option - - - -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. +* `bmon` 会将其显示调整为终端窗口的大小 +* 显示区域底部显示的某些选项仅在窗口足够大可以容纳数据时才起作用 +* 除非你使用 `-R`(例如 `bmon -R 5`)来减慢显示速度,否则每秒更新一次显示 -------------------------------------------------------------------------------- @@ -210,8 +197,8 @@ via: https://www.networkworld.com/article/3447936/viewing-network-bandwidth-usag 作者:[Sandra Henry-Stocker][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 a00d977df1ef860927723422992829d4404856e7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 Nov 2019 01:06:04 +0800 Subject: [PATCH 349/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191106=20A=20Qu?= =?UTF-8?q?ick=20Look=20at=20Some=20of=20the=20Best=20Cloud=20Platforms=20?= =?UTF-8?q?for=20High=20Performance=20Computing=20Applications?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191106 A Quick Look at Some of the Best Cloud Platforms for High Performance Computing Applications.md --- ...High Performance Computing Applications.md | 152 ++++++++++++++++++ 1 file changed, 152 insertions(+) create mode 100644 sources/talk/20191106 A Quick Look at Some of the Best Cloud Platforms for High Performance Computing Applications.md diff --git a/sources/talk/20191106 A Quick Look at Some of the Best Cloud Platforms for High Performance Computing Applications.md b/sources/talk/20191106 A Quick Look at Some of the Best Cloud Platforms for High Performance Computing Applications.md new file mode 100644 index 0000000000..f684d6a5d7 --- /dev/null +++ b/sources/talk/20191106 A Quick Look at Some of the Best Cloud Platforms for High Performance Computing Applications.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A Quick Look at Some of the Best Cloud Platforms for High Performance Computing Applications) +[#]: via: (https://opensourceforu.com/2019/11/a-quick-look-at-some-of-the-best-cloud-platforms-for-high-performance-computing-applications/) +[#]: author: (Dr Kumar Gaurav https://opensourceforu.com/author/dr-gaurav-kumar/) + +A Quick Look at Some of the Best Cloud Platforms for High Performance Computing Applications +====== + +[![][1]][2] + +_Cloud platforms enable high performance computing without the need to purchase the required infrastructure. Cloud services are available on a ‘pay per use’ basis which is very economical. This article takes a look at cloud platforms like Neptune, BigML, Deep Cognition and Google Colaboratory, all of which can be used for high performance applications._ + +Software applications, smart devices and gadgets face many performance issues which include load balancing, turnaround time, delay, congestion, Big Data, parallel computations and others. These key issues traditionally consume enormous computational resources and low-configuration computers are not able to work on high performance tasks. The laptops and computers available in the market are designed for personal use; so these systems face numerous performance issues when they are tasked with high performance jobs. + +For example, a desktop computer or laptop with a 3GHz processor is able to perform approximately 3 billion computations per second. However, high performance computing (HPC) is focused on solving complex problems and working on quadrillions or trillions of computations with high speed and maximum accuracy. + +![Figure 1: The Neptune portal][3] + +![Figure 2: Creating a new project on the Neptune platform][4] + +**Application domains and use cases** +High performance computing applications are used in domains where speed and accuracy levels are quite high as compared to those in traditional scenarios, and the cost factor is also very high. + +The following are the use cases where high performance implementations are required: + + * Nuclear power plants + * Space research organisations + * Oil and gas exploration + * Artificial intelligence and knowledge discovery + * Machine learning and deep learning + * Financial services and digital forensics + * Geographical and satellite data analytics + * Bio-informatics and molecular sciences + + + +**Working with cloud platforms for high performance applications** +There are a number of cloud platforms on which high performance computing applications can be launched without users having actual access to the supercomputer. The billing for these cloud services is done on a usage basis and costs less compared to purchasing the actual infrastructure required to work with high performance computing applications. +The following are a few of the prominent cloud based platforms that can be used for advanced implementations including data science, data exploration, machine learning, deep learning, artificial intelligence, etc. + +**Neptune** +URL: __ +Neptune is a lightweight cloud based service for high performance applications including data science, machine learning, predictive knowledge discovery, deep learning, modelling training curves and many others. Neptune can be integrated with Jupyter notebooks so that Python programs can be easily executed for multiple applications. + +The Neptune dashboard is available at on which multiple experiments can be performed. Neptune works as a machine learning lab on which assorted algorithms can be programmed and their outcomes can be visualised. The platform is available as Software as a Service (SaaS) so that the deployment can be done on the cloud. The deployments can be done on the users’ own hardware and can be mapped with the Neptune cloud. + +In addition to having a pre-built cloud based platform, Neptune can be integrated with Python and R programming so that high performance applications can be programmed. Python and R are prominent programming environments for data science, machine learning, deep learning, Big Data and many other applications. + +For Python programming, Neptune provides neptune-client so that communication with the Neptune server can be achieved, and advanced data analytics can be implemented on its advanced cloud. +For integration of Neptune with R, there is an amazing and effective library ‘reticulate’ which integrates the use of neptune-client. + +The detailed documentation for the integration of R and Python with Neptune is available at _ and _. + +![Figure 3: Integration of Neptune with Jupyter Notebook][5] + +![Figure 4: Dashboard of BigML][6] + +In addition, integration with MLflow and TensorBoard is also available. MLflow is an open source platform for managing the machine learning life cycle with reproducibility, advanced experiments and deployments. It has three key components — tracking, projects and models. These can be programmed and controlled using the Neptune – MLflow integration. + +The association of TensorFlow with Neptune is possible using Neptune-TensorBoard. TensorFlow is one of the powerful frameworks for the deep learning and advanced knowledge discovery approaches. +With the use of assorted features and dimensions, the Neptune cloud can be used for high performance research based implementations. + +**BigML** +URL: __ + +BigML is a cloud based platform for the implementation of advanced algorithms with assorted data sets. This cloud based platform has a panel for implementing multiple machine learning algorithms with ease. +The BigML dashboard has access to different data sets and algorithms under supervised and unsupervised taxonomy, as shown in Figure 4. The researcher can use the algorithm from the menu according to the requirements of the research domain. + +![Figure 5: Algorithms and techniques integrated with BigML][7] + +A number of tools, libraries and repositories are integrated with BigML so that the programming, collaboration and reporting can be done with a higher degree of performance and minimum error levels. +Algorithms and techniques can be attached to specific data sets for evaluation and deep analytics, as shown in Figure 5. Using this methodology, the researcher can work with the code as well as the data set on easier platforms. + +The following are the tools and libraries associated with BigML for multiple applications of high performance computing: + + * Node-Red for flow diagrams + * GitHub repos + * BigMLer as the command line tool + * Alexa Voice Service + * Zapier for machine learning workflows + * Google Sheets + * Amazon EC2 Image PredictServer + * BigMLX app for MacOS + + + +![Figure 6: Enabling Google Colaboratory from Google Drive][8] + +![Figure 7: Activation of the hardware accelerator with Google Colaboratory notebook][9] + +**Google Colaboratory** +URL: __ +Google Colaboratory is one of the cloud platforms for the implementation of high performance computing tasks including artificial intelligence, machine learning, deep learning and many others. It is a cloud based service which integrates Jupyter Notebook so that Python code can be executed as per the application domain. +Google Colaboratory is available as a Google app in Google Cloud Services. It can be invoked from Google Drive as depicted in Figure 6 or directly at __. + +The Jupyter notebook in Google Colaboratory is associated with the CPU, by default. If a hardware accelerator is required, like the tensor processing unit (TPU) or the graphics processing unit (GPU), it can be activated from _Notebook Settings_, as shown in Figure 7. +Figure 8 presents a view of Python code that is imported in the Jupyter Notebook. The data set can be placed in Google Drive. The data set under analysis is mapped with the code so that the script can directly perform the operations as programmed in the code. The outputs and logs are presented on the Jupyter Notebook in the platform of Google Colaboratory. + +![Figure 8: Implementation of the Python code on the Google Colaboratory Jupyter Notebook][10] + +**Deep Cognition** +URL: __ +Deep Cognition provides the platform to implement advanced neural networks and deep learning models. AutoML with Deep Cognition provides an autonomous integrated development environment (IDE) so that the coding, testing and debugging of advanced models can be done. +It has a visual editor so that the multiple layers of different types can be programmed. The layers that can be imported are core layers, hidden layers, convolutional layers, recurrent layers, pooling layers and many others. +The platform provides the features to work with advanced frameworks and libraries of MXNet and TensorFlow for scientific computations and deep neural networks. + +![Figure 9: Importing layers in neural network models on Deep Cognition][11] + +**Scope for research and development** +Research scholars, academicians and practitioners can work on advanced algorithms and their implementations using cloud based platforms dedicated to high performance computing. With this type of implementation, there is no need to purchase the specific infrastructure or devices; rather, the supercomputing environment can be hired on the cloud. + +![Avatar][12] + +[Dr Kumar Gaurav][13] + +The author is the managing director of Magma Research and Consultancy Pvt Ltd, Ambala Cantonment, Haryana. He has 16 years experience in teaching, in industry and in research. He is a projects contributor for the Web-based source code repository SourceForge.net. He is associated with various central, state and deemed universities in India as a research guide and consultant. He is also an author and consultant reviewer/member of advisory panels for various journals, magazines and periodicals. The author can be reached at [kumargaurav.in@gmail.com][14]. + +[![][15]][16] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/a-quick-look-at-some-of-the-best-cloud-platforms-for-high-performance-computing-applications/ + +作者:[Dr Kumar Gaurav][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/dr-gaurav-kumar/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Big-ML-Colab-and-Deep-cognition.jpg?resize=696%2C384&ssl=1 (Big ML Colab and Deep cognition) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Big-ML-Colab-and-Deep-cognition.jpg?fit=900%2C497&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-The-Neptune-portal.jpg?resize=350%2C122&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-Creating-a-new-project-on-the-Neptune-platform.jpg?resize=350%2C161&ssl=1 +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-Integration-of-Neptune-with-Jupyter-Notebook.jpg?resize=350%2C200&ssl=1 +[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-Dashboard-of-BigML.jpg?resize=350%2C193&ssl=1 +[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-5-Algorithms-and-techniques-integrated-with-BigML.jpg?resize=350%2C200&ssl=1 +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-6-Enabling-Google-Colaboratory-from-Google-Drive.jpg?resize=350%2C253&ssl=1 +[9]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-7-Activation-of-the-hardware-accelerator-with-Google-Colaboratory-notebook.jpg?resize=350%2C264&ssl=1 +[10]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-8-Implementation-of-the-Python-code-on-the-Google-Colaboratory-Jupyter-Notebook.jpg?resize=350%2C253&ssl=1 +[11]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-9-Importing-layers-in-neural-network-models-on-Deep-Cognition.jpg?resize=350%2C254&ssl=1 +[12]: https://secure.gravatar.com/avatar/4a506881730a18516f8f839f49527105?s=100&r=g +[13]: https://opensourceforu.com/author/dr-gaurav-kumar/ +[14]: mailto:kumargaurav.in@gmail.com +[15]: http://opensourceforu.com/wp-content/uploads/2013/10/assoc.png +[16]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 9e39f30bcff8cf5bf18e18b590d5577871da8884 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 Nov 2019 01:07:27 +0800 Subject: [PATCH 350/800] PUB @wxy https://linux.cn/article-11547-1.html --- .../20191030 Viewing network bandwidth usage with bmon.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191030 Viewing network bandwidth usage with bmon.md (99%) diff --git a/translated/tech/20191030 Viewing network bandwidth usage with bmon.md b/published/20191030 Viewing network bandwidth usage with bmon.md similarity index 99% rename from translated/tech/20191030 Viewing network bandwidth usage with bmon.md rename to published/20191030 Viewing network bandwidth usage with bmon.md index f1de5e4ecd..53a16c45b8 100644 --- a/translated/tech/20191030 Viewing network bandwidth usage with bmon.md +++ b/published/20191030 Viewing network bandwidth usage with bmon.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11547-1.html) [#]: subject: (Viewing network bandwidth usage with bmon) [#]: via: (https://www.networkworld.com/article/3447936/viewing-network-bandwidth-usage-with-bmon.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 2ba11674e41524ca1838b5987522e27b4bd24dd6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Nov 2019 01:24:30 +0800 Subject: [PATCH 351/800] Rename sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md to sources/talk/20191106 My first contribution to open source- Make a fork of the repo.md --- ... first contribution to open source- Make a fork of the repo.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191106 My first contribution to open source- Make a fork of the repo.md (100%) diff --git a/sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md b/sources/talk/20191106 My first contribution to open source- Make a fork of the repo.md similarity index 100% rename from sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md rename to sources/talk/20191106 My first contribution to open source- Make a fork of the repo.md From 6a90562f94d42177c6b8e2ce3fb1f33e86bb43d9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 7 Nov 2019 01:25:58 +0800 Subject: [PATCH 352/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191106=20What?= =?UTF-8?q?=20it=20Takes=20to=20Be=20a=20Successful=20Network=20Engineer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191106 What it Takes to Be a Successful Network Engineer.md --- ...kes to Be a Successful Network Engineer.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/talk/20191106 What it Takes to Be a Successful Network Engineer.md diff --git a/sources/talk/20191106 What it Takes to Be a Successful Network Engineer.md b/sources/talk/20191106 What it Takes to Be a Successful Network Engineer.md new file mode 100644 index 0000000000..dc79765c7d --- /dev/null +++ b/sources/talk/20191106 What it Takes to Be a Successful Network Engineer.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What it Takes to Be a Successful Network Engineer) +[#]: via: (https://opensourceforu.com/2019/11/what-it-takes-to-be-a-successful-network-engineer/) +[#]: author: (Christopher Nichols https://opensourceforu.com/author/christopher-nichols/) + +What it Takes to Be a Successful Network Engineer +====== + +[![][1]][2] + +_Network engineering is an excellent field filled with complex and fulfilling work, and many job opportunities. As companies end up with networks that continue to become more complex and connect more devices together, network engineers are in high-demand. Being successful in this role requires several characteristics and skill sets that serve employees well in this fast-paced and mission-critical environment._ + +**Deep Understanding of Networking Technologies** +Some people might think that this characteristic is assumed when it comes to network engineering. However, there’s a distinct difference between knowing enough about networking to manage and monitor the system, and having a truly in-depth understanding of the subject matter. The best network engineers eat, breathe, and drink this type of technology. They keep up on top of the latest trends during their free time and are thrilled to learn about new developments in the field. + +**Detail Oriented** +Networking has a lot of moving parts and various types of software and hardware to work with. Paying close attention to all of the details ensures that the system is being monitored correctly and nothing gets lost in the shuffle. When data breaches are prevalent in the business world, stopping an intrusion could mean identifying a small red flag that popped up the day before. Without being alert to these details, the network ends up being vulnerable. + +**Problem Solving** +One of the most used skills in network engineering is problem-solving. Everything from troubleshooting issues for users to look for ways to improve the performance of the network requires it. When a worker in this field can quickly and efficiently solve issues through an analytical mindset, they free up a lot of time for strategic decision-making. + +**Team Coordination** +Many organizations have teams collaborating together across departments. The network engineer role may be a small part of the team or put in a management position based on the resources required for the project. Working with multiple teams requires strong people management skills and understanding how to move towards a common goal. + +**Ongoing Education** +Many continued education opportunities exist for network engineering. Many organizations offer certifications in specific networking technologies, whether the person is learning about a particular server operating system or branching out into subject areas that are related to networking. A drive for ongoing education means that the network engineer will always have their skills updated to adapt to the latest technology changes in the marketplace. Additionally, when these workers love to learn, they also seek out self-instruction opportunities. For example, they could [_read this guide_][3] to learn more about how VPN protocols work. + +**Documentation** +Strong writing skills may not be the first characteristic that comes to mind when someone thinks about a network engineer. However, it’s essential when it comes to writing technical documentation. Well-structured and clear documentation allows the network engineer to share information about the network with other people in the organization. If that person ends up leaving the company, the networking protocols, procedures and configuration remain in place because all of the data is available and understandable. + +**Jargon-free Communication** +Network engineers have frequent conversations with stakeholders and end users, who may not have a strong IT background. The common jargon used for talking with other members of the IT teams would leave this group confused and not understanding what you’re saying. When the network engineer can explain technology in simple terms, it makes it easier to get the resources and budget that they need to effectively support the company’s networking needs. + +**Proactive Approaches** +Some network engineers rely on reactive approaches to fix problems when they occur. If data breaches aren’t prevented before they impact the organization, then it ends up being an expensive endeavor. A reactive approach is sometimes compared to running around and putting out fires the entire day. A proactive approach is more strategic. Network engineers put systems, policies and procedures in place that prevent the intrusion in the first place. They pick up on small issues and tackle them as soon as they show up, rather than waiting for something to break. It’s easier to improve network performance because many of the low-level problems are eliminated through the network design or other technology that was implemented. + +**Independent** +Network engineers often have to work on tasks without a lot of oversight. Depending on the company’s budget, they may be the only person in their role in the entire organization. Working independently requires the employee to be driven and a self-starter. They must be able to keep themselves on task and stick to the schedule that’s laid out for that particular project. In the event of a disaster, the network engineer may need to step into a leadership role to guide the recovery process. + +**Fast Learner** +Technology changes all the time, and the interactions between new hardware and software may not be expected. A fast learner can quickly pick up the most important details about a piece of technology so that they can effectively troubleshoot it or optimize it. + +**On-Call** +Disasters can strike a network at any time, and unexpected downtime is one of the worst things that can happen to a modern business. The mission-critical systems have to come up as soon as possible, which means that network engineers may need to take on-call shifts. One of the keys to being on-call is to be ready to act at a moment’s notice, even if it’s the middle of the night. + +**Reliability** +Few businesses can operate without their network being up and available. If critical software or hardware are not available, then the entire business may find itself at a standstill. Customers get upset that they can’t access the website or reach anyone in the company, employees are frustrated because they’re falling behind on their projects, and management is running around trying to get everything back up and running. As a network engineer, reliability is the key. Being available makes a big difference in resolving these types of problems, and always showing up on time and on schedule goes a long way towards cementing someone as a great network engineer. + +![Avatar][4] + +[Christopher Nichols][5] + +[![][6]][7] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/what-it-takes-to-be-a-successful-network-engineer/ + +作者:[Christopher Nichols][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/christopher-nichols/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2015/03/Network-cable-with-router.jpg?resize=696%2C372&ssl=1 (Network cable with router) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2015/03/Network-cable-with-router.jpg?fit=1329%2C710&ssl=1 +[3]: https://surfshark.com/learn/vpn-protocols +[4]: https://secure.gravatar.com/avatar/92e286970e06818292d5ce792b67a662?s=100&r=g +[5]: https://opensourceforu.com/author/christopher-nichols/ +[6]: http://opensourceforu.com/wp-content/uploads/2013/10/assoc.png +[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 42179cb187f038308fb64b5ac64040b8a1e2dc25 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Nov 2019 07:49:06 +0800 Subject: [PATCH 353/800] Rename sources/talk/20191106 My first contribution to open source- Make a fork of the repo.md to sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md --- ... first contribution to open source- Make a fork of the repo.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => tech}/20191106 My first contribution to open source- Make a fork of the repo.md (100%) diff --git a/sources/talk/20191106 My first contribution to open source- Make a fork of the repo.md b/sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md similarity index 100% rename from sources/talk/20191106 My first contribution to open source- Make a fork of the repo.md rename to sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md From 4a38ee21da3a223c828ec1d217f295269b8ab7ba Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 7 Nov 2019 07:51:27 +0800 Subject: [PATCH 354/800] Rename sources/tech/20191106 Getting started with Pimcore- An open source alternative for product information management.md to sources/talk/20191106 Getting started with Pimcore- An open source alternative for product information management.md --- ... open source alternative for product information management.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191106 Getting started with Pimcore- An open source alternative for product information management.md (100%) diff --git a/sources/tech/20191106 Getting started with Pimcore- An open source alternative for product information management.md b/sources/talk/20191106 Getting started with Pimcore- An open source alternative for product information management.md similarity index 100% rename from sources/tech/20191106 Getting started with Pimcore- An open source alternative for product information management.md rename to sources/talk/20191106 Getting started with Pimcore- An open source alternative for product information management.md From 12b45433ade2446de36bd5440a5570edbb47c6e2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 7 Nov 2019 08:54:11 +0800 Subject: [PATCH 355/800] translated --- ...hortcuts to Speed Up Your Work in Linux.md | 107 ----------------- ...hortcuts to Speed Up Your Work in Linux.md | 110 ++++++++++++++++++ 2 files changed, 110 insertions(+), 107 deletions(-) delete mode 100644 sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md create mode 100644 translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md diff --git a/sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md deleted file mode 100644 index d340764151..0000000000 --- a/sources/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md +++ /dev/null @@ -1,107 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Keyboard Shortcuts to Speed Up Your Work in Linux) -[#]: via: (https://opensourceforu.com/2019/11/keyboard-shortcuts-to-speed-up-your-work-in-linux/) -[#]: author: (S Sathyanarayanan https://opensourceforu.com/author/s-sathyanarayanan/) - -Keyboard Shortcuts to Speed Up Your Work in Linux -====== - -[![Google Keyboard][1]][2] - -_Manipulating the mouse, keyboard and menus takes up a lot of our time, which could be saved by using keyboard shortcuts. These not only save time, but also make the computer user more efficient._ - -Did you realise that switching from the keyboard to the mouse while typing takes up to two seconds each time? If a person works for eight hours every day, switching from the keyboard to the mouse once a minute, and there are around 240 working days in a year, the amount of time wasted (as per calculations done by Brainscape) is: -_[2 wasted seconds/min] x [480 minutes per day] x 240 working days per year = 64 wasted hours per year_ -This is equal to eight working days lost and hence learning keyboard shortcuts will increase productivity by 3.3 per cent (__). - -Keyboard shortcuts provide a quicker way to do a task, which otherwise would have had to be done in multiple steps using the mouse and/or the menu. Figure 1 gives a list of a few most frequently used shortcuts in Ubuntu 18.04 Linux OS and the Web browsers. I am omitting the very well-known shortcuts like copy, paste, etc, and the ones which are not used frequently. The readers can refer to online resources for a comprehensive list of shortcuts. Note that the Windows key is renamed as Super key in Linux. - -**General shortcuts** -A list of general shortcuts is given below. - -[![][3]][4] -**Print Screen and video recording of the screen** -The following shortcuts can be used to print the screen or take a video recording of the screen. -[![][5]][6]**Switching between applications** -The shortcut keys listed here can be used to switch between applications. - -[![][7]][8] -**Tile windows** -The windows can be tiled in different ways using the shortcuts given below. - -[![][9]][10] - -**Browser shortcuts** -The most frequently used shortcuts for browsers are listed here. Most of the shortcuts are common to the Chrome/Firefox browsers. - -**Key combination** | **Action** ----|--- -Ctrl + T | Opens a new tab. -Ctrl + Shift + T | Opens the most recently closed tab. -Ctrl + D | Adds a new bookmark. -Ctrl + W | Closes the browser tab. -Alt + D | Positions the cursor in the browser’s address bar. -F5 or Ctrl-R | Refreshes a page. -Ctrl + Shift + Del | Clears private data and history. -Ctrl + N | Opens a new window. -Home | Scrolls to the top of the page. -End | Scrolls to the bottom of the page. -Ctrl + J | Opens the Downloads folder -(in Chrome) -F11 | Full-screen view (toggle effect) - -**Terminal shortcuts** -Here is a list of terminal shortcuts. -[![][11]][12]You can also configure your own custom shortcuts in Ubuntu, as follows: - - * Click on Settings in Ubuntu Dash. - * Select the Devices tab in the left menu of the Settings window. - * Select the Keyboard tab in the Devices menu. - * The ‘+’ button is displayed at the bottom of the right panel. Click on the ‘+’ sign to open the custom shortcut dialogue box and configure a new shortcut. - - - -Learning three shortcuts mentioned in this article can save a lot of time and make you more productive. - -**Reference** -_Cohen, Andrew. How keyboard shortcuts could revive America’s economy; [www.brainscape.com][13]. [Online] Brainscape, 26 May 2017; _ - -![Avatar][14] - -[S Sathyanarayanan][15] - -The author is currently working with Sri Sathya Sai University for Human Excellence, Gulbarga. He has more than 25 years of experience in systems management and in teaching IT courses. He is an enthusiastic promoter of FOSS and can be reached at [sathyanarayanan.brn@gmail.com][16]. - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/11/keyboard-shortcuts-to-speed-up-your-work-in-linux/ - -作者:[S Sathyanarayanan][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensourceforu.com/author/s-sathyanarayanan/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/12/Google-Keyboard.jpg?resize=696%2C418&ssl=1 (Google Keyboard) -[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/12/Google-Keyboard.jpg?fit=750%2C450&ssl=1 -[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/1.png?resize=350%2C319&ssl=1 -[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/1.png?ssl=1 -[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/NW.png?resize=350%2C326&ssl=1 -[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/NW.png?ssl=1 -[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/2.png?resize=350%2C264&ssl=1 -[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/2.png?ssl=1 -[9]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/3.png?resize=350%2C186&ssl=1 -[10]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/3.png?ssl=1 -[11]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/7.png?resize=350%2C250&ssl=1 -[12]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/7.png?ssl=1 -[13]: http://www.brainscape.com -[14]: https://secure.gravatar.com/avatar/736684a2707f2ed7ae72675edf7bb3ee?s=100&r=g -[15]: https://opensourceforu.com/author/s-sathyanarayanan/ -[16]: mailto:sathyanarayanan.brn@gmail.com diff --git a/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md new file mode 100644 index 0000000000..4cf8e01b45 --- /dev/null +++ b/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Keyboard Shortcuts to Speed Up Your Work in Linux) +[#]: via: (https://opensourceforu.com/2019/11/keyboard-shortcuts-to-speed-up-your-work-in-linux/) +[#]: author: (S Sathyanarayanan https://opensourceforu.com/author/s-sathyanarayanan/) + +在 Linux 中加速工作的键盘快捷键 +====== + +[![Google Keyboard][1]][2] + +_操作鼠标、键盘和菜单会占用我们很多时间,这些可以使用键盘快捷键来节省时间。这不仅节省时间,还可以使用户更高效。_ + +你是否意识到每次在打字时从键盘切换到鼠标最多需要两秒钟?如果一个人每天工作八小时,每分钟从键盘切换到鼠标一次,并且一年中大约有 240 个工作日,那么所浪费的时间(根据 Brainscape 的计算)为: +_ [每分钟浪费 2 秒] x [每天 480 分钟] x每年 240 个工作日=每年浪费 64 小时_ +这相当于损失了八个工作日,因此学习键盘快捷键将使生产率提高 3.3%(__)。 + +键盘快捷键提供了一种更快的方式来执行任务,不然就需要使用鼠标和/或菜单分多个步骤来完成。图 1 列出了 Ubuntu 18.04 Linux 和 Web 浏览器中一些最常用的快捷方式。我省略了非常有名的快捷方式,例如复制、粘贴等,以及不经常使用的快捷方式。读者可以参考在线资源以获得完整的快捷方式列表。请注意,Windows 键在 Linux 中被重命名为 Super 键。 + +**常规快捷方式** +下面列出了常规快捷方式。 + +[![][3]][4] +**打印屏幕和屏幕录像** +以下快捷方式可用于打印屏幕或录制屏幕视频。 +[![][5]][6] +**在应用之间切换** +此处列出的快捷键可用于在应用之间切换。 + +[![][7]][8] +**平铺窗口** +可以使用下面提供的快捷方式以不同方式将窗口平铺。 + +[![][9]][10] + +**浏览器快捷方式** +此处列出了浏览器最常用的快捷方式。大多数快捷键对于 Chrome/Firefox 浏览器是通用的。 + +**组合键** | **行为** +---|--- + +Ctrl + T | 打开一个新标签。 +Ctrl + Shift + T | 打开最近关闭的标签。 +Ctrl + D | 添加一个新书签。 +Ctrl + W | 关闭浏览器标签。 +Alt + D | 将光标置于浏览器的地址栏中。 +F5 或 Ctrl-R | 刷新页面。 +Ctrl + Shift + Del | 清除私人数据和历史记录。 +Ctrl + N | 打开一个新窗口。 +Home| 滚动到页面顶部。 +End | 滚动到页面底部。 +Ctrl + J | 打开下载文件夹(在Chrome中) +F11 | 全屏视图(切换效果) + +**终端快捷方式** +这是终端快捷方式的列表。 +[![][11]][12] +你还可以在 Ubuntu 中配置自己的自定义快捷方式,如下所示: + + + * 在 Ubuntu Dash 中单击设置。 +  * 在“设置”窗口的左侧菜单中选择“设备”选项卡。 +  * 在设备菜单中选择键盘标签。 +  * 右面板的底部有个 “+” 按钮。点击 “+” 号打开自定义快捷方式对话框并配置新的快捷方式。 + + + +学习本文提到的三个快捷方式可以节省大量时间,并使你的工作效率更高。 + +**引用** +_Cohen, Andrew. How keyboard shortcuts could revive America’s economy; [www.brainscape.com][13]. [Online] Brainscape, 26 May 2017; _ + +![Avatar][14] + +[S Sathyanarayanan][15] + +作者目前在斯里萨蒂亚赛古尔巴加人类卓越大学工作。他在系统管理和 IT 课程教学方面拥有 25 年以上的经验。他是 FOSS 的积极推动者,可以通过 [sathyanarayanan.brn@gmail.com][16] 与他联系。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/keyboard-shortcuts-to-speed-up-your-work-in-linux/ + +作者:[S Sathyanarayanan][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://opensourceforu.com/author/s-sathyanarayanan/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/12/Google-Keyboard.jpg?resize=696%2C418&ssl=1 (Google Keyboard) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/12/Google-Keyboard.jpg?fit=750%2C450&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/1.png?resize=350%2C319&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/1.png?ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/NW.png?resize=350%2C326&ssl=1 +[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/NW.png?ssl=1 +[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/2.png?resize=350%2C264&ssl=1 +[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/2.png?ssl=1 +[9]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/3.png?resize=350%2C186&ssl=1 +[10]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/3.png?ssl=1 +[11]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/7.png?resize=350%2C250&ssl=1 +[12]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/7.png?ssl=1 +[13]: http://www.brainscape.com +[14]: https://secure.gravatar.com/avatar/736684a2707f2ed7ae72675edf7bb3ee?s=100&r=g +[15]: https://opensourceforu.com/author/s-sathyanarayanan/ +[16]: mailto:sathyanarayanan.brn@gmail.com From aa14a5fd1b9dd1264315d4f17c05b6285ad7db74 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 7 Nov 2019 09:01:33 +0800 Subject: [PATCH 356/800] translating --- ...to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md index bcbf0c27ec..b56e4fa2ab 100644 --- a/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md +++ b/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 74ff832d1dd4a2581420d6877066200ce7704c16 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 Nov 2019 19:00:48 +0800 Subject: [PATCH 357/800] APL --- sources/tech/20190801 Linux permissions 101.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190801 Linux permissions 101.md b/sources/tech/20190801 Linux permissions 101.md index cfbc3d0a29..6600a801e3 100644 --- a/sources/tech/20190801 Linux permissions 101.md +++ b/sources/tech/20190801 Linux permissions 101.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 04e87f3e0b72d636e6c89bac8eafd1f0c8b1c9e6 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Thu, 7 Nov 2019 12:47:36 +0100 Subject: [PATCH 358/800] Update 20191023 How to dual boot Windows 10 and Debian 10.md --- ...w to dual boot Windows 10 and Debian 10.md | 41 ++++++++++--------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md index d445417c83..8c1b44ffab 100644 --- a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md +++ b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md @@ -7,51 +7,54 @@ [#]: via: (https://www.linuxtechi.com/dual-boot-windows-10-debian-10/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) -How to dual boot Windows 10 and Debian 10 +How to dual boot Windows 10 and Debian 10 如何拥有一个Windows 10 和 Debian 10 的双系统 ====== -So, you finally made the bold decision to try out **Linux** after much convincing. However, you do not want to let go of your Windows 10 operating system yet as you will still be needing it before you learn the ropes on Linux. Thankfully, you can easily have a dual boot setup that allows you to switch to either of the operating systems upon booting your system. In this guide, you will learn how to **dual boot  Windows 10 alongside Debian 10**. +So, you finally made the bold decision to try out **Linux** after much convincing. However, you do not want to let go of your Windows 10 operating system yet as you will still be needing it before you learn the ropes on Linux. Thankfully, you can easily have a dual boot setup that allows you to switch to either of the operating systems upon booting your system. In this guide, you will learn how to **dual boot Windows 10 alongside Debian 10**. +所以,在无数次劝说自己后,你终于做出了一个大胆的决定,试试**Linux** 。 不过,在你完全熟悉Linux之前,依旧需要使用Windows 10 系统。幸运的是,通过一个双系统引导设置,能让你在启动时,选择自己想要进入的系统。在这个帮助手册中,你会看到如何 **如何双重引导Windows 10 和 Debian 10**. -[![How-to-dual-boot-Windows-and-Debian10][1]][2] +[![如何拥有一个Windows 10 和 Debian 10 的双系统][1]][2] -### Prerequisites - -Before you get started, ensure you have the following: - - * A bootable USB  or DVD of Debian 10 - * A fast and stable internet connection ( For installation updates & third party applications) +### 前提条件 +在开始之前,确保你满足下列条件: + * 一个Debian10 的可引导的USB 或DVD + * 一个快速且稳定的网络 (为了安装更新 & 以及第三方软件) Additionally, it worth paying attention to how your system boots (UEFI or Legacy) and ensure both the operating systems boot using the same boot mode. +另外,记得注意你系统的引导策略(UEFI 或Legacy), 需要确保两个系统使用同一种引导模式。 -### Step 1: Create a free partition on your hard drive +### 第一步:在硬盘上创建一个空余分区 -To start off, you need to create a free partition on your hard drive. This is the partition where Debian will be installed during the installation process. To achieve this, you will invoke the disk management utility as shown: +To achieve this, you will invoke the disk management utility as shown: +第一步,你需要在你的硬盘上创建一个空余分区。 之后,这将是我们安装Debian系统的位置。为了实现这一目的,需要使用下图所示的磁盘管理器: -Press **Windows Key + R** to launch the Run dialogue. Next, type **diskmgmt.msc** and hit **ENTER** +同时按下 **Windows + R键**,启动运行程序。接下来,输入 **diskmgmt.msc** ,按 **回车键** [![Launch-Run-dialogue][1]][3] -This launches the **disk management** window displaying all the drives existing on your Windows system. +这会启动 **磁盘管理器**窗口,并显示你Windows 上所有已有磁盘。 [![Disk-management][1]][4] Next, you need to create a free space for Debian installation. To do this, you need to shrink a partition from one of the volumes and create a new unallocated partition. In this case, I will create a **30 GB** partition from Volume D. -To shrink a volume, right-click on it and select the ‘**shrink**’ option +接下来,你需要为Debian安装创建空余空间。为此,你需要压缩其中一个磁盘的空间,从而创建一个未分配的新分区。在这个例子里,我会从 D 盘中创建一个 **30 GB** 的新分区。 -[![Shrink-volume][1]][5] +为了压缩一个卷,右键点击它,然后选中选项 ‘**压缩**’ -In the pop-up dialogue, define the size that you want to shrink your space. Remember, this will be the disk space on which Debian 10 will be installed. In my case, I selected **30000MB  ( Approximately 30 GB)**. Once done, click on ‘**Shrink**’. +[![压缩卷][1]][5] + +在弹出窗口中,定义你想压缩的空间大小。记住,这是将来要安装Debian 10的磁盘空间。我选择了 **30000MB ( 大约 30 GB)** 。 压缩完成后,点击‘**压缩**’. [![Shrink-space][1]][6] -After the shrinking operation completes, you should have an unallocated partition as shown: +在压缩操作结束后,你会看到一个如下图所示的未分配分区: -[![Unallocated-partition][1]][7] +[![未分配分区][1]][7] -Perfect! We are now good to go and ready to begin the installation process. +完美! 现在可以准备开始安装了。 ### Step 2: Begin the installation of Debian 10 From 3df8f39d35ab55cc3e8efcd300a1a630415a3649 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Thu, 7 Nov 2019 14:11:09 +0100 Subject: [PATCH 359/800] Update 20191023 How to dual boot Windows 10 and Debian 10.md --- ...w to dual boot Windows 10 and Debian 10.md | 166 +++++++++--------- 1 file changed, 80 insertions(+), 86 deletions(-) diff --git a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md index 8c1b44ffab..37b59370ec 100644 --- a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md +++ b/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md @@ -7,39 +7,34 @@ [#]: via: (https://www.linuxtechi.com/dual-boot-windows-10-debian-10/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) -How to dual boot Windows 10 and Debian 10 如何拥有一个Windows 10 和 Debian 10 的双系统 +如何拥有一个Windows 10 和 Debian 10 的双系统 ====== -So, you finally made the bold decision to try out **Linux** after much convincing. However, you do not want to let go of your Windows 10 operating system yet as you will still be needing it before you learn the ropes on Linux. Thankfully, you can easily have a dual boot setup that allows you to switch to either of the operating systems upon booting your system. In this guide, you will learn how to **dual boot Windows 10 alongside Debian 10**. -所以,在无数次劝说自己后,你终于做出了一个大胆的决定,试试**Linux** 。 不过,在你完全熟悉Linux之前,依旧需要使用Windows 10 系统。幸运的是,通过一个双系统引导设置,能让你在启动时,选择自己想要进入的系统。在这个帮助手册中,你会看到如何 **如何双重引导Windows 10 和 Debian 10**. +所以,在无数次劝说自己后,你终于做出了一个大胆的决定,试试**Linux**。 不过,在完全熟悉Linux之前,你依旧需要使用Windows 10系统。幸运的是,通过一个双系统引导设置,能让你在启动时,选择自己想要进入的系统。在这个指南中,你会看到如何 **如何双重引导Windows 10 和 Debian 10**. [![如何拥有一个Windows 10 和 Debian 10 的双系统][1]][2] -### 前提条件 +### 前提条件 在开始之前,确保你满足下列条件: - * 一个Debian10 的可引导的USB 或DVD + * 一个Debian10 的可引导USB或DVD * 一个快速且稳定的网络 (为了安装更新 & 以及第三方软件) -Additionally, it worth paying attention to how your system boots (UEFI or Legacy) and ensure both the operating systems boot using the same boot mode. 另外,记得注意你系统的引导策略(UEFI 或Legacy), 需要确保两个系统使用同一种引导模式。 ### 第一步:在硬盘上创建一个空余分区 -To achieve this, you will invoke the disk management utility as shown: -第一步,你需要在你的硬盘上创建一个空余分区。 之后,这将是我们安装Debian系统的位置。为了实现这一目的,需要使用下图所示的磁盘管理器: +第一步,你需要在你的硬盘上创建一个空余分区。之后,这将是我们安装Debian系统的地方。为了实现这一目的,需要使用下图所示的磁盘管理器: -同时按下 **Windows + R键**,启动运行程序。接下来,输入 **diskmgmt.msc** ,按 **回车键** +同时按下 **Windows + R键**,启动运行程序。接下来,输入 **diskmgmt.msc** ,按 **回车键** [![Launch-Run-dialogue][1]][3] -这会启动 **磁盘管理器**窗口,并显示你Windows 上所有已有磁盘。 +这会启动 **磁盘管理器**窗口,它会显示你Windows 上所有已有磁盘。 [![Disk-management][1]][4] -Next, you need to create a free space for Debian installation. To do this, you need to shrink a partition from one of the volumes and create a new unallocated partition. In this case, I will create a **30 GB** partition from Volume D. - 接下来,你需要为Debian安装创建空余空间。为此,你需要压缩其中一个磁盘的空间,从而创建一个未分配的新分区。在这个例子里,我会从 D 盘中创建一个 **30 GB** 的新分区。 为了压缩一个卷,右键点击它,然后选中选项 ‘**压缩**’ @@ -56,155 +51,154 @@ Next, you need to create a free space for Debian installation. To do this, you n 完美! 现在可以准备开始安装了。 -### Step 2: Begin the installation of Debian 10 +### 第二步:开始安装Debian 10 -With the free partition already created, plug in your bootable USB drive or insert the DVD installation medium in your PC and reboot your system. Be sure to make changes to the **boot order** in the **BIOS** set up by pressing the function keys (usually, **F9, F10 or F12** depending on the vendor). This is crucial so that the PC boots into your installation medium. Saves the BIOS settings and reboot. +空余分区已经创建好了,将你的可引导USB或安装DVD插入电脑,重新启动系统。 记得更改 **BIOS** 中的**引导顺序**,需要在启动时按住功能键(通常,根据品牌不同,是**F9, F10 或 F12** 中的某一个)。 这一步骤,对系统是否能进入安装媒体来说,至关重要。保存 BIOS 设置,并重启电脑。 -A new grub menu will be displayed as shown below: Click on ‘**Graphical install**’ +如下图所示,界面会显示一个新的引导菜单:点击 ‘**Graphical install**’ +[![图形化界面安装][1]][8] -[![Graphical-Install-Debian10][1]][8] +下一步,选择你的 **偏好语言** ,然后点击 ‘**继续**’ +[![设置语言-Debian10][1]][9] -In the next step, select your **preferred language** and click ‘**Continue**’ +接着,选择你的 **地区** ,点击‘**继续**’。 根据地区,系统会自动选择当地对应的时区。 如果你无法找到你所对应的地区,将界面往下拉, 点击‘**其他**’后,选择相对应位置。 -[![Select-Language-Debian10][1]][9] +[![选择地区-Debain10][1]][10] -Next, select your **location** and click ‘**Continue**’. Based on this location the time will automatically be selected for you. If you cannot find you located, scroll down and click on ‘**other**’ then select your location. +而后,选择你的 **keyboard** 布局。 -[![Select-location-Debain10][1]][10] +[![设置键盘-Debain10][1]][11] -Next, select your **keyboard** layout. - -[![Configure-Keyboard-layout-Debain10][1]][11] - -In the next step, specify your system’s **hostname** and click ‘**Continue**’ +接下来,设置系统的 **主机名** ,点击 ‘**继续**’ [![Set-hostname-Debian10][1]][12] -Next, specify the **domain name**. If you are not in a domain environment, simply click on the ‘**continue**’ button. +下一步,确定 **域名**。如果你的电脑不在域中,直接点击 ‘**继续**’按钮。 -[![Set-domain-name-Debian10][1]][13] +[![设置域名-Debian10][1]][13] -In the next step, specify the **root password** as shown and click ‘**continue**’. +然后,如图所示,设置 **root 密码**,点击 ‘**继续**’ -[![Set-root-Password-Debian10][1]][14] +[![设置root 密码-Debian10][1]][14] -In the next step, specify the full name of the user for the account and click ‘**continue**’ +下一步骤,设置账户的用户全名,点击 ‘**继续**’ -[![Specify-fullname-user-debain10][1]][15] +[![设置用户全名-debain10][1]][15] -Then set the account name by specifying the **username** associated with the account +接着,通过设置 **username** 来确定此账户显示时的用户名 [![Specify-username-Debian10][1]][16] -Next, specify the username’s password as shown and click ‘**continue**’ +下一步,设置用户密码, 点击‘**继续**’ -[![Specify-user-password-Debian10][1]][17] +[![设置用户密码-Debian10][1]][17] -Next, specify your **timezone** +然后,设置**时区** -[![Configure-timezone-Debian10][1]][18] +[![设置时区-Debian10][1]][18] -At this point, you need to create partitions for your Debian 10 installation. If you are an inexperienced user, Click on the ‘**Use the largest continuous free space**’ and click ‘**continue**’. +这时,你要为Debian10安装创建分区。如果你是新手用户,点击菜单中的第一个选项, ‘**使用最大的连续空余空间**,点击‘**继续**’. [![Use-largest-continuous-free-space-debian10][1]][19] -However, if you are more knowledgeable about creating partitions, select the ‘**Manual**’ option and click ‘**continue**’ +不过,如果你对创建分区有所了解的话,选择‘**手动**’ 选项,点击 ‘**继续**’ -[![Select-Manual-Debain10][1]][20] +[![选择手动-Debain10][1]][20] -Thereafter, select the partition labeled ‘**FREE SPACE**’  and click ‘**continue**’ . Next click on ‘**Create a new partition**’. +接着,选择被标记为 ‘**空余空间**’ 的磁盘, 点击‘**继续**’ 。接下来,点击‘**创建新分区**’ -[![Create-new-partition-Debain10][1]][21] +[![创建新分区-Debain10][1]][21] -In the next window, first, define the size of swap space, In my case, I specified **2GB**. Click **Continue**. -[![Define-swap-space-debian10][1]][22] +下一界面,首先确定swap空间大小。我的swap大小为**2GB**,点击 **继续**。 -Next, click on ‘’**Primary**’ on the next screen and click ‘**continue**’ +[![确定swap大小-debian10][1]][22] -[![Partition-Disks-Primary-Debain10][1]][23] +点击下一界面的 ‘’**Primary**’ , 点击‘**继续**’ -Select the partition to **start at the beginning** and click continue. +[![磁盘主分区-Debian10][1]][23] -[![Start-at-the-beginning-Debain10][1]][24] +选择在磁盘**初始位置创建新分区**后,点击继续. -Next, click on **Ext 4 journaling file system** and click ‘**continue**’ +[![在初始位置创建-Debain10][1]][24] -[![Select-Ext4-Journaling-system-debain10][1]][25] +选择**Ext 4 日志文件系统** ,点击 ‘**继续**’ -On the next window, select **swap  **and click continue +[![选择Ext4日志文件系统-debain10][1]][25] -[![Select-swap-debain10][1]][26] +下个界面选择 **swap** ,点击继续 -Next, click on **done setting the partition** and click continue. +[![选择swap-debian10][1]][26] -[![Done-setting-partition-debian10][1]][27] +选中 **完成此分区设置** ,点击继续。 -Back to the **Partition disks** page, click on **FREE SPACE** and click continue +[!完成此分区设置-debian10][1]][27] -[![Click-Free-space-Debain10][1]][28] +返回 **磁盘分区** 界面, 点击**空余空间** ,点击继续 -To make your life easy select **Automatically partition the free space** and click **continue**. +[![点击空余空间-Debain10][1]][28] -[![Automatically-partition-free-space-Debain10][1]][29] +为了让自己能轻松一点,选中**自动为空余空间分区** 后,点击 **继续**. -Next click on **All files in one partition (recommended for new users)** +[![自动为空余空间分区-Debain10][1]][29] -[![All-files-in-one-partition-debian10][1]][30] +接着点击 **将所有文件存储在同一分区 (新手用户推荐)** -Finally, click on **Finish partitioning and write changes to disk** and click **continue**. +[![将所有文件存储在同一分区-debian10][1]][30] -[![Finish-partitioning-write-changes-to-disk][1]][31] +最后, 点击**完成分区设置,并将改动写入磁盘** ,点击 **继续**. -Confirm that you want to write changes to disk and click ‘**Yes**’ +[![完成分区设置,并将改动写入磁盘][1]][31] -[![Write-changes-to-disk-Yes-Debian10][1]][32] +确定你要将改动写入磁盘,点击‘**Yes**’ -Thereafter, the installer will begin installing all the requisite software packages. +[![将改动写入磁盘-Debian10][1]][32] -When asked if you want to scan another CD, select **No** and click continue +而后,安装程序会开始安装所有必要的软件包。 -[![Scan-another-CD-No-Debain10][1]][33] +当系统询问是否要扫描其他CD时,选择 **No** ,并点击继续 -Next, select the mirror of the Debian archive closest to you and click ‘Continue’ +[![扫描其他CD-No-Debain10][1]][33] -[![Debian-archive-mirror-country][1]][34] +接着,选择离你最近的镜像站点地区,点击 ‘继续’ -Next, select the **Debian mirror** that is most preferable to you and click ‘**Continue**’ +[![Debian-镜像站点-国家][1]][34] -[![Select-Debian-archive-mirror][1]][35] +然后,选择最适合你的镜像站点,点击‘**继续**’ -If you plan on using a proxy server, enter its details as shown below, otherwise leave it blank and click ‘continue’ +[![选择镜像站点][1]][35] -[![Enter-proxy-details-debian10][1]][36] +如果你打算使用代理服务器,在下面输入具体信息,没有的话就留空,点击‘继续’ -As the installation proceeds, you will be asked if you would like to participate in a **package usage survey**. You can select either option and click ‘continue’ . In my case, I selected ‘**No**’ +[![输入代理信息-debian10][1]][36] -[![Participate-in-survey-debain10][1]][37] +随着安装进程的继续, 你会被问到,是否想参加一个**软件包用途调查**。 你可以选择任意一个选项,之后点击‘继续’ .我选择了‘**否**’。 -Next, select the packages you need in the **software selection** window and click **continue**. +[![参与调查-debain10][1]][37] -[![Software-selection-debian10][1]][38] +在 **软件选择** 窗口选中你想安装的软件包,点击**继续**. -The installation will continue installing the selected packages. At this point, you can take a coffee break as the installation goes on. +[![软件选择-debian10][1]][38] -You will be prompted whether to install the grub **bootloader** on **Master Boot Record (MBR)**. Click **Yes** and click **Continue**. +安装程序会将选中的软件一一安装,在这期间,你可以去喝杯咖啡休息一下。 -[![Install-grub-bootloader-debian10][1]][39] +系统将会询问你,是否要将 grub 的**引导装载程序** 安装到 **主引导记录表 (MBR)** 上。点击 **Yes**,而后点击 **继续**. -Next, select the hard drive on which you want to install **grub** and click **Continue**. +[![安装-grub-bootloader-debian10][1]][39] -[![Select-hard-drive-install-grub-Debian10][1]][40] +接着,选中你想安装**grub** 的硬盘,点击**继续** -Finally, the installation will complete, Go ahead and click on the ‘**Continue**’ button +[![选择硬盘-安装grub-Debian10][1]][40] -[![Installation-complete-reboot-debian10][1]][41] +最后, 安装完成,直接点击 ‘**继续**’ 按钮 -You should now have a grub menu with both **Windows** and **Debian** listed. To boot to Debian, scroll and click on Debian. Thereafter, you will be prompted with a login screen. Enter your details and hit ENTER. +[![安装完成-重新启动-debian10][1]][41] -[![Debian10-log-in][1]][42] +你现在应该会有一个列出**Windows** 和**Debian** 的grub 菜单。 为了引导Debian系统,往下选择Debian。之后,你就能看见登录界面。输入密码之后,点击回车键。 -And voila! There goes your fresh copy of Debian 10 in a dual boot setup with Windows 10. +[![Debian10-登录][1]][42] + +这就完成了!这样,你就拥有了一个全新的Debian 10 和Windows 10双系统。 [![Debian10-Buster-Details][1]][43] From 4ca1920215989f6ef64b9ce7f4c8ad9af5678b23 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Thu, 7 Nov 2019 14:13:24 +0100 Subject: [PATCH 360/800] Rename sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md to translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md --- .../tech/20191023 How to dual boot Windows 10 and Debian 10.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191023 How to dual boot Windows 10 and Debian 10.md (100%) diff --git a/sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md b/translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md similarity index 100% rename from sources/tech/20191023 How to dual boot Windows 10 and Debian 10.md rename to translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md From b2951fac4cc9d789291ebf1ae51361eb88b9b6e7 Mon Sep 17 00:00:00 2001 From: jdh8383 <4565726+jdh8383@users.noreply.github.com> Date: Thu, 7 Nov 2019 22:27:56 +0800 Subject: [PATCH 361/800] Update and rename sources/tech/20191021 How to program with Bash- Syntax and tools.md to translated/tech/20191021 How to program with Bash- Syntax and tools.md --- ... to program with Bash- Syntax and tools.md | 272 ------------------ ... to program with Bash- Syntax and tools.md | 272 ++++++++++++++++++ 2 files changed, 272 insertions(+), 272 deletions(-) delete mode 100644 sources/tech/20191021 How to program with Bash- Syntax and tools.md create mode 100644 translated/tech/20191021 How to program with Bash- Syntax and tools.md diff --git a/sources/tech/20191021 How to program with Bash- Syntax and tools.md b/sources/tech/20191021 How to program with Bash- Syntax and tools.md deleted file mode 100644 index 6d83ad53e3..0000000000 --- a/sources/tech/20191021 How to program with Bash- Syntax and tools.md +++ /dev/null @@ -1,272 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (jdh8383) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to program with Bash: Syntax and tools) -[#]: via: (https://opensource.com/article/19/10/programming-bash-part-1) -[#]: author: (David Both https://opensource.com/users/dboth) - -How to program with Bash: Syntax and tools -====== -Learn basic Bash programming syntax and tools, as well as how to use -variables and control operators, in the first article in this three-part -series. -![bash logo on green background][1] - -A shell is the command interpreter for the operating system. Bash is my favorite shell, but every Linux shell interprets the commands typed by the user or sysadmin into a form the operating system can use. When the results are returned to the shell program, it sends them to STDOUT which, by default, [displays them in the terminal][2]. All of the shells I am familiar with are also programming languages. - -Features like tab completion, command-line recall and editing, and shortcuts like aliases all contribute to its value as a powerful shell. Its default command-line editing mode uses Emacs, but one of my favorite Bash features is that I can change it to Vi mode to use editing commands that are already part of my muscle memory. - -However, if you think of Bash solely as a shell, you miss much of its true power. While researching my three-volume [Linux self-study course][3] (on which this series of articles is based), I learned things about Bash that I'd never known in over 20 years of working with Linux. Some of these new bits of knowledge relate to its use as a programming language. Bash is a powerful programming language, one perfectly designed for use on the command line and in shell scripts. - -This three-part series explores using Bash as a command-line interface (CLI) programming language. This first article looks at some simple command-line programming with Bash, variables, and control operators. The other articles explore types of Bash files; string, numeric, and miscellaneous logical operators that provide execution-flow control logic; different types of shell expansions; and the **for**, **while**, and **until** loops that enable repetitive operations. They will also look at some commands that simplify and support the use of these tools. - -### The shell - -A shell is the command interpreter for the operating system. Bash is my favorite shell, but every Linux shell interprets the commands typed by the user or sysadmin into a form the operating system can use. When the results are returned to the shell program, it displays them in the terminal. All of the shells I am familiar with are also programming languages. - -Bash stands for Bourne Again Shell because the Bash shell is [based upon][4] the older Bourne shell that was written by Steven Bourne in 1977. Many [other shells][5] are available, but these are the four I encounter most frequently: - - * **csh:** The C shell for programmers who like the syntax of the C language - * **ksh:** The Korn shell, written by David Korn and popular with Unix users - * **tcsh:** A version of csh with more ease-of-use features - * **zsh:** The Z shell, which combines many features of other popular shells - - - -All shells have built-in commands that supplement or replace the ones provided by the core utilities. Open the shell's man page and find the "BUILT-INS" section to see the commands it provides. - -Each shell has its own personality and syntax. Some will work better for you than others. I have used the C shell, the Korn shell, and the Z shell. I still like the Bash shell more than any of them. Use the one that works best for you, although that might require you to try some of the others. Fortunately, it's quite easy to change shells. - -All of these shells are programming languages, as well as command interpreters. Here's a quick tour of some programming constructs and tools that are integral parts of Bash. - -### Bash as a programming language - -Most sysadmins have used Bash to issue commands that are usually fairly simple and straightforward. But Bash can go beyond entering single commands, and many sysadmins create simple command-line programs to perform a series of tasks. These programs are common tools that can save time and effort. - -My objective when writing CLI programs is to save time and effort (i.e., to be the lazy sysadmin). CLI programs support this by listing several commands in a specific sequence that execute one after another, so you do not need to watch the progress of one command and type in the next command when the first finishes. You can go do other things and not have to continually monitor the progress of each command. - -### What is "a program"? - -The Free On-line Dictionary of Computing ([FOLDOC][6]) defines a program as: "The instructions executed by a computer, as opposed to the physical device on which they run." Princeton University's [WordNet][7] defines a program as: "…a sequence of instructions that a computer can interpret and execute…" [Wikipedia][8] also has a good entry about computer programs. - -Therefore, a program can consist of one or more instructions that perform a specific, related task. A computer program instruction is also called a program statement. For sysadmins, a program is usually a sequence of shell commands. All the shells available for Linux, at least the ones I am familiar with, have at least a basic form of programming capability, and Bash, the default shell for most Linux distributions, is no exception. - -While this series uses Bash (because it is so ubiquitous), if you use a different shell, the general programming concepts will be the same, although the constructs and syntax may differ somewhat. Some shells may support some features that others do not, but they all provide some programming capability. Shell programs can be stored in a file for repeated use, or they may be created on the command line as needed. - -### Simple CLI programs - -The simplest command-line programs are one or two consecutive program statements, which may be related or not, that are entered on the command line before the **Enter** key is pressed. The second statement in a program, if there is one, might be dependent upon the actions of the first, but it does not need to be. - -There is also one bit of syntactical punctuation that needs to be clearly stated. When entering a single command on the command line, pressing the **Enter** key terminates the command with an implicit semicolon (**;**). When used in a CLI shell program entered as a single line on the command line, the semicolon must be used to terminate each statement and separate it from the next one. The last statement in a CLI shell program can use an explicit or implicit semicolon. - -### Some basic syntax - -The following examples will clarify this syntax. This program consists of a single command with an explicit terminator: - - -``` -[student@studentvm1 ~]$ echo "Hello world." ; -Hello world. -``` - -That may not seem like much of a program, but it is the first program I encounter with every new programming language I learn. The syntax may be a bit different for each language, but the result is the same. - -Let's expand a little on this trivial but ubiquitous program. Your results will be different from mine because I have done other experiments, while you may have only the default directories and files that are created in the account home directory the first time you log into an account via the GUI desktop. - - -``` -[student@studentvm1 ~]$ echo "My home directory." ; ls ; -My home directory. -chapter25   TestFile1.Linux  dmesg2.txt  Downloads  newfile.txt  softlink1  testdir6 -chapter26   TestFile1.mac    dmesg3.txt  file005    Pictures     Templates  testdir -TestFile1      Desktop       dmesg.txt   link3      Public       testdir    Videos -TestFile1.dos  dmesg1.txt    Documents   Music      random.txt   testdir1 -``` - -That makes a bit more sense. The results are related, but the individual program statements are independent of each other. Notice that I like to put spaces before and after the semicolon because it makes the code a bit easier to read. Try that little CLI program again without an explicit semicolon at the end: - - -``` -`[student@studentvm1 ~]$ echo "My home directory." ; ls` -``` - -There is no difference in the output. - -### Something about variables - -Like all programming languages, the Bash shell can deal with variables. A variable is a symbolic name that refers to a specific location in memory that contains a value of some sort. The value of a variable is changeable, i.e., it is variable. - -Bash does not type variables like C and related languages, defining them as integers, floating points, or string types. In Bash, all variables are strings. A string that is an integer can be used in integer arithmetic, which is the only type of math that Bash is capable of doing. If more complex math is required, the [**bc** command][9] can be used in CLI programs and scripts. - -Variables are assigned values and can be used to refer to those values in CLI programs and scripts. The value of a variable is set using its name but not preceded by a **$** sign. The assignment **VAR=10** sets the value of the variable VAR to 10. To print the value of the variable, you can use the statement **echo $VAR**. Start with text (i.e., non-numeric) variables. - -Bash variables become part of the shell environment until they are unset. - -Check the initial value of a variable that has not been assigned; it should be null. Then assign a value to the variable and print it to verify its value. You can do all of this in a single CLI program: - - -``` -[student@studentvm1 ~]$ echo $MyVar ; MyVar="Hello World" ; echo $MyVar ; - -Hello World -[student@studentvm1 ~]$ -``` - -_Note: The syntax of variable assignment is very strict. There must be no spaces on either side of the equal (**=**) sign in the assignment statement._ - -The empty line indicates that the initial value of **MyVar** is null. Changing and setting the value of a variable are done the same way. This example shows both the original and the new value. - -As mentioned, Bash can perform integer arithmetic calculations, which is useful for calculating a reference to the location of an element in an array or doing simple math problems. It is not suitable for scientific computing or anything that requires decimals, such as financial calculations. There are much better tools for those types of calculations. - -Here's a simple calculation: - - -``` -[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1*Var2))" -Result = 63 -``` - -What happens when you perform a math operation that results in a floating-point number? - - -``` -[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1/Var2))" -Result = 0 -[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var2/Var1))" -Result = 1 -[student@studentvm1 ~]$ -``` - -The result is the nearest integer. Notice that the calculation was performed as part of the **echo** statement. The math is performed before the enclosing echo command due to the Bash order of precedence. For details see the Bash man page and search "precedence." - -### Control operators - -Shell control operators are one of the syntactical operators for easily creating some interesting command-line programs. The simplest form of CLI program is just stringing several commands together in a sequence on the command line: - - -``` -`command1 ; command2 ; command3 ; command4 ; . . . ; etc. ;` -``` - -Those commands all run without a problem so long as no errors occur. But what happens when an error occurs? You can anticipate and allow for errors using the built-in **&&** and **||** Bash control operators. These two control operators provide some flow control and enable you to alter the sequence of code execution. The semicolon is also considered to be a Bash control operator, as is the newline character. - -The **&&** operator simply says, "if command1 is successful, then run command2. If command1 fails for any reason, then command2 is skipped." That syntax looks like this: - - -``` -`command1 && command2` -``` - -Now, look at some commands that will create a new directory and—if it's successful—make it the present working directory (PWD). Ensure that your home directory (**~**) is the PWD. Try this first in **/root**, a directory that you do not have access to: - - -``` -[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir/ && cd $Dir -mkdir: cannot create directory '/root/testdir/': Permission denied -[student@studentvm1 ~]$ -``` - -The error was emitted by the **mkdir** command. You did not receive an error indicating that the file could not be created because the creation of the directory failed. The **&&** control operator sensed the non-zero return code, so the **touch** command was skipped. Using the **&&** control operator prevents the **touch** command from running because there was an error in creating the directory. This type of command-line program flow control can prevent errors from compounding and making a real mess of things. But it's time to get a little more complicated. - -The **||** control operator allows you to add another program statement that executes when the initial program statement returns a code greater than zero. The basic syntax looks like this: - - -``` -`command1 || command2` -``` - -This syntax reads, "If command1 fails, execute command2." That implies that if command1 succeeds, command2 is skipped. Try this by attempting to create a new directory: - - -``` -[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir || echo "$Dir was not created." -mkdir: cannot create directory '/root/testdir': Permission denied -/root/testdir was not created. -[student@studentvm1 ~]$ -``` - -This is exactly what you would expect. Because the new directory could not be created, the first command failed, which resulted in the execution of the second command. - -Combining these two operators provides the best of both. The control operator syntax using some flow control takes this general form when the **&&** and **||** control operators are used: - - -``` -`preceding commands ; command1 && command2 || command3 ; following commands` -``` - -This syntax can be stated like so: "If command1 exits with a return code of 0, then execute command2, otherwise execute command3." Try it: - - -``` -[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." -mkdir: cannot create directory '/root/testdir': Permission denied -/root/testdir was not created. -[student@studentvm1 ~]$ -``` - -Now try the last command again using your home directory instead of the **/root** directory. You will have permission to create this directory: - - -``` -[student@studentvm1 ~]$ Dir=~/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." -[student@studentvm1 testdir]$ -``` - -The control operator syntax, like **command1 && command2**, works because every command sends a return code (RC) to the shell that indicates if it completed successfully or whether there was some type of failure during execution. By convention, an RC of zero (0) indicates success, and any positive number indicates some type of failure. Some of the tools sysadmins use just return a one (1) to indicate a failure, but many use other codes to indicate the type of failure that occurred. - -The Bash shell variable **$?** contains the RC from the last command. This RC can be checked very easily by a script, the next command in a list of commands, or even the sysadmin directly. Start by running a simple command and immediately checking the RC. The RC will always be for the last command that ran before you looked at it. - - -``` -[student@studentvm1 testdir]$ ll ; echo "RC = $?" -total 1264 -drwxrwxr-x  2 student student   4096 Mar  2 08:21 chapter25 -drwxrwxr-x  2 student student   4096 Mar 21 15:27 chapter26 --rwxr-xr-x  1 student student     92 Mar 20 15:53 TestFile1 -<snip> -drwxrwxr-x. 2 student student 663552 Feb 21 14:12 testdir -drwxr-xr-x. 2 student student   4096 Dec 22 13:15 Videos -RC = 0 -[student@studentvm1 testdir]$ -``` - -The RC, in this case, is zero, which means the command completed successfully. Now try the same command on root's home directory, a directory you do not have permissions for: - - -``` -[student@studentvm1 testdir]$ ll /root ; echo "RC = $?" -ls: cannot open directory '/root': Permission denied -RC = 2 -[student@studentvm1 testdir]$ -``` - -In this case, the RC is two; this means permission was denied for a non-root user to access a directory to which the user is not permitted access. The control operators use these RCs to enable you to alter the sequence of program execution. - -### Summary - -This article looked at Bash as a programming language and explored its basic syntax as well as some basic tools. It showed how to print data to STDOUT and how to use variables and control operators. The next article in this series looks at some of the many Bash logical operators that control the flow of instruction execution. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/programming-bash-part-1 - -作者:[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/bash_command_line.png?itok=k4z94W2U (bash logo on green background) -[2]: https://opensource.com/article/18/10/linux-data-streams -[3]: http://www.both.org/?page_id=1183 -[4]: https://opensource.com/19/9/command-line-heroes-bash -[5]: https://en.wikipedia.org/wiki/Comparison_of_command_shells -[6]: http://foldoc.org/program -[7]: https://wordnet.princeton.edu/ -[8]: https://en.wikipedia.org/wiki/Computer_program -[9]: https://www.gnu.org/software/bc/manual/html_mono/bc.html diff --git a/translated/tech/20191021 How to program with Bash- Syntax and tools.md b/translated/tech/20191021 How to program with Bash- Syntax and tools.md new file mode 100644 index 0000000000..2872e7d4c8 --- /dev/null +++ b/translated/tech/20191021 How to program with Bash- Syntax and tools.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: (jdh8383) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to program with Bash: Syntax and tools) +[#]: via: (https://opensource.com/article/19/10/programming-bash-part-1) +[#]: author: (David Both https://opensource.com/users/dboth) + +怎样用 Bash 编程:语法和工具 +====== +让我们通过本系列文章来学习基本的 Bash 编程语法和工具,以及如何使用变量和控制运算符,这是三篇中的第一篇。 +![bash logo on green background][1] + +Shell 是操作系统的命令解释器,其中 Bash 是我最喜欢的。每当用户或者系统管理员将命令输入系统的时候,Linux 的 shell 解释器就会把这些命令转换成操作系统可以理解的形式。而执行结果返回 shell 程序后,它会将结果输出到 STDOUT(标准输出),默认情况下,这些结果会[显示在你的终端][2]。所有我熟悉的 shell 同时也是门编程语言。 + +Bash 是个功能强大的 shell,包含众多便捷特性,比如:tab 补全、命令回溯和再编辑、aliases 别名等。它的命令行默认编辑模式是 Emacs,但是我最喜欢的Bash特性之一是我可以将其更改为 Vi 模式,以使用那些储存在我肌肉记忆中的的编辑命令。 + +然而,如果你把 Bash 当作单纯的 shell 来用,则无法体验它的真实能力。我在设计一套包含三卷的 [Linux 自学课程][3]时(这个系列的文章正是基于此课程),了解到许多 Bash 的知识,这些是我在过去 20 年的 Linux 工作经验中所没有掌握的,其中的一些知识就是关于 Bash 的编程用法。不得不说,Bash 是一门强大的编程语言,是一个能够同时用于命令行和 shell 脚本的完美设计。 + +本系列文章将要探讨如何使用 Bash 作为命令行界面(CLI)编程语言。第一篇文章简单介绍 Bash 命令行编程、变量以及控制运算符。其他文章会讨论诸如:Bash 文件的类型;字符串、数字和一些逻辑运算符,它们能够提供代码执行流程中的逻辑控制;不同类型的 shell 扩展;通过 **for**、**while** 和 **until** 来控制循环操作。 + +### Shell + +Shell 是操作系统的命令解释器,其中 Bash 是我最喜欢的。每当用户或者系统管理员将命令输入系统的时候,Linux 的 shell 解释器就会把这些命令转换成操作系统可以理解的形式。而执行结果返回 shell 程序后,它会将结果输出到终端。所有我熟悉的 shell 同时也是门编程语言。 + +Bash 是 Bourne Again Shell 的缩写,因为 Bash shell 是 [基于][4] 更早的 Bourne shell,后者是 Steven Bourne 在 1977 年开发的。另外还有很多[其他的 shell][5] 可以使用,但下面四个是我经常见到的: + + * **csh:** C shell 适合那些习惯了 C 语言语法的开发者。 + * **ksh:** Korn shell,由 David Korn 开发,在 Unix 用户中更流行。 + * **tcsh:** 一个 csh 的变种,增加了一些易用性。 + * **zsh:** Z shell,集成了许多其他流行 shell 的特性。 + + + +所有 shell 都有内置命令,用以补充或替代核心工具集。打开 shell 的 man 说明页,找到“BUILT-INS”那一段,可以查看都有哪些内置命令。 + + +每种 shell 都有它自己的特性和语法风格。我用过 csh、ksh 和 zsh,但我还是更喜欢 Bash。你可以多试几个,寻找更适合你的 shell,尽管这可能需要花些功夫。但幸运的是,切换不同 shell 很简单。 + +所有这些 shell 既是编程语言又是命令解释器。下面我们来快速浏览一下 Bash 中集成的编程结构和工具。 + +### 做为编程语言的 Bash + +大多数场景下,系统管理员都会使用 Bash 来发送简单明了的命令。但 Bash 不仅可以输入单条命令,很多系统管理员可以编写简单的命令行程序来执行一系列任务,这些程序可以作为通用工具,能节省时间和精力。 + +编写 CLI 程序的目的是要提高效率(做一个“懒惰的”系统管理员)。在 CLI 程序中,你可以用特定顺序列出若干命令,逐条执行。这样你就不用盯着显示屏,等待一条命令执行完,再输入另一条,省下来的时间就可以去做其他事情了。 + +### 什么是“程序”? + +自由在线计算机词典([FOLDOC][6])对于程序的定义是:“由计算机执行的指令,而不是运行它们的物理硬件。”普林斯顿大学的 [WordNet][7] 将程序定义为:“……计算机可以理解并执行的一系列指令……”[维基百科][8]上也有一条不错的关于计算机程序的条目。 + +总结下,程序由一条或多条指令组成,目的是完成一个具体的相关任务。对于系统管理员而言,一段程序通常由一系列的 shell 命令构成。Linux 下所有的 shell (至少我所熟知的)都有基本的编程功能,Bash 作为大多数 linux 发行版的默认 shell,也不例外。 + +本系列用 Bash 举例(因为它无处不在),假如你使用一个不同的 shell 也没关系,尽管结构和语法有所不同,但编程思想是相通的。有些 shell 支持某种特性而其他 shell 则不支持,但它们都提供编程功能。Shell 程序可以被存在一个文件中被反复使用,或者在需要的时候才创建它们。 + + +### 简单 CLI 程序 + +最简单的命令行程序只有一或两条语句,它们可能相关,也可能无关,在按**回车**键之前被输入到命令行。程序中的第二条语句(如果有的话)可能取决于第一条语句的操作,但也不是必须的。 + +这里需要特别讲解一个标点符号。当你在命令行输入一条命令,按下**回车**键的时候,其实在命令的末尾有一个隐含的分号(**;**)。当一段 CLI shell 程序在命令行中被串起来作为单行指令使用时,必须使用分号来终结每个语句并将其与下一条语句分开。但 CLI shell 程序中的最后一条语句可以使用显式或隐式的分号。 + +### 一些基本语法 + +下面的例子会阐明这一语法规则。这段程序由单条命令组成,还有一个显式的终止符: + + +``` +[student@studentvm1 ~]$ echo "Hello world." ; +Hello world. +``` + +看起来不像一个程序,但它确是我学习每个新编程语言时写下的第一个程序。不同语言可能语法不同,但输出结果是一样的。 + +让我们扩展一下这段微不足道却又无所不在的代码。你的结果可能与我的有所不同,因为我的家目录有点乱,而你可能是在 GUI 桌面中第一次登陆账号。 + + +``` +[student@studentvm1 ~]$ echo "My home directory." ; ls ; +My home directory. +chapter25 TestFile1.Linux dmesg2.txt Downloads newfile.txt softlink1 testdir6 +chapter26 TestFile1.mac dmesg3.txt file005 Pictures Templates testdir +TestFile1 Desktop dmesg.txt link3 Public testdir Videos +TestFile1.dos dmesg1.txt Documents Music random.txt testdir1 +``` + +现在是不是更明显了。结果是相关的,但是两条语句彼此独立。你可能注意到我喜欢在分号前后多输入一个空格,这样会让代码的可读性更好。让我们再运行一遍这段程序,这次不要带结尾的分号: + + +``` +`[student@studentvm1 ~]$ echo "My home directory." ; ls` +``` + +输出结果没有区别。 + +### 关于变量 + +像所有其他编程语言一样,Bash 支持变量。变量是个象征性的名字,它指向内存中的某个位置,那里存着对应的值。变量的值是可以改变的,所以它叫“变~量”。 + +Bash 不像 C 之类的语言,需要强制指定变量类型,比如:整型、浮点型或字符型。在 Bash 中,所有变量都是字符串。整数型的变量可以被用于整数运算,这是 Bash 唯一能够处理的数学类型。更复杂的运算则需要借助 [**bc**][9] 这样的命令,可以被用在命令行编程或者脚本中。 + +变量的值是被预先分配好的,这些值可以用在命令行编程或者脚本中。可以通过变量名字给其赋值,但是不能使用 **$** 符开头。比如,**VAR=10** 这样会把 VAR 的值设为 10。要打印变量的值,你可以使用语句 **echo $VAR**。变量名必须以文本(即非数字)开始。 + +Bash 会保存已经定义好的变量,直到它们被取消掉。 + +下面这个例子,在变量被赋值前,它的值是空(null)。然后给它赋值并打印出来,检验一下。你可以在同一行 CLI 程序里完成它: + + +``` +[student@studentvm1 ~]$ echo $MyVar ; MyVar="Hello World" ; echo $MyVar ; + +Hello World +[student@studentvm1 ~]$ +``` + +_注意:变量赋值的语法非常严格,等号(**=**)两边不能有空格。_ + +那个空行表明了 **MyVar** 的初始值为空。变量的赋值和改值方法都一样,这个例子展示了原始值和新的值。 + +正如之前说的,Bash 支持整数运算,当你想计算一个数组中的某个元素的位置,或者做些简单的算术运算,这还是挺有帮助的。然而,这种方法并不适合科学计算,或是某些需要小数运算的场景,比如财务统计。这些场景有其它更好的工具可以应对。 + +下面是个简单的算术题: + + +``` +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1*Var2))" +Result = 63 +``` + +好像没啥问题,但如果运算结果是浮点数会发生什么呢? + + +``` +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1/Var2))" +Result = 0 +[student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var2/Var1))" +Result = 1 +[student@studentvm1 ~]$ +``` + +结果会被取整。请注意运算被包含在 **echo** 语句之中,其实计算在 echo 命令结束前就已经完成了,原因是 Bash 的内部优先级。想要了解详情的话,可以在 Bash 的 man 页面中搜索 "precedence"。 + +### 控制运算符 + +Shell 的控制运算符是一种语法运算符,可以轻松地创建一些有趣的命令行程序。在命令行上按顺序将几个命令串在一起,就变成了最简单的 CLI 程序: + + +``` +`command1 ; command2 ; command3 ; command4 ; . . . ; etc. ;` +``` + +只要不出错,这些命令都能顺利执行。但假如出错了怎么办?你可以预设好应对出错的办法,这就要用到 Bash 内置的控制运算符, **&&** 和 **||**。这两种运算符提供了流程控制功能,使你能改变代码执行的顺序。分号也可以被看做是一种 Bash 运算符,预示着新一行的开始。 + + +**&&** 运算符提供了如下简单逻辑,“如果 command1 执行成功,那么接着执行 command2。如果 command1 失败,就跳过 command2。”语法如下: + + +``` +`command1 && command2` +``` + +现在,让我们用命令来创建一个新的目录,如果成功的话,就把它切换为当前目录。确保你的家目录(**~**)是当前目录,先尝试在 **/root** 目录下创建,你应该没有权限: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir/ &&; cd $Dir +mkdir: cannot create directory '/root/testdir/': Permission denied +[student@studentvm1 ~]$ +``` + +上面的报错信息是由 **mkdir** 命令抛出的,因为创建目录失败了。**&&** 运算符收到了非零的返回码,所以 **cd** 命令就被跳过,前者阻止后者继续运行,因为创建目录失败了。这种控制流程可以阻止后面的错误累积,避免引发更严重的问题。是时候讲点更复杂的逻辑了。 + +当一段程序的返回码大于零时,使用 **||** 运算符可以让你在后面接着执行另一段程序。简单语法如下: + + +``` +`command1 || command2` +``` + +解读一下,“假如 command1 失败,执行 command2”。隐藏的逻辑是,如果 command1 成功,跳过 command2。下面实践一下,仍然是创建新目录: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir || echo "$Dir was not created." +mkdir: cannot create directory '/root/testdir': Permission denied +/root/testdir was not created. +[student@studentvm1 ~]$ +``` + +正如预期,因为目录无法创建,第一条命令失败了,于是第二条命令被执行。 + +把 **&&** 和 **||** 两种运算符结合起来才能发挥它们的最大功效。请看下面例子中的流程控制方法: + + +``` +`preceding commands ; command1 && command2 || command3 ; following commands` +``` + +语法解释:“假如 command1 退出时返回码为零,就执行 command2,否则执行 command3。”用具体代码试试: + + +``` +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." +mkdir: cannot create directory '/root/testdir': Permission denied +/root/testdir was not created. +[student@studentvm1 ~]$ +``` + +现在我们再试一次,用你的家目录替换 **/root** 目录,你将会有权限创建这个目录了: + + +``` +[student@studentvm1 ~]$ Dir=~/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." +[student@studentvm1 testdir]$ +``` + +像 **command1 && command2** 这样的控制语句能够运行的原因是,每条命令执行完毕时都会给 shell 发送一个返回码,用来表示它执行成功与否。默认情况下,返回码为 0 表示成功,其他任何正值表示失败。一些系统管理员使用的工具用值为 1 的返回码来表示失败,但其他很多程序使用别的数字来表示失败。 + +Bash 的内置变量 **$?** 可以显示上一条命令的返回码,可以在脚本或者命令行中非常方便地检查它。要查看返回码,让我们从运行一条简单的命令开始,返回码的结果总是上一条命令给出的。 + + +``` +[student@studentvm1 testdir]$ ll ; echo "RC = $?" +total 1264 +drwxrwxr-x 2 student student 4096 Mar 2 08:21 chapter25 +drwxrwxr-x 2 student student 4096 Mar 21 15:27 chapter26 +-rwxr-xr-x 1 student student 92 Mar 20 15:53 TestFile1 +drwxrwxr-x. 2 student student 663552 Feb 21 14:12 testdir +drwxr-xr-x. 2 student student 4096 Dec 22 13:15 Videos +RC = 0 +[student@studentvm1 testdir]$ +``` + +在这个例子中,返回码为零,意味着命令执行成功了。现在对 root 的家目录测试一下,你应该没有权限: + + +``` +[student@studentvm1 testdir]$ ll /root ; echo "RC = $?" +ls: cannot open directory '/root': Permission denied +RC = 2 +[student@studentvm1 testdir]$ +``` + +本例中返回码是 2,表明非 root 用户没有权限进入这个目录。你可以利用这些返回码,用控制运算符来改变程序执行的顺序。 + +### 总结 + +本文将 Bash 看作一门编程语言,并从这个视角介绍了它的简单语法和基础工具。我们学习了如何将数据输出到 STDOUT,怎样使用变量和控制运算符。在本系列的下一篇文章中,将会重点介绍能够控制指令执行流程的逻辑运算符。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/programming-bash-part-1 + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[jdh8383](https://github.com/jdh8383) +校对:[校对者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/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/18/10/linux-data-streams +[3]: http://www.both.org/?page_id=1183 +[4]: https://opensource.com/19/9/command-line-heroes-bash +[5]: https://en.wikipedia.org/wiki/Comparison_of_command_shells +[6]: http://foldoc.org/program +[7]: https://wordnet.princeton.edu/ +[8]: https://en.wikipedia.org/wiki/Computer_program +[9]: https://www.gnu.org/software/bc/manual/html_mono/bc.html From c82b105b1b4298ca94aadee25d84c689d69abe54 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 7 Nov 2019 22:33:45 +0800 Subject: [PATCH 362/800] TSL --- .../tech/20190801 Linux permissions 101.md | 346 ------------------ .../tech/20190801 Linux permissions 101.md | 322 ++++++++++++++++ 2 files changed, 322 insertions(+), 346 deletions(-) delete mode 100644 sources/tech/20190801 Linux permissions 101.md create mode 100644 translated/tech/20190801 Linux permissions 101.md diff --git a/sources/tech/20190801 Linux permissions 101.md b/sources/tech/20190801 Linux permissions 101.md deleted file mode 100644 index 6600a801e3..0000000000 --- a/sources/tech/20190801 Linux permissions 101.md +++ /dev/null @@ -1,346 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux permissions 101) -[#]: via: (https://opensource.com/article/19/8/linux-permissions-101) -[#]: author: (Alex Juarez https://opensource.com/users/mralexjuarezhttps://opensource.com/users/marcobravohttps://opensource.com/users/greg-p) - -Linux permissions 101 -====== -Knowing how to control users' access to files is a fundamental system -administration skill. -![Penguins][1] - -Understanding Linux permissions and how to control which users have access to files is a fundamental skill for systems administration. - -This article will cover standard Linux file systems permissions, dig further into special permissions, and wrap up with an explanation of default permissions using **umask**. - -### Understanding the ls command output - -Before we can talk about how to modify permissions, we need to know how to view them. The **ls** command with the long listing argument (**-l**) gives us a lot of information about a file. - - -``` -$ ls -lAh -total 20K --rwxr-xr--+ 1 root root    0 Mar  4 19:39 file1 --rw-rw-rw-. 1 root root    0 Mar  4 19:39 file10 --rwxrwxr--+ 1 root root    0 Mar  4 19:39 file2 --rw-rw-rw-. 1 root root    0 Mar  4 19:39 file8 --rw-rw-rw-. 1 root root    0 Mar  4 19:39 file9 -drwxrwxrwx. 2 root root 4.0K Mar  4 20:04 testdir -``` - -To understand what this means, let's break down the output regarding the permissions into individual sections. It will be easier to reference each section individually. - -Take a look at each component of the final line in the output above: - - -``` -`drwxrwxrwx. 2 root root 4.0K Mar  4 20:04 testdir` -``` - -Section 1 | Section 2 | Section 3 | Section 4 | Section 5 | Section 6 | Section 7 ----|---|---|---|---|---|--- -d | rwx | rwx | rwx | . | root | root - -Section 1 (on the left) reveals what type of file it is. - -d | Directory ----|--- -- | Regular file -l | A soft link - -The [info page][2] for **ls** has a full listing of the different file types. - -Each file has three modes of access: - - * the owner - * the group - * all others - - - -Sections 2, 3, and 4 refer to the user, group, and "other users" permissions. And each section can include a combination of **r** (read), **w** (write), and **x** (executable) permissions. - -Each of the permissions is also assigned a numerical value, which is important when talking about the octal representation of permissions. - -Permission | Octal Value ----|--- -Read | 4 -Write | 2 -Execute | 1 - -Section 5 details any alternative access methods, such as SELinux or File Access Control List (FACL). - -Method | Character ----|--- -No other method | - -SELinux | . -FACLs | + -Any combination of methods | + - -Sections 6 and 7 are the names of the owner and the group, respectively. - -### Using chown and chmod - -#### The chown command - -The **chown** (change ownership) command is used to change a file's user and group ownership. - -To change both the user and group ownership of the file **foo** to **root**, we can use these commands: - - -``` -$ chown root:root foo -$ chown root: foo -``` - -Running the command with the user followed by a colon (**:**) sets both the user and group ownership. - -To set only the user ownership of the file **foo** to the **root** user, enter: - - -``` -`$ chown root foo` -``` - -To change only the group ownership of the file **foo**, precede the group with a colon: - - -``` -`$ chown :root foo` -``` - -#### The chmod command - -The **chmod** (change mode) command controls file permissions for the owner, group, and all other users who are neither the owner nor part of the group associated with the file. - -The **chmod** command can set permissions in both octal (e.g., 755, 644, etc.) and symbolic (e.g., u+rwx, g-rwx, o=rw) formatting. - -Octal notation assigns 4 "points" to **read**, 2 to **write**, and 1 to **execute**. If we want to assign the user **read** permissions, we assign 4 to the first slot, but if we want to add **write** permissions, we must add 2. If we want to add **execute**, then we add 1. We do this for each permission type: owner, group, and others. - -For example, if we want to assign **read**, **write**, and **execute** to the owner of the file, but only **read** and **execute** to group members and all other users, we would use 755 in octal formatting. That's all permission bits for the owner (4+2+1), but only a 4 and 1 for the group and others (4+1). - -> The breakdown for that is: 4+2+1=7; 4+1=5; and 4+1=5. - -If we wanted to assign **read** and **write** to the owner of the file but only **read** to members of the group and all other users, we could use **chmod** as follows: - - -``` -`$ chmod 644 foo_file` -``` - -In the examples below, we use symbolic notation in different groupings. Note the letters **u**, **g**, and **o** represent **user**, **group**, and **other**. We use **u**, **g**, and **o** in conjunction with **+**, **-**, or **=** to add, remove, or set permission bits. - -To add the **execute** bit to the ownership permission set: - - -``` -`$ chmod u+x foo_file` -``` - -To remove **read**, **write**, and **execute** from members of the group: - - -``` -`$ chmod g-rwx foo_file` -``` - -To set the ownership for all other users to **read** and **write**: - - -``` -`$ chmod o=rw` -``` - -### The special bits: Set UID, set GID, and sticky bits - -In addition to the standard permissions, there are a few special permission bits that have some useful benefits. - -#### Set user ID (suid) - -When **suid** is set on a file, an operation executes as the owner of the file, not the user running the file. A [good example][3] of this is the **passwd** command. It needs the **suid** bit to be set so that changing a password runs with root permissions. - - -``` -$ ls -l /bin/passwd --rwsr-xr-x. 1 root root 27832 Jun 10  2014 /bin/passwd -``` - -An example of setting the **suid** bit would be: - - -``` -`$ chmod u+s /bin/foo_file_name` -``` - -#### Set group ID (sgid) - -The **sgid** bit is similar to the **suid** bit in the sense that the operations are done under the group ownership of the directory instead of the user running the command. - -An example of using **sgid** would be if multiple users are working out of the same directory, and every file created in the directory needs to have the same group permissions. The example below creates a directory called **collab_dir**, sets the **sgid** bit, and changes the group ownership to **webdev**. - - -``` -$ mkdir collab_dir -$ chmod g+s collab_dir -$ chown :webdev collab_dir -``` - -Now any file created in the directory will have the group ownership of **webdev** instead of the user who created the file. - - -``` -$ cd collab_dir -$ touch file-sgid -$ ls -lah file-sgid --rw-r--r--. 1 root webdev 0 Jun 12 06:04 file-sgid -``` - -#### The "sticky" bit - -The sticky bit denotes that only the owner of a file can delete the file, even if group permissions would otherwise allow it. This setting usually makes the most sense on a common or collaborative directory such as **/tmp**. In the example below, the **t** in the **execute** column of the **all others** permission set indicates that the sticky bit has been applied. - - -``` -$ ls -ld /tmp -drwxrwxrwt. 8 root root 4096 Jun 12 06:07 /tmp/ -``` - -Keep in mind this does not prevent somebody from editing the file; it just keeps them from deleting the contents of a directory. - -We set the sticky bit with: - - -``` -`$ chmod o+t foo_dir` -``` - -On your own, try setting the sticky bit on a directory and give it full group permissions so that multiple users can read, write and execute on the directory because they are in the same group. - -From there, create files as each user and then try to delete them as the other. - -If everything is configured correctly, one user should not be able to delete users from the other user. - -Note that each of these bits can also be set in octal format with SUID=4, SGID=2, and Sticky=1. - - -``` -$ chmod 4744 -$ chmod 2644 -$ chmod 1755 -``` - -#### Uppercase or lowercase? - -If you are setting the special bits and see an uppercase **S** or **T** instead of lowercase (as we've seen until this point), it is because the underlying execute bit is not present. To demonstrate, the following example creates a file with the sticky bit set. We can then add/remove the execute bit to demonstrate the case change. - - -``` -$ touch file cap-ST-demo -$ chmod 1755 cap-ST-demo -$ ls -l cap-ST-demo --rwxr-xr-t. 1 root root 0 Jun 12 06:16 cap-ST-demo - -$ chmod o-x cap-X-demo -$ ls -l cap-X-demo --rwxr-xr-T. 1 root root 0 Jun 12 06:16 cap-ST-demo -``` - -#### Setting the execute bit conditionally - -To this point, we've set the **execute** bit using a lowercase **x**, which sets it without asking any questions. We have another option: using an uppercase **X** instead of lowercase will set the **execute** bit only if it is already present somewhere in the permission group. This can be a difficult concept to explain, but the demo below will help illustrate it. Notice here that after trying to add the **execute** bit to the group privileges, it is not applied. - - -``` -$ touch cap-X-file -$ ls -l cap-X-file --rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file -$ chmod g+X cap-X-file -$ ls -l cap-X-file --rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file -``` - -In this similar example, we add the execute bit first to the group permissions using the lowercase **x** and then use the uppercase **X** to add permissions for all other users. This time, the uppercase **X** sets the permissions. - - -``` -$ touch cap-X-file -$ ls -l cap-X-file --rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file -$ chmod g+x cap-X-file -$ ls -l cap-X-file --rw-r-xr--. 1 root root 0 Jun 12 06:31 cap-X-file -$ chmod g+x cap-X-file -$ chmod o+X cap-X-file -ls -l cap-X-file --rw-r-xr-x. 1 root root 0 Jun 12 06:31 cap-X-file -``` - -### Understanding umask - -The **umask** masks (or "blocks off") bits from the default permission set in order to define permissions for a file or directory. For example, a 2 in the **umask** output indicates it is blocking the **write** bit from a file, at least by default. - -Using the **umask** command without any arguments allows us to see the current **umask** setting. There are four columns: the first is reserved for the special suid, sgid, or sticky bit, and the remaining three represent the owner, group, and other permissions. - - -``` -$ umask -0022 -``` - -To understand what this means, we can execute **umask** with a **-S** (as shown below) to get the result of masking the bits. For instance, because of the **2** value in the third column, the **write** bit is masked off from the group and other sections; only **read** and **execute** can be assigned for those. - - -``` -$ umask -S -u=rwx,g=rx,o=rx -``` - -To see what the default permission set is for files and directories, let's set our **umask** to all zeros. This means that we are not masking off any bits when we create a file. - - -``` -$ umask 000 -$ umask -S -u=rwx,g=rwx,o=rwx - -$ touch file-umask-000 -$ ls -l file-umask-000 --rw-rw-rw-. 1 root root 0 Jul 17 22:03 file-umask-000 -``` - -Now when we create a file, we see the default permissions are **read** (4) and **write** (2) for all sections, which would equate to 666 in octal representation. - -We can do the same for a directory and see its default permissions are 777. We need the **execute** bit on directories so we can traverse through them. - - -``` -$ mkdir dir-umask-000 -$ ls -ld dir-umask-000 -drwxrwxrwx. 2 root root 4096 Jul 17 22:03 dir-umask-000/ -``` - -### Conclusion - -There are many other ways an administrator can control access to files on a system. These permissions are basic to Linux, and we can build upon these fundamental aspects. If your work takes you into FACLs or SELinux, you will see that they also build upon these first rules of file access. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/linux-permissions-101 - -作者:[Alex Juarez][a] -选题:[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/mralexjuarezhttps://opensource.com/users/marcobravohttps://opensource.com/users/greg-p -[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://www.gnu.org/software/texinfo/manual/info-stnd/info-stnd.html -[3]: https://www.theurbanpenguin.com/using-a-simple-c-program-to-explain-the-suid-permission/ diff --git a/translated/tech/20190801 Linux permissions 101.md b/translated/tech/20190801 Linux permissions 101.md new file mode 100644 index 0000000000..113d571613 --- /dev/null +++ b/translated/tech/20190801 Linux permissions 101.md @@ -0,0 +1,322 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux permissions 101) +[#]: via: (https://opensource.com/article/19/8/linux-permissions-101) +[#]: author: (Alex Juarez https://opensource.com/users/mralexjuarezhttps://opensource.com/users/marcobravohttps://opensource.com/users/greg-p) + +全面介绍 Linux 权限 +====== + +> 知道如何控制用户对文件的访问是一项基本的系统管理技能。 + +![Penguins][1] + +了解 Linux 权限以及如何控制哪些用户可以访问文件是系统管理的一项基本技能。 + +本文将介绍标准 Linux 文件系统权限,并进一步研究特殊权限,以及使用 `umask` 解释默认权限的出处。 + +### 理解 ls 命令的输出 + +在讨论如何修改权限之前,我们需要知道如何查看权限。通过 `ls` 命令的长列表参数(`-l`)为我们提供了有关文件的许多信息。 + +``` +$ ls -lAh +total 20K +-rwxr-xr--+ 1 root root    0 Mar  4 19:39 file1 +-rw-rw-rw-. 1 root root    0 Mar  4 19:39 file10 +-rwxrwxr--+ 1 root root    0 Mar  4 19:39 file2 +-rw-rw-rw-. 1 root root    0 Mar  4 19:39 file8 +-rw-rw-rw-. 1 root root    0 Mar  4 19:39 file9 +drwxrwxrwx. 2 root root 4.0K Mar  4 20:04 testdir +``` + +为了理解这些是什么意思,让我们将关于权限的输出分解为各个部分。单独理解每个部分会更容易。 + +让我们看看在上面的输出中的最后一行的每个组件: + +``` +drwxrwxrwx. 2 root root 4.0K Mar  4 20:04 testdir +``` + +第 1 节 | 第 2 节 | 第 3 节 | 第 4 节 | 第 5 节 | 第 6 节 | 第 7 节 +---|---|---|---|---|---|--- +`d` | `rwx` | `rwx` | `rwx` | `.` | `root` | `root` + +第 1 节(左侧)显示文件的类型。 + +符号 | 类型 +---|--- +`d` | 目录 +`-` | 常规文件 +`l` | 软链接 + +`ls` 的 [info 页面][2]完整列出了不同的文件类型。 + +每个文件都有三种访问方式: + +* 属主 +* 组 +* 所有其他人 +   +第 2、3 和 4 节涉及用户、组和“其他用户”权限。每个部分都可以包含 `r`(读)、`w`(写)和 `x`(可执行)权限的组合。 + +每个权限还分配了一个数值,这在以八进制表示形式讨论权限时很重要。 + +权限 | 八进制值 +---|--- +`r` | 4 +`w` | 2 +`x` | 1 + +第 5 节描述了其他访问方法,例如 SELinux 或文件访问控制列表(FACL)。 + +访问方法 | 字符 +---|--- +没有其它访问方法 | `-` +SELinux | `.` +FACL | `+` +各种方法的组合 | `+` + +第 6 节和第 7 节分别是属主和组的名称。 + +### 使用 chown 和 chmod + +#### chown 命令 + +`chown`(更改所有权)命令用于更改文件的用户和组的所有权。 + +要将文件 `foo` 的用户和组的所有权更改为 `root`,我们可以使用以下命令: + +``` +$ chown root:root foo +$ chown root: foo +``` + +在用户后跟冒号(`:`)运行该命令将同时设置用户和组所有权。 + +要仅将文件 `foo` 的用户所有权设置为 `root` 用户,请输入: + +``` +$ chown root foo +``` + +要仅更改文件 `foo` 的组所有权,请在组之前加冒号: + +``` +$ chown :root foo +``` + +#### chmod 命令 + +`chmod`(更改模式)命令控制属主、组以及既不是属主也不属于与文件关联的组的所有其他用户的文件许可权。 + +`chmod` 命令可以以八进制(例如 `755`、`644` 等)和符号(例如 `u+rwx`、`g-rwx`、`o=rw`)格式设置权限。 + +八进制表示法将 4 个“点”分配给“读取”,将 2 个“点”分配给“写入”,将 1 个点分配给“执行”。如果要给用户(属主)分配“读”权限,则将 4 分配给第一个插槽,但是如果要添加“写”权限,则必须添加 2。如果要添加“执行”,则要添加 1。我们对每种权限类型执行此操作:属主、组和其他。 + +例如,如果我们想将 “读取”、“写入”和“执行”分配给文件的属主,但仅将“读取”和“执行”分配给组成员和所有其他用户,则我们应使用 `755`(八进制格式)。这是属主的所有权限位(`4 + 2 + 1`),但组和其他权限的所有权限位只有 `4` 和 `1`(`4 + 1`)。 + +> 细分为:4+2+1=7,4+1=5 和 4+1=5。 + +如果我们想将“读取”和“写入”分配给文件的属主,而只将“读取”分配给组的成员和所有其他用户,则可以如下使用 `chmod`: + +``` +$ chmod 644 foo_file +``` + +在下面的示例中,我们在不同的分组中使用符号表示法。注意字母 `u`、`g` 和 `o` 分别代表“用户”(属主)、“组”和“其他”。我们将 `u`、`g` 和 `o` 与 `+`、`-` 或 `=` 结合使用来添加、删除或设置权限位。 + +要将“执行”位添加到所有权权限集中: + +``` +$ chmod u+x foo_file +``` + +要从组成员中删除“读取”、“写入”和“执行”: + +``` +$ chmod g-rwx foo_file +``` + +要将所有其他用户的所有权设置为“读取”和“写入”: + +``` +$ chmod o=rw +``` + +### 特殊位:设置 UID、设置 GID 和粘滞位 + +除了标准权限外,还有一些特殊的权限位,它们具有一些有用的好处。 + +#### 设置用户 ID(suid) + +当在文件上设置 `suid` 时,将以文件的属主的身份而不是运行该文件的用户身份执行操作。一个[好例子][3]是 `passwd` 命令。它需要设置 `suid` 位,以便更改密码的操作具有 root 权限。 + +``` +$ ls -l /bin/passwd +-rwsr-xr-x. 1 root root 27832 Jun 10  2014 /bin/passwd +``` + +设置 `suid` 位的示例: + +``` +$ chmod u+s /bin/foo_file_name +``` + +#### 设置组 ID(sgid) + +`sgid` 位与 `suid` 位类似,因为操作是在目录的组所有权下完成的,而不是以运行命令的用户身份。 + +一个使用 `sgid` 的例子是,如果多个用户正在同一个目录中工作,并且目录中创建的每个文件都需要具有相同的组权限。下面的示例创建一个名为 `collab_dir` 的目录,设置 `sgid` 位,并将组所有权更改为 `webdev`。 + +``` +$ mkdir collab_dir +$ chmod g+s collab_dir +$ chown :webdev collab_dir +``` + +现在,在该目录中创建的任何文件都将具有 `webdev` 的组所有权,而不是创建该文件的用户的组。 + +``` +$ cd collab_dir +$ touch file-sgid +$ ls -lah file-sgid +-rw-r--r--. 1 root webdev 0 Jun 12 06:04 file-sgid +``` + +#### “粘滞”位 + +粘滞位表示只有文件所有者才能删除该文件,即使组权限也允许该文件可以删除。通常,在 `/tmp` 这样的通用或协作目录上,此设置最有意义。在下面的示例中,“所有其他人”权限集的“执行”列中的 `t` 表示已应用粘滞位。 + +``` +$ ls -ld /tmp +drwxrwxrwt. 8 root root 4096 Jun 12 06:07 /tmp/ +``` + +请记住,这不会阻止某个人编辑该文件,它只是阻止他们删除该目录的内容。 + +我们将粘滞位设置为: + +``` +$ chmod o+t foo_dir +``` + +你可以自己尝试在目录上设置粘滞位并赋予其完整的组权限,以便多个属于同一组的用户可以在目录上进行读取、写入和执行。 + +接着,以每个用户的身份创建文件,然后尝试以另一个用户的身份删除它们。 + +如果一切配置正确,则一个用户应该不能从另一用户那里删除文件。 + +请注意,这些位中的每个位也可以用八进制格式设置:SUID = 4、SGID = 2 和 粘滞位 = 1。(LCTT 译注:这里是四位八进制数字) + +``` +$ chmod 4744 +$ chmod 2644 +$ chmod 1755 +``` + +#### 大写还是小写? + +如果要设置特殊位并看到大写的 `S` 或 `T` 而不是小写的字符(如我们之前所见),那是因为不存在(对应的)底层的执行位。为了说明这一点,下面的示例创建一个设置了粘滞位的文件。然后,我们可以添加和删除执行位以演示大小写更改。 + +``` +$ touch file cap-ST-demo +$ chmod 1755 cap-ST-demo +$ ls -l cap-ST-demo +-rwxr-xr-t. 1 root root 0 Jun 12 06:16 cap-ST-demo + +$ chmod o-x cap-X-demo +$ ls -l cap-X-demo +-rwxr-xr-T. 1 root root 0 Jun 12 06:16 cap-ST-demo +``` + +#### 有条件地设置执行位 + +至此,我们使用小写的 `x` 设置了执行位,而无需询问任何问题即可对其进行设置。我们还有另一种选择:使用大写的 `X` 而不是小写的,它将仅在权限组中某个位置已经有执行位时才设置执行位。这可能是一个很难解释的概念,但是下面的演示将帮助说明它。请注意,在尝试将执行位添加到组特权之后,该位没有被设置上。 + +``` +$ touch cap-X-file +$ ls -l cap-X-file +-rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file +$ chmod g+X cap-X-file +$ ls -l cap-X-file +-rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file +``` + +在这个类似的例子中,我们首先使用小写的 `x` 将执行位添加到组权限,然后使用大写的 `X` 为所有其他用户添加权限。这次,大写的 `X`设置了该权限。 + +``` +$ touch cap-X-file +$ ls -l cap-X-file +-rw-r--r--. 1 root root 0 Jun 12 06:31 cap-X-file +$ chmod g+x cap-X-file +$ ls -l cap-X-file +-rw-r-xr--. 1 root root 0 Jun 12 06:31 cap-X-file +$ chmod o+X cap-X-file +ls -l cap-X-file +-rw-r-xr-x. 1 root root 0 Jun 12 06:31 cap-X-file +``` + +### 理解 umask + +`umask 会屏蔽(或“阻止”)默认权限集中的位,以定义文件或目录的权限。例如,`umask`输出中的 `2` 表示它至少在默认情况下阻止了文件的写入位。 + +使用不带任何参数的 `umask` 命令可以使我们看到当前的 `umask` 设置。共有四列:第一列为特殊的`suid`、`sgid` 或粘滞位而保留,其余三列代表属主、组和其他人的权限。 + +``` +$ umask +0022 +``` + +为了理解这意味着什么,我们可以用 `-S` 标志来执行 `umask`(如下所示)以了解屏蔽位的结果。例如,由于第三列中的值为 `2`,因此将“写入”位从组和其他部分中屏蔽掉了;只能为它们分配“读取”和“执行”。 + +``` +$ umask -S +u=rwx,g=rx,o=rx +``` + +要查看文件和目录的默认权限集是什么,让我们将 `umask` 设置为全零。这意味着我们在创建文件时不会掩盖任何位。 + +``` +$ umask 000 +$ umask -S +u=rwx,g=rwx,o=rwx + +$ touch file-umask-000 +$ ls -l file-umask-000 +-rw-rw-rw-. 1 root root 0 Jul 17 22:03 file-umask-000 +``` + +现在,当我们创建文件时,我们看到所有部分的默认权限分别为“读取”(`4`)和“写入”(`2`),相当于八进制表示 `666`。 + +我们可以对目录执行相同的操作,并看到其默认权限为 `777`。我们需要在目录上使用“执行”位,以便可以遍历它们。 + +``` +$ mkdir dir-umask-000 +$ ls -ld dir-umask-000 +drwxrwxrwx. 2 root root 4096 Jul 17 22:03 dir-umask-000/ +``` + +### 总结 + +管理员还有许多其他方法可以控制对系统文件的访问。这些权限是 Linux 的基本权限,我们可以在这些基础上进行构建。如果你的工作将你带入 FACL 或 SELinux,你会发现它们也建立在这些文件访问的首要规则之上。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/linux-permissions-101 + +作者:[Alex Juarez][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/mralexjuarezhttps://opensource.com/users/marcobravohttps://opensource.com/users/greg-p +[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://www.gnu.org/software/texinfo/manual/info-stnd/info-stnd.html +[3]: https://www.theurbanpenguin.com/using-a-simple-c-program-to-explain-the-suid-permission/ From ad9cffd8ed7df5a6dc6749759e791fb19419eaea Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 Nov 2019 00:53:38 +0800 Subject: [PATCH 363/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191107=20Tuning?= =?UTF-8?q?=20your=20bash=20or=20zsh=20shell=20on=20Fedora=20Workstation?= =?UTF-8?q?=20and=20Silverblue?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md --- ...ll on Fedora Workstation and Silverblue.md | 260 ++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md diff --git a/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md b/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md new file mode 100644 index 0000000000..9419994451 --- /dev/null +++ b/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md @@ -0,0 +1,260 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tuning your bash or zsh shell on Fedora Workstation and Silverblue) +[#]: via: (https://fedoramagazine.org/tuning-your-bash-or-zsh-shell-in-workstation-and-silverblue/) +[#]: author: (George Luiz Maluf https://fedoramagazine.org/author/georgelmaluf/) + +Tuning your bash or zsh shell on Fedora Workstation and Silverblue +====== + +![][1] + +This article shows you how to set up some powerful tools in your command line interpreter (CLI) shell on Fedora. If you use _bash_ (the default) or _zsh_, Fedora lets you easily setup these tools. + +### Requirements + +Some installed packages are required. On Workstation, run the following command: + +``` +sudo dnf install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make +``` + +On Silverblue run: + +``` +sudo rpm-ostree install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make +``` + +**Note**: On Silverblue you need to restart before proceeding. + +### Fonts + +You can give your terminal a new look by installing new fonts. Why not fonts that display characters and icons together? + +##### Nerd-Fonts + +Open a new terminal and type the following commands: + +``` +git clone https://github.com/ryanoasis/nerd-fonts ~/.nerd-fonts +cd .nerd-fonts +sudo ./install.sh +``` + +##### Awesome-Fonts + +On Workstation, install using the following command: + +``` +sudo dnf fontawesome-fonts +``` + +On Silverblue, type: + +``` +sudo rpm-ostree install fontawesome-fonts +``` + +### Powerline + +Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including bash, zsh, tmus, i3, Awesome, IPython and Qtile. + +Fedora Magazine previously posted an [article about powerline][2] that includes instructions on how to install it in the vim editor. You can also find more information on the official [documentation site][3]. + +#### Installation + +To install powerline utility on Fedora Workstation, open a new terminal and run: + +``` +sudo dnf install powerline vim-powerline tmux-powerline powerline-fonts +``` + +On Silverblue, the command changes to: + +``` +sudo rpm-ostree install powerline vim-powerline tmux-powerline powerline-fonts +``` + +**Note**: On Silverblue, before proceeding you need restart. + +#### Activating powerline + +To make the powerline active by default, place the code below at the end of your _~/.bashrc_ file + +``` +if [ -f `which powerline-daemon` ]; then + powerline-daemon -q + POWERLINE_BASH_CONTINUATION=1 + POWERLINE_BASH_SELECT=1 + . /usr/share/powerline/bash/powerline.sh +fi +``` + +Finally, close the terminal and open a new one. It will look like this: + +![][4] + +### Oh-My-Zsh + +[Oh-My-Zsh][5] is a framework for managing your Zsh configuration. It comes bundled with helpful functions, plugins, and themes. To learn how set Zsh as your default shell this [article][6]. + +#### Installation + +Type this in the terminal: + +``` +sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +``` + +Alternatively, you can type this: + +``` +sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" +``` + +At the end, you see the terminal like this: + +![][7] + +Congratulations, Oh-my-zsh is installed. + +#### Themes + +Once installed, you can select your theme. I prefer to use the Powerlevel10k. One advantage is that it is 100 times faster than powerlevel9k theme. To install run this line: + +``` +git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10k +``` + +And set ZSH_THEME in your _~/.zshrc_ file + +``` +ZSH_THEME=powerlevel10k/powerlevel10k +``` + +Close the terminal. When you open the terminal again, the Powerlevel10k configuration wizard will ask you a few questions to configure your prompt properly. + +![][8] + +After finish Powerline10k configuration wizard, your prompt will look like this: + +![][9] + +If you don’t like it. You can run the powerline10k wizard any time with the command _p10k configure_. + +#### Enable plug-ins + +Plug-ins are stored in _.oh-my-zsh/plugins_ folder. You can visit this site for more information. To activate a plug-in, you need edit your _~/.zshrc_ file. Install plug-ins means that you are going create a series of aliases or shortcuts that execute a specific function. + +For example, to enable the firewalld and git plugins, first edit ~/.zshrc: + +``` +plugins=(firewalld git) +``` + +**Note**: use a blank space to separate the plug-ins names list. + +Then reload the configuration + +``` +source ~/.zshrc +``` + +To see the created aliases, use the command: + +``` +alias | grep firewall +``` + +![][10] + +#### Additional configuration + +I suggest the install syntax-highlighting and syntax-autosuggestions plug-ins. + +``` +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting +git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +``` + +Add them to your plug-ins list in your file _~/.zshrc_ + +``` +plugins=( [plugins...] zsh-syntax-highlighting zsh-autosuggestions) +``` + +Reload the configuration + +``` +source ~/.zshrc +``` + +See the results: + +![][11] + +### Colored folders and icons + +Colorls is a Ruby gem that beautifies the terminal’s ls command, with colors and font-awesome icons. You can visit the official [site][12] for more information. + +Because it’s a ruby gem, just follow this simple step: + +``` +sudo gem install colorls +``` + +To keep up to date, just do: + +``` +sudo gem update colorls +``` + +To prevent type colorls everytime you can make aliases in your _~/.bashrc_ or _~/.zshrc_. + +``` +alias ll='colorls -lA --sd --gs --group-directories-first' +alias ls='colorls --group-directories-first' +``` + +Also, you can enable tab completion for colorls flags, just entering following line at end of your shell configuration: + +``` +source $(dirname ($gem which colorls))/tab_complete.sh +``` + +Reload it and see what it happens: + +![][13] + +![][14] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/tuning-your-bash-or-zsh-shell-in-workstation-and-silverblue/ + +作者:[George Luiz Maluf][a] +选题:[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/georgelmaluf/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/tuning-shell-816x345.jpg +[2]: https://fedoramagazine.org/add-power-terminal-powerline/ +[3]: https://powerline.readthedocs.io/en/latest/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/10/terminal_bash_powerline.png +[5]: https://ohmyz.sh +[6]: https://fedoramagazine.org/set-zsh-fedora-system/ +[7]: https://fedoramagazine.org/wp-content/uploads/2019/10/oh-my-zsh.png +[8]: https://fedoramagazine.org/wp-content/uploads/2019/10/powerlevel10k_config_wizard.png +[9]: https://fedoramagazine.org/wp-content/uploads/2019/10/powerlevel10k.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/10/aliases_plugin.png +[11]: https://fedoramagazine.org/wp-content/uploads/2019/10/sintax.png +[12]: https://github.com/athityakumar/colorls +[13]: https://fedoramagazine.org/wp-content/uploads/2019/10/ls-1024x495.png +[14]: https://fedoramagazine.org/wp-content/uploads/2019/10/ll-1024x495.png From 849a1caea5e7dc16c6232ddfcc7140150b718f6e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 Nov 2019 00:54:02 +0800 Subject: [PATCH 364/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191108=20Budget?= =?UTF-8?q?-friendly=20Linux=20Smartphone=20PinePhone=20Will=20be=20Availa?= =?UTF-8?q?ble=20to=20Pre-order=20Next=20Week?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md --- ...ill be Available to Pre-order Next Week.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md diff --git a/sources/tech/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md b/sources/tech/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md new file mode 100644 index 0000000000..4e8ec1311f --- /dev/null +++ b/sources/tech/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week) +[#]: via: (https://itsfoss.com/pinephone/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week +====== + +Do you remember when [It’s FOSS first broke the story that Pine64 was working on a Linux-based smartphone][1] running KDE Plasma (among other distributions) in 2017? It’s been some time since then but the good news is that PinePhone will be available for pre-order from 15th November. + +Let me provide you more details on the PinePhone like its specification, pricing and release date. + +### PinePhone: Linux-based budget smartphone + +The PinePhone developer kit is already being tested by some devs and more such kits will be shipped by 15th November. You can check out some of these images by clicking the photo gallery below: + +The developer kit is a combo kit of PINE A64 baseboard + SOPine module + 7″ Touch Screen Display + Camera + Wifi/BT + Playbox enclosure + Lithium-Ion battery case + LTE cat 4 USB dongle. + +These combo kits allow developers to jump start PinePhone development. The PINE A64 platform already has mainline Linux OS build thanks to the PINE64 community and the support by [KDE neon][2]. + +#### Specifications of PinePhone + +![PinePhone Prototype | Image by Martjin Braam][3] + + * Allwinner A64 Quad Core SoC with Mali 400 MP2 GPU + * 2GB of LPDDR3 RAM + * 5.95″ LCD 1440×720, 18:9 aspect ratio (hardened glass) + * Bootable Micro SD + * 16GB eMMC + * HD Digital Video Out + * USB Type C (Power, Data and Video Out) + * Quectel EG-25G with worldwide bands + * WiFi: 802.11 b/g/n, single-band, hotspot capable + * Bluetooth: 4.0, A2DP + * GNSS: GPS, GPS-A, GLONASS + * Vibrator + * RGB status LED + * Selfie and Main camera (2/5Mpx respectively) + * Main Camera: Single OV6540, 5MP, 1/4″, LED Flash + * Selfie Camera: Single GC2035, 2MP, f/2.8, 1/5″ + * Sensors: accelerator, gyro, proximity, compass, barometer, ambient light + * 3 External Switches: up down and power + * HW switches: LTE/GNSS, WiFi, Microphone, Speaker, USB + * Samsung J7 form-factor 3000mAh battery + * Case is matte black finished plastic + * Headphone Jack + + + +#### Production, Price & Availability + +![Pinephone Brave Heart Pre Order][4] + +PinePhone will cost about $150. The early adapter release has been named ‘Brave Heart’ edition and it will go on sale from November 15, 2019. As you can see in the image above, [Pine64’s homepage][5] has included a timer for the first pre-order batch of PinePhone. + +You should expect the early adopter ‘Brave Heart’ editions to be shipped and delivered by December 2019 or January 2020. + +Mass production will begin only after the Chinese New Year, hinting at early Q2 of 2020 or March 2020 (at the earliest). + +The phone hasn’t yet been listed on Pine Store – so make sure to check out [Pine64 online store][6] to pre-order the ‘Brave Heart’ edition if you want to be one of the early adopters. + +#### What do you think of PinePhone? + +Pine64 has already created a budget laptop called [Pinebook][7] and a relatively powerful [Pinebook Pro][8] laptop. So, there is definitely hope for PinePhone to succeed, at least in the niche of DIY enthusiasts and hardcore Linux fans. The low pricing is definitely a huge plus here compared to the other [Linux smartphone Librem5][9] that costs over $600. + +Another good thing about PinePhone is that you can experiment with the operating system by installing Ubuntu Touch, Plasma Mobile or Aurora OS/Sailfish OS. + +These Linux-based smartphones don’t have the features to replace Android or iOS, yet. If you are looking for a fully functional smartphone to replace your Android smartphone, PinePhone is certainly not for you. It’s more for people who like to experiment and are not afraid to troubleshoot. + +If you are looking to buy PinePhone, mark the date and set a reminder. There will be limited supply and what I have seen so far, Pine devices go out of stock pretty soon. + +_Are you going to pre-order a PinePhone? Let us know of your views in the comment section._ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pinephone/ + +作者:[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/pinebook-kde-smartphone/ +[2]: https://neon.kde.org/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pinephone-prototype.jpeg?ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/pinephone-brave-heart-pre-order.jpg?ssl=1 +[5]: https://www.pine64.org/ +[6]: https://store.pine64.org/ +[7]: https://itsfoss.com/pinebook-linux-notebook/ +[8]: https://itsfoss.com/pinebook-pro/ +[9]: https://itsfoss.com/librem-linux-phone/ From d514cc9cbfe0c86dcb93ccaa2a11c069703102dd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 Nov 2019 00:55:33 +0800 Subject: [PATCH 365/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191107=20A=20gu?= =?UTF-8?q?ide=20to=20open=20source=20for=20microservices?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191107 A guide to open source for microservices.md --- ... guide to open source for microservices.md | 309 ++++++++++++++++++ 1 file changed, 309 insertions(+) create mode 100644 sources/tech/20191107 A guide to open source for microservices.md diff --git a/sources/tech/20191107 A guide to open source for microservices.md b/sources/tech/20191107 A guide to open source for microservices.md new file mode 100644 index 0000000000..5731e85cf5 --- /dev/null +++ b/sources/tech/20191107 A guide to open source for microservices.md @@ -0,0 +1,309 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A guide to open source for microservices) +[#]: via: (https://opensource.com/article/19/11/microservices-cheat-sheet) +[#]: author: (Girish Managoli https://opensource.com/users/gammay) + +A guide to open source for microservices +====== +Build and manage high-scale microservices networks and solve the +challenges of running services without fault that scale based on +business demand. +![Text editor on a browser, in blue][1] + +Microservices—applications broken down into smaller, composable pieces that work together—are getting as much attention as the hottest new restaurant in town. (If you're not yet familiar, dive into [What Are Microservices][2] before continuing here.) + +However, if you have moved on from "Hello, World" and running a simple handful of microservices, and are building hundreds of microservices and running thousands of instances, you know there is nothing "micro" about them. You want your instances to increase when users increase and decrease when users decrease. You want to distribute requests effectively between instances. You want to build and run your services intelligently. You need a clear view of the service instances that are running or going down. How can you manage all of this complexity? + +This article looks at some of the key terminologies in the microservices ecosystem and some of the open source software available to build out a microservices architecture. The focus is on building and managing high-scale microservices networks and solving the challenges of running services without fault and that scale correctly based on business demand. + +Here is a wholesome, lavish spread of open source cuisine that is sure to be gastronomically, "_microservically"_ appetizing. I'm sure I've overlooked some open source applications in this area; please let me know about them in the comments. + +**[Download the PDF version of this cheat sheet [here][3]]** + +### Containers + +The right way to deploy applications is in [containers][4]. Briefly, a container is a miniature virtual server packed with the software required to run an application. The container pack is small, smart, and easy to deploy and maintain. And deploying your application in a container is clever. You can deploy as many instances as you need and scale up or down as needed to meet the current load. + +**Open source containers** + +**Software** | **Code** | **License** +---|---|--- +[rkt][5] | [GitHub][6] | Apache License 2.0 +[Docker][7] | [GitHub][8] | Apache License 2.0 +[FreeBSD Jail][9] | [GitHub][10] | FreeBSD License +[LXC][11] | [GitHub][12] | GNU LGPL v.2.1 +[OpenVZ][13] | [GitHub][14] | GNU General Public License v2.0 + +### Container orchestrators + +If you have hundreds or thousands of service instances deployed on containers, you need a good way to manage them. Container orchestration is the right solution for deploying and managing all of these containers. Orchestrators can move across; scale up, down, or out; manage higher or lower loads; regulate added, removed, and dead containers; and much more. + +**Open source container orchestrators** + +**Software** | **Code** | **License** +---|---|--- +[Kubernetes][15] | [GitHub][16] | Apache License 2.0 +[OpenShift][17] | [GitHub][18] | Apache License 2.0 +[Nomad][19] | [GitHub][20] | Mozilla Public License 2.0 +[LXD][21] | [GitHub][22] | Apache License 2.0 + +### API gateways + +An API gateway is a watchman that controls and monitors API calls to your application. An API gateway has three key roles: + + 1. **API data and management:** API listing, API subscription, API documentation, community support + 2. **API viewpoint and billing:** Analytics, metrics, billing + 3. **API control and security:** Subscription caller management, rate control, blocking, data conversion, production and sandbox support, key management + + + +API gateways are usually multi-tenant solutions to deploy multiple applications on the same gateway. + +**Open source API gateways** + +Not all of the following API gateways support every function mentioned above, so pick and choose depending on your needs. + +**Software** | **Code** | **License** +---|---|--- +[3scale][23] | [GitHub][24] | Apache License 2.0 +[API Umbrella][25] | [GitHub][26] | MIT License +[Apigee][27] | [GitHub][28] | Apache License 2.0 +[Apiman][29] | [GitHub][30] | Apache License 2.0 +[DreamFactory][31] | [GitHub][32] | Apache License 2.0 +[Fusio][33] | [GitHub][34] | GNU Affero General Public License v3.0 +[Gravitee][35] | [GitHub][36] | Apache License 2.0 +[Kong][37] | [GitHub][38] | Apache License 2.0 +[KrakenD][39] | [GitHub][40] | Apache License 2.0 +[Tyk][41] | [GitHub][42] | Mozilla Public License 2.0 + +### CI/CD + +Continuous integration (CI) and continuous deployment (CD; it may also stand for continuous delivery) are the net sum of processes to build and run your processes. [CI/CD][43] is a philosophy that ensures your microservices are built and run correctly to meet users' expectations. Automation is the critical CI/CD factor that makes the build and run process easy and structured. CI's primary processes are build and test, and CD's are deploy and monitor. + +All of the CI/CD tools and platforms listed below are open source. I don't include SaaS platforms that are free for hosting open source. GitHub also isn't on the list because it is not open source and does not have built-in CI/CD; it uses third-party CI/CD product integrations instead. GitLab is open source and has a built-in CI/CD service, so it is on this list. + +**Open source CI/CD tools** + +**Software** | **Code** | **License** +---|---|--- +[Jenkins][44] | [GitHub][45] | MIT License +[GitLab][46] | [GitLab][47] | MIT License +[Buildbot][48] | [GitHub][49] | GNU General Public License v2.0 +[Concourse][50] | [GitHub][51] | Apache License 2.0 +[GoCD][52] | [GitHub][53] | Apache License 2.0 +[Hudson][54] | [GitHub][55] | MIT License +[Spinnaker][56] | [GitHub][57] | Apache License 2.0 + +### Load balancers + +When your number of requests scale, you must deploy multiple instances of your application and share requests across those instances. The application that manages the requests between instances is called a load balancer. A load balancer can be configured to distribute requests based on round-robin scheduling, IP routing, or another algorithm. The load balancer automatically manages request distributions when new instances are added (to support higher load) or decommissioned (when load scales down). Session persistence is another load-balancing feature that redirects new requests to the previous instance when needed (for example, to maintain a session). There are hardware- and software-based load balancers. + +**Open source load balancers** + +**Software** | **Code** | **License** +---|---|--- +[HAProxy][58] | [GitHub][59] | HAPROXY's license / GPL v2.0 +[Apache modules][60] (mod_athena, mod_proxy_balancer) | [SourceForge][61] or +[Code.Google][62] or +[GitHub][63] | Apache License 2.0 +[Balance][64] | [SourceForge][65] | GNU General Public License v2.0 +[Distributor][66] | [SourceForge][67] | GNU General Public License v2.0 +[GitHub Load Balancer (GLB) Director][68] | [GitHub][69] | BSD 3-Clause License +[Neutrino][70] | [GitHub][71] | Apache License 2.0 +[OpenLoBa][72] | [SourceForge][73] | Not known +[Pen][74] | [GitHub][75] | GNU General Public License, v2.0 +[Seesaw][76] | [GitHub][77] | Apache License 2.0 +[Synapse][78] | [GitHub][79] | Apache License 2.0 +[Traefik][80] | [GitHub][81] | MIT License + +### Service registry and service discovery + +When several hundreds or thousands of service instances are deployed and talking to each other, how do requester services know how to connect the right responder services, given that deployment points are dynamic as services are scaled in and out? A service registry and service discovery service solves this problem. These systems are essentially key-value stores that maintain configuration information and naming and provide distributed synchronization. + +**Open source service registry and discovery services** + +**Software** | **Code** | **License** +---|---|--- +[Baker Street][82] | [GitHub][83] | Apache License 2.0 +[Consul][84] | [GitHub][85] | Mozilla Public License 2.0 +[etcd][86] | [GitHub][87] | Apache License 2.0 +[Registrator][88] | [GitHub][89] | MIT License +[Serf][90] | [GitHub][91] | Mozilla Public License 2.0 +[ZooKeeper][92] | [GitHub][93] | Apache License 2.0 + +### Monitoring + +When your microservices and their instances cater to users' needs, you need to maintain a good view of their performance. Monitoring tools to the rescue! + +Open source monitoring tools and software come in numerous flavors, some barely better than [top][94]. Other options include OS-specific; enterprise-grade; tool collections that provide complete integration; do-one-thing tools that merely monitor or report or visualize and integrate with third-party tools; and tools that monitor specific or multiple components such as networks, log files, web requests, and databases. Monitoring tools can be web-based or standalone tools, and notification options range from passive reporting to active alerting. + +Choose one or more of these tools to enjoy a chewy crunch of your microservices network. + +**Open source monitoring software** + +**Software** | **Code** | **License** +---|---|--- +[OpenNMS][95] | [GitHub][96] | GNU Affero General Public License +[Grafana][97] | [GitHub][98] | Apache License 2.0 +[Graphite][99] | [GitHub][100] | Apache License 2.0 +[Icinga][101] | [GitHub][102] | GNU General Public License v2.0 +[InfluxDB][103] | [GitHub][104] | MIT License +[LibreNMS][105] | [GitHub][106] | GNU General Public License v3.0 +[Naemon][107] | [GitHub][108] | GNU General Public License v2.0 +[Nagios][109] | [GitHub][110] | GNU General Public License v2.0 +[ntop][111] | [GitHub][112] | GNU General Public License v3.0 +[ELK][113] | [GitHub][114] | Apache License 2.0 +[Prometheus][115] | [GitHub][116] | Apache License 2.0 +[Sensu][117] | [GitHub][118] | MIT License +[Zabbix][119] | [Self-hosted repo][120] | GNU General Public License v2.0 +[Zenoss][121] | [SourceForge][122] | GNU General Public License v2.0 + +### The right ingredients + +Pure open source solutions can offer the right ingredients for deploying and running microservices at high scale. I hope you find them to be relishing, gratifying, satiating, and most of all, _microservicey_! + +### Download the [Microservices cheat sheet][3].  + +What are microservices? Opensource.com created a new resource page which gently introduces... + +What are microservices, how do container technologies allow for their use, and what other tools do... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/microservices-cheat-sheet + +作者:[Girish Managoli][a] +选题:[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/gammay +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://opensource.com/resources/what-are-microservices +[3]: https://opensource.com/content/microservices-cheat-sheet +[4]: https://opensource.com/resources/what-are-linux-containers +[5]: https://coreos.com/rkt/ +[6]: https://github.com/rkt/rkt/ +[7]: https://www.docker.com/ +[8]: https://github.com/docker +[9]: https://www.freebsd.org/doc/handbook/jails-build.html +[10]: https://github.com/freebsd/freebsd +[11]: https://linuxcontainers.org/lxc/ +[12]: https://github.com/lxc/lxc +[13]: https://openvz.org/ +[14]: https://github.com/OpenVZ +[15]: https://kubernetes.io/ +[16]: https://github.com/kubernetes/kubernetes +[17]: https://www.openshift.com/ +[18]: https://github.com/openshift +[19]: https://www.nomadproject.io/ +[20]: https://github.com/hashicorp/nomad +[21]: https://linuxcontainers.org/lxd/introduction/ +[22]: https://github.com/lxc/lxd +[23]: https://www.redhat.com/en/technologies/jboss-middleware/3scale +[24]: https://github.com/3scale/APIcast +[25]: https://apiumbrella.io/ +[26]: https://github.com/NREL/api-umbrella +[27]: https://cloud.google.com/apigee/ +[28]: https://github.com/apigee/microgateway-core +[29]: http://www.apiman.io/ +[30]: https://github.com/apiman/apiman +[31]: https://www.dreamfactory.com/ +[32]: https://github.com/dreamfactorysoftware/dreamfactory +[33]: https://www.fusio-project.org/ +[34]: https://github.com/apioo/fusio +[35]: https://gravitee.io/ +[36]: https://github.com/gravitee-io/gravitee-gateway +[37]: https://konghq.com/kong/ +[38]: https://github.com/Kong/ +[39]: https://www.krakend.io/ +[40]: https://github.com/devopsfaith/krakend +[41]: https://tyk.io/ +[42]: https://github.com/TykTechnologies/tyk +[43]: https://opensource.com/article/18/8/what-cicd +[44]: https://jenkins.io/ +[45]: https://github.com/jenkinsci/jenkins +[46]: https://gitlab.com/ +[47]: https://gitlab.com/gitlab-org +[48]: https://buildbot.net/ +[49]: https://github.com/buildbot/buildbot +[50]: https://concourse-ci.org/ +[51]: https://github.com/concourse/concourse +[52]: https://www.gocd.org/ +[53]: https://github.com/gocd/gocd +[54]: http://hudson-ci.org/ +[55]: https://github.com/hudson +[56]: https://www.spinnaker.io/ +[57]: https://github.com/spinnaker/spinnaker +[58]: http://www.haproxy.org/ +[59]: https://github.com/haproxy/haproxy +[60]: https://httpd.apache.org/docs/2.4/mod/mod_proxy_balancer.html +[61]: http://ath.sourceforge.net/ +[62]: https://code.google.com/archive/p/ath/ +[63]: https://github.com/omnigroup/Apache/blob/master/httpd/modules/proxy/mod_proxy_balancer.c +[64]: https://www.inlab.net/balance/ +[65]: https://sourceforge.net/projects/balance/ +[66]: http://distributor.sourceforge.net/ +[67]: https://sourceforge.net/projects/distributor/files/ +[68]: https://github.blog/2016-09-22-introducing-glb/ +[69]: https://github.com/github/glb-director +[70]: https://neutrinoslb.github.io/ +[71]: https://github.com/eBay/Neutrino +[72]: http://openloba.sourceforge.net/ +[73]: https://sourceforge.net/p/openloba/code/HEAD/tree/ +[74]: http://siag.nu/pen/ +[75]: https://github.com/UlricE/pen +[76]: https://opensource.google.com/projects/seesaw +[77]: https://github.com/google/seesaw +[78]: https://synapse.apache.org/ +[79]: https://github.com/apache/synapse/tree/master +[80]: https://traefik.io/ +[81]: https://github.com/containous/traefik +[82]: http://bakerstreet.io/ +[83]: https://github.com/datawire/bakerstreet +[84]: https://www.consul.io/ +[85]: https://github.com/hashicorp/consul +[86]: https://etcd.io/ +[87]: https://github.com/etcd-io/etcd +[88]: https://gliderlabs.github.io/registrator/latest/ +[89]: https://github.com/gliderlabs/registrator +[90]: https://www.serf.io/ +[91]: https://github.com/hashicorp/serf +[92]: https://zookeeper.apache.org/ +[93]: https://github.com/apache/zookeeper +[94]: https://en.wikipedia.org/wiki/Top_(software) +[95]: https://www.opennms.com/ +[96]: https://github.com/OpenNMS/opennms +[97]: https://grafana.com +[98]: https://github.com/grafana/grafana +[99]: https://graphiteapp.org/ +[100]: https://github.com/graphite-project +[101]: https://icinga.com/ +[102]: https://github.com/icinga/ +[103]: https://www.influxdata.com/ +[104]: https://github.com/influxdata/influxdb +[105]: https://www.librenms.org/ +[106]: https://github.com/librenms/librenms +[107]: http://www.naemon.org/ +[108]: https://github.com/naemon +[109]: https://www.nagios.org/ +[110]: https://github.com/NagiosEnterprises/nagioscore +[111]: https://www.ntop.org/ +[112]: https://github.com/ntop/ntopng +[113]: https://www.elastic.co/ +[114]: https://github.com/elastic +[115]: https://prometheus.io/ +[116]: https://github.com/prometheus/prometheus +[117]: https://sensu.io/ +[118]: https://github.com/sensu +[119]: https://www.zabbix.com/ +[120]: https://git.zabbix.com/projects/ZBX/repos/zabbix/browse +[121]: https://www.zenoss.com/ +[122]: https://sourceforge.net/projects/zenoss/ From 6b45be5f4949e03fdeb579c11ee372dae3b09d94 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 Nov 2019 00:56:43 +0800 Subject: [PATCH 366/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191107=20How=20?= =?UTF-8?q?to=20add=20a=20user=20to=20your=20Linux=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191107 How to add a user to your Linux desktop.md --- ...How to add a user to your Linux desktop.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/tech/20191107 How to add a user to your Linux desktop.md diff --git a/sources/tech/20191107 How to add a user to your Linux desktop.md b/sources/tech/20191107 How to add a user to your Linux desktop.md new file mode 100644 index 0000000000..da1957b563 --- /dev/null +++ b/sources/tech/20191107 How to add a user to your Linux desktop.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to add a user to your Linux desktop) +[#]: via: (https://opensource.com/article/19/11/add-user-gui-linux) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +How to add a user to your Linux desktop +====== +It's easy to manage users from a graphical interface, whether during +installation or on the desktop. +![Team of people around the world][1] + +Adding a user is one of the first things you do on a new computer system. And you often have to manage users throughout the computer's lifespan. + +My article on the [**useradd** command][2] provides a deeper understanding of user management on Linux. Useradd is a command-line tool, but you can also manage users graphically on Linux. That's the topic of this article. + +### Add a user during Linux installation + +Most Linux distributions provide a step for creating a user during installation. For example, the Fedora 30 installer, Anaconda, creates the standard _root_ user and one other local user account. When you reach the **Configuration** screen during installation, click **User Creation** under **User Settings**. + +![Fedora Anaconda Installer - Add a user][3] + +On the Create User screen, enter the user's details: **Full name**, **User name**, and **Password**. You can also choose whether to make the user an administrator. + +![Create a user during installation][4] + +The **Advanced** button opens the **Advanced User Configuration** screen. Here, you can specify the path to the home directory and the user and group IDs if you need something besides the default. You can also type a list of secondary groups that the user will be placed into. + +![Advanced user configuration][5] + +### Add a user on the Linux desktop + +#### GNOME + +Many Linux distributions use the GNOME desktop. The following screenshots are from Red Hat Enterprise Linux 8.0, but the process is similar in other distros like Fedora, Ubuntu, or Debian. + +Start by opening **Settings**. Then go to **Details**, select **Users**, click **Unlock**, and enter your password (unless you are already logged in as root). This will replace the **Unlock** button with an **Add User** button. + +![GNOME user settings][6] + +Now, you can add a user by clicking **Add User**,** **then selecting the account **Type** and the details **Name** and **Password**). + +In the screenshot below, a user name has been entered, and settings are left as default. I did not have to enter the **Username**; it was created automatically as I typed in the **Full Name** field. You can still modify it though if the autocompletion is not to your liking. + +![GNOME settings - add user][7] + +This creates a standard account for a user named Sonny. Sonny will need to provide a password the first time he or she logs in. + +Next, the users will be displayed. Each user can be selected and customized or removed from this screen. For instance, you might want to choose an avatar image or set the default language. + +![GNOME new user][8] + +#### KDE + +KDE is another popular Linux desktop environment. Below is a screenshot of KDE Plasma on Fedora 30. You can see that adding a user in KDE is quite similar to doing it in GNOME. + +![KDE settings - add user][9] + +### Conclusion + +Other desktop environments and window managers in addition to GNOME and KDE include graphical user management tools. Adding a user graphically in Linux is quick and simple, whether you do it at installation or afterward. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/add-user-gui-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/team_global_people_gis_location.png?itok=Rl2IKo12 (Team of people around the world) +[2]: https://opensource.com/article/19/10/linux-useradd-command +[3]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda2.png (Fedora Anaconda Installer - Add a user) +[4]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda3.png (Create a user during installation) +[5]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda4.png (Advanced user configuration) +[6]: https://opensource.com/sites/default/files/uploads/gnome_settings_user_unlock.png (GNOME user settings) +[7]: https://opensource.com/sites/default/files/uploads/gnome_settings_adding_user.png (GNOME settings - add user) +[8]: https://opensource.com/sites/default/files/uploads/gnome_settings_user_new.png (GNOME new user) +[9]: https://opensource.com/sites/default/files/uploads/kde_settings_adding_user.png (KDE settings - add user) From 99e95abae176c2052290d25365cde9426aedaa7a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 Nov 2019 00:57:16 +0800 Subject: [PATCH 367/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191107=20My=20f?= =?UTF-8?q?irst=20open=20source=20contribution:=20Keep=20the=20code=20rele?= =?UTF-8?q?vant?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191107 My first open source contribution- Keep the code relevant.md --- ...ce contribution- Keep the code relevant.md | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 sources/tech/20191107 My first open source contribution- Keep the code relevant.md diff --git a/sources/tech/20191107 My first open source contribution- Keep the code relevant.md b/sources/tech/20191107 My first open source contribution- Keep the code relevant.md new file mode 100644 index 0000000000..f435d2e10c --- /dev/null +++ b/sources/tech/20191107 My first open source contribution- Keep the code relevant.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My first open source contribution: Keep the code relevant) +[#]: via: (https://opensource.com/article/19/11/first-open-source-contribution-relevant-code) +[#]: author: (Galen Corey https://opensource.com/users/galenemco) + +My first open source contribution: Keep the code relevant +====== +Be aware of what development tools you have running in the background. +![Filing cabinet for organization][1] + +Previously, I explained [the importance of forking repositories][2]. Once I finished the actual "writing the code" part of making my first open source pull request, I felt excellent. It seemed like the hard part was finally over. What’s more, I felt great about the code that I wrote. + +One thing that I decided to do (which turned out to be an excellent choice) was to use [test-driven development][3] (TDD) to write the code. Using TDD was helpful because it gave me a place to start, and a way to know if what I was doing actually worked. Because my background was in building web apps, I rarely ran into the problem of writing code that didn’t have a tangible, visible output. The test-first approach helped me make the leap into working on a tool where you can’t evaluate your progress manually. The fact that I had written a clear test also helped me ultimately get my pull request accepted. The reviewer highlighted the test in his comments on my code. + +Another thing I felt great about was that I had accomplished the whole thing in around 20 lines of code. I know from experience that shorter pull requests are much easier to review. Such short pieces generally take less time, and the reviewer can concentrate on only the small number of lines that were changed. I hoped that this would increase my chances that one of the maintainers would look at my work and feel confident in it. + +Much to my surprise, when I finally pushed my branch to GitHub, the diff was showing that I had changed multiple lines of code. I ran into trouble here because I had become too comfortable with my usual development setup. Because I typically work on a single project, I barely think about some of the tools I have working in the background to make my life easier. The culprit here was [`prettier`][4], a code formatter that automatically fixes all of my minor spacing and syntax discrepancies when I save an edited file. In my usual workflow, this tool is extremely helpful. Most of the developers I work with have `prettier` installed, so all of the code that we write obeys the same style rules. + +In this new project, however, style rules had fallen by the wayside. The project did, in fact, contain an eslint config stating that single quotes should be used instead of double-quotes. However, the developers who were contributing to the project ignored this rule and used both single- and double-quotes. Unlike human beings, `prettier` never ignores the rules. While I was working, it took the initiative to turn every double quote in every file I changed to a single quote, causing hundreds of unintentional changes. + +I tried for a few minutes to remove these changes, but because they had been continually happening as I worked, they were embedded in all of my commits. Then the type-B in me took over and decided to leave the changes in. "Maybe this is not a big deal," I thought. "They said they wanted single quotes, after all." + +My mistake was including these unrelated changes in my PR. While I was technically right that this wasn’t a "big deal," the maintainer who reviewed my code asked me to revert the changes. My initial instinct, that keeping my pull request small and to the point, was correct. + +The lesson here is that you should keep your changes as minimal and to-the-point as possible. Be mindful of any tools you have that might apply to your normal workflow, but aren’t as useful if you are working on a new project. + +**Free idea:** If you are looking for a way to get an open source PR in without writing any code, pick a project that doesn’t adhere to its style guide, run `prettier` on it, and make the result your whole pull request. It’s not guaranteed that every project community will appreciate this, but it’s worth a shot. + +There are lots of non-code ways to contribute to open source: Here are three alternatives. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/first-open-source-contribution-relevant-code + +作者:[Galen Corey][a] +选题:[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/galenemco +[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://opensource.com/article/19/10/first-open-source-contribution-fork-clone +[3]: https://opensource.com/article/19/10/test-driven-development-best-practices +[4]: https://prettier.io/ From 7b3ce18020f1a135db82bb82d4e5bc69ba1968a5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 Nov 2019 01:00:20 +0800 Subject: [PATCH 368/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191107=20Demyst?= =?UTF-8?q?ifying=20Kubernetes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191107 Demystifying Kubernetes.md --- .../tech/20191107 Demystifying Kubernetes.md | 236 ++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 sources/tech/20191107 Demystifying Kubernetes.md diff --git a/sources/tech/20191107 Demystifying Kubernetes.md b/sources/tech/20191107 Demystifying Kubernetes.md new file mode 100644 index 0000000000..f92934b136 --- /dev/null +++ b/sources/tech/20191107 Demystifying Kubernetes.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Demystifying Kubernetes) +[#]: via: (https://opensourceforu.com/2019/11/demystifying-kubernetes/) +[#]: author: (Abhinav Nath Gupta https://opensourceforu.com/author/abhinav-gupta/) + +Demystifying Kubernetes +====== + +[![][1]][2] + +_Kubernetes is a production grade open source system for automating deployment, scaling, and the management of containerised applications. This article is about managing containers with Kubernetes._ + +‘Containers’ has become one of the latest buzz words. But what does the term imply? Often associated with Docker, a container is defined as a standardised unit of software. Containers encapsulate the software and the environment required to run the software into a single unit that is easily shippable. +A container is a standard unit of software that packages the code and all its dependencies so that the application runs quickly and reliably from one computing environment to another. The container does this by creating something called an image, which is akin to an ISO image. A container image is a lightweight, standalone, executable package of software that includes everything needed to run an application — code, runtime, system tools, system libraries and settings. + +Container images become containers at runtime and, in the case of Docker containers, images become containers when they run on a Docker engine. Containers isolate software from the environment and ensure that it works uniformly despite differences in instances across environments. + +**What is container management?** +Container management is the process of organising, adding or replacing large numbers of software containers. Container management uses software to automate the process of creating, deploying and scaling containers. This gives rise to the need for container orchestration—a tool that automates the deployment, management, scaling, networking and availability of container based applications. + +**Kubernetes** +Kubernetes is a portable, extensible, open source platform for managing containerised workloads and services, and it facilitates both configuration and automation. It was originally developed by Google. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available. + +Google open sourced the Kubernetes project in 2014. Kubernetes builds upon a decade and a half of experience that Google had with running production workloads at scale, combined with best-of-breed ideas and practices from the community, as well as the usage of declarative syntax. + +Some of the common terminologies associated with the Kubernetes ecosystem are listed below. +_**Pods:**_ A pod is the basic execution unit of a Kubernetes application – the smallest and simplest unit in the Kubernetes object model that you create or deploy. A pod represents processes running on a Kubernetes cluster. + +A pod encapsulates the running container, storage, network IP (unique) and commands that govern how the container should run. It represents the single unit of deployment within the Kubernetes ecosystem, a single instance of an application which might consist of one or many containers running with tight coupling and shared resources. + +Pods in a Kubernetes cluster can be used in two main ways. The first is pods that run a single container. The ‘one-container-per-pod’ model is the most common Kubernetes use case. The second method involves pods that run multiple containers that need to work together. + +A pod might encapsulate an application composed of multiple co-located containers that are tightly coupled and need to share resources. + +_**ReplicaSet:**_ The purpose of a ReplicaSet is to maintain a stable set of replica pods running at any given time. A ReplicaSet contains information about how many copies of a particular pod should be running. To create multiple pods to match the ReplicaSet criteria, Kubernetes uses the pod template. The link a ReplicaSet has to its pods is via the latter’s metadata.ownerReferences field, which specifies which resource owns the current object. + +_**Services:**_ Services are an abstraction to expose the functionality of a set of pods. With Kubernetes, you don’t need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives pods their own IP addresses and a single DNS name for a set of pods, and can load-balance across them. + +One major problem that services solve is the integration of the front-end and back-end of a Web application. Since Kubernetes provides IP addresses behind the scenes to pods, when the latter are killed and resurrected, the IP addresses are changed. This creates a big problem on the front-end side to connect a given back-end IP address to the corresponding front-end IP address. Services solve this problem by providing an abstraction over the pods — something akin to a load balancer. + +_**Volumes:**_ A Kubernetes volume has an explicit lifetime — the same as the pod that encloses it. Consequently, a volume outlives any container that runs within the pod and the data is preserved across container restarts. Of course, when a pod ceases to exist, the volume will cease to exist, too. Perhaps more important than this is that Kubernetes supports many types of volumes, and a pod can use any number of them simultaneously. + +At its core, a volume is just a directory, possibly with some data in it, which is accessible to the containers in a pod. How that directory comes to be, the medium that backs it and its contents are determined by the particular volume type used. + +**Why Kubernetes?** +Containers are a good way to bundle and run applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if one container goes down, another needs to start. Wouldn’t it be nice if this could be automated by a system? +That’s where Kubernetes comes to the rescue! It provides a framework to run distributed systems resiliently. It takes care of scaling requirements, failover, deployment patterns, and more. For example, Kubernetes can easily manage a canary deployment for your system. + +Kubernetes provides users with: +1\. Service discovery and load balancing +2\. Storage orchestration +3\. Automated roll-outs and roll-backs +4\. Automatic bin packing +5\. Self-healing +6\. Secret and configuration management + +**What can Kubernetes do?** +In this section we will look at some code examples of how to use Kubernetes when building a Web application from scratch. We will create a simple back-end server using Flask in Python. +There are a few prerequisites for those who want to build a Web app from scratch. These are: +1\. Basic understanding of Docker, Docker containers and Docker images. A quick refresher can be found at __. +2\. Docker should be installed in the system. +3\. Kubernetes should be installed in the system. Instructions on how to do so on a local machine can be found at __. +Now, create a simple directory, as shown in the code snippet below: + +``` +mkdir flask-kubernetes/app && cd flask-kubernetes/app +``` + +Next, inside the _flask-kubernetes/app_ directory, create a file called main.py, as shown in the code snippet below: + +``` +touch main.py +``` + +In the newly created _main.py,_ paste the following code: + +``` +from flask import Flask +app = Flask(__name__) + +@app.route("/") +def hello(): +return "Hello from Kubernetes!" + +if __name__ == "__main__": +app.run(host='0.0.0.0') +``` + +Install Flask in your local using the command below: + +``` +pip install Flask==0.10.1 +``` + +After installing Flask, run the following command: + +``` +python app.py +``` + +This should run the Flask server locally on port 5000, which is the default port for the Flask app, and you can see the output ‘Hello from Kubernetes!’ on *. +Once the server is running locally, we will create a Docker image to be used by Kubernetes. +Create a file with the name Dockerfile and paste the following code snippet in it: + +``` +FROM python:3.7 + +RUN mkdir /app +WORKDIR /app +ADD . /app/ +RUN pip install -r requirements.txt + +EXPOSE 5000 +CMD ["python", "/app/main.py"] +``` + +The instructions in _Dockerfile_ are explained below: + +1\. Docker will fetch the Python 3.7 image from the Docker hub. +2\. It will create an app directory in the image. +3\. It will set an app as the working directory. +4\. Copy the contents from the app directory in the host to the image app directory. +5\. Expose Port 5000. +6\. Finally, it will run the command to start the Flask server. +In the next step, we will create the Docker image, using the command given below: + +``` +docker build -f Dockerfile -t flask-kubernetes:latest . +``` + +After creating the Docker image, we can test it by running it locally using the following command: + +``` +docker run -p 5001:5000 flask-kubernetes +``` + +Once we are done testing it locally by running a container, we need to deploy this in Kubernetes. +We will first verify that Kubernetes is running using the _kubectl_ command. If there are no errors, then it is working. If there are errors, do refer to __. + +Next, let’s create a deployment file. This is a yaml file containing the instruction for Kubernetes about how to create pods and services in a very declarative fashion. Since we have a Flask Web application, we will create a _deployment.yaml_ file with both the pods and services declarations inside it. + +Create a file named deployment.yaml and add the following contents to it, before saving it: + +``` +apiVersion: v1 +kind: Service +metadata: +name: flask-kubernetes -service +spec: +selector: +app: flask-kubernetes +ports: +- protocol: "TCP" +port: 6000 +targetPort: 5000 +type: LoadBalancer + + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: +name: flask-kubernetes +spec: +replicas: 4 +template: +metadata: +labels: +app: flask-kubernetes +spec: +containers: +- name: flask-kubernetes +image: flask-kubernetes:latest +imagePullPolicy: Never +ports: +- containerPort: 5000 +``` + +Use _kubectl_ to send the _yaml_ file to Kubernetes by running the following command: + +``` +kubectl apply -f deployment.yaml +``` + +You can see the pods are running if you execute the following command: + +``` +kubectl get pods +``` + +Now navigate to __, and you should see the ‘Hello from Kubernetes!’ message. +That’s it! The application is now running in Kubernetes! + +**What Kubernetes cannot do** +Kubernetes is not a traditional, all-inclusive PaaS (Platform as a Service) system. Since Kubernetes operates at the container level rather than at the hardware level, it provides some generally applicable features common to PaaS offerings, such as deployment, scaling, load balancing, logging, and monitoring. Kubernetes provides the building blocks for developer platforms, but preserves user choice and flexibility where it is important. + + * Kubernetes does not limit the types of applications supported. If an application can run in a container, it should run great on Kubernetes. + * It does not deploy and build source code. + * It does not dictate logging, monitoring, or alerting solutions. + * It does not provide or mandate a configuration language/system. It provides a declarative API for everyone’s use. + * It does not provide or adopt any comprehensive machine configuration, maintenance, management, or self-healing systems. + + + +![Avatar][3] + +[Abhinav Nath Gupta][4] + +The author is a software development engineer at Cleo Software India Pvt Ltd, Bengaluru. He is interested in cryptography, data security, cryptocurrency and cloud computing. He can be reached at [abhi.aec89@gmail.com][5]. + +[![][6]][7] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/demystifying-kubernetes/ + +作者:[Abhinav Nath Gupta][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/abhinav-gupta/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?resize=696%2C457&ssl=1 (Gear kubernetes) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?fit=800%2C525&ssl=1 +[3]: https://secure.gravatar.com/avatar/f65917facf5f28936663731fedf545c4?s=100&r=g +[4]: https://opensourceforu.com/author/abhinav-gupta/ +[5]: mailto:abhi.aec89@gmail.com +[6]: http://opensourceforu.com/wp-content/uploads/2013/10/assoc.png +[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 0eebb9efbd5c835276ba3d13de854128278777d8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 8 Nov 2019 01:04:07 +0800 Subject: [PATCH 369/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191106=20How=20?= =?UTF-8?q?Much=20of=20a=20Genius-Level=20Move=20Was=20Using=20Binary=20Sp?= =?UTF-8?q?ace=20Partitioning=20in=20Doom=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191106 How Much of a Genius-Level Move Was Using Binary Space Partitioning in Doom.md --- ...Using Binary Space Partitioning in Doom.md | 173 ++++++++++++++++++ 1 file changed, 173 insertions(+) create mode 100644 sources/talk/20191106 How Much of a Genius-Level Move Was Using Binary Space Partitioning in Doom.md diff --git a/sources/talk/20191106 How Much of a Genius-Level Move Was Using Binary Space Partitioning in Doom.md b/sources/talk/20191106 How Much of a Genius-Level Move Was Using Binary Space Partitioning in Doom.md new file mode 100644 index 0000000000..3bea7df831 --- /dev/null +++ b/sources/talk/20191106 How Much of a Genius-Level Move Was Using Binary Space Partitioning in Doom.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Much of a Genius-Level Move Was Using Binary Space Partitioning in Doom?) +[#]: via: (https://twobithistory.org/2019/11/06/doom-bsp.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +How Much of a Genius-Level Move Was Using Binary Space Partitioning in Doom? +====== + +In 1993, id Software released the first-person shooter _Doom_, which quickly became a phenomenon. The game is now considered one of the most influential games of all time. + +A decade after _Doom_’s release, in 2003, journalist David Kushner published a book about id Software called _Masters of Doom_, which has since become the canonical account of _Doom_’s creation. I read _Masters of Doom_ a few years ago and don’t remember much of it now, but there was one story in the book about lead programmer John Carmack that has stuck with me. This is a loose gloss of the story (see below for the full details), but essentially, early in the development of _Doom_, Carmack realized that the 3D renderer he had written for the game slowed to a crawl when trying to render certain levels. This was unacceptable, because _Doom_ was supposed to be action-packed and frenetic. So Carmack, realizing the problem with his renderer was fundamental enough that he would need to find a better rendering algorithm, starting reading research papers. He eventually implemented a technique called “binary space partitioning,” never before used in a video game, that dramatically sped up the _Doom_ engine. + +That story about Carmack applying cutting-edge academic research to video games has always impressed me. It is my explanation for why Carmack has become such a legendary figure. He deserves to be known as the archetypal genius video game programmer for all sorts of reasons, but this episode with the academic papers and the binary space partitioning is the justification I think of first. + +Obviously, the story is impressive because “binary space partitioning” sounds like it would be a difficult thing to just read about and implement yourself. I’ve long assumed that what Carmack did was a clever intellectual leap, but because I’ve never understood what binary space partitioning is or how novel a technique it was when Carmack decided to use it, I’ve never known for sure. On a spectrum from Homer Simpson to Albert Einstein, how much of a genius-level move was it really for Carmack to add binary space partitioning to _Doom_? + +I’ve also wondered where binary space partitioning first came from and how the idea found its way to Carmack. So this post is about John Carmack and _Doom_, but it is also about the history of a data structure: the binary space partitioning tree (or BSP tree). It turns out that the BSP tree, rather interestingly, and like so many things in computer science, has its origins in research conducted for the military. + +That’s right: E1M1, the first level of _Doom_, was brought to you by the US Air Force. + +### The VSD Problem + +The BSP tree is a solution to one of the thorniest problems in computer graphics. In order to render a three-dimensional scene, a renderer has to figure out, given a particular viewpoint, what can be seen and what cannot be seen. This is not especially challenging if you have lots of time, but a respectable real-time game engine needs to figure out what can be seen and what cannot be seen at least 30 times a second. + +This problem is sometimes called the problem of visible surface determination. Michael Abrash, a programmer who worked with Carmack on _Quake_ (id Software’s follow-up to _Doom_), wrote about the VSD problem in his famous _Graphics Programming Black Book_: + +> I want to talk about what is, in my opinion, the toughest 3-D problem of all: visible surface determination (drawing the proper surface at each pixel), and its close relative, culling (discarding non-visible polygons as quickly as possible, a way of accelerating visible surface determination). In the interests of brevity, I’ll use the abbreviation VSD to mean both visible surface determination and culling from now on. + +> Why do I think VSD is the toughest 3-D challenge? Although rasterization issues such as texture mapping are fascinating and important, they are tasks of relatively finite scope, and are being moved into hardware as 3-D accelerators appear; also, they only scale with increases in screen resolution, which are relatively modest. + +> In contrast, VSD is an open-ended problem, and there are dozens of approaches currently in use. Even more significantly, the performance of VSD, done in an unsophisticated fashion, scales directly with scene complexity, which tends to increase as a square or cube function, so this very rapidly becomes the limiting factor in rendering realistic worlds.[1][1] + +Abrash was writing about the difficulty of the VSD problem in the late ’90s, years after _Doom_ had proved that regular people wanted to be able to play graphically intensive games on their home computers. In the early ’90s, when id Software first began publishing games, the games had to be programmed to run efficiently on computers not designed to run them, computers meant for word processing, spreadsheet applications, and little else. To make this work, especially for the few 3D games that id Software published before _Doom_, id Software had to be creative. In these games, the design of all the levels was constrained in such a way that the VSD problem was easier to solve. + +For example, in _Wolfenstein 3D_, the game id Software released just prior to _Doom_, every level is made from walls that are axis-aligned. In other words, in the Wolfenstein universe, you can have north-south walls or west-east walls, but nothing else. Walls can also only be placed at fixed intervals on a grid—all hallways are either one grid square wide, or two grid squares wide, etc., but never 2.5 grid squares wide. Though this meant that the id Software team could only design levels that all looked somewhat the same, it made Carmack’s job of writing a renderer for _Wolfenstein_ much simpler. + +The _Wolfenstein_ renderer solved the VSD problem by “marching” rays into the virtual world from the screen. Usually a renderer that uses rays is a “raycasting” renderer—these renderers are often slow, because solving the VSD problem in a raycaster involves finding the first intersection between a ray and something in your world, which in the general case requires lots of number crunching. But in _Wolfenstein_, because all the walls are aligned with the grid, the only location a ray can possibly intersect a wall is at the grid lines. So all the renderer needs to do is check each of those intersection points. If the renderer starts by checking the intersection point nearest to the player’s viewpoint, then checks the next nearest, and so on, and stops when it encounters the first wall, the VSD problem has been solved in an almost trivial way. A ray is just marched forward from each pixel until it hits something, which works because the marching is so cheap in terms of CPU cycles. And actually, since all walls are the same height, it is only necessary to march a single ray for every _column_ of pixels. + +This rendering shortcut made _Wolfenstein_ fast enough to run on underpowered home PCs in the era before dedicated graphics cards. But this approach would not work for _Doom_, since the id team had decided that their new game would feature novel things like diagonal walls, stairs, and ceilings of different heights. Ray marching was no longer viable, so Carmack wrote a different kind of renderer. Whereas the _Wolfenstein_ renderer, with its ray for every column of pixels, is an “image-first” renderer, the _Doom_ renderer is an “object-first” renderer. This means that rather than iterating through the pixels on screen and figuring out what color they should be, the _Doom_ renderer iterates through the objects in a scene and projects each onto the screen in turn. + +In an object-first renderer, one easy way to solve the VSD problem is to use a z-buffer. Each time you project an object onto the screen, for each pixel you want to draw to, you do a check. If the part of the object you want to draw is closer to the player than what was already drawn to the pixel, then you can overwrite what is there. Otherwise you have to leave the pixel as is. This approach is simple, but a z-buffer requires a lot of memory, and the renderer may still expend a lot of CPU cycles projecting level geometry that is never going to be seen by the player. + +In the early 1990s, there was an additional drawback to the z-buffer approach: On IBM-compatible PCs, which used a video adapter system called VGA, writing to the output frame buffer was an expensive operation. So time spent drawing pixels that would only get overwritten later tanked the performance of your renderer. + +Since writing to the frame buffer was so expensive, the ideal renderer was one that started by drawing the objects closest to the player, then the objects just beyond those objects, and so on, until every pixel on screen had been written to. At that point the renderer would know to stop, saving all the time it might have spent considering far-away objects that the player cannot see. But ordering the objects in a scene this way, from closest to farthest, is tantamount to solving the VSD problem. Once again, the question is: What can be seen by the player? + +Initially, Carmack tried to solve this problem by relying on the layout of _Doom_’s levels. His renderer started by drawing the walls of the room currently occupied by the player, then flooded out into neighboring rooms to draw the walls in those rooms that could be seen from the current room. Provided that every room was convex, this solved the VSD issue. Rooms that were not convex could be split into convex “sectors.” You can see how this rendering technique might have looked if run at extra-slow speed [in this video][2], where YouTuber Bisqwit demonstrates a renderer of his own that works according to the same general algorithm. This algorithm was successfully used in Duke Nukem 3D, released three years after _Doom_, when CPUs were more powerful. But, in 1993, running on the hardware then available, the _Doom_ renderer that used this algorithm struggled with complicated levels—particularly when sectors were nested inside of each other, which was the only way to create something like a circular pit of stairs. A circular pit of stairs led to lots of repeated recursive descents into a sector that had already been drawn, strangling the game engine’s speed. + +Around the time that the id team realized that the _Doom_ game engine might be too slow, id Software was asked to port _Wolfenstein 3D_ to the Super Nintendo. The Super Nintendo was even less powerful than the IBM-compatible PCs of the day, and it turned out that the ray-marching _Wolfenstein_ renderer, simple as it was, didn’t run fast enough on the Super Nintendo hardware. So Carmack began looking for a better algorithm. It was actually for the Super Nintendo port of _Wolfenstein_ that Carmack first researched and implemented binary space partitioning. In _Wolfenstein_, this was relatively straightforward because all the walls were axis-aligned; in _Doom_, it would be more complex. But Carmack realized that BSP trees would solve _Doom_’s speed problems too. + +### Binary Space Partitioning + +Binary space partitioning makes the VSD problem easier to solve by splitting a 3D scene into parts ahead of time. For now, you just need to grasp why splitting a scene is useful: If you draw a line (really a plane in 3D) across your scene, and you know which side of the line the player or camera viewpoint is on, then you also know that nothing on the other side of the line can obstruct something on the viewpoint’s side of the line. If you repeat this process many times, you end up with a 3D scene split into many sections, which wouldn’t be an improvement on the original scene except now you know more about how different parts of the scene can obstruct each other. + +The first people to write about dividing a 3D scene like this were researchers trying to establish for the US Air Force whether computer graphics were sufficiently advanced to use in flight simulators. They released their findings in a 1969 report called “Study for Applying Computer-Generated Images to Visual Simulation.” The report concluded that computer graphics could be used to train pilots, but also warned that the implementation would be complicated by the VSD problem: + +> One of the most significant problems that must be faced in the real-time computation of images is the priority, or hidden-line, problem. In our everyday visual perception of our surroundings, it is a problem that nature solves with trivial east; a point of an opaque object obscures all other points that lie along the same line of sight and are more distant. In the computer, the task is formidable. The computations required to resolve priority in the general case grow exponentially with the complexity of the environment, and soon they surpass the computing load associated with finding the perspective images of the objects.[2][3] + +One solution these researchers mention, which according to them was earlier used in a project for NASA, is based on creating what I am going to call an “occlusion matrix.” The researchers point out that a plane dividing a scene in two can be used to resolve “any priority conflict” between objects on opposite sides of the plane. In general you might have to add these planes explicitly to your scene, but with certain kinds of geometry you can just rely on the faces of the objects you already have. They give the example in the figure below, where (p_1), (p_2), and (p_3) are the separating planes. If the camera viewpoint is on the forward or “true” side of one of these planes, then (p_i) evaluates to 1. The matrix shows the relationships between the three objects based on the three dividing planes and the location of the camera viewpoint—if object (a_i) obscures object (a_j), then entry (a_{ij}) in the matrix will be a 1. + +![][4] + +The researchers propose that this matrix could be implemented in hardware and re-evaluated every frame. Basically the matrix would act as a big switch or a kind of pre-built z-buffer. When drawing a given object, no video would be output for the parts of the object when a 1 exists in the object’s column and the corresponding row object is also being drawn. + +The major drawback with this matrix approach is that to represent a scene with (n) objects you need a matrix of size (n^2). So the researchers go on to explore whether it would be feasible to represent the occlusion matrix as a “priority list” instead, which would only be of size (n) and would establish an order in which objects should be drawn. They immediately note that for certain scenes like the one in the figure above no ordering can be made (since there is an occlusion cycle), so they spend a lot of time laying out the mathematical distinction between “proper” and “improper” scenes. Eventually they conclude that, at least for “proper” scenes—and it should be easy enough for a scene designer to avoid “improper” cases—a priority list could be generated. But they leave the list generation as an exercise for the reader. It seems the primary contribution of this 1969 study was to point out that it should be possible to use partitioning planes to order objects in a scene for rendering, at least _in theory_. + +It was not until 1980 that a paper, titled “On Visible Surface Generation by A Priori Tree Structures,” demonstrated a concrete algorithm to accomplish this. The 1980 paper, written by Henry Fuchs, Zvi Kedem, and Bruce Naylor, introduced the BSP tree. The authors say that their novel data structure is “an alternative solution to an approach first utilized a decade ago but due to a few difficulties, not widely exploited”—here referring to the approach taken in the 1969 Air Force study.[3][5] A BSP tree, once constructed, can easily be used to provide a priority ordering for objects in the scene. + +Fuchs, Kedem, and Naylor give a pretty readable explanation of how a BSP tree works, but let me see if I can provide a less formal but more concise one. + +You begin by picking one polygon in your scene and making the plane in which the polygon lies your partitioning plane. That one polygon also ends up as the root node in your tree. The remaining polygons in your scene will be on one side or the other of your root partitioning plane. The polygons on the “forward” side or in the “forward” half-space of your plane end in up in the left subtree of your root node, while the polygons on the “back” side or in the “back” half-space of your plane end up in the right subtree. You then repeat this process recursively, picking a polygon from your left and right subtrees to be the new partitioning planes for their respective half-spaces, which generates further half-spaces and further sub-trees. You stop when you run out of polygons. + +Say you want to render the geometry in your scene from back-to-front. (This is known as the “painter’s algorithm,” since it means that polygons further from the camera will get drawn over by polygons closer to the camera, producing a correct rendering.) To achieve this, all you have to do is an in-order traversal of the BSP tree, where the decision to render the left or right subtree of any node first is determined by whether the camera viewpoint is in either the forward or back half-space relative to the partitioning plane associated with the node. So at each node in the tree, you render all the polygons on the “far” side of the plane first, then the polygon in the partitioning plane, then all the polygons on the “near” side of the plane—”far” and “near” being relative to the camera viewpoint. This solves the VSD problem because, as we learned several paragraphs back, the polygons on the far side of the partitioning plane cannot obstruct anything on the near side. + +The following diagram shows the construction and traversal of a BSP tree representing a simple 2D scene. In 2D, the partitioning planes are instead partitioning lines, but the basic idea is the same in a more complicated 3D scene. + +![][6] _Step One: The root partitioning line along wall D splits the remaining geometry into two sets._ + +![][7] _Step Two: The half-spaces on either side of D are split again. Wall C is the only wall in its half-space so no split is needed. Wall B forms the new partitioning line in its half-space. Wall A must be split into two walls since it crosses the partitioning line._ + +![][8] _A back-to-front ordering of the walls relative to the viewpoint in the top-right corner, useful for implementing the painter’s algorithm. This is just an in-order traversal of the tree._ + +The really neat thing about a BSP tree, which Fuchs, Kedem, and Naylor stress several times, is that it only has to be constructed once. This is somewhat surprising, but the same BSP tree can be used to render a scene no matter where the camera viewpoint is. The BSP tree remains valid as long as the polygons in the scene don’t move. This is why the BSP tree is so useful for real-time rendering—all the hard work that goes into constructing the tree can be done beforehand rather than during rendering. + +One issue that Fuchs, Kedem, and Naylor say needs further exploration is the question of what makes a “good” BSP tree. The quality of your BSP tree will depend on which polygons you decide to use to establish your partitioning planes. I skipped over this earlier, but if you partition using a plane that intersects other polygons, then in order for the BSP algorithm to work, you have to split the intersected polygons in two, so that one part can go in one half-space and the other part in the other half-space. If this happens a lot, then building a BSP tree will dramatically increase the number of polygons in your scene. + +Bruce Naylor, one of the authors of the 1980 paper, would later write about this problem in his 1993 paper, “Constructing Good Partitioning Trees.” According to John Romero, one of Carmack’s fellow id Software co-founders, this paper was one of the papers that Carmack read when he was trying to implement BSP trees in _Doom_.[4][9] + +### BSP Trees in Doom + +Remember that, in his first draft of the _Doom_ renderer, Carmack had been trying to establish a rendering order for level geometry by “flooding” the renderer out from the player’s current room into neighboring rooms. BSP trees were a better way to establish this ordering because they avoided the issue where the renderer found itself visiting the same room (or sector) multiple times, wasting CPU cycles. + +“Adding BSP trees to _Doom_” meant, in practice, adding a BSP tree generator to the _Doom_ level editor. When a level in _Doom_ was complete, a BSP tree was generated from the level geometry. According to Fabien Sanglard, the generation process could take as long as eight seconds for a single level and 11 minutes for all the levels in the original _Doom_.[5][10] The generation process was lengthy in part because Carmack’s BSP generation algorithm tries to search for a “good” BSP tree using various heuristics. An eight-second delay would have been unforgivable at runtime, but it was not long to wait when done offline, especially considering the performance gains the BSP trees brought to the renderer. The generated BSP tree for a single level would have then ended up as part of the level data loaded into the game when it starts. + +Carmack put a spin on the BSP tree algorithm outlined in the 1980 paper, because once _Doom_ is started and the BSP tree for the current level is read into memory, the renderer uses the BSP tree to draw objects front-to-back rather than back-to-front. In the 1980 paper, Fuchs, Kedem, and Naylor show how a BSP tree can be used to implement the back-to-front painter’s algorithm, but the painter’s algorithm involves a lot of over-drawing that would have been expensive on an IBM-compatible PC. So the _Doom_ renderer instead starts with the geometry closer to the player, draws that first, then draws the geometry farther away. This reverse ordering is easy to achieve using a BSP tree, since you can just make the opposite traversal decision at each node in the tree. To ensure that the farther-away geometry is not drawn over the closer geometry, the _Doom_ renderer uses a kind of implicit z-buffer that provides much of the benefit of a z-buffer with a much smaller memory footprint. There is one array that keeps track of occlusion in the horizontal dimension, and another two arrays that keep track of occlusion in the vertical dimension from the top and bottom of the screen. The _Doom_ renderer can get away with not using an actual z-buffer because _Doom_ is not technically a fully 3D game. The cheaper data structures work because certain things never appear in _Doom_: The horizontal occlusion array works because there are no sloping walls, and the vertical occlusion arrays work because no walls have, say, two windows, one above the other. + +The only other tricky issue left is how to incorporate _Doom_’s moving characters into the static level geometry drawn with the aid of the BSP tree. The enemies in _Doom_ cannot be a part of the BSP tree because they move; the BSP tree only works for geometry that never moves. So the _Doom_ renderer draws the static level geometry first, keeping track of the segments of the screen that were drawn to (with yet another memory-efficient data structure). It then draws the enemies in back-to-front order, clipping them against the segments of the screen that occlude them. This process is not as optimal as rendering using the BSP tree, but because there are usually fewer enemies visible then there is level geometry in a level, speed isn’t as much of an issue here. + +Using BSP trees in _Doom_ was a major win. Obviously it is pretty neat that Carmack was able to figure out that BSP trees were the perfect solution to his problem. But was it a _genius_-level move? + +In his excellent book about the _Doom_ game engine, Fabien Sanglard quotes John Romero saying that Bruce Naylor’s paper, “Constructing Good Partitioning Trees,” was mostly about using BSP trees to cull backfaces from 3D models.[6][11] According to Romero, Carmack thought the algorithm could still be useful for _Doom_, so he went ahead and implemented it. This description is quite flattering to Carmack—it implies he saw that BSP trees could be useful for real-time video games when other people were still using the technique to render static scenes. There is a similarly flattering story in _Masters of Doom_: Kushner suggests that Carmack read Naylor’s paper and asked himself, “what if you could use a BSP to create not just one 3D image but an entire virtual world?”[7][12] + +This framing ignores the history of the BSP tree. When those US Air Force researchers first realized that partitioning a scene might help speed up rendering, they were interested in speeding up _real-time_ rendering, because they were, after all, trying to create a flight simulator. The flight simulator example comes up again in the 1980 BSP paper. Fuchs, Kedem, and Naylor talk about how a BSP tree would be useful in a flight simulator that pilots use to practice landing at the same airport over and over again. Since the airport geometry never changes, the BSP tree can be generated just once. Clearly what they have in mind is a real-time simulation. In the introduction to their paper, they even motivate their research by talking about how real-time graphics systems must be able to create an image in at least 1/30th of a second. + +So Carmack was not the first person to think of using BSP trees in a real-time graphics simulation. Of course, it’s one thing to anticipate that BSP trees might be used this way and another thing to actually do it. But even in the implementation Carmack may have had more guidance than is commonly assumed. The [Wikipedia page about BSP trees][13], at least as of this writing, suggests that Carmack consulted a 1991 paper by Chen and Gordon as well as a 1990 textbook called _Computer Graphics: Principles and Practice_. Though no citation is provided for this claim, it is probably true. The 1991 Chen and Gordon paper outlines a front-to-back rendering approach using BSP trees that is basically the same approach taken by _Doom_, right down to what I’ve called the “implicit z-buffer” data structure that prevents farther polygons being drawn over nearer polygons. The textbook provides a great overview of BSP trees and some pseudocode both for building a tree and for displaying one. (I’ve been able to skim through the 1990 edition thanks to my wonderful university library.) _Computer Graphics: Principles and Practice_ is a classic text in computer graphics, so Carmack might well have owned it. + +Still, Carmack found himself faced with a novel problem—”How can we make a first-person shooter run on a computer with a CPU that can’t even do floating-point operations?”—did his research, and proved that BSP trees are a useful data structure for real-time video games. I still think that is an impressive feat, even if the BSP tree had first been invented a decade prior and was pretty well theorized by the time Carmack read about it. Perhaps the accomplishment that we should really celebrate is the _Doom_ game engine as a whole, which is a seriously nifty piece of work. I’ve mentioned it once already, but Fabien Sanglard’s book about the _Doom_ game engine (_Game Engine Black Book: DOOM_) is an excellent overview of all the different clever components of the game engine and how they fit together. We shouldn’t forget that the VSD problem was just one of many problems that Carmack had to solve to make the _Doom_ engine work. That he was able, on top of everything else, to read about and implement a complicated data structure unknown to most programmers speaks volumes about his technical expertise and his drive to perfect his craft. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][14] on Twitter or subscribe to the [RSS feed][15] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> I've wanted to learn more about GNU Readline for a while, so I thought I'd turn that into a new blog post. Includes a few fun facts from an email exchange with Chet Ramey, who maintains Readline (and Bash): +> +> — TwoBitHistory (@TwoBitHistory) [August 22, 2019][16] + + 1. Michael Abrash, “Michael Abrash’s Graphics Programming Black Book,” James Gregory, accessed November 6, 2019, . [↩︎][17] + + 2. R. Schumacher, B. Brand, M. Gilliland, W. Sharp, “Study for Applying Computer-Generated Images to Visual Simulation,” Air Force Human Resources Laboratory, December 1969, accessed on November 6, 2019, . [↩︎][18] + + 3. Henry Fuchs, Zvi Kedem, Bruce Naylor, “On Visible Surface Generation By A Priori Tree Structures,” ACM SIGGRAPH Computer Graphics, July 1980. [↩︎][19] + + 4. Fabien Sanglard, Game Engine Black Book: DOOM (CreateSpace Independent Publishing Platform, 2018), 200. [↩︎][20] + + 5. Sanglard, 206. [↩︎][21] + + 6. Sanglard, 200. [↩︎][22] + + 7. David Kushner, Masters of Doom (Random House Trade Paperbacks, 2004), 142. [↩︎][23] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2019/11/06/doom-bsp.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]: tmp.BANyYeM4Vm#fn:1 +[2]: https://youtu.be/HQYsFshbkYw?t=822 +[3]: tmp.BANyYeM4Vm#fn:2 +[4]: https://twobithistory.org/images/matrix_figure.png +[5]: tmp.BANyYeM4Vm#fn:3 +[6]: https://twobithistory.org/images/bsp.svg +[7]: https://twobithistory.org/images/bsp1.svg +[8]: https://twobithistory.org/images/bsp2.svg +[9]: tmp.BANyYeM4Vm#fn:4 +[10]: tmp.BANyYeM4Vm#fn:5 +[11]: tmp.BANyYeM4Vm#fn:6 +[12]: tmp.BANyYeM4Vm#fn:7 +[13]: https://en.wikipedia.org/wiki/Binary_space_partitioning +[14]: https://twitter.com/TwoBitHistory +[15]: https://twobithistory.org/feed.xml +[16]: https://twitter.com/TwoBitHistory/status/1164631020353859585?ref_src=twsrc%5Etfw +[17]: tmp.BANyYeM4Vm#fnref:1 +[18]: tmp.BANyYeM4Vm#fnref:2 +[19]: tmp.BANyYeM4Vm#fnref:3 +[20]: tmp.BANyYeM4Vm#fnref:4 +[21]: tmp.BANyYeM4Vm#fnref:5 +[22]: tmp.BANyYeM4Vm#fnref:6 +[23]: tmp.BANyYeM4Vm#fnref:7 From 94b78f3efe46c2ea2327a90da644b9fbed7b1183 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 07:57:22 +0800 Subject: [PATCH 370/800] PRF @geekpi --- ...hortcuts to Speed Up Your Work in Linux.md | 92 ++++++++++--------- 1 file changed, 48 insertions(+), 44 deletions(-) diff --git a/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md index 4cf8e01b45..5583bf48b1 100644 --- a/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md +++ b/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Keyboard Shortcuts to Speed Up Your Work in Linux) @@ -10,74 +10,78 @@ 在 Linux 中加速工作的键盘快捷键 ====== -[![Google Keyboard][1]][2] +![Google Keyboard][2] -_操作鼠标、键盘和菜单会占用我们很多时间,这些可以使用键盘快捷键来节省时间。这不仅节省时间,还可以使用户更高效。_ +> 操作鼠标、键盘和菜单会占用我们很多时间,这些可以使用键盘快捷键来节省时间。这不仅节省时间,还可以使用户更高效。 -你是否意识到每次在打字时从键盘切换到鼠标最多需要两秒钟?如果一个人每天工作八小时,每分钟从键盘切换到鼠标一次,并且一年中大约有 240 个工作日,那么所浪费的时间(根据 Brainscape 的计算)为: -_ [每分钟浪费 2 秒] x [每天 480 分钟] x每年 240 个工作日=每年浪费 64 小时_ -这相当于损失了八个工作日,因此学习键盘快捷键将使生产率提高 3.3%(__)。 +你是否意识到每次在打字时从键盘切换到鼠标需要多达两秒钟?如果一个人每天工作八小时,每分钟从键盘切换到鼠标一次,并且一年中大约有 240 个工作日,那么所浪费的时间(根据 Brainscape 的计算)为: +[每分钟浪费 2 秒] x [每天 480 分钟] x 每年 240 个工作日 = 每年浪费 64 小时 +这相当于损失了八个工作日,因此学习键盘快捷键将使生产率提高 3.3%()。 键盘快捷键提供了一种更快的方式来执行任务,不然就需要使用鼠标和/或菜单分多个步骤来完成。图 1 列出了 Ubuntu 18.04 Linux 和 Web 浏览器中一些最常用的快捷方式。我省略了非常有名的快捷方式,例如复制、粘贴等,以及不经常使用的快捷方式。读者可以参考在线资源以获得完整的快捷方式列表。请注意,Windows 键在 Linux 中被重命名为 Super 键。 -**常规快捷方式** +### 常规快捷方式 + 下面列出了常规快捷方式。 -[![][3]][4] -**打印屏幕和屏幕录像** +![][4] + +### 打印屏幕和屏幕录像 + 以下快捷方式可用于打印屏幕或录制屏幕视频。 -[![][5]][6] -**在应用之间切换** + +![][6] + +### 在应用之间切换 + 此处列出的快捷键可用于在应用之间切换。 -[![][7]][8] -**平铺窗口** +![][8] + +### 平铺窗口 + 可以使用下面提供的快捷方式以不同方式将窗口平铺。 -[![][9]][10] +![][10] + +### 浏览器快捷方式 -**浏览器快捷方式** 此处列出了浏览器最常用的快捷方式。大多数快捷键对于 Chrome/Firefox 浏览器是通用的。 **组合键** | **行为** ---|--- +`Ctrl + T` | 打开一个新标签。 +`Ctrl + Shift + T` | 打开最近关闭的标签。 +`Ctrl + D` | 添加一个新书签。 +`Ctrl + W` | 关闭浏览器标签。 +`Alt + D` | 将光标置于浏览器的地址栏中。 +`F5 或 Ctrl-R` | 刷新页面。 +`Ctrl + Shift + Del` | 清除私人数据和历史记录。 +`Ctrl + N` | 打开一个新窗口。 +`Home` | 滚动到页面顶部。 +`End` | 滚动到页面底部。 +`Ctrl + J` | 打开下载文件夹(在 Chrome 中) +`F11` | 全屏视图(切换效果) -Ctrl + T | 打开一个新标签。 -Ctrl + Shift + T | 打开最近关闭的标签。 -Ctrl + D | 添加一个新书签。 -Ctrl + W | 关闭浏览器标签。 -Alt + D | 将光标置于浏览器的地址栏中。 -F5 或 Ctrl-R | 刷新页面。 -Ctrl + Shift + Del | 清除私人数据和历史记录。 -Ctrl + N | 打开一个新窗口。 -Home| 滚动到页面顶部。 -End | 滚动到页面底部。 -Ctrl + J | 打开下载文件夹(在Chrome中) -F11 | 全屏视图(切换效果) +### 终端快捷方式 -**终端快捷方式** 这是终端快捷方式的列表。 -[![][11]][12] + +![][12] + 你还可以在 Ubuntu 中配置自己的自定义快捷方式,如下所示: - - * 在 Ubuntu Dash 中单击设置。 -  * 在“设置”窗口的左侧菜单中选择“设备”选项卡。 -  * 在设备菜单中选择键盘标签。 -  * 右面板的底部有个 “+” 按钮。点击 “+” 号打开自定义快捷方式对话框并配置新的快捷方式。 - - +* 在 Ubuntu Dash 中单击设置。 +* 在“设置”窗口的左侧菜单中选择“设备”选项卡。 +* 在设备菜单中选择键盘标签。 +* 右面板的底部有个 “+” 按钮。点击 “+” 号打开自定义快捷方式对话框并配置新的快捷方式。 学习本文提到的三个快捷方式可以节省大量时间,并使你的工作效率更高。 -**引用** -_Cohen, Andrew. How keyboard shortcuts could revive America’s economy; [www.brainscape.com][13]. [Online] Brainscape, 26 May 2017; _ +### 引用 -![Avatar][14] - -[S Sathyanarayanan][15] - -作者目前在斯里萨蒂亚赛古尔巴加人类卓越大学工作。他在系统管理和 IT 课程教学方面拥有 25 年以上的经验。他是 FOSS 的积极推动者,可以通过 [sathyanarayanan.brn@gmail.com][16] 与他联系。 +Cohen, Andrew. How keyboard shortcuts could revive America’s economy; www.brainscape.com. [Online] Brainscape, 26 May 2017; + -------------------------------------------------------------------------------- @@ -86,7 +90,7 @@ via: https://opensourceforu.com/2019/11/keyboard-shortcuts-to-speed-up-your-work 作者:[S Sathyanarayanan][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 8dff5a3c507f428af30429bf74e5fa7603ffb9ca Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 07:59:20 +0800 Subject: [PATCH 371/800] PUB @geekpi https://linux.cn/article-11549-1.html --- ...91101 Keyboard Shortcuts to Speed Up Your Work in Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md (98%) diff --git a/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/published/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md similarity index 98% rename from translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md rename to published/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md index 5583bf48b1..e7b0bf62e0 100644 --- a/translated/tech/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md +++ b/published/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11549-1.html) [#]: subject: (Keyboard Shortcuts to Speed Up Your Work in Linux) [#]: via: (https://opensourceforu.com/2019/11/keyboard-shortcuts-to-speed-up-your-work-in-linux/) [#]: author: (S Sathyanarayanan https://opensourceforu.com/author/s-sathyanarayanan/) From 5988c17bf19a3e72b8fbc56b148cef2e721ea96f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 08:27:59 +0800 Subject: [PATCH 372/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Morisun029 应该多做检查和润色 --- ...edora Linux System -Beginner-s Tutorial.md | 55 +++++++++---------- 1 file changed, 25 insertions(+), 30 deletions(-) diff --git a/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md b/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md index e6dd96aced..ff6ef1e45a 100644 --- a/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md +++ b/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md @@ -1,84 +1,79 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How To Update a Fedora Linux System [Beginner’s Tutorial]) [#]: via: (https://itsfoss.com/update-fedora/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -如何更新 Fedora Linux 系统[入门教程] +初级:如何更新 Fedora Linux 系统 ====== -_**本快速教程介绍了更新 Fedora Linux 安装的多种方法。**_ - +> 本快速教程介绍了更新 Fedora Linux 安装的多种方法。 前几天,我安装了[新发布的 Fedora 31][1]。老实说,这是我第一次使用[非 Ubuntu 发行版][2]。 -安装 Fedora 之后,我做的第一件事就是尝试安装一些软件。 我打开软件中心,发现该软件中心已“损坏”。 我无法从中安装任何应用程序。 +安装 Fedora 之后,我做的第一件事就是尝试安装一些软件。我打开软件中心,发现该软件中心已“损坏”。 我无法从中安装任何应用程序。 -我不确定我的安装出了什么问题。 在团队内部讨论时,Abhishek 建议我先更新系统。 我更新了, 更新后一切恢复正常。 更新[Fedora][3]系统后,软件中心也能正常工作了。 +我不确定我的系统出了什么问题。在团队内部讨论时,Abhishek 建议我先更新系统。我更新了,更新后一切恢复正常。更新 [Fedora][3] 系统后,软件中心也能正常工作了。 -有时我们只是忽略了对系统的更新,而继续对我们所面临的问题进行故障排除。 不管问题有多大或多小,为了避免它们,你都应该保持系统更新。 +有时我们一直尝试解决我们所面临的问题,而忽略了对系统的更新。不管问题有多大或多小,为了避免它们,你都应该保持系统更新。 -在本文中,我将向你展示更新Fedora Linux系统的多种方法。 +在本文中,我将向你展示更新 Fedora Linux 系统的多种方法。 - * [使用软件中心更新 Fedora][4] - * [使用命令行更新 Fedora][5] - * [从系统设置更新 Fedora][6] +* 使用软件中心更新 Fedora +* 使用命令行更新 Fedora +* 从系统设置更新 Fedora - - -请记住,更新 Fedora 意味着安装安全补丁,更新内核和软件。 如果要从 Fedora 的一个版本更新到另一个版本,这称为版本升级,你可以[在此处阅读有关 Fedora 版本升级过程的信息][7]。 +请记住,更新 Fedora 意味着安装安全补丁、更新内核和软件。如果要从 Fedora 的一个版本更新到另一个版本,这称为版本升级,你可以[在此处阅读有关 Fedora 版本升级过程的信息][7]。 ### 从软件中心更新 Fedora ![软件中心][8] -您很可能会收到通知,通知您有一些系统更新需要查看,您应该在单击该通知时启动软件中心。 +你很可能会收到通知,通知你有一些系统更新需要查看,你应该在单击该通知时启动软件中心。 -您所要做的就是–点击“更新”,并验证 root 密码开始更新。 +你所要做的就是 —— 点击“更新”,并验证 root 密码开始更新。 -如果您没有收到更新的通知,则只需启动软件中心并转到“更新”选项卡即可。 现在,您只需要继续更新。 +如果你没有收到更新的通知,则只需启动软件中心并转到“更新”选项卡即可。现在,你只需要继续更新。 ### 使用终端更新 Fedora -如果由于某种原因无法加载软件中心,则可以使用dnf 软件包管理命令轻松地更新系统。 -只需启动终端并输入以下命令即可开始更新(系统将提示你确认root密码): +如果由于某种原因无法加载软件中心,则可以使用 `dnf` 软件包管理命令轻松地更新系统。 +只需启动终端并输入以下命令即可开始更新(系统将提示你确认 root 密码): ``` sudo dnf upgrade ``` -**dnf 更新 vs dnf 升级 -** -你会发现有两个可用的 dnf 命令:dnf 更新和 dnf 升级。 这两个命令执行相同的工作,即安装 Fedora 提供的所有更新。 那么,为什么要会有 dnf 更新和 dnf 升级,你应该使用哪一个呢? dnf 更新基本上是 dnf 升级的别名。 尽管 dnf 更新可能仍然有效,但最好使用 dnf 升级,因为这是真正的命令。 +> **dnf 更新 vs dnf 升级 ** + +> 你会发现有两个可用的 dnf 命令:`dnf update` 和 `dnf upgrade`。这两个命令执行相同的工作,即安装 Fedora 提供的所有更新。那么,为什么要会有这两个呢,你应该使用哪一个?`dnf update` 基本上是 `dnf upgrade` 的别名。尽管 `dnf update` 可能仍然有效,但最好使用 `dnf upgrade`,因为这是真正的命令。 ### 从系统设置中更新 Fedora ![][9] -如果其它方法都不行(或者由于某种原因已经进入系统设置),请导航至设置底部的“详细信息”选项。 +如果其它方法都不行(或者由于某种原因已经进入“系统设置”),请导航至“设置”底部的“详细信息”选项。 -如上图所示,改选项中显示操作系统和硬件的详细信息以及一个“检查更新”按钮,如上图中所示。 您只需要单击它并提供root / admin密码即可继续安装可用的更新。 +如上图所示,该选项中显示操作系统和硬件的详细信息以及一个“检查更新”按钮。你只需要单击它并提供 root 密码即可继续安装可用的更新。 +### 总结 -**总结** - -如上所述,更新Fedora安装非常容易。 有三种方法供你选择,因此无需担心。 +如上所述,更新 Fedora 系统非常容易。有三种方法供你选择,因此无需担心。 如果你按上述说明操作时发现任何问题,请随时在下面的评论部分告诉我。 - -------------------------------------------------------------------------------- via: https://itsfoss.com/update-fedora/ 作者:[Ankush Das][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6bf16f11869d81b7cb122a1862769dd14a2aaba6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 08:28:34 +0800 Subject: [PATCH 373/800] PUB @Morisun029 https://linux.cn/article-11550-1.html --- ...ow To Update a Fedora Linux System -Beginner-s Tutorial.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md (98%) diff --git a/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md b/published/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md similarity index 98% rename from translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md rename to published/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md index ff6ef1e45a..4992e41050 100644 --- a/translated/tech/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md +++ b/published/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11550-1.html) [#]: subject: (How To Update a Fedora Linux System [Beginner’s Tutorial]) [#]: via: (https://itsfoss.com/update-fedora/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 2522c5fe3f8cd9f8119798e6e8b764b29f8d68c8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Nov 2019 08:43:31 +0800 Subject: [PATCH 374/800] Rename sources/tech/20191107 My first open source contribution- Keep the code relevant.md to sources/talk/20191107 My first open source contribution- Keep the code relevant.md --- ...7 My first open source contribution- Keep the code relevant.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191107 My first open source contribution- Keep the code relevant.md (100%) diff --git a/sources/tech/20191107 My first open source contribution- Keep the code relevant.md b/sources/talk/20191107 My first open source contribution- Keep the code relevant.md similarity index 100% rename from sources/tech/20191107 My first open source contribution- Keep the code relevant.md rename to sources/talk/20191107 My first open source contribution- Keep the code relevant.md From 622f3ec50d1b9ae943d1e364ca1ff93af5ccac02 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 8 Nov 2019 08:55:18 +0800 Subject: [PATCH 375/800] translated --- ... MAC address to bypass a captive portal.md | 61 ------------------- ... MAC address to bypass a captive portal.md | 61 +++++++++++++++++++ 2 files changed, 61 insertions(+), 61 deletions(-) delete mode 100644 sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md create mode 100644 translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md diff --git a/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md b/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md deleted file mode 100644 index 065ee17339..0000000000 --- a/sources/tech/20191104 Cloning a MAC address to bypass a captive portal.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cloning a MAC address to bypass a captive portal) -[#]: via: (https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal/) -[#]: author: (Esteban Wilson https://fedoramagazine.org/author/swilson/) - -Cloning a MAC address to bypass a captive portal -====== - -![][1] - -If you ever attach to a WiFi system outside your home or office, you often see a portal page. This page may ask you to accept terms of service or some other agreement to get access. But what happens when you can’t connect through this kind of portal? This article shows you how to use NetworkManager on Fedora to deal with some failure cases so you can still access the internet. - -### How captive portals work - -Captive portals are web pages offered when a new device is connected to a network. When the user first accesses the Internet, the portal captures all web page requests and redirects them to a single portal page. - -The page then asks the user to take some action, typically agreeing to a usage policy. Once the user agrees, they may authenticate to a RADIUS or other type of authentication system. In simple terms, the captive portal registers and authorizes a device based on the device’s MAC address and end user acceptance of terms. (The MAC address is [a hardware-based value][2] attached to any network interface, like a WiFi chip or card.) - -Sometimes a device doesn’t load the captive portal to authenticate and authorize the device to use the location’s WiFi access. Examples of this situation include mobile devices and gaming consoles (Switch, Playstation, etc.). They usually won’t launch a captive portal page when connecting to the Internet. You may see this situation when connecting to hotel or public WiFi access points. - -You can use NetworkManager on Fedora to resolve these issues, though. Fedora will let you temporarily clone the connecting device’s MAC address and authenticate to the captive portal on the device’s behalf. You’ll need the MAC address of the device you want to connect. Typically this is printed somewhere on the device and labeled. It’s a six-byte hexadecimal value, so it might look like _4A:1A:4C:B0:38:1F_. You can also usually find it through the device’s built-in menus. - -### Cloning with NetworkManager - -First, open _**nm-connection-editor**_, or open the WiFI settings via the Settings applet. You can then use NetworkManager to clone as follows: - - * For Ethernet – Select the connected Ethernet connection. Then select the _Ethernet_ tab. Note or copy the current MAC address. Enter the MAC address of the console or other device in the _Cloned MAC address_ field. - * For WiFi – Select the WiFi profile name. Then select the WiFi tab. Note or copy the current MAC address. Enter the MAC address of the console or other device in the _Cloned MAC address_ field. - - - -### **Bringing up the desired device** - -Once the Fedora system connects with the Ethernet or WiFi profile, the cloned MAC address is used to request an IP address, and the captive portal loads. Enter the credentials needed and/or select the user agreement. The MAC address will then get authorized. - -Now, disconnect the WiFi or Ethernet profile, and change the Fedora system’s MAC address back to its original value. Then boot up the console or other device. The device should now be able to access the Internet, because its network interface has been authorized via your Fedora system. - -This isn’t all that NetworkManager can do, though. For instance, check out this article on [randomizing your system’s hardware address][3] for better privacy. - -> [Randomize your MAC address using NetworkManager][3] - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal/ - -作者:[Esteban Wilson][a] -选题:[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/swilson/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/clone-mac-nm-816x345.jpg -[2]: https://en.wikipedia.org/wiki/MAC_address -[3]: https://fedoramagazine.org/randomize-mac-address-nm/ diff --git a/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md b/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md new file mode 100644 index 0000000000..f08c03de0b --- /dev/null +++ b/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cloning a MAC address to bypass a captive portal) +[#]: via: (https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal/) +[#]: author: (Esteban Wilson https://fedoramagazine.org/author/swilson/) + +克隆 MAC 地址来绕过强制门户 +====== + +![][1] + +如果你曾经不在家和办公室连接到 WiFi,那么通常会看到一个门户页面。它可能会要求你接受服务条款或其他协议才能访问。但是,当你无法通过这类门户进行连接时会发生什么?本文向你展示了如何在 Fedora 上使用 NetworkManager 处理某些故障情况,以便你仍然可以访问互联网。 + +### 强制门户如何工作 + +强制门户是新设备连接到网络时显示的网页。当用户首次访问互联网时,门户网站会捕获所有网页请求并将其重定向到单个门户页面。 + +然后,页面要求用户采取一些措施,通常是同意使用政策。用户同意后,他们可以向 RADIUS 或其他类型的身份验证系统进行身份验证。简而言之,强制门户根据设备的 MAC 地址和终端用户接受条款来注册和授权设备。 (MAC 地址是附加到任何网络接口(例如 WiFi 芯片或卡)的[基于硬件的值][2]。) + +有时设备无法加载强制门户来进行身份验证和授权,以使用 WiFI 接入。这种情况的例子包括移动设备和游戏机(Switch,Playstation 等)。当连接到互联网时,它们通常不会打开动强制门户页面。连接到酒店或公共 WiFi 接入点时,你可能会看到这种情况。 + +不过,你可以在 Fedora 上使用 NetworkManager 来解决这些问题。Fedora 使你可以临时克隆连接设备的 MAC 地址,并代表该设备通过强制门户进行身份验证。你需要得到连接设备的 MAC 地址。通常,它被打印在设备上的某个地方并贴上标签。它是一个六字节的十六进制值,因此看起来类似 _4A:1A:4C:B0:38:1F_。通常,你也可以通过设备的内置菜单找到它。 + +### 使用 NetworkManager 克隆 + +首先,打开 _**nm-connection-editor**_,或通过”设置“打开 WiFi 设置。然后,你可以使用 NetworkManager 进行克隆: + + * 对于以太网–选择已连接的以太网连接。然后选择 _Ethernet_ 选项卡。记录或复制当前的 MAC 地址。在 _Cloned MAC address_ 字段中输入游戏机或其他设备的 MAC 地址。 +  * 对于 WiFi –选择 WiFi 配置名。然后选择 “WiFi” 选项卡。记录或复制当前的 MAC 地址。在 _Cloned MAC address_ 字段中输入游戏机或其他设备的 MAC 地址。 + + + +### **启动所需的设备** + +当 Fedora 系统与以太网或 WiFi 配置连接,克隆的 MAC 地址将用于请求 IP 地址,并加载强制门户。输入所需的凭据和/或选择用户协议。MAC 地址将获得授权。 + +现在,断开 WiF i或以太网配置连接,然后将 Fedora 系统的 MAC 地址更改回其原始值。然后启动游戏机或其他设备。设备现在应该可以访问互联网了,因为它的网络接口已通过你的 Fedora 系统进行了授权。 + +不过,这不是 NetworkManager 全部能做的。例如,请参阅[随机化系统硬件地址][3],来获得更好的隐私保护。 + +> [使用 NetworkManager 随机化你的 MAC 地址][3] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal/ + +作者:[Esteban Wilson][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/swilson/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/clone-mac-nm-816x345.jpg +[2]: https://en.wikipedia.org/wiki/MAC_address +[3]: https://fedoramagazine.org/randomize-mac-address-nm/ From 5536b4f94e28ef57cce6ecab3b54145aabb234a6 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 8 Nov 2019 09:01:09 +0800 Subject: [PATCH 376/800] translating --- .../tech/20191107 How to add a user to your Linux desktop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191107 How to add a user to your Linux desktop.md b/sources/tech/20191107 How to add a user to your Linux desktop.md index da1957b563..7e57efc9d3 100644 --- a/sources/tech/20191107 How to add a user to your Linux desktop.md +++ b/sources/tech/20191107 How to add a user to your Linux desktop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3fdce71de07ddf693bc6c8af76ee2e309c65fba7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 09:26:20 +0800 Subject: [PATCH 377/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @jdh8383 翻译的很好 --- ... to program with Bash- Syntax and tools.md | 95 ++++++++----------- 1 file changed, 37 insertions(+), 58 deletions(-) diff --git a/translated/tech/20191021 How to program with Bash- Syntax and tools.md b/translated/tech/20191021 How to program with Bash- Syntax and tools.md index 2872e7d4c8..5d04c6db51 100644 --- a/translated/tech/20191021 How to program with Bash- Syntax and tools.md +++ b/translated/tech/20191021 How to program with Bash- Syntax and tools.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (jdh8383) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to program with Bash: Syntax and tools) @@ -9,33 +9,30 @@ 怎样用 Bash 编程:语法和工具 ====== -让我们通过本系列文章来学习基本的 Bash 编程语法和工具,以及如何使用变量和控制运算符,这是三篇中的第一篇。 -![bash logo on green background][1] -Shell 是操作系统的命令解释器,其中 Bash 是我最喜欢的。每当用户或者系统管理员将命令输入系统的时候,Linux 的 shell 解释器就会把这些命令转换成操作系统可以理解的形式。而执行结果返回 shell 程序后,它会将结果输出到 STDOUT(标准输出),默认情况下,这些结果会[显示在你的终端][2]。所有我熟悉的 shell 同时也是门编程语言。 +> 让我们通过本系列文章来学习基本的 Bash 编程语法和工具,以及如何使用变量和控制运算符,这是三篇中的第一篇。 -Bash 是个功能强大的 shell,包含众多便捷特性,比如:tab 补全、命令回溯和再编辑、aliases 别名等。它的命令行默认编辑模式是 Emacs,但是我最喜欢的Bash特性之一是我可以将其更改为 Vi 模式,以使用那些储存在我肌肉记忆中的的编辑命令。 +![](https://img.linux.net.cn/data/attachment/album/201911/08/092559r5wdg0w97dtf350j.jpg) + +Shell 是操作系统的命令解释器,其中 Bash 是我最喜欢的。每当用户或者系统管理员将命令输入系统的时候,Linux 的 shell 解释器就会把这些命令转换成操作系统可以理解的形式。而执行结果返回 shell 程序后,它会将结果输出到 STDOUT(标准输出),默认情况下,这些结果会[显示在你的终端][2]。所有我熟悉的 shell 同时也是一门编程语言。 + +Bash 是个功能强大的 shell,包含众多便捷特性,比如:tab 补全、命令回溯和再编辑、别名等。它的命令行默认编辑模式是 Emacs,但是我最喜欢的 Bash 特性之一是我可以将其更改为 Vi 模式,以使用那些储存在我肌肉记忆中的的编辑命令。 然而,如果你把 Bash 当作单纯的 shell 来用,则无法体验它的真实能力。我在设计一套包含三卷的 [Linux 自学课程][3]时(这个系列的文章正是基于此课程),了解到许多 Bash 的知识,这些是我在过去 20 年的 Linux 工作经验中所没有掌握的,其中的一些知识就是关于 Bash 的编程用法。不得不说,Bash 是一门强大的编程语言,是一个能够同时用于命令行和 shell 脚本的完美设计。 -本系列文章将要探讨如何使用 Bash 作为命令行界面(CLI)编程语言。第一篇文章简单介绍 Bash 命令行编程、变量以及控制运算符。其他文章会讨论诸如:Bash 文件的类型;字符串、数字和一些逻辑运算符,它们能够提供代码执行流程中的逻辑控制;不同类型的 shell 扩展;通过 **for**、**while** 和 **until** 来控制循环操作。 +本系列文章将要探讨如何使用 Bash 作为命令行界面(CLI)编程语言。第一篇文章简单介绍 Bash 命令行编程、变量以及控制运算符。其他文章会讨论诸如:Bash 文件的类型;字符串、数字和一些逻辑运算符,它们能够提供代码执行流程中的逻辑控制;不同类型的 shell 扩展;通过 `for`、`while` 和 `until` 来控制循环操作。 ### Shell -Shell 是操作系统的命令解释器,其中 Bash 是我最喜欢的。每当用户或者系统管理员将命令输入系统的时候,Linux 的 shell 解释器就会把这些命令转换成操作系统可以理解的形式。而执行结果返回 shell 程序后,它会将结果输出到终端。所有我熟悉的 shell 同时也是门编程语言。 - Bash 是 Bourne Again Shell 的缩写,因为 Bash shell 是 [基于][4] 更早的 Bourne shell,后者是 Steven Bourne 在 1977 年开发的。另外还有很多[其他的 shell][5] 可以使用,但下面四个是我经常见到的: - * **csh:** C shell 适合那些习惯了 C 语言语法的开发者。 - * **ksh:** Korn shell,由 David Korn 开发,在 Unix 用户中更流行。 - * **tcsh:** 一个 csh 的变种,增加了一些易用性。 - * **zsh:** Z shell,集成了许多其他流行 shell 的特性。 - - +* `csh`:C shell 适合那些习惯了 C 语言语法的开发者。 +* `ksh`:Korn shell,由 David Korn 开发,在 Unix 用户中更流行。 +* `tcsh`:一个 csh 的变种,增加了一些易用性。 +* `zsh`:Z shell,集成了许多其他流行 shell 的特性。 所有 shell 都有内置命令,用以补充或替代核心工具集。打开 shell 的 man 说明页,找到“BUILT-INS”那一段,可以查看都有哪些内置命令。 - 每种 shell 都有它自己的特性和语法风格。我用过 csh、ksh 和 zsh,但我还是更喜欢 Bash。你可以多试几个,寻找更适合你的 shell,尽管这可能需要花些功夫。但幸运的是,切换不同 shell 很简单。 所有这些 shell 既是编程语言又是命令解释器。下面我们来快速浏览一下 Bash 中集成的编程结构和工具。 @@ -54,18 +51,16 @@ Bash 是 Bourne Again Shell 的缩写,因为 Bash shell 是 [基于][4] 更早 本系列用 Bash 举例(因为它无处不在),假如你使用一个不同的 shell 也没关系,尽管结构和语法有所不同,但编程思想是相通的。有些 shell 支持某种特性而其他 shell 则不支持,但它们都提供编程功能。Shell 程序可以被存在一个文件中被反复使用,或者在需要的时候才创建它们。 - ### 简单 CLI 程序 -最简单的命令行程序只有一或两条语句,它们可能相关,也可能无关,在按**回车**键之前被输入到命令行。程序中的第二条语句(如果有的话)可能取决于第一条语句的操作,但也不是必须的。 +最简单的命令行程序只有一或两条语句,它们可能相关,也可能无关,在按回车键之前被输入到命令行。程序中的第二条语句(如果有的话)可能取决于第一条语句的操作,但也不是必须的。 -这里需要特别讲解一个标点符号。当你在命令行输入一条命令,按下**回车**键的时候,其实在命令的末尾有一个隐含的分号(**;**)。当一段 CLI shell 程序在命令行中被串起来作为单行指令使用时,必须使用分号来终结每个语句并将其与下一条语句分开。但 CLI shell 程序中的最后一条语句可以使用显式或隐式的分号。 +这里需要特别讲解一个标点符号。当你在命令行输入一条命令,按下回车键的时候,其实在命令的末尾有一个隐含的分号(`;`)。当一段 CLI shell 程序在命令行中被串起来作为单行指令使用时,必须使用分号来终结每个语句并将其与下一条语句分开。但 CLI shell 程序中的最后一条语句可以使用显式或隐式的分号。 ### 一些基本语法 下面的例子会阐明这一语法规则。这段程序由单条命令组成,还有一个显式的终止符: - ``` [student@studentvm1 ~]$ echo "Hello world." ; Hello world. @@ -73,8 +68,7 @@ Hello world. 看起来不像一个程序,但它确是我学习每个新编程语言时写下的第一个程序。不同语言可能语法不同,但输出结果是一样的。 -让我们扩展一下这段微不足道却又无所不在的代码。你的结果可能与我的有所不同,因为我的家目录有点乱,而你可能是在 GUI 桌面中第一次登陆账号。 - +让我们扩展一下这段微不足道却又无所不在的代码。你的结果可能与我的有所不同,因为我的家目录有点乱,而你可能是在 GUI 桌面中第一次登录账号。 ``` [student@studentvm1 ~]$ echo "My home directory." ; ls ; @@ -87,9 +81,8 @@ TestFile1.dos dmesg1.txt Documents Music random.txt testdir1 现在是不是更明显了。结果是相关的,但是两条语句彼此独立。你可能注意到我喜欢在分号前后多输入一个空格,这样会让代码的可读性更好。让我们再运行一遍这段程序,这次不要带结尾的分号: - ``` -`[student@studentvm1 ~]$ echo "My home directory." ; ls` +[student@studentvm1 ~]$ echo "My home directory." ; ls ``` 输出结果没有区别。 @@ -98,14 +91,13 @@ TestFile1.dos dmesg1.txt Documents Music random.txt testdir1 像所有其他编程语言一样,Bash 支持变量。变量是个象征性的名字,它指向内存中的某个位置,那里存着对应的值。变量的值是可以改变的,所以它叫“变~量”。 -Bash 不像 C 之类的语言,需要强制指定变量类型,比如:整型、浮点型或字符型。在 Bash 中,所有变量都是字符串。整数型的变量可以被用于整数运算,这是 Bash 唯一能够处理的数学类型。更复杂的运算则需要借助 [**bc**][9] 这样的命令,可以被用在命令行编程或者脚本中。 +Bash 不像 C 之类的语言,需要强制指定变量类型,比如:整型、浮点型或字符型。在 Bash 中,所有变量都是字符串。整数型的变量可以被用于整数运算,这是 Bash 唯一能够处理的数学类型。更复杂的运算则需要借助 [bc][9] 这样的命令,可以被用在命令行编程或者脚本中。 -变量的值是被预先分配好的,这些值可以用在命令行编程或者脚本中。可以通过变量名字给其赋值,但是不能使用 **$** 符开头。比如,**VAR=10** 这样会把 VAR 的值设为 10。要打印变量的值,你可以使用语句 **echo $VAR**。变量名必须以文本(即非数字)开始。 +变量的值是被预先分配好的,这些值可以用在命令行编程或者脚本中。可以通过变量名字给其赋值,但是不能使用 `$` 符开头。比如,`VAR=10` 这样会把 `VAR` 的值设为 `10`。要打印变量的值,你可以使用语句 `echo $VAR`。变量名必须以文本(即非数字)开始。 Bash 会保存已经定义好的变量,直到它们被取消掉。 -下面这个例子,在变量被赋值前,它的值是空(null)。然后给它赋值并打印出来,检验一下。你可以在同一行 CLI 程序里完成它: - +下面这个例子,在变量被赋值前,它的值是空(`null`)。然后给它赋值并打印出来,检验一下。你可以在同一行 CLI 程序里完成它: ``` [student@studentvm1 ~]$ echo $MyVar ; MyVar="Hello World" ; echo $MyVar ; @@ -114,15 +106,14 @@ Hello World [student@studentvm1 ~]$ ``` -_注意:变量赋值的语法非常严格,等号(**=**)两边不能有空格。_ +*注意:变量赋值的语法非常严格,等号(`=`)两边不能有空格。* -那个空行表明了 **MyVar** 的初始值为空。变量的赋值和改值方法都一样,这个例子展示了原始值和新的值。 +那个空行表明了 `MyVar` 的初始值为空。变量的赋值和改值方法都一样,这个例子展示了原始值和新的值。 正如之前说的,Bash 支持整数运算,当你想计算一个数组中的某个元素的位置,或者做些简单的算术运算,这还是挺有帮助的。然而,这种方法并不适合科学计算,或是某些需要小数运算的场景,比如财务统计。这些场景有其它更好的工具可以应对。 下面是个简单的算术题: - ``` [student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1*Var2))" Result = 63 @@ -130,7 +121,6 @@ Result = 63 好像没啥问题,但如果运算结果是浮点数会发生什么呢? - ``` [student@studentvm1 ~]$ Var1="7" ; Var2="9" ; echo "Result = $((Var1/Var2))" Result = 0 @@ -139,29 +129,25 @@ Result = 1 [student@studentvm1 ~]$ ``` -结果会被取整。请注意运算被包含在 **echo** 语句之中,其实计算在 echo 命令结束前就已经完成了,原因是 Bash 的内部优先级。想要了解详情的话,可以在 Bash 的 man 页面中搜索 "precedence"。 +结果会被取整。请注意运算被包含在 `echo` 语句之中,其实计算在 echo 命令结束前就已经完成了,原因是 Bash 的内部优先级。想要了解详情的话,可以在 Bash 的 man 页面中搜索 “precedence”。 ### 控制运算符 Shell 的控制运算符是一种语法运算符,可以轻松地创建一些有趣的命令行程序。在命令行上按顺序将几个命令串在一起,就变成了最简单的 CLI 程序: - ``` -`command1 ; command2 ; command3 ; command4 ; . . . ; etc. ;` +command1 ; command2 ; command3 ; command4 ; . . . ; etc. ; ``` -只要不出错,这些命令都能顺利执行。但假如出错了怎么办?你可以预设好应对出错的办法,这就要用到 Bash 内置的控制运算符, **&&** 和 **||**。这两种运算符提供了流程控制功能,使你能改变代码执行的顺序。分号也可以被看做是一种 Bash 运算符,预示着新一行的开始。 - - -**&&** 运算符提供了如下简单逻辑,“如果 command1 执行成功,那么接着执行 command2。如果 command1 失败,就跳过 command2。”语法如下: +只要不出错,这些命令都能顺利执行。但假如出错了怎么办?你可以预设好应对出错的办法,这就要用到 Bash 内置的控制运算符, `&&` 和 `||`。这两种运算符提供了流程控制功能,使你能改变代码执行的顺序。分号也可以被看做是一种 Bash 运算符,预示着新一行的开始。 +`&&` 运算符提供了如下简单逻辑,“如果 command1 执行成功,那么接着执行 command2。如果 command1 失败,就跳过 command2。”语法如下: ``` -`command1 && command2` +command1 && command2 ``` -现在,让我们用命令来创建一个新的目录,如果成功的话,就把它切换为当前目录。确保你的家目录(**~**)是当前目录,先尝试在 **/root** 目录下创建,你应该没有权限: - +现在,让我们用命令来创建一个新的目录,如果成功的话,就把它切换为当前目录。确保你的家目录(`~`)是当前目录,先尝试在 `/root` 目录下创建,你应该没有权限: ``` [student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir/ &&; cd $Dir @@ -169,18 +155,16 @@ mkdir: cannot create directory '/root/testdir/': Permission denied [student@studentvm1 ~]$ ``` -上面的报错信息是由 **mkdir** 命令抛出的,因为创建目录失败了。**&&** 运算符收到了非零的返回码,所以 **cd** 命令就被跳过,前者阻止后者继续运行,因为创建目录失败了。这种控制流程可以阻止后面的错误累积,避免引发更严重的问题。是时候讲点更复杂的逻辑了。 - -当一段程序的返回码大于零时,使用 **||** 运算符可以让你在后面接着执行另一段程序。简单语法如下: +上面的报错信息是由 `mkdir` 命令抛出的,因为创建目录失败了。`&&` 运算符收到了非零的返回码,所以 `cd` 命令就被跳过,前者阻止后者继续运行,因为创建目录失败了。这种控制流程可以阻止后面的错误累积,避免引发更严重的问题。是时候讲点更复杂的逻辑了。 +当一段程序的返回码大于零时,使用 `||` 运算符可以让你在后面接着执行另一段程序。简单语法如下: ``` -`command1 || command2` +command1 || command2 ``` 解读一下,“假如 command1 失败,执行 command2”。隐藏的逻辑是,如果 command1 成功,跳过 command2。下面实践一下,仍然是创建新目录: - ``` [student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir || echo "$Dir was not created." mkdir: cannot create directory '/root/testdir': Permission denied @@ -190,16 +174,14 @@ mkdir: cannot create directory '/root/testdir': Permission denied 正如预期,因为目录无法创建,第一条命令失败了,于是第二条命令被执行。 -把 **&&** 和 **||** 两种运算符结合起来才能发挥它们的最大功效。请看下面例子中的流程控制方法: - +把 `&&` 和 `||` 两种运算符结合起来才能发挥它们的最大功效。请看下面例子中的流程控制方法: ``` -`preceding commands ; command1 && command2 || command3 ; following commands` +前置 commands ; command1 && command2 || command3 ; 跟随 commands ``` 语法解释:“假如 command1 退出时返回码为零,就执行 command2,否则执行 command3。”用具体代码试试: - ``` [student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." mkdir: cannot create directory '/root/testdir': Permission denied @@ -207,18 +189,16 @@ mkdir: cannot create directory '/root/testdir': Permission denied [student@studentvm1 ~]$ ``` -现在我们再试一次,用你的家目录替换 **/root** 目录,你将会有权限创建这个目录了: - +现在我们再试一次,用你的家目录替换 `/root` 目录,你将会有权限创建这个目录了: ``` [student@studentvm1 ~]$ Dir=~/testdir ; mkdir $Dir && cd $Dir || echo "$Dir was not created." [student@studentvm1 testdir]$ ``` -像 **command1 && command2** 这样的控制语句能够运行的原因是,每条命令执行完毕时都会给 shell 发送一个返回码,用来表示它执行成功与否。默认情况下,返回码为 0 表示成功,其他任何正值表示失败。一些系统管理员使用的工具用值为 1 的返回码来表示失败,但其他很多程序使用别的数字来表示失败。 - -Bash 的内置变量 **$?** 可以显示上一条命令的返回码,可以在脚本或者命令行中非常方便地检查它。要查看返回码,让我们从运行一条简单的命令开始,返回码的结果总是上一条命令给出的。 +像 `command1 && command2` 这样的控制语句能够运行的原因是,每条命令执行完毕时都会给 shell 发送一个返回码,用来表示它执行成功与否。默认情况下,返回码为 `0` 表示成功,其他任何正值表示失败。一些系统管理员使用的工具用值为 `1` 的返回码来表示失败,但其他很多程序使用别的数字来表示失败。 +Bash 的内置变量 `$?` 可以显示上一条命令的返回码,可以在脚本或者命令行中非常方便地检查它。要查看返回码,让我们从运行一条简单的命令开始,返回码的结果总是上一条命令给出的。 ``` [student@studentvm1 testdir]$ ll ; echo "RC = $?" @@ -234,7 +214,6 @@ RC = 0 在这个例子中,返回码为零,意味着命令执行成功了。现在对 root 的家目录测试一下,你应该没有权限: - ``` [student@studentvm1 testdir]$ ll /root ; echo "RC = $?" ls: cannot open directory '/root': Permission denied @@ -242,7 +221,7 @@ RC = 2 [student@studentvm1 testdir]$ ``` -本例中返回码是 2,表明非 root 用户没有权限进入这个目录。你可以利用这些返回码,用控制运算符来改变程序执行的顺序。 +本例中返回码是 `2`,表明非 root 用户没有权限进入这个目录。你可以利用这些返回码,用控制运算符来改变程序执行的顺序。 ### 总结 @@ -255,7 +234,7 @@ via: https://opensource.com/article/19/10/programming-bash-part-1 作者:[David Both][a] 选题:[lujun9972][b] 译者:[jdh8383](https://github.com/jdh8383) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 196a7b2eb69f2f5e37338f3cfc935e7de2a51b72 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 09:28:29 +0800 Subject: [PATCH 378/800] PUB @jdh8383 https://linux.cn/article-11552-1.html --- .../20191021 How to program with Bash- Syntax and tools.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191021 How to program with Bash- Syntax and tools.md (99%) diff --git a/translated/tech/20191021 How to program with Bash- Syntax and tools.md b/published/20191021 How to program with Bash- Syntax and tools.md similarity index 99% rename from translated/tech/20191021 How to program with Bash- Syntax and tools.md rename to published/20191021 How to program with Bash- Syntax and tools.md index 5d04c6db51..9e4fe128b9 100644 --- a/translated/tech/20191021 How to program with Bash- Syntax and tools.md +++ b/published/20191021 How to program with Bash- Syntax and tools.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (jdh8383) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11552-1.html) [#]: subject: (How to program with Bash: Syntax and tools) [#]: via: (https://opensource.com/article/19/10/programming-bash-part-1) [#]: author: (David Both https://opensource.com/users/dboth) From 14db98e4289a561a481d286d215b5a9b158f4e98 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 11:08:45 +0800 Subject: [PATCH 379/800] PRF --- .../20191021 How to program with Bash- Syntax and tools.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/published/20191021 How to program with Bash- Syntax and tools.md b/published/20191021 How to program with Bash- Syntax and tools.md index 9e4fe128b9..3f044598b4 100644 --- a/published/20191021 How to program with Bash- Syntax and tools.md +++ b/published/20191021 How to program with Bash- Syntax and tools.md @@ -37,7 +37,7 @@ Bash 是 Bourne Again Shell 的缩写,因为 Bash shell 是 [基于][4] 更早 所有这些 shell 既是编程语言又是命令解释器。下面我们来快速浏览一下 Bash 中集成的编程结构和工具。 -### 做为编程语言的 Bash +### 作为编程语言的 Bash 大多数场景下,系统管理员都会使用 Bash 来发送简单明了的命令。但 Bash 不仅可以输入单条命令,很多系统管理员可以编写简单的命令行程序来执行一系列任务,这些程序可以作为通用工具,能节省时间和精力。 @@ -150,7 +150,7 @@ command1 && command2 现在,让我们用命令来创建一个新的目录,如果成功的话,就把它切换为当前目录。确保你的家目录(`~`)是当前目录,先尝试在 `/root` 目录下创建,你应该没有权限: ``` -[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir/ &&; cd $Dir +[student@studentvm1 ~]$ Dir=/root/testdir ; mkdir $Dir/ && cd $Dir mkdir: cannot create directory '/root/testdir/': Permission denied [student@studentvm1 ~]$ ``` From cc02b3d5228e8a7442b3719554cfd3668e4123af Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 8 Nov 2019 11:16:12 +0800 Subject: [PATCH 380/800] Rename sources/tech/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md to sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md --- ...artphone PinePhone Will be Available to Pre-order Next Week.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md (100%) diff --git a/sources/tech/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md b/sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md similarity index 100% rename from sources/tech/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md rename to sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md From 8c1cda723ed0b83bb1883cd7234d1fec31174cb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 8 Nov 2019 13:39:25 +0800 Subject: [PATCH 381/800] Translated --- ...urce Paint Applications for Linux Users.md | 234 ------------------ ...urce Paint Applications for Linux Users.md | 234 ++++++++++++++++++ 2 files changed, 234 insertions(+), 234 deletions(-) delete mode 100644 sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md create mode 100644 translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md diff --git a/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md b/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md deleted file mode 100644 index d1c4ce50a6..0000000000 --- a/sources/tech/20190906 6 Open Source Paint Applications for Linux Users.md +++ /dev/null @@ -1,234 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 Open Source Paint Applications for Linux Users) -[#]: via: (https://itsfoss.com/open-source-paint-apps/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -6 Open Source Paint Applications for Linux Users -====== - -As a child, when I started using computer (with Windows XP), my favorite application was Paint. I spent hours doodling on it. Surprisingly, children still love the paint apps. And not just children, the simple paint app comes handy in a number of situations. - -You will find a bunch of applications that let you draw/paint or manipulate images. However, some of them are proprietary. While you’re a Linux user – why not focus on open source paint applications? - -In this article, we are going to list some of the best open source paint applications which are worthy alternatives to proprietary painting software available on Linux. - -### Open Source paint & drawing applications - -![][1] - -**Note:** _The list is in no particular order of ranking._ - -#### 1\. Pinta - -![][2] - -Key Highlights: - - * Great alternative to Paint.NET / MS Paint - * Add-on support (WebP Image support available) - * Layer Support - - - -[Pinta][3] is an impressive open-source paint application which is perfect for drawing and basic image editing. In other words, it is a simple paint application with some fancy features. - -You may consider [Pinta][4] as an alternative to MS Paint on Linux – but with layer support and more. Not just MS Paint, but it acts as a Linux replacement for Paint.NET software available for Windows. Even though Paint.NET is better – Pinta seems to be a decent alternative to it. - -A couple of add-ons can be utilized to enhance the functionality, like the [support for WebP images on Linux][5]. In addition to the layer support, you can easily resize the images, add effects, make adjustments (brightness, contrast, etc.), and also adjust the quality when exporting the image. - -#### How to install Pinta? - -You should be able to easily find it in the Software Center / App Center / Package Manager. Just type in “**Pinta**” and get started installing it. In either case, try the [Flatpak][6] package. - -Or, you can enter the following command in the terminal (Ubuntu/Debian): - -``` -sudo apt install pinta -``` - -For more information on the download packages and installation instructions, refer the [official download page][7]. - -#### 2\. Krita - -![][8] - -Key Highlights: - - * HDR Painting - * PSD Support - * Layer Support - * Brush stabilizers - * 2D Animation - - - -Krita is one of the most advanced open source paint applications for Linux. Of course, for this article, it helps you draw sketches and wreak havoc upon the canvas. But, in addition to that, it offers a whole lot of features. - -[][9] - -Suggested read  Things To Do After Installing Fedora 24 - -For instance, if you have a shaky hand, it can help you stabilize the brush strokes. You also get built-in vector tools to create comic panels and other interesting things. If you are looking for a full-fledged color management support, drawing assistants, and layer management, Krita should be your preferred choice. - -#### How to install Krita? - -Similar to pinta, you should be able to find it listed in the Software Center/App Center or the package manager. It’s also available in the [Flatpak repository][10]. - -Thinking to install it via terminal? Type in the following command: - -``` -sudo apt install krita -``` - -In either case, you can head down to their [official download page][11] to get the **AppImage** file and run it. - -If you have no idea on AppImage files, check out our guide on – [how to use AppImage][12]. - -#### 3\. Tux Paint - -![][13] - -Key Highlights: - - * A no-nonsense paint application for kids - - - -I’m not kidding, Tux Paint is one of the best open-source paint applications for kids between 3-12 years of age. Of course, you do not want options when you want to just scribble. So, Tux Paint seems to be the best option in that case (even for adults!). - -#### How to install Tuxpaint? - -Tuxpaint can be downloaded from the Software Center or Package manager. In either case, to install it on Ubuntu/Debian, type in the following command in the terminal: - -``` -sudo apt install tuxpaint -``` - -For more information on it, head to the [official site][14]. - -#### 4\. Drawpile - -![][15] - -Key Highlights: - - * Collaborative Drawing - * Built-in chat to interact with other users - * Layer support - * Record drawing sessions - - - -Drawpile is an interesting open-source paint application where you get to collaborate with other users in real-time. To be precise, you can simultaneously draw in a single canvas. In addition to this unique feature, you have the layer support, ability to record your drawing session, and even a chat facility to interact with the users collaborating. - -You can host/join a public session or start a private session with your friend which requires a code. By default, the server will be your computer. But, if you want a remote server, you can select it as well. - -Do note, that you will need to [sign up for a Drawpile account][16] in order to collaborate. - -#### How to install Drawpile? - -As far as I’m aware of, you can only find it listed in the [Flatpak repository][17]. - -[][18] - -Suggested read  OCS Store: One Stop Shop All of Your Linux Software Customization Needs - -#### 5\. MyPaint - -![][19] - -Key Highlights: - - * Easy-to-use tool for digital painters - * Layer management support - * Lots of options to tweak your brush and drawing - - - -[MyPaint][20] is a simple yet powerful tool for digital painters. It features a lot of options to tweak in order to make the perfect digital brush stroke. I’m not much of a digital artist (but a scribbler) but I observed quite a few options to adjust the brush, the colors, and an option to add a scratchpad panel. - -It also supports layer management – in case you want that. The latest stable version hasn’t been updated for a few years now, but the recent alpha build (which I tested) works just fine. If you are looking for an open source paint application on Linux – do give this a try. - -#### How to install MyPaint? - -MyPaint is available in the official repository. However, that’s the old version. If you still want to proceed, you can search for it in the Software Center or type the following command in the terminal: - -``` -sudo apt install mypaint -``` - -You can head to its official [GitHub release page][21] for the latest alpha build and get the [AppImage file][12] (any version) to make it executable and launch the app. - -#### 6\. KolourPaint - -![][22] - -Key Highlights: - - * A simple alternative to MS Paint on Linux - * No layer management support - - - -If you aren’t looking for any Layer management support and just want an open source paint application to draw stuff – this is it. - -[KolourPaint][23] is originally tailored for KDE desktop environments but it works flawlessly on others too. - -#### How to install KolourPaint? - -You can install KolourPaint right from the Software Center or via the terminal using the following command: - -``` -sudo apt install kolourpaint4 -``` - -In either case, you can utilize [Flathub][24] as well. - -**Wrapping Up** - -If you are wondering about applications like GIMP/Inkscape, we have those listed in another separate article on the [best Linux Tools for digital artists][25]. If you’re curious about more options, I recommend you to check that out. - -Here, we try to compile a list of best open source paint applications available for Linux. If you think we missed something, feel free to tell us about it in the comments section below! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/open-source-paint-apps/ - -作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/open-source-paint-apps.png?resize=800%2C450&ssl=1 -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/pinta.png?ssl=1 -[3]: https://pinta-project.com/pintaproject/pinta/ -[4]: https://itsfoss.com/pinta-1-6-ubuntu-linux-mint/ -[5]: https://itsfoss.com/webp-ubuntu-linux/ -[6]: https://www.flathub.org/apps/details/com.github.PintaProject.Pinta -[7]: https://pinta-project.com/pintaproject/pinta/releases -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/krita-paint.png?ssl=1 -[9]: https://itsfoss.com/things-to-do-after-installing-fedora-24/ -[10]: https://www.flathub.org/apps/details/org.kde.krita -[11]: https://krita.org/en/download/krita-desktop/ -[12]: https://itsfoss.com/use-appimage-linux/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/tux-paint.jpg?ssl=1 -[14]: http://www.tuxpaint.org/ -[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/drawpile.png?ssl=1 -[16]: https://drawpile.net/accounts/signup/ -[17]: https://flathub.org/apps/details/net.drawpile.drawpile -[18]: https://itsfoss.com/ocs-store/ -[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/mypaint.png?ssl=1 -[20]: https://mypaint.org/ -[21]: https://github.com/mypaint/mypaint/releases -[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/kolourpaint.png?ssl=1 -[23]: http://kolourpaint.org/ -[24]: https://flathub.org/apps/details/org.kde.kolourpaint -[25]: https://itsfoss.com/best-linux-graphic-design-software/ diff --git a/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md b/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md new file mode 100644 index 0000000000..b8692dcfe9 --- /dev/null +++ b/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 Open Source Paint Applications for Linux Users) +[#]: via: (https://itsfoss.com/open-source-paint-apps/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +面向 Linux 用户的6款开源绘图应用程序 +====== + +小时候,当我开始使用计算机(使用 Windows XP)时,我最喜欢的应用程序是 Paint。我在它上面花费数小时涂鸦。出乎意料,孩子们仍然喜欢 paint 应用程序。不仅仅是孩子们,简单是 paint 应用程序,在很多情况下都能派上用场。 + +你将找到一堆可以让你绘制/绘图或操作图片的应用程序。然而,其中一些是专有的。既然你是一名 Linux 用户 - 为什么不聚焦在开源绘图应用程序上呢? + +在这篇文章中,我们将列出一些最好的开源绘图应用程序,在 Linux 上,它们有替换专有绘图软件的价值。 + +### 开源绘图 & 绘制应用程序 + +![][1] + +**注意:** _该列表没有特别的排名顺序,_ + +#### 1\. Pinta + +![][2] + +主要亮点: + + * Paint.NET / MS Paint 的极好替代品 + * 附加组件支持 (也支持 WebP 图片) + * 图层支持 + + + +[Pinta][3] 是一款令人赞叹的开源绘图应用程序,非常适合绘图和简单的图片编辑。换句话说,它是一款简单的带有绚丽特色的绘图应用程序。 + +你可以考虑把 [Pinta][4] 作为 Linux 上的 MS Paint 的一个替代品 – 但是带有图层支持等等。不仅仅是 MS Paint,它也可以作为 Windows 上可以使用的Paint.NET 的一个 Linux 替代品。尽管 Paint.NET 更好一些 – Pinta 似乎是个不错的选择。 + +几个附件可以用于增强功能,像 [在 Linux 上支持 WebP 图片][5]。另外,图层支持,你可以简单地调整图片大小,添加特效,进行调整(亮度,对比度等等),以及在导出图片时调整其质量。 + +#### 如何安装 Pinta ? + +你应该能够在软件中心/应用程序中心/软件包管理器中简单地找到它。只需要输入 “**Pinta**” ,并开始安装它。无论哪种情况,尝试 [Flatpak][6] 软件包。 + +或者,你可以在终端中输入下面的命令 (Ubuntu/Debian): + +``` +sudo apt install pinta +``` + +下载软件包和安装指南的更多信息,参考[官方下载页面][7]. + +#### 2\. Krita + +![][8] + +主要亮点: + + * HDR 绘图 + * PSD 支持 + * 图层支持 + * 笔刷稳定器 + * 二维动画 + + + +Krita 是 Linux 上最高级的开源绘图应用程序之一。当然,对于本文,它帮助你绘制草图和在画布上造成破坏。除此之外,它还提供很多特色。 + +[][9] + +建议在安装 Fedora 24后阅读要做的事情 + +例如,如果你有一只颤抖的手,它可以帮助你稳定笔刷的笔划。你可以使用内置的矢量工具来创建漫画面板和其它有趣的东西。如果你正在寻找一个成熟的颜色管理支持,绘图助理和图层管理,Krita 应该是你最好的选择。 + +#### 如何安装 Krita ? + +类似于 pinta,你可以在软件中心/应用程序中心或软件包管理器的列表中找到它。它也可以 [Flatpak 存储库][10]中找到。 + +考虑通过终端安装它?输入下面的命令: + +``` +sudo apt install krita +``` + +无论哪种情况,你可以前往它们的[官方下载页面][11]来获取 **AppImage** 文件并运行它。 + +如果你对 AppImage 文件一无所知,查看我们的指南 – [如何使用 AppImage][12] 。 + +#### 3\. Tux Paint + +![][13] + +主要亮点: + + * 给儿童用的一个简单直接的绘图应用程序 + + + +我不是儿童,对于3-12岁儿童来说,Tux Paint 是最好的开源绘图应用程序之一。当然,当你只想乱画时,你不需要选择。所以,在这种情况下,Tux Paint 似乎是最好的选择(即使是成年人!). + +#### 如何安装 Tuxpaint ? + +Tuxpaint 可以从软件中心或软件包管理器下载。无论哪种情况,在 Ubuntu/Debian 上安装它,在终端中输入下面的命令: + +``` +sudo apt install tuxpaint +``` + +关于它的更多信息,前往[官方站点][14]。 + +#### 4\. Drawpile + +![][15] + +主要亮点: + + * 协同绘制 + * 内置聊天功能,与其他用户互动 + * 图层支持 + * 记录绘制会话 + + + +Drawpile 是一个有趣的开源绘图应用程序,在程序中,你可以与其他用户实时协作。准确地说,你们可以单个画布中同时绘制。除了这个独特的功能,你还有图层支持,记录绘制会话的能力,甚至一个聊天工具来与其他协作用户交互。 + +你可以主办/加入一个公共会话,或使用一个代码与你的朋友一起开始一个私有会话。默认情况下,服务器将是你的计算机。但是,如果你需要远程服务器,你也可以选择它。 + +注意,你将需要[注册一个 Drawpile 账户][16] 以便于协作。 + +#### 如何安装 Drawpile ? + +据我所知,你只能在As far as I’m aware of, you can only find it listed in the [Flatpak 存储库][17]的列表中找到它。 + +[][18] + +建议阅读 OCS 商店:一站式商店,满足你所有的 Linux 软件定制需求 + +#### 5\. MyPaint + +![][19] + +主要亮点: + + * 给数码画家的易用工具 + * 图层管理支持 + * 很多选项来微调你的画笔和绘制 + + + +对于数码画家来说,[MyPaint][20] 是一个简单但强大的工具。它以很多选项来调整为特色,以便于使数字笔刷笔划轻触。我不是一个数字艺术家(但我是一个涂鸦者),但是我注意到很多来调整笔刷,颜色的选项,和一个来添加中间结果暂存器面板的选项。 + +它也支持图层管理 – 也许你需要它。已经有好几年没有更新最新的稳定版本,但是当前的 alpha 构建版本(我测试过)运行的很好。如果你正在 Linux 上寻找一个开源绘图应用程序 – 试试这个。 + +#### 如何安装 MyPaint ? + +MyPaint 在官方存储库中可获得。然而,这是老旧的版本。如果你仍然想继续,你可以在软件中心搜索它,或在终端中输入下面的命令: + +``` +sudo apt install mypaint +``` + +你可以前往它的官方 [GitHub 发布页面][21]获取最新的 alpha 构建版本,和获取 [AppImage 文件][12] (任意版本) 来使它可执行并启动应用程序。 + +#### 6\. KolourPaint + +![][22] + +主要亮点: + + * 在 Linux 上的一个 MS Paint 简单替代 + * 不支持图层管理 + + + +如果你制作寻找不支持任何图层管理,只需要一个开源绘图应用程序来绘制东西 – 它就是这个。 + +[KolourPaint][23] 最初为 KDE 桌面环境定制,但是它在其它的桌面环境中也完美地工作。 + +#### 如何安装 KolourPaint ? + +你可以从软件中心安装 KolourPaint ,或通过终端使用下面的命令: + +``` +sudo apt install kolourpaint4 +``` + +无论哪种情况,你都可以使用 [Flathub][24] 。 + +**总结** + +如果你在考虑如 GIMP/Inkscape 这样的应用程序, 我们在另一篇关于[给数码艺术家的最好 Linux 工具][25]的文章中列出。如果你对更多的选项好奇,我建议你去查看它。 + +在这里,我们尝试编写一份 Linux 可用的最佳开源绘图应用程序列表。如果你认为我们错过一些东西,请在下面的评论区告诉我们! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-paint-apps/ + +作者:[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://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/open-source-paint-apps.png?resize=800%2C450&ssl=1 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/pinta.png?ssl=1 +[3]: https://pinta-project.com/pintaproject/pinta/ +[4]: https://itsfoss.com/pinta-1-6-ubuntu-linux-mint/ +[5]: https://itsfoss.com/webp-ubuntu-linux/ +[6]: https://www.flathub.org/apps/details/com.github.PintaProject.Pinta +[7]: https://pinta-project.com/pintaproject/pinta/releases +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/09/krita-paint.png?ssl=1 +[9]: https://itsfoss.com/things-to-do-after-installing-fedora-24/ +[10]: https://www.flathub.org/apps/details/org.kde.krita +[11]: https://krita.org/en/download/krita-desktop/ +[12]: https://itsfoss.com/use-appimage-linux/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/tux-paint.jpg?ssl=1 +[14]: http://www.tuxpaint.org/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/drawpile.png?ssl=1 +[16]: https://drawpile.net/accounts/signup/ +[17]: https://flathub.org/apps/details/net.drawpile.drawpile +[18]: https://itsfoss.com/ocs-store/ +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/09/mypaint.png?ssl=1 +[20]: https://mypaint.org/ +[21]: https://github.com/mypaint/mypaint/releases +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/09/kolourpaint.png?ssl=1 +[23]: http://kolourpaint.org/ +[24]: https://flathub.org/apps/details/org.kde.kolourpaint +[25]: https://itsfoss.com/best-linux-graphic-design-software/ From 79b7d36e26c26ae856d489c1bec0100cf5c0884d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 8 Nov 2019 13:59:20 +0800 Subject: [PATCH 382/800] Translating --- sources/tech/20191007 7 Java tips for new developers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191007 7 Java tips for new developers.md b/sources/tech/20191007 7 Java tips for new developers.md index 6a560ceb2d..8ad9a70f8a 100644 --- a/sources/tech/20191007 7 Java tips for new developers.md +++ b/sources/tech/20191007 7 Java tips for new developers.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 562fd6d4a64ab53249ca18e7e0dfff3262fa1763 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 14:18:12 +0800 Subject: [PATCH 383/800] =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...104 My first contribution to open source- Impostor Syndrome.md | 0 ...105 My first contribution to open source- Making a decision.md | 0 ... first contribution to open source- Make a fork of the repo.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191104 My first contribution to open source- Impostor Syndrome.md (100%) rename sources/{tech => talk}/20191105 My first contribution to open source- Making a decision.md (100%) rename sources/{tech => talk}/20191106 My first contribution to open source- Make a fork of the repo.md (100%) diff --git a/sources/tech/20191104 My first contribution to open source- Impostor Syndrome.md b/sources/talk/20191104 My first contribution to open source- Impostor Syndrome.md similarity index 100% rename from sources/tech/20191104 My first contribution to open source- Impostor Syndrome.md rename to sources/talk/20191104 My first contribution to open source- Impostor Syndrome.md diff --git a/sources/tech/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 similarity index 100% rename from sources/tech/20191105 My first contribution to open source- Making a decision.md rename to sources/talk/20191105 My first contribution to open source- Making a decision.md diff --git a/sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md b/sources/talk/20191106 My first contribution to open source- Make a fork of the repo.md similarity index 100% rename from sources/tech/20191106 My first contribution to open source- Make a fork of the repo.md rename to sources/talk/20191106 My first contribution to open source- Make a fork of the repo.md From c56f42e10768cad562bc7243eb23ae3ff267072f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 14:24:49 +0800 Subject: [PATCH 384/800] APL --- ...yboard Shortcuts Google Chrome-Chromium Users Should Know.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md b/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md index 4e2693f079..d1e2c38992 100644 --- a/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md +++ b/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 747f9fb096191920f4e65fc56def8f9aef874c37 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 17:57:45 +0800 Subject: [PATCH 385/800] TSL --- ...oogle Chrome-Chromium Users Should Know.md | 141 ------------------ ...oogle Chrome-Chromium Users Should Know.md | 129 ++++++++++++++++ 2 files changed, 129 insertions(+), 141 deletions(-) delete mode 100644 sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md create mode 100644 translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md diff --git a/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md b/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md deleted file mode 100644 index d1e2c38992..0000000000 --- a/sources/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md +++ /dev/null @@ -1,141 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (11 Essential Keyboard Shortcuts Google Chrome/Chromium Users Should Know) -[#]: via: (https://itsfoss.com/google-chrome-shortcuts/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -11 Essential Keyboard Shortcuts Google Chrome/Chromium Users Should Know -====== - -_**Brief: Master these Google Chrome keyboard shortcuts for a better, smoother and more productive web browsing experience. Downloadable cheatsheet is also included.**_ - -Google Chrome is the [most popular web browser][1] and there is no denying it. It’s open source version [Chromium][2] is also getting popularity and some Linux distributions now include it as the default web browser. - -If you use it on desktop a lot, you can improve your browsing experience by using Google Chrome keyboard shortcuts. No need to go up to your mouse and spend time finding your way around. Just master these shortcuts and you’ll even save some time and be more productive. - -I am using the term Google Chrome but these shortcuts are equally applicable to the Chromium browser. - -### 11 Cool Chrome Keyboard shortcuts you should be using - -If you are a pro, you might know a few of these Chrome shortcuts already but the chances are that you may still find some hidden gems here. Let’s see. - -**Keyboard Shortcuts** | **Action** ----|--- -Ctrl+T | Open a new tab -Ctrl+N | Open a new window -Ctrl+Shift+N | Open incognito window -Ctrl+W | Close current tab -Ctrl+Shift+T | Reopen last closed tab -Ctrl+Shift+W | Close the window -Ctrl+Tab and Ctrl+Shift+Tab | Switch to right or left tab -Ctrl+L | Go to search/address bar -Ctrl+D | Bookmark the website -Ctrl+H | Access browsing history -Ctrl+J | Access downloads history -Shift+Esc | Open Chrome task manager - -You can [download this list of useful Chrome keyboard shortcut for quick reference][3]. - -#### 1\. Open a new tab with Ctrl+T - -Need to open a new tab? Just press Ctrl and T keys together and you’ll have a new tab opened. - -#### 2\. Open a new window with Ctrl+N - -Too many tabs opened already? Time to open a fresh new window. Use Ctrl and N keys to open a new browser window. - -#### 3\. Go incognito with Ctrl+Shift+N - -Checking flight or hotel prices online? Going incognito might help. Open an incognito window in Chrome with Ctrl+Shift+N. - -[][4] - -Suggested read  Best Text Editors for Linux Command Line - -#### 4\. Close a tab with Ctrl+W - -Close the current tab with Ctrl and W key. No need to take the mouse to the top and look for the x button. - -#### 5\. Accidentally closed a tab? Reopen it with Ctrl+Shift+T - -This is my favorite Google Chrome shortcut. No more ‘oh crap’ when you close a tab you didn’t mean to. Use the Ctrl+Shift+T and it will open the last closed tab. Keep hitting this key combination and it will keep on bringing the closed tabs. - -#### 6\. Close the entire browser window with Ctrl+Shift+W - -Done with you work? Time to close the entire browser window with all the tabs. Use the keys Ctrl+Shift+W and the browser window will disappear like it never existed. - -#### 7\. Switch between tabs with Ctrl+Tab - -Too many tabs open? You can move to right tab with Ctrl+Tab. Want to move left? Use Ctrl+Shift+Tab. Press these keys repeatedly and you can move between all the open tabs in the current browser window. - -You can also use Ctrl+0 till Ctrl+9 to go to one of the first 10 tabs. But this Chrome keyboard shortcut doesn’t work for the 11th tabs onward. - -#### 8\. Go to the search/address bar with Ctrl+L - -Want to type a new URL or search something quickly. You can use Ctrl+L and it will highlight the address bar on the top. - -#### 9\. Bookmark the current website with Ctrl+D - -Found something interesting? Save it in your bookmarks with Ctrl+D keys combination. - -#### 10\. Go back in history with Ctrl+H - -You can open up your browser history with Ctrl+H keys. Search through the history if you are looking for a page visited some time ago or delete something that you don’t want to be seen anymore. - -#### 11\. See your downloads with Ctrl+J - -Pressing the Ctrl+J keys in Chrome will take you to the Downloads page. This page will show you all the downloads action you performed. - -[][5] - -Suggested read  Get Rid Of Two Google Chrome Icons From Dock In Elementary OS Freya [Quick Tip] - -#### Bonus shortcut: Open Chrome task manager with Shift+Esc - -Many people doesn’t even know that there is a task manager in Chrome browser. Chrome is infamous for eating up your system’s RAM. And when you have plenty of tabs opened, finding the culprit is not easy. - -With Chrome task manager, you can see all the open tabs and their system utilization stats. You can also see various hidden processes such as Chrome extensions and other services. - -![Google Chrome Task Manager][6] - -I am going to this table here for a quick reference. - -### Download Chrome shortcut cheatsheet - -I know that mastering keyboard shortcuts depends on habit and you can make it a habit by using it again and again. To help you in this task, I have created this Google Chrome keyboard shortcut cheatsheet. - -You can download the below image in PDF form, print it and put it on your desk. This way you can use practice the shortcuts all the time. - -![Google Chrome Keyboard Shortcuts Cheat Sheet][7] - -[Download Chrome Shortcut Cheatsheet][8] - -If you are interested in mastering shortcuts, you may also have a look at [Ubuntu keyboard shortcuts][9]. - -By the way, what’s your favorite Chrome shortcut? - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/google-chrome-shortcuts/ - -作者:[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://en.wikipedia.org/wiki/Usage_share_of_web_browsers -[2]: https://www.chromium.org/Home -[3]: tmp.3qZNXSy2FC#download-cheatsheet -[4]: https://itsfoss.com/command-line-text-editors-linux/ -[5]: https://itsfoss.com/rid-google-chrome-icons-dock-elementary-os-freya/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/google-chrome-task-manager.png?resize=800%2C300&ssl=1 -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/google-chrome-keyboard-shortcuts-cheat-sheet.png?ssl=1 -[8]: https://drive.google.com/open?id=1lZ4JgRuFbXrnEXoDQqOt7PQH6femIe3t -[9]: https://itsfoss.com/ubuntu-shortcuts/ diff --git a/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md b/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md new file mode 100644 index 0000000000..5163e269db --- /dev/null +++ b/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (11 Essential Keyboard Shortcuts Google Chrome/Chromium Users Should Know) +[#]: via: (https://itsfoss.com/google-chrome-shortcuts/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Chrome/Chromium 用户必知必会的 11 个基本快捷键 +====== + +> 掌握这些 Google Chrome 键盘快捷键,以获得更好、更流畅、更高效的 Web 浏览体验。还包括可下载的备忘单。 + +无可否认,Google Chrome 是[最受欢迎的网络浏览器][1]。它的开源版本 [Chromium][2] 也越来越受欢迎,现在一些 Linux 发行版将其作为默认的网络浏览器。 + +如果你经常在台式机上使用它,则可以使用 Google Chrome 键盘快捷键来改善浏览体验。没有必要用你的鼠标移来移去、点来点去。只要掌握这些快捷方式,你可以节省一些时间并提高工作效率。 + +我这里使用的名称是 Google Chrome,但是这些快捷方式同样适用于 Chromium 浏览器。 + +### 你应该使用的 11 个酷炫的 Chrome 键盘快捷键 + +如果你是专业人士,则可能已经知道其中一些 Chrome 快捷方式,但是有可能你仍然可以在这里找到一些隐藏的宝石。让我们来看看。 + +**键盘快捷键** | **动作** +---|--- +`Ctrl+T` | 打开一个新标签页 +`Ctrl+N` | 打开一个新窗口 +`Ctrl+Shift+N` | 打开一个新无痕式窗口 +`Ctrl+W` | 关闭当前标签页 +`Ctrl+Shift+T` | 重新打开上一个关闭的标签页 +`Ctrl+Shift+W` | 关闭窗口 +`Ctrl+Tab` 和 `Ctrl+Shift+Tab` | 切换到右侧或左侧的标签页 +`Ctrl+L` | 访问搜索/地址栏 +`Ctrl+D` | 将网址放入书签 +`Ctrl+H` | 访问浏览历史 +`Ctrl+J` | 访问下载历史 +`Shift+Esc` | 打开 Chrome 任务管理器 + +你可以[下载这份有用的 Chrome 键盘快捷键列表来作为快速参考][3]。 + +#### 1、用 `Ctrl+T` 打开一个新标签页 + +需要打开一个新标签页吗?只需同时按 `Ctrl 和 `T`键,你就会打开一个新标签。 + +#### 2、使用 `Ctrl+N` 打开一个新窗口 + +已经打开太多标签页?是时候打开一个新的窗口。使用 `Ctrl` 和 `N` 键打开一个新的浏览器窗口。 + +#### 3、使用 `Ctrl+Shift+N` 隐身 + +在线查询航班或酒店价格?隐身可能会有所帮助。使用 `Ctrl+Shift+N`在 Chrome 中打开一个隐身窗口。 + +#### 4、使用 `Ctrl+W` 关闭标签页 + +使用 `Ctrl` 和 `W` 键关闭当前标签页。无需将鼠标移到顶部并寻找 `x` 按钮。 + +#### 5、不小心关闭了标签页?用 `Ctrl+Shift+T` 重新打开 + +这是我最喜欢的 Google Chrome 浏览器快捷方式。当你关闭了原本不想关的标签页时,就不用再懊悔了。使用 `Ctrl+Shift+T`,它将打开最后一个关闭的选项卡。继续按此组合键,它把关闭的选项卡再次打开。 + +#### 6、使用 `Ctrl+Shift+W` 关闭整个浏览器窗口 + +完成工作了吗?是时候关闭带有所有标签页的整个浏览器窗口了。使用 `Ctrl+Shift+W` 键,浏览器窗口将消失,就像以前不存在一样。 + +#### 7、使用 `Ctrl+Tab` 在标签之间切换 + +打开的标签页太多了吗?你可以使用 `Ctrl+Tab` 移至右侧标签页。想左移吗?使用 `Ctrl+Shift+Tab`。 重复按这些键,你可以在当前浏览器窗口的所有打开的标签页之间移动。 + +你也可以使用 `Ctrl+0` 直到 `Ctrl+9` 转到前 10 个标签页之一。但是此 Chrome 键盘快捷键不适用于第 11 个及更多标签页。 + +#### 8、使用 `Ctrl+L` 转到搜索/地址栏 + +想要输入新的 URL 或快速搜索一些内容。你可以使用 `Ctrl+L,它将在顶部突出显示地址栏。 + +#### 9、用 `Ctrl+D` 收藏当前网站 + +找到了有趣的东西?使用 `Ctrl+D` 组合键将其保存在书签中。 + +#### 10、使用 `Ctrl+H` 返回历史记录 + +你可以使用 `Ctrl+H` 键打开浏览器历史记录。如果你正在寻找前一段时间访问过的页面,或者删除你不想再看到的页面,可以搜索历史记录。 + +#### 11、使用 `Ctrl+J` 查看下载 + +在 Chrome 中按 `Ctrl+J` 键将带你进入下载页面。此页面将显示你执行的所有下载操作。 + +#### 意外惊喜:使用 `Shift+Esc` 打开 Chrome 任务管理器 + +很多人甚至都不知道 Chrome 浏览器中有一个任务管理器。Chrome 以消耗系统内存而臭名昭著。而且,当你打开大量标签时,找到罪魁祸首并不容易。 + +使用 Chrome 任务管理器,你可以查看所有打开的标签页及其系统利用率统计信息。你还可以看到各种隐藏的进程,例如 Chrome 扩展程序和其他服务。 + +![Google Chrome 任务管理器][6] + +### 下载 Chrome 快捷键备忘单 + +我知道掌握键盘快捷键取决于习惯,你可以通过反复使用使其习惯。为了帮助你完成此任务,我创建了此 Google Chrome 键盘快捷键备忘单。 + +![Google Chrome键盘快捷键备忘单][7] + +你可以[下载以下 PDF 格式的图像][8],进行打印并将其放在办公桌上。这样,你可以一直练习快捷方式。 + +如果你对掌握快捷方式感兴趣,还可以查看 [Ubuntu 键盘快捷键][9]。 + +顺便问一下,你最喜欢的 Chrome 快捷方式是什么? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/google-chrome-shortcuts/ + +作者:[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://en.wikipedia.org/wiki/Usage_share_of_web_browsers +[2]: https://www.chromium.org/Home +[3]: tmp.3qZNXSy2FC#download-cheatsheet +[4]: https://itsfoss.com/command-line-text-editors-linux/ +[5]: https://itsfoss.com/rid-google-chrome-icons-dock-elementary-os-freya/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/google-chrome-task-manager.png?w=800&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/google-chrome-keyboard-shortcuts-cheat-sheet.png?ssl=1 +[8]: https://drive.google.com/open?id=1lZ4JgRuFbXrnEXoDQqOt7PQH6femIe3t +[9]: https://itsfoss.com/ubuntu-shortcuts/ From 7801f2438784c099f63e6753094e2c1de46d1a2c Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Fri, 8 Nov 2019 13:44:07 +0100 Subject: [PATCH 386/800] Update 20191104 Fields, records, and variables in awk.md --- sources/tech/20191104 Fields, records, and variables in awk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191104 Fields, records, and variables in awk.md b/sources/tech/20191104 Fields, records, and variables in awk.md index 53d2bb7c55..0c0d18adbf 100644 --- a/sources/tech/20191104 Fields, records, and variables in awk.md +++ b/sources/tech/20191104 Fields, records, and variables in awk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (liwenwensnow) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ff37259c7a787930080e1e6554a7c6b80173eedd Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Fri, 8 Nov 2019 20:56:47 +0800 Subject: [PATCH 387/800] Translating --- sources/tech/20191107 Demystifying Kubernetes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191107 Demystifying Kubernetes.md b/sources/tech/20191107 Demystifying Kubernetes.md index f92934b136..ad3260b0b3 100644 --- a/sources/tech/20191107 Demystifying Kubernetes.md +++ b/sources/tech/20191107 Demystifying Kubernetes.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (Morisun029) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 082dcc2fd693ceb0e1548355a3185832e9964e2b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 23:31:22 +0800 Subject: [PATCH 388/800] PRF --- .../tech/20190801 Linux permissions 101.md | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/translated/tech/20190801 Linux permissions 101.md b/translated/tech/20190801 Linux permissions 101.md index 113d571613..13b6f42785 100644 --- a/translated/tech/20190801 Linux permissions 101.md +++ b/translated/tech/20190801 Linux permissions 101.md @@ -12,11 +12,11 @@ > 知道如何控制用户对文件的访问是一项基本的系统管理技能。 -![Penguins][1] +![](https://img.linux.net.cn/data/attachment/album/201911/08/233101y043rn4ua00r3lqn.jpg) 了解 Linux 权限以及如何控制哪些用户可以访问文件是系统管理的一项基本技能。 -本文将介绍标准 Linux 文件系统权限,并进一步研究特殊权限,以及使用 `umask` 解释默认权限的出处。 +本文将介绍标准 Linux 文件系统权限,并进一步研究特殊权限,以及使用 `umask` 来解释默认权限作为文章的结束。 ### 理解 ls 命令的输出 @@ -61,7 +61,7 @@ drwxrwxrwx. 2 root root 4.0K Mar  4 20:04 testdir * 组 * 所有其他人    -第 2、3 和 4 节涉及用户、组和“其他用户”权限。每个部分都可以包含 `r`(读)、`w`(写)和 `x`(可执行)权限的组合。 +第 2、3 和 4 节涉及用户(属主)、组和“其他用户”权限。每个部分都可以包含 `r`(读取)、`w`(写入)和 `x`(执行)权限的组合。 每个权限还分配了一个数值,这在以八进制表示形式讨论权限时很重要。 @@ -71,7 +71,7 @@ drwxrwxrwx. 2 root root 4.0K Mar  4 20:04 testdir `w` | 2 `x` | 1 -第 5 节描述了其他访问方法,例如 SELinux 或文件访问控制列表(FACL)。 +第 5 节描述了其他替代访问方法,例如 SELinux 或文件访问控制列表(FACL)。 访问方法 | 字符 ---|--- @@ -95,7 +95,7 @@ $ chown root:root foo $ chown root: foo ``` -在用户后跟冒号(`:`)运行该命令将同时设置用户和组所有权。 +在用户名后跟冒号(`:`)运行该命令将同时设置用户和组所有权。 要仅将文件 `foo` 的用户所有权设置为 `root` 用户,请输入: @@ -115,9 +115,9 @@ $ chown :root foo `chmod` 命令可以以八进制(例如 `755`、`644` 等)和符号(例如 `u+rwx`、`g-rwx`、`o=rw`)格式设置权限。 -八进制表示法将 4 个“点”分配给“读取”,将 2 个“点”分配给“写入”,将 1 个点分配给“执行”。如果要给用户(属主)分配“读”权限,则将 4 分配给第一个插槽,但是如果要添加“写”权限,则必须添加 2。如果要添加“执行”,则要添加 1。我们对每种权限类型执行此操作:属主、组和其他。 +八进制表示法将 4 个“点”分配给“读取”,将 2 个“点”分配给“写入”,将 1 个点分配给“执行”。如果要给用户(属主)分配“读取”权限,则将 4 分配给第一个插槽,但是如果要添加“写入”权限,则必须添加 2。如果要添加“执行”,则要添加 1。我们对每种权限类型执行此操作:属主、组和其他。 -例如,如果我们想将 “读取”、“写入”和“执行”分配给文件的属主,但仅将“读取”和“执行”分配给组成员和所有其他用户,则我们应使用 `755`(八进制格式)。这是属主的所有权限位(`4 + 2 + 1`),但组和其他权限的所有权限位只有 `4` 和 `1`(`4 + 1`)。 +例如,如果我们想将“读取”、“写入”和“执行”分配给文件的属主,但仅将“读取”和“执行”分配给组成员和所有其他用户,则我们应使用 `755`(八进制格式)。这是属主的所有权限位(`4+2+1`),但组和其他权限的所有权限位只有 `4` 和 `1`(`4+1`)。 > 细分为:4+2+1=7,4+1=5 和 4+1=5。 @@ -149,11 +149,11 @@ $ chmod o=rw ### 特殊位:设置 UID、设置 GID 和粘滞位 -除了标准权限外,还有一些特殊的权限位,它们具有一些有用的好处。 +除了标准权限外,还有一些特殊的权限位,它们具有一些别的用处。 #### 设置用户 ID(suid) -当在文件上设置 `suid` 时,将以文件的属主的身份而不是运行该文件的用户身份执行操作。一个[好例子][3]是 `passwd` 命令。它需要设置 `suid` 位,以便更改密码的操作具有 root 权限。 +当在文件上设置 `suid` 时,将以文件的属主的身份而不是运行该文件的用户身份执行操作。一个[好的例子][3]是 `passwd` 命令。它需要设置 `suid` 位,以便更改密码的操作具有 root 权限。 ``` $ ls -l /bin/passwd @@ -168,7 +168,7 @@ $ chmod u+s /bin/foo_file_name #### 设置组 ID(sgid) -`sgid` 位与 `suid` 位类似,因为操作是在目录的组所有权下完成的,而不是以运行命令的用户身份。 +`sgid` 位与 `suid` 位类似,操作是在目录的组所有权下完成的,而不是以运行命令的用户身份。 一个使用 `sgid` 的例子是,如果多个用户正在同一个目录中工作,并且目录中创建的每个文件都需要具有相同的组权限。下面的示例创建一个名为 `collab_dir` 的目录,设置 `sgid` 位,并将组所有权更改为 `webdev`。 @@ -189,14 +189,14 @@ $ ls -lah file-sgid #### “粘滞”位 -粘滞位表示只有文件所有者才能删除该文件,即使组权限也允许该文件可以删除。通常,在 `/tmp` 这样的通用或协作目录上,此设置最有意义。在下面的示例中,“所有其他人”权限集的“执行”列中的 `t` 表示已应用粘滞位。 +粘滞位表示,只有文件所有者才能删除该文件,即使组权限允许该文件可以删除。通常,在 `/tmp` 这样的通用或协作目录上,此设置最有意义。在下面的示例中,“所有其他人”权限集的“执行”列中的 `t` 表示已应用粘滞位。 ``` $ ls -ld /tmp drwxrwxrwt. 8 root root 4096 Jun 12 06:07 /tmp/ ``` -请记住,这不会阻止某个人编辑该文件,它只是阻止他们删除该目录的内容。 +请记住,这不会阻止某个人编辑该文件,它只是阻止他们删除该目录的内容(LCTT 译注:即删除目录下文件)。 我们将粘滞位设置为: @@ -220,7 +220,7 @@ $ chmod 1755 #### 大写还是小写? -如果要设置特殊位并看到大写的 `S` 或 `T` 而不是小写的字符(如我们之前所见),那是因为不存在(对应的)底层的执行位。为了说明这一点,下面的示例创建一个设置了粘滞位的文件。然后,我们可以添加和删除执行位以演示大小写更改。 +如果要设置特殊位时看到大写的 `S` 或 `T` 而不是小写的字符(如我们之前所见),那是因为不存在(对应的)底层的执行位。为了说明这一点,下面的示例创建一个设置了粘滞位的文件。然后,我们可以添加和删除执行位以演示大小写更改。 ``` $ touch file cap-ST-demo @@ -262,7 +262,7 @@ ls -l cap-X-file ### 理解 umask -`umask 会屏蔽(或“阻止”)默认权限集中的位,以定义文件或目录的权限。例如,`umask`输出中的 `2` 表示它至少在默认情况下阻止了文件的写入位。 +`umask` 会屏蔽(或“阻止”)默认权限集中的位,以定义文件或目录的权限。例如,`umask`输出中的 `2` 表示它至少在默认情况下阻止了文件的“写入”位。 使用不带任何参数的 `umask` 命令可以使我们看到当前的 `umask` 设置。共有四列:第一列为特殊的`suid`、`sgid` 或粘滞位而保留,其余三列代表属主、组和其他人的权限。 @@ -271,7 +271,7 @@ $ umask 0022 ``` -为了理解这意味着什么,我们可以用 `-S` 标志来执行 `umask`(如下所示)以了解屏蔽位的结果。例如,由于第三列中的值为 `2`,因此将“写入”位从组和其他部分中屏蔽掉了;只能为它们分配“读取”和“执行”。 +为了理解这意味着什么,我们可以用 `-S` 标志来执行 `umask`(如下所示)以解释屏蔽位的结果。例如,由于第三列中的值为 `2`,因此将“写入”位从组和其他部分中屏蔽掉了;只能为它们分配“读取”和“执行”。 ``` $ umask -S @@ -302,7 +302,7 @@ drwxrwxrwx. 2 root root 4096 Jul 17 22:03 dir-umask-000/ ### 总结 -管理员还有许多其他方法可以控制对系统文件的访问。这些权限是 Linux 的基本权限,我们可以在这些基础上进行构建。如果你的工作将你带入 FACL 或 SELinux,你会发现它们也建立在这些文件访问的首要规则之上。 +管理员还有许多其他方法可以控制对系统文件的访问。这些权限是 Linux 的基本权限,我们可以在这些基础上进行构建。如果你的工作为你引入了 FACL 或 SELinux,你会发现它们也建立在这些文件访问的首要规则之上。 -------------------------------------------------------------------------------- From 931de12a7fcf7361c8b1d545bdff1d01148718e3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 8 Nov 2019 23:31:58 +0800 Subject: [PATCH 389/800] PUB @wxy https://linux.cn/article-11553-1.html --- .../tech => published}/20190801 Linux permissions 101.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190801 Linux permissions 101.md (99%) diff --git a/translated/tech/20190801 Linux permissions 101.md b/published/20190801 Linux permissions 101.md similarity index 99% rename from translated/tech/20190801 Linux permissions 101.md rename to published/20190801 Linux permissions 101.md index 13b6f42785..b64c6f314a 100644 --- a/translated/tech/20190801 Linux permissions 101.md +++ b/published/20190801 Linux permissions 101.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11553-1.html) [#]: subject: (Linux permissions 101) [#]: via: (https://opensource.com/article/19/8/linux-permissions-101) [#]: author: (Alex Juarez https://opensource.com/users/mralexjuarezhttps://opensource.com/users/marcobravohttps://opensource.com/users/greg-p) From 8d2dd910b3a7c9169d0ebf04e11d25e88cff5418 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 Nov 2019 08:13:06 +0800 Subject: [PATCH 390/800] PRF @robsean --- ...urce Paint Applications for Linux Users.md | 128 ++++++++---------- 1 file changed, 54 insertions(+), 74 deletions(-) diff --git a/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md b/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md index b8692dcfe9..d7fd3e1431 100644 --- a/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md +++ b/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md @@ -1,80 +1,72 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (6 Open Source Paint Applications for Linux Users) [#]: via: (https://itsfoss.com/open-source-paint-apps/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) -面向 Linux 用户的6款开源绘图应用程序 +6 款面向 Linux 用户的开源绘图应用程序 ====== -小时候,当我开始使用计算机(使用 Windows XP)时,我最喜欢的应用程序是 Paint。我在它上面花费数小时涂鸦。出乎意料,孩子们仍然喜欢 paint 应用程序。不仅仅是孩子们,简单是 paint 应用程序,在很多情况下都能派上用场。 +小时候,当我开始使用计算机(在 Windows XP 中)时,我最喜欢的应用程序是微软的“画图”。我能在它上面涂鸦数个小时。出乎意料,孩子们仍然喜欢这个“画图”应用程序。不仅仅是孩子们,这个简单的“画图”应用程序,在很多情况下都能派上用场。 -你将找到一堆可以让你绘制/绘图或操作图片的应用程序。然而,其中一些是专有的。既然你是一名 Linux 用户 - 为什么不聚焦在开源绘图应用程序上呢? +你可以找到一堆可以让你绘制/绘图或操作图片的应用程序。然而,其中一些是专有软件。既然你是一名 Linux 用户,为什么不关注一下开源绘图应用程序呢? -在这篇文章中,我们将列出一些最好的开源绘图应用程序,在 Linux 上,它们有替换专有绘图软件的价值。 +在这篇文章中,我们将列出一些最好的开源绘图应用程序,它们可以替代可用于 Linux 的专有绘画软件。 ### 开源绘图 & 绘制应用程序 ![][1] -**注意:** _该列表没有特别的排名顺序,_ +**注意:** 该列表没有特别的排名顺序。 -#### 1\. Pinta +#### 1、Pinta ![][2] 主要亮点: - * Paint.NET / MS Paint 的极好替代品 - * 附加组件支持 (也支持 WebP 图片) - * 图层支持 + * Paint.NET / 微软“画图”的极好替代品 + * 支持附加组件(有对 WebP 图像的支持) + * 支持图层 +[Pinta][3] 是一款令人赞叹的开源绘图应用程序,非常适合绘图和简单的图片编辑。换句话说,它是一款具有精美功能的简单绘图应用程序。 +你可以将 [Pinta][4] 视为 Linux 上的“画图”的一个替代品,但是带有图层支持等等。不仅仅是“画图”,它也可以替代 Windows 上的 Paint.NET。尽管 Paint.NET 更好一些,但 Pinta 似乎是个不错的选择。 -[Pinta][3] 是一款令人赞叹的开源绘图应用程序,非常适合绘图和简单的图片编辑。换句话说,它是一款简单的带有绚丽特色的绘图应用程序。 +几个附加组件可以用于增强功能,例如[在 Linux 上支持 WebP 图像][5]。除了图层支持之外,你还可以轻松地调整图片大小、添加特效、进行调整(亮度、对比度等等),以及在导出图片时调整其质量。 -你可以考虑把 [Pinta][4] 作为 Linux 上的 MS Paint 的一个替代品 – 但是带有图层支持等等。不仅仅是 MS Paint,它也可以作为 Windows 上可以使用的Paint.NET 的一个 Linux 替代品。尽管 Paint.NET 更好一些 – Pinta 似乎是个不错的选择。 +##### 如何安装 Pinta ? -几个附件可以用于增强功能,像 [在 Linux 上支持 WebP 图片][5]。另外,图层支持,你可以简单地调整图片大小,添加特效,进行调整(亮度,对比度等等),以及在导出图片时调整其质量。 +你应该能够在软件中心/应用程序中心/软件包管理器中简单地找到它。只需要输入 “Pinta”,并开始安装它。要么也可以尝试 [Flatpak][6] 软件包。 -#### 如何安装 Pinta ? - -你应该能够在软件中心/应用程序中心/软件包管理器中简单地找到它。只需要输入 “**Pinta**” ,并开始安装它。无论哪种情况,尝试 [Flatpak][6] 软件包。 - -或者,你可以在终端中输入下面的命令 (Ubuntu/Debian): +或者,你可以在终端中输入下面的命令(Ubuntu/Debian): ``` sudo apt install pinta ``` -下载软件包和安装指南的更多信息,参考[官方下载页面][7]. +下载软件包和安装指南的更多信息,参考[官方下载页面][7]。 -#### 2\. Krita +#### 2、Krita ![][8] 主要亮点: * HDR 绘图 - * PSD 支持 - * 图层支持 + * 支持 PSD + * 支持图层 * 笔刷稳定器 * 二维动画 +Krita 是 Linux 上最高级的开源绘图应用程序之一。当然,对于本文而言,它可以帮助你绘制草图和在画布上胡写乱画。除此之外,它还提供很多功能。 +例如,如果你的手有点颤抖,它可以帮助你稳定笔刷的笔划。你可以使用内置的矢量工具来创建漫画画板和其它有趣的东西。如果你正在寻找具有全面的颜色管理支持、绘图助理和图层管理的软件,Krita 应该是你最好的选择。 -Krita 是 Linux 上最高级的开源绘图应用程序之一。当然,对于本文,它帮助你绘制草图和在画布上造成破坏。除此之外,它还提供很多特色。 - -[][9] - -建议在安装 Fedora 24后阅读要做的事情 - -例如,如果你有一只颤抖的手,它可以帮助你稳定笔刷的笔划。你可以使用内置的矢量工具来创建漫画面板和其它有趣的东西。如果你正在寻找一个成熟的颜色管理支持,绘图助理和图层管理,Krita 应该是你最好的选择。 - -#### 如何安装 Krita ? +##### 如何安装 Krita ? 类似于 pinta,你可以在软件中心/应用程序中心或软件包管理器的列表中找到它。它也可以 [Flatpak 存储库][10]中找到。 @@ -84,11 +76,11 @@ Krita 是 Linux 上最高级的开源绘图应用程序之一。当然,对于 sudo apt install krita ``` -无论哪种情况,你可以前往它们的[官方下载页面][11]来获取 **AppImage** 文件并运行它。 +要么你也可以前往它们的[官方下载页面][11]来获取 AppImage 文件并运行它。 -如果你对 AppImage 文件一无所知,查看我们的指南 – [如何使用 AppImage][12] 。 +如果你对 AppImage 文件一无所知,查看我们的指南 —— [如何使用 AppImage][12]。 -#### 3\. Tux Paint +#### 3、Tux Paint ![][13] @@ -96,11 +88,9 @@ sudo apt install krita * 给儿童用的一个简单直接的绘图应用程序 +我不是开玩笑,对于 3-12 岁儿童来说,Tux Paint 是最好的开源绘图应用程序之一。当然,当你只想乱画时,那无需选择,所以,在这种情况下,Tux Paint 似乎是最好的选择(即使是成年人!)。 - -我不是儿童,对于3-12岁儿童来说,Tux Paint 是最好的开源绘图应用程序之一。当然,当你只想乱画时,你不需要选择。所以,在这种情况下,Tux Paint 似乎是最好的选择(即使是成年人!). - -#### 如何安装 Tuxpaint ? +##### 如何安装 Tuxpaint ? Tuxpaint 可以从软件中心或软件包管理器下载。无论哪种情况,在 Ubuntu/Debian 上安装它,在终端中输入下面的命令: @@ -110,87 +100,77 @@ sudo apt install tuxpaint 关于它的更多信息,前往[官方站点][14]。 -#### 4\. Drawpile +#### 4、Drawpile ![][15] 主要亮点: * 协同绘制 - * 内置聊天功能,与其他用户互动 + * 内置聊天功能,可与其他用户互动 * 图层支持 * 记录绘制会话 +Drawpile 是一个有趣的开源绘图应用程序,在该程序中,你可以与其他用户实时协作。确切地说,你们可以单个画布中同时绘制。除了这个独特的功能,它还有图层支持、记录绘制会话的能力,甚至还有与协作用户进行交互的聊天功能。 +你可以主持或加入一个公共会话,或通过一个密码与你的朋友建立私有会话。默认情况下,服务器将是你的计算机,但是如果你需要远程服务器那也可以。 -Drawpile 是一个有趣的开源绘图应用程序,在程序中,你可以与其他用户实时协作。准确地说,你们可以单个画布中同时绘制。除了这个独特的功能,你还有图层支持,记录绘制会话的能力,甚至一个聊天工具来与其他协作用户交互。 +注意,你将需要[注册一个 Drawpile 账户][16] 才能进行协作。 -你可以主办/加入一个公共会话,或使用一个代码与你的朋友一起开始一个私有会话。默认情况下,服务器将是你的计算机。但是,如果你需要远程服务器,你也可以选择它。 +##### 如何安装 Drawpile ? -注意,你将需要[注册一个 Drawpile 账户][16] 以便于协作。 +据我所知,你只能在 [Flatpak 存储库][17]的列表中找到它。 -#### 如何安装 Drawpile ? - -据我所知,你只能在As far as I’m aware of, you can only find it listed in the [Flatpak 存储库][17]的列表中找到它。 - -[][18] - -建议阅读 OCS 商店:一站式商店,满足你所有的 Linux 软件定制需求 - -#### 5\. MyPaint +#### 5、MyPaint ![][19] 主要亮点: - * 给数码画家的易用工具 - * 图层管理支持 - * 很多选项来微调你的画笔和绘制 + * 易用的数码画家工具 + * 支持图层管理 + * 很多微调你的画笔和绘制的选项 +对于数码画家来说,[MyPaint][20] 是一个简单而强大的工具。它具有许多选项,可以调整以制作出完美的数字画笔笔触。我不是一个数字艺术家(但我是一个涂鸦者),但是我注意到有很多调整笔刷、颜色的选项,和一个添加中间结果暂存器面板的选项。 +它也支持图层管理,也许你需要它。最新的稳定版本已经有几年没有更新了,但是当前的 alpha 构建版本(我测试过)运行良好。如果你正在 Linux 上寻找一个开源绘图应用程序 —— 试试这个。 -对于数码画家来说,[MyPaint][20] 是一个简单但强大的工具。它以很多选项来调整为特色,以便于使数字笔刷笔划轻触。我不是一个数字艺术家(但我是一个涂鸦者),但是我注意到很多来调整笔刷,颜色的选项,和一个来添加中间结果暂存器面板的选项。 +##### 如何安装 MyPaint ? -它也支持图层管理 – 也许你需要它。已经有好几年没有更新最新的稳定版本,但是当前的 alpha 构建版本(我测试过)运行的很好。如果你正在 Linux 上寻找一个开源绘图应用程序 – 试试这个。 - -#### 如何安装 MyPaint ? - -MyPaint 在官方存储库中可获得。然而,这是老旧的版本。如果你仍然想继续,你可以在软件中心搜索它,或在终端中输入下面的命令: +MyPaint 可在官方存储库中获得。然而,这是老旧的版本。如果你仍然想继续,你可以在软件中心搜索它,或在终端中输入下面的命令: ``` sudo apt install mypaint ``` -你可以前往它的官方 [GitHub 发布页面][21]获取最新的 alpha 构建版本,和获取 [AppImage 文件][12] (任意版本) 来使它可执行并启动应用程序。 +你可以前往它的官方 [GitHub 发布页面][21]获取最新的 alpha 构建版本,获取 [AppImage 文件][12](任意版本)并使它可执行并启动应用程序。 -#### 6\. KolourPaint +#### 6、KolourPaint ![][22] 主要亮点: - * 在 Linux 上的一个 MS Paint 简单替代 + * 一个 Linux 上的“画图”的简单替代品 * 不支持图层管理 +如果你不需要任何图层管理的支持,而只是想要一个开源绘图应用程序来绘制东西 —— 那就是它了。 +[KolourPaint][23] 最初是为 KDE 桌面环境定制的,但是它在其它的桌面环境中也能完美地工作。 -如果你制作寻找不支持任何图层管理,只需要一个开源绘图应用程序来绘制东西 – 它就是这个。 +##### 如何安装 KolourPaint ? -[KolourPaint][23] 最初为 KDE 桌面环境定制,但是它在其它的桌面环境中也完美地工作。 - -#### 如何安装 KolourPaint ? - -你可以从软件中心安装 KolourPaint ,或通过终端使用下面的命令: +你可以从软件中心安装 KolourPaint,或通过终端使用下面的命令: ``` sudo apt install kolourpaint4 ``` -无论哪种情况,你都可以使用 [Flathub][24] 。 +你总可以试试 [Flathub][24]。 -**总结** +### 总结 -如果你在考虑如 GIMP/Inkscape 这样的应用程序, 我们在另一篇关于[给数码艺术家的最好 Linux 工具][25]的文章中列出。如果你对更多的选项好奇,我建议你去查看它。 +如果你在考虑如 GIMP/Inkscape 这样的应用程序,我们在另一篇关于[给数码艺术家的最好 Linux 工具][25]的文章中列出。如果你对更多的选择好奇,我建议你去查看它。 在这里,我们尝试编写一份 Linux 可用的最佳开源绘图应用程序列表。如果你认为我们错过一些东西,请在下面的评论区告诉我们! @@ -201,7 +181,7 @@ via: https://itsfoss.com/open-source-paint-apps/ 作者:[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 b5dfee20c393445e96cf656b243d97d2b09df5df Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 Nov 2019 08:13:50 +0800 Subject: [PATCH 391/800] PUB @robsean https://linux.cn/article-11554-1.html --- ...190906 6 Open Source Paint Applications for Linux Users.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190906 6 Open Source Paint Applications for Linux Users.md (99%) diff --git a/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md b/published/20190906 6 Open Source Paint Applications for Linux Users.md similarity index 99% rename from translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md rename to published/20190906 6 Open Source Paint Applications for Linux Users.md index d7fd3e1431..72eecbff38 100644 --- a/translated/tech/20190906 6 Open Source Paint Applications for Linux Users.md +++ b/published/20190906 6 Open Source Paint Applications for Linux Users.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11554-1.html) [#]: subject: (6 Open Source Paint Applications for Linux Users) [#]: via: (https://itsfoss.com/open-source-paint-apps/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 04fd09d27adbbe9f76c532346670ea47d6eeb812 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 Nov 2019 21:42:17 +0800 Subject: [PATCH 392/800] PRF --- ...s Google Chrome-Chromium Users Should Know.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md b/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md index 5163e269db..23178a68ad 100644 --- a/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md +++ b/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (11 Essential Keyboard Shortcuts Google Chrome/Chromium Users Should Know) @@ -12,6 +12,8 @@ Chrome/Chromium 用户必知必会的 11 个基本快捷键 > 掌握这些 Google Chrome 键盘快捷键,以获得更好、更流畅、更高效的 Web 浏览体验。还包括可下载的备忘单。 +![](https://img.linux.net.cn/data/attachment/album/201911/09/214207wh96q76ejacnn5as.png) + 无可否认,Google Chrome 是[最受欢迎的网络浏览器][1]。它的开源版本 [Chromium][2] 也越来越受欢迎,现在一些 Linux 发行版将其作为默认的网络浏览器。 如果你经常在台式机上使用它,则可以使用 Google Chrome 键盘快捷键来改善浏览体验。没有必要用你的鼠标移来移去、点来点去。只要掌握这些快捷方式,你可以节省一些时间并提高工作效率。 @@ -20,7 +22,7 @@ Chrome/Chromium 用户必知必会的 11 个基本快捷键 ### 你应该使用的 11 个酷炫的 Chrome 键盘快捷键 -如果你是专业人士,则可能已经知道其中一些 Chrome 快捷方式,但是有可能你仍然可以在这里找到一些隐藏的宝石。让我们来看看。 +如果你是专业人士,可能已经知道其中一些 Chrome 快捷方式,但是有可能你仍然可以在这里找到一些隐藏的宝石。让我们来看看。 **键盘快捷键** | **动作** ---|--- @@ -41,7 +43,7 @@ Chrome/Chromium 用户必知必会的 11 个基本快捷键 #### 1、用 `Ctrl+T` 打开一个新标签页 -需要打开一个新标签页吗?只需同时按 `Ctrl 和 `T`键,你就会打开一个新标签。 +需要打开一个新标签页吗?只需同时按 `Ctrl` 和 `T` 键,你就会打开一个新标签。 #### 2、使用 `Ctrl+N` 打开一个新窗口 @@ -49,7 +51,7 @@ Chrome/Chromium 用户必知必会的 11 个基本快捷键 #### 3、使用 `Ctrl+Shift+N` 隐身 -在线查询航班或酒店价格?隐身可能会有所帮助。使用 `Ctrl+Shift+N`在 Chrome 中打开一个隐身窗口。 +在线查询航班或酒店价格?隐身可能会有所帮助。使用 `Ctrl+Shift+N` 在 Chrome 中打开一个隐身窗口。 #### 4、使用 `Ctrl+W` 关闭标签页 @@ -65,13 +67,13 @@ Chrome/Chromium 用户必知必会的 11 个基本快捷键 #### 7、使用 `Ctrl+Tab` 在标签之间切换 -打开的标签页太多了吗?你可以使用 `Ctrl+Tab` 移至右侧标签页。想左移吗?使用 `Ctrl+Shift+Tab`。 重复按这些键,你可以在当前浏览器窗口的所有打开的标签页之间移动。 +打开的标签页太多了吗?你可以使用 `Ctrl+Tab` 移至右侧标签页。想左移吗?使用 `Ctrl+Shift+Tab`。重复按这些键,你可以在当前浏览器窗口的所有打开的标签页之间移动。 你也可以使用 `Ctrl+0` 直到 `Ctrl+9` 转到前 10 个标签页之一。但是此 Chrome 键盘快捷键不适用于第 11 个及更多标签页。 #### 8、使用 `Ctrl+L` 转到搜索/地址栏 -想要输入新的 URL 或快速搜索一些内容。你可以使用 `Ctrl+L,它将在顶部突出显示地址栏。 +想要输入新的 URL 或快速搜索一些内容。你可以使用 `Ctrl+L`,它将在顶部突出显示地址栏。 #### 9、用 `Ctrl+D` 收藏当前网站 @@ -112,7 +114,7 @@ via: https://itsfoss.com/google-chrome-shortcuts/ 作者:[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 93b2d550038face0a041a134830e54deeab137ea Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 Nov 2019 21:42:50 +0800 Subject: [PATCH 393/800] PUB @wxy https://linux.cn/article-11556-1.html --- ...oard Shortcuts Google Chrome-Chromium Users Should Know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md (98%) diff --git a/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md b/published/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md similarity index 98% rename from translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md rename to published/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md index 23178a68ad..b7d6d63551 100644 --- a/translated/tech/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md +++ b/published/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11556-1.html) [#]: subject: (11 Essential Keyboard Shortcuts Google Chrome/Chromium Users Should Know) [#]: via: (https://itsfoss.com/google-chrome-shortcuts/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 3a9a72c9d6665123fd5b4fdcb3ff4de2fe32e713 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 Nov 2019 23:33:17 +0800 Subject: [PATCH 394/800] PRF --- ...w to dual boot Windows 10 and Debian 10.md | 193 +++++++++--------- 1 file changed, 97 insertions(+), 96 deletions(-) diff --git a/translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md b/translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md index 37b59370ec..c7975f6c52 100644 --- a/translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md +++ b/translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md @@ -1,206 +1,207 @@ [#]: collector: (lujun9972) [#]: translator: (wenwensnow) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to dual boot Windows 10 and Debian 10) [#]: via: (https://www.linuxtechi.com/dual-boot-windows-10-debian-10/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) -如何拥有一个Windows 10 和 Debian 10 的双系统 +如何拥有一个 Windows 10 和 Debian 10 的双系统 ====== -所以,在无数次劝说自己后,你终于做出了一个大胆的决定,试试**Linux**。 不过,在完全熟悉Linux之前,你依旧需要使用Windows 10系统。幸运的是,通过一个双系统引导设置,能让你在启动时,选择自己想要进入的系统。在这个指南中,你会看到如何 **如何双重引导Windows 10 和 Debian 10**. +在无数次劝说自己后,你终于做出了一个大胆的决定,试试 Linux。不过,在完全熟悉 Linux 之前,你依旧需要使用 Windows 10 系统。幸运的是,通过一个双系统引导设置,能让你在启动时,选择自己想要进入的系统。在这个指南中,你会看到如何 如何双重引导 Windows 10 和 Debian 10。 -[![如何拥有一个Windows 10 和 Debian 10 的双系统][1]][2] +![如何拥有一个 Windows 10 和 Debian 10 的双系统][2] ### 前提条件 在开始之前,确保你满足下列条件: - * 一个Debian10 的可引导USB或DVD - * 一个快速且稳定的网络 (为了安装更新 & 以及第三方软件) + * 一个 Debian 10 的可引导 USB 或 DVD + * 一个快速且稳定的网络(为了安装更新以及第三方软件) -另外,记得注意你系统的引导策略(UEFI 或Legacy), 需要确保两个系统使用同一种引导模式。 +另外,记得注意你系统的引导策略(UEFI 或 Legacy),需要确保两个系统使用同一种引导模式。 ### 第一步:在硬盘上创建一个空余分区 -第一步,你需要在你的硬盘上创建一个空余分区。之后,这将是我们安装Debian系统的地方。为了实现这一目的,需要使用下图所示的磁盘管理器: +第一步,你需要在你的硬盘上创建一个空余分区。之后,这将是我们安装 Debian 系统的地方。为了实现这一目的,需要使用下图所示的磁盘管理器: -同时按下 **Windows + R键**,启动运行程序。接下来,输入 **diskmgmt.msc** ,按 **回车键** +同时按下 `Windows + R` 键,启动“运行程序”。接下来,输入 `diskmgmt.msc`,按回车键。 -[![Launch-Run-dialogue][1]][3] +![启动“运行程序”][3] -这会启动 **磁盘管理器**窗口,它会显示你Windows 上所有已有磁盘。 +这会启动“磁盘管理”窗口,它会显示你 Windows 上所有已有磁盘。 -[![Disk-management][1]][4] +![磁盘管理][4] -接下来,你需要为Debian安装创建空余空间。为此,你需要压缩其中一个磁盘的空间,从而创建一个未分配的新分区。在这个例子里,我会从 D 盘中创建一个 **30 GB** 的新分区。 +接下来,你需要为安装的 Debian 系统创建空余空间。为此,你需要缩小其中一个磁盘(卷)上的分区,从而创建一个未分配的新分区。在这个例子里,我会从 D 盘中创建一个 30 GB 的新分区。 -为了压缩一个卷,右键点击它,然后选中选项 ‘**压缩**’ +为了缩小一个卷,右键点击它,然后选中选项 “缩小Shrink volume...”。 -[![压缩卷][1]][5] +![缩小卷][5] -在弹出窗口中,定义你想压缩的空间大小。记住,这是将来要安装Debian 10的磁盘空间。我选择了 **30000MB ( 大约 30 GB)** 。 压缩完成后,点击‘**压缩**’. +在弹出窗口中,定义你想缩小的空间大小。记住,这是将来要安装 Debian 10 的磁盘空间。我选择了 30000MB(大约 30 GB)。压缩完成后,点击“缩小Shrink”。 -[![Shrink-space][1]][6] +![缩小空间][6] -在压缩操作结束后,你会看到一个如下图所示的未分配分区: +在缩小操作结束后,你会看到一个如下图所示的未分配分区: -[![未分配分区][1]][7] +![未分配分区][7] -完美! 现在可以准备开始安装了。 +完美!现在可以准备开始安装了。 -### 第二步:开始安装Debian 10 +### 第二步:开始安装 Debian 10 -空余分区已经创建好了,将你的可引导USB或安装DVD插入电脑,重新启动系统。 记得更改 **BIOS** 中的**引导顺序**,需要在启动时按住功能键(通常,根据品牌不同,是**F9, F10 或 F12** 中的某一个)。 这一步骤,对系统是否能进入安装媒体来说,至关重要。保存 BIOS 设置,并重启电脑。 +空余分区已经创建好了,将你的可引导 USB 或安装 DVD 插入电脑,重新启动系统。记得更改 BIOS 中的引导顺序,需要在启动时按住功能键(通常,根据品牌不同,是 `F9`、`F10` 或 `F12` 中的某一个)。 这一步骤,对系统是否能进入安装媒体来说,至关重要。保存 BIOS 设置,并重启电脑。 -如下图所示,界面会显示一个新的引导菜单:点击 ‘**Graphical install**’ -[![图形化界面安装][1]][8] +如下图所示,界面会显示一个新的引导菜单:点击 “Graphical install”。 -下一步,选择你的 **偏好语言** ,然后点击 ‘**继续**’ -[![设置语言-Debian10][1]][9] +![图形化界面安装][8] -接着,选择你的 **地区** ,点击‘**继续**’。 根据地区,系统会自动选择当地对应的时区。 如果你无法找到你所对应的地区,将界面往下拉, 点击‘**其他**’后,选择相对应位置。 +下一步,选择你的偏好语言,然后点击 “继续Continue”。 -[![选择地区-Debain10][1]][10] +![设置语言-Debian10][9] -而后,选择你的 **keyboard** 布局。 +接着,选择你的地区,点击“继续Continue”。 根据地区,系统会自动选择当地对应的时区。如果你无法找到你所对应的地区,将界面往下拉, 点击“其他Other”后,选择相对应位置。 -[![设置键盘-Debain10][1]][11] +![选择地区-Debain10][10] -接下来,设置系统的 **主机名** ,点击 ‘**继续**’ +而后,选择你的键盘布局。 -[![Set-hostname-Debian10][1]][12] +![设置键盘-Debain10][11] -下一步,确定 **域名**。如果你的电脑不在域中,直接点击 ‘**继续**’按钮。 +接下来,设置系统的主机名,点击 “继续Continue”。 -[![设置域名-Debian10][1]][13] +![Set-hostname-Debian10][12] -然后,如图所示,设置 **root 密码**,点击 ‘**继续**’ +下一步,确定域名。如果你的电脑不在域中,直接点击 “继续Continue”按钮。 -[![设置root 密码-Debian10][1]][14] +![设置域名-Debian10][13] -下一步骤,设置账户的用户全名,点击 ‘**继续**’ +然后,如图所示,设置 root 密码,点击 “继续Continue”。 -[![设置用户全名-debain10][1]][15] +![设置 root 密码-Debian10][14] -接着,通过设置 **username** 来确定此账户显示时的用户名 +下一步骤,设置账户的用户全名,点击 “继续Continue”。 -[![Specify-username-Debian10][1]][16] +![设置用户全名-debain10][15] -下一步,设置用户密码, 点击‘**继续**’ +接着,设置与此账户相关联的用户名。 -[![设置用户密码-Debian10][1]][17] +![Specify-username-Debian10][16] -然后,设置**时区** +下一步,设置用户密码,点击“继续Continue”。 -[![设置时区-Debian10][1]][18] +![设置用户密码-Debian10][17] -这时,你要为Debian10安装创建分区。如果你是新手用户,点击菜单中的第一个选项, ‘**使用最大的连续空余空间**,点击‘**继续**’. +然后,设置时区。 -[![Use-largest-continuous-free-space-debian10][1]][19] +![设置时区-Debian10][18] -不过,如果你对创建分区有所了解的话,选择‘**手动**’ 选项,点击 ‘**继续**’ +这时,你要为 Debian10 安装创建分区。如果你是新手用户,点击菜单中的第一个选项,“使用最大的连续空余空间Use the largest continuous free space”,点击“继续Continue”。 -[![选择手动-Debain10][1]][20] +![使用最大的连续空余空间-debian10][19] -接着,选择被标记为 ‘**空余空间**’ 的磁盘, 点击‘**继续**’ 。接下来,点击‘**创建新分区**’ +不过,如果你对创建分区有所了解的话,选择“手动Manual” 选项,点击 “继续Continue”。 -[![创建新分区-Debain10][1]][21] +![选择手动-Debain10][20] +接着,选择被标记为 “空余空间FREE SPACE” 的磁盘,点击 “继续Continue” 。接下来,点击“创建新分区Create a new partition”。 -下一界面,首先确定swap空间大小。我的swap大小为**2GB**,点击 **继续**。 +![创建新分区-Debain10][21] -[![确定swap大小-debian10][1]][22] +下一界面,首先确定交换空间大小。我的交换空间大小为 2GB,点击 “继续Continue”。 -点击下一界面的 ‘’**Primary**’ , 点击‘**继续**’ +![确定交换空间大小-debian10][22] -[![磁盘主分区-Debian10][1]][23] +点击下一界面的 “主分区Primary”,点击“继续Continue”。 -选择在磁盘**初始位置创建新分区**后,点击继续. +![磁盘主分区-Debian10][23] -[![在初始位置创建-Debain10][1]][24] +选择在磁盘 “初始位置beginning” 创建新分区后,点击继续。 -选择**Ext 4 日志文件系统** ,点击 ‘**继续**’ +![在初始位置创建-Debain10][24] -[![选择Ext4日志文件系统-debain10][1]][25] +选择 “Ext 4 日志文件系统Ext 4 journaling file system”,点击 “继续Continue”。 -下个界面选择 **swap** ,点击继续 +![选择 Ext4 日志文件系统-debain10][25] -[![选择swap-debian10][1]][26] +下个界面选择“交换空间swap space” ,点击 “继续Continue”。 -选中 **完成此分区设置** ,点击继续。 +![选择交换空间-debian10][26] -[!完成此分区设置-debian10][1]][27] +选中 “完成此分区设置done setting the partition”,点击 “继续Continue”。 -返回 **磁盘分区** 界面, 点击**空余空间** ,点击继续 +![完成此分区设置-debian10][27] -[![点击空余空间-Debain10][1]][28] +返回磁盘分区界面,点击 “空余空间FREE SPACE”,点击 “继续Continue”。 -为了让自己能轻松一点,选中**自动为空余空间分区** 后,点击 **继续**. +![点击空余空间-Debain10][28] -[![自动为空余空间分区-Debain10][1]][29] +为了让自己能轻松一点,选中 “自动为空余空间分区Automatically partition the free space”后,点击 “继续Continue”。 -接着点击 **将所有文件存储在同一分区 (新手用户推荐)** +![自动为空余空间分区-Debain10][29] -[![将所有文件存储在同一分区-debian10][1]][30] +接着点击 “将所有文件存储在同一分区(新手用户推荐)All files in one partition (recommended for new users)” -最后, 点击**完成分区设置,并将改动写入磁盘** ,点击 **继续**. +![将所有文件存储在同一分区-debian10][30] -[![完成分区设置,并将改动写入磁盘][1]][31] +最后, 点击 “完成分区设置,并将改动写入磁盘Finish partitioning and write changes to disk” ,点击 “继续Continue”。 -确定你要将改动写入磁盘,点击‘**Yes**’ +![完成分区设置,并将改动写入磁盘][31] -[![将改动写入磁盘-Debian10][1]][32] +确定你要将改动写入磁盘,点击 “Yes”。 + +![将改动写入磁盘-Debian10][32] 而后,安装程序会开始安装所有必要的软件包。 -当系统询问是否要扫描其他CD时,选择 **No** ,并点击继续 +当系统询问是否要扫描其他 CD 时,选择 “No” ,并点击 “继续Continue”。 -[![扫描其他CD-No-Debain10][1]][33] +![扫描其他CD-No-Debain10][33] -接着,选择离你最近的镜像站点地区,点击 ‘继续’ +接着,选择离你最近的镜像站点地区,点击 “继续Continue”。 -[![Debian-镜像站点-国家][1]][34] +![Debian-镜像站点-国家][34] -然后,选择最适合你的镜像站点,点击‘**继续**’ +然后,选择最适合你的镜像站点,点击“继续Continue”。 -[![选择镜像站点][1]][35] +![选择镜像站点][35] -如果你打算使用代理服务器,在下面输入具体信息,没有的话就留空,点击‘继续’ +如果你打算使用代理服务器,在下面输入具体信息,没有的话就留空,点击 “继续Continue”。 -[![输入代理信息-debian10][1]][36] +![输入代理信息-debian10][36] -随着安装进程的继续, 你会被问到,是否想参加一个**软件包用途调查**。 你可以选择任意一个选项,之后点击‘继续’ .我选择了‘**否**’。 +随着安装进程的继续, 你会被问到,是否想参加一个软件包用途调查。你可以选择任意一个选项,之后点击“继续Continue”,我选择了“No”。 -[![参与调查-debain10][1]][37] +![参与调查-debain10][37] -在 **软件选择** 窗口选中你想安装的软件包,点击**继续**. +在软件选择窗口选中你想安装的软件包,点击“继续Continue”。 -[![软件选择-debian10][1]][38] +![软件选择-debian10][38] 安装程序会将选中的软件一一安装,在这期间,你可以去喝杯咖啡休息一下。 -系统将会询问你,是否要将 grub 的**引导装载程序** 安装到 **主引导记录表 (MBR)** 上。点击 **Yes**,而后点击 **继续**. +系统将会询问你,是否要将 grub 的引导装载程序安装到主引导记录表(MBR)上。点击 “Yes”,而后点击 “继续Continue”。 -[![安装-grub-bootloader-debian10][1]][39] +![安装-grub-bootloader-debian10][39] -接着,选中你想安装**grub** 的硬盘,点击**继续** +接着,选中你想安装 grub 的硬盘,点击“继续Continue”。 -[![选择硬盘-安装grub-Debian10][1]][40] +![选择硬盘-安装 grub-Debian10][40] -最后, 安装完成,直接点击 ‘**继续**’ 按钮 +最后,安装完成,直接点击 “继续Continue”。 -[![安装完成-重新启动-debian10][1]][41] +![安装完成-重新启动-debian10][41] -你现在应该会有一个列出**Windows** 和**Debian** 的grub 菜单。 为了引导Debian系统,往下选择Debian。之后,你就能看见登录界面。输入密码之后,点击回车键。 +你现在应该会有一个列出 Windows 和 Debian 的 grub 菜单。为了引导 Debian 系统,往下选择 Debian。之后,你就能看见登录界面。输入密码之后,按回车键。 -[![Debian10-登录][1]][42] +![Debian10-登录][42] -这就完成了!这样,你就拥有了一个全新的Debian 10 和Windows 10双系统。 +这就完成了!这样,你就拥有了一个全新的 Debian 10 和 Windows 10 双系统。 -[![Debian10-Buster-Details][1]][43] +![Debian10-Buster-Details][43] -------------------------------------------------------------------------------- @@ -208,8 +209,8 @@ via: https://www.linuxtechi.com/dual-boot-windows-10-debian-10/ 作者:[James Kiarie][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[wenwensnow](https://github.com/wenwensnow) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a3566620c495ed5820c212d4a261db1421d36840 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 Nov 2019 23:33:54 +0800 Subject: [PATCH 395/800] PUB @wenwensnow https://linux.cn/article-11557-1.html --- .../20191023 How to dual boot Windows 10 and Debian 10.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191023 How to dual boot Windows 10 and Debian 10.md (99%) diff --git a/translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md b/published/20191023 How to dual boot Windows 10 and Debian 10.md similarity index 99% rename from translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md rename to published/20191023 How to dual boot Windows 10 and Debian 10.md index c7975f6c52..d19b937032 100644 --- a/translated/tech/20191023 How to dual boot Windows 10 and Debian 10.md +++ b/published/20191023 How to dual boot Windows 10 and Debian 10.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wenwensnow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11557-1.html) [#]: subject: (How to dual boot Windows 10 and Debian 10) [#]: via: (https://www.linuxtechi.com/dual-boot-windows-10-debian-10/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) From 8da1bf393cd283b9a776c2b8272d2b4f7a0ce003 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 9 Nov 2019 23:47:29 +0800 Subject: [PATCH 396/800] PRF --- .../20191023 How to dual boot Windows 10 and Debian 10.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/published/20191023 How to dual boot Windows 10 and Debian 10.md b/published/20191023 How to dual boot Windows 10 and Debian 10.md index d19b937032..b50292a234 100644 --- a/published/20191023 How to dual boot Windows 10 and Debian 10.md +++ b/published/20191023 How to dual boot Windows 10 and Debian 10.md @@ -73,7 +73,7 @@ 接下来,设置系统的主机名,点击 “继续Continue”。 -![Set-hostname-Debian10][12] +![设置主机名-Debian10][12] 下一步,确定域名。如果你的电脑不在域中,直接点击 “继续Continue”按钮。 @@ -89,7 +89,7 @@ 接着,设置与此账户相关联的用户名。 -![Specify-username-Debian10][16] +![指定用户名-Debian10][16] 下一步,设置用户密码,点击“继续Continue”。 @@ -143,7 +143,7 @@ ![自动为空余空间分区-Debain10][29] -接着点击 “将所有文件存储在同一分区(新手用户推荐)All files in one partition (recommended for new users)” +接着点击 “将所有文件存储在同一分区(新手用户推荐)All files in one partition (recommended for new users)”。 ![将所有文件存储在同一分区-debian10][30] From b1222df74bc28ee2673818d2d11a55a09bf34448 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 Nov 2019 21:11:14 +0800 Subject: [PATCH 397/800] APL --- ...tphone PinePhone Will be Available to Pre-order Next Week.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md b/sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md index 4e8ec1311f..14f89c05ba 100644 --- a/sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md +++ b/sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 77a11f9f0c7707cf3c6c29585bed848b01fc1ced Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 Nov 2019 22:06:40 +0800 Subject: [PATCH 398/800] TSL&PRF --- ...ill be Available to Pre-order Next Week.md | 99 ----------------- ...ill be Available to Pre-order Next Week.md | 101 ++++++++++++++++++ 2 files changed, 101 insertions(+), 99 deletions(-) delete mode 100644 sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md create mode 100644 translated/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md diff --git a/sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md b/sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md deleted file mode 100644 index 14f89c05ba..0000000000 --- a/sources/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week) -[#]: via: (https://itsfoss.com/pinephone/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week -====== - -Do you remember when [It’s FOSS first broke the story that Pine64 was working on a Linux-based smartphone][1] running KDE Plasma (among other distributions) in 2017? It’s been some time since then but the good news is that PinePhone will be available for pre-order from 15th November. - -Let me provide you more details on the PinePhone like its specification, pricing and release date. - -### PinePhone: Linux-based budget smartphone - -The PinePhone developer kit is already being tested by some devs and more such kits will be shipped by 15th November. You can check out some of these images by clicking the photo gallery below: - -The developer kit is a combo kit of PINE A64 baseboard + SOPine module + 7″ Touch Screen Display + Camera + Wifi/BT + Playbox enclosure + Lithium-Ion battery case + LTE cat 4 USB dongle. - -These combo kits allow developers to jump start PinePhone development. The PINE A64 platform already has mainline Linux OS build thanks to the PINE64 community and the support by [KDE neon][2]. - -#### Specifications of PinePhone - -![PinePhone Prototype | Image by Martjin Braam][3] - - * Allwinner A64 Quad Core SoC with Mali 400 MP2 GPU - * 2GB of LPDDR3 RAM - * 5.95″ LCD 1440×720, 18:9 aspect ratio (hardened glass) - * Bootable Micro SD - * 16GB eMMC - * HD Digital Video Out - * USB Type C (Power, Data and Video Out) - * Quectel EG-25G with worldwide bands - * WiFi: 802.11 b/g/n, single-band, hotspot capable - * Bluetooth: 4.0, A2DP - * GNSS: GPS, GPS-A, GLONASS - * Vibrator - * RGB status LED - * Selfie and Main camera (2/5Mpx respectively) - * Main Camera: Single OV6540, 5MP, 1/4″, LED Flash - * Selfie Camera: Single GC2035, 2MP, f/2.8, 1/5″ - * Sensors: accelerator, gyro, proximity, compass, barometer, ambient light - * 3 External Switches: up down and power - * HW switches: LTE/GNSS, WiFi, Microphone, Speaker, USB - * Samsung J7 form-factor 3000mAh battery - * Case is matte black finished plastic - * Headphone Jack - - - -#### Production, Price & Availability - -![Pinephone Brave Heart Pre Order][4] - -PinePhone will cost about $150. The early adapter release has been named ‘Brave Heart’ edition and it will go on sale from November 15, 2019. As you can see in the image above, [Pine64’s homepage][5] has included a timer for the first pre-order batch of PinePhone. - -You should expect the early adopter ‘Brave Heart’ editions to be shipped and delivered by December 2019 or January 2020. - -Mass production will begin only after the Chinese New Year, hinting at early Q2 of 2020 or March 2020 (at the earliest). - -The phone hasn’t yet been listed on Pine Store – so make sure to check out [Pine64 online store][6] to pre-order the ‘Brave Heart’ edition if you want to be one of the early adopters. - -#### What do you think of PinePhone? - -Pine64 has already created a budget laptop called [Pinebook][7] and a relatively powerful [Pinebook Pro][8] laptop. So, there is definitely hope for PinePhone to succeed, at least in the niche of DIY enthusiasts and hardcore Linux fans. The low pricing is definitely a huge plus here compared to the other [Linux smartphone Librem5][9] that costs over $600. - -Another good thing about PinePhone is that you can experiment with the operating system by installing Ubuntu Touch, Plasma Mobile or Aurora OS/Sailfish OS. - -These Linux-based smartphones don’t have the features to replace Android or iOS, yet. If you are looking for a fully functional smartphone to replace your Android smartphone, PinePhone is certainly not for you. It’s more for people who like to experiment and are not afraid to troubleshoot. - -If you are looking to buy PinePhone, mark the date and set a reminder. There will be limited supply and what I have seen so far, Pine devices go out of stock pretty soon. - -_Are you going to pre-order a PinePhone? Let us know of your views in the comment section._ - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/pinephone/ - -作者:[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/pinebook-kde-smartphone/ -[2]: https://neon.kde.org/ -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pinephone-prototype.jpeg?ssl=1 -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/pinephone-brave-heart-pre-order.jpg?ssl=1 -[5]: https://www.pine64.org/ -[6]: https://store.pine64.org/ -[7]: https://itsfoss.com/pinebook-linux-notebook/ -[8]: https://itsfoss.com/pinebook-pro/ -[9]: https://itsfoss.com/librem-linux-phone/ diff --git a/translated/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md b/translated/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md new file mode 100644 index 0000000000..ff7cd6d368 --- /dev/null +++ b/translated/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week) +[#]: via: (https://itsfoss.com/pinephone/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +低价 Linux 智能手机 PinePhone 即将接受预订 +====== + +![PinePhone Prototype | Image by Martjin Braam][3] + +你还记得[在 2017 年首次披露][1]的 Pine64 正在开发一个基于 Linux(可以运行 KDE Plasma 及其他发行版)的智能手机的事情吗?从那以后已经有一段时间了,但是好消息是 PinePhone 将从 11 月 15 日开始接受预订。 + +让我来为你提供有关 PinePhone 的更多详细信息,例如其规格、价格和发布日期。 + +### PinePhone:基于 Linux 的廉价智能手机 + +PinePhone 开发者套件已经经过了一些开发人员的测试,更多此类套件将于 11 月 15 日发货。你可以查看下面的照片: + +![](https://img.apester.com/insecure/fit/0/520/ce/0/plain/user-images%2F43%2F43b54bb2e341a0ddba3a2e5c5add438c.jpg) + +![](https://img.apester.com/insecure/fit/0/520/ce/0/plain/user-images%2F55%2F558329908500e3f69f0ab03cd3fc0e62.jpg) + +![](https://img.apester.com/insecure/fit/0/520/ce/0/plain/user-images%2F8d%2F8df9d93a240237b45cdef9615c8fd5de.jpg) + +开发者套件是由 PINE A64 基板 + SOPine 模块 + 7 英寸触摸屏显示器 + 摄像头 + Wifi / BT + 外壳 + 锂离子电池盒 + LTE cat 4 USB 软件狗组成的组合套件。 + +这些组合套件可以使开发人员快速开始 PinePhone 开发。由于 PINE64 社区和 [KDE neon][2] 的支持,主线 Linux 操作系统已经可以在 PINE A64 平台上构建。 + +#### PinePhone 规格 + +* Allwinner A64 四核 SoC,带有 Mali 400 MP2 GPU +* 2GB 的 LPDDR3 RAM +* 5.95 英寸 LCD 1440×720,长宽比 18:9(钢化玻璃) +* 可启动的 Micro SD +* 16GB eMMC +* 高清数字视频输出 +* USB Type-C(电源、数据和视频输出) +* Quectel EG-25G 全球波段 +* WiFi:802.11 b/g/n,单频,支持热点 +* 蓝牙:4.0,A2DP +* GNSS:GPS,GPS-A,GLONASS +* 振动器 +* RGB 状态 LED +* 自拍和主摄像头(分别为 2/5 Mpx) +* 主摄像头:单颗 OV6540、5MP,1/4 英寸,LED 闪光灯 +* 自拍相机:单 GC2035、2MP,f/2.8、1/5 英寸 +* 传感器:加速器、陀螺仪、距离感应器、罗盘、气压计、环境光感 +* 3 个外部开关:上、下和电源 +* 硬件开关:LTE/GNSS、WiFi、麦克风、扬声器、USB +* 三星 J7 外形尺寸 3000mAh 电池 +* 外壳是磨砂黑色成品塑料 +* 耳机插孔 + +#### 产品、价格和交付时间 + +PinePhone 的价格约为 150 美元。尝鲜版命名为“勇敢的心”,将于 2019 年 11 月 15 日开始销售。如上图所示,[Pine64 的主页][5]包含了用于首次预订 PinePhone 的计时器。 + +预期“勇敢的心”尝鲜版在 2019 年 12 月或 2020 年 1 月之前发货。 + +大规模生产将在中国的农历新年后开始,也就是说在 2020 年第二季度早期或最早 2020 年 3 月开始。 + +该电话尚未在 Pine Store 中列出,因此,如果你想成为尝鲜者之一,请务必查看 [Pine64 在线商店][6]以预订“勇敢的心”版本。 + +#### 你对 PinePhone 如何看? + +Pine64 已经开发了一款名为 [Pinebook][7] 的廉价笔记本电脑和一款功能相对强大的 [Pinebook Pro][8] 笔记本电脑。因此,PinePhone 至少在 DIY 爱好者和 Linux 忠实拥护者的狭窄市场中绝对有希望获得成功。与其他价格超过 600 美元的 [Linux 智能手机 Librem5][9] 相比,低廉的价格绝对是一个巨大的优势。 + +PinePhone 的另一个优点是,你可以通过安装 Ubuntu Touch、Plasma Mobile 或 Aurora OS/Sailfish OS 来试验操作系统。 + +这些基于 Linux 的智能手机尚不具备取代 Android 或 iOS 的功能。如果你正在寻找功能全面的智能手机来替代你的 Android 智能手机,那么 PinePhone 当然不适合你。但对于喜欢尝试并且不害怕排除故障的人来说,它的优势更大。 + +如果你想购买 PinePhone,请记住这个日期并设置提醒。供应应该是限量的,到目前为止,我所了解的,Pine 设备很快就会脱销。 + +你要预订 PinePhone 吗?在评论部分将你的意见告知我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pinephone/ + +作者:[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/pinebook-kde-smartphone/ +[2]: https://neon.kde.org/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/pinephone-prototype.jpeg?ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/pinephone-brave-heart-pre-order.jpg?ssl=1 +[5]: https://www.pine64.org/ +[6]: https://store.pine64.org/ +[7]: https://itsfoss.com/pinebook-linux-notebook/ +[8]: https://itsfoss.com/pinebook-pro/ +[9]: https://itsfoss.com/librem-linux-phone/ From 6f9f7b40b39742ff19b8f6640150a03c2d2704b9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 Nov 2019 22:13:27 +0800 Subject: [PATCH 399/800] PUB @wxy https://linux.cn/article-11559-1.html --- ...hone PinePhone Will be Available to Pre-order Next Week.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md (98%) diff --git a/translated/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md b/published/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md similarity index 98% rename from translated/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md rename to published/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md index ff7cd6d368..a41d338c6b 100644 --- a/translated/news/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md +++ b/published/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11559-1.html) [#]: subject: (Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week) [#]: via: (https://itsfoss.com/pinephone/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From 4498992ac455eced7865eb917e75d6f5800ee28c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 Nov 2019 22:52:31 +0800 Subject: [PATCH 400/800] APL --- ...ur bash or zsh shell on Fedora Workstation and Silverblue.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md b/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md index 9419994451..1984f5f8f1 100644 --- a/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md +++ b/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d0dd1386f6ebd8073a7bd588a010ab640eb40d31 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 Nov 2019 23:35:11 +0800 Subject: [PATCH 401/800] TSL&PRF --- ...ll on Fedora Workstation and Silverblue.md | 260 ------------------ ...ll on Fedora Workstation and Silverblue.md | 258 +++++++++++++++++ 2 files changed, 258 insertions(+), 260 deletions(-) delete mode 100644 sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md create mode 100644 translated/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md diff --git a/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md b/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md deleted file mode 100644 index 1984f5f8f1..0000000000 --- a/sources/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md +++ /dev/null @@ -1,260 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Tuning your bash or zsh shell on Fedora Workstation and Silverblue) -[#]: via: (https://fedoramagazine.org/tuning-your-bash-or-zsh-shell-in-workstation-and-silverblue/) -[#]: author: (George Luiz Maluf https://fedoramagazine.org/author/georgelmaluf/) - -Tuning your bash or zsh shell on Fedora Workstation and Silverblue -====== - -![][1] - -This article shows you how to set up some powerful tools in your command line interpreter (CLI) shell on Fedora. If you use _bash_ (the default) or _zsh_, Fedora lets you easily setup these tools. - -### Requirements - -Some installed packages are required. On Workstation, run the following command: - -``` -sudo dnf install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make -``` - -On Silverblue run: - -``` -sudo rpm-ostree install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make -``` - -**Note**: On Silverblue you need to restart before proceeding. - -### Fonts - -You can give your terminal a new look by installing new fonts. Why not fonts that display characters and icons together? - -##### Nerd-Fonts - -Open a new terminal and type the following commands: - -``` -git clone https://github.com/ryanoasis/nerd-fonts ~/.nerd-fonts -cd .nerd-fonts -sudo ./install.sh -``` - -##### Awesome-Fonts - -On Workstation, install using the following command: - -``` -sudo dnf fontawesome-fonts -``` - -On Silverblue, type: - -``` -sudo rpm-ostree install fontawesome-fonts -``` - -### Powerline - -Powerline is a statusline plugin for vim, and provides statuslines and prompts for several other applications, including bash, zsh, tmus, i3, Awesome, IPython and Qtile. - -Fedora Magazine previously posted an [article about powerline][2] that includes instructions on how to install it in the vim editor. You can also find more information on the official [documentation site][3]. - -#### Installation - -To install powerline utility on Fedora Workstation, open a new terminal and run: - -``` -sudo dnf install powerline vim-powerline tmux-powerline powerline-fonts -``` - -On Silverblue, the command changes to: - -``` -sudo rpm-ostree install powerline vim-powerline tmux-powerline powerline-fonts -``` - -**Note**: On Silverblue, before proceeding you need restart. - -#### Activating powerline - -To make the powerline active by default, place the code below at the end of your _~/.bashrc_ file - -``` -if [ -f `which powerline-daemon` ]; then - powerline-daemon -q - POWERLINE_BASH_CONTINUATION=1 - POWERLINE_BASH_SELECT=1 - . /usr/share/powerline/bash/powerline.sh -fi -``` - -Finally, close the terminal and open a new one. It will look like this: - -![][4] - -### Oh-My-Zsh - -[Oh-My-Zsh][5] is a framework for managing your Zsh configuration. It comes bundled with helpful functions, plugins, and themes. To learn how set Zsh as your default shell this [article][6]. - -#### Installation - -Type this in the terminal: - -``` -sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" -``` - -Alternatively, you can type this: - -``` -sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" -``` - -At the end, you see the terminal like this: - -![][7] - -Congratulations, Oh-my-zsh is installed. - -#### Themes - -Once installed, you can select your theme. I prefer to use the Powerlevel10k. One advantage is that it is 100 times faster than powerlevel9k theme. To install run this line: - -``` -git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10k -``` - -And set ZSH_THEME in your _~/.zshrc_ file - -``` -ZSH_THEME=powerlevel10k/powerlevel10k -``` - -Close the terminal. When you open the terminal again, the Powerlevel10k configuration wizard will ask you a few questions to configure your prompt properly. - -![][8] - -After finish Powerline10k configuration wizard, your prompt will look like this: - -![][9] - -If you don’t like it. You can run the powerline10k wizard any time with the command _p10k configure_. - -#### Enable plug-ins - -Plug-ins are stored in _.oh-my-zsh/plugins_ folder. You can visit this site for more information. To activate a plug-in, you need edit your _~/.zshrc_ file. Install plug-ins means that you are going create a series of aliases or shortcuts that execute a specific function. - -For example, to enable the firewalld and git plugins, first edit ~/.zshrc: - -``` -plugins=(firewalld git) -``` - -**Note**: use a blank space to separate the plug-ins names list. - -Then reload the configuration - -``` -source ~/.zshrc -``` - -To see the created aliases, use the command: - -``` -alias | grep firewall -``` - -![][10] - -#### Additional configuration - -I suggest the install syntax-highlighting and syntax-autosuggestions plug-ins. - -``` -git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting -git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions -``` - -Add them to your plug-ins list in your file _~/.zshrc_ - -``` -plugins=( [plugins...] zsh-syntax-highlighting zsh-autosuggestions) -``` - -Reload the configuration - -``` -source ~/.zshrc -``` - -See the results: - -![][11] - -### Colored folders and icons - -Colorls is a Ruby gem that beautifies the terminal’s ls command, with colors and font-awesome icons. You can visit the official [site][12] for more information. - -Because it’s a ruby gem, just follow this simple step: - -``` -sudo gem install colorls -``` - -To keep up to date, just do: - -``` -sudo gem update colorls -``` - -To prevent type colorls everytime you can make aliases in your _~/.bashrc_ or _~/.zshrc_. - -``` -alias ll='colorls -lA --sd --gs --group-directories-first' -alias ls='colorls --group-directories-first' -``` - -Also, you can enable tab completion for colorls flags, just entering following line at end of your shell configuration: - -``` -source $(dirname ($gem which colorls))/tab_complete.sh -``` - -Reload it and see what it happens: - -![][13] - -![][14] - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/tuning-your-bash-or-zsh-shell-in-workstation-and-silverblue/ - -作者:[George Luiz Maluf][a] -选题:[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/georgelmaluf/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/tuning-shell-816x345.jpg -[2]: https://fedoramagazine.org/add-power-terminal-powerline/ -[3]: https://powerline.readthedocs.io/en/latest/ -[4]: https://fedoramagazine.org/wp-content/uploads/2019/10/terminal_bash_powerline.png -[5]: https://ohmyz.sh -[6]: https://fedoramagazine.org/set-zsh-fedora-system/ -[7]: https://fedoramagazine.org/wp-content/uploads/2019/10/oh-my-zsh.png -[8]: https://fedoramagazine.org/wp-content/uploads/2019/10/powerlevel10k_config_wizard.png -[9]: https://fedoramagazine.org/wp-content/uploads/2019/10/powerlevel10k.png -[10]: https://fedoramagazine.org/wp-content/uploads/2019/10/aliases_plugin.png -[11]: https://fedoramagazine.org/wp-content/uploads/2019/10/sintax.png -[12]: https://github.com/athityakumar/colorls -[13]: https://fedoramagazine.org/wp-content/uploads/2019/10/ls-1024x495.png -[14]: https://fedoramagazine.org/wp-content/uploads/2019/10/ll-1024x495.png diff --git a/translated/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md b/translated/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md new file mode 100644 index 0000000000..a0dd949eef --- /dev/null +++ b/translated/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md @@ -0,0 +1,258 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tuning your bash or zsh shell on Fedora Workstation and Silverblue) +[#]: via: (https://fedoramagazine.org/tuning-your-bash-or-zsh-shell-in-workstation-and-silverblue/) +[#]: author: (George Luiz Maluf https://fedoramagazine.org/author/georgelmaluf/) + +在 Fedora 上优化 bash 或 zsh +====== + +![][1] + +本文将向你展示如何在 Fedora 的命令行解释器(CLI)Shell 中设置一些强大的工具。如果使用bash(默认)或zsh,Fedora 可让你轻松设置这些工具。 + +### 前置需求 + +这需要一些已安装的软件包。在 Fedora 工作站上,运行以下命令: + +``` +sudo dnf install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make +``` + +在 Silverblue 上运行: + +``` +sudo rpm-ostree install git wget curl ruby ruby-devel zsh util-linux-user redhat-rpm-config gcc gcc-c++ make +``` + +注意:在 Silverblue 上,你需要重新启动才能继续。 + +### 字体 + +你可以通过安装新字体使终端焕然一新。为什么不使用可以同时显示字符和图标的字体呢? + +#### Nerd-Fonts + +打开一个新终端,然后键入以下命令: + +``` +git clone https://github.com/ryanoasis/nerd-fonts ~/.nerd-fonts +cd .nerd-fonts +sudo ./install.sh +``` + +#### Awesome-Fonts + +在工作站上,使用以下命令进行安装: + +``` +sudo dnf fontawesome-fonts +``` + +在 Silverblue 上键入: + +``` +sudo rpm-ostree install fontawesome-fonts +``` + +### Powerline + +Powerline 是 vim 的状态行插件,并为其他几个应用程序也提供了状态行和提示符,包括 bash、zsh、tmus、i3、Awesome、IPython 和 Qtile。你也可以在官方[文档站点][3]上找到更多信息。 + +#### 安装 + +要在 Fedora 工作站上安装 Powerline 实用程序,请打开一个新终端并运行: + +``` +sudo dnf install powerline vim-powerline tmux-powerline powerline-fonts +``` + +在 Silverblue 上,命令更改为: + +``` +sudo rpm-ostree install powerline vim-powerline tmux-powerline powerline-fonts +``` + +注意:在 Silverblue 上,你需要重新启动才能继续。 + +#### 激活 Powerline + +要使 Powerline 默认处于活动状态,请将下面的代码放在 `~/.bashrc` 文件的末尾: + +``` +if [ -f `which powerline-daemon` ]; then + powerline-daemon -q + POWERLINE_BASH_CONTINUATION=1 + POWERLINE_BASH_SELECT=1 + . /usr/share/powerline/bash/powerline.sh +fi +``` + +最后,关闭终端并打开一个新终端。它看起来像这样: + +![][4] + +### Oh-My-Zsh + +[Oh-My-Zsh][5] 是用于管理 Zsh 配置的框架。它捆绑了有用的功能、插件和主题。要了解如何将 Zsh 设置为默认外壳程序,请参见[这篇文章][6]。 + +#### 安装 + +在终端中输入: + +``` +sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" +``` + +或者,你也可以输入以下内容: + +``` +sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" +``` + +最后,你将看到如下所示的终端: + +![][7] + +恭喜,Oh-my-zsh 已安装成功。 + +#### 主题 + +安装后,你可以选择主题。我喜欢使用 powerlevel10k。优点之一是它比 powerlevel9k 主题快 100 倍。要安装它,请运行以下命令行: + +``` +git clone https://github.com/romkatv/powerlevel10k.git ~/.oh-my-zsh/themes/powerlevel10k +``` + +并在你的 `~/.zshrc` 文件设置 `ZSH_THEME`: + +``` +ZSH_THEME=powerlevel10k/powerlevel10k +``` + +关闭终端。再次打开终端时,powerlevel10k 配置向导将询问你几个问题以正确配置提示符。 + +![][8] + +完成 powerline10k 配置向导后,你的提示符将如下所示: + +![][9] + +如果你不喜欢它。你可以随时使用 `p10k configure` 命令来运行 powerline10k 向导。 + +#### 启用插件 + +插件存储在 `.oh-my-zsh/plugins` 文件夹中。要激活插件,你需要编辑 `~/.zshrc` 文件。安装插件意味着你创建了一系列执行特定功能的别名或快捷方式。 + +例如,要启用 firewalld 和 git 插件,请首先编辑 `~/.zshrc`: + +``` +plugins=(firewalld git) +``` + +注意:使用空格分隔插件名称列表。 + +然后重新加载配置: + +``` +source ~/.zshrc +``` + +要查看创建的别名,请使用以下命令: + +``` +alias | grep firewall +``` + +![][10] + +#### 更多配置 + +我建议安装语法高亮和语法自动建议插件。 + +``` +git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting +git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions +``` + +将它们添加到文件 `~/.zshrc` 的插件列表中。 + +``` +plugins=( [plugins...] zsh-syntax-highlighting zsh-autosuggestions) +``` + +重新加载配置。 + +``` +source ~/.zshrc +``` + +查看结果: + +![][11] + +### 彩色的文件夹和图标 + +`colorls` 是一个 ruby gem,可使用颜色和超棒的字体图标美化终端的 `ls` 命令。你可以访问官方[网站][12]以获取更多信息。 + +因为它是个 ruby gem,所以请按照以下简单步骤操作: + +``` +sudo gem install colorls +``` + +要保持最新状态,只需执行以下操作: + +``` +sudo gem update colorls +``` + +为防止每次输入 `colorls`,你可以在 `~/.bashrc` 或 `~/.zshrc` 中创建别名。 + +``` +alias ll='colorls -lA --sd --gs --group-directories-first' +alias ls='colorls --group-directories-first' +``` + +另外,你可以为 `colorls` 的选项启用制表符补完功能,只需在 shell 配置末尾输入以下行: + +``` +source $(dirname ($gem which colorls))/tab_complete.sh +``` + +重新加载并查看会发生什么: + +![][13] + +![][14] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/tuning-your-bash-or-zsh-shell-in-workstation-and-silverblue/ + +作者:[George Luiz Maluf][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/georgelmaluf/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/tuning-shell-816x345.jpg +[2]: https://fedoramagazine.org/add-power-terminal-powerline/ +[3]: https://powerline.readthedocs.io/en/latest/ +[4]: https://fedoramagazine.org/wp-content/uploads/2019/10/terminal_bash_powerline.png +[5]: https://ohmyz.sh +[6]: https://fedoramagazine.org/set-zsh-fedora-system/ +[7]: https://fedoramagazine.org/wp-content/uploads/2019/10/oh-my-zsh.png +[8]: https://fedoramagazine.org/wp-content/uploads/2019/10/powerlevel10k_config_wizard.png +[9]: https://fedoramagazine.org/wp-content/uploads/2019/10/powerlevel10k.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/10/aliases_plugin.png +[11]: https://fedoramagazine.org/wp-content/uploads/2019/10/sintax.png +[12]: https://github.com/athityakumar/colorls +[13]: https://fedoramagazine.org/wp-content/uploads/2019/10/ls-1024x495.png +[14]: https://fedoramagazine.org/wp-content/uploads/2019/10/ll-1024x495.png From 7328ebecb1e9b9edc1f2a610b0018ddc117e5fed Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 10 Nov 2019 23:39:38 +0800 Subject: [PATCH 402/800] PUB @wxy https://linux.cn/article-11560-1.html --- ... bash or zsh shell on Fedora Workstation and Silverblue.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md (99%) diff --git a/translated/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md b/published/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md similarity index 99% rename from translated/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md rename to published/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md index a0dd949eef..e0878cfbe5 100644 --- a/translated/tech/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md +++ b/published/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11560-1.html) [#]: subject: (Tuning your bash or zsh shell on Fedora Workstation and Silverblue) [#]: via: (https://fedoramagazine.org/tuning-your-bash-or-zsh-shell-in-workstation-and-silverblue/) [#]: author: (George Luiz Maluf https://fedoramagazine.org/author/georgelmaluf/) From c4a2c4f72e8a75e731a3d072b1bce815b090b0fc Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 00:53:59 +0800 Subject: [PATCH 403/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191111=20Bash?= =?UTF-8?q?=20Script=20to=20Monitor=20Disk=20Space=20Usage=20on=20Multiple?= =?UTF-8?q?=20Remote=20Linux=20Systems=20With=20eMail=20Alert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191111 Bash Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alert.md --- ...e Remote Linux Systems With eMail Alert.md | 200 ++++++++++++++++++ 1 file changed, 200 insertions(+) create mode 100644 sources/tech/20191111 Bash Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alert.md diff --git a/sources/tech/20191111 Bash Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alert.md b/sources/tech/20191111 Bash Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alert.md new file mode 100644 index 0000000000..136748169d --- /dev/null +++ b/sources/tech/20191111 Bash Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alert.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alert) +[#]: via: (https://www.2daygeek.com/linux-bash-script-to-monitor-disk-space-usage-on-multiple-remote-linux-systems-send-email/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alert +====== + +Some time ago, we had wrote **[Bash script to monitor disk space usage on a Linux][1]** system with an email alert. + +That script works on a single machine, and you have to put the script on the corresponding machine. + +If you want to set disk space usage alerts on multiple computers at the same time, that script does not help you. + +So we have written this new **[shell script][2]** to achieve this. + +To do so, you need a JUMP server (centralized server) that can communicate with any other computer without a password. + +This means that password-less authentication must be set as a prerequisite. + +When the prerequisite is complete, run the script on the JUMP server. + +Finally add a **[cronjob][3]** to completely automate this process. + +Three shell scripts are included in this article, and choose the one you like. + +### 1) Bash Script-1: Bash Script to Check Disk Space Usage on Multiple Remote Linux Systems and Print Output on Terminal + +This **[bash script][4]** checks the disk space usage on a given remote machine and print the output to the terminal if the system reaches the specified threshold. + +In this example, we set the threshold limit to 80% for testing purpose and you can adjust this limit to suit your needs. + +Also, replace your email id instead of us to receive this alert. + +``` +# vi /opt/scripts/disk-usage-multiple.sh + +#!/bin/sh +output1=/tmp/disk-usage.out +echo "---------------------------------------------------------------------------" +echo "HostName Filesystem Size Used Avail Use% Mounted on" +echo "---------------------------------------------------------------------------" +for server in `more /opt/scripts/servers.txt` +do +output=`ssh $server df -Ph | tail -n +2 | sed s/%//g | awk '{ if($5 > 80) print $0;}'` +echo "$server: $output" >> $output1 +done +cat $output1 | grep G | column -t +rm $output1 +``` + +Run the script file once you have added the above script to a file. + +``` +# sh /opt/scripts/disk-usage-multiple.sh +``` + +You get an output like the one below. + +``` +------------------------------------------------------------------------------------------------ +HostName Filesystem Size Used Avail Use% Mounted on +------------------------------------------------------------------------------------------------ +server01: /dev/mapper/vg_root-lv_red 5.0G 4.3G 784M 85 /var/log/httpd +server02: /dev/mapper/vg_root-lv_var 5.8G 4.5G 1.1G 81 /var +server03: /dev/mapper/vg01-LogVol01 5.7G 4.5G 1003M 82 /usr +server04: /dev/mapper/vg01-LogVol04 4.9G 3.9G 711M 85 /usr +server05: /dev/mapper/vg_root-lv_u01 74G 56G 15G 80 /u01 +``` + +### 2) Shell Script-2: Shell Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alerts + +This shell script checks the disk space usage on a given remote machine and sends the output via a mail in a simple text once the system reaches the specified threshold. + +``` +# vi /opt/scripts/disk-usage-multiple-1.sh + +#!/bin/sh +SUBJECT="Disk Usage Report on "`date`"" +MESSAGE="/tmp/disk-usage.out" +MESSAGE1="/tmp/disk-usage-1.out" +TO="[email protected]" +echo "---------------------------------------------------------------------------------------------------" >> $MESSAGE1 +echo "HostName Filesystem Size Used Avail Use% Mounted on" >> $MESSAGE1 +echo "---------------------------------------------------------------------------------------------------" >> $MESSAGE1 +for server in `more /opt/scripts/servers.txt` +do +output=`ssh $server df -Ph | tail -n +2 | sed s/%//g | awk '{ if($5 > 80) print $0;}'` +echo "$server: $output" >> $MESSAGE +done +cat $MESSAGE | grep G | column -t >> $MESSAGE1 +mail -s "$SUBJECT" "$TO" < $MESSAGE1 +rm $MESSAGE +rm $MESSAGE1 +``` + +Run the script file once you have added the above script to a file. + +``` +# sh /opt/scripts/disk-usage-multiple-1.sh +``` + +You get an output like the one below. + +``` +------------------------------------------------------------------------------------------------ +HostName Filesystem Size Used Avail Use% Mounted on +------------------------------------------------------------------------------------------------ +server01: /dev/mapper/vg_root-lv_red 5.0G 4.3G 784M 85 /var/log/httpd +server02: /dev/mapper/vg_root-lv_var 5.8G 4.5G 1.1G 81 /var +server03: /dev/mapper/vg01-LogVol01 5.7G 4.5G 1003M 82 /usr +server04: /dev/mapper/vg01-LogVol04 4.9G 3.9G 711M 85 /usr +server05: /dev/mapper/vg_root-lv_u01 74G 56G 15G 80 /u01 +``` + +Finally add a cronjob to automate this. It will run every 10 minutes. + +``` +# crontab -e + +*/10 * * * * /bin/bash /opt/scripts/disk-usage-multiple-1.sh +``` + +### 3) Bash Script-3: Bash Script to Monitor Disk Space Usage on Multiple Remote Linux Systems With eMail Alerts + +This shell script checks the disk space usage on a given remote machine and sends the output via the mail with a CSV file if the system reaches the specified threshold. + +``` +# vi /opt/scripts/disk-usage-multiple-2.sh + +#!/bin/sh +MESSAGE="/tmp/disk-usage.out" +MESSAGE2="/tmp/disk-usage-1.csv" +echo "Server Name, Filesystem, Size, Used, Avail, Use%, Mounted on" > $MESSAGE2 +for server in thvtstrhl7 thvrhel6 +for server in `more /opt/scripts/servers-disk-usage.txt` +do +output1=`ssh $server df -Ph | tail -n +2 | sed s/%//g | awk '{ if($5 > 80) print $0;}'` +echo "$server $output1" >> $MESSAGE +done +cat $MESSAGE | grep G | column -t | while read output; +do +Sname=$(echo $output | awk '{print $1}') +Fsystem=$(echo $output | awk '{print $2}') +Size=$(echo $output | awk '{print $3}') +Used=$(echo $output | awk '{print $4}') +Avail=$(echo $output | awk '{print $5}') +Use=$(echo $output | awk '{print $6}') +Mnt=$(echo $output | awk '{print $7}') +echo "$Sname,$Fsystem,$Size,$Used,$Avail,$Use,$Mnt" >> $MESSAGE2 +done +echo "Disk Usage Report for `date +"%B %Y"`" | mailx -s "Disk Usage Report on `date`" -a /tmp/disk-usage-1.csv [email protected] +rm $MESSAGE +rm $MESSAGE2 +``` + +Run the script file once you have added the above script to a file. + +``` +# sh /opt/scripts/disk-usage-multiple-2.sh +``` + +You get an output like the one below. + +![][5] + +Finally add a cronjob to automate this. It will run every 10 minutes. + +``` +# crontab -e + +*/10 * * * * /bin/bash /opt/scripts/disk-usage-multiple-1.sh +``` + +**Note:** Because the script is scheduled to run once every 10 minutes, you will receive an email alert every 10 minutes. + +If your system reaches a given limit after 18 minutes, you will receive an email alert on the second cycle, such as after 20 minutes (2nd 10 minute cycle). + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-bash-script-to-monitor-disk-space-usage-on-multiple-remote-linux-systems-send-email/ + +作者:[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/linux-shell-script-to-monitor-disk-space-usage-and-send-email/ +[2]: https://www.2daygeek.com/category/shell-script/ +[3]: https://www.2daygeek.com/crontab-cronjob-to-schedule-jobs-in-linux/ +[4]: https://www.2daygeek.com/category/bash-script/ +[5]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 From 4ebefc225ec4b81c3d90de495d5f60309d329f70 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 00:54:20 +0800 Subject: [PATCH 404/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191108=20Managi?= =?UTF-8?q?ng=20software=20and=20services=20with=20Cockpit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191108 Managing software and services with Cockpit.md --- ...ging software and services with Cockpit.md | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 sources/tech/20191108 Managing software and services with Cockpit.md diff --git a/sources/tech/20191108 Managing software and services with Cockpit.md b/sources/tech/20191108 Managing software and services with Cockpit.md new file mode 100644 index 0000000000..c2039de262 --- /dev/null +++ b/sources/tech/20191108 Managing software and services with Cockpit.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Managing software and services with Cockpit) +[#]: via: (https://fedoramagazine.org/managing-software-and-services-with-cockpit/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Managing software and services with Cockpit +====== + +![][1] + +The Cockpit series continues to focus on some of the tools users and administrators can use to perform everyday tasks within the web user-interface. So far we’ve covered [introducing the user-interface][2], [storage][3] and [network management][4], and [user accounts][5]. Hence, this article will highlight how Cockpit handles software and services. + +The menu options for Applications and Software Updates are available through Cockpit’s PackageKit feature. To install it from the command-line, run: + +``` +sudo dnf install cockpit-packagekit +``` + +For [Fedora Silverblue][6], [Fedora CoreOS][7], and other ostree-based operating systems, install the _cockpit-ostree_ package and reboot the system: + +``` +sudo rpm-ostree install cockpit-ostree; sudo systemctl reboot +``` + +### Software updates + +On the main screen, Cockpit notifies the user whether the system is updated, or if any updates are available. Click the **Updates Available** link on the main screen, or **Software Updates** in the menu options, to open the updates page. + +#### RPM-based updates + +The top of the screen displays general information such as the number of updates and the number of security-only updates. It also shows when the system was last checked for updates, and a button to perform the check. Likewise, this button is equivalent to the command **sudo dnf check-update**. + +Below is the **Available Updates** section, which lists the packages requiring updates. Furthermore, each package displays the name, version, and best of all, the severity of the update. Clicking a package in the list provides additional information such as the CVE, the Bugzilla ID, and a brief description of the update. For details about the CVE and related bugs, click their respective links. + +Also, one of the best features about Software Updates is the option to only install security updates. Distinguishing which updates to perform makes it simple for those who may not need, or want, the latest and greatest software installed. Of course, one can always use [Red Hat Enterprise Linux][8] or [CentOS][9] for machines requiring long-term support. + +The example below demonstrates how Cockpit applies RPM-based updates. + +![][10] + +#### OSTree-based updates + +The popular article [What is Silverblue][11] states: + +> OSTree is used by rpm-ostree, a hybrid package/image based system… It atomically replicates a base OS and allows the user to “layer” the traditional RPM on top of the base OS if needed. + +Because of this setup, Cockpit uses a snapshot-like layout for these operating systems. As seen in the demo below, the top of the screen displays the repository (_fedora_), the base OS image, and a button to **Check for Updates**. + +Clicking the repository name (_fedora_ in the demo below) opens the **Change Repository** screen. From here one can **Add New Repository**, or click the pencil icon to edit an existing repository. Editing provides the option to delete the repository, or **Add Another Key**. To add a new repository, enter the name and URL. Also, select whether or not to **Use trusted GPG key**. + +There are three categories that provide details of its respective image: Tree, Packages, and Signature. **Tree** displays basic information such as the operating system, version of the image, how long ago it was released, and the origin of the image. **Packages** displays a list of installed packages within that image. **Signature** verifies the integrity of the image such as the author, date, RSA key ID, and status. + +The current, or running, image displays a green check-mark beside it. If something happens, or an update causes an issue, click the **Roll Back and Reboot** button. This restores the system to a previous image. + +![][12] + +### Applications + +The **Applications** screen displays a list of add-ons available for Cockpit. This makes it easy to find and install the plugins required by the user. At the time of this article, some of the options include the 389 Directory Service, Fleet Commander, and Subscription Manager. The demo below shows a complete list of available Cockpit add-ons. + +Also, each item displays the name, a brief description, and a button to install, or remove, the add-on. Furthermore, clicking the item displays more information (if available). To refresh the list, click the icon at the top-right corner. + +![][13] + +### Subscription Management + +Subscription managers allow admins to attach subscriptions to the machine. Even more, subscriptions give admins control over user access to content and packages. One example of this is the famous [Red Hat subscription model][14]. This feature works in relation to the **subscription-manager** command + +The Subscriptions add-on can be installed via Cockpit’s Applications menu option. It can also be installed from the command-line with: + +``` +sudo dnf install cockpit-subscriptions +``` + +To begin, click **Subscriptions** in the main menu. If the machine is currently unregistered, it opens the **Register System** screen. Next, select the URL. You can choose **Default**, which uses Red Hat’s subscription server, or enter a **Custom URL**. Enter the **Login**, **Password**, **Activation Key**, and **Organization** ID. Finally, to complete the process, click the **Register** button. + +The main page for Subscriptions show if the machine is registered, the System Purpose, and a list of installed products. + +![][15] + +### Services + +To start, click the **Services** menu option. Because Cockpit uses _[systemd][16]_, we get the options to view **System Services**, **Targets**, **Sockets**, **Timers**, and **Paths**. Cockpit also provides an intuitive interface to help users search and find the service they want to configure. Services can also be filtered by it’s state: **All**, **Enabled**, **Disabled**, or **Static**. Below this is the list of services. Each row displays the service name, description, state, and automatic startup behavior. + +For example, let’s take _bluetooth.service_. Typing _bluetooth_ in the search bar automatically displays the service. Now, select the service to view the details of that service. The page displays the status and path of the service file. It also displays information in the service file such as the requirements and conflicts. Finally, at the bottom of the page, are the logs pertaining to that service. + +Also, users can quickly start and stop the service by toggling the switch beside the service name. The three-dots to the right of that switch expands those options to **Enable**, **Disable**, **Mask/Unmask** the service + +To learn more about _systemd_, check out the series in the Fedora Magazine starting with [What is an init system?][17] + +![][18] + +In the next article we’ll explore the security features available in Cockpit. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/managing-software-and-services-with-cockpit/ + +作者:[Shaun Assam][a] +选题:[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/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/cockpit-sw-services-816x345.jpg +[2]: https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/ +[3]: https://fedoramagazine.org/performing-storage-management-tasks-in-cockpit/ +[4]: https://fedoramagazine.org/managing-network-interfaces-and-firewalld-in-cockpit/ +[5]: https://fedoramagazine.org/managing-user-accounts-with-cockpit/ +[6]: https://silverblue.fedoraproject.org/ +[7]: https://getfedora.org/en/coreos/ +[8]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux?intcmp=701f2000001OEGhAAO +[9]: https://www.centos.org/ +[10]: https://fedoramagazine.org/wp-content/uploads/2019/11/cockpit-software-updates-rpm.gif +[11]: https://fedoramagazine.org/what-is-silverblue/ +[12]: https://fedoramagazine.org/wp-content/uploads/2019/11/cockpit-software-updates-ostree.gif +[13]: https://fedoramagazine.org/wp-content/uploads/2019/11/cockpit-applications.gif +[14]: https://www.redhat.com/en/about/value-of-subscription +[15]: https://fedoramagazine.org/wp-content/uploads/2019/11/cockpit-subscriptions.gif +[16]: https://fedoramagazine.org/series/systemd-series/ +[17]: https://fedoramagazine.org/what-is-an-init-system/ +[18]: https://fedoramagazine.org/wp-content/uploads/2019/11/cockpit-services.gif From c6ff42689c17ca0c1a53e3c22c0ff73e5ae81282 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 00:55:22 +0800 Subject: [PATCH 405/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191111=20Confir?= =?UTF-8?q?med!=20Microsoft=20Edge=20Will=20be=20Available=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md --- ...crosoft Edge Will be Available on Linux.md | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 sources/tech/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md diff --git a/sources/tech/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md b/sources/tech/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md new file mode 100644 index 0000000000..86d9760ce0 --- /dev/null +++ b/sources/tech/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Confirmed! Microsoft Edge Will be Available on Linux) +[#]: via: (https://itsfoss.com/microsoft-edge-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Confirmed! Microsoft Edge Will be Available on Linux +====== + +![][1] + +_**Microsoft is overhauling its Edge web browser and it will be based on the open source**_ [_**Chromium**_][2] _**browser. Microsoft is also bringing the new Edge browser to desktop Linux however the Linux release might be a bit delayed.**_ + +Microsoft’s Internet Explorer once dominated the browser market share, but it lost its dominance in the last decade to Google’s Chrome. + +> The rise and fall of [#opensource][3] web browser Mozilla Firefox. [pic.twitter.com/Co5Xj3dKIQ][4] +> +> — Abhishek Prakash (@abhishek_foss) [March 22, 2017][5] + +Microsoft tried to gain its lost position by creating Edge, a brand new web browser built with EdgeHTML and [Chakra engine][6]. It was tightly integrated with Microsoft’s digital assistant [Cortana][7] and Windows 10. + +However, it still could not bring the crown home and as of today, it stands at the [fourth position in desktop browser usage share][8]. + +Lately, Microsoft decided to give Edge an overhaul by rebasing it on [open source Chromium project][9]. Google’s Chrome browser is also based on Chromium. [Chromium is also available as a standalone web browser][2] and some Linux distributions use it at as the default web browser. + +### The new Microsoft Edge web browser on Linux + +After initial reluctance and uncertainties, it seems that Microsoft is finally going to bring the new Edge browser to Linux. + +In its annual developer conference Microsoft [Ignite][10], the [session on Edge Browser][11] mentions that it is coming to Linux in future. + +![Microsoft confirms that Edge is coming to Linux in future][12] + +The new Edge browser will be available on 15th January 2020 but I think that the Linux release will be delayed. + +### Is Microsoft Edge coming to Linux really a big deal? + +What’s the big deal with Microsoft Edge coming to Linux? Don’t we have plenty of [web browsers available for Linux][13] already? I think it has to do with the ‘Microsoft Linux rivalry’ (if there is such a thing). If Microsoft does anything for Linux, specially desktop Linux, it becomes a news. + +I also think that Edge on Linux has mutual benefits for Microsoft and for Linux users. Here’s why. + +#### What’s in it for Microsoft? + +When Google launched its Chrome browser in 2008, no one had thought that it will dominate the market in just a few years. But why would a search engine put so much of energy behind a ‘free web browser’? + +The answer is that Google is a search engine and it wants more people using its search engine and other services so that it can earn revenue from the ad services. With Chrome, Google is the default search engine. On other browsers like Firefox and Safari, Google pays hundreds of millions to be kept as the default web browser. Without Chrome, Google would have to rely entirely on the other browsers. + +Microsoft too has a search engine named Bing. The Internet Explorer and Edge use Bing as the default search engine. If Edge is used by more users, it improves the chances of bringing more users to Bing. More Bing users is something Microsoft would love to have. + +#### What’s in it for Linux users? + +I see a couple of benefits for desktop Linux users. With Edge, you can use some Microsoft specific products on Linux. For example, Microsoft’s streaming gaming service [xCloud][14] maybe available on the Edge browser only. + +Another benefit is an improved [Netflix experience on Linux][15]. Of course, you can use Chrome or [Firefox for watching Netflix on Linux][16] but you might not be getting the full HD or ultra HD streaming. + +As far as I know, the [Full HD and Ultra HD Netflix streaming is only available on Microsoft Edge][17]. This means you can ‘Netflix and chill’ in HD with Edge on Linux. + +_**What do you think?**_ + +What’s your feeling about Microsoft Edge coming to Linux? Will you be using it when it is available for Linux? Do share your views in the comment section below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/microsoft-edge-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/2019/11/microsoft_edge_logo_transparent.png?ssl=1 +[2]: https://itsfoss.com/install-chromium-ubuntu/ +[3]: https://twitter.com/hashtag/opensource?src=hash&ref_src=twsrc%5Etfw +[4]: https://t.co/Co5Xj3dKIQ +[5]: https://twitter.com/abhishek_foss/status/844666818665025537?ref_src=twsrc%5Etfw +[6]: https://itsfoss.com/microsoft-chakra-core/ +[7]: https://www.microsoft.com/en-in/windows/cortana +[8]: https://en.wikipedia.org/wiki/Usage_share_of_web_browsers +[9]: https://www.chromium.org/Home +[10]: https://www.microsoft.com/en-us/ignite +[11]: https://myignite.techcommunity.microsoft.com/sessions/79341?source=sessions +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Microsoft_Edge_Linux.jpg?ssl=1 +[13]: https://itsfoss.com/open-source-browsers-linux/ +[14]: https://www.pocket-lint.com/games/news/147429-what-is-xbox-project-xcloud-cloud-gaming-service-price-release-date-devices +[15]: https://itsfoss.com/watch-netflix-in-ubuntu-linux/ +[16]: https://itsfoss.com/netflix-firefox-linux/ +[17]: https://help.netflix.com/en/node/23742 From 5e0379b9ad62d1d15d15748c46758f0ad2d4173b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 00:55:50 +0800 Subject: [PATCH 406/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191110=20How=20?= =?UTF-8?q?to=20Create=20Affinity=20and=20Anti-Affinity=20Policy=20in=20Op?= =?UTF-8?q?enStack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191110 How to Create Affinity and Anti-Affinity Policy in OpenStack.md --- ...y and Anti-Affinity Policy in OpenStack.md | 214 ++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 sources/tech/20191110 How to Create Affinity and Anti-Affinity Policy in OpenStack.md diff --git a/sources/tech/20191110 How to Create Affinity and Anti-Affinity Policy in OpenStack.md b/sources/tech/20191110 How to Create Affinity and Anti-Affinity Policy in OpenStack.md new file mode 100644 index 0000000000..8e65ed8a02 --- /dev/null +++ b/sources/tech/20191110 How to Create Affinity and Anti-Affinity Policy in OpenStack.md @@ -0,0 +1,214 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Create Affinity and Anti-Affinity Policy in OpenStack) +[#]: via: (https://www.linuxtechi.com/create-affinity-anti-affinity-policy-openstack/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Create Affinity and Anti-Affinity Policy in OpenStack +====== + +In the organizations where the **OpenStack** is used aggressively, so in such organizations application and database teams can come up with requirement that their application and database instances are required to launch either on same **compute nodes** (hypervisor) or different compute nodes. + +[![OpenStack-VMs-Affinity-AntiAffinity-Policy][1]][2] + +So, this requirement in OpenStack is fulfilled via **server groups** with **affinity** and **anti-affinity** policies. Server Group is used control affinity and anti-affinity rules for scheduling openstack instances. + +When we try to provision virtual machines with affinity server group then all virtual machines will be launched on same compute node. When VMs are provisioned with ant-affinity server group then all VMs will be launched in different compute nodes. In this article we will demonstrate how to create OpenStack server groups with Affinity and Anti-Affinity rules. + +Let’s first verify whether your OpenStack setup support Affinity and Anti-Affinity Policies or not, execute the following grep command from your controller nodes, + +``` +# grep -i "scheduler_default_filters" /etc/nova/nova.conf +``` + +Output should be something like below, + +![Affinity-AntiAffinity-Filter-Nova-Conf-OpenStack][1] + +As we can see Affinity and Ant-Affinity filters are enabled but in case if these are not enabled then add these filters in **/etc/nova/nova.conf**  file of controller nodes under “**scheduler_default_filters**” parameters. + +``` +# vi /etc/nova/nova.conf +……………… +scheduler_default_filters=xx,xxx,xxx,xxxxx,xxxx,xxx,xxx,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter,xx,xxx,xxxx,xx +……………… +``` + +Save and exit the file + +To make above changes into the effect, restart the following services + +``` +# systemctl restart openstack-nova-scheduler +# systemctl restart openstack-nova-conductor +``` + +Now let’s create OpenStack Server Groups with Affinity and Anti-Affinity Policies + +### Server Group with Affinity Policy + +To create a server group with name “app” for affinity policy, execute the following openstack command from controller node, + +**Syntax:** + +# openstack server group create –policy affinity <Server-Group-Name> + +Or + +# nova server-group-create <Server-Group-Name> affinity + +**Note:** Before start executing openstack command, please make sure you source project credential file, in my case project credential file is “**openrc**” + +Example: + +``` +# source openrc +# openstack server group create --policy affinity app +``` + +### Server Group with Anti-Affinity Policy + +To create a server group with anti-affinity policy, execute the following openstack command from controller node, I am assuming server group name is “database” + +**Syntax:** + +# openstack server group create –policy anti-affinity <Server-Group-Name> + +Or + +# nova server-group-create <Server-Group-Name> anti-affinity + +Example: + +``` +# source openrc +# openstack server group create --policy anti-affinity database +``` + +### List Server Group’s ID and Policies + +Execute either nova command or Openstack command to get server group’s id and their policies + +``` +# nova server-group-list | grep -Ei "Policies|database" +Or +# openstack server group list --long | grep -Ei "Policies|app|database" +``` + +Output would be something like below, + +![Server-Group-Policies-OpenStack][1] + +### [Launch Virtual Machines (VMs)][3] with Affinity Policy + +Let’s assume we want to launch 4 vms with affinity policy, run the following “**openstack server create**” command + +**Syntax:** + +# openstack server create –image <img-name> –flavor <id-or-flavor-name> –security-group <security-group-name> –nic net-id=<network-id> –hint group=<Server-Group-ID> –max <number-of-vms>  <VM-Name> + +**Example:** + +``` +# openstack server create --image Cirros --flavor m1.small --security-group default --nic net-id=37b9ab9a-f198-4db1-a5d6-5789b05bfb4c --hint group="a9847c7f-b7c2-4751-9c9a-03b117e704ff" --max 4 affinity-test +``` + +Output of above command, + +![OpenStack-Server-create-with-hint-option][1] + +Let’s verify whether VMs are launched on same compute node or not, run following command + +``` +# openstack server list --long -c Name -c Status -c Host -c "Power State" | grep -i affinity-test +``` + +![Affinity-VMs-Status-OpenStack][1] + +This confirms that our affinity policy is working fine as all the VMs are launched on same compute node. + +Now let’s test anti-affinity policy + +### Launch Virtual Machines (VMs) with Anti-Affinity Policy + +For anti-affinity policy we will launch 4 VMs, in above ‘openstack server create’ command, we need to replace Anti-Affinity Server Group’s ID. In our case we will be using database server group id. + +Run the following openstack command to launch 4 VMs on different computes with anti-affinity policy, + +``` +# openstack server create --image Cirros --flavor m1.small --security-group default --nic net-id=37b9ab9a-f198-4db1-a5d6-5789b05bfb4c --hint group="498fd41b-8a8a-497a-afd8-bc361da2d74e" --max 4 anti-affinity-test +``` + +Output + +![Openstack-server-create-anti-affinity-hint-option][1] + +Use below openstack command to verify whether VMs are launched on different compute nodes or not + +``` +# openstack server list --long -c Name -c Status -c Host -c "Power State" | grep -i anti-affinity-test +``` + +![Anti-Affinity-VMs-Status-OpenStack][1] + +Above output confirms that our anti-affinity policy is also working fine. + +**Note:** Default Quota for Server group is 10 for every tenant , it means we can max launch 10 VMs inside a server group. + +Use below command to view Server Group quota for a specific tenant, replace the tenant id that suits to your setup + +``` +# openstack quota show f6852d73eaee497a8a640757fe02b785 | grep -i server_group +| server_group_members | 10 | +| server_groups | 10 | +# +``` + +To update Server Group Quota, execute the following commands + +``` +# nova quota-update --server-group-members 15 f6852d73eaee497a8a640757fe02b785 +# nova quota-update --server-groups 15 f6852d73eaee497a8a640757fe02b785 +``` + +Now re-run the openstack quota command to verify server group quota + +``` +# openstack quota show f6852d73eaee497a8a640757fe02b785 | grep -i server_group +| server_group_members | 15 | +| server_groups | 15 | +# +``` + +That’s all, we have successfully updated Server Group quota for the tenant. This conclude the article as well, please do hesitate to share it among your technical friends. + + * [Facebook][4] + * [Twitter][5] + * [LinkedIn][6] + * [Reddit][7] + + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/create-affinity-anti-affinity-policy-openstack/ + +作者:[Pradeep Kumar][a] +选题:[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/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/OpenStack-VMs-Affinity-AntiAffinity-Policy.jpg +[3]: https://www.linuxtechi.com/create-delete-virtual-machine-command-line-openstack/ +[4]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Fcreate-affinity-anti-affinity-policy-openstack%2F&t=How%20to%20Create%20Affinity%20and%20Anti-Affinity%20Policy%20in%20OpenStack +[5]: http://twitter.com/share?text=How%20to%20Create%20Affinity%20and%20Anti-Affinity%20Policy%20in%20OpenStack&url=https%3A%2F%2Fwww.linuxtechi.com%2Fcreate-affinity-anti-affinity-policy-openstack%2F&via=Linuxtechi +[6]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Fcreate-affinity-anti-affinity-policy-openstack%2F&title=How%20to%20Create%20Affinity%20and%20Anti-Affinity%20Policy%20in%20OpenStack +[7]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Fcreate-affinity-anti-affinity-policy-openstack%2F&title=How%20to%20Create%20Affinity%20and%20Anti-Affinity%20Policy%20in%20OpenStack From f08d7e630e079c10b2c3c6358faaf68250413af1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 00:58:15 +0800 Subject: [PATCH 407/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191110=20How=20?= =?UTF-8?q?universities=20are=20using=20open=20source=20to=20attract=20stu?= =?UTF-8?q?dents?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191110 How universities are using open source to attract students.md --- ...e using open source to attract students.md | 209 ++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 sources/tech/20191110 How universities are using open source to attract students.md diff --git a/sources/tech/20191110 How universities are using open source to attract students.md b/sources/tech/20191110 How universities are using open source to attract students.md new file mode 100644 index 0000000000..466ec93c9f --- /dev/null +++ b/sources/tech/20191110 How universities are using open source to attract students.md @@ -0,0 +1,209 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How universities are using open source to attract students) +[#]: via: (https://opensource.com/article/19/11/open-source-universities) +[#]: author: (Joshua Pearce https://opensource.com/users/jmpearce) + +How universities are using open source to attract students +====== +Many universities have begun new initiatives to attract students that +are excited about technical freedom and open source. +![Open education][1] + +Michigan Tech just launched [opensource.mtu.edu][2], a virtual one-stop free shop for all things open source on campus. According to their site, _[Tech Today][3]_: + +> "With the [majority of big companies now contributing to open source projects][4] it is clearly a major trend. [All [major] supercomputers][5] (including our own supercomputer: [Superior][6]), 90% of cloud servers, 82% of smartphones, and 62% of embedded systems run on open source operating systems. More than 70% of ‘internet of things’ devices also use open source software. 90% of the Fortune Global 500 pay for the open source Linux operating system from Red Hat, a company that makes billions of dollars a year for the service they provide on top of the product that can be downloaded for free." + +The publication also says that "the open source hardware movement is [roughly 15 years][7] behind its software counterpart," but it appears to be catching up quickly. Given their mandate to "attract students that are excited about technical freedom and open source," many universities have started a new front in the battle for educational supremacy. + +Unlike conventional warfare, this is a battle that benefits the public. The more universities share using the open source paradigm, the faster technology moves forward with all of its concomitant benefits. The resources available through [opensource.mtu.edu][2] include: + + * [Thousands of free and open access articles in their Digital Commons][8]. + * Free data, including housing the [Free Inactive Patent Search][9], a tool to help find inactive patents that have fallen into the public domain. + * Free open source courses like [FOSS101][10]: Essentials of Free and Open Source Software, which teaches Linux commands and the Git revision control system, or [Open source 3D printing][11], which teaches OpenSCAD, FreeCAD, Blender, Arduino, and RepRap 3D printing. + * Student organizations like the [Open Source Hardware Enterprise][12], which is dedicated to the development and availability of open source hardware, and the [Open Source Club][13], which develops open source software. + * Free software, including the [Astrophysics Source Code Library (ASCL)][14] open repository, which now lists over 2,000 codes and the [Psychology Experiment Building Language (PEBL)][15] software for psychological testing used in laboratories and by clinicians around the world. + * Free hardware, including hundreds of digitally manufactured designs and dozens of complex machines for everything from [plastic recycling systems][16] to [open source lab equipment][17]. + + + +Michigan Tech is hardly alone with major initiatives across a broad swath of academia. Open access databases like [Academia][18], [OSF preprints][19], [ResearchGate][20], [PrePrints][21], and [Science Open][22] swell with millions of free, open access, peer-reviewed articles. The Center for Open Science supports the [Open Science Framework][23], which is a "free and open source project management tool that supports researchers throughout their entire project" lifecycle, including storing Gigabytes of data: + +![Open Source Framework \(OSF\) workflow.][24] + +_Source: [OSF][25]_ + +You can choose from a wide variety of course options at other institutions as well, and are generally able to take these courses at your own pace: + + * Rochester Institute of Technology students can [earn a minor in free and open source software][26] and free culture. + * Many of the world’s most renowned colleges and universities offer free courses to self-learners through [OpenCourseWare (OCW)][27]. None of the courses offered through OCW award credit, though. For that, you need to pay. + * Schools like [MIT][28], the University of Notre Dame, Yale, Carnegie Mellon, Delft, Stanford, Johns Hopkins, University of California Berkeley and the Open University (among many more) offer free academic content, such as syllabi, lecture notes, assignments, and examinations. + + + +Many universities also contribute to free and open source software (FOSS) and free and open source hardware (FOSH). In fact, many universities—including American International University West Africa, Brandeis University, Indiana University, and the University of Southern Queensland—are [Open Source Initiative (OSI) Affiliates][29]. The University of Texas even has [formal policies][30] in place for contributing to open source. + +### Universities using open source in higher education + +In addition, the vast majority of universities use FOSS. [PortalProgramas][31] ranked Tufts University as the top higher education user of FOSS. Even more representative is [Apereo][32], which is a network of universities actively supporting the use of open source in higher education. This network includes a long list of [member institutions][33]: + + * American Public University System   + * Beijing Open-mindness Technology Co., Ltd.   + * Blindside Networks   + * Boston University Questrom School of Business   + * Brigham Young University   + * Brock University   + * Brown University   + * California Community Colleges Technology Center + * California State University, Sacramento   + * Cirrus Identity   + * Claremont Colleges   + * Clark County School District   + * Duke University   + * Edalex   + * Educational Service Unit Coordinating Council   + * ELAN e.V.   + * Entornos de Formación S.L (EDF)   + * ETH Zürich   + * Gert Sibande TVET College   + * HEC Montreal   + * Hosei University   + * Hotelschool the Hague   + * IlliniCloud   + * Instructional Media & Magic   + * JISC   + * Kyoto University   + * LAMP + * Learning Experiences   + * Longsight. Inc.   + * MPL, Ltda.   + * Nagoya University   + * New York University   + * North-West University   + * Oakland University   + * OPENCOLLAB + * Oxford University   + * Pepperdine University   + * Princeton University   + * Rice University   + * Roger Williams University   + * Rutgers University   + * Sinclair Community College   + * SWITCH   + * Texas State University, San Marcos   + * Unicon   + * Universidad Politecnica de Valencia   + * Universidad Publica de Navarra   + * Universitat de Lleida   + * Universite de Rennes 1   + * Universite de Valenciennes   + * University of Amsterdam   + * University of California, Berkeley   + * University of Cape Town   + * University of Edinburgh   + * University of Illinois   + * University of Kansas   + * University of Manchester   + * University of Michigan   + * University of North Carolina, Chapel Hill   + * University of Notre Dame   + * University of South Africa UNISA   + * University of Virginia   + * University of Wisconsin-Madison   + * University of Witwatersrand   + * Western University   + * Whitman College +  + + + +Another popular organization is [Kuali][34], which is a nonprofit that produces open source administrative software for higher education institutions. Their members include: + + * Boston University + * California State University, Office of the Chancellor + * Colorado State University + * Cornell University + * Drexel University + * Indiana University + * Marist College + * Massachusetts Institute of Technology + * Michigan State University + * North-West University, South Africa + * Research Foundation of The City University of New York + * Stevens Institute of Technology + * Strathmore University + * Tufts University + * University Corporation for Atmospheric Research + * Universidad del Sagrado Corazon + * University of Arizona + * University of California, Davis + * University of California, Irvine + * University of Connecticut + * University of Hawaii + * University of Illinois + * University of Maryland, Baltimore + * University of Maryland, College Park + * University of Toronto + * West Virginia University + + + +Didn't see your favorite university on the list? If that school has been involved in open source, please leave a comment below telling me what your school is doing in open source. If you want to see your favorite school on the list and they aren't doing much in open source, you can encourage them by sending a letter asking the program heads to: + + * Institutionalize sharing their research open access in their own Digital Commons and/or use one of the many free repositories. + * Share research data on the Open Science Framework. + * Provide OCW and/or offer courses and programs specifically focused on open source. + * Start and/or expand their use of FOSS and FOSH on campus, and/or join or . + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/open-source-universities + +作者:[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/osdc_OER_520x292_FINAL.png?itok=DBCJ4H1s (Open education) +[2]: https://opensource.mtu.edu/ +[3]: https://www.mtu.edu/ttoday/?issue=20191022 +[4]: https://opensource.com/business/16/5/2016-future-open-source-survey +[5]: https://www.zdnet.com/article/supercomputers-all-linux-all-the-time/ +[6]: https://hpc.mtu.edu/ +[7]: https://www.mdpi.com/2411-5134/3/3/44 +[8]: https://digitalcommons.mtu.edu/ +[9]: https://opensource.com/article/17/1/making-us-patent-system-useful-again +[10]: https://mtu.instructure.com/courses/1147020 +[11]: https://opensource.com/article/19/2/3d-printing-course +[12]: http://openhardware.eit.mtu.edu/ +[13]: http://mtuopensource.club/ +[14]: https://ascl.net/ +[15]: http://pebl.sourceforge.net/ +[16]: https://www.appropedia.org/Recyclebot +[17]: https://www.appropedia.org/Open-source_Lab +[18]: https://www.academia.edu/ +[19]: https://cos.io/our-products/osf-preprints/ +[20]: https://www.researchgate.net/ +[21]: https://www.preprints.org/ +[22]: https://www.scienceopen.com/ +[23]: https://osf.io/ +[24]: https://opensource.com/sites/default/files/uploads/osf_workflow_-_hero.original600_copy_0.png +[25]: https://cdn.cos.io/media/images/OSF_workflow_-_hero.original.png +[26]: http://www.rit.edu/news/story.php?id=50590 +[27]: https://learn.org/articles/25_Colleges_and_Universities_Ranked_by_Their_OpenCourseWare.html +[28]: https://ocw.mit.edu/index.htm +[29]: https://opensource.org/affiliates +[30]: https://it.utexas.edu/policies/releasing-software-open-source +[31]: http://www.portalprogramas.com/en/open-source-universities-ranking/about +[32]: https://www.apereo.org/ +[33]: https://www.apereo.org/content/apereo-member-organizations +[34]: https://www.kuali.org/ From 31227a1eb0c7bab778eb19282a2f9dceb24b9d2c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 01:00:46 +0800 Subject: [PATCH 408/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191108=20How=20?= =?UTF-8?q?to=20manage=20music=20tags=20using=20metaflac?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191108 How to manage music tags using metaflac.md --- ...How to manage music tags using metaflac.md | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 sources/tech/20191108 How to manage music tags using metaflac.md diff --git a/sources/tech/20191108 How to manage music tags using metaflac.md b/sources/tech/20191108 How to manage music tags using metaflac.md new file mode 100644 index 0000000000..836f167d5a --- /dev/null +++ b/sources/tech/20191108 How to manage music tags using metaflac.md @@ -0,0 +1,148 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to manage music tags using metaflac) +[#]: via: (https://opensource.com/article/19/11/metaflac-fix-music-tags) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +How to manage music tags using metaflac +====== +Correct music tagging errors from the command line with this powerful +open source utility. +![website design image][1] + +I've been ripping CDs to my computer for a long time now. Over that time, I've used several different tools for ripping, and I have observed that each tool seems to have a different take on tagging, specifically, what metadata to save with the music data. By "observed," I mean that music players seem to sort albums in a funny order, they split tracks in one physical directory into two albums, or they create other sorts of frustrating irritations. + +I've also learned that some of the tags are pretty obscure, and many music players and tag editors don't show them. Even so, they may use them for sorting or displaying music in some edge cases, like where the player separates all the music files containing tag XYZ into a different album from all the files not containing that tag. + +So if the tagging applications and music players don't show the "weirdo" tags—but are somehow affected by them—what can you do? + +### Metaflac to the rescue! + +I have been meaning to get familiar with **[metaflac][2]**, the open source command-line metadata editor for [FLAC files][3], which is my open source music file format of choice. Not that there is anything wrong with great tag-editing software like [EasyTAG][4], but the old saying "if all you have is a hammer…" comes to mind. Also, from a practical perspective, my home and office stereo music needs are met by small, dedicated servers running [Armbian][5] and [MPD][6], with the music files stored locally, running a very stripped-down, music-only headless environment, so a command-line metadata management tool would be quite useful. + +The screenshot below shows the typical problem created by my long-term ripping program: Putumayo's wonderful compilation of Colombian music appears as two separate albums, one containing a single track, the other containing the remaining 11: + +![Album with incorrect tags][7] + +I used metaflac to generate a list of all the tags for all of the FLAC files in the directory containing those tracks: + + +``` +rm -f tags.txt +for f in *.flac; do +        echo $f >> tags.txt +        metaflac --export-tags-to=tags.tmp "$f" +        cat tags.tmp >> tags.txt +        rm tags.tmp +done +``` + +I saved this as an executable shell script (see my colleague [David Both][8]'s wonderful series of columns on Bash shell scripting, [particularly the one on loops][9]). Basically, what I'm doing here is creating a file, _tags.txt_, containing the filename (the **echo** command) followed by all its flags, followed by the next filename, and so forth. Here are the first few lines of the result: + + +``` +A Guapi.flac +TITLE=A Guapi +ARTIST=Grupo Bahia +ALBUMARTIST=Various Artists +ALBUM=Putumayo Presents: Colombia +DATE=2001 +TRACKTOTAL=12 +GENRE=Latin Salsa +MUSICBRAINZ_ALBUMARTISTID=89ad4ac3-39f7-470e-963a-56509c546377 +MUSICBRAINZ_ALBUMID=6e096386-1655-4781-967d-f4e32defb0a3 +MUSICBRAINZ_ARTISTID=2993268d-feb6-4759-b497-a3ef76936671 +DISCID=900a920c +ARTISTSORT=Grupo Bahia +MUSICBRAINZ_DISCID=RwEPU0UpVVR9iMP_nJexZjc_JCc- +COMPILATION=1 +MUSICBRAINZ_TRACKID=8a067685-8707-48ff-9040-6a4df4d5b0ff +ALBUMARTISTSORT=50 de Joselito, Los +Cumbia Del Caribe.flac +``` + +After a bit of investigation, it turns out I ripped a number of my Putumayo CDs at the same time, and whatever software I was using at the time seems to have put the MUSICBRAINZ_ tags on all but one of the files. (A bug? Probably; I see this on a half-dozen albums.) Also, with respect to the sometimes unusual sorting, note the ALBUMARTISTSORT tag moved the Spanish article "Los" to the end of the artist name, after a comma. + +I used a simple **awk** script to list all the tags reported in the _tags.txt_ file: + + +``` +`awk -F= 'index($0,"=") > 0 {print $1}' tags.txt | sort -u` +``` + +This split all lines into fields using **=** as the field separator and prints the first field of lines containing an equals sign. The results are passed through sort with the **-u** flag, which eliminates all duplication in the output (see my colleague Seth Kenlon's great [article on the **sort** utility][10]). For this specific _tags.txt_ file, the output is: + + +``` +ALBUM +ALBUMARTIST +ALBUMARTISTSORT +ARTIST +ARTISTSORT +COMPILATION +DATE +DISCID +GENRE +MUSICBRAINZ_ALBUMARTISTID +MUSICBRAINZ_ALBUMID +MUSICBRAINZ_ARTISTID +MUSICBRAINZ_DISCID +MUSICBRAINZ_TRACKID +TITLE +TRACKTOTAL +``` + +Sleuthing around a bit, I found that the MUSICBRAINZ_ flags appear on all but one FLAC file, so I used the metaflac command to delete those flags: + + +``` +for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ALBUMARTISTID "$f"; done +for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ALBUMID "$f"; done +for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ARTISTID "$f"; done +for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_DISCID "$f"; done +for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_TRACKID "$f"; done +``` + +Once that's done, I can rebuild the MPD database with my music player. Here are the results: + +![Album with correct tags][11] + +And, there we are—all 12 tracks together in one album. + +So, yeah, I'm lovin' metaflac a whole bunch. I expect I'll be using it more often as I try to wrangle the last bits of weirdness in my music collection's music tags. It's highly recommended! + +### And the music + +I've been spending a few evenings listening to Odario Williams' program _After Dark_ on CBC Music. (CBC is Canada's public broadcasting corporation.) Thanks to Odario, one of the albums I've really come to enjoy is [_Songs for Cello and Voice_ by Kevin Fox][12]. Here he is, covering the Eurythmics tune "[Sweet Dreams (Are Made of This)][13]." + +I bought this on CD, and now it's on my music server with its tags properly organized! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/metaflac-fix-music-tags + +作者:[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/web-design-monitor-website.png?itok=yUK7_qR0 (website design image) +[2]: https://xiph.org/flac/documentation_tools_metaflac.html +[3]: https://xiph.org/flac/index.html +[4]: https://wiki.gnome.org/Apps/EasyTAG +[5]: https://www.armbian.com/ +[6]: https://www.musicpd.org/ +[7]: https://opensource.com/sites/default/files/uploads/music-tags1_before.png (Album with incorrect tags) +[8]: https://opensource.com/users/dboth +[9]: https://opensource.com/article/19/10/programming-bash-loops +[10]: https://opensource.com/article/19/10/get-sorted-sort +[11]: https://opensource.com/sites/default/files/uploads/music-tags2_after.png (Album with correct tags) +[12]: https://burlingtonpac.ca/events/kevin-fox/ +[13]: https://www.youtube.com/watch?v=uyN66XI1zp4 From b9aadb4f86b80beb71c4636a877bfb9d74da462e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 01:01:52 +0800 Subject: [PATCH 409/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191108=20My=20f?= =?UTF-8?q?irst=20open=20source=20contribution:=20Talk=20about=20your=20pu?= =?UTF-8?q?ll=20request?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191108 My first open source contribution- Talk about your pull request.md --- ...tribution- Talk about your pull request.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sources/tech/20191108 My first open source contribution- Talk about your pull request.md diff --git a/sources/tech/20191108 My first open source contribution- Talk about your pull request.md b/sources/tech/20191108 My first open source contribution- Talk about your pull request.md new file mode 100644 index 0000000000..04e78e7b39 --- /dev/null +++ b/sources/tech/20191108 My first open source contribution- Talk about your pull request.md @@ -0,0 +1,45 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My first open source contribution: Talk about your pull request) +[#]: via: (https://opensource.com/article/19/11/first-open-source-contribution-communicate-pull-request) +[#]: author: (Galen Corey https://opensource.com/users/galenemco) + +My first open source contribution: Talk about your pull request +====== +I finally heard back from the project and my code was merged. +![speech bubble that says tell me more][1] + +Previously, I wrote about [keeping your code relevant][2] when making a contribution to an open source project. Now, you finally click **Create pull request**. You're elated, you're done. + +At first, I didn’t even care whether my code would get merged or not. I had done my part. I knew I could do it. The future lit up with the many future pull requests that I would make to open source projects. + +But of course, I did want my code to become a part of my chosen project, and soon I found myself googling, "How long does it take for an open source pull request to get merged?" The results weren’t especially conclusive. Due to the nature of open source (the fact that anyone can participate in it), processes for maintaining projects vary widely. But I found a tweet somewhere that confidently said: "If you don’t hear back in two months, you should reach out to the maintainers." + +Well, two months came and went, and I heard nothing. I also did not reach out to the maintainers, since talking to people and asking them to critique your work is scary. But I wasn’t overly concerned. I told myself that two months was probably an average, so I put it in the back of my mind. + +At four months, there was still no response. I opted for the passive approach again. I decided not to try to get in touch with the maintainers, but my reasoning this time was more negative. I started to wonder if some of my earlier assumptions about how actively maintained the project was were wrong—maybe no one was keeping up with incoming pull requests. Or maybe they didn’t look at pull requests from random people. I put the issue in the back of my mind again, this time with less hope of ever seeing a result. + +I had nearly given up hope entirely and forgotten about the whole thing when, six months after I made my original pull request, I finally heard back. After making a few small changes that they requested, my code was approved and merged. My fifth mistake was giving up on my contribution when I did not hear back and failing to be communicative about my work. + +Don’t be afraid to communicate about your pull request. Doing so could mean something as simple as adding a comment to your issue that says, “Hey, I’m working on this!" And don’t give up hope just because you don’t get a response for a while. The amount of time that it takes will vary based on who is maintaining the project and how much time they have to devote to maintaining it. + +This story has a happy ending. My code was merged. I hope that by sharing some parts of the experience that tripped me up on my first open source journey, I can smooth the path for some of you who want to explore open source for the first time. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/first-open-source-contribution-communicate-pull-request + +作者:[Galen Corey][a] +选题:[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/galenemco +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSCD_MPL3_520x292_FINAL.png?itok=cp6TbjVI (speech bubble that says tell me more) +[2]: https://opensource.com/article/19/10/my-first-open-source-contribution-relevant-code From 872f2f6a808358a424032fa255bc08fa47839843 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 01:04:50 +0800 Subject: [PATCH 410/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191108=20My=20L?= =?UTF-8?q?inux=20story:=20Learning=20Linux=20in=20the=2090s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191108 My Linux story- Learning Linux in the 90s.md --- ... Linux story- Learning Linux in the 90s.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20191108 My Linux story- Learning Linux in the 90s.md diff --git a/sources/tech/20191108 My Linux story- Learning Linux in the 90s.md b/sources/tech/20191108 My Linux story- Learning Linux in the 90s.md new file mode 100644 index 0000000000..ae9bb5c230 --- /dev/null +++ b/sources/tech/20191108 My Linux story- Learning Linux in the 90s.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Linux story: Learning Linux in the 90s) +[#]: via: (https://opensource.com/article/19/11/learning-linux-90s) +[#]: author: (Mike Harris https://opensource.com/users/mharris) + +My Linux story: Learning Linux in the 90s +====== +This is the story of how I learned Linux before the age of WiFi, when +distributions came in the form of a CD. +![Sky with clouds and grass][1] + +Most people probably don't remember where they, the computing industry, or the everyday world were in 1996. But I remember that year very clearly. I was a sophomore in high school in the middle of Kansas, and it was the start of my journey into free and open source software (FOSS). + +I'm getting ahead of myself here. I was interested in computers even before 1996. I was born and raised on my family's first Apple ][e, followed many years later by the IBM Personal System/2. (Yes, there were definitely some generational skips along the way.) The IBM PS/2 had a very exciting feature: a 1200 baud Hayes modem. + +I don't remember how, but early on, I got the phone number of a local [BBS][2]. Once I dialed into it, I could get a list of other BBSes in the local area, and my adventure into networked computing began. + +In 1995, the people [lucky enough][3] to have a home internet connection spent less than 30 minutes a month using it. That internet was nothing like our modern services that operate over satellite, fiber, CATV coax, or any version of copper lines. Most homes dialed in with a modem, which tied up their phone line. (This was also long before cellphones were pervasive, and most people had just one home phone line.) I don't think there were many independent internet service providers (ISPs) back then, although that may have depended upon where you were located, so most people got service from a handful of big names, including America Online, CompuServe, and Prodigy. + +And the service you did get was very slow; even at dial-up's peak evolution at 56K, you could only expect to get a maximum of about 3.5 Kbps. If you wanted to try Linux, downloading a 200MB to 800MB ISO image or (more realistically) a disk image set was a dedication to time, determination, and lack of phone usage. + +I went with the easier route: In 1996, I ordered a "tri-Linux" CD set from a major Linux distributor. These tri-Linux disks provided three distributions; mine included Debian 1.1 (the first stable release of Debian), Red Hat Linux 3.0.3, and Slackware 3.1 (nicknamed Slackware '96). As I recall, the discs were purchased from an online store called [Linux Systems Labs][4]. The online store doesn't exist now, but in the 90s and early 00s, such distributors were common. And so were multi-disc sets of Linux. This one's from 1998 but gives you an idea of what they involved: + +![A tri-linux CD set][5] + +![A tri-linux CD set][6] + +On a fateful day in the summer of 1996, while living in a new and relatively rural city in Kansas, I made my first attempt at installing and working with Linux. Throughout the summer of '96, I tried all three distributions on that tri-Linux CD set. They all ran beautifully on my mom's older Pentium 75MHz computer. + +I ended up choosing [Slackware][7] 3.1 as my preferred distribution, probably more because of the terminal's appearance than the other, more important reasons one should consider before deciding on a distribution. + +I was up and running. I was connecting to an "off-brand" ISP (a local provider in the area), dialing in on my family's second phone line (ordered to accommodate all my internet use). I was in heaven. I had a dual-boot (Microsoft Windows 95 and Slackware 3.1) computer that worked wonderfully. I was still dialing into the BBSes that I knew and loved and playing online BBS games like Trade Wars, Usurper, and Legend of the Red Dragon. + +I can remember spending days upon days of time in #Linux on EFNet (IRC), helping other users answer their Linux questions and interacting with the moderation crew. + +More than 20 years after taking my first swing at using the Linux OS at home, I am now entering my fifth year as a consultant for Red Hat, still using Linux (now Fedora) as my daily driver, and still on IRC helping people looking to use Linux. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/learning-linux-90s + +作者:[Mike Harris][a] +选题:[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/mharris +[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]: https://en.wikipedia.org/wiki/Bulletin_board_system +[3]: https://en.wikipedia.org/wiki/Global_Internet_usage#Internet_users +[4]: https://web.archive.org/web/19961221003003/http://lsl.com/ +[5]: https://opensource.com/sites/default/files/20191026_142009.jpg (A tri-linux CD set) +[6]: https://opensource.com/sites/default/files/20191026_142020.jpg (A tri-linux CD set) +[7]: http://slackware.com From 15f011abbd3dd4a8aae198c86d906c5d7bcca1b3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 01:10:52 +0800 Subject: [PATCH 411/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191108=207=20Be?= =?UTF-8?q?st=20Open=20Source=20Tools=20that=20will=20help=20in=20AI=20Tec?= =?UTF-8?q?hnology?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191108 7 Best Open Source Tools that will help in AI Technology.md --- ...e Tools that will help in AI Technology.md | 164 ++++++++++++++++++ 1 file changed, 164 insertions(+) create mode 100644 sources/talk/20191108 7 Best Open Source Tools that will help in AI Technology.md diff --git a/sources/talk/20191108 7 Best Open Source Tools that will help in AI Technology.md b/sources/talk/20191108 7 Best Open Source Tools that will help in AI Technology.md new file mode 100644 index 0000000000..de3744b9a0 --- /dev/null +++ b/sources/talk/20191108 7 Best Open Source Tools that will help in AI Technology.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Best Open Source Tools that will help in AI Technology) +[#]: via: (https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/) +[#]: author: (Nitin Garg https://opensourceforu.com/author/nitin-garg/) + +7 Best Open Source Tools that will help in AI Technology +====== + +[![][1]][2] + +_Artificial intelligence is an exceptional technology following the futuristic approach. In this progressive era, it’s capturing the attention of all the multination organizations. Some of the popular names in the industry like Google, IBM, Facebook, Amazon, Microsoft constantly investing in this new-age technology._ + +Anticipate in business needs using artificial intelligence and take research and development on another level. This advanced technology is becoming an integral part of organizations in research and development offering ultra-intelligent solutions. It helps you maintain accuracy and increase productivity with better results. + +AI open source tools and technologies are capturing the attention of every industry providing with frequent and accurate results. These tools help you analyse your performance while providing you with a boost to generate greater revenue. + +Without further ado, here we have listed some of the best open-source tools to help you understand artificial intelligence better. + +**1\. TensorFlow** + +TensorFlow is an open-source machine learning framework used for Artificial Intelligence. It is basically developed to conduct machine learning and deep learning for research and production. TensorFlow allows developers to create dataflow graphics structure, It moves through a network or a system node, and the graph provides a multidimensional array or tensor of data. + +TensorFlow is an exceptional tool that offers countless advantages. + + * Simplifies the numeric computation + * TensorFlow offers flexibility on multiple models. + * TensorFlow improves business efficiency + * Highly portable + * Automatic differentiate capabilities. + + + +**2\. Apache SystemML** + +Apache SystemML is a very popular open-source machine learning platform created by IBM offering a favourable workplace using big data. It can run efficiently and on Apache Spark and automatically scale your data while determining whether your code can run on the drive or Apache Spark Cluster. Not just that, its lucrative features make it stand out in the industry offers; + + * Algorithms customization + * Multiple Execution Modes + * Automatic Optimisation + + + +It also supports deep learning while enabling developers to implement machine learning code and optimizing it with more effectiveness. + +**3\. OpenNN** + +OpenNN is an open-source artificial intelligence neural network library for progressive analytics. It helps you develop robust models with C++ and Python while containing algorithms and utilities to deal with machine learning solutions likes forecasting and classification. It also covers regression and association providing high performance and technology evolution in the industry. + +It possesses numerous lucrative features like; + + * Digital Assistance + * Predictive Analysis + * Fast Performance + * Virtual Personal Assistance + * Speech Recognition + * Advanced Analytics + + + +It helps you design advance solutions implementing data mining methods for fruitful results. + +**4\. Caffe** + +Caffe (Convolutional Architecture for Fast Feature Embedding) is an open-source deep learning framework. It considers speed, modularity, and expressions the most. Caffe was originally developed at the University of California, Berkeley Vision and Learning Centre, written in C++ with a python interface. It smoothly works on operating system Linux, macOS, and Windows. + +Some of the key features of Caffe that helps in AI technology. + + 1. Expressive Architecture + 2. Extensive Code + 3. Large Community + 4. Active Development + 5. Speedy Performance + + + +It helps you inspire innovation while introducing stimulated growth. Make full use of this tool to get desired results. + +**5\. Torch** + +Torch is an open-source machine learning library which, helps you simplify complex task like serialization, object-oriented programming by offering multiple convenient functions. It offers the utmost flexibility and speed in machine learning projects. Torch is written using scripting language Lua and comes with an underlying C implementation. It is used in multiple organization and research labs. + +Torch has countless advantages like; + + * Fast & Effective GPU Support + * Linear algebra Routines + * Support for iOS & Android Platform + * Numeric Optimization Routine + * N-dimensional arrays + + + +**6\. Accord .NET** + +Accord .NET is one of the renown free, open-source AI development tool. It has a set of libraries for combining audio and image processing libraries written in C#. From computer vision to computer audition, signal processing and statistics applications it helps you build everything for commercial use. It comes with a comprehensive set of the sample application for quick running and extensive range of libraries. + +You can develop an advance app using Accord .NET using attention-grabbing features like; + + * Statistical Analysis + * Data Ingestions + * Adaptive + * Deep Learning + * Second-order neural network learning algorithms + * Digital Assistance & Multi-languages + * Speech recognition + + + +**7\. Scikit-Learn** + +Scikit-learn is one of the popular open-source tools that will help in AI technology. It is a valuable library for machine learning in Python. It includes efficient tools like machine learning and statistical modelling including classification, clustering, regression and dimensionality reduction. + +Let’s find out more about Scikit-Learn features; + + * Cross-validation + * Clustering and Classification + * Manifold Learning + * Machine Learning + * Virtual process Automation + * Workflow Automation + + + +From preprocessing to model selection Scikit-learn helps you take care of everything. It simplifies the complete task from data mining to data analysis. + +**Final Thought** + +These are some of the popular open-source AI tools which provide with the comprehensive range of features. Before developing the new-age application, one must select one of the tools and work accordingly. These tools provide with advanced Artificial Intelligence solutions keeping recent trends in mind. + +Artificial intelligence is used globally and it’s marking its presence all around the world. With applications like Amazon Alexa, Siri, AI is providing customers with ultimate user experience. Its offering significant benefit in the industry capturing users attention. Among all the industries like healthcare, banking, finance, e-commerce artificial intelligence is contributing to growth and productivity while saving a lot of time and efforts. + +Select any one of these open-source tools for better user experience and unbelievable results. It will help you grow and get a better result in terms of quality and security. + +![Avatar][3] + +[Nitin Garg][4] + +The author is the CEO and co-founder of BR Softech – [Business intelligence software company][5]. Likes to share his opinions on IT industry via blogs. His interest is to write on the latest and advanced IT technologies which include IoT, VR & AR app development, web, and app development services. Along with this, he also offers consultancy services for RPA, Big Data and Cyber Security services. + +[![][6]][7] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/ + +作者:[Nitin Garg][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/nitin-garg/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2018/05/Artificial-Intelligence_EB-June-17.jpg?resize=696%2C464&ssl=1 (Artificial Intelligence_EB June 17) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2018/05/Artificial-Intelligence_EB-June-17.jpg?fit=1000%2C667&ssl=1 +[3]: https://secure.gravatar.com/avatar/d4e6964b80590824b981f06a451aa9e6?s=100&r=g +[4]: https://opensourceforu.com/author/nitin-garg/ +[5]: https://www.brsoftech.com/bi-consulting-services.html +[6]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 918c81a8d644739d39fe5d29b7a5037cfd83722a Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 11 Nov 2019 08:55:39 +0800 Subject: [PATCH 412/800] translated --- ...figure Nagios Core on CentOS 8 - RHEL 8.md | 271 ----------------- ...figure Nagios Core on CentOS 8 - RHEL 8.md | 272 ++++++++++++++++++ 2 files changed, 272 insertions(+), 271 deletions(-) delete mode 100644 sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md create mode 100644 translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md diff --git a/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md deleted file mode 100644 index b56e4fa2ab..0000000000 --- a/sources/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md +++ /dev/null @@ -1,271 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install and Configure Nagios Core on CentOS 8 / RHEL 8) -[#]: via: (https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/) -[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) - -How to Install and Configure Nagios Core on CentOS 8 / RHEL 8 -====== - -**Nagios** is a free and opensource network and alerting engine used to monitor various devices, such as network devices, and servers in a network. It supports both **Linux** and **Windows OS** and provides an intuitive web interface that allows you to easily monitor network resources. When professionally configured, it can alert you in the event a server or a network device goes down or malfunctions via email alerts. In this topic, we shed light on how you can install and configure Nagios core on **RHEL 8** / **CentOS 8**. - -[![Install-Nagios-Core-RHEL8-CentOS8][1]][2] - -### Prerequisites of Nagios Core - -Before we begin, perform a flight check and ensure you have the following: - - * An instance of RHEL 8 / CentOS 8 - * SSH access to the instance - * A fast and stable internet connection - - - -With the above requirements in check, let’s roll our sleeves! - -### Step 1: Install LAMP Stack - -For Nagios to work as expected, you need to install LAMP stack or any other web hosting stack since it’s going to run on a browser. To achieve this, execute the command: - -``` -# dnf install httpd mariadb-server php-mysqlnd php-fpm -``` - -![Install-LAMP-stack-CentOS8][1] - -You need to ensure that Apache web server is up and running. To do so, start and enable Apache server using the commands: - -``` -# systemctl start httpd -# systemctl enable httpd -``` - -![Start-enable-httpd-centos8][1] - -To check the status of Apache server run - -``` -# systemctl status httpd -``` - -![Check-status-httpd-centos8][1] - -Next, we need to start and enable MariaDB server, run the following commands - -``` -# systemctl start mariadb -# systemctl enable mariadb -``` - -![Start-enable-MariaDB-CentOS8][1] - -To check MariaDB status run: - -``` -# systemctl status mariadb -``` - -![Check-MariaDB-status-CentOS8][1] - -Also, you might consider hardening or securing your server and making it less susceptible to unauthorized access. To secure your server, run the command: - -``` -# mysql_secure_installation -``` - -Be sure to set a strong password for your MySQL instance. For the subsequent prompts, Type **Yes** and hit **ENTER** - -![Secure-MySQL-server-CentOS8][1] - -### Step 2: Install Required packages - -Apart from installing the LAMP server, some additional packages are needed for the installation and proper configuration of Nagios. Therefore, install the packages as shown below: - -``` -# dnf install gcc glibc glibc-common wget gd gd-devel perl postfix -``` - -![Install-requisite-packages-CentOS8][1] - -### Step 3: Create a Nagios user account - -Next, we need to create a user account for the Nagios user. To achieve this , run the command: - -``` -# adduser nagios -# passwd nagios -``` - -![Create-new-user-for-Nagios][1] - -Now, we need to create a group for Nagios and add the Nagios user to this group. - -``` -# groupadd nagiosxi -``` - -Now add the Nagios user to the group - -``` -# usermod -aG nagiosxi nagios -``` - -Also, add Apache user to the Nagios group - -``` -# usermod -aG nagiosxi apache -``` - -![Add-Nagios-group-user][1] - -### Step 4: Download and install Nagios core - -We can now proceed and install Nagios Core. The latest stable version in Nagios 4.4.5 which was released on August 19, 2019.  But first, download the Nagios tarball file from its official site. - -To download Nagios core, first head to the tmp directory - -``` -# cd /tmp -``` - -Next download the tarball file - -``` -# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz -``` - -![Download-Nagios-CentOS8][1] - -After downloading the tarball file, extract it using the command: - -``` -# tar -xvf nagios-4.4.5.tar.gz -``` - -Next, navigate to the uncompressed folder - -``` -# cd nagios-4.4.5 -``` - -Run the commands below in this order - -``` -# ./configure --with-command-group=nagcmd -# make all -# make install -# make install-init -# make install-daemoninit -# make install-config -# make install-commandmode -# make install-exfoliation -``` - -To setup Apache configuration issue the command: - -``` -# make install-webconf -``` - -### Step 5: Configure Apache Web Server Authentication - -Next, we are going to setup authentication for the user **nagiosadmin**. Please be mindful not to change the username or else, you may be required to perform further configuration which may be quite tedious. - -To set up authentication run the command: - -``` -# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin -``` - -![Configure-Apache-webserver-authentication-CentOS8][1] - -You will be prompted for the password of the nagiosadmin user. Enter and confirm the password as requested. This is the user that you will use to login to Nagios towards the end of this tutorial. - -For the changes to come into effect, restart your web server. - -``` -# systemctl restart httpd -``` - -### Step 6: Download & install Nagios Plugins - -Plugins will extend the functionality of the Nagios Server. They will help you monitor various services, network devices, and applications. To download the plugin tarball file run the command: - -``` -# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz -``` - -Next, extract the tarball file and navigate to the uncompressed plugin folder - -``` -# tar -xvf nagios-plugins-2.2.1.tar.gz -# cd nagios-plugins-2.2.1 -``` - -To install the plugins compile the source code as shown - -``` -# ./configure --with-nagios-user=nagios --with-nagios-group=nagiosxi -# make -# make install -``` - -### Step 7: Verify and Start Nagios - -After the successful installation of Nagios plugins, verify the Nagios configuration to ensure that all is well and there is no error in the configuration: - -``` -# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg -``` - -![Verify-Nagios-settings-CentOS8][1] - -Next, start Nagios and verify its status - -``` -# systemctl start nagios -# systemctl status nagios -``` - -![Start-check-status-Nagios-CentOS8][1] - -In case Firewall is running on system then allow “80” using the following command - -``` -# firewall-cmd --permanent --add-port=80/tcp# firewall-cmd --reload -``` - -### Step 8: Access Nagios dashboard via the web browser - -To access Nagios, browse your server’s IP address as shown - - - -A pop-up will appear prompting for the username and the password of the user we created earlier in Step 5. Enter the credentials and hit ‘**Sign In**’ - -![Access-Nagios-via-web-browser-CentOS8][1] - -This ushers you to the Nagios dashboard as shown below - -![Nagios-dashboard-CentOS8][1] - -We have finally successfully installed and configured Nagios Core on CentOS 8 / RHEL 8. Your feedback is most welcome. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/ - -作者:[James Kiarie][a] -选题:[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/james/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-Nagios-Core-RHEL8-CentOS8.jpg diff --git a/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..7596a615dc --- /dev/null +++ b/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install and Configure Nagios Core on CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +如何在 CentOS 8 / RHEL 8 上安装和配置 Nagios Core +====== + +**Nagios** 是一个免费开源网络和警报引擎,它用于监视各种设备,例如网络设备和网络中的服务器。它支持 **Linux** 和 **Windows**,并提供直观的 Web 界面,可让你轻松监控网络资源。经过专业配置后,它可以在服务器或网络设备下线或者故障时向你发出邮件警报。在本文中,我们说明了如何在 **RHEL 8** / **CentOS 8** 上安装和配置 Nagios Core。 + +[![Install-Nagios-Core-RHEL8-CentOS8][1]][2] + +### Nagios Core 的先决条件 + +在开始之前,请先检查并确保有以下各项: + + + * RHEL 8 / CentOS 8 的实例 + * 能通过 SSH 访问实例 + * 快速稳定的互联网连接 + + + +满足上述要求后,我们开始吧! + +### 步骤 1:安装 LAMP + +为了使 Nagios 能够按预期工作,你需要安装 LAMP 或其他网络托管软件,因为它们将在浏览器上运行。 为此,请执行以下命令: + +``` +# dnf install httpd mariadb-server php-mysqlnd php-fpm +``` + +![Install-LAMP-stack-CentOS8][1] + +你需要确保 Apache Web 服务器已启动并正在运行。 为此,请使用以下命令启用并启动 Apache 服务器: + +``` +# systemctl start httpd +# systemctl enable httpd +``` + +![Start-enable-httpd-centos8][1] + +检查 Apache 服务器运行状态 + +``` +# systemctl status httpd +``` + +![Check-status-httpd-centos8][1] + +接下来,我们需要启用并启动 MariaDB 服务器,运行以下命令 + +``` +# systemctl start mariadb +# systemctl enable mariadb +``` + +![Start-enable-MariaDB-CentOS8][1] + +要检查 MariaDB 状态,请运行: + +``` +# systemctl status mariadb +``` + +![Check-MariaDB-status-CentOS8][1] + +另外,你可能会考虑加强或保护服务器,使其不容易受到未经授权的访问。要保护服务器,请运行以下命令: + +``` +# mysql_secure_installation +``` + +确保为你的 MySQL 实例设置一个强密码。对于后续提示,请输入 **Yes** 并按**回车** + +![Secure-MySQL-server-CentOS8][1] + +### 步骤 2:安装必需的软件包 + +除了安装 LAMP 外,还需要一些其他软件包来安装和正确配置 Nagios。因此,如下所示安装软件包: + +``` +# dnf install gcc glibc glibc-common wget gd gd-devel perl postfix +``` + +![Install-requisite-packages-CentOS8][1] + +### 步骤 3:创建 Nagios 用户帐户 + +接下来,我们需要为 Nagios 用户创建一个用户帐户。为此,请运行以下命令: + +``` +# adduser nagios +# passwd nagios +``` + +![Create-new-user-for-Nagios][1] + +现在,我们需要为 Nagios 创建一个组,并将 Nagios 用户添加到该组中。 + +``` +# groupadd nagiosxi +``` + +现在添加 Nagios 用户到组中 + +``` +# usermod -aG nagiosxi nagios +``` + +另外,将 Apache 用户添加到 Nagios 组 + +``` +# usermod -aG nagiosxi apache +``` + +![Add-Nagios-group-user][1] + +### 步骤 4:下载并安装 Nagios Core + +现在,我们可以继续安装 Nagios Core。Nagios 4.4.5 的最新稳定版本于 2019 年 8 月 19 日发布。但首先,请从它的官方网站下载 Nagios tarball 文件。 + +要下载 Nagios Core,请首进入 tmp 目录 + +``` +# cd /tmp +``` + +接下来下载 tarball 文件 + +``` +# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz +``` + +![Download-Nagios-CentOS8][1] + +下载完 tarball 文件后,使用以下命令将其解压缩: + +``` +# tar -xvf nagios-4.4.5.tar.gz +``` + +接下来,进入未压缩的文件夹 + +``` +# cd nagios-4.4.5 +``` + +按此顺序运行以下命令 + +``` +# ./configure --with-command-group=nagcmd +# make all +# make install +# make install-init +# make install-daemoninit +# make install-config +# make install-commandmode +# make install-exfoliation +``` + +要配置 Apache,请运行以下命令: + +``` +# make install-webconf +``` + +### 步骤 5:配置 Apache Web 服务器身份验证 + +接下来,我们将为用户 **nagiosadmin** 设置身份验证。请注意不要更改用户名,否则,可能会要求你进一步的配置,这可能很繁琐。 + +要设置身份验证,请运行以下命令: + +``` +# htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin +``` + +![Configure-Apache-webserver-authentication-CentOS8][1] + +系统将提示你输入 nagiosadmin 用户的密码。输入并按要求确认密码。在本教程结束时,你将使用该用户登录 Nagios。 + +为使更改生效,请重新启动 Web 服务器。 + +``` +# systemctl restart httpd +``` + +### 步骤 6:下载并安装 Nagios 插件 + +插件将扩展 Nagios 服务器的功能。它们将帮助你监控各种服务、网络设备和应用。要下载插件 tarball 文件,请运行以下命令: + +``` +# wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz +``` + +接下来,解压 tarball 文件并进入到未压缩的插件文件夹 + +``` +# tar -xvf nagios-plugins-2.2.1.tar.gz +# cd nagios-plugins-2.2.1 +``` + +要安装插件,请编译源代码,如下所示 + +``` +# ./configure --with-nagios-user=nagios --with-nagios-group=nagiosxi +# make +# make install +``` + +### 步骤 7:验证和启动 Nagios + +成功安装 Nagios 插件后,验证 Nagios 配置以确保一切良好,并且配置中没有错误: + +``` +# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg +``` + +![Verify-Nagios-settings-CentOS8][1] + +接下来,启动 Nagios 并验证其状态 + +``` +# systemctl start nagios +# systemctl status nagios +``` + +![Start-check-status-Nagios-CentOS8][1] + +如果系统中有防火墙,那么使用以下命令允许 ”80“ 端口 + +``` +# firewall-cmd --permanent --add-port=80/tcp# firewall-cmd --reload +``` + +### 步骤 8:通过 Web 浏览器访问 Nagios 面板 + +要访问 Nagios,请打开服务器的 IP 地址,如下所示 + + + +这将出现一个弹出窗口,提示输入我们在步骤 5 创建的用户名和密码。输入凭据并点击”**登录**“ + +![Access-Nagios-via-web-browser-CentOS8][1] + +这将引导你到 Nagios 面板,如下所示 + +![Nagios-dashboard-CentOS8][1] + +我们终于成功地在 CentOS 8 / RHEL 8 上安装和配置了 Nagios Core。欢迎你的反馈。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/ + +作者:[James Kiarie][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.linuxtechi.com/author/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-Nagios-Core-RHEL8-CentOS8.jpg From 8af60d902b7f2d182a14096671a6e11c92f1adbd Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 11 Nov 2019 09:02:45 +0800 Subject: [PATCH 413/800] translating --- ...enerate Patching Compliance Report on CentOS-RHEL Systems.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md b/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md index ecab2ad704..2050ca69bc 100644 --- a/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md +++ b/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 816336e2d6fabd253c2255e2790d790b6b1a0aa9 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Nov 2019 09:51:28 +0800 Subject: [PATCH 414/800] Rename sources/talk/20191108 7 Best Open Source Tools that will help in AI Technology.md to sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md --- ...08 7 Best Open Source Tools that will help in AI Technology.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => tech}/20191108 7 Best Open Source Tools that will help in AI Technology.md (100%) diff --git a/sources/talk/20191108 7 Best Open Source Tools that will help in AI Technology.md b/sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md similarity index 100% rename from sources/talk/20191108 7 Best Open Source Tools that will help in AI Technology.md rename to sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md From 0961ec580a2df755ff3af4699262c0efb16b14da Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Nov 2019 10:23:37 +0800 Subject: [PATCH 415/800] Rename sources/tech/20191108 My Linux story- Learning Linux in the 90s.md to sources/talk/20191108 My Linux story- Learning Linux in the 90s.md --- .../20191108 My Linux story- Learning Linux in the 90s.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191108 My Linux story- Learning Linux in the 90s.md (100%) diff --git a/sources/tech/20191108 My Linux story- Learning Linux in the 90s.md b/sources/talk/20191108 My Linux story- Learning Linux in the 90s.md similarity index 100% rename from sources/tech/20191108 My Linux story- Learning Linux in the 90s.md rename to sources/talk/20191108 My Linux story- Learning Linux in the 90s.md From 3d94d4287274b2d5fa9025b09ada3356691a171f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Nov 2019 10:28:48 +0800 Subject: [PATCH 416/800] Rename sources/tech/20191108 My first open source contribution- Talk about your pull request.md to sources/talk/20191108 My first open source contribution- Talk about your pull request.md --- ...irst open source contribution- Talk about your pull request.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191108 My first open source contribution- Talk about your pull request.md (100%) diff --git a/sources/tech/20191108 My first open source contribution- Talk about your pull request.md b/sources/talk/20191108 My first open source contribution- Talk about your pull request.md similarity index 100% rename from sources/tech/20191108 My first open source contribution- Talk about your pull request.md rename to sources/talk/20191108 My first open source contribution- Talk about your pull request.md From e7c6432191809113947fcc14bf22b54c2d189b57 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Nov 2019 10:50:29 +0800 Subject: [PATCH 417/800] Rename sources/tech/20191110 How universities are using open source to attract students.md to sources/talk/20191110 How universities are using open source to attract students.md --- ... How universities are using open source to attract students.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191110 How universities are using open source to attract students.md (100%) diff --git a/sources/tech/20191110 How universities are using open source to attract students.md b/sources/talk/20191110 How universities are using open source to attract students.md similarity index 100% rename from sources/tech/20191110 How universities are using open source to attract students.md rename to sources/talk/20191110 How universities are using open source to attract students.md From 1f2049c00e416286399a86fcd8738bd5fab8bcff Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 11 Nov 2019 12:11:18 +0800 Subject: [PATCH 418/800] Rename sources/tech/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md to sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md --- ...191111 Confirmed- Microsoft Edge Will be Available on Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md (100%) diff --git a/sources/tech/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md b/sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md similarity index 100% rename from sources/tech/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md rename to sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md From 1491f006b9c9e1cfb9b9d026605be0055c9376b6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 11 Nov 2019 14:49:33 +0800 Subject: [PATCH 419/800] APL --- ...1111 Confirmed- Microsoft Edge Will be Available on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md b/sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md index 86d9760ce0..14c7f46818 100644 --- a/sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md +++ b/sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c42506f2cbf8c58ae179a3302fc9d9c67074ad60 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 11 Nov 2019 16:47:53 +0800 Subject: [PATCH 420/800] TSL&PRF --- ...crosoft Edge Will be Available on Linux.md | 94 ------------------- ...crosoft Edge Will be Available on Linux.md | 90 ++++++++++++++++++ 2 files changed, 90 insertions(+), 94 deletions(-) delete mode 100644 sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md create mode 100644 translated/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md diff --git a/sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md b/sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md deleted file mode 100644 index 14c7f46818..0000000000 --- a/sources/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md +++ /dev/null @@ -1,94 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Confirmed! Microsoft Edge Will be Available on Linux) -[#]: via: (https://itsfoss.com/microsoft-edge-linux/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Confirmed! Microsoft Edge Will be Available on Linux -====== - -![][1] - -_**Microsoft is overhauling its Edge web browser and it will be based on the open source**_ [_**Chromium**_][2] _**browser. Microsoft is also bringing the new Edge browser to desktop Linux however the Linux release might be a bit delayed.**_ - -Microsoft’s Internet Explorer once dominated the browser market share, but it lost its dominance in the last decade to Google’s Chrome. - -> The rise and fall of [#opensource][3] web browser Mozilla Firefox. [pic.twitter.com/Co5Xj3dKIQ][4] -> -> — Abhishek Prakash (@abhishek_foss) [March 22, 2017][5] - -Microsoft tried to gain its lost position by creating Edge, a brand new web browser built with EdgeHTML and [Chakra engine][6]. It was tightly integrated with Microsoft’s digital assistant [Cortana][7] and Windows 10. - -However, it still could not bring the crown home and as of today, it stands at the [fourth position in desktop browser usage share][8]. - -Lately, Microsoft decided to give Edge an overhaul by rebasing it on [open source Chromium project][9]. Google’s Chrome browser is also based on Chromium. [Chromium is also available as a standalone web browser][2] and some Linux distributions use it at as the default web browser. - -### The new Microsoft Edge web browser on Linux - -After initial reluctance and uncertainties, it seems that Microsoft is finally going to bring the new Edge browser to Linux. - -In its annual developer conference Microsoft [Ignite][10], the [session on Edge Browser][11] mentions that it is coming to Linux in future. - -![Microsoft confirms that Edge is coming to Linux in future][12] - -The new Edge browser will be available on 15th January 2020 but I think that the Linux release will be delayed. - -### Is Microsoft Edge coming to Linux really a big deal? - -What’s the big deal with Microsoft Edge coming to Linux? Don’t we have plenty of [web browsers available for Linux][13] already? I think it has to do with the ‘Microsoft Linux rivalry’ (if there is such a thing). If Microsoft does anything for Linux, specially desktop Linux, it becomes a news. - -I also think that Edge on Linux has mutual benefits for Microsoft and for Linux users. Here’s why. - -#### What’s in it for Microsoft? - -When Google launched its Chrome browser in 2008, no one had thought that it will dominate the market in just a few years. But why would a search engine put so much of energy behind a ‘free web browser’? - -The answer is that Google is a search engine and it wants more people using its search engine and other services so that it can earn revenue from the ad services. With Chrome, Google is the default search engine. On other browsers like Firefox and Safari, Google pays hundreds of millions to be kept as the default web browser. Without Chrome, Google would have to rely entirely on the other browsers. - -Microsoft too has a search engine named Bing. The Internet Explorer and Edge use Bing as the default search engine. If Edge is used by more users, it improves the chances of bringing more users to Bing. More Bing users is something Microsoft would love to have. - -#### What’s in it for Linux users? - -I see a couple of benefits for desktop Linux users. With Edge, you can use some Microsoft specific products on Linux. For example, Microsoft’s streaming gaming service [xCloud][14] maybe available on the Edge browser only. - -Another benefit is an improved [Netflix experience on Linux][15]. Of course, you can use Chrome or [Firefox for watching Netflix on Linux][16] but you might not be getting the full HD or ultra HD streaming. - -As far as I know, the [Full HD and Ultra HD Netflix streaming is only available on Microsoft Edge][17]. This means you can ‘Netflix and chill’ in HD with Edge on Linux. - -_**What do you think?**_ - -What’s your feeling about Microsoft Edge coming to Linux? Will you be using it when it is available for Linux? Do share your views in the comment section below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/microsoft-edge-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/2019/11/microsoft_edge_logo_transparent.png?ssl=1 -[2]: https://itsfoss.com/install-chromium-ubuntu/ -[3]: https://twitter.com/hashtag/opensource?src=hash&ref_src=twsrc%5Etfw -[4]: https://t.co/Co5Xj3dKIQ -[5]: https://twitter.com/abhishek_foss/status/844666818665025537?ref_src=twsrc%5Etfw -[6]: https://itsfoss.com/microsoft-chakra-core/ -[7]: https://www.microsoft.com/en-in/windows/cortana -[8]: https://en.wikipedia.org/wiki/Usage_share_of_web_browsers -[9]: https://www.chromium.org/Home -[10]: https://www.microsoft.com/en-us/ignite -[11]: https://myignite.techcommunity.microsoft.com/sessions/79341?source=sessions -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Microsoft_Edge_Linux.jpg?ssl=1 -[13]: https://itsfoss.com/open-source-browsers-linux/ -[14]: https://www.pocket-lint.com/games/news/147429-what-is-xbox-project-xcloud-cloud-gaming-service-price-release-date-devices -[15]: https://itsfoss.com/watch-netflix-in-ubuntu-linux/ -[16]: https://itsfoss.com/netflix-firefox-linux/ -[17]: https://help.netflix.com/en/node/23742 diff --git a/translated/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md b/translated/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md new file mode 100644 index 0000000000..ad633a6ee1 --- /dev/null +++ b/translated/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Confirmed! Microsoft Edge Will be Available on Linux) +[#]: via: (https://itsfoss.com/microsoft-edge-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +确认了!微软 Edge 浏览器将发布 Linux 版 +====== + +![](https://img.linux.net.cn/data/attachment/album/201911/11/164600uv7yrbe7gtkxi4xg.jpg) + +> 微软正在全面重制其 Edge Web 浏览器,它将基于开源 [Chromium][2] 浏览器。微软还要将新的 Edge 浏览器带到 Linux 桌面上,但是 Linux 版本可能会有所延迟。 + +微软的 Internet Explorer 曾经一度统治了浏览器市场,但在过去的十年中,它将统治地位丢给了谷歌的 Chrome。 + +微软试图通过创造 Edge 浏览器来找回失去的位置,Edge 是一种使用 EdgeHTML 和 [Chakra 引擎][6]构建的全新 Web 浏览器。它与 Microsoft 的数字助手 [Cortana][7] 和 Windows 10 紧密集成。 + +但是,它仍然无法夺回冠军位置,截至目前,它处于[桌面浏览器使用份额的第四位][8]。 + +最近,微软决定通过基于[开源 Chromium 项目][9]重新对 Edge 进行大修。谷歌的 Chrome 浏览器也是基于 Chromium 的。[Chromium 还可以作为独立的 Web 浏览器使用][2],某些 Linux 发行版将其用作默认的 Web 浏览器。 + +### Linux 上新的微软 Edge Web 浏览器 + +经过最初的犹豫和不确定性之后,微软似乎最终决定把新的 Edge 浏览器引入到 Linux。 + +在其年度开发商大会 [Microsoft Ignite][10] 中,[关于 Edge 浏览器的演讲][11]中提到了它未来将进入 Linux 中。 + +![微软确认 Edge 未来将进入 Linux 中][12] + +新的 Edge 浏览器将于 2020 年 1 月 15 日发布,但我认为 Linux 版本会推迟。 + +### 微软 Edge 进入 Linux 真的重要吗? + +微软 Edge 进入 Linux 有什么大不了的吗?我们又不是没有很多[可用于 Linux 的 Web 浏览器][13]? + +我认为这与 “微软 Linux 竞争”(如果有这样的事情)有关。微软为 Linux(特别是 Linux 桌面)做的任何事情,都会成为新闻。 + +我还认为 Linux 上的 Edge 对于微软和 Linux 用户都有好处。这就是为什么。 + +#### 对于微软有什么用? + +当谷歌在 2008 年推出其 Chrome 浏览器时,没有人想到它会在短短几年内占领市场。但是,为什么作为一个搜索引擎会在一个“免费的 Web 浏览器”后面投入如此多的精力呢? + +答案是谷歌是一家搜索引擎,它希望有更多的人使用其搜索引擎和其他服务,以便它可以从广告服务中获得收入。使用 Chrome,Google 是默认的搜索引擎。在 Firefox 和 Safari 等其他浏览器上,谷歌支付了数亿美元作为默认 Web 浏览器的费用。如果没有 Chrome,则谷歌必须完全依赖其他浏览器。 + +微软也有一个名为 Bing 的搜索引擎。Internet Explorer 和 Edge 使用 Bing 作为默认搜索引擎。如果更多用户使用 Edge,它可以增加将更多用户带到 Bing 的机会。而微软显然希望拥有更多的 Bing 用户。 + +#### 对 Linux 用户有什么用? + +对于 Linux 桌面用户,我看到有两个好处。借助 Edge,你可以在 Linux 上使用某些微软特定的产品。 例如,微软的流式游戏服务 [xCloud][14] 可能仅能在 Edge 浏览器上使用。另一个好处是提升了 [Linux 上的 Netflix 体验][15]。当然,你可以在 Linux 上使用 Chrome 或 [Firefox 观看 Netflix][16],但可能无法获得全高清或超高清流。 + +据我所知,[全高清和超高清 Netflix 流仅在微软 Edge 上可用][17]。这意味着你可以使用 Linux 上的 Edge 以高清格式享受 Netflix。 + +### 你怎么看? + +你对微软 Edge 进入 Linux 有什么感觉?当 Linux 版本可用时,你会使用吗?请在下面的评论部分中分享你的观点。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/microsoft-edge-linux/ + +作者:[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://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/microsoft_edge_logo_transparent.png?ssl=1 +[2]: https://itsfoss.com/install-chromium-ubuntu/ +[3]: https://twitter.com/hashtag/opensource?src=hash&ref_src=twsrc%5Etfw +[4]: https://t.co/Co5Xj3dKIQ +[5]: https://twitter.com/abhishek_foss/status/844666818665025537?ref_src=twsrc%5Etfw +[6]: https://itsfoss.com/microsoft-chakra-core/ +[7]: https://www.microsoft.com/en-in/windows/cortana +[8]: https://en.wikipedia.org/wiki/Usage_share_of_web_browsers +[9]: https://www.chromium.org/Home +[10]: https://www.microsoft.com/en-us/ignite +[11]: https://myignite.techcommunity.microsoft.com/sessions/79341?source=sessions +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Microsoft_Edge_Linux.jpg?ssl=1 +[13]: https://itsfoss.com/open-source-browsers-linux/ +[14]: https://www.pocket-lint.com/games/news/147429-what-is-xbox-project-xcloud-cloud-gaming-service-price-release-date-devices +[15]: https://itsfoss.com/watch-netflix-in-ubuntu-linux/ +[16]: https://itsfoss.com/netflix-firefox-linux/ +[17]: https://help.netflix.com/en/node/23742 From ee0085d195000e82fdd1cc83d4f62646cc3b446b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 11 Nov 2019 16:57:33 +0800 Subject: [PATCH 421/800] PUB @wxy https://linux.cn/article-11562-1.html --- ...11 Confirmed- Microsoft Edge Will be Available on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md (98%) diff --git a/translated/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md b/published/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md similarity index 98% rename from translated/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md rename to published/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md index ad633a6ee1..0b6d422bd0 100644 --- a/translated/news/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md +++ b/published/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11562-1.html) [#]: subject: (Confirmed! Microsoft Edge Will be Available on Linux) [#]: via: (https://itsfoss.com/microsoft-edge-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From 7596255c1c1b328be6335a7e45d05bc9e141487c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 11 Nov 2019 23:27:34 +0800 Subject: [PATCH 422/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020190610=20Why=20?= =?UTF-8?q?containers=20and=20Kubernetes=20have=20the=20potential=20to=20r?= =?UTF-8?q?un=20almost=20anything?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md --- ...ve the potential to run almost anything.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md diff --git a/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md b/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md new file mode 100644 index 0000000000..c3f31d1e64 --- /dev/null +++ b/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why containers and Kubernetes have the potential to run almost anything) +[#]: via: (https://opensource.com/article/19/6/kubernetes-potential-run-anything) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +Why containers and Kubernetes have the potential to run almost anything +====== +Go beyond deployment of simple applications and tackle day two +operations with Kubernetes Operators. +![arrows cycle symbol for failing faster][1] + +In my first article, _[Kubernetes is a dump truck: Here's why][2]_, I talked about about how Kubernetes is elegant at defining, sharing, and running applications, similar to how dump trucks are elegant at moving dirt. In the second, _[How to navigate the Kubernetes learning curve][3]_, I explain that the learning curve for Kubernetes is really the same learning curve for running any applications in production, which is actually easier than learning all of the traditional pieces (load balancers, routers, firewalls, switches, clustering software, clustered files systems, etc). This is DevOps, a collaboration between Developers and Operations to specify the way things should run in production, which means there's a learning curve for both sides. In article four, _[Kubernetes basics: Learn how to drive first][4]_, I reframe learning Kubernetes with a focus on driving the dump truck instead of building or equipping it. In the fourth article, _[4 tools to help you drive Kubernetes][5]_, I share tools that I have fallen in love with to help build applications (drive the dump truck) in Kubernetes. + +In this final article, I share the reasons why I am so excited about the future of running applications on Kubernetes. + +From the beginning, Kubernetes has been able to run web-based workloads (containerized) really well. Workloads like web servers, Java, and associated app servers (PHP, Python, etc) just work. The supporting services like DNS, load balancing, and SSH (replaced by kubectl exec) are handled by the platform. For the majority of my career, these are the workloads I ran in production, so I immediately recognized the power of running production workloads with Kubernetes, aside from DevOps, aside from agile. There is incremental efficiency gain even if we barely change our cultural practices. Commissioning and decommissioning become extremely easy, which were terribly difficult with traditional IT. So, since the early days, Kubernetes has given me all of the basic primitives I need to model a production workload, in a single configuration language (Kube YAML/Json). + +But, what happened if you needed to run Multi-master MySQL with replication? What about redundant data using Galera? How do you do snapshotting and backups? What about sophisticated workloads like SAP? Day zero (deployment) with simple applications (web servers, etc) has been fairly easy with Kubernetes, but day two operations and workloads were not tackled. That's not to say that day two operations with sophisticated workloads were harder than traditional IT to solve, but they weren't made easier with Kubernetes. Every user was left to devise their own genius ideas for solving these problems, which is basically the status quo today. Over the last 5 years, the number one type of question I get is around day two operations of complex workloads. + +Thankfully, that's changing as we speak with the advent of Kubernetes Operators. With the advent of Operators, we now have a framework to codify day two operations knowledge into the platform. We can now apply the same defined state, actual state methodology that I described in [_Kubernetes basics: Learn how to drive first_][4]—we can now define, automate, and maintain a wide range of systems administration tasks. + +I often refer to Operators as "Robot Sysadmins" because they essentially codify a bunch of the day two operations knowledge that a subject matter expert (SME, like database administrator or, systems administrator) for that workload type (database, web server, etc) would normally keep in their notes somewhere in a wiki. The problem with these notes being in a wiki is, for the knowledge to be applied to solve a problem, we need to: + + 1. Generate an event, often a monitoring system finds a fault and we create a ticket + 2. Human SME has to investigate the problem, even if it's something we've seen a million times before + 3. Human SME has to execute the knowledge (perform the backup/restore, configure the Galera or transaction replication, etc) + + + +With Operators, all of this SME knowledge can be embedded in a separate container image which is deployed before the actual workload. We deploy the Operator container, and then the Operator deploys and manages one or more instances of the workload. We then manage the Operators using something like the Operator Lifecycle Manager (Katacoda tutorial). + +So, as we move forward with Kubernetes, we not only simplify the deployment of applications, but also the management over the lifecycle. Operators also give us the tools to manage very complex, stateful applications with deep configuration requirements (clustering, replication, repair, backup/restore. And, the best part is, the people who built the container are probably the subject matter experts for day two operations, so now they can embed that knowledge into the operations environment. + +### The conclusion to this series + +The future of Kubernetes is bright, and like virtualization before it, workload expansion is inevitable. Learning how to drive Kubernetes is probably the biggest investment that a developer or sysadmin can make in their own career growth. As the workloads expand, so will the career opportunities. So, here's to driving an amazing [dump truck that's very elegant at moving dirt][2]... + +If you would like to follow me on Twitter, I share a lot of content on this topic at [@fatherlinux][6] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/kubernetes-potential-run-anything + +作者:[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/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) +[2]: https://opensource.com/article/19/6/kubernetes-dump-truck +[3]: https://opensource.com/article/19/6/kubernetes-learning-curve +[4]: https://opensource.com/article/19/6/kubernetes-basics +[5]: https://opensource.com/article/19/6/tools-drive-kubernetes +[6]: https://twitter.com/fatherlinux From 0c9bce0d55af681defbd5da790648383e862208e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 11 Nov 2019 23:44:49 +0800 Subject: [PATCH 423/800] PRF @geekpi --- ... MAC address to bypass a captive portal.md | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md b/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md index f08c03de0b..e956c532be 100644 --- a/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md +++ b/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Cloning a MAC address to bypass a captive portal) @@ -12,37 +12,33 @@ ![][1] -如果你曾经不在家和办公室连接到 WiFi,那么通常会看到一个门户页面。它可能会要求你接受服务条款或其他协议才能访问。但是,当你无法通过这类门户进行连接时会发生什么?本文向你展示了如何在 Fedora 上使用 NetworkManager 处理某些故障情况,以便你仍然可以访问互联网。 +如果你曾经在家和办公室之外连接到 WiFi,那么通常会看到一个门户页面。它可能会要求你接受服务条款或其他协议才能访问。但是,当你无法通过这类门户进行连接时会发生什么?本文向你展示了如何在 Fedora 上使用 NetworkManager 在某些故障情况下让你仍然可以访问互联网。 ### 强制门户如何工作 强制门户是新设备连接到网络时显示的网页。当用户首次访问互联网时,门户网站会捕获所有网页请求并将其重定向到单个门户页面。 -然后,页面要求用户采取一些措施,通常是同意使用政策。用户同意后,他们可以向 RADIUS 或其他类型的身份验证系统进行身份验证。简而言之,强制门户根据设备的 MAC 地址和终端用户接受条款来注册和授权设备。 (MAC 地址是附加到任何网络接口(例如 WiFi 芯片或卡)的[基于硬件的值][2]。) +然后,页面要求用户采取一些措施,通常是同意使用政策。用户同意后,他们可以向 RADIUS 或其他类型的身份验证系统进行身份验证。简而言之,强制门户根据设备的 MAC 地址和终端用户接受条款来注册和授权设备。(MAC 地址是附加到任何网络接口的[基于硬件的值][2],例如 WiFi 芯片或卡。) -有时设备无法加载强制门户来进行身份验证和授权,以使用 WiFI 接入。这种情况的例子包括移动设备和游戏机(Switch,Playstation 等)。当连接到互联网时,它们通常不会打开动强制门户页面。连接到酒店或公共 WiFi 接入点时,你可能会看到这种情况。 +有时设备无法加载强制门户来进行身份验证和授权以使用 WiFI 接入。这种情况的例子包括移动设备和游戏机(Switch、Playstation 等)。当连接到互联网时,它们通常不会打开强制门户页面。连接到酒店或公共 WiFi 接入点时,你可能会看到这种情况。 -不过,你可以在 Fedora 上使用 NetworkManager 来解决这些问题。Fedora 使你可以临时克隆连接设备的 MAC 地址,并代表该设备通过强制门户进行身份验证。你需要得到连接设备的 MAC 地址。通常,它被打印在设备上的某个地方并贴上标签。它是一个六字节的十六进制值,因此看起来类似 _4A:1A:4C:B0:38:1F_。通常,你也可以通过设备的内置菜单找到它。 +不过,你可以在 Fedora 上使用 NetworkManager 来解决这些问题。Fedora 可以使你临时克隆要连接的设备的 MAC 地址,并代表该设备通过强制门户进行身份验证。你需要得到连接设备的 MAC 地址。通常,它被打印在设备上的某个地方并贴上标签。它是一个六字节的十六进制值,因此看起来类似 `4A:1A:4C:B0:38:1F`。通常,你也可以通过设备的内置菜单找到它。 ### 使用 NetworkManager 克隆 -首先,打开 _**nm-connection-editor**_,或通过”设置“打开 WiFi 设置。然后,你可以使用 NetworkManager 进行克隆: +首先,打开 `nm-connection-editor`,或通过“设置”打开 WiFi 设置。然后,你可以使用 NetworkManager 进行克隆: - * 对于以太网–选择已连接的以太网连接。然后选择 _Ethernet_ 选项卡。记录或复制当前的 MAC 地址。在 _Cloned MAC address_ 字段中输入游戏机或其他设备的 MAC 地址。 -  * 对于 WiFi –选择 WiFi 配置名。然后选择 “WiFi” 选项卡。记录或复制当前的 MAC 地址。在 _Cloned MAC address_ 字段中输入游戏机或其他设备的 MAC 地址。 +* 对于以太网:选择已连接的以太网连接。然后选择 “Ethernet” 选项卡。记录或复制当前的 MAC 地址。在 “克隆 MAC 地址Cloned MAC address” 字段中输入游戏机或其他设备的 MAC 地址。 +* 对于 WiFi:选择 WiFi 配置名。然后选择 “WiFi” 选项卡。记录或复制当前的 MAC 地址。在 “克隆 MAC 地址Cloned MAC address” 字段中输入游戏机或其他设备的 MAC 地址。 +### 启动所需的设备 +当 Fedora 系统与以太网或 WiFi 配置连接,克隆的 MAC 地址将用于请求 IP 地址,并加载强制门户。输入所需的凭据和/或选择用户协议。该 MAC 地址将获得授权。 -### **启动所需的设备** - -当 Fedora 系统与以太网或 WiFi 配置连接,克隆的 MAC 地址将用于请求 IP 地址,并加载强制门户。输入所需的凭据和/或选择用户协议。MAC 地址将获得授权。 - -现在,断开 WiF i或以太网配置连接,然后将 Fedora 系统的 MAC 地址更改回其原始值。然后启动游戏机或其他设备。设备现在应该可以访问互联网了,因为它的网络接口已通过你的 Fedora 系统进行了授权。 +现在,断开 WiF i或以太网配置连接,然后将 Fedora 系统的 MAC 地址更改回其原始值。然后启动游戏机或其他设备。该设备现在应该可以访问互联网了,因为它的网络接口已通过你的 Fedora 系统进行了授权。 不过,这不是 NetworkManager 全部能做的。例如,请参阅[随机化系统硬件地址][3],来获得更好的隐私保护。 -> [使用 NetworkManager 随机化你的 MAC 地址][3] - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal/ @@ -50,7 +46,7 @@ via: https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal 作者:[Esteban Wilson][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/) 荣誉推出 @@ -58,4 +54,4 @@ via: https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal [b]: https://github.com/lujun9972 [1]: https://fedoramagazine.org/wp-content/uploads/2019/10/clone-mac-nm-816x345.jpg [2]: https://en.wikipedia.org/wiki/MAC_address -[3]: https://fedoramagazine.org/randomize-mac-address-nm/ +[3]: https://linux.cn/article-10028-1.html From bee9854502d69e4e5d11408a01d01f679b76cc61 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 11 Nov 2019 23:45:17 +0800 Subject: [PATCH 424/800] PUB @geekpi https://linux.cn/article-11564-1.html --- ...191104 Cloning a MAC address to bypass a captive portal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191104 Cloning a MAC address to bypass a captive portal.md (98%) diff --git a/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md b/published/20191104 Cloning a MAC address to bypass a captive portal.md similarity index 98% rename from translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md rename to published/20191104 Cloning a MAC address to bypass a captive portal.md index e956c532be..3445d2f52b 100644 --- a/translated/tech/20191104 Cloning a MAC address to bypass a captive portal.md +++ b/published/20191104 Cloning a MAC address to bypass a captive portal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11564-1.html) [#]: subject: (Cloning a MAC address to bypass a captive portal) [#]: via: (https://fedoramagazine.org/cloning-a-mac-address-to-bypass-a-captive-portal/) [#]: author: (Esteban Wilson https://fedoramagazine.org/author/swilson/) From 3811d7aca6774cb99bacb8d1c198b3f90b91fbd5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 12 Nov 2019 00:10:28 +0800 Subject: [PATCH 425/800] APL --- ... and Kubernetes have the potential to run almost anything.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md b/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md index c3f31d1e64..401363d0af 100644 --- a/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md +++ b/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4f457f5430d08e065cd774ae770fcce425d28900 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 12 Nov 2019 02:47:57 +0800 Subject: [PATCH 426/800] TSL&PRF --- ...ve the potential to run almost anything.md | 62 ------------------ ...ve the potential to run almost anything.md | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 62 deletions(-) delete mode 100644 sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md create mode 100644 translated/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md diff --git a/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md b/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md deleted file mode 100644 index 401363d0af..0000000000 --- a/sources/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md +++ /dev/null @@ -1,62 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why containers and Kubernetes have the potential to run almost anything) -[#]: via: (https://opensource.com/article/19/6/kubernetes-potential-run-anything) -[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) - -Why containers and Kubernetes have the potential to run almost anything -====== -Go beyond deployment of simple applications and tackle day two -operations with Kubernetes Operators. -![arrows cycle symbol for failing faster][1] - -In my first article, _[Kubernetes is a dump truck: Here's why][2]_, I talked about about how Kubernetes is elegant at defining, sharing, and running applications, similar to how dump trucks are elegant at moving dirt. In the second, _[How to navigate the Kubernetes learning curve][3]_, I explain that the learning curve for Kubernetes is really the same learning curve for running any applications in production, which is actually easier than learning all of the traditional pieces (load balancers, routers, firewalls, switches, clustering software, clustered files systems, etc). This is DevOps, a collaboration between Developers and Operations to specify the way things should run in production, which means there's a learning curve for both sides. In article four, _[Kubernetes basics: Learn how to drive first][4]_, I reframe learning Kubernetes with a focus on driving the dump truck instead of building or equipping it. In the fourth article, _[4 tools to help you drive Kubernetes][5]_, I share tools that I have fallen in love with to help build applications (drive the dump truck) in Kubernetes. - -In this final article, I share the reasons why I am so excited about the future of running applications on Kubernetes. - -From the beginning, Kubernetes has been able to run web-based workloads (containerized) really well. Workloads like web servers, Java, and associated app servers (PHP, Python, etc) just work. The supporting services like DNS, load balancing, and SSH (replaced by kubectl exec) are handled by the platform. For the majority of my career, these are the workloads I ran in production, so I immediately recognized the power of running production workloads with Kubernetes, aside from DevOps, aside from agile. There is incremental efficiency gain even if we barely change our cultural practices. Commissioning and decommissioning become extremely easy, which were terribly difficult with traditional IT. So, since the early days, Kubernetes has given me all of the basic primitives I need to model a production workload, in a single configuration language (Kube YAML/Json). - -But, what happened if you needed to run Multi-master MySQL with replication? What about redundant data using Galera? How do you do snapshotting and backups? What about sophisticated workloads like SAP? Day zero (deployment) with simple applications (web servers, etc) has been fairly easy with Kubernetes, but day two operations and workloads were not tackled. That's not to say that day two operations with sophisticated workloads were harder than traditional IT to solve, but they weren't made easier with Kubernetes. Every user was left to devise their own genius ideas for solving these problems, which is basically the status quo today. Over the last 5 years, the number one type of question I get is around day two operations of complex workloads. - -Thankfully, that's changing as we speak with the advent of Kubernetes Operators. With the advent of Operators, we now have a framework to codify day two operations knowledge into the platform. We can now apply the same defined state, actual state methodology that I described in [_Kubernetes basics: Learn how to drive first_][4]—we can now define, automate, and maintain a wide range of systems administration tasks. - -I often refer to Operators as "Robot Sysadmins" because they essentially codify a bunch of the day two operations knowledge that a subject matter expert (SME, like database administrator or, systems administrator) for that workload type (database, web server, etc) would normally keep in their notes somewhere in a wiki. The problem with these notes being in a wiki is, for the knowledge to be applied to solve a problem, we need to: - - 1. Generate an event, often a monitoring system finds a fault and we create a ticket - 2. Human SME has to investigate the problem, even if it's something we've seen a million times before - 3. Human SME has to execute the knowledge (perform the backup/restore, configure the Galera or transaction replication, etc) - - - -With Operators, all of this SME knowledge can be embedded in a separate container image which is deployed before the actual workload. We deploy the Operator container, and then the Operator deploys and manages one or more instances of the workload. We then manage the Operators using something like the Operator Lifecycle Manager (Katacoda tutorial). - -So, as we move forward with Kubernetes, we not only simplify the deployment of applications, but also the management over the lifecycle. Operators also give us the tools to manage very complex, stateful applications with deep configuration requirements (clustering, replication, repair, backup/restore. And, the best part is, the people who built the container are probably the subject matter experts for day two operations, so now they can embed that knowledge into the operations environment. - -### The conclusion to this series - -The future of Kubernetes is bright, and like virtualization before it, workload expansion is inevitable. Learning how to drive Kubernetes is probably the biggest investment that a developer or sysadmin can make in their own career growth. As the workloads expand, so will the career opportunities. So, here's to driving an amazing [dump truck that's very elegant at moving dirt][2]... - -If you would like to follow me on Twitter, I share a lot of content on this topic at [@fatherlinux][6] - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/kubernetes-potential-run-anything - -作者:[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/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) -[2]: https://opensource.com/article/19/6/kubernetes-dump-truck -[3]: https://opensource.com/article/19/6/kubernetes-learning-curve -[4]: https://opensource.com/article/19/6/kubernetes-basics -[5]: https://opensource.com/article/19/6/tools-drive-kubernetes -[6]: https://twitter.com/fatherlinux diff --git a/translated/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md b/translated/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md new file mode 100644 index 0000000000..7b0cb89aa2 --- /dev/null +++ b/translated/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why containers and Kubernetes have the potential to run almost anything) +[#]: via: (https://opensource.com/article/19/6/kubernetes-potential-run-anything) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +为什么容器和 Kubernetes 有潜力运行一切 +====== + +> 不仅可以部署简单的应用程序,还可以用 Kubernetes 运维器应对第 2 天运营。 + +![](https://img.linux.net.cn/data/attachment/album/201911/12/011140mp75sd0ynppd77da.jpg) + +在我的第一篇文章 [为什么说 Kubernetes 是一辆翻斗车][2] 中,我谈到了 Kubernetes 如何在定义、分享和运行应用程序方面很出色,类似于翻斗车在移动垃圾方面很出色。在第二篇中,[如何跨越 Kubernetes 学习曲线][3],我解释了 Kubernetes 的学习曲线实际上与运行任何生产环境中的应用程序的学习曲线相同,这确实比学习所有传统组件要容易(如负载均衡器、路由器、防火墙、交换机、集群软件、集群文件系统等)。这是 DevOps,是开发人员和运维人员之间的合作,用于指定事物在生产环境中的运行方式,这意味着双方都需要学习。在第三篇 [Kubernetes 基础:首先学习如何使用][4] 中,我重新设计了 Kubernetes 的学习框架,重点是驾驶翻斗车而不是制造或装备翻斗车。在第四篇文章 [帮助你驾驭 Kubernetes 的 4 个工具][5] 中,我分享了我喜爱的工具,这些工具可帮助你在 Kubernetes 中构建应用程序(驾驶翻斗车)。 + +在这最后一篇文章中,我会分享我为什么对在 Kubernetes 上运行应用程序的未来如此兴奋的原因。 + +从一开始,Kubernetes 就能够很好地运行基于 Web 的工作负载(容器化的)。Web 服务器、Java 和相关的应用程序服务器(PHP、Python等)之类的工作负载都可以正常工作。该平台处理诸如 DNS、负载平衡和 SSH(由 `kubectl exec` 取代)之类的支持服务。在我的职业生涯的大部分时间里,这些都是我在生产环境中运行的工作负载,因此,我立即意识到,除了 DevOps 之外,除了敏捷之外,使用 Kubernetes 运行生产环境工作负载的强大功能。即使是我们几乎不改变我们的文化习惯,也可以提高效率。调试和退役变得非常容易,而这对于传统 IT 来说是极为困难的。因此,从早期开始,Kubernetes 就用一种单一的配置语言(Kube YAML/Json)为我提供了对生产环境工作负载进行建模所需的所有基本原语。 + +但是,如果你需要运行具有复制功能的多主 MySQL,会发生什么情况?使用 Galera 的冗余数据呢?你如何进行快照和备份?那么像 SAP 这样复杂的工作呢?使用 Kubernetes,简单的应用程序(Web 服务器等)的第 0 天(部署)相当简单,但是没有解决第 2 天的运营和工作负载。这并不是说,具有复杂工作负载的第 2 天运营要比传统 IT 难解决,而是使用 Kubernetes 并没有使它们变得更容易。每个用户都要设计自己的天才想法来解决这些问题,这基本上是当今的现状。在过去的五年中,我遇到的第一类问题是复杂工作负载的第 2 天操作。(LCTT 译注:在软件生命周期中,第 0 天是指软件的设计阶段;第 1 天是指软件的开发和部署阶段;第 2 天是指生产环境中的软件运维阶段。) + +值得庆幸的是,随着 Kubernetes 运维器Operator的出现,这种情况正在改变。随着运维器的出现,我们现在有了一个框架,可以将第 2 天的运维知识汇总到平台中。现在,我们可以应用我在 [Kubernetes 基础:首先学习如何使用][4] 中描述的相同的定义状态、实际状态的方法,现在我们可以定义、自动化和维护各种各样的系统管理任务。 + +(LCTT 译注: Operator 是 Kubernetes 中的一种可以完成运维工程师的特定工作的组件,业界大多没有翻译这个名词,此处仿运维工程师例首倡翻译为“运维器”。) + +我经常将运维器称为“系统管理机器人”,因为它们实质上是在第 2 天的工作中整理出一堆运维知识,该知识涉及主题专家Subject Matter Expert(SME、例如数据库管理员或系统管理员)针对的工作负载类型(数据库、Web 服务器等),通常会记录在 Wiki 中的某个地方。这些知识放在 Wiki 中的问题是,为了将该知识应用于解决问题,我们需要: + +1. 生成事件,通常监控系统会发现故障,然后我们创建故障单 +2. SME 人员必须对此问题进行调查,即使这是我们之前见过几百万次的问题 +3. SME 人员必须执行该知识(执行备份/还原、配置 Galera 或事务复制等) + +通过运维器,所有这些 SME 知识都可以嵌入到单独的容器镜像中,该镜像在有实际工作负荷之前就已部署。 我们部署运维器容器,然后运维器部署和管理一个或多个工作负载实例。然后,我们使用“运维器生命周期管理器”(Katacoda 教程)之类的方法来管理运维器。 + +因此,随着我们进一步使用 Kubernetes,我们不仅简化了应用程序的部署,而且简化了整个生命周期的管理。运维器还为我们提供了工具,可以管理具有深层配置要求(群集、复制、修复、备份/还原)的非常复杂的有状态应用程序。而且,最好的地方是,构建容器的人员可能是做第 2 天运维的主题专家,因此现在他们可以将这些知识嵌入到操作环境中。 + +### 本系列的总结 + +Kubernetes 的未来是光明的,就像之前的虚拟化一样,工作负载的扩展是不可避免的。学习如何驾驭 Kubernetes 可能是开发人员或系统管理员可以对自己的职业发展做出的最大投资。随着工作负载的增多,职业机会也将增加。因此,这是驾驶一辆令人惊叹的 [在移动垃圾时非常优雅的翻斗车][2]…… + +你可能想在 Twitter 上关注我,我在 [@fatherlinux][6] 上分享有关此主题的很多内容。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/kubernetes-potential-run-anything + +作者:[Scott McCarty][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/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) +[2]: https://opensource.com/article/19/6/kubernetes-dump-truck +[3]: https://opensource.com/article/19/6/kubernetes-learning-curve +[4]: https://opensource.com/article/19/6/kubernetes-basics +[5]: https://opensource.com/article/19/6/tools-drive-kubernetes +[6]: https://twitter.com/fatherlinux From 62dbda21fdd6e97a4e7bc2ac6b85e77a8876de35 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 12 Nov 2019 07:17:55 +0800 Subject: [PATCH 427/800] PUB @wxy https://linux.cn/article-11565-1.html --- ...nd Kubernetes have the potential to run almost anything.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20190610 Why containers and Kubernetes have the potential to run almost anything.md (99%) diff --git a/translated/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md b/published/20190610 Why containers and Kubernetes have the potential to run almost anything.md similarity index 99% rename from translated/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md rename to published/20190610 Why containers and Kubernetes have the potential to run almost anything.md index 7b0cb89aa2..50b74ce4a8 100644 --- a/translated/talk/20190610 Why containers and Kubernetes have the potential to run almost anything.md +++ b/published/20190610 Why containers and Kubernetes have the potential to run almost anything.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11565-1.html) [#]: subject: (Why containers and Kubernetes have the potential to run almost anything) [#]: via: (https://opensource.com/article/19/6/kubernetes-potential-run-anything) [#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) From d8b84677c478ed5f57c1e505c588ef304a67b5fe Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 Nov 2019 07:20:36 +0800 Subject: [PATCH 428/800] translating --- .../tech/20191108 How to manage music tags using metaflac.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191108 How to manage music tags using metaflac.md b/sources/tech/20191108 How to manage music tags using metaflac.md index 836f167d5a..9fb58668d6 100644 --- a/sources/tech/20191108 How to manage music tags using metaflac.md +++ b/sources/tech/20191108 How to manage music tags using metaflac.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 4a9bbd178cae597fd3017cbdbd96540e6ab6bb8c Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 Nov 2019 08:36:32 +0800 Subject: [PATCH 429/800] translating --- ...How to manage music tags using metaflac.md | 43 +++++++++---------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/sources/tech/20191108 How to manage music tags using metaflac.md b/sources/tech/20191108 How to manage music tags using metaflac.md index 9fb58668d6..0945e04ac6 100644 --- a/sources/tech/20191108 How to manage music tags using metaflac.md +++ b/sources/tech/20191108 How to manage music tags using metaflac.md @@ -7,27 +7,26 @@ [#]: via: (https://opensource.com/article/19/11/metaflac-fix-music-tags) [#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) -How to manage music tags using metaflac +如何使用 metaflac 管理音乐标签 ====== -Correct music tagging errors from the command line with this powerful -open source utility. +使用这个强大的开源工具可以在命令行中纠正音乐标签错误。 ![website design image][1] -I've been ripping CDs to my computer for a long time now. Over that time, I've used several different tools for ripping, and I have observed that each tool seems to have a different take on tagging, specifically, what metadata to save with the music data. By "observed," I mean that music players seem to sort albums in a funny order, they split tracks in one physical directory into two albums, or they create other sorts of frustrating irritations. +我将 CD 翻录到电脑已经有很长一段时间了。在此期间,我用过几种不同的翻录工具,观察到每种工具在标记上似乎有不同的做法,特别是在保存哪些音乐元数据上。所谓“观察”,是指音乐播放器似乎按照有趣的顺序对专辑进行排序,他们将一个目录中的曲目分为两张专辑,或者产生了其他令人沮丧的烦恼。 -I've also learned that some of the tags are pretty obscure, and many music players and tag editors don't show them. Even so, they may use them for sorting or displaying music in some edge cases, like where the player separates all the music files containing tag XYZ into a different album from all the files not containing that tag. +我还看到有些标签非常模糊,许多音乐播放器和标签编辑器没有显示它们。即使这样,在某些极端情况下,它们仍可以使用这些标签来分类或显示音乐,例如播放器将所有包含 XYZ 标签的音乐文件与不包含该标签的所有文件分离到不同的专辑中。 -So if the tagging applications and music players don't show the "weirdo" tags—but are somehow affected by them—what can you do? +那么,如果标记应用和音乐播放器没有显示“奇怪”的标记,但是它们受到了某种影响,你该怎么办? -### Metaflac to the rescue! +### Metaflac 来拯救! -I have been meaning to get familiar with **[metaflac][2]**, the open source command-line metadata editor for [FLAC files][3], which is my open source music file format of choice. Not that there is anything wrong with great tag-editing software like [EasyTAG][4], but the old saying "if all you have is a hammer…" comes to mind. Also, from a practical perspective, my home and office stereo music needs are met by small, dedicated servers running [Armbian][5] and [MPD][6], with the music files stored locally, running a very stripped-down, music-only headless environment, so a command-line metadata management tool would be quite useful. +我一直想要熟悉 **[metaflac][2]**,它是一款开源命令行 [FLAC文件][3] 元数据编辑器,这是我选择的开源音乐文件格式。并不是说 [EasyTAG][4] 这样的出色标签编辑软件有什么问题,但我想起“如果你手上有个锤子。。”这句老话(译注:原文是如果你手上有个锤子, 那么所有的东西看起来都像钉子。意指人们惯于用熟悉的方式解决问题,而不管合不合适)。另外,从实际的角度来看,运行 [Armbian][5] 和 [MPD][6]、音乐存储在本地、运行精简、仅限音乐的无头环境的小型专用服务器可以满足我的家庭和办公室立体音乐的需求,因此命令行元数据管理工具将非常有用。 -The screenshot below shows the typical problem created by my long-term ripping program: Putumayo's wonderful compilation of Colombian music appears as two separate albums, one containing a single track, the other containing the remaining 11: +下面的截图显示了我的长期翻录程序产生的典型问题:Putumayo 的哥伦比亚音乐汇编显示为两张单独的专辑,一张包含单首曲目,另一张包含其余 11 首: ![Album with incorrect tags][7] -I used metaflac to generate a list of all the tags for all of the FLAC files in the directory containing those tracks: +我使用 metaflac 为目录中包含这些曲目的所有 FLAC 文件生成了所有标签的列表: ``` @@ -40,7 +39,7 @@ for f in *.flac; do done ``` -I saved this as an executable shell script (see my colleague [David Both][8]'s wonderful series of columns on Bash shell scripting, [particularly the one on loops][9]). Basically, what I'm doing here is creating a file, _tags.txt_, containing the filename (the **echo** command) followed by all its flags, followed by the next filename, and so forth. Here are the first few lines of the result: +我将其保存为可执行的 shell 脚本(请参阅我的同事 [David Both][8] 关于 Bash shell 脚本的精彩系列专栏文章,[特别是关于循环这章][9])。基本上,我在这做的是创建一个文件 _tags.txt_,包含文件名(**echo** 命令),后面是它的所有标签,然后是下一个文件名,依此类推。 这是结果的前几行: ``` @@ -64,16 +63,16 @@ ALBUMARTISTSORT=50 de Joselito, Los Cumbia Del Caribe.flac ``` -After a bit of investigation, it turns out I ripped a number of my Putumayo CDs at the same time, and whatever software I was using at the time seems to have put the MUSICBRAINZ_ tags on all but one of the files. (A bug? Probably; I see this on a half-dozen albums.) Also, with respect to the sometimes unusual sorting, note the ALBUMARTISTSORT tag moved the Spanish article "Los" to the end of the artist name, after a comma. +经过一番调查,结果发现我同时翻录了很多 Putumayo CD,并且当时我所使用的所有软件似乎给除了一个之外的所有文件加上了 MUSICBRAINZ_ 标签。 (是 bug 么?大概吧。我在六张专辑中都看到了。)此外,关于有时不寻常的排序,注意到,ALBUMARTISTSORT 标签将西班牙语标题 “Los” 移到了标题的最后面(逗号之后)。 -I used a simple **awk** script to list all the tags reported in the _tags.txt_ file: +我使用了一个简单的 **awk** 脚本来列出 _tags.txt_ 中报告的所有标签: ``` `awk -F= 'index($0,"=") > 0 {print $1}' tags.txt | sort -u` ``` -This split all lines into fields using **=** as the field separator and prints the first field of lines containing an equals sign. The results are passed through sort with the **-u** flag, which eliminates all duplication in the output (see my colleague Seth Kenlon's great [article on the **sort** utility][10]). For this specific _tags.txt_ file, the output is: +这会使用 **=** 作为字段分隔符将所有行拆分为字段,并打印包含等号的行的第一个字段。结果通过使用 sort 带上 **-u** 标志来传递,从而消除了输出中的所有重复项(请参阅我的同事 Seth Kenlon 的[关于 **sort** 程序的文章][10])。对于这个 _tags.txt_ 文件,输出为: ``` @@ -95,7 +94,7 @@ TITLE TRACKTOTAL ``` -Sleuthing around a bit, I found that the MUSICBRAINZ_ flags appear on all but one FLAC file, so I used the metaflac command to delete those flags: +研究一会后,我发现 MUSICBRAINZ_ 标签出现在除了一个 FLAC 文件之外的所有文件上,因此我使用 metaflac 命令删除了这些标签: ``` @@ -106,19 +105,19 @@ for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_DISCID "$f"; done for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_TRACKID "$f"; done ``` -Once that's done, I can rebuild the MPD database with my music player. Here are the results: +完成后,我可以使用音乐播放器重建 MPD 数据库。结果如下: ![Album with correct tags][11] -And, there we are—all 12 tracks together in one album. +完成了,12 首曲目出现在了一张专辑中。 -So, yeah, I'm lovin' metaflac a whole bunch. I expect I'll be using it more often as I try to wrangle the last bits of weirdness in my music collection's music tags. It's highly recommended! +太好了,我很喜欢 metaflac。我希望我会更频繁地使用它,因为我会试图去纠正最后一些我弄乱的音乐收藏标签。强烈推荐! -### And the music +### 关于音乐 -I've been spending a few evenings listening to Odario Williams' program _After Dark_ on CBC Music. (CBC is Canada's public broadcasting corporation.) Thanks to Odario, one of the albums I've really come to enjoy is [_Songs for Cello and Voice_ by Kevin Fox][12]. Here he is, covering the Eurythmics tune "[Sweet Dreams (Are Made of This)][13]." +我花了几个晚上在 CBC 音乐(CBC 是加拿大的公共广播公司)上收听 Odario Williams 的节目 _After Dark_。感谢 Odario,我听到了让我非常享受的 [Kevin Fox 的 _Songs for Cello and Voice_] [12]。在这里,他演唱了 Eurythmics 的歌曲 “[Sweet Dreams(Are Made of This)][13]”。 -I bought this on CD, and now it's on my music server with its tags properly organized! +我购买了这张 CD,现在它在我的音乐服务器上,还有组织正确的标签! -------------------------------------------------------------------------------- @@ -126,7 +125,7 @@ via: https://opensource.com/article/19/11/metaflac-fix-music-tags 作者:[Chris Hermansen][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 7119fc0d786f4cbf9889350afc2b5b13fff0413c Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 12 Nov 2019 08:37:36 +0800 Subject: [PATCH 430/800] translating --- .../tech/20191108 How to manage music tags using metaflac.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191108 How to manage music tags using metaflac.md (100%) diff --git a/sources/tech/20191108 How to manage music tags using metaflac.md b/translated/tech/20191108 How to manage music tags using metaflac.md similarity index 100% rename from sources/tech/20191108 How to manage music tags using metaflac.md rename to translated/tech/20191108 How to manage music tags using metaflac.md From cdeb7498f90b7c4015063b138e4ac3031d071eee Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 12 Nov 2019 22:01:28 +0800 Subject: [PATCH 431/800] APL --- ...w to Schedule and Automate tasks in Linux using Cron Jobs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md index a8ed75432c..02c3344ed9 100644 --- a/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md +++ b/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e3a8169735c6a9dba8efbab9f7c80eb8cf79ebca Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 12 Nov 2019 23:31:51 +0800 Subject: [PATCH 432/800] TSL --- ...Automate tasks in Linux using Cron Jobs.md | 241 --------------- ...Automate tasks in Linux using Cron Jobs.md | 290 ++++++++++++++++++ 2 files changed, 290 insertions(+), 241 deletions(-) delete mode 100644 sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md create mode 100644 translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md diff --git a/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md deleted file mode 100644 index 02c3344ed9..0000000000 --- a/sources/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md +++ /dev/null @@ -1,241 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Schedule and Automate tasks in Linux using Cron Jobs) -[#]: via: (https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/) -[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) - -How to Schedule and Automate tasks in Linux using Cron Jobs -====== - -Sometimes, you may have tasks that need to be performed on a regular basis or at certain predefined intervals. Such tasks include backing up databases, updating the system, performing periodic reboots and so on. Such tasks are referred to as **cron jobs**. Cron jobs are used for **automation of tasks** that come in handy and help in simplifying the execution of repetitive and sometimes mundane tasks. **Cron** is a daemon that allows you to schedule these jobs which are then carried out at specified intervals. In this tutorial, you will learn how to schedule jobs using cron jobs. - -[![Schedule -tasks-in-Linux-using cron][1]][2] - -### The Crontab file - -A crontab file, also known as a **cron table**, is a simple text file that contains rules or commands that specify the time interval of execution of a task. There are two categories of crontab files: - -**1)  System-wide crontab file** - -These are usually used by Linux services & critical applications requiring root privileges. The system crontab file is located at **/etc/crontab** and can only be accessed and edited by the root user. It’s usually used for the configuration of system-wide daemons. The crontab file looks as shown: - -[![etc-crontab-linux][1]][3] - -**2) User-created crontab files** - -Linux users can also create their own cron jobs with the help of the crontab command. The cron jobs created will run as the user who created them. - -All cron jobs are stored in /var/spool/cron (For RHEL and CentOS distros) and /var/spool/cron/crontabs (For Debian and Ubuntu distros), the cron jobs are listed using the username of the user that created the cron job - -The **cron daemon** runs silently in the background checking the **/etc/crontab** file and **/var/spool/cron** and **/etc/cron.d*/** directories - -The **crontab** command is used for editing cron files. Let us take a look at the anatomy of a crontab file. - -### The anatomy of a crontab file - -Before we go further, it’s important that we first explore how a crontab file looks like. The basic syntax for a crontab file comprises 5 columns represented by asterisks followed by the command to be carried out. - -*    *    *    *    *    command - -This format can also be represented as shown below: - -m h d moy dow command - -OR - -m h d moy dow /path/to/script - -Let’s expound on each entry - - * **m**: This represents minutes. It’s specified from 0 to 59 - * **h**: This denoted the hour specified from 0 to 23 - * **d**:  This represents the day of the month. Specified between 1 to 31` - * **moy**: This is the month of the year. It’s specified between 1 to 12 - * **doy**:  This is the day of the week. It’s specified between 0 and 6 where 0 = Sunday - * **Command**: This is the command to be executed e.g backup command, reboot, & copy - - - -### Managing cron jobs - -Having looked at the architecture of a crontab file, let’s see how you can create, edit and delete cron jobs - -**Creating cron jobs** - -To create or edit a cron job as the root user, run the command - -# crontab -e - -To create a cron job or schedule a task as another user, use the syntax - -# crontab -u username -e - -For instance, to run a cron job as user Pradeep, issue the command: - -# crontab -u Pradeep -e - -If there is no preexisting crontab file, then you will get a blank text document. If a crontab file was existing, The  -e option allows  to edit the file, - -**Listing crontab files** - -To view the cron jobs that have been created, simply pass the -l option as shown - -# crontab -l - -**Deleting a  crontab file** - -To delete a cron file, simply run crontab -e and delete or the line of the cron job that you want and save the file. - -To remove all cron jobs, run the command: - -# crontab -r - -That said, let’s have a look at different ways that you can schedule tasks - -### Crontab examples in Scheduling tasks. - -All cron jobs being with a shebang header as shown - -#!/bin/bash - -This indicates the shell you are using, which, for this case, is bash shell. - -Next, specify the interval at which you want to schedule the tasks using the cron job entries we specified earlier on. - -To reboot a system daily at 12:30 pm, use the syntax: - -30  12 *  *  * /sbin/reboot - -To schedule the reboot at 4:00 am use the syntax: - -0  4  *  *  *  /sbin/reboot - -**NOTE:**  The asterisk * is used to match all records - -To run a script twice every day, for example, 4:00 am and 4:00 pm, use the syntax. - -0  4,16  *  *  *  /path/to/script - -To schedule a cron job to run every Friday at 5:00 pm  use the syntax: - -0  17  *  *  Fri  /path/to/script - -OR - -0 17  *  *  *  5  /path/to/script - -If you wish to run your cron job every 30 minutes then use: - -*/30  *  *  *  * /path/to/script - -To schedule cron to run after every 5 hours, run - -*  */5  *  *  *  /path/to/script - -To run a script on selected days, for example, Wednesday and Friday at 6.00 pm execute: - -0  18  *  *  wed,fri  /path/to/script - -To schedule multiple tasks to use a single cron job, separate the tasks using a semicolon for example: - -*  *  *  *  *  /path/to/script1 ; /path/to/script2 - -### Using special strings to save time on writing cron jobs - -Some of the cron jobs can easily be configured using special strings that correspond to certain time intervals. For example, - -1)  @hourly timestamp corresponds to  0 * * * * - -It will execute a task in the first minute of every hour. - -@hourly /path/to/script - -2) @daily timestamp is equivalent to  0 0 * * * - -It executes a task in the first minute of every day (midnight). It comes in handy when executing daily jobs. - -  @daily /path/to/script - -3) @weekly   timestamp is the equivalent to  0 0 1 * mon - -It executes a cron job in the first minute of every week where a week whereby, a  week starts on Monday. - - @weekly /path/to/script - -3) @monthly is similar to the entry 0 0 1 * * - -It carries out a task in the first minute of the first day of the month. - -  @monthly /path/to/script - -4) @yearly corresponds to 0 0 1 1 * - -It executes a task in the first minute of every year and is useful in sending New year greetings 🙂 - -@monthly /path/to/script - -### Crontab Restrictions - -As a Linux user, you can control who has the right to use the crontab command. This is possible using the **/etc/cron.deny** and **/etc/cron.allow** file. By default, only the /etc/cron.deny file exists and does not contain any entries. To restrict a user from using the crontab utility, simply add a user’s username to the file. When a user is added to this file, and the user tries to run the crontab command, he/she will encounter the error below. - -![restricted-cron-user][1] - -To allow the user to continue using the crontab utility,  simply remove the username from the /etc/cron.deny file. - -If /etc/cron.allow file is present, then only the users listed in the file can access and use the crontab utility. - -If neither file exists, then only the root user will have privileges to use the crontab command. - -### Backing up crontab entries - -It’s always advised to backup your crontab entries. To do so, use the syntax - -# crontab -l > /path/to/file.txt - -For example, - -``` -# crontab -l > /home/james/backup.txt -``` - -**Checking cron logs** - -Cron logs are stored in /var/log/cron file. To view the cron logs run the command: - -``` -# cat /var/log/cron -``` - -![view-cron-log-files-linux][1] - -To view live logs, use the tail command as shown: - -``` -# tail -f /var/log/cron -``` - -![view-live-cron-logs][1] - -**Conclusion** - -In this guide, you learned how to create cron jobs to automate repetitive tasks, how to backup as well as how to view cron logs. We hope that this article provided useful insights with regard to cron jobs. Please don’t hesitate to share your feedback and comments. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/ - -作者:[Pradeep Kumar][a] -选题:[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/pradeep/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Schedule-tasks-in-Linux-using-cron.jpg -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/etc-crontab-linux.png diff --git a/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md new file mode 100644 index 0000000000..a11cc0ea4c --- /dev/null +++ b/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md @@ -0,0 +1,290 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Schedule and Automate tasks in Linux using Cron Jobs) +[#]: via: (https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何使用 cron 任务在 Linux 中计划和自动化任务 +====== + +有时,你可能需要定期执行任务或以预定的时间间隔执行任务。这些任务包括备份数据库、更新系统、执行定期重新引导等。这些任务称为 “cron 任务”。cron 任务用于“自动执行的任务”,它有助于简化重复的、有时是乏味的任务的执行。cron 是一个守护进程,可让你调度这些任务,然后按指定的时间间隔执行这些任务。在本教程中,你将学习如何使用 cron 来调度任务。 + +![Schedule -tasks-in-Linux-using cron][2] + +### crontab 文件 + +crontab 即 “cron table”,是一个简单的文本文件,其中包含指定任务执行时间间隔的规则或命令。 crontab 文件分为两类: + +1)系统范围的 crontab 文件 + +这些通常由需要 root 特权的 Linux 服务及关键应用程序使用。系统 crontab 文件位于 `/etc/crontab` 中,并且只能由 root 用户访问和编辑。通常用于配置系统范围的守护程序。`crontab` 文件的看起来类似如下所示: + +![etc-crontab-linux][3] + +2)用户创建的 crontab 文件 + +Linux 用户还可以在 `crontab` 命令的帮助下创建自己的 cron 任务。创建的 cron 任务将以创建它们的用户身份运行。 + +所有 cron 任务都存储在 `/var/spool/cron`(对于 RHEL 和 CentOS 发行版)和 `/var/spool/cron/crontabs`(对于 Debian 和 Ubuntu 发行版)中,cron 任务使用创建该文件的用户的用户名列出。 + +cron 守护进程在后台静默地检查 `/etc/crontab` 文件和 `/var/spool/cron` 及 `/etc/cron.d*/` 目录。 + +`crontab` 命令用于编辑 cron 文件。让我们看一下 crontab 文件的结构。 + +### crontab 文件剖析 + +在继续之前,我们要首先探索 crontab 文件的格式。crontab 文件的基本语法包括 5 列,由星号表示,后跟要执行的命令。 + +``` +*    *    *    *    *    command +``` + +此格式也可以表示如下: + +``` +m h d moy dow command +``` + +或 + +``` +m h d moy dow /path/to/script +``` + +让我们来解释一下每个条目 + +* `m`:代表分钟。范围是 0 到 59 +* `h`:表示小时,范围是 0 到 23 +* `d`:代表一个月中的某天,范围是 1 到 31 +* `moy`:这是一年中的月份。范围是 1 到 12 +* `doy`:这是星期几。范围是 0 到 6,其中 0 代表星期日 +* `Command`:这是要执行的命令,例如备份命令、重新启动和复制命令等 + +### 管理 cron 任务 + +看完 crontab 文件的结构之后,让我们看看如何创建、编辑和删除 cron 任务。 + +#### 创建 cron 任务 + +要以 root 用户身份创建或编辑 cron 任务,请运行以下命令: + +``` +# crontab -e +``` + +要为另一个用户创建或安排 cron 任务,请使用以下语法: + +``` +# crontab -u username -e +``` + +例如,要以 Pradeep 用户身份运行 cron 任务,请发出以下命令: + +``` +# crontab -u Pradeep -e +``` + +如果该 crontab 文件尚不存在,那么你将打开一个空白文本文档。如果该 crontab 文件已经存在,则 `-e` 选项会让你编辑该文件, + +#### 列出 crontab 文件 + +要查看已创建的 cron 任务,只需传递 `-l` 选项: + +``` +# crontab -l +``` + +#### 删除 crontab 文件 + +要删除 cron 任务,只需运行 `crontab -e` 并删除所需的 cron 任务行,然后保存该文件。 + +要删除所有的 cron 任务,请运行以下命令: + +``` +# crontab -r +``` + +然后,让我们看一下安排任务的不同方式。 + +### crontab 安排任务示例 + +如图所示,所有 cron 任务文件都带有释伴标头。 + +``` +#!/bin/bash +``` + +这表示你正在使用的 shell,在这种情况下,即 bash shell。 + +接下来,使用我们之前指定的 cron 任务条目指定要安排任务的时间间隔。 + +要每天下午 12:30 重新引导系统,请使用以下语法: + +``` +30  12 *  *  * /sbin/reboot +``` + +要安排在凌晨 4:00 重启,请使用以下语法: + +``` +0  4  *  *  *  /sbin/reboot +``` + +注:星号 `*` 用于匹配所有记录。 + +要每天两次运行脚本(例如,凌晨 4:00 和下午 4:00),请使用以下语法: + +``` +0  4,16  *  *  *  /path/to/script +``` + +要安排 cron 任务在每个星期五下午 5:00 运行,请使用以下语法: + +``` +0  17  *  *  Fri  /path/to/script +``` + +或 + +``` +0 17  *  *  *  5  /path/to/script +``` + +如果你希望每 30 分钟运行一次 cron 任务,请使用: + +``` +*/30  *  *  *  * /path/to/script +``` + +要安排 cron 任务每 5 小时运行一次,请运行: + +``` +*  */5  *  *  *  /path/to/script +``` + +要在选定的日期(例如,星期三和星期五的下午 6:00)运行脚本,请执行以下操作: + +``` +0  18  *  *  wed,fri  /path/to/script +``` + +要使用单个 cron 任务运行多个命令,请使用分号分隔任务,例如: + +``` +*  *  *  *  *  /path/to/script1 ; /path/to/script2 +``` + +### 使用特殊字符串节省编写 cron 任务的时间 + +某些 cron 任务可以使用对应于特定时间间隔的特殊字符串轻松配置。例如, + +1)`@hourly` 时间戳等效于 `0 * * * *` + +它将在每小时的第一分钟执行一次任务。 + +``` +@hourly /path/to/script +``` + +2)`@daily` 时间戳等效于 `0 0 * * *` + +它在每天的第一分钟(午夜)执行任务。它可以在执行日常工作时派上用场。 + +``` +@daily /path/to/script +``` + +3)`@weekly` 时间戳等效于 `0 0 1 * mon` + +它在每周的第一分钟执行 cron 任务,一周是从星期一开始的。 + +``` +@weekly /path/to/script +``` + +3)`@monthly` 时间戳等效于 `0 0 1 * *` + +它在每月第一天的第一分钟执行任务。 + +``` +@monthly /path/to/script +``` + +4)`@yearly` 时间戳等效于 `0 0 1 1 *` + +它在每年的第一分钟执行任务,并且对发送新年问候很有用。 + +``` +@yearly /path/to/script +``` + +### 限制 crontab + +作为 Linux 用户,你可以控制谁有权使用 `crontab` 命令。可以使用 `/etc/cron.deny` 和 `/etc/cron.allow` 文件来控制。默认情况下,只有一个 `/etc/cron.deny` 文件,并且不包含任何条目。要限制用户使用 `crontab` 实用程序,只需将用户的用户名添加到文件中即可。当用户添加到该文件中,并且该用户尝试运行 `crontab` 命令时,他/她将遇到以下错误。 + +![restricted-cron-user][4] + +要允许用户继续使用 `crontab` 实用程序,只需从 `/etc/cron.deny` 文件中删除用户名即可。 + +如果存在 `/etc/cron.allow` 文件,则仅文件中列出的用户可以访问和使用 `crontab` 实用程序。 + +如果两个文件都不存在,则只有 root 用户具有使用 `crontab` 命令的特权。 + +### 备份 crontab 条目 + +始终建议你备份 crontab 条目。为此,请使用语法 + +``` +# crontab -l > /path/to/file.txt +``` + +例如: + +``` +# crontab -l > /home/james/backup.txt +``` + +### 检查 cron 日志 + +cron 日志存储在 `/var/log/cron` 文件中。要查看 cron 日志,请运行以下命令: + +``` +# cat /var/log/cron +``` + +![view-cron-log-files-linux][5] + +要实时查看日志,请使用 `tail` 命令,如下所示: + +``` +# tail -f /var/log/cron +``` + +![view-live-cron-logs][6] + +### 总结 + +在本指南中,你学习了如何创建 cron 任务以自动执行重复性任务,如何备份和查看 cron 日志。我们希望本文提供有关 cron 作业的有用见解。请随时分享你的反馈和意见。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/ + +作者:[Pradeep Kumar][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.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Schedule-tasks-in-Linux-using-cron.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/etc-crontab-linux.png +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/restricted-cron-user.png +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/view-cron-log-files-linux.png +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/view-live-cron-logs.png From 6be8b1bebe05f669bff8d6b8abb8edca6fad361a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 00:58:02 +0800 Subject: [PATCH 433/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191111=20Unders?= =?UTF-8?q?tanding=20=E2=80=9Cdisk=20space=20math=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191111 Understanding -disk space math.md --- ...20191111 Understanding -disk space math.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 sources/tech/20191111 Understanding -disk space math.md diff --git a/sources/tech/20191111 Understanding -disk space math.md b/sources/tech/20191111 Understanding -disk space math.md new file mode 100644 index 0000000000..fbbe9d3aa7 --- /dev/null +++ b/sources/tech/20191111 Understanding -disk space math.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding “disk space math”) +[#]: via: (https://fedoramagazine.org/understanding-disk-space-math/) +[#]: author: (Pat Kelly https://fedoramagazine.org/author/tablepc/) + +Understanding “disk space math” +====== + +![][1] + +Everything in a PC, laptop, or server is represented as binary digits (a.k.a. _bits,_ where each bit can only be 1 or 0). There are no characters like we use for writing or numbers as we write them anywhere in a computer’s memory or secondary storage such as disk drives. For general purposes, the unit of measure for groups of binary bits is the byte — eight bits. Bytes are an agreed-upon measure that helped standardize computer memory, storage, and how computers handled data. + +There are various terms in use to specify the capacity of a disk drive (either magnetic or electronic). The same measures are applied to a computers random access memory (RAM) and other memory devices that inhabit your computer. So now let’s see how the numbers are made up. + +Suffixes are used with the number that specifies the capacity of the device. The suffixes designate a multiplier that is to be applied to the number that preceded the suffix. Commonly used suffixes are: + + * Kilo = 103 = 1,000 (one thousand) + * Mega = 106 = 1,000,000 (one million) + * Giga = 109 = 1000,000,000 (one billion) + * Tera = 1012 = 1,000,000,000,000 (one trillion) + + + +As an example 500 GB (gigabytes) is 500,000,000,000 bytes. + +The units that memory and storage are specified in  advertisements, on boxes in the store, and so on are in the decimal system as shown above. However since computers only use binary bits, the actual capacity of these devices is different than the advertised capacity. + +You saw that the decimal numbers above were shown with their equivalent powers of ten. In the binary system numbers can be represented as powers of two. The table below shows how bits are used to represent powers of two in an 8 bit Byte. At the bottom of the table there is an example of how the decimal number 109 can be represented as a binary number that can be held in a single byte of 8 bits (01101101). + +Eight bit binary number | | | | | | | | +---|---|---|---|---|---|---|---|--- +| Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 +Power of 2 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 +Decimal Value | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 +Example Number | 0 | 1 | 1 | 0 | 1 | 1 | 0 | 1 + +The example bit values comprise the binary number 01101101. To get the equivalent decimal value just add the decimal values from the table where the bit is set to 1. That is 64 + 32 + 8 + 4 + 1 = 109. + +By the time you get out to 230 you have decimal 1,073,741,824 with just 31 bits (don’t forget the 20) You’ve got a large enough number to start specifying memory and storage sizes. + +Now comes what you have been waiting for. The table below lists common designations as they are used for labeling decimal and binary values. + +Decimal + +| + +Binary + +---|--- + +KB (Kilobyte) + +1KB = 1,000 bytes + +| + +KiB (Kibibyte) + +1KiB = 1,024 bytes + +MB (Megabyte) + +1MB = 1,000,000 bytes + +| + +MiB (Mebibyte) + +1MiB = 1,048,576 bytes + +GB (Gigabyte) + +1GB = 1,000,000,000 bytes + +| + +GiB (Gibibyte) + +1 GiB (Gibibyte) = 1,073,741,824 bytes + +TB (Terabyte) + +1TB = 1,000,000,000,000 + +| + +TiB (Tebibyte) + +1TiB = 1,099,511,627,776 bytes + +Note that all of the quantities of bytes in the table above are expressed as decimal numbers. They are not shown as binary numbers because those numbers would be more than 30 characters long. + +Most users and programmers need not be concerned with the small differences between the binary and decimal storage size numbers. If you’re developing software or hardware that deals with data at the binary level you may need the binary numbers. + +As for what this means to your PC: Your PC will make use of the full capacity of your storage and memory devices. If you want to see the capacity of your disk drives, thumb drives, etc, the Disks utility in Fedora will show you the actual capacity of the storage device in number of bytes as a decimal number. + +There are also command line tools that can provide you with more flexibility in seeing how your storage bytes are being used. Two such command line tools are [_du_][2] (for files and directories) and [_df_][3] (for file systems). You can read about these by typing _man du_ or _man df_ at the command line in a terminal window. + +* * * + +*Photo by _[_Franck V._][4]_ on *[_Unsplash_][5]. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/understanding-disk-space-math/ + +作者:[Pat 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://fedoramagazine.org/author/tablepc/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/disk-space-math-816x345.jpg +[2]: https://linux.die.net/man/1/du +[3]: https://linux.die.net/man/1/df +[4]: https://unsplash.com/@franckinjapan?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[5]: https://unsplash.com/s/photos/math?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText From de795289251c6dd2509b860d935118267e75f250 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 00:58:27 +0800 Subject: [PATCH 434/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191113=20Gettin?= =?UTF-8?q?g=20Started=20With=20ZFS=20Filesystem=20on=20Ubuntu=2019.10?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md --- ...ted With ZFS Filesystem on Ubuntu 19.10.md | 144 ++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md diff --git a/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md b/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md new file mode 100644 index 0000000000..e9f4d75755 --- /dev/null +++ b/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting Started With ZFS Filesystem on Ubuntu 19.10) +[#]: via: (https://itsfoss.com/zfs-ubuntu/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Getting Started With ZFS Filesystem on Ubuntu 19.10 +====== + +One of the main [features of Ubuntu 19.10][1] is support for [ZFS][2]. Now you can easily install Ubuntu with on ZFS without any extra effort. + +Normally, you install Linux with Ext4 filesystem. But if you do a fresh install of Ubuntu 19.10, you’ll see the option to use ZFS on the root. You must not use it on a dual boot system though because it will erase the entire disk. + +![You can choose ZFS while installing Ubuntu 19.10][3] + +Let’s see why ZFS matters and how to take advantage of it on ZFS install of Ubuntu. + +### How ZFS is different than other filesystems? + +ZFS is designed with two major goals in mind: to handle large amounts of storage and prevent data corruption. ZFS can handle up to 256 quadrillion Zettabytes of storage. (Hence the Z in ZFS.) It can also handle files up to 16 exabytes in size. + +If you are limited to a single drive laptop, you can still take advantage of the data protection features in ZFS. The copy-on-write feature ensures that data that is in use is not overwritten. Instead, the new information is written to a new block and the filesystem’s metadata is updated to point to the new block. ZFS can easily create snapshots of the filesystem. These snapshots track changes made to the filesystem and share with the filesystem the data that is the same to save space. + +ZFS assigned a checksum to each file on the drive. It is constantly checking the state of the file against that checksum. If it detects that the file has become corrupt, it will attempt to automatically repair that file. + +I have written a detailed article about [what is ZFS and what its features are][2]. Please read it if you are interested in knowing more on this topic. + +Note + +Keep in mind that the data protection features of ZFS can lead to a reduction in performance. + +### Using ZFS on Ubuntu [For intermediate to advanced users] + +![][4] + +Once you have a clean install of Ubuntu with ZFS on the main disk you can start [taking advantage][5] of the features that this filesystem has. + +Please note that all setup of ZFS requires the command line. I am not aware of any GUI tools for it. + +#### Creating a ZFS pool + +_**The section only applies if you have a system with more than one drive. If you only have one drive, Ubuntu will automatically create the pool during installation.**_ + +Before you create your pool, you need to find out the id of the drives for the pool. You can use the command _**lsblk**_ to show this information. + +To create a basic pool with three drives, use the following command: + +``` +sudo zpool create pool-test /dev/sdb /dev/sdc /dev/sdd. +``` + +Remember to replace _**pool-test**_ with the pool name of your choice. + +This command will set up “a zero redundancy RAID-0 pool”. This means that if one of the drives becomes damaged or corrupt, you will lose data. If you do use this setup, it is recommended that you do regular backups. + +You can alos add another disk to the pool by using this command: + +``` +sudo zpool add pool-name /dev/sdx +``` + +#### Check the status of your ZFS pool + +You can check the status of your new pool using this command: + +``` +sudo zpool status pool-test +``` + +![Zpool Status][6] + +#### Mirror a ZFS pool + +To ensure that your data is safe, you can instead set up mirroring. Mirroring means that each drive contains the same data. With mirroring setup, you could lose two out of three drives and still have all of your information. + +To create a mirror, you can use something like this: + +``` +sudo zpool create pool-test mirror /dev/sdb /dev/sdc /dev/sdd +``` + +#### Create ZFS Snapshots for backup and restore + +Snapshots allow you to create a fall-back position in case a file gets deleted or overwritten. For example, let’s create a snapshot, delete some folder in my home directory and restore them. + +First, you need to find the dataset you want to snapshot. You can do that with the + +``` +zfs list +``` + +![Zfs List][7] + +You can see that my home folder is located in **rpool/USERDATA/johnblood_uwcjk7**. + +Let’s create a snapshot named **1910** using this command: + +``` +sudo zfs snapshot rpool/USERDATA/[email protected] +``` + +The snapshot will be created very quickly. Now, I am going to delete the _Downloads_ and _Documents_ directories. + +Now to restore the snapshot, all you have to do is run this command: + +``` +sudo zfs rollback rpool/USERDATA/[email protected] +``` + +The length of the rollback depends on how much the information changed. Now, you can check the home folder and the deleted folders (and their content) will be returned to their correct place. + +### To ZFS or not? + +This is just a quick glimpse at what you can do with ZFS on Ubuntu. For more information, check out [Ubuntu’s wiki page on ZFS.][5] I also recommend reading this [excellent article on ArsTechnica][8]. + +This is an experimental feature and if you are not aware of ZFS and you want to have a simple stable system, please go with the standard install on Ext4. If you have a spare machine that you want to experiment with, then only try something like this to learn a thing or two about ZFS. If you are an ‘expert’ and you know what you are doing, you are free to experiment ZFS wherever you like. + +Have you ever used ZFS? 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][9]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zfs-ubuntu/ + +作者:[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/ubuntu-19-04-release-features/ +[2]: https://itsfoss.com/what-is-zfs/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/zfs-ubuntu-19-10.jpg?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Using_ZFS_Ubuntu.jpg?resize=800%2C450&ssl=1 +[5]: https://wiki.ubuntu.com/Kernel/Reference/ZFS +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/zpool-status.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/zfs-list.png?ssl=1 +[8]: https://arstechnica.com/information-technology/2019/10/a-detailed-look-at-ubuntus-new-experimental-zfs-installer/ +[9]: https://reddit.com/r/linuxusersgroup From 6e417146f6567ae4b210b9d68eec3d66d44dea4c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 00:59:57 +0800 Subject: [PATCH 435/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191112=20Gettin?= =?UTF-8?q?g=20started=20with=20PostgreSQL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191112 Getting started with PostgreSQL.md --- ...0191112 Getting started with PostgreSQL.md | 213 ++++++++++++++++++ 1 file changed, 213 insertions(+) create mode 100644 sources/tech/20191112 Getting started with PostgreSQL.md diff --git a/sources/tech/20191112 Getting started with PostgreSQL.md b/sources/tech/20191112 Getting started with PostgreSQL.md new file mode 100644 index 0000000000..79945ae3d3 --- /dev/null +++ b/sources/tech/20191112 Getting started with PostgreSQL.md @@ -0,0 +1,213 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with PostgreSQL) +[#]: via: (https://opensource.com/article/19/11/getting-started-postgresql) +[#]: author: (Greg Pittman https://opensource.com/users/greg-p) + +Getting started with PostgreSQL +====== +Install, set up, create, and start using your first PostgreSQL database. +![Guy on a laptop on a building][1] + +Everyone has things that would be useful to collect in a database. Even if you're obsessive about keeping paperwork or electronic files, they can become cumbersome. Paper documents can be lost or completely disorganized, and information you need to access in electronic files may be buried in depths of paragraphs and pages of information. + +When I was practicing medicine, I used [PostgreSQL][2] to keep track of my hospital patient list and to submit information about my hospital patients. I carried a printout of my daily patient list in my pocket for quick reference and to make quick notes about any changes in the patients' room, diagnosis, or other details. + +I thought that was all behind me, until last year when my wife decided to get a new car, and I "inherited" her previous one. She had kept a folder of car repair and maintenance service receipts, but over time, it lost any semblance of organization. It takes time to sift through all the slips of paper to figure out what was done when, and I thought PostgreSQL would be a better way to keep track of this information. + +### Install PostgreSQL + +It had been a while since I last used PostgreSQL, and I had forgotten how to get going with it. In fact, I didn't even have it on my computer. Installing it was step one. I use Fedora, so in a console, I ran: + + +``` +`dnf list postgresql*` +``` + +Notice that you don't need to use sudo to use the **list** option. This command returned a long list of packages; after scanning them, I decided I only wanted three: postgresql, postgresql-server, and postgresql-docs. + +To find out what I needed to do next, I decided to consult the [PostgreSQL docs][3]. The docs are a very extensive reference—so extensive, in fact, that it is rather daunting. Fortunately, I found some notes I made in the past when I was upgrading Fedora and wanted to efficiently export my database, restart PostgreSQL on the new version, and import my old database. + +### Set up PostgreSQL + +Unlike most other software, you can't just install PostgreSQL and start using it. You must carry out two basic steps beforehand: First, you need to set up PostgreSQL, and second, you need to start it. You must do these as the **root** user (sudo will not work here). + +To set it up, enter: + + +``` +`postgresql-setup –initdb` +``` + +This establishes the location of the PostgreSQL databases on the computer. Then (still as **root**), enter these two commands: + + +``` +systemctl start postgresql.service +systemctl enable postgresql.service +``` + +The first command starts PostgreSQL for the current session on your computer (if you turn it off, PostgreSQL shuts down). The second command causes PostgreSQL to automatically start on subsequent reboots. + +### Create a user + +PostgreSQL is running, but you still can't use it because you haven't been named a user yet. To do this, you need to switch to the special user **postgres**. While you are still running as **root**, type: + + +``` +`su postgres` +``` + +Since you're doing this as **root**, you don't need to enter a password. The **root** user can operate as any user without knowing their password; this is part of what makes it so powerful—and dangerous. + +Now that you're **postgres**, run two commands like the following example (which creates the user **gregp**) to create your user: + + +``` +createuser gregp +createdb gregp +``` + +You will probably get an error message like: **Could not switch to /home/gregp**. This just means that the user **postgres** doesn't have access to that directory. Nonetheless, your user and the database have been created. Next, type **Exit** and **Enter** twice so you're back to being yourself again. + +### Set up a database + +To start using PostgreSQL, type **psql** on the command line. You should see something like **gregp=>** to the left of each line to show that you're using PostgreSQL and can only use commands that it understands. You automatically have a database (mine is named **gregp**)—with absolutely nothing in it. A database, in the sense of PostgreSQL, is just a space to work. Inside that space, you create _tables_. A table contains a list of variables, and underneath each variable is the data that makes up your database. + +Here is how I set up my auto-service database: + + +``` +CREATE TABLE autorepairs ( +        date            date, +        repairs         varchar(80), +        location        varchar(80), +        cost            numeric(6,2) +); +``` + +I could have typed this continuously on a single line, but I broke it up to illustrate the parts better and to show that the white space of tabs and line feeds is not interpreted by PostgreSQL. The data points are contained within parentheses, each variable name and data type is separated from the next by a comma (except for the last), and the command ends with a semicolon. All commands must end with a semicolon! + +The first variable name is **date**, and its datatype is also **date**, which is OK with PostgreSQL. The second and third variables, **repairs** and **location**, are both datatype **varchar(80)**, which means they can be any mixture of up to 80 characters (letters, numbers, whatever). The last variable, **cost**, uses the **numeric** datatype. The numbers in parentheses indicate there is a maximum of six digits and two of them are decimals. At first, I tried the **real** datatype, which would be a floating-point number. The problem with **real** as a datatype comes in more advanced commands using a **WHERE** clause, like **WHERE cost = 0** or any other specific number. Since there is some imprecision in **real** values, specific numbers will never match anything. + +### Enter data + +Next, you can add some data (in PostgreSQL called a **row**) with the command **INSERT INTO**: + + +``` +`INSERT INTO autorepairs VALUES ('2017-08-11', 'airbag recall', 'dealer', 0);` +``` + +Notice that the parentheses form a container for the values, which must be in the correct order, separated by commas, and with a semicolon at the end of the command. The value for the **date** and **varchar(80)** datatypes must be enclosed in single quotes, but number values like **numeric** do not. As feedback, you should see: + + +``` +`INSERT 0 1` +``` + +Just as in your regular terminal session, you will have a history of entered commands, so often you can save a great deal of time when entering subsequent rows by pressing the Up arrow key to show the last command and editing the data as needed. + +What if you get something wrong? Use **UPDATE** to change a value: + + +``` +`UPDATE autorepairs SET date = '2017-11-08' WHERE repairs = 'airbag recall';` +``` + +Or maybe you no longer want something in your table. Use **DELETE**: + + +``` +`DELETE FROM autorepairs WHERE repairs = 'airbag recall';` +``` + +and the whole row will be deleted. + +One last thing: Even though I used all caps in the PostgreSQL commands (which is also done in most documentation), you can type them in lowercase, which is what I generally do. + +### Output data + +If you want to show your data, use **SELECT**: + + +``` +`SELECT * FROM autorepairs ORDER BY date;` +``` + +Without the **ORDER BY** option, the rows would appear however they were entered. For example, here's a selection of my auto-service data as it's output in my terminal: + + +``` +SELECT date, repairs FROM autorepairs ORDER BY date; + +    date   |                             repairs                              +\-----------+----------------------------------------------------------------- +2008-08-08 | oil change, air filter, spark plugs +2011-09-30 | 35000 service, oil change, rotate tires/balance wheels +2012-03-07 | repl battery +2012-11-14 | 45000 maint, oil/filter +2014-04-09 | 55000 maint, oil/filter, spark plugs, air/dust filters +2014-04-21 | replace 4 tires +2014-04-21 | wheel alignment +2016-06-01 | 65000 mile service, oil change +2017-05-16 | oil change, replce oil filt housing +2017-05-26 | rotate tires +2017-06-05 | air filter, cabin filter,spark plugs +2017-06-05 | brake pads and rotors, flush brakes +2017-08-11 | airbag recall +2018-07-06 | oil/filter change, fuel filter, battery svc +2018-07-06 | transmission fl, p steering fl, rear diff fl +2019-07-22 | oil & filter change, brake fluid flush, front differential flush +2019-08-20 | replace 4 tires +2019-10-09 | replace passenger taillight bulb +2019-10-25 | replace passenger taillight assembly +(19 rows) +``` + +To send this to a file, change the output with: + + +``` +`\o autorepairs.txt` +``` + +then run the **SELECT** command again. + +### Exit PostgreSQL + +Finally, to get out of PostgreSQL mode in the terminal, type: + + +``` +`quit` +``` + +or its shorthand version: + + +``` +`\q` +``` + +While this is just a brief introduction to PostgreSQL, I hope it demonstrates that it's neither difficult nor time-consuming to use the database for a simple task like this. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/getting-started-postgresql + +作者:[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/computer_code_programming_laptop.jpg?itok=ormv35tV (Guy on a laptop on a building) +[2]: https://www.postgresql.org/ +[3]: http://www.postgresql.org/docs From ba24f652eece9b0a4682b19f1bf93d389b6ec566 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 01:02:07 +0800 Subject: [PATCH 436/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191112=205=20op?= =?UTF-8?q?en=20source=20plugins=20for=20Flutter=20apps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191112 5 open source plugins for Flutter apps.md --- ... 5 open source plugins for Flutter apps.md | 853 ++++++++++++++++++ 1 file changed, 853 insertions(+) create mode 100644 sources/tech/20191112 5 open source plugins for Flutter apps.md diff --git a/sources/tech/20191112 5 open source plugins for Flutter apps.md b/sources/tech/20191112 5 open source plugins for Flutter apps.md new file mode 100644 index 0000000000..2f529b9303 --- /dev/null +++ b/sources/tech/20191112 5 open source plugins for Flutter apps.md @@ -0,0 +1,853 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 open source plugins for Flutter apps) +[#]: via: (https://opensource.com/article/19/11/open-source-plugins-flutter-apps) +[#]: author: (Baradwaj Varadharajan https://opensource.com/users/baradwaj) + +5 open source plugins for Flutter apps +====== +Create more useful and attractive apps faster with these plugins for +Google's cross-platform development language. +![][1] + +[Flutter][2] is the newest addition to Google's programming cadre. Following the success of Android, Kotlin, and Golang, [Flutter][3] was created as a cross-platform application development language. It is primarily based on the Dart programming construct and is considered to be the next big programming paradigm because its code can run as a mobile app, a web app, and even a desktop app without any major changes. Supposedly it will support Google's upcoming [Fuschia][4] operating system. + +Flutter plugins are simple dependencies that extend the language's capabilities. This list of the top five open source Flutter plugins includes both user interface (UI)-related and function-related plugins. + +The plugins must be included in your **pubspec.yaml** file before they can be used; they are required to make modifications to the **pubspec.yaml** file in the **lib** folder inside the project. + +### Flutter video-player plugin + +The video_player plugin allows you to embed videos to play in Flutter apps.  + +_Note: Up to Flutter 1.9, there is no video player support present in Flutter, so you have to depend on external plugins like video_player. This provides us with the VideoPlayer class which we will be using here._ + +Before using the VideoPlayer class in Flutter, you have to do the following for iOS and Android applications. + +#### Prerequisites + +**For Android:** + +Make sure that the minimum SDK is set to 21. You can modify this through the Build Gradle inside the **android>app** folder. + +Next, make sure that the **AndroidManifest.xml** file has internet permission enabled by adding the following line in the **AndroidManifest.xml** file: + + +``` +`` +``` + +**For iOS:** + +To give permission to use the internet to render the videos (if required), add the following lines to the **info.plist** file in **<project root>/ios/Runner/Info.plist**: + + +``` +<key>NSAppTransportSecurity</key> +<dict> +  <key>NSAllowsArbitraryLoads</key> +  <true/> +</dict> +``` + +Once the prerequisites for Android and iOS are done, add the following line to the **pubspec.yaml** file in the **dependency** section: + + +``` +`dependencies: video_player: ^0.10.1+3` +``` + +Then use **get packages** to sync the project. + +#### Video_Player plugin basics + +The Video_Player plugin provides support for playing network and local videos on a device by creating a simple API to call the videos. The example application below shows how the Video_Player plugin uses the controller object and how to create the **Future<> Builder** to play the video on loading. + +Start by using the [Scaffold widget][5] as the parent body widget. The goal is for the user to be able to play and pause a video using button controls. + +In order to call the video player object from anywhere, you need a controller to hold it. The VideoPlayerController class makes this possible. The example application pieces it all together. + +#### Example Flutter Video Player app + + +``` +import 'dart:async'; + +import 'package:flutter/material.dart'; +import 'package:video_player/video_player.dart'; + +void main() => runApp(VideoPlayerApp()); + +class VideoPlayerApp extends StatelessWidget { +  @override +  Widget build(BuildContext context) { +    return MaterialApp( +      title: 'Video Player Demo', +      home: VideoPlayerScreen(), +    ); +  } +} + +class VideoPlayerScreen extends StatefulWidget { +  VideoPlayerScreen({Key key}) : super(key: key); + +  @override +  _VideoPlayerScreenState createState() => _VideoPlayerScreenState(); +} + +class _VideoPlayerScreenState extends State<VideoPlayerScreen> { +  VideoPlayerController _controller; +  Future<void> _initializeVideoPlayerFuture; + +  @override +  void initState() { +    _controller = VideoPlayerController.network( +      '', +    ); + +    // Initialize the controller and store the Future for later use. +    _initializeVideoPlayerFuture = _controller.initialize(); + +    // Use the controller to loop the video. +    _controller.setLooping(true); +    super.initState(); +  } + +  @override +  void dispose() { +    // Ensure disposing of the VideoPlayerController to free up resources. +    _controller.dispose(); + +    super.dispose(); +  } + +  @override +  Widget build(BuildContext context) { +    return Scaffold( +      drawer: Drawer(), +      backgroundColor: Colors.orangeAccent, +      appBar: AppBar( +        title: Text('Bee Video'), +        backgroundColor: Colors.black87, +      ), +      // Use a FutureBuilder to display a loading spinner while waiting for the +      // VideoPlayerController to finish initializing. +      body: Stack( +        children: <Widget>[ +          Center(child:FutureBuilder( +            future: _initializeVideoPlayerFuture, +            builder: (context, snapshot) { +              if (snapshot.connectionState == ConnectionState.done) { +                // If the VideoPlayerController has finished initialization, use +                // the data it provides to limit the aspect ratio of the video. +                return AspectRatio( +                  aspectRatio: _controller.value.aspectRatio, +                  // Use the VideoPlayer widget to display the video. +                  child: VideoPlayer(_controller), +                ); +              } else { +                // If the VideoPlayerController is still initializing, show a +                // loading spinner. +                return Center(child: CircularProgressIndicator()); +              } +            }, +          )), +          Center( +              child: +             ButtonTheme( +                  height: 100.0, +                  minWidth: 200.0, +                  child: RaisedButton( +                    padding: EdgeInsets.all(60.0), +                    color: Colors.transparent, +                    textColor: Colors.white, +                    onPressed: () { +                      // Wrap the play or pause in a call to `setState`. This ensures the +                      // correct icon is shown. +                      setState(() { +                        // If the video is playing, pause it. +                        if (_controller.value.isPlaying) { +                          _controller.pause(); +                        } else { +                          // If the video is paused, play it. +                          _controller.play(); +                        } +                      }); +                    }, +                    child: Icon( +                      _controller.value.isPlaying ? Icons.pause : Icons.play_arrow, +                      size: 120.0, +                    ), +                  )) +          ) +        ], +      ), +    ); +  } +} +``` + +Here's the resulting application. + +![Flutter Video Plugin][6] + +![Flutter Video Plugin][7] + +### Flutter Shimmer Effect plugin + +The Flutter [Shimmer Effect][8] UI plugin is fairly straightforward: You just make use of only one class in your widget tree, and the work is done. Here is what the Shimmer Effect looks like: + +![Flutter Shimmer Effect plugin][9] + +To implement this effect, jump into the widget definition and use the **Shimmer** class in your widget tree with this option: + + +``` +`Shimmer.fromColors` +``` + +Next, finalize the application by filling out the properties described below. + +#### Shimmer.fromColors properties + +**Shimmer.fromColors** has the following properties: + + * **baseColor:** This is the shimmer's base color that gets shown on the widget. This is the primary color and the one the child widget will use. + * **HighlightColor:** This is the color that produces the shimmer-like effect by continually waving across the child widget. + * **Child:** This holds whatever widget produces the Shimmer Effect. It could be a Text widget or any complex structure. + + + +The example program shows how these attributes work across complex widgets. + +#### Example Flutter Shimmer Effect app + +This example produces the Shimmer Effect for two important widgets: the Text widget and the [Listview widget][10]. + + +``` +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:shimmer/shimmer.dart'; + +void main() => runApp(ShimmerEffectApp()); + +class ShimmerEffectApp extends StatelessWidget { +@override +Widget build(BuildContext context) { +return MaterialApp( +title: 'Sample ShimmerEffect Widget', +home: ShimmerWidget(), +); +} +} + +class ShimmerWidget extends StatefulWidget { +ShimmerWidget({Key key}) : super(key: key); + +@override +_ShimmerWidgetState createState() => _ShimmerWidgetState(); +} + +class _ShimmerWidgetState extends State { + +@override +void initState() { +super.initState(); +} + +@override +Widget build(BuildContext context) { +return Scaffold( +appBar: AppBar(title: Text("Shimmer effect"),), +body: Container( +padding: EdgeInsets.all(25.0), +child:Center( +child: Shimmer.fromColors( +direction: ShimmerDirection.rtl, +period: Duration(seconds:5), +child: Column( +children: [0, 1, 2, 3] +.map((_) => Padding( +padding: const EdgeInsets.only(bottom: 8.0), +child: Row( +crossAxisAlignment: CrossAxisAlignment.start, +children: [ +Container( +width: 48.0, +height: 48.0, +color: Colors.white, +), +Padding( +padding: +const EdgeInsets.symmetric(horizontal: 8.0), +), +Expanded( +child: Column( +crossAxisAlignment: CrossAxisAlignment.start, +children: [ +Container( +width: double.infinity, +height: 8.0, +color: Colors.white, +), +Padding( +padding: +const EdgeInsets.symmetric(vertical: 2.0), +), +Container( +width: double.infinity, +height: 8.0, +color: Colors.white, +), +Padding( +padding: +const EdgeInsets.symmetric(vertical: 2.0), +), +Container( +width: 40.0, +height: 8.0, +color: Colors.white, +), +], +), +) +], +), +)) +.toList(), +), +baseColor: Colors.grey[700], +highlightColor: Colors.grey[100]), +) +), +); +} +} +``` + +Here's the resulting application. + +![Flutter Shimmer Effect plugin][11] + +![Flutter Shimmer Effect plugin][12] + +### Flutter Badges plugin + +[Flutter Badges][13] is a very useful UI plugin that marks a notification count, a count of items in an e-commerce basket, etc. + +To use the Flutter Badges plugin, add the following dependency in your **pubspec.yaml** file: + + +``` +dependencies: +    badges: ^1.1.0 +``` + +Then, import the following line into your **main.dart** file: + + +``` +`import 'package:badges/badges.dart';` +``` + +Now, you can create badges with a simple call to the **Badge class.** + +#### Badge class properties + +Following are the Badge class's available properties: + + * **badgeContent:** This is the attribute that takes in the value of the Badge. It could be a number, a letter, etc. Make sure to make it as small as possible! + * **BadgeColor:** Control the color of the badge by adjusting the BadgeColor colors property. + * **AnimationType:** This enables three animations for the Badge: + * **BadgeAnimationType.scale:** Scales animation once loading happens. + * **BadgeAnimationType.fade:** Fades animation once loading happens + * **BadgeAnimationType.slide:** Slides animation once loading happens + * **shape:** This controls the shape of the badge; it could be a circle or a square. + * **AnimationDuration:** This takes in a Duration class as its value to set how long the animation should last. + + + +Once these attributes are set, you can create a simple app like the following. + +#### Example Flutter Badge application + +Add the following to your **main.dart** file and run the application. + + +``` +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:badges/badges.dart'; + +void main() => runApp(BadgesApp()); + +class BadgesApp extends StatelessWidget { +@override +Widget build(BuildContext context) { +return new MaterialApp( +title: 'APP', +home: BadgesWidget(), +); +} +} + +class BadgesWidget extends StatefulWidget { +BadgesWidget({Key key}) : super(key: key); + +@override +_BadgesWidgetState createState() => _BadgesWidgetState(); +} + +class _BadgesWidgetState extends State { + +int value = 0; + +@override +void initState() { +super.initState(); +} + +@override +Widget build(BuildContext context) { +return Scaffold( +appBar: AppBar(title:Text("Sample Badges")), +body: Center( +child: Container( +padding: EdgeInsets.all(25.0), +child: Column( +children: [ +Spacer(), +Badge( +child: RaisedButton( +color: Colors.blueGrey, +child: Text("Notifications", style: TextStyle(color: Colors.white),), +onPressed: (){ +setState(() { +value = value + 1; +}); +},), +badgeContent: Text('$value',style: TextStyle(color: Colors.white),), +badgeColor: Colors.red, +animationType: BadgeAnimationType.scale, +animationDuration: Duration(milliseconds: 500), +shape: BadgeShape.circle, +), +Spacer(), +Badge( +child: RaisedButton( +color: Colors.blueGrey, +child: Text("Messages", style: TextStyle(color: Colors.white),), +onPressed: (){ + +},), +badgeContent: Text("2",style: TextStyle(color: Colors.white),), +badgeColor: Colors.red, +animationType: BadgeAnimationType.scale, +animationDuration: Duration(seconds: 1), +shape: BadgeShape.circle, +), +Spacer(), +Badge( +child: RaisedButton( +color: Colors.blueGrey, +child: Text("Notifications", style: TextStyle(color: Colors.white),), +onPressed: (){ +},), +badgeContent: Text("2",style: TextStyle(color: Colors.white),), +badgeColor: Colors.red, +animationType: BadgeAnimationType.scale, +animationDuration: Duration(seconds: 1), +shape: BadgeShape.circle, +), +Spacer(flex: 4,) +], +), +), +) +); +} +} +``` + +Here's the resulting application. + +![Flutter Badges plugin][14] + +### Flutter Google Maps plugin + +Adding Google Maps in Flutter apps is a very easy process with the help of the **google_maps_flutter** plugin. + +_Note: The Google Maps Flutter plugin is still in developer preview (so it cannot be released to the app store yet). Make sure to wait for the stable release before using it._ + +The main prerequisites for using this plugin are to have a [Google Cloud Platform][15] account and to create a Google Maps API key. If you do not know how to obtain a key, see [Google Maps Integration in Flutter][16]. + +Once the Google Maps SDK is enabled with a credential/API key, you can use it in your Flutter app. Fill out the following with the key. + +**For Android:** + +Go to **android>app>src>main>Androidmanifest.xml** and make sure that the manifest looks like the following (replacing YOUR KEY HERE with your API key): + + +``` +<manifest ... +  <application ... +    <meta-data android:name="com.google.android.geo.API_KEY" +               android:value="YOUR KEY HERE"/> +``` + +**For iOS:** + +Edit the **Appdelegate.m** file as follows (replacing YOUR KEY HERE with your API key): + + +``` +@implementation AppDelegate + +\- (BOOL)application:(UIApplication *)application +    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { +  [GMSServices provideAPIKey:@"YOUR KEY HERE"]; +  [GeneratedPluginRegistrant registerWithRegistry:self]; +  return [super application:application didFinishLaunchingWithOptions:launchOptions]; +} +@end +``` + +#### GoogleMaps widget basics + +Now it's time to bring the Maps inside the Flutter application. To begin, add the following dependency in the **pubspec.yaml** file: + + +``` +dependencies: + google_maps_flutter: ^0.5.21 +``` + +Import the following package to the **main.dart** file: + + +``` +`import 'package:google_maps_flutter/google_maps_flutter.dart';` +``` + +This package provides the following widgets: + +##### GoogleMap + +The GoogleMap widget provides the main control over Google Maps inside a Flutter application. It has several important attributes that help create the maps you require. They are: + + * **mapType:** This attribute defines what type of map (satellite, hybrid, or normal) is shown. Select one by with the value MapType.satellite, MapType.hybrid, or MapType.normal. + * **InitialCameraPosition:** The initial camera position is important for rendering the map on the Flutter UI and setting the camera position (from which the camera will move). Set the initial camera position by creating a variable with the **CameraPosition** class as its value. + * **OnMapCreated:** This is a callback that fires whenever the camera position changes (e.g., whenever the user moves the map by pinching or swiping it). To move the camera angle programmatically, use GoogleMapController instead. + + + +##### GoogleMapController + +This class controls the Google Map by creating an instance of it. There is no explicit way to change the camera position of the Google Map, but you can use the GoogleMapController to control all sorts of activities on the GoogleMap class. + +##### CameraPosition + +The CameraPosition class provides the camera position values that are required to show any position on the GoogleMap. + + +``` +CameraPosition initPosition = CameraPosition( +target: LatLng(14.5, 25.7), zoom: 7, ); +``` + +The CameraPosition class takes in various attributes, like target, zoom, etc. The **Target** attribute marks the latitude and longitude position on the Google Map. The class takes in a double value like **LatLng(double, double)** to mark it at that position. + +#### Example Flutter GoogleMaps app + +This example app creates an animated camera transition on a Google Map. This is a very useful way to provide [Google Maps in Flutter][16] applications. + + +``` +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:google_maps_flutter/google_maps_flutter.dart'; + +void main() => runApp(GoogleMapApp()); + +class GoogleMapApp extends StatelessWidget { +@override +Widget build(BuildContext context) { +return MaterialApp( +title: 'Sample GoogleMap Widget', +home: GoogleMapWidget(), +); +} +} + +class GoogleMapWidget extends StatefulWidget { +GoogleMapWidget({Key key}) : super(key: key); + +@override +_GoogleMapWidgetState createState() => _GoogleMapWidgetState(); +} + +class _GoogleMapWidgetState extends State { + +Completer _controller = Completer(); + +@override +void initState() { +super.initState(); +} + +CameraPosition initPosition = CameraPosition( +target: LatLng(14.5, 25.7), +zoom: 7, +); + +void updateGoogleMap() +async{ +GoogleMapController cont = await _controller.future; +setState(() { +CameraPosition newtPosition = CameraPosition( +target: LatLng(14.5, 28.7), +zoom: 4, +); +cont.animateCamera(CameraUpdate.newCameraPosition(newtPosition)); +}); + +} + +@override +Widget build(BuildContext context) { +return Scaffold( +appBar: AppBar( +backgroundColor: Colors.black45, +title: Text("Update Google Map"), +), +body: Center( +child: Column( +children: [ +Container( +height: 400.0, +child: GoogleMap( +mapType: MapType.hybrid, +initialCameraPosition: initPosition, +onMapCreated: (GoogleMapController controller){ +_controller.complete(controller); +}, +), +), +FlatButton( +child: Text("Update Map", style: TextStyle(color: Colors.white),), +color: Colors.deepOrange, +onPressed: (){ +updateGoogleMap(); +}, +) +], +), +)); +} +} +``` + +Here's the resulting application. + +![Flutter Google Maps plugin][17] + +![Flutter Google Maps plugin][18] + +### Flutter ImagePicker image gallery plugin + +The ImagePicker plugin integrates an image gallery into a Flutter app. + +To begin using the [**image_picker**][19] plugin, add the following dependency in the **pubspec.yaml** file: + + +``` +dependencies: +  image_picker: ^0.6.1+4 +``` + +This requires you to add an import statement in your main file, e.g., **main.dart** file: + + +``` +`import 'package:image_picker/image_picker.dart';` +``` + +To use the Flutter application in iOS, make the following changes in the **info.plist** file: + + * **NSPhotoLibraryUsageDescription:** This describes why the app needs permission to use the photo library. This is called _Privacy - Photo Library Usage Description_ in the visual editor. + * **NSCameraUsageDescription:** This describes why your app needs access to the camera. This is called _Privacy - Camera Usage Description_ in the visual editor. + * **NSMicrophoneUsageDescription:** This describes why your app needs access to the microphone if you intend to record videos. This is called _Privacy - Microphone Usage Description_ in the visual editor. + + + +#### Image Picker widget basics + +To use the ImagePicker widget, just call the class [**ImagePicker**][20]. There are two options for this class: + + * Choose an image or choose a video + * Choose an image or video directly from a gallery or a camera source + + + +This is possible through two method callbacks: + + * **ImagePicker.pickImage()** with the source **ImageSource.gallery** or **ImageSource.camera** + * **ImagePicker.pickVideo()** with the above sources + + + +Both of these calls are async calls, which require **setState()** on the image or video that is selected. + +**ImagePicker.<source call>** returns the file location of the image/video. You must load the image using the **Image.file()** call. + +All of this is explained in the example application. + +#### Example Flutter ImagePicker widget app + +This example app creates an [Image Picker button][20] to select an image from the gallery or directly from the camera. + + +``` +import 'dart:async'; +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:image_picker/image_picker.dart'; + +void main() => runApp(ImagePickerApp()); + +class ImagePickerApp extends StatelessWidget { +@override +Widget build(BuildContext context) { +return MaterialApp( +title: 'Sample Imagepicker Widget', +home: ImagePickerWidget(), +); +} +} + +class ImagePickerWidget extends StatefulWidget { +ImagePickerWidget({Key key}) : super(key: key); + +@override +_ImagePickerWidgetState createState() => _ImagePickerWidgetState(); +} + +class _ImagePickerWidgetState extends State { + +File _image; +@override +void initState() { +super.initState(); +} + +void open_camera() +async { +var image = await ImagePicker.pickImage(source: ImageSource.camera); +setState(() { +_image = image; +}); + +} +void open_gallery() +async { +var image = await ImagePicker.pickImage(source: ImageSource.gallery); +setState(() { +_image = image; +}); +} +@override +Widget build(BuildContext context) { +return Scaffold( +appBar: AppBar(title: Text("Sample Imagepicker Widget"), +backgroundColor: Colors.black45,), +body: Center( +child: Container( +child: Column( +children: [ +Container( +color: Colors.black12, +height: 300.0, +width: 900.0, +child: _image == null ? Text("Still waiting!") : Image.file(_image),), +FlatButton( +color: Colors.deepOrangeAccent, +child: Text("Open Camera", style: TextStyle(color: Colors.white),), +onPressed: (){ +open_camera(); +},), +FlatButton( +color: Colors.limeAccent, + +child:Text("Open Gallery", style: TextStyle(color: Colors.black),), +onPressed: (){ +open_gallery(); +}, +) +], +), +), +) + +); + +} +} +``` + +Here's the resulting application. + +![Flutter ImagePicker widget][21] + +![Flutter ImagePicker widget][22] + +![Flutter ImagePicker widget][23] + +### Summary + +These five plugins are very important for creating a neater UI experience in Flutter apps. They will also help you ramp up faster with Flutter app development. + +* * * + +_Some of the information in this article was previously published at [Android Monks][24]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/open-source-plugins-flutter-apps + +作者:[Baradwaj Varadharajan][a] +选题:[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/baradwaj +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug-insect-butterfly-diversity-inclusion-2.png?itok=TcC9eews +[2]: https://opensource.com/article/18/6/flutter +[3]: https://flutter.dev/ +[4]: https://en.wikipedia.org/wiki/Google_Fuchsia +[5]: https://androidmonks.com/scaffold-flutter/ +[6]: https://opensource.com/sites/default/files/uploads/flutter1_videoplayer.png (Flutter Video Plugin) +[7]: https://opensource.com/sites/default/files/uploads/flutter2_videoplayer.png (Flutter Video Plugin) +[8]: https://androidmonks.com/shimmer-effect-flutter/ +[9]: https://opensource.com/sites/default/files/uploads/flutter3_shimmergif.gif (Flutter Shimmer Effect plugin) +[10]: https://androidmonks.com/listview-flutter/ +[11]: https://opensource.com/sites/default/files/uploads/flutter4_shimmer.png (Flutter Shimmer Effect plugin) +[12]: https://opensource.com/sites/default/files/uploads/flutter5_shimmer.png (Flutter Shimmer Effect plugin) +[13]: https://androidmonks.com/flutter-badges/ +[14]: https://opensource.com/sites/default/files/uploads/flutter6_samplebadges.png (Flutter Badges plugin) +[15]: https://cloud.google.com/maps-platform/ +[16]: https://androidmonks.com/google-maps-flutter/ +[17]: https://opensource.com/sites/default/files/uploads/flutter7_googlemap.png (Flutter Google Maps plugin) +[18]: https://opensource.com/sites/default/files/uploads/flutter8_googlemap.png (Flutter Google Maps plugin) +[19]: https://pub.dev/packages/image_picker +[20]: https://androidmonks.com/imagepicker-flutter/ +[21]: https://opensource.com/sites/default/files/uploads/flutter9_imagepicker.png (Flutter ImagePicker widget) +[22]: https://opensource.com/sites/default/files/uploads/flutter10_imagepicker.png (Flutter ImagePicker widget) +[23]: https://opensource.com/sites/default/files/uploads/flutter11_imagepicker.png (Flutter ImagePicker widget) +[24]: https://androidmonks.com/flutter-open-source-plugins/ From 5196bb54a6e26caf2d0b3ddc89d3e60c485c35f2 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 01:03:06 +0800 Subject: [PATCH 437/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191112=208=20gr?= =?UTF-8?q?eat=20podcasts=20for=20open=20source=20enthusiasts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191112 8 great podcasts for open source enthusiasts.md --- ...at podcasts for open source enthusiasts.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20191112 8 great podcasts for open source enthusiasts.md diff --git a/sources/tech/20191112 8 great podcasts for open source enthusiasts.md b/sources/tech/20191112 8 great podcasts for open source enthusiasts.md new file mode 100644 index 0000000000..c0d249d754 --- /dev/null +++ b/sources/tech/20191112 8 great podcasts for open source enthusiasts.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 great podcasts for open source enthusiasts) +[#]: via: (https://opensource.com/article/19/11/open-source-podcasts) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +8 great podcasts for open source enthusiasts +====== +Expand your knowledge about Linux, Python, and open source generally +while you're doing other things. +![Woman programming][1] + +Where I live, almost everything is a 20- or 30-minute drive from my home, and I'm always looking for ways to use my car time productively. One way is by listening to podcasts on topics that interest me, so as an open source enthusiast, I subscribe to a variety of open source-related podcasts. + +Here are eight Linux and open source podcasts that I Iook forward to every week. + +### Linux4Everyone + +[Linux4Everyone][2] by Jason Evangelho (whom I [recently interviewed][3]) is a favorite. The podcasts always offer fresh insights on Linux along with thoughtful interviews, including his conversations with [Barton George][4] of Dell and [Christopher Scott][5] of Microsoft. Jason's only been at this gig for a few months, but he already has a loyal following supporting him on Patreon. + +I have recently been listening to [**Command Line Heroes**][6]. Its host, Saron Yitbarek, is a developer and the founder of [CodeNewbie][7]. I've learned about how [C and Unix][8] laid important groundwork for the development and growth of Linux, as well as the evolution of the [Python community][9]—which will continue since founder Guido Van Rossum stepped down from his benevolent dictatorship role. + +### Linux Headlines + +[Linux Headlines][10] from [Jupiter Broadcasting][11] never fails to pique my interest in what's happening in the Linux world. Hosts [Chris Fisher][12], [Joe Ressington][13], [Wes Payne][14], and [Drew Davore][15] are always dishing up the latest developments that inspire me to learn and explore more. If you only have a few minutes to spare, this podcast is for you. + +### Self-Hosted + +[Self-Hosted][16] is a new podcast about home networks that hooked me immediately. With all the emphasis on containers and the cloud, you might think your local network doesn't have much to offer anymore. Hosts [Alex Kretzschmar][17] and Chris Fisher are two longtime self-hosters who share their learnings with listeners. + +### Online Life is Real Life + +In [Online Life is Real Life][18], sponsored by Firefox, "host [Manoush Zomorodi][19] shares real stories of life online and real talk about the future of the web." A recent show, "[Privacy or Profit—Why Not Both?][20]," dug into the concept that "privacy" means different things to different people. Do you know how your personal data is being used? Do you care? If so, this podcast might interest you. + +### The Changelog + +[The Changelog][21] bills itself as "conversations with the hackers, leaders, and innovators of software development." In a recent episode, [Chris Anderson][22], former editor-in-chief of _Wired_, shared how his hobby with drones started out terribly wrong but led him to 3D robotics, do-it-yourself drones, and the [Dronecode][23] project. + +### Destination Linux + +[Destination Linux][24], where "Linux is our passion," is a weekly show hosted by [Ryan][25], [Michael][26], [Zebediah][27], and [Noah][28]. The show started in 2017, and all of its content is licensed under Creative Commons 4.0 ShareAlike. One recent podcast focused on the addition of ZFS to Ubuntu 19.10 and how Project Trident ditched FreeBSD for Linux. + +### Talk Python to Me + +[Talk Python To Me][29] with host [Michael Kennedy][30] keeps me growing on my Python learning curve. + +In one of my favorite shows, "[Python in digital humanities research][31]," Michael interviewed Cornelius Van Lit, a medieval Islamic philosophy scholar, who is using Python to parse ancient manuscripts. + +Most of these podcasts come with show notes, which include links to the content they cover. Since I can't take notes when I'm driving, the show notes help me review what I hear and learn more about the topics mentioned. + +I am always eager to learn, so please share your favorite open source-related podcasts in the comments section. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/open-source-podcasts + +作者:[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/programming-code-keyboard-laptop-music-headphones.png?itok=EQZ2WKzy (Woman programming) +[2]: https://linuxforeveryone.fireside.fm/ +[3]: https://opensource.com/article/19/9/found-linux-video-gaming +[4]: https://twitter.com/barton808?lang=en +[5]: https://opensource.com/article/19/10/trust-linux-community +[6]: https://www.redhat.com/en/command-line-heroes +[7]: https://www.codenewbie.org/ +[8]: https://opensource.com/article/19/10/command-line-heroes-c +[9]: https://opensource.com/article/19/6/command-line-heroes-python +[10]: https://linuxheadlines.show/ +[11]: https://opensource.com/article/19/10/linux-podcasts-Jupiter-Broadcasting +[12]: https://twitter.com/ChrisLAS +[13]: https://twitter.com/JoeRessington +[14]: https://twitter.com/wespayne?lang=en +[15]: https://twitter.com/drewofdoom +[16]: https://selfhosted.show/ +[17]: https://twitter.com/ironicbadger?lang=en +[18]: https://irlpodcast.org/ +[19]: https://twitter.com/manoushz +[20]: https://irlpodcast.org/season5/episode7/ +[21]: https://changelog.com/podcast +[22]: https://twitter.com/chr1sa +[23]: https://www.dronecode.org/ +[24]: https://destinationlinux.org/ +[25]: https://destinationlinux.org/ryan/#contact +[26]: https://twitter.com/michaeltunnell?lang=en +[27]: https://twitter.com/zebedeeboss +[28]: https://destinationlinux.org/noah/ +[29]: https://talkpython.fm/ +[30]: https://twitter.com/mkennedy?lang=en +[31]: https://talkpython.fm/episodes/show/230/python-in-digital-humanities-research From d95ff82b5f018a26e855dcb2f3cd83459c2ac9f3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 01:04:21 +0800 Subject: [PATCH 438/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191112=20What?= =?UTF-8?q?=20open=20communities=20teach=20us=20about=20empowering=20custo?= =?UTF-8?q?mers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191112 What open communities teach us about empowering customers.md --- ...ies teach us about empowering customers.md | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 sources/tech/20191112 What open communities teach us about empowering customers.md diff --git a/sources/tech/20191112 What open communities teach us about empowering customers.md b/sources/tech/20191112 What open communities teach us about empowering customers.md new file mode 100644 index 0000000000..263a0f407d --- /dev/null +++ b/sources/tech/20191112 What open communities teach us about empowering customers.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What open communities teach us about empowering customers) +[#]: via: (https://opensource.com/open-organization/19/11/customer-empowerment-open-communities) +[#]: author: (TracyG https://opensource.com/users/tgiuliani23) + +What open communities teach us about empowering customers +====== +Granting customers more autonomy and control can be scary. It's also an +inevitable consequence of digital transformation. Time to open up our +relationships. +![Shaking hands, networking][1] + +When it comes to digital transformation, businesses seem to be on the right track improving their customers' experiences through the use of technologies. Today, so much [digital transformation literature][2] describes the benefits of "delivering new value to customers" or "delivering value to customers in new ways." + +But "bringing new value to customers" is just the beginning. An even more powerful effect of digital transformation efforts is _empowering customers_. + +"What?" you may be saying. "How could I _possibly_ empower customers? What does that even mean?" + +With this series, we're here to help. In this article specifically, we'll define customer empowerment and explain why it should be a concern for any organization facing the possibility of transformation. + +### Defining customer empowerment + +Customer empowerment begins with the idea of giving customers access to the information, knowledge, opportunities, and authority to act in their own best interests inside the boundaries of their organizations and industries. This translates into an ability for customers to do _more for themselves_. + +Creating systems for customer empowerment means doing more than merely adding value to existing customer relationships. It means developing entirely _new_ kinds of relationships—more _open_ relationships—with customers. And that, in turn, means organizations undergoing digital transformations will need to understand how openness affects not only the _technical_ connections they make with people but also the _social_ connections responsible for the success of the new systems they're putting in place. + +The customer relationships you want to create are not merely the result of saying "Here's what we do for you, dear customer"; they are like the relationships you have in _other_ areas of your life: Trusting. Reciprocal. Authentic. + +Creating systems for customer empowerment means doing more than merely adding value to existing customer relationships. + +In short, customer empowerment is a natural, inevitable step in digital transformation. It involves using open values, open processes, and open software to transform the relationship with the customer by trusting them and giving them the information and opportunities to engage differently with your company. + +Think of [the way employee empowerment works in open organizations][3]. Leaders in these organizations make information, opportunities, and authority available to stakeholders so they feel empowered to make decisions and solve problems in ways leaders might not have predicted. _Customer_ empowerment works the same way—though in this case, the _organization itself_ provides _external_ parties with materials that empower their _own_ innovative activities. Typically, they do this through new, customer-facing processes. It's imperative that businesses interested in customer empowerment have enough data and sufficiently frequent interactions with their customers to be able to understand them, and that _associates_ in these businesses have a customer-centric mindset accompanied by the tools, processes, and training to make decisions that focus on customers' empowerment. + +Makes sense, right? But what does it look like? + +### An empowerment continuum + +Let's begin with one example from the retail industry. Nordstrom is a company that repeatedly earns high marks for its empowered employees and its superior customer service. Nordstrom customers feel empowered when they interact with the brand because the organization goes to great lengths to ensure that information on sizes for each item is correct, that pictures are color-true, that the opportunity to shop is convenient through online sites and mobile apps, and that trying new brands is risk-free for customers (because shipping is free). Nordstrom even manages return shipping through printable labels directly on its website. The company is trusting customers not to order clothes and return them after wearing them. + +Customer empowerment is a natural, inevitable step in digital transformation. + +This is an example of a company operating at the far end of a customer empowerment continuum. The empowerment practices we describe are low-risk—that is, the customer behaviors Nordstrom is trying to cultivate are aimed at helping customers do more of what Nordstrom expects them to do (buy goods). + +But we can follow that customer empowerment continuum to identify various ways companies might empower customers (and in the process grant them the power to innovate and surprise). [Kelvin Claveria][4], for example, outlines several examples: Mountain Dew collaborated with customers on their new flavor, "Voltage"; Buffer was transparent with customers and businesses about their security breach; Coca-Cola involved its fan community in building marketing content. These examples (all of which focus on marketing) demonstrate a higher degree of risk, but they're not quite on the far edge of our customer empowerment continuum. + +At that edge is full-on customer empowerment, where a trusted relationship with the customer lays the foundation of interactions. We might think of open source communities as exemplary in this regard: customers have access to the source code of the application they're using and are actively modifying the products they receive. What's more trusting and empowering than that? + +In open source communities, which leverage collaborative development methods, anyone can share information, get feedback, and take advantage of numerous opportunities to write code and participate in the community projects. The community is trusting user-collaborators to participate honestly (and without malicious intent) at the same time that the community manages itself and bans users who don't participate with community values or take advantage. + +What might customer empowerment in _this_ sense look like for organizations? + +In our next installment, we'll explore that question. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/11/customer-empowerment-open-communities + +作者:[TracyG][a] +选题:[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/tgiuliani23 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/network_team_career_hand.png?itok=_ztl2lk_ (Shaking hands, networking) +[2]: https://enterprisersproject.com/what-is-digital-transformation +[3]: https://opensource.com/open-organization/18/10/understanding-engagement-and-empowerment +[4]: https://www.visioncritical.com/blog/power-of-customer From 86066aa37a8319cf81b39118b986815e71f88326 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 01:09:12 +0800 Subject: [PATCH 439/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191111=203=20ap?= =?UTF-8?q?proaches=20to=20secrets=20management=20for=20Flatpak=20applicat?= =?UTF-8?q?ions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191111 3 approaches to secrets management for Flatpak applications.md --- ...ets management for Flatpak applications.md | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 sources/tech/20191111 3 approaches to secrets management for Flatpak applications.md diff --git a/sources/tech/20191111 3 approaches to secrets management for Flatpak applications.md b/sources/tech/20191111 3 approaches to secrets management for Flatpak applications.md new file mode 100644 index 0000000000..fd33e978f4 --- /dev/null +++ b/sources/tech/20191111 3 approaches to secrets management for Flatpak applications.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 approaches to secrets management for Flatpak applications) +[#]: via: (https://opensource.com/article/19/11/secrets-management-flatpak-applications) +[#]: author: (Daiki Ueno https://opensource.com/users/ueno) + +3 approaches to secrets management for Flatpak applications +====== +Flatpak secrets management is getting an upgrade. Here's what's coming. +![A top secret file.][1] + +[Flatpak][2] enables desktop applications to run in isolated sandboxes, which significantly improves security as it prevents applications from affecting one another and impacting the host system. In practice, however, typical applications still need to access services and user data that are shared among other applications and the host. This situation has been improved [by hardening permissions around the portal mechanism][3], though there was a long-standing issue: How to manage user secrets. + +In this article, we present our approach to managing user secrets for Flatpak applications. While most applications can transparently take advantage of the proposed mechanism, some applications need code modification. The migration steps are also presented. + +### How secrets are managed on the Linux desktop + +On a modern Linux desktop, most of the secrets—passwords, tokens, and so on, with their associated attributes—are centrally managed by the daemon process **gnome-keyring-daemon**. Applications access this daemon through [the Secret Service API][4], which is exposed through D-Bus. This process is done under the hood if the application is using a client library like **libsecret**.  + +**Note:** For the same purpose, there is a library called **libgnome-keyring**, which is now obsolete. Note that, despite the name, **libgnome-keyring** is a separate project from **gnome-keyring**, which is NOT obsolete and still maintains the central role of secrets management. + +On the daemon side, the secrets are stored on the filesystem and encrypted. Other than that, the daemon is nothing but a normal storage service, meaning that any application can store data on arbitrary "paths" that other applications can also see. While this model is sufficient as long as we trust all applications, it negates one of Flatpak’s security goals: [Increase the security of desktop systems by isolating applications from one another][5]. + +Therefore, when installing a Flatpak application that uses the Secret Service API, the user is asked to grant the necessary permissions to the application. In the example below, you can see that the application requires access to the Secret Service API (**org.freedesktop.secrets**). If the user doesn’t want to allow this application to access the service, their only option is to forfeit installation: + + +``` +$ flatpak install org.gnome.Epiphany +… +org.gnome.Epiphany permissions: +        ipc                     network         pulseaudio      wayland +        x11                     dri             file access [1] dbus access [2] +        system dbus access [3] + +        [1] xdg-download, xdg-run/dconf, ~/.config/dconf:ro +        [2] ca.desrt.dconf, org.freedesktop.Notifications, org.freedesktop.secrets +        [3] org.freedesktop.GeoClue2 +Proceed with these changes to the Default system installation? [Y/n]: +``` + +This is clearly an undesirable outcome. + +### The local storage approach + +The basic idea to tackle this problem is to store the secrets on the application side, rather than the host side (**gnome-keyring-daemon**). This practice is analogous to [the recent work on GSettings][6], where applications store the settings data in a local file instead of in a [**dconf**][7] service running on the host. + +When it comes to secrets, however, there is a bootstrapping problem: The application has to encrypt secrets when storing them in a local file, but it doesn’t know the encryption key yet. To provision the application with an encryption key, we rely on the [Flatpak portal][8] mechanism, which sits between the application and the host to let the two communicate through a restricted interface. + +We also added [a new portal][9] that allows applications to retrieve encryption keys. First, the application sends a request to the portal (the request contains a Unix file descriptor where the encryption key is written). Then, the portal delegates the request to the back-end implementation in **gnome-keyring-daemon**, which sends a unique encryption key for the sandboxed application through the file descriptor. + +With the received encryption key, the application encrypts the secrets and stores them in the application data directory (**~/.var/app/$APPID/data/keyrings**), which is **bind**-mounted and accessible from both the host and the sandbox. + +### The libsecret API + +The **libsecret** project provides two different sets of APIs. One is [the simple API][10], and the other is [the complete API][11]. The former provides simpler, stateless operations for retrieving and storing secrets, while the latter provides a more complete, object-oriented API that maps the D-Bus interface to the C API. + +Local storage is only supported in the simple API. If your applications are already using the simple API, then they will automatically use local storage when running under Flatpak. Otherwise, to enable local storage, the applications need to be ported to the simple API. See [the migration patch in Epiphany][12] as an example. + +Having a distinction between the two API sets also makes it possible for the applications to opt-out from using local storage. For example, if your application is a password manager that needs full access to user keyrings, you can bypass local storage by using the complete API. + +### The keyring format + +Although ideally, we should be able to use the same keyring format for both local storage and **gnome-keyring-daemon**, we realized that the keyring format used by **gnome-keyring-daemon** has limitations. Secrets, including associated attributes, are encrypted as a single chunk, meaning that they can consume an unnecessary amount of locked memory. Also, attributes are hashed without a key, meaning that it is possible to guess which secrets are stored in the file. + +Therefore, instead of implementing this format in two places, we decided to define a new version of the keyring file format, with the following characteristics: Secrets are encrypted individually and attribute hashes are now a [message authentication code (MAC)][13] over the attributes. + +This new format is based on [the][14] [GVariant serialization format][14], except for the header, and this change allows us to reuse most of the code for encoding, decoding, and lookup. + +### What's next for Flatpak secrets management + +The necessary patches are (currently) only available in the Git repositories of the relevant components (**xdg-desktop-portal**, **gnome-keyring**, and **libsecret**). They will be included in the next releases leading up to GNOME 3.36. + +If you are a developer, there is still room for improvement in this area. Here is where your help would be greatly appreciated: + + * **Session keyrings:** The Secret Service API supports "session" keyrings, which only last for the duration of the user session. The local storage backend doesn’t support this feature yet. This code could be implemented using the session keyring in the Linux kernel. + + * **Management and backup application:** Application secrets are now stored in multiple locations, and not just the host keyrings. It would be useful if there were a tool to manage application secrets and make backups. This process should be possible by enhancing GNOME’s Seahorse to look at application secrets. + + * **Online accounts portal:** These days, it is common for web applications to be integrated with web-based access delegation protocols such as OAuth 2.0. These protocols are supported by **gnome-online-accounts**, which in turn uses **gnome-keyring-daemon** for storing the tokens. A portal interface for online accounts would be useful for restricting access per application. + + * **Wider adoption of the new keyring format:** While the new format has several advantages, it is currently only used by **libsecret** on the application side. It would be beneficial if **gnome-keyring-daemon** on the host side also used the same format. + + * **Hardening the reinstall process:** By default, the application’s keyring file (**~/.var/app/$APPID/data/keyrings**) persists after uninstall, along with other data. This persistence is vulnerable in case the application ID is reused by an untrusted publisher. Currently, we recommend using the **\--delete-data** option to ensure that such application data is removed. This procedure could be improved if a publisher’s ID was associated with the application. + + + + +### Summary + +This article presented a mechanism to provision Flatpak applications with user secrets. This mechanism was designed based on the following principles: + + * Minimize the host interface. + * Let applications interact with the host through a Flatpak portal. + * Store the application data in a common data format. + + + +Although the mechanism is transparent, as long as you use **libsecret**, the mechanism is only enabled through **libsecret**’s simple API. For a smoother transition, we suggest migrating applications to this API. More information about the project’s background and the design rationale is available in the GUADEC presentation ([slides][15], [recording][16]). + +Fragmentation is a longstanding Achilles heel for the Linux desktop. In a world of myriad... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/secrets-management-flatpak-applications + +作者:[Daiki Ueno][a] +选题:[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/ueno +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/topsecret_folder_file_security.jpg?itok=y0P2GC5K (A top secret file.) +[2]: https://opensource.com/article/19/10/how-build-flatpak-packaging +[3]: https://blog.tingping.se/2019/10/06/hardening-flatpak-permissions.html +[4]: https://specifications.freedesktop.org/secret-service/ +[5]: http://docs.flatpak.org/en/latest/sandbox-permissions.html#sandbox-permissions +[6]: https://blogs.gnome.org/mclasen/2019/07/12/settings-in-a-sandbox-world/ +[7]: https://wiki.gnome.org/Projects/dconf +[8]: https://flatpak.github.io/xdg-desktop-portal/portal-docs.html +[9]: https://github.com/flatpak/xdg-desktop-portal/pull/359 +[10]: https://developer.gnome.org/libsecret/unstable/simple.html +[11]: https://developer.gnome.org/libsecret/unstable/complete.html +[12]: https://gitlab.gnome.org/GNOME/epiphany/commit/ed514f3ef43b323c51fb539274bef9dce0907ff2 +[13]: https://en.wikipedia.org/wiki/Message_authentication_code +[14]: https://people.gnome.org/~desrt/gvariant-serialisation.pdf +[15]: https://people.gnome.org/~dueno/libsecret-guadec.pdf +[16]: https://guadec.ubicast.tv/videos/desktop-secrets-management-for-the-future/ From d6fb2041b1eb1f5540bfb88c301b9943a62f3c0c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 01:12:03 +0800 Subject: [PATCH 440/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191111=20A=20gu?= =?UTF-8?q?ide=20to=20intermediate=20awk=20scripting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191111 A guide to intermediate awk scripting.md --- ...1 A guide to intermediate awk scripting.md | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sources/tech/20191111 A guide to intermediate awk scripting.md diff --git a/sources/tech/20191111 A guide to intermediate awk scripting.md b/sources/tech/20191111 A guide to intermediate awk scripting.md new file mode 100644 index 0000000000..7c1000736c --- /dev/null +++ b/sources/tech/20191111 A guide to intermediate awk scripting.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A guide to intermediate awk scripting) +[#]: via: (https://opensource.com/article/19/11/intermediate-awk-scripting) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +A guide to intermediate awk scripting +====== +Learn how to structure commands into executable scripts. +![Coding on a computer][1] + +This article explores awk's capabilities, which are easier to use now that you know how to structure your command into an executable script. + +### Logical operators and conditionals + +You can use the logical operators **and** (written **&&**) and **or** (written **||**) to add specificity to your conditionals. + +For example, to select and print only records with the string "purple" in the second column _and_ an amount less than five in the third column: + + +``` +`$2 == "purple" && $3 < 5 {print $1}` +``` + +If a record has "purple" in column two but a value greater than five in column three, then it is _not_ selected. Similarly, if a record matches column three's requirement but lacks "purple" in column two, it is also _not_ selected. + +### Next command + +Say you want to select every record in your file where the amount is greater than or equal to eight and print a matching record with two asterisks (******). You also want to flag every record with a value between five (inclusive) and eight with only one asterisk (*****). There are a few ways to do this, and one way is to use the **next** command to instruct awk that after it takes an action, it should stop scanning and proceed to the _next_ record. + +Here's an example: + + +``` +NR == 1 { +  print $0; +  next; +} + +$3 >= 8 { +  printf "%s\t%s\n", $0, "**"; +  next; +} + +$3 >= 5 { +  printf "%s\t%s\n", $0, "*"; +  next; +} + +$3 < 5 { +  print $0; +} +``` + +### BEGIN command + +The **BEGIN** command lets you print and set variables before awk starts scanning a text file. For instance, you can set the input and output field separators inside your awk script by defining them in a **BEGIN** statement. This example adapts the simple script from the previous article for a file with fields delimited by commas instead of whitespace: + + +``` +#!/usr/bin/awk -f +# +# Print each record EXCEPT +# IF the first record contains "raspberry", +# THEN replace "red" with "pi" + +BEGIN { +        FS=","; +} + +$1 == "raspberry" { +        gsub(/red/,"pi") +} +``` + +### END command + +The **END** command, like **BEGIN**, allows you to perform actions in awk after it completes its scan through the text file you are processing. If you want to print cumulative results of some value in all records, you can do that only after all records have been scanned and processed. + +The **BEGIN** and **END** commands run only once each. All rules between them run zero or more times on _each record_. In other words, most of your awk script is a loop that is executed at every new line of the text file you're processing, with the exception of the **BEGIN** and **END** rules, which run before and after the loop. + +Here is an example that wouldn't be possible without the **END** command. This script accepts values from the output of the **df** Unix command and increments two custom variables (**used** and **available**) with each new record. + + +``` +$1 != "tempfs" { +    used += $3; +    available += $4; +} + +END { +    printf "%d GiB used\n%d GiB available\n", used/2^20, available/2^20; +} +``` + +Save the script as **total.awk** and try it: + + +``` +`df -l | awk -f total.awk` +``` + +The **used** and **available** variables act like variables in many other programming languages. You create them arbitrarily and without declaring their type, and you add values to them at will. At the end of the loop, the script adds the records in the respective columns together and prints the totals. + +### Math + +As you can probably tell from all the logical operators and casual calculations so far, awk does math quite naturally. This arguably makes it a very useful calculator for your terminal. Instead of struggling to remember the rather unusual syntax of **bc**, you can just use awk along with its special **BEGIN** function to avoid the requirement of a file argument: + + +``` +$ awk 'BEGIN { print 2*21 }' +42 +$ awk 'BEGIN {print 8*log(4) }' +11.0904 +``` + +Admittedly, that's still a lot of typing for simple (and not so simple) math, but it wouldn't take much effort to write a frontend, which is an exercise for you to explore. + +* * * + +_This article is adapted from an episode of [Hacker Public Radio][2], a community technology podcast._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/intermediate-awk-scripting + +作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: http://hackerpublicradio.org/eps.php?id=2129 From 892e1a08191737651dd5bf32c6f3c3f28b73c2e6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 01:18:55 +0800 Subject: [PATCH 441/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191111=20The=20?= =?UTF-8?q?Top=20Nine=20Open=20Source=20Cloud=20Management=20Platforms?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191111 The Top Nine Open Source Cloud Management Platforms.md --- ... Open Source Cloud Management Platforms.md | 302 ++++++++++++++++++ 1 file changed, 302 insertions(+) create mode 100644 sources/talk/20191111 The Top Nine Open Source Cloud Management Platforms.md diff --git a/sources/talk/20191111 The Top Nine Open Source Cloud Management Platforms.md b/sources/talk/20191111 The Top Nine Open Source Cloud Management Platforms.md new file mode 100644 index 0000000000..7801a465d0 --- /dev/null +++ b/sources/talk/20191111 The Top Nine Open Source Cloud Management Platforms.md @@ -0,0 +1,302 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Top Nine Open Source Cloud Management Platforms) +[#]: via: (https://opensourceforu.com/2019/11/the-top-nine-open-source-cloud-management-platforms/) +[#]: author: (Dr Anand Nayyar https://opensourceforu.com/author/anand-nayyar/) + +The Top Nine Open Source Cloud Management Platforms +====== + +[![][1]][2] + +_A cloud management platform (CMP) is a comprehensive software suite with integrated tools that an enterprise can use to monitor and control cloud computing resources. There are many CMPs out there, both open source and proprietary. This article explores how cloud platforms work, their capabilities, as well as a selection of the top open source cloud platforms of the day._ + +In recent times, all the enterprises that have started or have adopted cloud computing face new challenges with regard to ensuring the same visibility in cloud applications as they have with their on-premise apps. With any cloud-based full implementation, the issues that users face include preserving the integrity, usability and security of all the data migrated online. According to John Webster, senior partner and analyst for the Evaluator Group, and whose research area is the hybrid cloud and Big Data, “As enterprise IT operations start to expand our capabilities and resources into the cloud, we now want to manage cloud resources with the same policy, procedure, guidance and expectations that we have over our existing IT environment.” + +The only solution to all the issues arising from cloud-based implementations is a cloud management platform (CMP). This provides a rich set of capabilities for discovery, template-based provisioning, orchestration and automation. It also enables operational monitoring and management, governance and cost optimisation across multiple public and private clouds as well as virtual and bare-metal servers. + +A CMP is a comprehensive suite with integrated software tools that an enterprise can use to monitor and control cloud computing resources. An enterprise can use a CMP for either a private or public cloud, but CMPs facilitate toolsets for hybrid and multi-cloud models to centralise the control of various cloud-based infrastructures. + +A wide range of tools is available to deal with these challenges and help companies efficiently operate applications and services in the cloud. Vendors offer a variety of cloud management tools that enable IT organisations to build, purchase, manage, monitor, track and optimise their cloud resources. With the help of these tools, organisations can save time and effort while allowing IT staff to focus on more strategic goals. These tools also help in monitoring users’ interactions with the cloud infrastructure and in managing resource allocation. + +In the cloud marketplace, different tools have unique feature sets. Capabilities include unified management across multiple clouds, integration with third-party tools for configuration and monitoring purposes, dashboards and reports for detailed information about resource consumption, notifications and alerts when predefined thresholds are reached, and controlled access to resources to avoid over usage or unauthorised access. By simplifying the management of cloud environments and reducing the complexity and cost of managing multiple activities, the right cloud management tool can bring speed, flexibility, security and cost efficiency to any organisation. + +![Figure 1: Cloudstack architecture][3] + +So the important question is, “Which CMP is the best?” Well, there are both commercial and open source options. Nowadays, open source technology has become a central facet of cloud computing for many users around the world. In this article, we discuss the top open source cloud management platforms to assist admins, systems analysts, network security as well as cloud computing professionals select the best platform, based on the requirements of the enterprise. + +Before we dive into the types of open source CMPs, let’s discuss some of their broad capabilities and how they work. + +According to analysis by Market Research Future (MRF), the global CMP market was valued at US$ 8.18 billion in 2018 and is expected to reach US$ 26.77 billion by 2022, registering a CAGR of 18.4 per cent during the forecast period. The market growth is attributed to the rising need for enterprises to have greater control over IT spending, the surge in the adoption of heterogeneous and multi-modal IT service delivery environments, the rapid deployment of virtualised workloads, and improved operational efficiency. On the other hand, insufficient technical expertise and the rising security concerns for platforms developed in-house are some of the factors expected to hinder the market growth during the assessment period. + +**How cloud management platforms work** +A CMP is deployed into existing cloud environments as a virtual machine (VM) consisting of a database and server. The server communicates with application programming interfaces (APIs) to connect the database and virtual resources held in the cloud. The database collects the information on how the virtual infrastructure is performing and sends an analysis to the Web interface, where systems administrators can analyse the cloud performance. The whole interconnectivity relies on the operating system, which commands all the different technologies that make up clouds and also deploys cloud management tools. + +A CMP should be capable of the following things. + + * **Strong integration with IT infrastructure:** CMPs should be customised as per the enterprise’s needs, and must meet the requirements of the operating systems, apps, storage frameworks and anything else running in the cloud. + * **Automating manual tasks:** CMPs should have self-service capabilities to automate everything, with no human involvement. + * **Cost management:** CMPs should assist organisations with precision cost forecasting and reporting to easily use and manage all sorts of cloud services. + * **Service management:** They should assist the IT team to monitor cloud-based services to help in capacity planning, workload deployment, asset management and incident management. + * **Governance and security:** CMPs should enable administrators to enforce policy-based control of cloud resources, and offer security features like encryption as well as identity and access management. + + + +**Top open source CMPs** +The following are the top open source cloud management platform providers. + +**Apache CloudStack** +Apache CloudStack is an open source, multi-hypervisor, multi-tenant, high-availability Infrastructure-as-a-Service CMP, which facilitates creating, deploying and managing cloud services by providing a complete stack of features and components for cloud environments. It uses existing hypervisors such as KVM, VMware vSphere, VMware ESXi, VMware vCenter and XenServer/XCP for virtualisation. CloudStack can also orchestrate the non-technical elements of service delivery such as billing and metering. It presents a range of APIs, allowing it to be integrated with any other platform. + +The main components of CloudStack are: + + 1. Compute nodes (CNs), which are servers when VM instances are instantiated. + 2. A cluster, which is composed of several CNs that share the same hypervisor and primary storage system. + 3. Pod is a rack of hardware including Layer-2 switches and one or more clusters. It is responsible for storing the VM files, which represent the primary storage. + 4. The Availability Zone is made up of one or more pods, with secondary storage forming a zone. This is equivalent to a single data centre, representing geographic allocations. The secondary storage stores VM templates, ISO images and disk volume snapshots. + 5. The management server is a single point of configuration that provides Web user interfaces and APIs, and manages the assignment of VM instances to particular hosts and of public and private IP addresses to particular accounts, as well as the allocation of storage. + + + +_**Features**_ + + * _Self-service user interface:_ AJAX console access, multi-role support, network virtualisation, hypervisor agnostic, usage metering, virtual routers. + * _LVM support:_ Block storage volumes, NetScaler support, OpenStack Swift integration, LDAP integration, domains and delegated administration. + + + +_**Official website:**_ __ +_**Latest version:**_ 4.12.0.0 + +![Figure 2: Openstack components][4] + +**OpenStack** +OpenStack consists of a set of software tools for building and managing cloud computing platforms for public and private clouds using pooled virtual resources. The tools comprising the OpenStack platform are called projects. They handle core cloud computing services of compute, networking, storage, identity and image services. OpenStack software controls large pools of compute, storage and networking resources throughout a data centre, and is managed through a dashboard or via the OpenStack API. + +OpenStack consists of the following nine components. + + * **Nova:** This is the primary computing engine used for deploying and managing a large number of virtual machines and instances to handle computing tasks. + * **Swift:** This is a storage system for objects and files. + * **Cinder:** This is a persistent block storage component for compute instances. + * **Neutron:** This provides networking capability so that all components can communicate quickly. + * **Horizon:** This is a GUI interface for OpenStack. + * **Keystone:** This provides identity services for OpenStack. + * **Glance:** This provides image services and allows images (virtual copies of hard disks) to be used as templates for deploying new virtual machine instances. + * **Ceilometer:** This provides telemetry services, and billing services to individuals. + * **Heat:** This is an orchestration component that allows developers to store the requirements of cloud applications in files. + + + +_**Features**_ + + * _Services:_ Messaging, clustering, containers, compute, identity, app data protection as a service, events, metadata indexing as service, workflows, DNS, database as a service, bare metal provisioning, optimisation and deployment, governance, and benchmarking. + * Web front-end, Big Data processing framework, container orchestration engine, key management, and NFV orchestration. + + + +_**Official website:** _ +**Latest version:** Stein + +**ManageIQ** +This is an open source CMP for hybrid IT environments, with a mix of public and private clouds. It provides tools for managing small and large environments as well as supports multiple technologies like virtual machines, public clouds and containers. It allows users to download any virtual appliance and deploy copies of it into virtualisation platforms like OpenStack or VMware. Three main variants of ManageIQ are available: Vagrant, Docker and Public Cloud. + +ManageIQ is written in Ruby and uses the Ruby on Rails framework. The ManageIQ software is shipped as a pre-built virtual appliance, roughly 1GB in size. The appliance is based on the CentOS operating system and includes an embedded PostgreSQL database. Since the Darga release, a container based version has also been made available. An appliance can be used on its own, or it can be part of a three-tier federated architecture. In the latter case, the operator configures zones, regions and a single super-region. Appliances can be assigned to a specific zone or region and are configured with specific roles so that work is coordinated within the region. Most roles are multi-master and distribute work automatically in a queue, but some roles like the database are singletons. + +**Features** + + * Offers insights through discovery, monitoring, utilisation, performance, reporting, analytics, chargeback and trending. + * Controls security, compliance, alerting, policy-based resource and configuration management. + * Automates IT processes, tasks and events, provisioning, workload management and orchestration. + * Integrates systems management, tools and processes, event consoles, CMDB, RBA and Web services. + + + +_**Official website:** _ +**Latest version:** Hammer-10 + +**Cloudify** +Cloudify is an open source software cloud and NFV orchestration product that uses OASIS TOSCA technology. It is designed using Python. Cloudify allows users to model and automate an application’s entire life cycle. This includes deployment to a cloud or data centre environment, the management of the deployed application, failure detection and ongoing maintenance. The platform is ideal for users who want to launch prebuilt applications in the cloud without handling the technical aspects. + +_**How it works:**_ It translates applications into a blueprint configuration written in the YAML format and describes how the application should be deployed, managed and automated. It identifies the resources and events for every application tier. The cloud orchestrator uses blueprints to install applications in the cloud using a cloud API, which creates VMs and installs Cloudify agents, and is used to orchestrate, install and start the application. Cloudify monitors the application for any pre-defined metrics and displays results on the dashboard. + +Cloudify enables users to deploy applications using two main methods — by using the CLI and by using a Cloudify manager. The latter is a dedicated environment comprising an open source stack which enables the user to: + + * Use plugins (such as Docker, Script, Chef and Puppet plugins) to manage application hosts. + * Keep a directory of the user’s blueprints. + * Create multiple deployments for each blueprint and install them. + * Execute healing, scaling and other custom workflows on installed applications. + * Run multiple workflows concurrently. + * View an application’s topology. + * Perform different tasks using the Cloudify Web UI view metrics. + + + +Cloudify performs the following tasks. + + * _Application modelling:_ This describes the application with all its resources. + * _Orchestration:_ This maintains and runs an application, and performs ongoing operations such as scaling, healing and maintenance. + * _Pluggability:_ This provides reusable component abstraction for the system. + * _Security:_ This provides secure communication via SSL, which enables clients to ensure that the data set received is encrypted. + + + +_**Features**_ +Easy orchestration, built-in node types, a blueprints catalogue, role-based access control, IT security and governance, network and TOSCA orchestration, new NFV capabilities, custom widgets and LDAP integration. + +_**Official website:**_ +_**Latest version:**_ 5.0 + +**Mist.io** +Mist.io is a platform that simplifies cloud management and helps users prevent vendor and complexity lock-in. It offers cost and usage reporting, RBAC, management, provisioning, orchestration, monitoring and automation for servers across public and private clouds, Docker containers and KVM hypervisors. It gives actionable alerts so users can address operational issues from anywhere, using any Web-connected device. + +Mist.io offers a unified interface for performing common management tasks like provisioning, orchestration, monitoring and automation. It works from any device, including laptops, tablets and phones, to help users take action from where ever they are. Due to the RESTful API and command line tools, it’s easy to integrate it in the user’s existing workflow. Because Mist.io abstracts the infrastructure level, users can replicate the entire setup across providers in a matter of seconds. It’s a freemium service with an open source component that aims to become the de facto standard for multi-cloud management and a broker of cloud computing services. It’s targeted at developers, systems administrators and any organisation that performs on-premise, remote, or hybrid computing. + +_**Features**_ + + * Controls public and private clouds, containers, bare metal servers and more. + * Has fine grained controls for delegating access to team members. + * Enables cost and usage reporting across the whole infrastructure. + * Orchestrates repeatable deployments, and automates common responses. + * Enforces policies consistently, across any computing platform. + + + +_**Official website:** _ + +**VirtEngine** +VirtEngine is an open source CMP that can be used to build private or public clouds, which support IaaS, PaaS and SaaS. This Platform as a Service system allows customers to deploy applications in a few clicks. VirtEngine has a wide range of applications and a simple user interface for customers to self-serve their needs. It helps users build both public and private clouds within very little time, and supports infrastructure platforms and other storage devices. It is also very scalable and comes with automation tools that provide companies a competitive advantage. VirtEngine by DET.io is available as two different solutions for the public and private cloud. The public cloud allows users to build their own cloud and offer servers to customers. It is available as a mini edition as well as a complete solution. The private cloud is available as an open source and free solution as well as a powerful solution for enterprises that supports HA and other enterprise features. + +_**Features**_ + + * Access control, demand and supply monitoring, cost management, multi-cloud management, one-click apps, and automatic launch. + * DNS support, self-healing, cloud-native, multi-locations, Docker containers, cloud virtual machines and migration tools. + + + +_**Official website:**_ __ + +![Figure 3: OpenNebula components][5] + +**openQRM** +openQRM is a free and open source cloud computing management platform for managing heterogeneous data centre infrastructures. It provides a complete, automated workflow engine for all bare metal and VM deployment, as well as for all IT sub-systems, enabling professional management and monitoring of the data centre and cloud capacities. The openQRM platform manages a data centre’s infrastructure to build private, public and hybrid Infrastructure as a Service clouds. openQRM orchestrates storage, networks, virtualisation, monitoring and security implementation technologies to deploy multi-tier services as virtual machines on distributed infrastructures, combining both data centre resources and remote cloud resources, according to allocation policies. + +openQRM provides a Web-based, open source data centre management and cloud platform with the help of which various internal and external technologies can be abstracted and grouped within a common management tool. This management system also takes care of provisioning, high availability and the monitoring of services offered. Instead of providing individual tools for individual tasks, such as configuration management and system monitoring, openQRM integrates proven open source management tools such as Nagios and Zabbix. + +_**Architecture:**_ The openQRM system architecture comprises three components — data centre management and cloud platform, the plugin API, and the hybrid cloud connector. + +The data centre management and cloud platform provides the basic functionality of openQRM, and uses the plugin API to communicate with the data centre’s resources that are also installed on the local network (hypervisor, storage and network). openQRM comes with support for five virtualisation environments — VMware ESX, Citrix XenServer, KVM, LXC and OpenVZ. + +openQRM can handle LVM, iSCSI, NFS, ATA over Ethernet, SAN Boot and Tmpfs storage. For the network configuration, openQRM integrates critical network services such as DNS, DHCP, TFTP and Wake-on-LAN. The network manager included with the package helps administrators configure the network bridges required for these services. The hybrid cloud connector takes care of connecting with external data centre resources, such as Amazon Web Services, Eucalyptus, or OpenStack cloud. +The openQRM cloud portal provides a Web interface that internal or external users can access to compile IT resources, as needed. + +_**Features**_ + + * Supports P2V, P2P, V2P, V2V migrations and high availability. + * Integrates with all major open and commercial storage technologies. + * Integrated billing system that maps CCU/h (cloud computing units) to real currency. + * Self-service portal for end users provisions new servers and application stacks in minutes! + + + +_**Official website:** _ + +**OpenNebula** +OpenNebula is a simple yet powerful and flexible turnkey open source solution to build private clouds and manage data centre virtualisation. The OpenNebula platform manages a data centre’s virtual infrastructure to build private, public and hybrid implementations of Infrastructure as a Service. The two primary uses of the OpenNebula platform are data centre virtualisation solutions and cloud infrastructure solutions. + +OpenNebula was designed to help companies build simple, cost-effective, reliable, open enterprise clouds on existing IT infrastructure. It provides flexible tools that orchestrate storage, network and virtualisation technologies to enable the dynamic placement of services. The design of OpenNebula is flexible and modular, to allow integration with different storage and network infrastructure and hypervisor technologies. + +OpenNebula components include the following three layers: + +1\. The driver layer is responsible for the creation, start-up and shutdown of virtual machines (VMs), for allocating storage to VMs, and for monitoring the operational status of physical machines (PMs). +2\. The core layer manages the VMs’ full life cycle, including setting up virtual networks dynamically, dynamic IP address allocation for VMs and managing VMs’ storage. +3\. The tool layer provides interfaces, such as the command line interface (CLI), to communicate with users. + +_**Features**_ + + * Supports numerous APIs like AWS EC2, EBS and OGF OCCI. + * Powerful UNIX based CLI for administration. + * GUI for cloud customers and data centre professionals. + * Resource allocation via fine-grained ACLs; load balancing, high availability, high performance computing. + * Powerful scheduling for task management. + * Supports integration with LDAP and Active directory. + * Supports SSH and X.509 for security, and even supports login token functionality. + + + +_**Official website:** _ +_**Latest version:**_ 5.8.4 + +**Eucalyptus** +Eucalyptus is an acronym for Elastic Utility Computing Architecture for Linking Your Programs to Useful Systems. It is an open source software framework that provides the platform for private cloud computing implementation on computer clusters. Eucalyptus implements Infrastructure as a Service (IaaS) methodology for solutions in private and hybrid clouds. + +Eucalyptus provides a platform for a single interface so that users can calculate the resources available in private clouds and the resources available externally in public cloud services. It is designed with extensible and modular architecture for Web services. It also implements the industry standard Amazon Web Services (AWS) API. + +![Figure 4: Eucalyptus architecture][6] + +The Eucalyptus user console provides an interface for users to provision and configure compute, network and storage resources on their own. Eucalyptus can run multiple versions of Windows and Linux virtual machine images. Users can build a library of Eucalyptus machine images (EMIs) with application metadata that is decoupled from infrastructure details to allow them to run on Eucalyptus clouds. + +Amazon Machine Images are also compatible with Eucalyptus clouds. VMware images and vApps can be converted to run on Eucalyptus clouds and AWS public clouds. Eucalyptus user identity management can be integrated with existing Microsoft Active Directory or LDAP systems to have fine-grained role-based access control over cloud resources. Eucalyptus supports storage area network devices to take advantage of storage arrays, thus improving performance and reliability. Eucalyptus machine images can be backed by EBS-like persistent storage volumes, improving the performance of image launch time and enabling fully persistent virtual machine instances. Eucalyptus also supports direct-attached storage. + +_**Architecture:**_ The Eucalyptus architecture has the following five main components. + + * **Cloud controller (CLC):** CLC acts as the administrative interface for cloud management and performs high-level resource scheduling and system accounting. The CLC accepts user API requests from command-line interfaces like euca2ools or GUI-based tools like the Eucalyptus management console, and manages the underlying computer storage and network resources. + * **Scalable object storage (SOS):** This is a pluggable service that allows infrastructure administrators the flexibility to implement scale-out storage on top of commodity resources using open source and commercial solutions that implement the S3 interface. + * **Cluster controller (CC):** Written in C, this acts as the front-end for clusters within the Eucalyptus cloud and communicates with the storage and node controllers. + * **Storage controller (SC):** Written in Java, this communicates with the cluster controller and the node controller, managing Eucalyptus block volumes and snapshots to instances within its specific cluster. It interfaces with storage systems including Local, NFS, iSCSI and SAN. + * **Node controller (NC):** This is written in C, hosts the virtual machine instances and manages the virtual network endpoints. It caches images from scalable object storage, and creates and caches instances. + + + +_**Features**_ + + * Works with multiple hypervisors including VMware, Xen and KVM. + * Communication within internal processes is secured through SOAP and WS-Security. + * Offers administrative features such as user and group management, and reports. + * Well-defined interfaces (via WSDL, since they are Web services) and thus can be easily swapped out for custom components. + * Flexible and can be installed on a very minimal setup. + + + +_**Official website:** _ +_**Latest version:**_ 4.4.3 + +![Avatar][7] + +[Dr Anand Nayyar][8] + +The author works in a Graduate School, Duy Tan University in +Vietnam. He loves to work and research on open source technologies, +sensor communications, network security, Internet of Things etc. He +can be reached at [anandnayyar@duytan.edu.vn][9]. YouTube channel: +Gyaan with Anand Nayyar at [www.youtube.com/anandnayyar][10]. + +[![][11]][12] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/the-top-nine-open-source-cloud-management-platforms/ + +作者:[Dr Anand Nayyar][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/anand-nayyar/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Young-man-with-the-head-in-the-clouds-thinking_15259762_xl.jpg?resize=505%2C487&ssl=1 (Young-man-with-the-head-in-the-clouds-thinking_15259762_xl) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Young-man-with-the-head-in-the-clouds-thinking_15259762_xl.jpg?fit=505%2C487&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-CloudStack-architecture.jpg?resize=350%2C250&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-OpenStack-components.jpg?resize=350%2C226&ssl=1 +[5]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-OpenNebula-components.jpg?resize=350%2C196&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-Eucalyptus-architecture.jpg?resize=350%2C241&ssl=1 +[7]: https://secure.gravatar.com/avatar/ab87a2bd63788f386c2d815c0f7d2d29?s=100&r=g +[8]: https://opensourceforu.com/author/anand-nayyar/ +[9]: mailto:anandnayyar@duytan.edu.vn +[10]: http://www.youtube.com/anandnayyar +[11]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[12]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 1391891b32a59954f4bf9685f0bf8abe879fec74 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 13 Nov 2019 01:37:34 +0800 Subject: [PATCH 442/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191111=20Best?= =?UTF-8?q?=20Tools/Latest=20Tools=20to=20Use=20in=20Programming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191111 Best Tools-Latest Tools to Use in Programming.md --- ...ools-Latest Tools to Use in Programming.md | 85 +++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 sources/talk/20191111 Best Tools-Latest Tools to Use in Programming.md diff --git a/sources/talk/20191111 Best Tools-Latest Tools to Use in Programming.md b/sources/talk/20191111 Best Tools-Latest Tools to Use in Programming.md new file mode 100644 index 0000000000..0e62c22619 --- /dev/null +++ b/sources/talk/20191111 Best Tools-Latest Tools to Use in Programming.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Best Tools/Latest Tools to Use in Programming) +[#]: via: (https://opensourceforu.com/2019/11/best-tools-latest-tools-to-use-in-programming/) +[#]: author: (Daniil Balabushkin https://opensourceforu.com/author/daniil-balabushkin/) + +Best Tools/Latest Tools to Use in Programming +====== + +[![computer programming][1]][2] + +_[Programming languages][3] can be termed as the process in which a person called a programmer writes computer programs. It can also be defined as a set of instructions to facilitate specific actions. A computer understands this language and translates it into a form that can be read or understood by the human eye. It is divided into generations that are from the first generation to the fifth-generation programming languages._ + +There are four types of programming languages: + + * Python + * C + * C++ + * Java + + + +Programming has helped a-lot in the development of new and diverse computational languages. + +**Computer Programming Uses in the Society and the World at Large** + +And these uses include: + + * Computer programming helps in developing programming languages that are used for transforming computing problems into instructions. This allows programmers to build source codes much quicker. + * Programming languages have supported the development of the internet, which has brought people closer and made the world one. + * Programming is one of the main stages of the software development process. Software development involves several steps, including programming, testing, bug fixing documenting, etc. A programmer has to know all the stages and also a specialized knowledge about one particular field. + * Programming helps students to understand how to solve computing problems. As you develop more and more programs, your confidence level rises and boosts your educational exposure on programming. + * As innovations come up, programmers are forced to cope up with these new technologies. Because technology is being used all over the world, clients need and want more natural ways to use technology. Programmers have been tasked with developing new ways of building software that can be used in the technology market to make it easier for these innovations to be used by people. + + + +The rise of a more technological world has immensely influenced programming through the following ways: + +**Internet** +The internet has been built on programming languages that the computer understands and in turn, creates a worldwide link through an informal network, e.g., Google, Wikipedia, and [_paper writing service_][4] companies. As the world and technology rise, it leads to the consumer wanting more straightforward means to get information and also a fast means of networking hence better services are leading to the high demand for assistance from the programmers. + +**Employment** +Due to a rise in technology, programmers are on high demand for their services, and this leads to the need for well-trained and learned programming technicians due to the high demand for programs and applications by the consumer. This, in turn, builds and uplifts the programming sector. + +**Socialization** +In the past, people only made calls and sent messages. These were older ways of programming to convey information. But due to a rise in the technological industry, people have come up with ideas like WhatsApp, Twitter, and Facebook. These applications need programmers for them to fix, create, and debug the programs, and this leads to better and new communication services from the specified uses. Due to the rise in technology and social needs, programmers have achieved better employment opportunities and made programming an essential requirement in the technological world. + +**Transport industry** +By this, I mean cars of the future, trains of the future, and even airlines of the future. Companies like Tesla have taken programming to the next level. From vehicles that speak to you to cars that can drive by themselves, to name but a few. For that to be achieved, you need a programmer to create a primary interface and language that will link the car to the software and in turn, give feedback to the system. Without programmers, this would not be possible. The rise in the transport industry has been influenced tremendously by programming and technological advancements. + +**Author’s Note** +_[Programming][5] and the rise in technology go hand in hand. The more technology grows, the more the need to have programmers in the market._ +_Every discovery in the technology industry needs an application or program, thus leading to the boom in the programming and coding sector._ + +![Avatar][6] + +[Daniil Balabushkin][7] + +[![][8]][9] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/best-tools-latest-tools-to-use-in-programming/ + +作者:[Daniil Balabushkin][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/daniil-balabushkin/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/06/computer-programming.jpg?resize=696%2C441&ssl=1 (computer programming) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/06/computer-programming.jpg?fit=700%2C444&ssl=1 +[3]: https://www.softwaretestinghelp.com/software-development-tools/ +[4]: https://expert-writers.net/ +[5]: https://www.computerscience.org/resources/computer-programming-languages/ +[6]: https://secure.gravatar.com/avatar/5f72f6534155d49b49e0f0b9eab2e7be?s=100&r=g +[7]: https://opensourceforu.com/author/daniil-balabushkin/ +[8]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[9]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 87e06ef099f0a0f6631741fd2ace384f4fbd94b3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 13 Nov 2019 08:52:52 +0800 Subject: [PATCH 443/800] translating --- ...How to add a user to your Linux desktop.md | 87 ------------------- ...How to add a user to your Linux desktop.md | 86 ++++++++++++++++++ 2 files changed, 86 insertions(+), 87 deletions(-) delete mode 100644 sources/tech/20191107 How to add a user to your Linux desktop.md create mode 100644 translated/tech/20191107 How to add a user to your Linux desktop.md diff --git a/sources/tech/20191107 How to add a user to your Linux desktop.md b/sources/tech/20191107 How to add a user to your Linux desktop.md deleted file mode 100644 index 7e57efc9d3..0000000000 --- a/sources/tech/20191107 How to add a user to your Linux desktop.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to add a user to your Linux desktop) -[#]: via: (https://opensource.com/article/19/11/add-user-gui-linux) -[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) - -How to add a user to your Linux desktop -====== -It's easy to manage users from a graphical interface, whether during -installation or on the desktop. -![Team of people around the world][1] - -Adding a user is one of the first things you do on a new computer system. And you often have to manage users throughout the computer's lifespan. - -My article on the [**useradd** command][2] provides a deeper understanding of user management on Linux. Useradd is a command-line tool, but you can also manage users graphically on Linux. That's the topic of this article. - -### Add a user during Linux installation - -Most Linux distributions provide a step for creating a user during installation. For example, the Fedora 30 installer, Anaconda, creates the standard _root_ user and one other local user account. When you reach the **Configuration** screen during installation, click **User Creation** under **User Settings**. - -![Fedora Anaconda Installer - Add a user][3] - -On the Create User screen, enter the user's details: **Full name**, **User name**, and **Password**. You can also choose whether to make the user an administrator. - -![Create a user during installation][4] - -The **Advanced** button opens the **Advanced User Configuration** screen. Here, you can specify the path to the home directory and the user and group IDs if you need something besides the default. You can also type a list of secondary groups that the user will be placed into. - -![Advanced user configuration][5] - -### Add a user on the Linux desktop - -#### GNOME - -Many Linux distributions use the GNOME desktop. The following screenshots are from Red Hat Enterprise Linux 8.0, but the process is similar in other distros like Fedora, Ubuntu, or Debian. - -Start by opening **Settings**. Then go to **Details**, select **Users**, click **Unlock**, and enter your password (unless you are already logged in as root). This will replace the **Unlock** button with an **Add User** button. - -![GNOME user settings][6] - -Now, you can add a user by clicking **Add User**,** **then selecting the account **Type** and the details **Name** and **Password**). - -In the screenshot below, a user name has been entered, and settings are left as default. I did not have to enter the **Username**; it was created automatically as I typed in the **Full Name** field. You can still modify it though if the autocompletion is not to your liking. - -![GNOME settings - add user][7] - -This creates a standard account for a user named Sonny. Sonny will need to provide a password the first time he or she logs in. - -Next, the users will be displayed. Each user can be selected and customized or removed from this screen. For instance, you might want to choose an avatar image or set the default language. - -![GNOME new user][8] - -#### KDE - -KDE is another popular Linux desktop environment. Below is a screenshot of KDE Plasma on Fedora 30. You can see that adding a user in KDE is quite similar to doing it in GNOME. - -![KDE settings - add user][9] - -### Conclusion - -Other desktop environments and window managers in addition to GNOME and KDE include graphical user management tools. Adding a user graphically in Linux is quick and simple, whether you do it at installation or afterward. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/add-user-gui-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/team_global_people_gis_location.png?itok=Rl2IKo12 (Team of people around the world) -[2]: https://opensource.com/article/19/10/linux-useradd-command -[3]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda2.png (Fedora Anaconda Installer - Add a user) -[4]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda3.png (Create a user during installation) -[5]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda4.png (Advanced user configuration) -[6]: https://opensource.com/sites/default/files/uploads/gnome_settings_user_unlock.png (GNOME user settings) -[7]: https://opensource.com/sites/default/files/uploads/gnome_settings_adding_user.png (GNOME settings - add user) -[8]: https://opensource.com/sites/default/files/uploads/gnome_settings_user_new.png (GNOME new user) -[9]: https://opensource.com/sites/default/files/uploads/kde_settings_adding_user.png (KDE settings - add user) diff --git a/translated/tech/20191107 How to add a user to your Linux desktop.md b/translated/tech/20191107 How to add a user to your Linux desktop.md new file mode 100644 index 0000000000..743ca8245e --- /dev/null +++ b/translated/tech/20191107 How to add a user to your Linux desktop.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to add a user to your Linux desktop) +[#]: via: (https://opensource.com/article/19/11/add-user-gui-linux) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +如何在 Linux 桌面添加用户 +====== +无论是在安装中还是在桌面中,通过图形界面管理用户都非常容易。 +![Team of people around the world][1] + +添加用户是你在一个新系统上要做的第一件事。而且,你通常需要在计算机的整个生命周期中管理用户。 + +我的关于 [**useradd** 命令][2]文章提供了更深入的对 Linux 的用户管理的了解。useradd 是一个命令行工具,但是你也可以在 Linux 上以图形方式管理用户。这就是本文的主题。 + +### 在 Linux 安装过程中添加用户 + +大多数 Linux 发行版都提供了在安装过程中创建用户的步骤。例如,Fedora 30 安装程序 Anaconda 创建标准的 _root_ 用户和另一个本地用户帐户。在安装过程中进入“配置”页面时,单击“用户设置”下的“用户创建”。 + +![Fedora Anaconda Installer - Add a user][3] + +在用户创建页面上,输入用户的详细信息:**全名**、**用户名**和**密码**。你还可以选择是否使用户成为管理员。 + +![Create a user during installation][4] + +点击**高级**按钮打开**高级用户配置**页面。如果需要除默认设置以外的其他设置,那么可以在此处指定主目录的路径以及用户和组 ID。你也可以输入用户所属的其他组。 + +![Advanced user configuration][5] + +### 在 Linux 桌面上添加用户 + +#### GNOME + +许多 Linux 发行版都使用 GNOME 桌面。以下截图来自 Red Hat Enterprise Linux 8.0,但是在其他发行版(如 Fedora、Ubuntu 或 Debian)中,该过程相似。 + +首先打开“设置”。然后打开**详细**,选择**用户**,单击**解锁**,然后输入密码(除非你已经以 root 用户登录)。这样将用“添加用户”按钮代替“解锁”按钮。 + +![GNOME user settings][6] + +现在,你可以通过单击**添加用户**,然后选择帐户**类型**然后输入**用户名**和**密码**来添加用户。 + +在下面的截图中,已经输入了用户名,设置保留为默认设置。我不必输入**用户名**,因为它是在我在“全名”字段中输入时自动创建的。如果你不喜欢自动补全,你仍然可以对其进行修改。 + +![GNOME settings - add user][7] + +这将为名为 Sonny 的用户创建一个标准帐户。Sonny 首次登录时需要提供密码。 + +接下来,将显示用户。在此页面可以选择每个用户进行自定义或者删除。例如,你可能想选择一个头像或设置默认语言。 + +![GNOME new user][8] + +#### KDE + +KDE 是另一个流行的 Linux 桌面环境。下面是 Fedora 30 上 KDE Plasma 的截图。你可以看到,在 KDE 中添加用户与在 GNOME 中添加用户非常相似。 + +![KDE settings - add user][9] + +### 总结 + +除 GNOME 和 KDE 外,其他桌面环境和窗口管理器也有图形用户管理工具。无论是在安装时还是安装后,在 Linux 中以图形方式添加用户都是快速简便的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/add-user-gui-linux + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_global_people_gis_location.png?itok=Rl2IKo12 (Team of people around the world) +[2]: https://opensource.com/article/19/10/linux-useradd-command +[3]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda2.png (Fedora Anaconda Installer - Add a user) +[4]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda3.png (Create a user during installation) +[5]: https://opensource.com/sites/default/files/uploads/screenshot_fedora30_anaconda4.png (Advanced user configuration) +[6]: https://opensource.com/sites/default/files/uploads/gnome_settings_user_unlock.png (GNOME user settings) +[7]: https://opensource.com/sites/default/files/uploads/gnome_settings_adding_user.png (GNOME settings - add user) +[8]: https://opensource.com/sites/default/files/uploads/gnome_settings_user_new.png (GNOME new user) +[9]: https://opensource.com/sites/default/files/uploads/kde_settings_adding_user.png (KDE settings - add user) From fc885d40e0fc9b15b873c45a7ee7e6978611f079 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 13 Nov 2019 08:58:34 +0800 Subject: [PATCH 444/800] translating --- ... 7 Best Open Source Tools that will help in AI Technology.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md b/sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md index de3744b9a0..10d04bdae4 100644 --- a/sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md +++ b/sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7d15d74d0140af52cc9d23512622e413cb99dca1 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Nov 2019 11:22:08 +0800 Subject: [PATCH 445/800] Rename sources/talk/20191111 The Top Nine Open Source Cloud Management Platforms.md to sources/tech/20191111 The Top Nine Open Source Cloud Management Platforms.md --- ...0191111 The Top Nine Open Source Cloud Management Platforms.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => tech}/20191111 The Top Nine Open Source Cloud Management Platforms.md (100%) diff --git a/sources/talk/20191111 The Top Nine Open Source Cloud Management Platforms.md b/sources/tech/20191111 The Top Nine Open Source Cloud Management Platforms.md similarity index 100% rename from sources/talk/20191111 The Top Nine Open Source Cloud Management Platforms.md rename to sources/tech/20191111 The Top Nine Open Source Cloud Management Platforms.md From 381e86c92e5d6554e0792e205a7af0078f056819 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 13 Nov 2019 18:20:33 +0800 Subject: [PATCH 446/800] Rename sources/tech/20191112 What open communities teach us about empowering customers.md to sources/talk/20191112 What open communities teach us about empowering customers.md --- ...2 What open communities teach us about empowering customers.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191112 What open communities teach us about empowering customers.md (100%) diff --git a/sources/tech/20191112 What open communities teach us about empowering customers.md b/sources/talk/20191112 What open communities teach us about empowering customers.md similarity index 100% rename from sources/tech/20191112 What open communities teach us about empowering customers.md rename to sources/talk/20191112 What open communities teach us about empowering customers.md From 3253165308dc7824b77b070de4a36dd2fafd240a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 Nov 2019 22:19:12 +0800 Subject: [PATCH 447/800] PRF --- ...Automate tasks in Linux using Cron Jobs.md | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md index a11cc0ea4c..59a3803198 100644 --- a/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md +++ b/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Schedule and Automate tasks in Linux using Cron Jobs) @@ -10,17 +10,17 @@ 如何使用 cron 任务在 Linux 中计划和自动化任务 ====== -有时,你可能需要定期执行任务或以预定的时间间隔执行任务。这些任务包括备份数据库、更新系统、执行定期重新引导等。这些任务称为 “cron 任务”。cron 任务用于“自动执行的任务”,它有助于简化重复的、有时是乏味的任务的执行。cron 是一个守护进程,可让你调度这些任务,然后按指定的时间间隔执行这些任务。在本教程中,你将学习如何使用 cron 来调度任务。 +有时,你可能需要定期或以预定的时间间隔执行任务。这些任务包括备份数据库、更新系统、执行定期重新引导等。这些任务称为 “cron 任务”。cron 任务用于“自动执行的任务”,它有助于简化重复的、有时是乏味的任务的执行。cron 是一个守护进程,可让你安排这些任务,然后按指定的时间间隔执行这些任务。在本教程中,你将学习如何使用 cron 来安排任务。 ![Schedule -tasks-in-Linux-using cron][2] ### crontab 文件 -crontab 即 “cron table”,是一个简单的文本文件,其中包含指定任务执行时间间隔的规则或命令。 crontab 文件分为两类: +crontab 即 “cron table”,是一个简单的文本文件,其中包含指定任务执行时间间隔的规则和命令。 crontab 文件分为两类: 1)系统范围的 crontab 文件 -这些通常由需要 root 特权的 Linux 服务及关键应用程序使用。系统 crontab 文件位于 `/etc/crontab` 中,并且只能由 root 用户访问和编辑。通常用于配置系统范围的守护程序。`crontab` 文件的看起来类似如下所示: +这些通常由需要 root 特权的 Linux 服务及关键应用程序使用。系统 crontab 文件位于 `/etc/crontab` 中,并且只能由 root 用户访问和编辑。通常用于配置系统范围的守护进程。`crontab` 文件的看起来类似如下所示: ![etc-crontab-linux][3] @@ -61,7 +61,7 @@ m h d moy dow /path/to/script * `d`:代表一个月中的某天,范围是 1 到 31 * `moy`:这是一年中的月份。范围是 1 到 12 * `doy`:这是星期几。范围是 0 到 6,其中 0 代表星期日 -* `Command`:这是要执行的命令,例如备份命令、重新启动和复制命令等 +* `command`:这是要执行的命令,例如备份命令、重新启动和复制命令等 ### 管理 cron 任务 @@ -87,7 +87,7 @@ m h d moy dow /path/to/script # crontab -u Pradeep -e ``` -如果该 crontab 文件尚不存在,那么你将打开一个空白文本文档。如果该 crontab 文件已经存在,则 `-e` 选项会让你编辑该文件, +如果该 crontab 文件尚不存在,那么你将打开一个空白文本文件。如果该 crontab 文件已经存在,则 `-e` 选项会让你编辑该文件, #### 列出 crontab 文件 @@ -109,9 +109,9 @@ m h d moy dow /path/to/script 然后,让我们看一下安排任务的不同方式。 -### crontab 安排任务示例 +### 使用 crontab 安排任务示例 -如图所示,所有 cron 任务文件都带有释伴标头。 +如图所示,所有 cron 任务文件都带有释伴shebang标头。 ``` #!/bin/bash @@ -121,7 +121,7 @@ m h d moy dow /path/to/script 接下来,使用我们之前指定的 cron 任务条目指定要安排任务的时间间隔。 -要每天下午 12:30 重新引导系统,请使用以下语法: +要每天下午 12:30 重启系统,请使用以下语法: ``` 30  12 *  *  * /sbin/reboot @@ -199,7 +199,7 @@ m h d moy dow /path/to/script 3)`@weekly` 时间戳等效于 `0 0 1 * mon` -它在每周的第一分钟执行 cron 任务,一周是从星期一开始的。 +它在每周的第一分钟执行 cron 任务,一周第一天是从星期一开始的。 ``` @weekly /path/to/script @@ -215,7 +215,7 @@ m h d moy dow /path/to/script 4)`@yearly` 时间戳等效于 `0 0 1 1 *` -它在每年的第一分钟执行任务,并且对发送新年问候很有用。 +它在每年的第一分钟执行任务,可以用于发送新年问候。 ``` @yearly /path/to/script @@ -223,7 +223,7 @@ m h d moy dow /path/to/script ### 限制 crontab -作为 Linux 用户,你可以控制谁有权使用 `crontab` 命令。可以使用 `/etc/cron.deny` 和 `/etc/cron.allow` 文件来控制。默认情况下,只有一个 `/etc/cron.deny` 文件,并且不包含任何条目。要限制用户使用 `crontab` 实用程序,只需将用户的用户名添加到文件中即可。当用户添加到该文件中,并且该用户尝试运行 `crontab` 命令时,他/她将遇到以下错误。 +作为 Linux 用户,你可以控制谁有权使用 `crontab` 命令。可以使用 `/etc/cron.deny` 和 `/etc/cron.allow` 文件来控制。默认情况下,只有一个 `/etc/cron.deny` 文件,并且不包含任何条目。要限制用户使用 `crontab` 实用程序,只需将用户的用户名添加到该文件中即可。当用户添加到该文件中,并且该用户尝试运行 `crontab` 命令时,他/她将遇到以下错误。 ![restricted-cron-user][4] @@ -235,7 +235,7 @@ m h d moy dow /path/to/script ### 备份 crontab 条目 -始终建议你备份 crontab 条目。为此,请使用语法 +始终建议你备份 crontab 条目。为此,请使用语法: ``` # crontab -l > /path/to/file.txt @@ -276,7 +276,7 @@ via: https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/ 作者:[Pradeep Kumar][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 bf3fdac32badb2385e9a36fd9988761fcd307741 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 Nov 2019 22:19:49 +0800 Subject: [PATCH 448/800] PUB @wxy https://linux.cn/article-11571-1.html --- ...to Schedule and Automate tasks in Linux using Cron Jobs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md (99%) diff --git a/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md similarity index 99% rename from translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md rename to published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md index 59a3803198..6d380030f0 100644 --- a/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md +++ b/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11571-1.html) [#]: subject: (How to Schedule and Automate tasks in Linux using Cron Jobs) [#]: via: (https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) From 3a64c149f96b85c54d01a43582798d4ed6082a6c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 Nov 2019 23:03:21 +0800 Subject: [PATCH 449/800] PRF @geekpi --- ...figure Nagios Core on CentOS 8 - RHEL 8.md | 110 ++++++++++-------- 1 file changed, 60 insertions(+), 50 deletions(-) diff --git a/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md index 7596a615dc..4a356f974e 100644 --- a/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md +++ b/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md @@ -1,67 +1,64 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install and Configure Nagios Core on CentOS 8 / RHEL 8) [#]: via: (https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) -如何在 CentOS 8 / RHEL 8 上安装和配置 Nagios Core +如何在 CentOS 8/RHEL 8 上安装和配置 Nagios Core ====== -**Nagios** 是一个免费开源网络和警报引擎,它用于监视各种设备,例如网络设备和网络中的服务器。它支持 **Linux** 和 **Windows**,并提供直观的 Web 界面,可让你轻松监控网络资源。经过专业配置后,它可以在服务器或网络设备下线或者故障时向你发出邮件警报。在本文中,我们说明了如何在 **RHEL 8** / **CentOS 8** 上安装和配置 Nagios Core。 +Nagios 是一个自由开源的网络和警报引擎,它用于监控各种设备,例如网络设备和网络中的服务器。它支持 Linux 和 Windows,并提供了直观的 Web 界面,可让你轻松监控网络资源。经过专业配置后,它可以在服务器或网络设备下线或者故障时向你发出邮件警报。在本文中,我们说明了如何在 RHEL 8/CentOS 8 上安装和配置 Nagios Core。 -[![Install-Nagios-Core-RHEL8-CentOS8][1]][2] +![Install-Nagios-Core-RHEL8-CentOS8][2] ### Nagios Core 的先决条件 在开始之前,请先检查并确保有以下各项: - - * RHEL 8 / CentOS 8 的实例 - * 能通过 SSH 访问实例 + * RHEL 8/CentOS 8 环境 + * 能通过 SSH 访问该环境 * 快速稳定的互联网连接 - - 满足上述要求后,我们开始吧! ### 步骤 1:安装 LAMP -为了使 Nagios 能够按预期工作,你需要安装 LAMP 或其他网络托管软件,因为它们将在浏览器上运行。 为此,请执行以下命令: +为了使 Nagios 能够按预期工作,你需要安装 LAMP 或其他 Web 软件,因为它们将在浏览器上运行。为此,请执行以下命令: ``` # dnf install httpd mariadb-server php-mysqlnd php-fpm ``` -![Install-LAMP-stack-CentOS8][1] +![Install-LAMP-stack-CentOS8][3] -你需要确保 Apache Web 服务器已启动并正在运行。 为此,请使用以下命令启用并启动 Apache 服务器: +你需要确保 Apache Web 服务器已启动并正在运行。为此,请使用以下命令启用并启动 Apache 服务器: ``` # systemctl start httpd # systemctl enable httpd ``` -![Start-enable-httpd-centos8][1] +![Start-enable-httpd-centos8][4] -检查 Apache 服务器运行状态 +检查 Apache 服务器运行状态: ``` # systemctl status httpd ``` -![Check-status-httpd-centos8][1] +![Check-status-httpd-centos8][5] -接下来,我们需要启用并启动 MariaDB 服务器,运行以下命令 +接下来,我们需要启用并启动 MariaDB 服务器,运行以下命令: ``` # systemctl start mariadb # systemctl enable mariadb ``` -![Start-enable-MariaDB-CentOS8][1] +![Start-enable-MariaDB-CentOS8][6] 要检查 MariaDB 状态,请运行: @@ -69,7 +66,7 @@ # systemctl status mariadb ``` -![Check-MariaDB-status-CentOS8][1] +![Check-MariaDB-status-CentOS8][7] 另外,你可能会考虑加强或保护服务器,使其不容易受到未经授权的访问。要保护服务器,请运行以下命令: @@ -77,9 +74,9 @@ # mysql_secure_installation ``` -确保为你的 MySQL 实例设置一个强密码。对于后续提示,请输入 **Yes** 并按**回车** +确保为你的 MySQL 实例设置一个强密码。对于后续提示,请输入 “Y” 并按回车。 -![Secure-MySQL-server-CentOS8][1] +![Secure-MySQL-server-CentOS8][8] ### 步骤 2:安装必需的软件包 @@ -89,7 +86,7 @@ # dnf install gcc glibc glibc-common wget gd gd-devel perl postfix ``` -![Install-requisite-packages-CentOS8][1] +![Install-requisite-packages-CentOS8][9] ### 步骤 3:创建 Nagios 用户帐户 @@ -100,7 +97,7 @@ # passwd nagios ``` -![Create-new-user-for-Nagios][1] +![Create-new-user-for-Nagios][10] 现在,我们需要为 Nagios 创建一个组,并将 Nagios 用户添加到该组中。 @@ -108,37 +105,37 @@ # groupadd nagiosxi ``` -现在添加 Nagios 用户到组中 +现在添加 Nagios 用户到组中: ``` # usermod -aG nagiosxi nagios ``` -另外,将 Apache 用户添加到 Nagios 组 +另外,将 Apache 用户添加到 Nagios 组: ``` # usermod -aG nagiosxi apache ``` -![Add-Nagios-group-user][1] +![Add-Nagios-group-user][11] ### 步骤 4:下载并安装 Nagios Core 现在,我们可以继续安装 Nagios Core。Nagios 4.4.5 的最新稳定版本于 2019 年 8 月 19 日发布。但首先,请从它的官方网站下载 Nagios tarball 文件。 -要下载 Nagios Core,请首进入 tmp 目录 +要下载 Nagios Core,请首进入 `/tmp` 目录: ``` # cd /tmp ``` -接下来下载 tarball 文件 +接下来下载 tarball 文件: ``` # wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz ``` -![Download-Nagios-CentOS8][1] +![Download-Nagios-CentOS8][12] 下载完 tarball 文件后,使用以下命令将其解压缩: @@ -146,13 +143,13 @@ # tar -xvf nagios-4.4.5.tar.gz ``` -接下来,进入未压缩的文件夹 +接下来,进入未压缩的文件夹: ``` # cd nagios-4.4.5 ``` -按此顺序运行以下命令 +按此顺序运行以下命令: ``` # ./configure --with-command-group=nagcmd @@ -173,7 +170,7 @@ ### 步骤 5:配置 Apache Web 服务器身份验证 -接下来,我们将为用户 **nagiosadmin** 设置身份验证。请注意不要更改用户名,否则,可能会要求你进一步的配置,这可能很繁琐。 +接下来,我们将为用户 `nagiosadmin` 设置身份验证。请注意不要更改该用户名,否则,可能会要求你进一步的配置,这可能很繁琐。 要设置身份验证,请运行以下命令: @@ -181,11 +178,11 @@ # htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin ``` -![Configure-Apache-webserver-authentication-CentOS8][1] +![Configure-Apache-webserver-authentication-CentOS8][13] -系统将提示你输入 nagiosadmin 用户的密码。输入并按要求确认密码。在本教程结束时,你将使用该用户登录 Nagios。 +系统将提示你输入 `nagiosadmin` 用户的密码。输入并按要求确认密码。在本教程结束时,你将使用该用户登录 Nagios。 -为使更改生效,请重新启动 Web 服务器。 +为使更改生效,请重新启动 Web 服务器: ``` # systemctl restart httpd @@ -193,20 +190,20 @@ ### 步骤 6:下载并安装 Nagios 插件 -插件将扩展 Nagios 服务器的功能。它们将帮助你监控各种服务、网络设备和应用。要下载插件 tarball 文件,请运行以下命令: +插件可以扩展 Nagios 服务器的功能。它们将帮助你监控各种服务、网络设备和应用。要下载插件的 tarball 文件,请运行以下命令: ``` # wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz ``` -接下来,解压 tarball 文件并进入到未压缩的插件文件夹 +接下来,解压 tarball 文件并进入到未压缩的插件文件夹: ``` # tar -xvf nagios-plugins-2.2.1.tar.gz # cd nagios-plugins-2.2.1 ``` -要安装插件,请编译源代码,如下所示 +要安装插件,请编译源代码,如下所示: ``` # ./configure --with-nagios-user=nagios --with-nagios-group=nagiosxi @@ -222,18 +219,18 @@ # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg ``` -![Verify-Nagios-settings-CentOS8][1] +![Verify-Nagios-settings-CentOS8][14] -接下来,启动 Nagios 并验证其状态 +接下来,启动 Nagios 并验证其状态: ``` # systemctl start nagios # systemctl status nagios ``` -![Start-check-status-Nagios-CentOS8][1] +![Start-check-status-Nagios-CentOS8][15] -如果系统中有防火墙,那么使用以下命令允许 ”80“ 端口 +如果系统中有防火墙,那么使用以下命令允许 ”80“ 端口: ``` # firewall-cmd --permanent --add-port=80/tcp# firewall-cmd --reload @@ -241,17 +238,15 @@ ### 步骤 8:通过 Web 浏览器访问 Nagios 面板 -要访问 Nagios,请打开服务器的 IP 地址,如下所示 +要访问 Nagios,请打开服务器的 IP 地址,如下所示: 。 - +这将出现一个弹出窗口,提示输入我们在步骤 5 创建的用户名和密码。输入凭据并点击“Sign In”。 -这将出现一个弹出窗口,提示输入我们在步骤 5 创建的用户名和密码。输入凭据并点击”**登录**“ +![Access-Nagios-via-web-browser-CentOS8][16] -![Access-Nagios-via-web-browser-CentOS8][1] +这将引导你到 Nagios 面板,如下所示: -这将引导你到 Nagios 面板,如下所示 - -![Nagios-dashboard-CentOS8][1] +![Nagios-dashboard-CentOS8][17] 我们终于成功地在 CentOS 8 / RHEL 8 上安装和配置了 Nagios Core。欢迎你的反馈。 @@ -262,11 +257,26 @@ via: https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/ 作者:[James Kiarie][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.linuxtechi.com/author/james/ [b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 [2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-Nagios-Core-RHEL8-CentOS8.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-LAMP-stack-CentOS8.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Start-enable-httpd-centos8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Check-status-httpd-centos8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Start-enable-MariaDB-CentOS8.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Check-MariaDB-status-CentOS8.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Secure-MySQL-server-CentOS8.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-requisite-packages-CentOS8.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Create-new-user-for-Nagios.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Add-Nagios-group-user.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Download-Nagios-CentOS8.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Configure-Apache-webserver-authentication-CentOS8.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Verify-Nagios-settings-CentOS8.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Start-check-status-Nagios-CentOS8.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Access-Nagios-via-web-browser-CentOS8.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Nagios-dashboard-CentOS8.jpg + From 945384d7f0f52c2fcab3955b24f8e0de70596cb7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 Nov 2019 23:04:14 +0800 Subject: [PATCH 450/800] PUB @geekpi https://linux.cn/article-11572-1.html --- ... Install and Configure Nagios Core on CentOS 8 - RHEL 8.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md (99%) diff --git a/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md similarity index 99% rename from translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md rename to published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md index 4a356f974e..e57a711a68 100644 --- a/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md +++ b/published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11572-1.html) [#]: subject: (How to Install and Configure Nagios Core on CentOS 8 / RHEL 8) [#]: via: (https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) From 1cf5cee4a6187853a22bc5b5a6015c38f7e1d9c2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 13 Nov 2019 23:45:24 +0800 Subject: [PATCH 451/800] APL --- ...t be) coming to an IoT implementation near you.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) rename {sources/tech => translated/talk}/20190404 Why blockchain (might be) coming to an IoT implementation near you.md (80%) diff --git a/sources/tech/20190404 Why blockchain (might be) coming to an IoT implementation near you.md b/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md similarity index 80% rename from sources/tech/20190404 Why blockchain (might be) coming to an IoT implementation near you.md rename to translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md index f5915aebe7..464bafca20 100644 --- a/sources/tech/20190404 Why blockchain (might be) coming to an IoT implementation near you.md +++ b/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -7,16 +7,18 @@ [#]: via: (https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html#tk.rss_all) [#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) -Why blockchain (might be) coming to an IoT implementation near you +为什么区块链(可能会)来的你身边 IoT 设备 ====== ![MF3D / Getty Images][1] -Companies have found that IoT partners well with a host of other popular enterprise computing technologies of late, and blockchain – the innovative system of distributed trust most famous for underpinning cryptocurrencies – is no exception. Yet while the two phenomena can be complementary in certain circumstances, those expecting an explosion of blockchain-enabled IoT technologies probably shouldn’t hold their breath. +各个公司发现,物联网与最近其他许多流行的企业计算技术有着良好的合作伙伴关系,区块链(以支持加密货币而闻名的分布式信任创新系统)也不例外。然而,尽管这两种现象在某些情况下可以互补,但是那些期待支持区块链的物联网技术爆发的人们可能不应该屏住呼吸。 -Blockchain technology can be counter-intuitive to understand at a basic level, but it’s probably best thought of as a sort of distributed ledger keeping track of various transactions. Every “block” on the chain contains transactional records or other data to be secured against tampering, and is linked to the previous one by a cryptographic hash, which means that any tampering with the block will invalidate that connection. The nodes – which can be largely anything with a CPU in it – communicate via a decentralized, peer-to-peer network to share data and ensure the validity of the data in the chain. +从根本上理解区块链技术可能会违背直觉,但最好将其视为一种跟踪各种交易的分布式分类帐。链上的每个“块”都包含要防止篡改的交易记录或其他数据,并通过加密散列链接到前一个,这意味着对块的任何篡改都将使该链接无效。节点(几乎可以是其中装有 CPU 的任何节点)通过分布式的对等网络进行通信,以共享数据并确保链中数据的有效性。 -**[ Also see[What is edge computing?][2] and [How edge networking and IoT will reshape data centers][3].]** +北卡罗来纳大学格林波若分校的管理学教授尼尔·谢特里(Nir Kshetri)表示,该系统之所以有效,是因为所有的块都必须就它们所保护的数据的细节达成一致。 如果有人尝试更改给定节点上的先前事务,则网络上的其余数据将向后推送。 “数据的旧记录仍然存在,” Kshetri说。 + +这是一项强大的安全技术–如果没有坏人成功控制给定区块链上的所有节点([著名的“ 51%攻击] [4]”),则该区块链保护的数据不能被伪造或以其他方式弄乱。 。 因此,对于在物联网世界某些角落的公司来说,使用区块链是一种有吸引力的选择也就不足为奇了。 The system works because all the blocks have to agree with each other on the specifics of the data that they’re safeguarding, according to Nir Kshetri, a professor of management at the University of North Carolina – Greensboro. If someone attempts to alter a previous transaction on a given node, the rest of the data on the network pushes back. “The old record of the data is still there,” said Kshetri. From 6d1035fcc4512a3181d4141fe19679ff2f84cd1c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 14 Nov 2019 00:56:13 +0800 Subject: [PATCH 452/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191114=20Micros?= =?UTF-8?q?oft=20Defender=20ATP=20is=20Coming=20to=20Linux!=20What=20Does?= =?UTF-8?q?=20it=20Mean=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md --- ...P is Coming to Linux- What Does it Mean.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/tech/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md diff --git a/sources/tech/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md b/sources/tech/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md new file mode 100644 index 0000000000..43693db00d --- /dev/null +++ b/sources/tech/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Microsoft Defender ATP is Coming to Linux! What Does it Mean?) +[#]: via: (https://itsfoss.com/microsoft-defender-atp-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Microsoft Defender ATP is Coming to Linux! What Does it Mean? +====== + +_**Microsoft has announced that it is bringing its enterprise security product Microsoft Defender Advanced Threat Protection (ATP) to Linux in 2020.**_ + +Microsoft’s annual developer conference Microsoft Ignite has just been concluded and there are a few important announcements that relate to Linux. You probably already read about [Microsoft bringing its Edge web browser to Linux][1]. The next big news is that Microsoft is bringing Microsoft Defender ATP to Linux. + +Let’s get into some details what it is and why Microsoft is bothering itself to develop something for Linux. + +### What is Microsoft Defender ATP? + +If you have used Windows in past few years, you must have come across Windows Defender. It is basically an antivirus product by Microsoft that brings some level of security by detecting viruses and malware. + +Microsoft improved this functionality for its enterprise users by introducing Windows Defender ATP (Advanced Threat Protection). Defender ATP works on behavioral analysis. It collects usage data and store them on the same system. However, when it notices an inconsistent behavior, it sends the data to Azure service (Microsoft’s cloud service). In here, it will have a collection of behavioral data and the anomalies. + +For example, if you got a PDF attachment in the email, you open it and it opened a command prompt, Defender ATP will notice this abnormal behavior. I recommend reading this article to [learn more about the difference between Defender and Defender ATP][2]. + +Now this is entirely an enterprise product. In a big enterprise with hundreds or thousands of end points (computers), Defender ATP provides a good layer of protection. The IT admins will have a centralized view of the end-points on their Azure instance and the threats can be analyzed and actions can be taken accordingly. + +### Microsoft Defender ATP for Linux (and Mac) + +Normally, enterprises have Windows on their computer but Mac and Linux are also getting popular specially among the developers. In an environment where there is a mix of Mac and Linux machines among Windows, Defender ATP has to extends its services to these operating systems so that it can provide a holistic defense to all the devices on the network. + +Keeping that in mind, Microsoft first [changed Windows Defender ATP to Microsoft Defender ATP in March 201][3][9][3], signaling that the product is not limited to just Windows operating system. + +Soon after it [announced Defender ATP for Mac][4]. + +And now to cover all the major operating systems in an enterprise environment, [Microsoft is bringing Defender ATP to Linux][5] in 2020. + +### How Microsoft Defender ATP on Linux impacts you, a Linux user? + +Since Defender ATP is an enterprise product, I don’t think you need to be bothered with this. Organizations need to secure their end-points against threats so it makes sense that Microsoft is improving its product to cover Linux as well. + +For normal Linux users like you and me, it won’t make any difference. I am not going to use it ‘secure’ my three Linux systems and pay Microsoft for that. + +Please feel free to share your opinion on Microsoft bringing Defender ATP to Linux in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/microsoft-defender-atp-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/microsoft-edge-linux/ +[2]: https://www.concurrency.com/blog/november-2017/windows-defender-vs-windows-defender-atp +[3]: https://www.theregister.co.uk/2019/03/21/microsoft_defender_atp/ +[4]: https://techcommunity.microsoft.com/t5/Microsoft-Defender-ATP/Announcing-Microsoft-Defender-ATP-for-Mac/ba-p/378010 +[5]: https://www.zdnet.com/article/microsoft-defender-atp-is-coming-to-linux-in-2020/ From c9a6d2a4da762f932cfb722c383388fdba1d7aa5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 14 Nov 2019 00:56:30 +0800 Subject: [PATCH 453/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191113=20How=20?= =?UTF-8?q?to=20install=20and=20Configure=20Postfix=20Mail=20Server=20on?= =?UTF-8?q?=20CentOS=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md --- ...nfigure Postfix Mail Server on CentOS 8.md | 351 ++++++++++++++++++ 1 file changed, 351 insertions(+) create mode 100644 sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md diff --git a/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md b/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md new file mode 100644 index 0000000000..15b7715d7f --- /dev/null +++ b/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md @@ -0,0 +1,351 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to install and Configure Postfix Mail Server on CentOS 8) +[#]: via: (https://www.linuxtechi.com/install-configure-postfix-mailserver-centos-8/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to install and Configure Postfix Mail Server on CentOS 8 +====== + +**Postfix** is a free and opensource **MTA** (Mail Transfer Agent) used for routing or delivering emails on a Linux system. In this guide, you will learn how to install and configure Postfix on CentOS 8. + +[![Install-configure-Postfx-Server-CentOS8][1]][2] + +Lab set up: + + * OS :                  CentOS 8 server + * IP Address :   192.168.1.13 + * Hostname:     server1.crazytechgeek.info (Ensure the domain name is pointed to the server’s IP) + + + +### Step 1) Update the system + +The first step is to ensure that the system packages are up to date. To do so, update the system as follows: + +``` +# dnf update +``` + +Before proceeding further, also ensure that no other **MTAs** such as **Sendmail** are existing as this will cause conflict with Postfix configuration. To remove Sendmail, for example, run the command: + +``` +# dnf remove sendmail +``` + +### Step 2)  Set Hostname and update /etc/hosts file + +Use below hostnamectl command to set the hostname on your system, + +``` +# hostnamectl set-hostname server1.crazytechgeek.info +# exec bash +``` + +Additionally, you need to add the system’s hostname and IP entries in the /etc/hosts file + +``` +# vim /etc/hosts +192.168.1.13 server1.crazytechgeek.info +``` + +Save and exit the file. + +### Step 3) Install Postfix Mail Server + +After verifying that no other MTA is running on the system install Postfix by executing the command: + +``` +# dnf install postfix +``` + +[![Install-Postfix-Centos8][1]][3] + +### Step 4) Start and enable Postfix Service + +Upon successful installation of Postfix, start and enable Postfix service by running: + +``` +# systemctl start postfix +# systemctl enable postfix +``` + +To check Postfix status, run the following systemctl command + +``` +# systemctl status postfix +``` + +![Start-Postfix-check-status-centos8][1] + +Great, we have verified that Postfix is up and running. Next, we are going to configure Postfix to send emails locally to our server. + +### Step 5) Install mailx email client + +Before configuring the Postfix server, we need to install mailx feature, To install mailx, run the command: + +``` +# dnf install mailx +``` + +![Install-Mailx-CentOS8][1] + +### Step 6)  Configure Postfix Mail Server + +Postfix’s configuration file is located in **/etc/postfix/main.cf**. We need to make a few changes in the configuration file, so open it using your favorite text editor. + +``` +# vi /etc/postfix/main.cf +``` + +Make changes to the following lines: + +``` +myhostname = server1.crazytechgeek.info +mydomain = crazytechgeek.info +myorigin = $mydomain +## Uncomment and Set inet_interfaces to all ## +inet_interfaces = all +## Change to all ## +inet_protocols = all +## Comment ## +#mydestination = $myhostname, localhost.$mydomain, localhost +##- Uncomment ## +mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain +## Uncomment and add IP range ## +mynetworks = 192.168.1.0/24, 127.0.0.0/8 +## Uncomment ## +home_mailbox = Maildir/ +``` + +Once done, save and exit the configuration file. Restart postfix  service for the changes to take effect + +``` +# systemctl restart postfix +``` + +### Step 7) Testing  Postfix Mail Server + +Test whether our configuration is working, first, create a test user + +``` +# useradd postfixuser +# passwd postfixuser +``` + +Next, run the command below to send email from **pkumar** local user to another user ‘**postfixuser**‘ + +``` +# telnet localhost smtp +or +# telnet localhost 25 +``` + +If telnet service is not installed, you can install it using the command: + +``` +# dnf install telnet -y +``` + +When you run the command as earlier indicated, you should get the output as shown + +``` +[root@linuxtechi ~]# telnet localhost 25 +Trying 127.0.0.1... +Connected to localhost. +Escape character is '^]'. +220 server1.crazytechgeek.info ESMTP Postfix +``` + +Above confirm that connectivity to postfix mail server is working fine. Next, type the command: + +``` +# ehlo localhost +``` + +Output will be something like this + +``` +250-server1.crazytechgeek.info +250-PIPELINING +250-SIZE 10240000 +250-VRFY +250-ETRN +250-STARTTLS +250-ENHANCEDSTATUSCODES +250-8BITMIME +250-DSN +250 SMTPUTF8 +``` + +Next, run the commands highlighted in orange, like “mail from”, “rcpt to”, data and then finally type quit, + +``` +mail from: +250 2.1.0 Ok +rcpt to: +250 2.1.5 Ok +data +354 End data with . +Hello, Welcome to my mailserver (Postfix) +. +250 2.0.0 Ok: queued as B56BF1189BEC +quit +221 2.0.0 Bye +Connection closed by foreign host +``` + +Complete telnet command to send email from local user “**pkumar**” to another local user “**postfixuser**” would be something like below + +![Send-email-with-telnet-centos8][1] + +If everything went according to plan, you should be able to view the email sent at the new user’s home directory. + +``` +# ls /home/postfixuser/Maildir/new +1573580091.Vfd02I20050b8M635437.server1.crazytechgeek.info +# +``` + +To read the email, simply use the cat command as follows: + +``` +# cat /home/postfixuser/Maildir/new/1573580091.Vfd02I20050b8M635437.server1.crazytechgeek.info +``` + +![Read-postfix-email-linux][1] + +### Postfix mail server logs + +Postfix mail server mail logs are stored in the file “**/var/log/maillog**“, use below command to view the live logs, + +``` +# tail -f /var/log/maillog +``` + +![postfix-maillogs-centos8][1] + +### Securing Postfix Mail Server + +It is always recommended secure the communication of between clients and postfix server, this can be achieved using SSL certificates, these certificates can be either from trusted authority or Self Signed Certificates. In this tutorial we will generate Self Signed certificated for postfix using **openssl** command, + +I am assuming openssl is already installed on your system, in case it is not installed then use following dnf command, + +``` +# dnf install openssl -y +``` + +Generate Private key and CSR (Certificate Signing Request) using beneath openssl command, + +``` +# openssl req -nodes -newkey rsa:2048 -keyout mail.key -out mail.csr +``` + +![Postfix-Key-CSR-CentOS8][1] + +Now Generate Self signed certificate using following openssl command, + +``` +# openssl x509 -req -days 365 -in mail.csr -signkey mail.key -out mail.crt +Signature ok +subject=C = IN, ST = New Delhi, L = New Delhi, O = IT, OU = IT, CN = server1.crazytechgeek.info, emailAddress = root@linuxtechi +Getting Private key +# +``` + +Now copy private key and certificate file to /etc/postfix directory + +``` +# cp mail.key mail.crt /etc/postfix +``` + +Update Private key and Certificate file’s path in postfix configuration file, + +``` +# vi /etc/postfix/main.cf +……… +smtpd_use_tls = yes +smtpd_tls_cert_file = /etc/postfix/mail.crt +smtpd_tls_key_file = /etc/postfix/mail.key +smtpd_tls_security_level = may +……… +``` + +Restart postfix service to make above changes into the effect. + +``` +# systemctl restart postfix +``` + +Let’s try to send email to internal local domain and external domain using mailx client. + +**Sending local internal email from pkumar user to postfixuser** + +``` +# echo "test email" | mailx -s "Test email from Postfix MailServer" -r root@linuxtechi root@linuxtechi +``` + +Check and read the email using the following, + +``` +# cd /home/postfixuser/Maildir/new/ +# ll +total 8 +-rw-------. 1 postfixuser postfixuser 476 Nov 12 17:34 1573580091.Vfd02I20050b8M635437.server1.crazytechgeek.info +-rw-------. 1 postfixuser postfixuser 612 Nov 13 02:40 1573612845.Vfd02I20050bbM466643.server1.crazytechgeek.info +# cat 1573612845.Vfd02I20050bbM466643.server1.crazytechgeek.info +``` + +![Read-Postfixuser-Email-CentOS8][1] + +**Sending email from postfixuser to external domain ( [root@linuxtechi][4])** + +``` +# echo "External Test email" | mailx -s "Postfix MailServer" -r root@linuxtechi root@linuxtechi +``` + +**Note:** If Your IP is not blacklisted anywhere then your email to external domain will be delivered otherwise it will be bounced saying that IP is blacklisted in so and so spamhaus database. + +### Check Postfix mail queue + +Use mailq command to list mails which are in queue. + +``` +# mailq +Mail queue is empty +# +``` + +And that’s it! Our Postfix configuration is working! That’s all for now. We hope you found this tutorial insightful and that you can comfortably set up your local Postfix server. + + * [Facebook][5] + * [Twitter][6] + * [LinkedIn][7] + * [Reddit][8] + + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-configure-postfix-mailserver-centos-8/ + +作者:[James Kiarie][a] +选题:[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/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-configure-Postfx-Server-CentOS8.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-Postfix-Centos8.png +[4]: https://www.linuxtechi.com/cdn-cgi/l/email-protection +[5]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-configure-postfix-mailserver-centos-8%2F&t=How%20to%20install%20and%20Configure%20Postfix%20Mail%20Server%20on%20CentOS%208 +[6]: http://twitter.com/share?text=How%20to%20install%20and%20Configure%20Postfix%20Mail%20Server%20on%20CentOS%208&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-configure-postfix-mailserver-centos-8%2F&via=Linuxtechi +[7]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-configure-postfix-mailserver-centos-8%2F&title=How%20to%20install%20and%20Configure%20Postfix%20Mail%20Server%20on%20CentOS%208 +[8]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-configure-postfix-mailserver-centos-8%2F&title=How%20to%20install%20and%20Configure%20Postfix%20Mail%20Server%20on%20CentOS%208 From bc87a85a23addc97617ff28083c2d75ab4b0396e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 14 Nov 2019 00:58:09 +0800 Subject: [PATCH 454/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191113=20How=20?= =?UTF-8?q?to=20cohost=20GitHub=20and=20GitLab=20with=20Ansible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md --- ...o cohost GitHub and GitLab with Ansible.md | 175 ++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md diff --git a/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md b/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md new file mode 100644 index 0000000000..a635054dae --- /dev/null +++ b/sources/tech/20191113 How to cohost GitHub and GitLab with Ansible.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to cohost GitHub and GitLab with Ansible) +[#]: via: (https://opensource.com/article/19/11/how-host-github-gitlab-ansible) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to cohost GitHub and GitLab with Ansible +====== +Protect your access to important projects by mirroring Git repositories +with Ansible. +![Hands programming][1] + +Open source is everywhere. It's in your computer at home, it's in your computer at work, it's on the internet, and a lot of it is managed with [Git][2]. Because Git is decentralized, many people also think of it as a kind of crowdsourced backup solution. The theory is that each time someone clones a Git repository to their local computer, they are creating a backup of the project's source code. If 100 people do that, then there are 100 backup copies of a repository. + +This, in theory, mitigates "disasters" such as a project maintainer [suddenly deciding to remove a repository][3] or [inexplicably blocking all traffic][4] and leaving developers scrambling to figure out who has the latest version of the master branch. Similarly, entire code-hosting sites have disappeared in the past. Nobody anticipated the closure of Google Code, Microsoft CodePlex, or Gitorious when they were at their peak. + +In short, if the internet has taught us anything over the past few decades, it's that relying on the internet to magically create backups isn't the most reliable road to redundancy. + +Besides, it's a problem for a lot of people that many open source projects are hosted on GitHub, which is not an open platform. Many developers and users would prefer to support and interact with a stack such as GitLab, which has an open source community edition. + +### Using Ansible for Git + +Git's decentralization is useful in solving this problem. Using pure Git, you can easily push to two or more repositories with a single **push** command. However, for that to be useful against unexpected failure, you must be interacting (and pushing, specifically) with a Git repository frequently. Furthermore, there may be repositories out there that you want to back up, even though you may never push or pull the code yourself. + +But using Ansible, you can automate Git pulls of a project's master branch (or any other branch, for that matter) and then automate Git pushes of the repository to an "offsite" mirror. In other words, you can have your computer regularly pull from GitHub and push to GitLab or [Gitolite][5] or Gitea (or whatever Git host you prefer). + +### Ansible modules + +There wouldn't be much to Ansible if it weren't for its excellent collection of modules. Like third-party libraries for Python or applications for Linux, the technical _driver_ of the useful and surprisingly easy tricks Ansible is famous for are the parts that other people have already figured out for you. Because this article is tackling how to effectively and reliably backup a Git repository, the modules used here are the [Git module][6] and the [ini_file][7] module. + +To begin, create a file called **mirror.yaml** to serve as the playbook. You can start mostly as you usually do with Ansible, with **name** and **task** entries. This example adds **localhost** to the **hosts** list so that the play runs on the controller machine (the computer you're sitting at right now), but in real life, you would probably run this on a specific host or group of hosts on your network. + + +``` +\--- +\- name: "Mirror a Git repo with Ansible" +  hosts: localhost +  tasks: +``` + +### Git pull and clone + +If you're going to make a backup, then you need a copy of the latest code. The obvious way to make that happen with a Git repository is to perform a **git pull**. However, **pull** assumes that a clone already exists, and a well-written Ansible _play_ (an Ansible script) assumes as little as possible. It's better to tell Ansible to **clone** a repository first. + +Add your first task to your playbook: + + +``` +\--- +\- name: "Mirror a Git repo with Ansible" +  hosts: localhost +  vars: +    git_dir: /tmp/soso.git +  tasks: + +  - name: "Clone the git repo" +    git: +       repo: '' +       dest: '{{ git_dir }}' +       clone: yes +       update: yes +``` + +This example uses the open source, Unix-like operating system **soso** as the repository I want to mirror. This is a completely arbitrary choice and in no way implies a lack of confidence in this repository's future. It also uses a variable to refer to the destination folder, **/tmp/soso.git**, which is convenient now and also beneficial later should you want to scale this out to be a generic mirroring script. In real life, you would probably have a more permanent location than **/tmp**, such as **/home/gitmirrors/soso.git** or **/opt/gitmirrors/soso.git**, on your worker machine. + +Run your playbook: + + +``` +`$ ansible-playbook mirror.yaml` +``` + +The first time you run the playbook, Ansible correctly detects that the Git repository does not yet exist locally, so it clones it. + + +``` +PLAY [Ansible Git mirror] ******** + +TASK [Gathering Facts] *********** +ok: [localhost] + +TASK [Clone git repo] ************ +changed: [localhost] + +PLAY RECAP *********************** +localhost: ok=2 changed=1 failed=0 [...] +``` + +Should you run the playbook again, Ansible correctly detects that there have been no changes since the last time it was run and it reports that no actions were performed: + + +``` +`localhost: ok=2 changed=0 failed=0 [...]` +``` + +Next, Ansible must be instructed to push the repository to another Git server. + +### Git push + +The Git module in Ansible doesn't provide a **push** function, so that part of the process is manual. However, before you can push the repo to an alternate mirror, you have to have a mirror, and you have to configure the mirror as an alternate remote. + +First, you must add an alternate remote to your Git configuration. Because the Git config file is an INI-style configuration, you can use the **ini_file** Ansible module to append the required information easily. Add this to your playbook: + + +``` + - name: "Add alternate remote" +    ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='[git@gitlab.com][8]:example/soso-mirror.git' +    tags: configuration +``` + +For this to work, you must have an empty repository on your destination server (in this case, [GitLab.com][9]). If you need to create destination repositories in your playbook, you can do that by following Steve Ovens' excellent article "[How to use Ansible to set up a Git server over SSH][10]." + +Finally, use Git directly to push HEAD to your alternate remote: + + +``` + - name: "Push the repo to alternate remote" +    shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' +``` + +Run the playbook as usual, and then automate the process so that you never have to run it directly again. You can adjust the script with variables and specific Git commands to suit your needs, but with regular pulls and pushes, you can be sure that an important project that lives on one server is safely mirrored on another. + +Here is the full playbook for reference: + + +``` +\--- +\- name: "Mirror a Git repository with Ansible" +  hosts: localhost +  vars: +    git_dir: /tmp/soso.git + +  tasks: + +  - name: "Clone the Git repo" +    git: +       repo: '' +       dest: '{{ git_dir }}' +       clone: yes +       update: yes + +  - name: "Add alternate remote" +    ini_file: dest={{ git_dir }}/.git/config section='remote \"mirrored\"' option=url value='[git@gitlab.com][8]:example/soso-mirror.git' +    tags: configuration +  +  - name: "Push the repo to alternate remote" +    shell: 'git --verbose --git-dir={{ git_dir }}/.git push mirrored HEAD' +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/how-host-github-gitlab-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/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/resources/what-is-git +[3]: https://github.com/AntiMicro/antimicro/issues/3 +[4]: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons +[5]: https://opensource.com/article/19/4/server-administration-git +[6]: https://docs.ansible.com/ansible/latest/modules/git_module.html +[7]: https://docs.ansible.com/ansible/latest/modules/ini_file_module.html +[8]: mailto:git@gitlab.com +[9]: http://GitLab.com +[10]: https://opensource.com/article/17/8/ansible-environment-management From 851bb360484e3c2f778521ebc74aaf172303b51f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 14 Nov 2019 01:17:45 +0800 Subject: [PATCH 455/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191113=20How=20?= =?UTF-8?q?to=20drive=20customer=20experience=20with=20agile=20principles?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191113 How to drive customer experience with agile principles.md --- ...stomer experience with agile principles.md | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 sources/tech/20191113 How to drive customer experience with agile principles.md diff --git a/sources/tech/20191113 How to drive customer experience with agile principles.md b/sources/tech/20191113 How to drive customer experience with agile principles.md new file mode 100644 index 0000000000..aa78563a36 --- /dev/null +++ b/sources/tech/20191113 How to drive customer experience with agile principles.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to drive customer experience with agile principles) +[#]: via: (https://opensource.com/article/19/11/apply-devops-agile-principles-customer-experience) +[#]: author: (Matt Shealy https://opensource.com/users/mshealy) + +How to drive customer experience with agile principles +====== +Increasing customer satisfaction scores is one of the most important +ways to grow a business. +![People meeting][1] + +Customer experience has never been more important. People can find out just about anything with a few clicks or a voice search on their phones. They can research products, services, and companies. They can do business with organizations all over the world. They can buy with a swipe and have things shipped right to their home within a day. + +Consumers now demand instant access, frictionless transactions, and [superior customer experience][2] (CX). Not only do they want efficiency, but they also want personalized interactions. + +### Customer experience as a competitive advantage + +CX is also becoming a way to distinguish yourself from the competition. More than 80% of organizations say that they expect to [compete mainly based on the customer experience][3] they provide. Companies that excel at customer experience have higher brand awareness, higher employee satisfaction, higher customer retention, higher customer satisfaction rates, and higher average order value. + +### Using agile and DevOps principles to compete + +Customer-forward applications, such as websites, apps, chatbots, call center tech, and e-commerce toolkits, define customer service and CX. They can positively shape a brand or push customers away. Organizations need to be in a continuous improvement cycle to improve these products. + +Competing successfully in a CX-driven world can happen only by applying agile and DevOps principals throughout the organization. + +### What is DevOps? + +[DevOps][4] is designed to deliver apps and services rapidly within a continuous development (CD) and continuous integration (CI) cycle. Products are developed, released, tested, and updated continuously rather than once or twice a year. + +To make this happen, cross-functional teams work in an agile environment rather than in a linear development cycle. Instead of working in silos, engineers work across application lifecycles. + +### The DevOps cycle + +By forgoing the traditional software development and infrastructure management process, organizations can launch products more quickly, identify problems to apply patches, and serve customers better. + +There are various iterations of the DevOps cycle, but they typically boil down to a few common elements in an infinite loop, starting with planning and looping back to the start. + + 1. Plan + 2. Build + 3. Continuous integration + 4. Deployment + 5. Operate + 6. Continuous feedback + + + +The idea is to constantly be in development and improving the application to provide a better customer experience. + +### Building a DevOps strategy + +The DevOps process brings together stakeholders from different disciplines into one project team. Instead of building things in an assembly-line manner, where one task follows another, the team works holistically across multiple disciplines at the same time. + +This helps bring business intelligence and strategy teams into the design phase. It keeps engineers in the customer feedback loop. For everyone in the agile development team, it provides tighter integration and keeps everyone focused on the larger goals. It allows developers to work towards customer and business outcomes rather than delivery feature sets. + +Customer feedback is one of the most important phases in improving CX. It doesn't matter how clean your code is or how innovative your app is if customers don't find it useful. Quality service starts with understanding customer needs and delivering intuitive ways to meet them. + +Automation is crucial to improving speed. Try to automate as much of the process as possible. There are technology tools—many of which are free and open source solutions—that can handle parts of the software delivery lifecycle smoothly. + +The DevOps strategy was developed as a way to speed software to market, but it can also be applied to nearly any process. A continuous development, deployment, test, and feedback loop creates a way to improve systems continuously. This makes for better workflows, stronger employee and customer engagement, and more iterative development. + +### The benefits of agile teams and DevOps strategies + +There are real and tangible benefits of improving CX. For one: [86% of consumers report they are willing to pay more for great customer experience][5]. + +Also, [improving customer experience][6] creates more brand loyalty. Keeping customers involved in the feedback loop and building on their suggestions to enhance usability can improve customer satisfaction. + +In addition, organizations can see multiple internal benefits, including: + + * Faster deployment times + * Higher product quality + * Increased project control and transparency + * Risk mitigation + * Faster adaptation + * More predictable costs and schedules + + + +Finally, agile development is iterative. A functional product may be market-ready after only a few iterations, and this can create a first-mover advantage. In fast-moving markets, this eliminates long delivery cycles. Fast releases can stimulate customer feedback, which can be turned into additional features to keep you ahead of competitors. + +Organizations with high agility are nearly [20% more likely to meet their business goals][7] than less agile teams. They finish projects on time 50% more often and [deliver software to market 37% faster][8]. + +The better your customer-facing products are, the more time call center and customer support teams will have available to work on customer problems. When patterns and concerns are recognized, they can be added to applications in a more seamless manner using the DevOps strategy. + +Raising the bar on customer experience takes an across-the-board commitment—from senior management to line-level employees. Raising customer satisfaction scores is one of the most important things you can do to grow any business. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/apply-devops-agile-principles-customer-experience + +作者:[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/people_team_community_group.png?itok=Nc_lTsUK (People meeting) +[2]: https://www.chamberofcommerce.com/business-advice/master-a-great-experience-for-your-customers +[3]: https://www.gartner.com/en/doc/3874972-realizing-the-benefits-of-superior-customer-experience-a-gartner-trend-insight-report +[4]: https://opensource.com/resources/devops +[5]: https://www.walkerinfo.com/knowledge-center/featured-research-reports/customers-2020-a-progress-report +[6]: https://www.avoxi.com/blog/how-to-improve-csat-scores-in-your-call-center/ +[7]: https://www.pmi.org/-/media/pmi/documents/public/pdf/learning/thought-leadership/pulse/pulse-of-the-profession-2015.pdf +[8]: http://nyspin.org/QSMA-Rally%20Agile%20Impact%20Report.pdf From f432b6393e0d5666cbf0c73aff9986561be6991c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 14 Nov 2019 01:19:12 +0800 Subject: [PATCH 456/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191112=20GitHub?= =?UTF-8?q?=20report=20surprises,=20serverless=20hotness,=20and=20more=20i?= =?UTF-8?q?ndustry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191112 GitHub report surprises, serverless hotness, and more industry trends.md --- ...rless hotness, and more industry trends.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/tech/20191112 GitHub report surprises, serverless hotness, and more industry trends.md diff --git a/sources/tech/20191112 GitHub report surprises, serverless hotness, and more industry trends.md b/sources/tech/20191112 GitHub report surprises, serverless hotness, and more industry trends.md new file mode 100644 index 0000000000..df2db0d6f8 --- /dev/null +++ b/sources/tech/20191112 GitHub report surprises, serverless hotness, and more industry trends.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GitHub report surprises, serverless hotness, and more industry trends) +[#]: via: (https://opensource.com/article/19/11/github-report-serverless-hotness-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +GitHub report surprises, serverless hotness, and more industry trends +====== +A weekly look at open source community and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [GitHub tops 40 million developers as Python, data science, machine learning popularity surges][2] + +> In its annual Octoverse report, GitHub, owned by Microsoft, said it had more than 10 million new users, 44 million repositories created and 87 million pull requests in the last 12 months. The report is a good view of open source software and where the community is headed. + +**The impact:** The finding that hit home hardest for me is that "nearly 80% of GitHub users are outside of the US." While an important part of open source history comes from the east and west coasts of America, there is a good chance that the future of the movement will happen elsewhere. + +## [Serverless: Is it the Kubernetes killer?][3] + +> Serverless isn't here to destroy Kubernetes. The cloud infrastructure space race isn't a zero-sum game. Kubernetes is an obvious evolution following OpenStack and can be run successfully inside of it. There will be OpenStack users for a long time to come, and there are also reasons many companies have moved on from there. Serverless is another tool in the belt of forward-thinking development teams. And increasingly, it can be [run on top of Kubernetes][4] (see Knative), enabling you to get the benefits of the simplicity of serverless and the complexity of Kubernetes where it makes sense for both in your stack. + +**The impact:** The moral of the story is that legacy doesn't really go away, it just gets built in and around. + +## [When Quarkus meets Knative serverless workloads][5] + +> Now, let's discuss how developers can use Quarkus to bring Java into serverless, a place where previously, it was unable to go. Quarkus introduces a comprehensive and seamless approach to generating an operating system specific (aka native) executable from your Java code, as you do with languages like Go and C/C++. Environments such as event-driven and serverless, where you need to start a service to react to an event, require a low time-to-first-response, and traditional Java stacks simply cannot provide this. Knative enables developers to run cloud-native applications as serverless containers in seconds and the containers will go down to zero on demand. +> +> In addition to compiling Java to Knative, Quarkus aims to improve developer productivity. Quarkus works out of the box with popular Java standards, frameworks and libraries like Eclipse MicroProfile, Apache Kafka, RESTEasy, Hibernate, Spring, and many more. Developers familiar with these will feel at home with Quarkus, which should streamline code for the majority of common use cases while providing the flexibility to cover others that come up. + +**The impact:** It's good to start getting specific with how and where the new hotness can be used. The answer, in this case, is "with the other new hotness." + +## [Why you should join the CNCF Meetup Program][6] + +> With the recent changes to Meetup’s [policies][7], we wanted to share a reminder of the benefits of joining the [CNCF Meetup Program][8] and encourage Meetups in the CNCF ecosystem to apply.  +> +> As part of our Meetup Pro membership, CNCF is able to organize a network with an unlimited number of groups on a single account. + +**The impact:** The long term response to this unfortunate fallout from the WeWork debacle is to build a distributed open source Meetup alternative. Thankfully in the meantime, the CNCF has a more pragmatic response. + +## [Introducing your friends to automation (and overcoming their fear)][9] + +> My team and I were in a meeting a little while back with a third party vendor when they asked us what our stance was on automation. My reply was, "We want to automate everything." On top of my reply, my teammates added, "Well, we don’t want to automate ourselves out of a job." + +**The impact:** I've always thought it was a bit cavalier when someone would say, "I think it's my job to automate myself out of a job." There is plenty of circumstances where that is the last measure of success someone would want to be measured by. I'm happy to see this addressed head-on. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/github-report-serverless-hotness-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.zdnet.com/article/github-tops-40-million-developers-as-python-data-science-machine-learning-popularity-surges/#ftag=RSSbaffb68 +[3]: https://www.forbes.com/sites/forbestechcouncil/2019/11/04/serverless-is-it-the-kubernetes-killer/#7e6740711f77 +[4]: https://github.com/knative +[5]: https://vmblog.com/archive/2019/10/29/when-quarkus-meets-knative-serverless-workloads.aspx#.XbiN1JNKiuN +[6]: https://www.cncf.io/blog/2019/11/01/why-you-should-join-the-cncf-meetup-program/ +[7]: https://www.meetup.com/lp/paymentchanges?mpId=9038 +[8]: https://www.meetup.com/pro/cncf +[9]: https://www.redhat.com/sysadmin/introducing-automation From ce3161b8035cf51dcc1328ed58eb750c2afaf7ce Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 14 Nov 2019 02:23:07 +0800 Subject: [PATCH 457/800] TSL&PRF --- ...oming to an IoT implementation near you.md | 56 ++++++++----------- 1 file changed, 24 insertions(+), 32 deletions(-) diff --git a/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md b/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md index 464bafca20..5b67a9960e 100644 --- a/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md +++ b/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md @@ -1,64 +1,56 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Why blockchain (might be) coming to an IoT implementation near you) [#]: via: (https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html#tk.rss_all) [#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) -为什么区块链(可能会)来的你身边 IoT 设备 +为什么区块链(可能会)来到你身边的物联网 ====== ![MF3D / Getty Images][1] -各个公司发现,物联网与最近其他许多流行的企业计算技术有着良好的合作伙伴关系,区块链(以支持加密货币而闻名的分布式信任创新系统)也不例外。然而,尽管这两种现象在某些情况下可以互补,但是那些期待支持区块链的物联网技术爆发的人们可能不应该屏住呼吸。 +各个公司发现,物联网与最近其他许多流行的企业计算技术有着良好的合作关系,以支持加密货币而闻名的分布式信任创新系统的区块链也不例外。然而,在物联网应用中实施区块链可能具有挑战性,并且需要对技术有深入的了解。 -从根本上理解区块链技术可能会违背直觉,但最好将其视为一种跟踪各种交易的分布式分类帐。链上的每个“块”都包含要防止篡改的交易记录或其他数据,并通过加密散列链接到前一个,这意味着对块的任何篡改都将使该链接无效。节点(几乎可以是其中装有 CPU 的任何节点)通过分布式的对等网络进行通信,以共享数据并确保链中数据的有效性。 +区块链是一个跟踪各种交易的分布式账本。链上的每个“块”都包含要防止篡改的交易记录或其他数据,并通过加密散列链接到前一个,这意味着对块的任何篡改都将使该链接无效。节点(几乎可以是其中装有 CPU 的任何节点)通过分布式的对等网络进行通信,以共享数据并确保链中数据的有效性。 -北卡罗来纳大学格林波若分校的管理学教授尼尔·谢特里(Nir Kshetri)表示,该系统之所以有效,是因为所有的块都必须就它们所保护的数据的细节达成一致。 如果有人尝试更改给定节点上的先前事务,则网络上的其余数据将向后推送。 “数据的旧记录仍然存在,” Kshetri说。 +北卡罗来纳大学格林波若分校的管理学教授 Nir Kshetri 表示,该系统之所以有效,是因为所有的块都必须就它们所保护的数据的细节达成一致。如果有人尝试更改给定节点上的先前事务,则网络上的其余数据将会被回推回来。“数据的旧记录仍然存在,” Kshetri 说。 -这是一项强大的安全技术–如果没有坏人成功控制给定区块链上的所有节点([著名的“ 51%攻击] [4]”),则该区块链保护的数据不能被伪造或以其他方式弄乱。 。 因此,对于在物联网世界某些角落的公司来说,使用区块链是一种有吸引力的选择也就不足为奇了。 +这是一项强大的安全技术 —— 如果没有坏人成功控制给定区块链上的所有(LCTT 译注:应为“大部分”)节点([著名的“51% 攻击”][4]),那么该区块链保护的数据就不会被伪造或以其他方式弄乱。因此,对于在物联网世界某些角落的公司来说,使用区块链是一种有吸引力的选择也就不足为奇了。 -The system works because all the blocks have to agree with each other on the specifics of the data that they’re safeguarding, according to Nir Kshetri, a professor of management at the University of North Carolina – Greensboro. If someone attempts to alter a previous transaction on a given node, the rest of the data on the network pushes back. “The old record of the data is still there,” said Kshetri. +物联网安全初创企业 NXMLabs 的首席技术官兼联合创始人 Jay Fallah 认为,除了区块链能够在网络上安全分发可信信息的能力这一事实之外,部分原因还在于区块链在技术堆栈中的地位。 -That’s a powerful security technique – absent a bad actor successfully controlling all of the nodes on a given blockchain (the [famous “51% attack][4]”), the data protected by that blockchain can’t be falsified or otherwise fiddled with. So it should be no surprise that the use of blockchain is an attractive option to companies in some corners of the IoT world. +“区块链站在一个非常有趣的交叉点。在过去的 15 年中,在存储、CPU 等方面,计算技术一直在加速发展,但是直到最近,网络技术并没有发生太大变化。”他说,“ 区块链不是网络技术、不是数据技术,而是二者兼具。” -Part of the reason for that, over and above the bare fact of blockchain’s ability to securely distribute trusted information across a network, is its place in the technology stack, according to Jay Fallah, CTO and co-founder of NXMLabs, an IoT security startup. +### 区块链和物联网 -“Blockchain stands at a very interesting intersection. Computing has accelerated in the last 15 years [in terms of] storage, CPU, etc, but networking hasn’t changed that much until recently,” he said. “[Blockchain]’s not a network technology, it’s not a data technology, it’s both.” +区块链作为物联网世界的一部分的意义取决于你在和谁交谈以及他们在出售什么,但是最接近的概括可能来自企业区块链供应商 Filament 的首席执行官 Allison Clift-Jenning。 -### Blockchain and IoT** +她说:“在任何地方,人们都想互相信任,并用的是非常古老的方式,这通常是用例入手的好地方。” -** +直接从 Filament 自己的客户群中挑选出来的一个例子是二手车销售。Filament 与“一家主要的底特律汽车制造商”合作,创建了一个受信任的车辆历史平台,该平台基于一种设备,该设备可插入二手车的诊断端口,从那里获取信息,并将该数据写入区块链。像这样,二手车的历史记录就是不可变的,包括它的安全气囊是否曾经打开过,是否被水淹过等等。任何不道德的二手车或不诚实的前车主都无法更改数据,甚至拔掉设备也将意味着记录中存在可疑的空白期。 -Where blockchain makes sense as a part of the IoT world depends on who you speak to and what they are selling, but the closest thing to a general summation may have come from Allison Clift-Jenning, CEO of enterprise blockchain vendor Filament. +SAP 物联网高级副总裁兼全球负责人 Elvira Wallis 表示,当今大多数区块链物联网方案都与信任和数据验证有关。 -“Anywhere where you've got people who are kind of wanting to trust each other, and have very archaic ways of doing it, that is usually a good place to start with use cases,” she said. +她说:“我们遇到的大多数用例都在项目的跟踪和溯源领域,”她举例说明了高端食品的农场到餐桌跟踪系统,该系统使用安装在板条箱和卡车上的区块链节点,这样就可以为物品在运输基础设施中的通过创建无懈可击的记录。(例如,该牛排在这样的温度下冷藏了多长时间,今天运输了多长时间,等等。) -One example, culled directly from Filament’s own customer base, is used car sales. Filament’s working with “a major Detroit automaker” to create a trusted-vehicle history platform, based on a device that plugs into the diagnostic port of a used car, pulls information from there, and writes that data to a blockchain. Just like that, there’s an immutable record of a used car’s history, including whether its airbags have ever been deployed, whether it’s been flooded, and so on. No unscrupulous used car lot or duplicitous former owner could change the data, and even unplugging the device would mean that there’s a suspicious blank period in the records. +### 将区块链与物联网一起使用是个好主意吗? -Most of present-day blockchain IoT implementation is about trust and the validation of data, according to Elvira Wallis, senior vice president and global head of IoT at SAP. +不同的供应商针对不同的用例出售不同的基于区块链的产品,这些产品使用不同的区块链技术实现,其中一些与加密货币中使用的经典的、线性的、挖矿式交易区块链不太一样。 -“Most of the use cases that we have come across are in the realm of tracking and tracing items,” she said, giving the example of a farm-to-fork tracking system for high-end foodstuffs, using blockchain nodes mounted on crates and trucks, allowing for the creation of an un-fudgeable record of an item’s passage through transport infrastructure. (e.g., how long has this steak been refrigerated at such-and-such a temperature, how far has it traveled today, and so on.) +这意味着你目前需要从供应商那里购买特定功能。451 Research 高级分析师 Csilla Zsigri 表示,很少有客户组织拥有可以实施区块链安全系统的内部专家。 -### **Is using blockchain with IoT a good idea?** +她说,区块链技术的任何智能应用的想法都是发挥其优势,为关键信息创建可信赖的平台。 -Different vendors sell different blockchain-based products for different use cases, which use different implementations of blockchain technology, some of which don’t bear much resemblance to the classic, linear, mined-transaction blockchain used in cryptocurrency. +Zsigri 说:“这就是我真正看到增值的地方,只是增加了一层信任和验证。” -That means it’s a capability that you’d buy from a vendor for a specific use case, at this point. Few client organizations have the in-house expertise to implement a blockchain security system, according to 451 Research senior analyst Csilla Zsigri. +专家们一致认为,尽管相当了解基于区块链的物联网应用程序的基本概念,但它并不适用于每个物联网用例。 将区块链应用于非交易系统(尽管有例外,包括 NXM Labs 的用于物联网设备的基于区块链配置的产品)通常不是正确的举动。 -The idea with any intelligent application of blockchain technology is to play to its strengths, she said, creating a trusted platform for critical information. +如果不需要在两个不同的参与方之间共享数据,而是简单地将数据从传感器移到后端,那么区块链通常就没有意义,因为它实际上并没有为当前大多数物联网实现中的数据分析增加任何关键的增值。 -“That’s where I see it really adding value, just in adding a layer of trust and validation,” said Zsigri. - -Yet while the basic idea of blockchain-enabled IoT applications is fairly well understood, it’s not applicable to every IoT use case, experts agree. Applying blockchain to non-transactional systems – although there are exceptions, including NXM Labs’ blockchain-based configuration product for IoT devices – isn’t usually the right move. - -If there isn’t a need to share data between two different parties – as opposed to simply moving data from sensor to back-end – blockchain doesn’t generally make sense, since it doesn’t really do anything for the key value-add present in most IoT implementations today: data analysis. - -“We’re still in kind of the early dial-up era of blockchain today,” said Clift-Jennings. “It’s slower than a typical database, it often isn't even readable, it often doesn't have a query engine tied to it. You don't really get privacy, by nature of it.” - -Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. +“今天,我们仍处于区块链的早期拨号时代。”Clift-Jennings 说,“它比典型的数据库要慢,它甚至无法读取,也常常没有查询引擎。从本质上讲,你并没有真正获得隐私。” -------------------------------------------------------------------------------- @@ -66,8 +58,8 @@ via: https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming 作者:[Jon Gold][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 7355c33887c05f3462296e34836594b48d3caad3 Mon Sep 17 00:00:00 2001 From: guevaraya Date: Thu, 14 Nov 2019 03:58:30 +0800 Subject: [PATCH 458/800] Update 20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申领文章 --- ...91113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md b/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md index e9f4d75755..1f1665d5fe 100644 --- a/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md +++ b/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (guevaraya ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2a60c0a971f1bdf7dfdbb34a88cd41c8b8048a04 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 14 Nov 2019 08:51:30 +0800 Subject: [PATCH 459/800] translated --- ...ompliance Report on CentOS-RHEL Systems.md | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) rename {sources => translated}/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md (63%) diff --git a/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md b/translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md similarity index 63% rename from sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md rename to translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md index 2050ca69bc..c4e92c23cc 100644 --- a/sources/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md +++ b/translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md @@ -7,36 +7,36 @@ [#]: via: (https://www.2daygeek.com/bash-script-to-generate-patching-compliance-report-on-centos-rhel-systems/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Bash Script to Generate Patching Compliance Report on CentOS/RHEL Systems +在 CentOS/RHEL 系统上生成补丁合规报告的 Bash 脚本 ====== -If you are running a large Linux environment you may have already integrated your Red Hat systems with the Satellite. +如果你运行的是大型 Linux 环境,那么你可能已经将 Red Hat 与 Satellite 集成了。 -If yes, there is a way to export this from the Satellite Server so you don’t have to worry about patching compliance reports. +如果是的话,有一种方法可以从 Satellite 服务器导出它,因此不必担心补丁合规性报告。 -But if you are running a small Red Hat environment without satellite integration, or if it is CentOS systems, this script will help you to create a report. +但是,如果你运行的是没有 Satellite 集成的小型 Red Hat 环境,或者它是 CentOS 系统,那么此脚本将帮助你创建报告。 -The patching compliance report is usually created monthly once or three months once, depending on the company’s needs. +补丁合规性报告通常每月创建一次或三个月一次,具体取决于公司的需求。 -Add a cronjob based on your needs to automate this. +根据你的需要添加 cronjob 来自动执行此功能。 -This **[bash script][1]** is generally good to run with less than 50 systems, but there is no limit. +此 [bash 脚本][1] 通常适合于少于 50 个系统运行,但没有限制。 -Keeping the system up-to-date is an important task for Linux administrators, keeping your computer very stable and secure. +保持系统最新是 Linux 管理员的一项重要任务,它使你的计算机非常稳定和安全。 -The following articles may help you to learn more about installing security patches on Red Hat (RHEL) and CentOS systems. +以下文章可以帮助你了解有关在红帽 (RHEL) 和 CentOS 系统上安装安全修补程序的更多详细信息。 - * **[How to check available security updates on Red Hat (RHEL) and CentOS system][2]** - * **[Four ways to install security updates on Red Hat (RHEL) & CentOS systems][3]** - * **[Two methods to check or list out installed security updates on Red Hat (RHEL) & CentOS system][4]** + * **[如何检查红帽 (RHEL) 和 CentOS 系统上的可用安全更新][2]** + * **[在红帽 (RHEL) 和 CentOS 系统上安装安全更新的四种方法][3]** + * **[两种用来检查或列出红帽 (RHEL) 和 CentOS 系统上已安装的安全更新的方法][4]** -Four **[shell scripts][5]** are included in this tutorial and pick the suitable one for you. +此教程中包含四个 [shell 脚本][5],选择适合你的脚本。 -### Method-1: Bash Script to Generate Patching Compliance Report for Security Errata on CentOS/RHEL Systems +### 方法 1:为 CentOS / RHEL 系统上的安全修补生成补丁合规性报告的 Bash 脚本 -This script allows you to create a security errata patch compliance report only. It sends the output via a mail in a plain text. +此脚本只会生成安全修补合规性报告。它会通过纯文本发送邮件。 ``` # vi /opt/scripts/small-scripts/sec-errata.sh @@ -58,13 +58,13 @@ echo "+---------------------------------------------+" >> $MESSAGE mail -s "$SUBJECT" "$TO" < $MESSAGE ``` -Run the script file once you have added the above script. +添加完上面的脚本后运行它。 ``` # sh /opt/scripts/small-scripts/sec-errata.sh ``` -You get an output like the one below. +你会看到下面的输出。 ``` # cat /tmp/sec-up.txt @@ -79,7 +79,7 @@ server4 +-----------------------------------+ ``` -Add the following cronjob to get the patching compliance report once a month. +现价下面的 cronjob 来每个月得到一份补丁合规性报告。 ``` # crontab -e @@ -87,9 +87,9 @@ Add the following cronjob to get the patching compliance report once a month. @monthly /bin/bash /opt/scripts/system-uptime-script-1.sh ``` -### Method-1a: Bash Script to Generate Patching Compliance Report for Security Errata on CentOS/RHEL Systems +### 方法 1a:为 CentOS / RHEL 系统上的安全修补生成补丁合规性报告的 Bash 脚本 -This script allows you to generate a security errata patch compliance report. It sends the output through a mail with the CSV file. +脚本会为你生成安全修补合规性报告。它会通过 CSV 文件发送邮件。 ``` # vi /opt/scripts/small-scripts/sec-errata-1.sh @@ -105,19 +105,19 @@ echo "Patching Report for `date +"%B %Y"`" | mailx -s "Patching Report on `date` rm /tmp/sec-up.csv ``` -Run the script file once you have added the above script. +添加完上面的脚本后运行它。 ``` # sh /opt/scripts/small-scripts/sec-errata-1.sh ``` -You get an output like the one below. +你会看到下面的输出。 ![][6] -### Method-2: Bash Script to Generate Patching Compliance Report for Security Errata, Bugfix, and Enhancement on CentOS/RHEL Systems +### 方法 2:为 CentOS / RHEL 系统上的安全修补、bugfix、增强生成补丁合规性报告的 Bash 脚本 -This script allows you to generate patching compliance reports for Security Errata, Bugfix, and Enhancement. It sends the output via a mail in a plain text. +脚本会为你生成安全修补、bugfix、增强的补丁合规性报告。它会通过纯文本发送邮件。 ``` # vi /opt/scripts/small-scripts/sec-errata-bugfix-enhancement.sh @@ -141,13 +141,13 @@ echo "+------------------------------------------------------------------+" >> $ mail -s "$SUBJECT" "$TO" < $MESSAGE ``` -Run the script file once you have added the above script. +添加完上面的脚本后运行它。 ``` # sh /opt/scripts/small-scripts/sec-errata-bugfix-enhancement.sh ``` -You get an output like the one below. +你会看到下面的输出。 ``` # cat /tmp/sec-up.txt @@ -162,7 +162,7 @@ server04 16 +------------------------------------------------------------------+ ``` -Add the following cronjob to get the patching compliance report once every three months. This script is scheduled to run on the 1’st of January, April, July and October months. +添加下面的 cronjob 来每三个月得到补丁合规性报告。该脚本计划在一月、四月、七月、十月的 1 号运行。 ``` # crontab -e @@ -170,9 +170,9 @@ Add the following cronjob to get the patching compliance report once every three 0 0 01 */3 * /bin/bash /opt/scripts/system-uptime-script-1.sh ``` -### Method-2a: Bash Script to Generate Patching Compliance Report for Security Errata, Bugfix, and Enhancement on CentOS/RHEL Systems +### 方法 2a:为 CentOS / RHEL 系统上的安全修补、bugfix、增强生成补丁合规性报告的 Bash 脚本 -This script allows you to generate patching compliance reports for Security Errata, Bugfix, and Enhancement. It sends the output through a mail with the CSV file. +脚本会为你生成安全修补、bugfix、增强的补丁合规性报告。它会通过 CSV 文件发送邮件。 ``` # vi /opt/scripts/small-scripts/sec-errata-bugfix-enhancement-1.sh @@ -190,13 +190,13 @@ echo "Patching Report for `date +"%B %Y"`" | mailx -s "Patching Report on `date` rm /tmp/sec-up.csv ``` -Run the script file once you have added the above script. +添加完上面的脚本后运行它。 ``` # sh /opt/scripts/small-scripts/sec-errata-bugfix-enhancement-1.sh ``` -You get an output like the one below. +你会看到下面的输出。 ![][6] @@ -206,7 +206,7 @@ via: https://www.2daygeek.com/bash-script-to-generate-patching-compliance-report 作者:[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 5a7dbba677b0d5a674e7b4023c0a27964d42e825 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 14 Nov 2019 09:03:24 +0800 Subject: [PATCH 460/800] translating --- sources/tech/20191112 Getting started with PostgreSQL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191112 Getting started with PostgreSQL.md b/sources/tech/20191112 Getting started with PostgreSQL.md index 79945ae3d3..48f7896c02 100644 --- a/sources/tech/20191112 Getting started with PostgreSQL.md +++ b/sources/tech/20191112 Getting started with PostgreSQL.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c5cb6bbca7050e8f65a30e34637b1a39b41d4aae Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Nov 2019 10:04:51 +0800 Subject: [PATCH 461/800] Rename sources/tech/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md to sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md --- ...icrosoft Defender ATP is Coming to Linux- What Does it Mean.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md (100%) diff --git a/sources/tech/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md b/sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md similarity index 100% rename from sources/tech/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md rename to sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md From 7b725d0fb32bd83d4f70da28394c2ac4cf6cae4d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Nov 2019 10:07:33 +0800 Subject: [PATCH 462/800] Rename sources/tech/20191113 How to drive customer experience with agile principles.md to sources/talk/20191113 How to drive customer experience with agile principles.md --- ...1113 How to drive customer experience with agile principles.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191113 How to drive customer experience with agile principles.md (100%) diff --git a/sources/tech/20191113 How to drive customer experience with agile principles.md b/sources/talk/20191113 How to drive customer experience with agile principles.md similarity index 100% rename from sources/tech/20191113 How to drive customer experience with agile principles.md rename to sources/talk/20191113 How to drive customer experience with agile principles.md From 84d3170d20e68c0fa17e9d48b928279cd89b63ba Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 14 Nov 2019 10:11:45 +0800 Subject: [PATCH 463/800] Rename sources/tech/20191112 GitHub report surprises, serverless hotness, and more industry trends.md to sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md --- ...ort surprises, serverless hotness, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191112 GitHub report surprises, serverless hotness, and more industry trends.md (100%) diff --git a/sources/tech/20191112 GitHub report surprises, serverless hotness, and more industry trends.md b/sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md similarity index 100% rename from sources/tech/20191112 GitHub report surprises, serverless hotness, and more industry trends.md rename to sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md From 8b74d976c711b0c034a982638ff448ccdabc8671 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 14 Nov 2019 16:14:50 +0800 Subject: [PATCH 464/800] PRF @wxy --- ...) coming to an IoT implementation near you.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md b/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md index 5b67a9960e..8a343e73c1 100644 --- a/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md +++ b/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md @@ -12,33 +12,33 @@ ![MF3D / Getty Images][1] -各个公司发现,物联网与最近其他许多流行的企业计算技术有着良好的合作关系,以支持加密货币而闻名的分布式信任创新系统的区块链也不例外。然而,在物联网应用中实施区块链可能具有挑战性,并且需要对技术有深入的了解。 +各个公司发现,物联网与最近其他许多流行的企业级计算技术有着良好的合作关系,以支持加密货币而闻名的创新的分布式信任系统的区块链也不例外。然而,在物联网应用中实施区块链可能具有挑战性,并且需要对技术有深入的了解。 区块链是一个跟踪各种交易的分布式账本。链上的每个“块”都包含要防止篡改的交易记录或其他数据,并通过加密散列链接到前一个,这意味着对块的任何篡改都将使该链接无效。节点(几乎可以是其中装有 CPU 的任何节点)通过分布式的对等网络进行通信,以共享数据并确保链中数据的有效性。 -北卡罗来纳大学格林波若分校的管理学教授 Nir Kshetri 表示,该系统之所以有效,是因为所有的块都必须就它们所保护的数据的细节达成一致。如果有人尝试更改给定节点上的先前事务,则网络上的其余数据将会被回推回来。“数据的旧记录仍然存在,” Kshetri 说。 +北卡罗来纳大学格林波若分校的管理学教授 Nir Kshetri 表示,区块链系统之所以有效,是因为所有的块都必须就它们所保护的数据的细节达成一致。如果有人尝试更改给定节点上先前的事务,则存储在网络上的其余数据会回推回来。“数据的旧记录仍然存在,” Kshetri 说。 这是一项强大的安全技术 —— 如果没有坏人成功控制给定区块链上的所有(LCTT 译注:应为“大部分”)节点([著名的“51% 攻击”][4]),那么该区块链保护的数据就不会被伪造或以其他方式弄乱。因此,对于在物联网世界某些角落的公司来说,使用区块链是一种有吸引力的选择也就不足为奇了。 -物联网安全初创企业 NXMLabs 的首席技术官兼联合创始人 Jay Fallah 认为,除了区块链能够在网络上安全分发可信信息的能力这一事实之外,部分原因还在于区块链在技术堆栈中的地位。 +物联网安全初创企业 NXMLabs 的首席技术官兼联合创始人 Jay Fallah 认为,除了区块链能够在网络上安全地分发可信信息的能力这一事实之外,部分原因还在于区块链在技术堆栈中的地位。 “区块链站在一个非常有趣的交叉点。在过去的 15 年中,在存储、CPU 等方面,计算技术一直在加速发展,但是直到最近,网络技术并没有发生太大变化。”他说,“ 区块链不是网络技术、不是数据技术,而是二者兼具。” ### 区块链和物联网 -区块链作为物联网世界的一部分的意义取决于你在和谁交谈以及他们在出售什么,但是最接近的概括可能来自企业区块链供应商 Filament 的首席执行官 Allison Clift-Jenning。 +区块链作为物联网世界的部分意义取决于你在和谁交谈以及他们在出售什么,但是最接近的概括可能来自企业区块链供应商 Filament 的首席执行官 Allison Clift-Jenning。 -她说:“在任何地方,人们都想互相信任,并用的是非常古老的方式,这通常是用例入手的好地方。” +她说:“在任何地方,人们都想互相信任,并且用的是非常古老的方式,这通常是进入场景的好地方。” 直接从 Filament 自己的客户群中挑选出来的一个例子是二手车销售。Filament 与“一家主要的底特律汽车制造商”合作,创建了一个受信任的车辆历史平台,该平台基于一种设备,该设备可插入二手车的诊断端口,从那里获取信息,并将该数据写入区块链。像这样,二手车的历史记录就是不可变的,包括它的安全气囊是否曾经打开过,是否被水淹过等等。任何不道德的二手车或不诚实的前车主都无法更改数据,甚至拔掉设备也将意味着记录中存在可疑的空白期。 SAP 物联网高级副总裁兼全球负责人 Elvira Wallis 表示,当今大多数区块链物联网方案都与信任和数据验证有关。 -她说:“我们遇到的大多数用例都在项目的跟踪和溯源领域,”她举例说明了高端食品的农场到餐桌跟踪系统,该系统使用安装在板条箱和卡车上的区块链节点,这样就可以为物品在运输基础设施中的通过创建无懈可击的记录。(例如,该牛排在这样的温度下冷藏了多长时间,今天运输了多长时间,等等。) +她说:“我们遇到的大多数用例都在项目的跟踪和溯源领域,”她举例说明了高端食品的农场到餐桌跟踪系统,该系统使用安装在板条箱和卡车上的区块链节点,这样就可以为物品在运输基础设施中创建无懈可击的记录。(例如,该牛排在这样的温度下冷藏了多长时间,今天运输了多长时间,等等。) ### 将区块链与物联网一起使用是个好主意吗? -不同的供应商针对不同的用例出售不同的基于区块链的产品,这些产品使用不同的区块链技术实现,其中一些与加密货币中使用的经典的、线性的、挖矿式交易区块链不太一样。 +不同的供应商针对不同的用例出售不同的基于区块链的产品,这些产品使用不同的区块链技术实现,其中一些与加密货币中所使用的经典的、线性的、挖矿式交易区块链不太一样。 这意味着你目前需要从供应商那里购买特定功能。451 Research 高级分析师 Csilla Zsigri 表示,很少有客户组织拥有可以实施区块链安全系统的内部专家。 @@ -54,7 +54,7 @@ Zsigri 说:“这就是我真正看到增值的地方,只是增加了一层 -------------------------------------------------------------------------------- -via: https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html#tk.rss_all +via: https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html 作者:[Jon Gold][a] 选题:[lujun9972][b] From 0369d1e45bf93c58e081fdb6059099ef8ad2a7ac Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 14 Nov 2019 16:16:59 +0800 Subject: [PATCH 465/800] PUB @wxy https://linux.cn/article-11575-1.html --- ...n (might be) coming to an IoT implementation near you.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/talk => published}/20190404 Why blockchain (might be) coming to an IoT implementation near you.md (97%) diff --git a/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md b/published/20190404 Why blockchain (might be) coming to an IoT implementation near you.md similarity index 97% rename from translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md rename to published/20190404 Why blockchain (might be) coming to an IoT implementation near you.md index 8a343e73c1..4a23ddda05 100644 --- a/translated/talk/20190404 Why blockchain (might be) coming to an IoT implementation near you.md +++ b/published/20190404 Why blockchain (might be) coming to an IoT implementation near you.md @@ -1,10 +1,10 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11575-1.html) [#]: subject: (Why blockchain (might be) coming to an IoT implementation near you) -[#]: via: (https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html#tk.rss_all) +[#]: via: (https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html) [#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) 为什么区块链(可能会)来到你身边的物联网 From 7cdd006f52b357b473caf4c1add16a11c6dce5e0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 14 Nov 2019 17:26:59 +0800 Subject: [PATCH 466/800] APL --- ...rosoft Defender ATP is Coming to Linux- What Does it Mean.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md b/sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md index 43693db00d..3b92bf6cd8 100644 --- a/sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md +++ b/sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c4858bdf8e4a98e5955061aa3724135d8ae9a8df Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 14 Nov 2019 18:38:35 +0800 Subject: [PATCH 467/800] TSL&PRF --- ...P is Coming to Linux- What Does it Mean.md | 64 ------------------ ...P is Coming to Linux- What Does it Mean.md | 66 +++++++++++++++++++ 2 files changed, 66 insertions(+), 64 deletions(-) delete mode 100644 sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md create mode 100644 translated/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md diff --git a/sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md b/sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md deleted file mode 100644 index 3b92bf6cd8..0000000000 --- a/sources/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Microsoft Defender ATP is Coming to Linux! What Does it Mean?) -[#]: via: (https://itsfoss.com/microsoft-defender-atp-linux/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Microsoft Defender ATP is Coming to Linux! What Does it Mean? -====== - -_**Microsoft has announced that it is bringing its enterprise security product Microsoft Defender Advanced Threat Protection (ATP) to Linux in 2020.**_ - -Microsoft’s annual developer conference Microsoft Ignite has just been concluded and there are a few important announcements that relate to Linux. You probably already read about [Microsoft bringing its Edge web browser to Linux][1]. The next big news is that Microsoft is bringing Microsoft Defender ATP to Linux. - -Let’s get into some details what it is and why Microsoft is bothering itself to develop something for Linux. - -### What is Microsoft Defender ATP? - -If you have used Windows in past few years, you must have come across Windows Defender. It is basically an antivirus product by Microsoft that brings some level of security by detecting viruses and malware. - -Microsoft improved this functionality for its enterprise users by introducing Windows Defender ATP (Advanced Threat Protection). Defender ATP works on behavioral analysis. It collects usage data and store them on the same system. However, when it notices an inconsistent behavior, it sends the data to Azure service (Microsoft’s cloud service). In here, it will have a collection of behavioral data and the anomalies. - -For example, if you got a PDF attachment in the email, you open it and it opened a command prompt, Defender ATP will notice this abnormal behavior. I recommend reading this article to [learn more about the difference between Defender and Defender ATP][2]. - -Now this is entirely an enterprise product. In a big enterprise with hundreds or thousands of end points (computers), Defender ATP provides a good layer of protection. The IT admins will have a centralized view of the end-points on their Azure instance and the threats can be analyzed and actions can be taken accordingly. - -### Microsoft Defender ATP for Linux (and Mac) - -Normally, enterprises have Windows on their computer but Mac and Linux are also getting popular specially among the developers. In an environment where there is a mix of Mac and Linux machines among Windows, Defender ATP has to extends its services to these operating systems so that it can provide a holistic defense to all the devices on the network. - -Keeping that in mind, Microsoft first [changed Windows Defender ATP to Microsoft Defender ATP in March 201][3][9][3], signaling that the product is not limited to just Windows operating system. - -Soon after it [announced Defender ATP for Mac][4]. - -And now to cover all the major operating systems in an enterprise environment, [Microsoft is bringing Defender ATP to Linux][5] in 2020. - -### How Microsoft Defender ATP on Linux impacts you, a Linux user? - -Since Defender ATP is an enterprise product, I don’t think you need to be bothered with this. Organizations need to secure their end-points against threats so it makes sense that Microsoft is improving its product to cover Linux as well. - -For normal Linux users like you and me, it won’t make any difference. I am not going to use it ‘secure’ my three Linux systems and pay Microsoft for that. - -Please feel free to share your opinion on Microsoft bringing Defender ATP to Linux in the comment section. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/microsoft-defender-atp-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/microsoft-edge-linux/ -[2]: https://www.concurrency.com/blog/november-2017/windows-defender-vs-windows-defender-atp -[3]: https://www.theregister.co.uk/2019/03/21/microsoft_defender_atp/ -[4]: https://techcommunity.microsoft.com/t5/Microsoft-Defender-ATP/Announcing-Microsoft-Defender-ATP-for-Mac/ba-p/378010 -[5]: https://www.zdnet.com/article/microsoft-defender-atp-is-coming-to-linux-in-2020/ diff --git a/translated/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md b/translated/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md new file mode 100644 index 0000000000..0002bdd974 --- /dev/null +++ b/translated/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Microsoft Defender ATP is Coming to Linux! What Does it Mean?) +[#]: via: (https://itsfoss.com/microsoft-defender-atp-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +微软 Defender ATP 要出 Linux 版了! +====== + +> 微软宣布将于 2020 年将其企业安全产品 Defender 高级威胁防护(ATP)引入 Linux。 + +![](https://img.linux.net.cn/data/attachment/album/201911/14/183733rllau7hvkgzkuwgg.jpg) + +微软的年度开发者大会 Microsoft Ignite 刚刚结束,会上发布了一些与 Linux 有关的重要公告。你可能已经知道[微软将 Edge Web 浏览器引入 Linux][1],而下一个大新闻是微软将 Defender ATP 引入 Linux! + +让我们详细介绍一下它是什么,以及微软为何不厌其烦为 Linux 开发某些东西。 + +### 微软 Defender ATP 是什么? + +如果你过去几年使用过 Windows,那么你一定遇到过 Windows Defender。它基本上可以说是微软的防病毒产品,通过检测病毒和恶意软件来提供一定程度的安全性。 + +微软通过引入 Windows Defender ATP(高级威胁防护)来为其企业用户改进了此功能。Defender ATP 致力于行为分析。它收集使用使用数据并将其存储在同一系统上。但是,当发现行为不一致时,它将数据发送到 Azure 服务(微软的云服务)。在这里,它将收集行为数据和异常信息。 + +例如,如果你收到一封包含 PDF 附件的电子邮件,你将其打开并打开了命令提示符,Defender ATP 就会注意到此异常行为。我建议[阅读本文以了解有关 Defender 和 Defender ATP 之间的区别的更多信息] [2]。 + +现在,这完全是一种企业级产品。在具有成百上千个端点(计算机)的大型企业中,Defender ATP 提供了很好的保护层。IT 管理员可以在其 Azure 实例上集中查看端点的视图,可以分析威胁并采取相应措施。 + +### 适用于 Linux(和 Mac)的微软 Defender ATP + +通常,企业的计算机上装有 Windows,但 Mac 和 Linux 在开发人员中也特别受欢迎。在混合了 Mac 和 Linux 的 Windows 机器环境中,Defender ATP 必须将其服务扩展到这些操作系统,以便它可以为网络上的所有设备提供整体防御。 + +请注意,微软先是[在 2019 年 3 月将 Windows Defender ATP 更改为微软 Defender ATP][3],这表明该产品不仅限于 Windows 操作系统。 + +此后不久微软[宣布推出 Mac 版 Defender ATP][4]。 + +现在,为了涵盖企业环境中的所有主要操作系统,[微软将于 2020 年将 Defender ATP 引入到 Linux][5]。 + +### Linux 上的微软 Defender ATP 对 Linux 用户有何影响? + +由于 Defender ATP 是企业产品,因此我认为你无需为此而烦恼。组织需要保护其端点免受威胁,因此,微软也在改进其产品以使其涵盖 Linux。 + +对于像你我这样的普通 Linux 用户,这没有任何区别。我不会用它“保护”我的三个 Linux 系统,并为此而向微软付费。 + +请随时在评论部分中分享你对微软将 Defender ATP 引入 Linux 的看法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/microsoft-defender-atp-linux/ + +作者:[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/microsoft-edge-linux/ +[2]: https://www.concurrency.com/blog/november-2017/windows-defender-vs-windows-defender-atp +[3]: https://www.theregister.co.uk/2019/03/21/microsoft_defender_atp/ +[4]: https://techcommunity.microsoft.com/t5/Microsoft-Defender-ATP/Announcing-Microsoft-Defender-ATP-for-Mac/ba-p/378010 +[5]: https://www.zdnet.com/article/microsoft-defender-atp-is-coming-to-linux-in-2020/ From 245cf050b5bd927f85c61eb26ecb0a2422bcfdd9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 14 Nov 2019 18:39:59 +0800 Subject: [PATCH 468/800] PUB @wxy https://linux.cn/article-11576-1.html --- ...soft Defender ATP is Coming to Linux- What Does it Mean.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md (98%) diff --git a/translated/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md b/published/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md similarity index 98% rename from translated/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md rename to published/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md index 0002bdd974..4c755bdcf7 100644 --- a/translated/news/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md +++ b/published/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11576-1.html) [#]: subject: (Microsoft Defender ATP is Coming to Linux! What Does it Mean?) [#]: via: (https://itsfoss.com/microsoft-defender-atp-linux/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) From dbcf3c20620185ac50ca30abec7f4447ec19ada3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 14 Nov 2019 21:44:19 +0800 Subject: [PATCH 469/800] APL --- .../talk/20191025 Why I made the switch from Mac to Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191025 Why I made the switch from Mac to Linux.md b/sources/talk/20191025 Why I made the switch from Mac to Linux.md index 342a6c9bd3..f2e022ba84 100644 --- a/sources/talk/20191025 Why I made the switch from Mac to Linux.md +++ b/sources/talk/20191025 Why I made the switch from Mac to Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 540f028e7c4ba1f9b5ad025b2141d7edeba1744d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 14 Nov 2019 23:57:14 +0800 Subject: [PATCH 470/800] TSL&PRF --- ...Why I made the switch from Mac to Linux.md | 77 ------------------ ...Why I made the switch from Mac to Linux.md | 79 +++++++++++++++++++ 2 files changed, 79 insertions(+), 77 deletions(-) delete mode 100644 sources/talk/20191025 Why I made the switch from Mac to Linux.md create mode 100644 translated/talk/20191025 Why I made the switch from Mac to Linux.md diff --git a/sources/talk/20191025 Why I made the switch from Mac to Linux.md b/sources/talk/20191025 Why I made the switch from Mac to Linux.md deleted file mode 100644 index f2e022ba84..0000000000 --- a/sources/talk/20191025 Why I made the switch from Mac to Linux.md +++ /dev/null @@ -1,77 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why I made the switch from Mac to Linux) -[#]: via: (https://opensource.com/article/19/10/why-switch-mac-linux) -[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) - -Why I made the switch from Mac to Linux -====== -Thanks to a lot of open source developers, it's a lot easier to use -Linux as your daily driver than ever before. -![Hands programming][1] - -I have been a huge Mac fan and power user since I started in IT in 2004. But a few months ago—for several reasons—I made the commitment to shift to Linux as my daily driver. This isn't my first attempt at fully adopting Linux, but I'm finding it easier than ever. Here is what inspired me to switch. - -### My first attempt at Linux on the desktop - -I remember looking up at the projector, and it looking back at me. Neither of us understood why it wouldn't display. VGA cords were fully seated with no bent pins to be found. I tapped every key combination I could think of to signal my laptop that it's time to get over the stage fright. - -I ran Linux in college as an experiment. My manager in the IT department was an advocate for the many flavors out there, and as I grew more confident in desktop support and writing scripts, I wanted to learn more about it. IT was far more interesting to me than my computer science degree program, which felt so abstract and theoretical—"who cares about binary search trees?" I thought—while our sysadmin team's work felt so tangible. - -This story ends with me logging into a Windows workstation to get through my presentation for class, and marks the end of my first attempt at Linux as my day-to-day OS. I admired its flexibility, but compatibility was lacking. I would occasionally write a script that SSHed into a box to run another script, but I stopped using Linux on a day-to-day basis. - -### A fresh look at Linux compatibility - -When I decided to give Linux another go a few months ago, I expected more of the same compatibility nightmare, but I couldn't be more wrong. - -Right after the installation process completed, I plugged in a USB-C hub to see what I'd gotten myself into. Everything worked immediately. The HDMI-connected extra-wide monitor popped up as a mirrored display to my laptop screen, and I easily adjusted it to be a second monitor. The USB-connected webcam, which is essential to my [work-from-home life][2], showed up as a video with no trouble at all. Even my Mac charger, which was already plugged into the hub since I've been using a Mac, started to charge my very-not-Mac hardware. - -My positive experience was probably related to some updates to USB-C, which received some needed attention in 2018 to compete with other OS experiences. As [Phoronix explained][3]: - -> "The USB Type-C interface offers an 'Alternate Mode' extension for non-USB signaling and the biggest user of this alternate mode in the specification is allowing DisplayPort support. Besides DP, another alternate mode is the Thunderbolt 3 support. The DisplayPort Alt Mode supports 4K and even 8Kx4K video output, including multi-channel audio. -> -> "While USB-C alternate modes and DisplayPort have been around for a while now and is common in the Windows space, the mainline Linux kernel hasn't supported this functionality. Fortunately, thanks to Intel, that is now changing." - -Thinking beyond ports, a quick scroll through the [Linux on Laptops][4] hardware options shows a much more complete set of choices than I experienced in the early 2000s. - -This has been a night-and-day difference from my first attempt at Linux adoption, and it's one I welcome with open arms. - -### Breaking out of Apple's walled garden - -Using Linux has added new friction to my daily workflow, and I love that it has. - -My Mac workflow was seamless: hop on an iPad in the morning, write down some thoughts on what my day will look like, and start to read some articles in Safari; slide over my iPhone to continue reading; then log into my MacBook where years of fine-tuning have worked out how all these pieces connect. Keyboard shortcuts are built into my brain; user experiences are as they've mostly always been. It's wildly comfortable. - -That comfort comes with a cost. I largely forgot how my environment functions, and I couldn't answer questions I wanted to answer. Did I customize some [PLIST files][5] to get that custom shortcut, or did I remember to check it into [my dotfiles][6]? How did I get so dependent on Safari and Chrome when Firefox has a much better mission? Or why, specifically, won't I use an Android-based phone instead of my i-things? - -On that note, I've often thought about shifting to an Android-based phone, but I would lose the connection I have across all these devices and the little conveniences designed into the ecosystem. For instance, I wouldn't be able to type in searches from my iPhone for the Apple TV or share a password with AirDrop with my other Apple-based friends. Those features are great benefits of homogeneous device environments, and it is remarkable engineering. That said, these conveniences come at a cost of feeling trapped by the ecosystem. - -I love being curious about how devices work. I want to be able to explain environmental configurations that make it fun or easy to use my systems, but I also want to see what adding some friction does for my perspective. To paraphrase [Marcel Proust][7], "The real voyage of discovery consists not in seeking new lands but seeing with new eyes." My use of technology has been so convenient that I stopped being curious about how it all works. Linux gives me an opportunity to see with new eyes again. - -### Inspired by you - -All of the above is reason enough to explore Linux, but I have also been inspired by you. While all operating systems are welcome in the open source community, Opensource.com writers' and readers' joy for Linux is infectious. It inspired me to dive back in, and I'm enjoying the journey. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/why-switch-mac-linux - -作者:[Matthew Broberg][a] -选题:[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/mbbroberg -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) -[2]: https://opensource.com/article/19/8/rules-remote-work-sanity -[3]: https://www.phoronix.com/scan.php?page=news_item&px=Linux-USB-Type-C-Port-DP-Driver -[4]: https://www.linux-laptop.net/ -[5]: https://fileinfo.com/extension/plist -[6]: https://opensource.com/article/19/3/move-your-dotfiles-version-control -[7]: https://www.age-of-the-sage.org/quotations/proust_having_seeing_with_new_eyes.html diff --git a/translated/talk/20191025 Why I made the switch from Mac to Linux.md b/translated/talk/20191025 Why I made the switch from Mac to Linux.md new file mode 100644 index 0000000000..fba4581795 --- /dev/null +++ b/translated/talk/20191025 Why I made the switch from Mac to Linux.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I made the switch from Mac to Linux) +[#]: via: (https://opensource.com/article/19/10/why-switch-mac-linux) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +为什么我从 Mac 换到了 Linux +====== + +> 感谢这么多的开源开发人员,使用 Linux 作为日常使用比以往任何时候都容易得多。 + +![Hands programming][1] + +自 2004 年开始从事 IT 工作以来,我一直是 Mac 的忠实粉丝。但是几个月前,由于种种原因,我决定将 Linux 用作日常使用。这不是我第一次尝试完全采用 Linux,但是我发现它比以往更容易。这就是促使我转换的原因。 + +### 我在个人电脑上的第一次的 Linux 尝试 + +我记得我抬头看着投影机,而它和我面面相觑。我们俩都不明白为什么它不会显示。VGA 线完全接好了,针脚也没有弯折。我按了我可能想到的所有按键组合,以向笔记本电脑发出信号,想让它克服舞台恐惧症。 + +我在大学里运行 Linux 只是作为实验。我在 IT 部门的经理是多种口味的倡导者,随着我对桌面支持和编写脚本的信心增强,我想了解更多有关它的信息。对我来说,IT 比我的计算机科学学位课程有趣得多,课程感觉是如此抽象和理论化:“二叉树有啥用?”,我如是想 —— 而我们的系统管理员团队的工作却是如此的切实。 + +这个故事的结尾是,我登录 Windows 工作站通过了我的课堂演讲,标志着我将 Linux 作为我的日常操作系统的第一次尝试的终结。我很欣赏 Linux 的灵活性,但是它缺乏兼容性。我偶尔会写一个脚本,该脚本通过 SSH 连接到一个机器中以运行另一个脚本,但是我对 Linux 的日常使用仅止于此。 + +### Linux 兼容性的全新印象 + +几个月前,当我决定再试一次 Linux 时,我曾觉得我遇到更多的兼容性噩梦,但我错了。 + +安装过程完成后,我立即插入 USB-C 集线器以了解兼容性到底如何。一切立即工作。连接 HDMI 的超宽显示器作为镜像显示器弹出到我的笔记本电脑屏幕上,我轻松地将其调整为第二台显示器。USB 连接的网络摄像头对我的[在家工作方式][2]至关重要,它可以毫无问题地显示视频。甚至自从我使用 Mac 以来就一直插在集线器的 Mac 充电器可以为我非常不 Mac 的硬件充电。 + +我的正面经历可能与 USB-C 的一些更新有关,它在 2018 年得到一些需要的关注,因此才能与其他 OS 体验相媲美。如 [Phoronix 解释的那样][3]: + +> “USB Type-C 接口为非 USB 信号提供了‘替代模式’扩展,在规范中该替代模式的最大使用场景是允许 DisplayPort。除此之外,另一个替代模式是 Thunderbolt 3 的支持。DisplayPort 替代模式支持 4K甚至 8Kx4K 的视频输出,包括多声道音频。 +> +> “虽然 USB-C 替代模式和 DisplayPort 已经存在了一段时间,并且在 Windows 上很常见,但是主线 Linux 内核不支持此功能。所幸的是,多亏英特尔,这种情况正在改变。” +> + +而在端口之外,快速浏览一下 [笔记本电脑 Linux][4] 的硬件选择,可以显示比我 2000 年代初期经历的更加完整的选择集。 + +与我第一次尝试采用 Linux 相比,这已经天差地别,这是我所张开双臂欢迎的。 + +### 突破 Apple 的樊篱 + +使用 Linux 给我的日常工作流程增加了一些新的麻烦,而我喜欢这种麻烦。 + +我的 Mac 工作流程是无缝的:早上打开 iPad,写下关于我今天想要做什么的想法,然后开始在 Safari 中阅读一些文章;转到我的 iPhone 上继续阅读;然后登录我的 MacBook,这些地方我进行了多年的微调,已经弄清楚了所有这些部分之间的连接方式。键盘快捷键已内置在我的大脑中;用户体验一如既往。简直不要太舒服了。 + +这种舒适需要付出代价。我基本上忘记了我的环境如何运作的,无法回答我想回答的问题。我是否自定义了一些 [PLIST 文件][5]以获得快捷方式,还是记得将其签入[我的 dotfiles][6] 当中?当 Firefox 的功能更好时,我如何还如此依赖 Safari 和 Chrome?或为什么我不使用基于 Android 的手机代替我的 i-系列产品呢? + +关于这一点,我经常考虑过改用基于 Android 的手机,但是我会失去在所有这些设备之间的连接以及为这种生态系统设计的一些便利。例如,我将无法在 iPhone 上为 Apple TV 输入搜索内容,也无法与其他基于 Apple 的朋友共享 AirDrop 密码。这些功能是同类设备环境的巨大好处,并且是一项了不起的工程。就是说,这些便利是被生态系统所困的代价。 + +我喜欢了解设备的工作方式。我希望能够解释使我的系统变得有趣或容易使用的环境配置,但我也想看看增加一些麻烦对我的观点有什么影响。用 [Marcel Proust][7] 来解释,“真正的发现之旅不在于寻找新的土地,而在于用新的眼光来看待。”我对技术的使用是如此的方便,以至于我不再对它的工作原理感到好奇。Linux 使我有机会再次有了新的眼光。 + +### 受你的启发 + +以上所有内容足以成为探索 Linux 的理由,但我也受到了你的启发。尽管所有操作系统都受到开源社区的欢迎,但 Opensource.com 的作者和读者对 Linux 的喜悦是充满感染力的。它激发了我重新潜入的乐趣,我享受这段旅途的乐趣。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/why-switch-mac-linux + +作者:[Matthew Broberg][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/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/article/19/8/rules-remote-work-sanity +[3]: https://www.phoronix.com/scan.php?page=news_item&px=Linux-USB-Type-C-Port-DP-Driver +[4]: https://www.linux-laptop.net/ +[5]: https://fileinfo.com/extension/plist +[6]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[7]: https://www.age-of-the-sage.org/quotations/proust_having_seeing_with_new_eyes.html From d6a9157b805315c65a4b00b14a86dbb2208231d1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 Nov 2019 08:59:01 +0800 Subject: [PATCH 471/800] translated --- ...e Tools that will help in AI Technology.md | 164 ----------------- ...e Tools that will help in AI Technology.md | 165 ++++++++++++++++++ 2 files changed, 165 insertions(+), 164 deletions(-) delete mode 100644 sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md create mode 100644 translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md diff --git a/sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md b/sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md deleted file mode 100644 index 10d04bdae4..0000000000 --- a/sources/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md +++ /dev/null @@ -1,164 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 Best Open Source Tools that will help in AI Technology) -[#]: via: (https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/) -[#]: author: (Nitin Garg https://opensourceforu.com/author/nitin-garg/) - -7 Best Open Source Tools that will help in AI Technology -====== - -[![][1]][2] - -_Artificial intelligence is an exceptional technology following the futuristic approach. In this progressive era, it’s capturing the attention of all the multination organizations. Some of the popular names in the industry like Google, IBM, Facebook, Amazon, Microsoft constantly investing in this new-age technology._ - -Anticipate in business needs using artificial intelligence and take research and development on another level. This advanced technology is becoming an integral part of organizations in research and development offering ultra-intelligent solutions. It helps you maintain accuracy and increase productivity with better results. - -AI open source tools and technologies are capturing the attention of every industry providing with frequent and accurate results. These tools help you analyse your performance while providing you with a boost to generate greater revenue. - -Without further ado, here we have listed some of the best open-source tools to help you understand artificial intelligence better. - -**1\. TensorFlow** - -TensorFlow is an open-source machine learning framework used for Artificial Intelligence. It is basically developed to conduct machine learning and deep learning for research and production. TensorFlow allows developers to create dataflow graphics structure, It moves through a network or a system node, and the graph provides a multidimensional array or tensor of data. - -TensorFlow is an exceptional tool that offers countless advantages. - - * Simplifies the numeric computation - * TensorFlow offers flexibility on multiple models. - * TensorFlow improves business efficiency - * Highly portable - * Automatic differentiate capabilities. - - - -**2\. Apache SystemML** - -Apache SystemML is a very popular open-source machine learning platform created by IBM offering a favourable workplace using big data. It can run efficiently and on Apache Spark and automatically scale your data while determining whether your code can run on the drive or Apache Spark Cluster. Not just that, its lucrative features make it stand out in the industry offers; - - * Algorithms customization - * Multiple Execution Modes - * Automatic Optimisation - - - -It also supports deep learning while enabling developers to implement machine learning code and optimizing it with more effectiveness. - -**3\. OpenNN** - -OpenNN is an open-source artificial intelligence neural network library for progressive analytics. It helps you develop robust models with C++ and Python while containing algorithms and utilities to deal with machine learning solutions likes forecasting and classification. It also covers regression and association providing high performance and technology evolution in the industry. - -It possesses numerous lucrative features like; - - * Digital Assistance - * Predictive Analysis - * Fast Performance - * Virtual Personal Assistance - * Speech Recognition - * Advanced Analytics - - - -It helps you design advance solutions implementing data mining methods for fruitful results. - -**4\. Caffe** - -Caffe (Convolutional Architecture for Fast Feature Embedding) is an open-source deep learning framework. It considers speed, modularity, and expressions the most. Caffe was originally developed at the University of California, Berkeley Vision and Learning Centre, written in C++ with a python interface. It smoothly works on operating system Linux, macOS, and Windows. - -Some of the key features of Caffe that helps in AI technology. - - 1. Expressive Architecture - 2. Extensive Code - 3. Large Community - 4. Active Development - 5. Speedy Performance - - - -It helps you inspire innovation while introducing stimulated growth. Make full use of this tool to get desired results. - -**5\. Torch** - -Torch is an open-source machine learning library which, helps you simplify complex task like serialization, object-oriented programming by offering multiple convenient functions. It offers the utmost flexibility and speed in machine learning projects. Torch is written using scripting language Lua and comes with an underlying C implementation. It is used in multiple organization and research labs. - -Torch has countless advantages like; - - * Fast & Effective GPU Support - * Linear algebra Routines - * Support for iOS & Android Platform - * Numeric Optimization Routine - * N-dimensional arrays - - - -**6\. Accord .NET** - -Accord .NET is one of the renown free, open-source AI development tool. It has a set of libraries for combining audio and image processing libraries written in C#. From computer vision to computer audition, signal processing and statistics applications it helps you build everything for commercial use. It comes with a comprehensive set of the sample application for quick running and extensive range of libraries. - -You can develop an advance app using Accord .NET using attention-grabbing features like; - - * Statistical Analysis - * Data Ingestions - * Adaptive - * Deep Learning - * Second-order neural network learning algorithms - * Digital Assistance & Multi-languages - * Speech recognition - - - -**7\. Scikit-Learn** - -Scikit-learn is one of the popular open-source tools that will help in AI technology. It is a valuable library for machine learning in Python. It includes efficient tools like machine learning and statistical modelling including classification, clustering, regression and dimensionality reduction. - -Let’s find out more about Scikit-Learn features; - - * Cross-validation - * Clustering and Classification - * Manifold Learning - * Machine Learning - * Virtual process Automation - * Workflow Automation - - - -From preprocessing to model selection Scikit-learn helps you take care of everything. It simplifies the complete task from data mining to data analysis. - -**Final Thought** - -These are some of the popular open-source AI tools which provide with the comprehensive range of features. Before developing the new-age application, one must select one of the tools and work accordingly. These tools provide with advanced Artificial Intelligence solutions keeping recent trends in mind. - -Artificial intelligence is used globally and it’s marking its presence all around the world. With applications like Amazon Alexa, Siri, AI is providing customers with ultimate user experience. Its offering significant benefit in the industry capturing users attention. Among all the industries like healthcare, banking, finance, e-commerce artificial intelligence is contributing to growth and productivity while saving a lot of time and efforts. - -Select any one of these open-source tools for better user experience and unbelievable results. It will help you grow and get a better result in terms of quality and security. - -![Avatar][3] - -[Nitin Garg][4] - -The author is the CEO and co-founder of BR Softech – [Business intelligence software company][5]. Likes to share his opinions on IT industry via blogs. His interest is to write on the latest and advanced IT technologies which include IoT, VR & AR app development, web, and app development services. Along with this, he also offers consultancy services for RPA, Big Data and Cyber Security services. - -[![][6]][7] - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/ - -作者:[Nitin Garg][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensourceforu.com/author/nitin-garg/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2018/05/Artificial-Intelligence_EB-June-17.jpg?resize=696%2C464&ssl=1 (Artificial Intelligence_EB June 17) -[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2018/05/Artificial-Intelligence_EB-June-17.jpg?fit=1000%2C667&ssl=1 -[3]: https://secure.gravatar.com/avatar/d4e6964b80590824b981f06a451aa9e6?s=100&r=g -[4]: https://opensourceforu.com/author/nitin-garg/ -[5]: https://www.brsoftech.com/bi-consulting-services.html -[6]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png -[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US diff --git a/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md b/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md new file mode 100644 index 0000000000..3eec69a0b6 --- /dev/null +++ b/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Best Open Source Tools that will help in AI Technology) +[#]: via: (https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/) +[#]: author: (Nitin Garg https://opensourceforu.com/author/nitin-garg/) + +7 个对 AI 技术有帮助的最佳开源工具 +====== + +[![][1]][2] + +_人工智能是一种紧跟未来道路的卓越技术。在这个进步的时代,它吸引了所有跨国组织的关注。谷歌、IBM、Facebook、亚马逊、微软等业内知名公司不断投资于这种新时代技术。_ + +利用人工智能预测业务需求,并在另一个层面上进行研发。这项先进技术正成为提供超智能解决方案的研发组织不可或缺的一部分。它可以帮助你保持准确性并以更好的结果提高生产率。 + +AI 开源工具和技术以频繁且准确的结果吸引了每个行业的关注。这些工具可帮助你分析性能,同时为你带来更大的收益。 + +事不宜迟,这里我们列出了一些最佳的开源工具,来帮助你更好地了解人工智能。 + +**1\. TensorFlow** + +TensorFlow 是用于人工智能的开源机器学习框架。它主要是为了进行机器学习和深度学习的研究和生产而开发。TensorFlow 允许开发者创建数据流图形结构,它会在网络或系统节点中移动,图形提供数据的多维数组或张量。 + +TensorFlow 是一个出色的工具,它有无数的优势。 + + * 简化数值计算 +  * TensorFlow 在多种模型上提供了灵活性。 +  * TensorFlow 提高了业务效率 +  * 高度可移植 +  * 自动区分能力 + + + + +**2\. Apache SystemML** + +Apache SystemML 是由 IBM 创建的非常流行的开源机器学习平台,它提供了使用大数据的良好平台。它可以在 Apache Spark 上高效运行,并自动扩展数据,同时确定代码是否可以在磁盘或 Apache Spark 集群上运行。不仅如此,它丰富的功能使其在行业产品中脱颖而出; + + * 算法定制 +  * 多种执行模式 +  * 自动优化 + + + +它还支持深度学习,让开发者更有效率地实现机器学习代码并优化。 + +**3\. OpenNN** + +OpenNN 是用于渐进式分析的开源人工智能神经网络库。它可帮助你使用 C++ 和 Python 开发健壮的模型,它还包含用于处理机器学习解决方案(如预测和分类)的算法和程序。它还涵盖了回归和关联,可提供业界的高性能和技术演化。 + +它有丰富的功能,如: + + * 数字化协助 +  * 预测分析 +  * 快速的性能 +  * 虚拟个人协助 +  * 语音识别 +  * 高级分析 + + + +它可帮助你设计实现数据挖掘的先进方案,而从取得丰硕结果。 + +**4\. Caffe** + +Caffe(快速特征嵌入的卷积结构)是一个开源深度学习框架。它优先考虑速度、模块化和表达式。Caffe 最初由加州大学伯克利分校视觉和学习中心开发,它使用 C++ 编写,带有一个 python 界面。能在 Linux、macOS 和 Windows 上正常运行。 + +Caffe 中的一些有助于 AI 技术的关键特性。 + + 1. 具有表现力的结构 + 2. 具有扩展性的代码 + 3. 大型社区 + 4. 开发活跃 + 5. 性能快速 + + + +它可以帮助你激发创新,同时引入刺激性增长。充分利用此工具来获得所需的结果。 + +**5\. Torch** + +Torch 是一个开源机器学习库,通过提供多种方便的功能,帮助你简化序列化、面向对象编程等复杂任务。它在机器学习项目中提供了最大的灵活性和速度。Torch 使用脚本语言 Lua 编写,底层使用 C 实现。它被用于多个组织和研究实验室中。 + +Torch 有无数的优势,如: + + * 快速高效的 GPU 支持 + * 线性代数子程序 + * 支持 iOS 和 Android 平台 + * 数值优化子程序 + * N 维数组 + + + +**6\. Accord .NET** + +Accord .NET 是著名的免费开源 AI 开发工具之一。它有一组库,用于组合用 C# 编写的音频和图像处理库。从计算机视觉到计算机听觉、信号处理和统计应用,它可以帮助你构建一切来用于商业用途。它附带了一套全面的示例应用来快速运行各类库。 + +你可以使用 Accord .NET 引人注意的功能开发一个高级应用,例如: + + * 统计分析 + * 数据接入 + * 自适应 + * 深度学习 + * 二阶神经网络学习算法 + * 数字协助和多语言 + * 语音识别 + + + +**7\. Scikit-Learn** + +Scikit-Learn 是流行的有助于 AI 技术的开源工具之一。它是 Python 中用于机器学习的一个很有价值的库。它包括机器学习和统计建模(包括分类、聚类、回归和降维)等高效工具。 + +让我们了解下 Scikit-Learn 的更多功能: + + * 交叉验证 + * 聚类和分类 + * 流形学习 + * 机器学习 + * 虚拟流程自动化 + * 工作流自动化 + + + +从预处理到模型选择,Scikit-learn 可帮助你处理所有问题。它简化了从数据挖掘到数据分析的所有任务。 + +**最后的想法** + +这些是一些流行的开源 AI 工具,它们提供了全面的功能。在开发新时代应用之前,必须选择其中一个工具并做相应的工作。这些工具提供先进的人工智能解决方案,并紧跟最新趋势。 + +人工智能在全球范围内被应用,标志着它在世界各地的存在。借助 Amazon Alexa、Siri 等应用,AI 为客户提供了很好的用户体验。它在吸引用户关注的行业中具有显著优势。在医疗保健、银行、金融、电子商务等所有行业中,人工智能在促进增长和生产力的同时节省了大量的时间和精力。 + +选择这些开源工具中的任何一个,获得更好的用户体验和令人难以置信的结果。它将帮助你成长,并在质量和安全性方面获得更好的结果。 + +![Avatar][3] + +[Nitin Garg][4] + +作者是 BR Softech(一家商业智能软件公司) 的 CEO 兼联合创始人。喜欢通过博客分享他对 IT 行业的看法。他的兴趣是写最新的和先进的 IT 技术,包括物联网、VR 和 AR 应用开发,网络和应用开发服务。此外,他还为 RPA、大数据和网络安全服务提供咨询。 + +[![][6]][7] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/ + +作者:[Nitin Garg][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://opensourceforu.com/author/nitin-garg/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2018/05/Artificial-Intelligence_EB-June-17.jpg?resize=696%2C464&ssl=1 (Artificial Intelligence_EB June 17) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2018/05/Artificial-Intelligence_EB-June-17.jpg?fit=1000%2C667&ssl=1 +[3]: https://secure.gravatar.com/avatar/d4e6964b80590824b981f06a451aa9e6?s=100&r=g +[4]: https://opensourceforu.com/author/nitin-garg/ +[5]: https://www.brsoftech.com/bi-consulting-services.html +[6]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 9e7e06d1c0069474b9e9167bb5a06cc6a7d816d0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 15 Nov 2019 09:14:13 +0800 Subject: [PATCH 472/800] translating --- ... to install and Configure Postfix Mail Server on CentOS 8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md b/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md index 15b7715d7f..45d55b4908 100644 --- a/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md +++ b/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 614e3b091850a9c1478c52b572344290f1c864a8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 00:55:17 +0800 Subject: [PATCH 473/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191116=206=20Me?= =?UTF-8?q?thods=20to=20Quickly=20Check=20if=20a=20Website=20is=20up=20or?= =?UTF-8?q?=20down=20from=20the=20Linux=20Terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md --- ...e is up or down from the Linux Terminal.md | 457 ++++++++++++++++++ 1 file changed, 457 insertions(+) create mode 100644 sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md diff --git a/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md b/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md new file mode 100644 index 0000000000..85e70ba6a8 --- /dev/null +++ b/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md @@ -0,0 +1,457 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 Methods to Quickly Check if a Website is up or down from the Linux Terminal) +[#]: via: (https://www.2daygeek.com/linux-command-check-website-is-up-down-alive/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +6 Methods to Quickly Check if a Website is up or down from the Linux Terminal +====== + +This tutorial shows you how to quickly check whether a given website is up (alive) or down from a Linux terminal. + +You may already know some of these commands to verify about this, namely ping, curl, and wget. + +But we have added some other commands as well in this tutorial. + +Also, we have added various options to check this information for single host and multiple hosts. + +This article will help you to check whether the website is up or down. + +But if you maintain some websites and want to get real-time alerts when the website is down. + +I recommend you to use real-time website monitoring tools. There are many tools for this, and some are free and most of them are paid. + +So choose the preferred one based on your needs. We will cover this topic in our upcoming article. + +### Method-1: How to Check if a Website is up or down Using the fping Command + +**[fping command][1]** is a program such as ping, which uses the Internet Control Message Protocol (ICMP) echo request to determine whether a target host is responding. + +fping differs from ping because it allows users to ping any number of host in parallel. Also, hosts can be entered from a text file. + +fping sends an ICMP echo request, moves the next target in a round-robin fashion, and does not wait until the target host responds. + +If a target host replies, it is noted as active and removed from the list of targets to check; if a target does not respond within a certain time limit and/or retry limit it is designated as unreachable. + +``` +# fping 2daygeek.com linuxtechnews.com magesh.co.in + +2daygeek.com is alive +linuxtechnews.com is alive +magesh.co.in is alive +``` + +### Method-2: How to Quickly Check Whether a Website is up or down Using the http Command + +HTTPie (pronounced aitch-tee-tee-pie) is a command line HTTP client. + +The **[httpie tool][2]** is a modern command line http client which makes CLI interaction with web services. + +It provides a simple http command that allows for sending arbitrary HTTP requests using a simple and natural syntax, and displays colorized output. + +HTTPie can be used for testing, debugging, and generally interacting with HTTP servers. + +``` +# http 2daygeek.com + +HTTP/1.1 301 Moved Permanently +CF-RAY: 535b66722ab6e5fc-LHR +Cache-Control: max-age=3600 +Connection: keep-alive +Date: Thu, 14 Nov 2019 19:30:28 GMT +Expires: Thu, 14 Nov 2019 20:30:28 GMT +Location: https://2daygeek.com/ +Server: cloudflare +Transfer-Encoding: chunked +Vary: Accept-Encoding +``` + +### Method-3: How to Check if a Website is up or down Using the curl Command + +**[curl command][3]** is a tool to transfer data from a server or to server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP). + +The command is designed to work without user interaction. + +Also curl support proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more. + +curl is powered by libcurl for all transfer-related features. + +``` +# curl -I https://www.magesh.co.in + +HTTP/2 200 +date: Thu, 14 Nov 2019 19:39:47 GMT +content-type: text/html +set-cookie: __cfduid=db16c3aee6a75c46a504c15131ead3e7f1573760386; expires=Fri, 13-Nov-20 19:39:46 GMT; path=/; domain=.magesh.co.in; HttpOnly +vary: Accept-Encoding +last-modified: Sun, 14 Jun 2015 11:52:38 GMT +x-cache: HIT from Backend +cf-cache-status: DYNAMIC +expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" +server: cloudflare +cf-ray: 535b74123ca4dbf3-LHR +``` + +Use the following curl command if you want to see only the HTTP status code instead of entire output. + +``` +# curl -I "www.magesh.co.in" 2>&1 | awk '/HTTP\// {print $2}' + 200 +``` + +If you want to see if a given website is up or down, use the following Bash script. + +``` +# vi curl-url-check.sh + +#!/bin/bash +if curl -I "https://www.magesh.co.in" 2>&1 | grep -w "200\|301" ; then + echo "magesh.co.in is up" +else + echo "magesh.co.in is down" +fi +``` + +Once you have added the above script to a file, run the file to see the output. + +``` +# sh curl-url-check.sh + +HTTP/2 200 +magesh.co.in is up +``` + +Use the following shell script if you want to see the status of multiple websites. + +``` +# vi curl-url-check-1.sh + +#!/bin/bash +for site in www.google.com google.co.in www.xyzzz.com +do +if curl -I "$site" 2>&1 | grep -w "200\|301" ; then + echo "$site is up" +else + echo "$site is down" +fi +echo "----------------------------------" +done +``` + +Once you have added the above script to a file, run the file to see the output. + +``` +# sh curl-url-check-1.sh + +HTTP/1.1 200 OK +www.google.com is up +---------------------------------- +HTTP/1.1 301 Moved Permanently +google.co.in is up +---------------------------------- +www.xyzzz.com is down +---------------------------------- +``` + +### Method-4: How to Quickly Check Whether a Website is up or down Using the wget Command + +**[wget command][4]** (formerly known as Geturl) is a Free, open source, command line download tool which is retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. + +It is a non-interactive command line tool and Its name is derived from World Wide Web and get. + +wget handle download pretty much good compared with other tools, futures included working in background, recursive download, multiple file downloads, resume downloads, non-interactive downloads & large file downloads. + +``` +# wget -S --spider https://www.magesh.co.in + +Spider mode enabled. Check if remote file exists. +--2019-11-15 01:22:00-- https://www.magesh.co.in/ +Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt' +Resolving www.magesh.co.in (www.magesh.co.in)… 104.18.35.52, 104.18.34.52, 2606:4700:30::6812:2334, … +Connecting to www.magesh.co.in (www.magesh.co.in)|104.18.35.52|:443… connected. +HTTP request sent, awaiting response… + HTTP/1.1 200 OK + Date: Thu, 14 Nov 2019 19:52:01 GMT + Content-Type: text/html + Connection: keep-alive + Set-Cookie: __cfduid=db73306a2f1c72c1318ad4709ef49a3a01573761121; expires=Fri, 13-Nov-20 19:52:01 GMT; path=/; domain=.magesh.co.in; HttpOnly + Vary: Accept-Encoding + Last-Modified: Sun, 14 Jun 2015 11:52:38 GMT + X-Cache: HIT from Backend + CF-Cache-Status: DYNAMIC + Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct" + Server: cloudflare + CF-RAY: 535b85fe381ee684-LHR +Length: unspecified [text/html] +Remote file exists and could contain further links, +but recursion is disabled -- not retrieving. +``` + +Use the following wget command if you want to see only the HTTP status code instead of entire output. + +``` +# wget --spider -S "www.magesh.co.in" 2>&1 | awk '/HTTP\// {print $2}' + 200 +``` + +If you want to see if a given website is up or down, use the following Bash script. + +``` +# vi wget-url-check.sh + +#!/bin/bash +if wget --spider -S "https://www.google.com" 2>&1 | grep -w "200\|301" ; then + echo "Google.com is up" +else + echo "Google.com is down" +fi +``` + +Once you have added the above script to a file, run the file to see the output. + +``` +# wget-url-check.sh + +HTTP/1.1 200 OK +Google.com is up +``` + +Use the following shell script if you want to see the status of multiple websites. + +``` +# vi curl-url-check-1.sh + +#!/bin/bash +for site in www.google.com google.co.in www.xyzzz.com +do +if wget --spider -S "$site" 2>&1 | grep -w "200\|301" ; then + echo "$site is up" +else + echo "$site is down" +fi +echo "----------------------------------" +done +``` + +Once you have added the above script to a file, run the file to see the output. + +``` +# sh wget-url-check-1.sh + +HTTP/1.1 200 OK +www.google.com is up +---------------------------------- +HTTP/1.1 301 Moved Permanently +google.co.in is up +---------------------------------- +www.xyzzz.com is down +---------------------------------- +``` + +### Method-5: How to Quickly Check Whether a Website is up or down Using the lynx Command + +**[lynx][5]** is a highly configurable text-based web browser for use on cursor-addressable character cell terminals. It’s the oldest web browser and it’s still in active development. + +``` +# lynx -head -dump http://www.magesh.co.in + +HTTP/1.1 200 OK +Date: Fri, 15 Nov 2019 08:14:23 GMT +Content-Type: text/html +Connection: close +Set-Cookie: __cfduid=df3cb624024b81df7362f42ede71300951573805662; expires=Sat, 1 +4-Nov-20 08:14:22 GMT; path=/; domain=.magesh.co.in; HttpOnly +Vary: Accept-Encoding +Last-Modified: Sun, 14 Jun 2015 11:52:38 GMT +X-Cache: HIT from Backend +CF-Cache-Status: DYNAMIC +Server: cloudflare +CF-RAY: 535fc5704a43e694-LHR +``` + +Use the following lynx command if you want to see only the HTTP status code instead of entire output. + +``` +# lynx -head -dump https://www.magesh.co.in 2>&1 | awk '/HTTP\// {print $2}' + 200 +``` + +If you want to see if a given website is up or down, use the following Bash script. + +``` +# vi lynx-url-check.sh + +#!/bin/bash +if lynx -head -dump http://www.magesh.co.in 2>&1 | grep -w "200\|301" ; then + echo "magesh.co.in is up" +else + echo "magesh.co.in is down" +fi +``` + +Once you have added the above script to a file, run the file to see the output. + +``` +# sh lynx-url-check.sh + +HTTP/1.1 200 OK +magesh.co.in is up +``` + +Use the following shell script if you want to see the status of multiple websites. + +``` +# vi lynx-url-check-1.sh + +#!/bin/bash +for site in http://www.google.com https://google.co.in http://www.xyzzz.com +do +if lynx -head -dump "$site" 2>&1 | grep -w "200\|301" ; then + echo "$site is up" +else + echo "$site is down" +fi +echo "----------------------------------" +done +``` + +Once you have added the above script to a file, run the file to see the output. + +``` +# sh lynx-url-check-1.sh + +HTTP/1.0 200 OK +http://www.google.com is up +---------------------------------- +HTTP/1.0 301 Moved Permanently +https://google.co.in is up +---------------------------------- +www.xyzzz.com is down +---------------------------------- +``` + +### Method-6: How to Check if a Website is up or down Using the ping Command + +**[ping command][1]** stands for (Packet Internet Groper) command is a networking utility that used to test the target of a host availability/connectivity on an Internet Protocol (IP) network. + +It’s verify a host availability by sending Internet Control Message Protocol (ICMP) Echo Request packets to the target host and waiting for an ICMP Echo Reply. + +It summarize statistical results based on the packets transmitted, packets received, packet loss, typically including the min/avg/max times. + +``` +# ping -c 5 2daygeek.com + +PING 2daygeek.com (104.27.157.177) 56(84) bytes of data. +64 bytes from 104.27.157.177 (104.27.157.177): icmp_seq=1 ttl=58 time=228 ms +64 bytes from 104.27.157.177 (104.27.157.177): icmp_seq=2 ttl=58 time=227 ms +64 bytes from 104.27.157.177 (104.27.157.177): icmp_seq=3 ttl=58 time=250 ms +64 bytes from 104.27.157.177 (104.27.157.177): icmp_seq=4 ttl=58 time=171 ms +64 bytes from 104.27.157.177 (104.27.157.177): icmp_seq=5 ttl=58 time=193 ms + +--- 2daygeek.com ping statistics --- +5 packets transmitted, 5 received, 0% packet loss, time 13244ms +rtt min/avg/max/mdev = 170.668/213.824/250.295/28.320 ms +``` + +### Method-7: How to Quickly Check Whether a Website is up or down Using the telnet Command + +The Telnet command is an old network protocol used to communicate with another host over a TCP/IP network using the TELNET protocol. + +It uses port 23 to connect to other devices, such as computer and network equipment. + +Telnet is not a secure protocol and is now not recommended to use because the data sent to the protocol is not encrypted and can be intercepted by hackers. + +Everyone uses SSH protocol instead of telnet, which is encrypted and very secure. + +``` +# telnet google.com 80 + +Trying 216.58.194.46… +Connected to google.com. +Escape character is '^]'. +^] +telnet> quit +Connection closed. +``` + +### Method-8: How to Check if a Website is up or down Using the Bash Script + +In simple words, a **[shell script][6]** is a file that contains a series of commands. The shell reads this file and executes the commands one by one as they are entered directly on the command line. + +To make this more useful we can add some conditions. This reduces the Linux admin task. + +If you want to see the status of multiple websites using the wget command, use the following shell script. + +``` +# vi wget-url-check-2.sh + +#!/bin/bash +for site in www.google.com google.co.in www.xyzzz.com +do +if wget --spider -S "$site" 2>&1 | grep -w "200\|301" > /dev/null ; then + echo "$site is up" +else + echo "$site is down" +fi +done +``` + +Once you have added the above script to a file, run the file to see the output. + +``` +# sh wget-url-check-2.sh + +www.google.com is up +google.co.in is up +www.xyzzz.com is down +``` + +If you want to see the status of multiple websites using the curl command, use the following **[bash script][7]**. + +``` +# vi curl-url-check-2.sh + +#!/bin/bash +for site in www.google.com google.co.in www.xyzzz.com +do +if curl -I "$site" 2>&1 | grep -w "200\|301" > /dev/null ; then + echo "$site is up" +else + echo "$site is down" +fi +done +``` + +Once you have added the above script to a file, run the file to see the output. + +``` +# sh curl-url-check-2.sh + +www.google.com is up +google.co.in is up +www.xyzzz.com is down +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-command-check-website-is-up-down-alive/ + +作者:[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-use-ping-fping-gping-in-linux/ +[2]: https://www.2daygeek.com/httpie-curl-wget-alternative-http-client-linux/ +[3]: https://www.2daygeek.com/curl-linux-command-line-download-manager/ +[4]: https://www.2daygeek.com/wget-linux-command-line-download-utility-tool/ +[5]: https://www.2daygeek.com/best-text-mode-based-command-line-web-browser-for-linux/ +[6]: https://www.2daygeek.com/category/shell-script/ +[7]: https://www.2daygeek.com/category/bash-script/ From 7da8732750695ca7fdd8809470e2fe230e51038e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 00:56:21 +0800 Subject: [PATCH 474/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191113=20Edit?= =?UTF-8?q?=20images=20on=20Fedora=20easily=20with=20GIMP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191113 Edit images on Fedora easily with GIMP.md --- ... Edit images on Fedora easily with GIMP.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/tech/20191113 Edit images on Fedora easily with GIMP.md diff --git a/sources/tech/20191113 Edit images on Fedora easily with GIMP.md b/sources/tech/20191113 Edit images on Fedora easily with GIMP.md new file mode 100644 index 0000000000..c45813d7cb --- /dev/null +++ b/sources/tech/20191113 Edit images on Fedora easily with GIMP.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Edit images on Fedora easily with GIMP) +[#]: via: (https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/) +[#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) + +Edit images on Fedora easily with GIMP +====== + +![][1] + +GIMP (short for GNU Image Manipulation Program) is free and open-source image manipulation software. With many capabilities ranging from simple image editing to complex filters, scripting and even animation, it is a good alternative to popular commercial options. + +Read on to learn how to install and use GIMP on Fedora. This article covers basic daily image editing. + +### Installing GIMP + +GIMP is available in the official Fedora repository. To install it run: + +``` +sudo dnf install gimp +``` + +### Single window mode + +Once you open the application, it shows you the dark theme window with toolbox and the main editing area. Note that it has two window modes that you can switch between by selecting _Windows_ -> _Single Window Mode_. By checking this option all components of the UI are displayed in a single window. Otherwise, they will be separate. + +### Loading an image + +![][2] + +To load an image, go to _File_ -> _Open_ and choose your file and choose your image file. + +### Resizing an image + +To resize the image, you have the option to resize based on a couple of parameters, including pixel and percentage — the two parameters which are often handy in editing images. + +Let’s say we need to scale down the Fedora 30 background image to 75% of its current size. To do that, select _Image_ -> _Scale_ and then on the scale dialog, select percentage in the unit drop down. Next, enter _75_ as width or height and press the **Tab** key. By default, the other dimension will automatically resize in correspondence with the changed dimension to preserve aspect ratio. For now, leave other options unchanged and press Scale. + +![][3] + +The image scales to 0.75 percent of its original size. + +### Rotating images + +Rotating is a transform operation, so you find it under _Image_ -> _Transform_ from the main menu, where there are options to rotate the image by 90 or 180 degrees. There are also options for flipping the image vertically or horizontally under the mentioned option. + +Let’s say we need to rotate the image 90 degrees. After applying a 90-degree clockwise rotation and horizontal flip, our image will look like this: + +![Transforming an image with GIMP][4] + +### Adding text + +Adding text is very easy. Just select the A icon from the toolbox, and click on a point on your image where you want to add the text. If the toolbox is not visible, open it from Windows->New Toolbox. + +As you edit the text, you might notice that the text dialog has font customization options including font family, font size, etc. + +![Adding text to image in GIMP][5] + +### Saving and exporting + +You can save your edit as as a GIMP project with the _xcf_ extension from _File_ -> _Save_ or by pressing **Ctrl+S**. Or you can export your image in formats such as PNG or JPEG. To export, go to _File_ -> _Export As_ or hit **Ctrl+Shift+E** and you will be presented with a dialog where you can select the output image and name. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/ + +作者:[Mehdi Haghgoo][a] +选题:[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/powergame/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/gimp-magazine-816x346.jpg +[2]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-00-44-300x165.png +[3]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-17-33-300x262.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-41-28-300x243.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-47-54-300x237.png From bb83a8069daf91ce89718d3026fe92ad66f33a12 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 00:57:13 +0800 Subject: [PATCH 475/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191116=20Troubl?= =?UTF-8?q?eshooting=20=E2=80=9CE:=20Unable=20to=20locate=20package?= =?UTF-8?q?=E2=80=9D=20Error=20on=20Ubuntu=20[Beginner=E2=80=99s=20Tutoria?= =?UTF-8?q?l]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191116 Troubleshooting -E- Unable to locate package- Error on Ubuntu -Beginner-s Tutorial.md --- ...e- Error on Ubuntu -Beginner-s Tutorial.md | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 sources/tech/20191116 Troubleshooting -E- Unable to locate package- Error on Ubuntu -Beginner-s Tutorial.md diff --git a/sources/tech/20191116 Troubleshooting -E- Unable to locate package- Error on Ubuntu -Beginner-s Tutorial.md b/sources/tech/20191116 Troubleshooting -E- Unable to locate package- Error on Ubuntu -Beginner-s Tutorial.md new file mode 100644 index 0000000000..d386cdc24e --- /dev/null +++ b/sources/tech/20191116 Troubleshooting -E- Unable to locate package- Error on Ubuntu -Beginner-s Tutorial.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Troubleshooting “E: Unable to locate package” Error on Ubuntu [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/unable-to-locate-package-error-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Troubleshooting “E: Unable to locate package” Error on Ubuntu [Beginner’s Tutorial] +====== + +_**This beginner tutorial shows how to go about fixing the E: Unable to locate package error on Ubuntu Linux.**_ + +One of the [many ways of installing software in Ubuntu][1] is to use the [apt-get][2] or the [apt command][3]. You open a terminal and use the program name to install it like this: + +``` +sudo apt install package_name +``` + +Sometimes, you may encounter an error while trying to install application in this manner. The error reads: + +``` +sudo apt-get install package_name +Reading package lists... Done +Building dependency tree +Reading state information... Done +E: Unable to locate package package_name +``` + +The error is self explanatory. Your Linux system cannot find the package that you are trying to install. But why is it so? Why can it not find the package? Let’s see some of the actions you can take to fix this issue. + +### Fixing ‘Unable to locate package error’ on Ubuntu + +![][4] + +Let’s see how to troubleshoot this issue one step at a time. + +#### 1\. Check the package name (no, seriously) + +This should be the first thing to check. Did you make a typo in the package name? I mean, if you are trying to [install vlc][5] and you typed vcl, it will surely fail. Typos are common so make sure that you have not made any mistakes in typing the name of the package. + +#### 2\. Update the repository cache + +If this is the first time you are using your system after installing, you should run the update command: + +``` +sudo apt update +``` + +This command won’t [update Ubuntu][6] straightaway. I recommend to get through the [concept of Ubuntu repositories][7]. Basically, the ‘apt update’ command builds a local cache of available packages. + +When you use the install command, apt package manager searches the cache to get the package and version information and then download it from its repositories over the network. If the package is not in this cache, your system won’t be able to install it. + +When you have a freshly installed Ubuntu system, the cache is empty. This is why you should run the apt update command right after installing Ubuntu or any other distributions based on Ubuntu (like Linux Mint). + +Even if its not a fresh install, your apt cache might be outdated. It’s always a good idea to update it. + +#### 3\. Check if package is available for your Ubuntu version + +Alright! You checked the name of the package and it is correct. You run the update command to rebuild the cache and yet you see the unable to locate package error. + +It is possible that the package is really not available. But you are following the instructions mentioned on some website and everyone else seems to be able to install it like that. What could be the issue? + +I can see two things here. Either the package available in Universe repository and your system hasn’t enabled it or the package is not available on your Ubuntu version altogether. Don’t get confused. I’ll explain it for you. + +First step, [check the Ubuntu version you are running][8]. Open a terminal and use the following command: + +``` +lsb_release -a +``` + +You’ll get the Ubuntu version number and the codename in the output. The codename is what important here: + +``` +[email protected]:~$ lsb_release -a +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 18.04.3 LTS +Release: 18.04 +Codename: bionic +``` + +![Ubuntu Version Check][9] + +As you can see here, I am using Ubuntu 18.04 and its codename is _bionic_. You may have something else but you get the gist of what you need to note here. + +Once you have the version number and the codename, head over to the Ubuntu packages website: + +[Ubuntu Packages][10] + +Scroll down a bit on this page and go to the Search part. You’ll see a keyword field. Enter the package name (which cannot be found by your system) and then set the correct distribution codename. The section should be ‘any’. When you have set these three details, hit the search button. + +![Ubuntu Package Search][11] + +This will show if the package is available for your Ubuntu version and if yes, which repository it belongs to. In my case, I searched for [Shutter screenshot tool][12] and this is what it showed me for Ubuntu 18.04 Bionic version: + +![Package Search Result][13] + +In my case, the package name is an exact match. This means the package shutter is available for Ubuntu 18.04 Bionic but in the ‘Universe repository’. If you are wondering what the heck is Universe repository, please [refer to the Ubuntu repository article I had mentioned earlier][7]. + +If the intended package is available for your Ubuntu version but it a repository like universe or multiverse, you should enable these additional repositories: + +``` +sudo add-apt-repository universe multiverse +``` + +You must also update the cache so that your system is aware of the new packages available through these repositories: + +``` +sudo apt update +``` + +Now if you try to install the package, things should be fine. + +#### Nothing works, what now? + +If Ubuntu Packages website also shows that the package is not available for your specific version, then you’ll have to find some other ways to install the package. + +Take Shutter for example. It’s an [excellent screenshot tool for Linux][14] but it hasn’t been updated in years and thus Ubuntu has dropped it from Ubuntu 18.10 and newer versions. How to install it now? Thankfully, some third party developer created a personal repository (PPA) and you can install it using that. [Please read this detailed guide to [understand PPA in Ubuntu][15].] You can search for packages and their PPA on Ubuntu’s Launchpad website. + +Do keep in mind that you shouldn’t add random (unofficial) PPAs to your repositories list. I advise sticking with what your distribution provides. + +If there are no PPAs, check the official website of the project and see if they provide some alternative ways of installing the application. Some projects provide .[DEB files][16] or [AppImage][17] files. Some projects have switched to [Snap packages][18]. + +In other words, check the official website of the project and check if they have changed their installation method. + +If nothing works, perhaps the project itself is discontinued and if that’s the case, you should look for its alternative application. + +**In the end…** + +If you are new to Ubuntu or Linux, things could be overwhelming. This is why I am covering some basic topics like this so that you get a better understanding of how things work in your system. + +I hope this tutorial helps you handling the package error in Ubuntu. If you have questions or suggestions, please feel free to ask in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/unable-to-locate-package-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/remove-install-software-ubuntu/ +[2]: https://itsfoss.com/apt-get-linux-guide/ +[3]: https://itsfoss.com/apt-command-guide/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/unable_to_locate_package_error_ubuntu.png?ssl=1 +[5]: https://itsfoss.com/install-latest-vlc/ +[6]: https://itsfoss.com/update-ubuntu/ +[7]: https://itsfoss.com/ubuntu-repositories/ +[8]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/ubuntu_version_check.jpg?ssl=1 +[10]: https://packages.ubuntu.com/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/ubuntu_package_search.png?ssl=1 +[12]: https://itsfoss.com/install-shutter-ubuntu/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/package_search_result.png?resize=800%2C311&ssl=1 +[14]: https://itsfoss.com/take-screenshot-linux/ +[15]: https://itsfoss.com/ppa-guide/ +[16]: https://itsfoss.com/install-deb-files-ubuntu/ +[17]: https://itsfoss.com/use-appimage-linux/ +[18]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ From 808a0a157a0811c01eee1c33978e0c148653e79f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:01:42 +0800 Subject: [PATCH 476/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191115=20How=20?= =?UTF-8?q?to=20port=20an=20awk=20script=20to=20Python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191115 How to port an awk script to Python.md --- ...115 How to port an awk script to Python.md | 212 ++++++++++++++++++ 1 file changed, 212 insertions(+) create mode 100644 sources/tech/20191115 How to port an awk script to Python.md diff --git a/sources/tech/20191115 How to port an awk script to Python.md b/sources/tech/20191115 How to port an awk script to Python.md new file mode 100644 index 0000000000..2476fb079d --- /dev/null +++ b/sources/tech/20191115 How to port an awk script to Python.md @@ -0,0 +1,212 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to port an awk script to Python) +[#]: via: (https://opensource.com/article/19/11/awk-to-python) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +How to port an awk script to Python +====== +Porting an awk script to Python is more about code style than +transliteration. +![Woman sitting in front of her laptop][1] + +Scripts are potent ways to solve a problem repeatedly, and awk is an excellent language for writing them. It excels at easy text processing in particular, and it can bring you through some complicated rewriting of config files or reformatting file names in a directory.  + +### When to move from awk to Python + +At some point, however, awk's limitations start to show. It has no real concept of breaking files into modules, it lacks quality error reporting, and it's missing other things that are now considered fundamentals of how a language works. When these rich features of a programming language are helpful to maintain a critical script, porting becomes a good option. + +My favorite modern programming language that is perfect for porting awk is Python. + +Before porting an awk script to Python, it is often worthwhile to consider its original context. For example, because of awk's limitations, the awk code is commonly called from a Bash script and includes some calls to other command-line favorites like sed, sort, and the gang. It's best to convert all of it into one coherent Python program. Other times, the script makes overly broad assumptions; for example, the code might allow for any number of files, even though it's run with only one in practice. + +After carefully considering the context and determining the thing to substitute with Python, it is time to write code. + +### Standard awk to Python functionality + +The following Python functionality is useful to remember: + + +``` +with open(some_file_name) as fpin: +    for line in fpin: +        pass # do something with line +``` + +This code will loop through a file line-by-line and process the lines. + +If you want to access a line number (equivalent to awk's **NR**), you can use the following code: + + +``` +with open(some_file_name) as fpin: +    for nr, line in enumerate(fpin): +        pass # do something with line +``` + +### awk-like behavior over multiple files in Python + +If you need to be able to iterate through any number of files while keeping a persistent count of the number of lines (like awk's **FNR**), this loop can do it: + + +``` +def awk_like_lines(list_of_file_names): +    def _all_lines(): +        for filename in list_of_file_names: +            with open(filename) as fpin: +                yield from fpin +    yield from enumerate(_all_lines()) +``` + +This syntax uses Python's _generators_ and **yield from** to build an _iterator_ that loops through all lines and keeps a persistent count. + +If you need the equivalent of both **FNR** and **NR**, here is a more sophisticated loop: + + +``` +def awk_like_lines(list_of_file_names): +    def _all_lines(): +        for filename in list_of_file_names: +            with open(filename) as fpin: +                yield from enumerate(fpin) +    for nr, (fnr, line) in _all_lines: +        yield nr, fnr, line +``` + +### More complex awk functionality with FNR, NR, and line + +The question remains if you need all three: **FNR**, **NR**, and **line**. If you really do, using a three-tuple where two of the items are numbers can lead to confusion. Named parameters can make this code easier to read, so it's better to use a **dataclass**: + + +``` +import dataclass + +@dataclass.dataclass(frozen=True) +class AwkLikeLine: +    content: str +    fnr: int +    nr: int + +def awk_like_lines(list_of_file_names): +    def _all_lines(): +        for filename in list_of_file_names: +            with open(filename) as fpin: +                yield from enumerate(fpin) +    for nr, (fnr, line) in _all_lines: +        yield AwkLikeLine(nr=nr, fnr=fnr, line=line) +``` + +You might wonder, why not start with this approach? The reason to start elsewhere is that this is almost always too complicated. If your goal is to make a generic library that makes porting awk to Python easier, then consider doing so. But writing a loop that gets you exactly what you need for a specific case is usually easier to do and easier to understand (and thus maintain). + +### Understanding awk fields + +Once you have a string that corresponds to a line, if you are converting an awk program, you often want to break it up into _fields_. Python has several ways of doing that. This will return a list of strings, splitting the line on any number of consecutive whitespaces: + + +``` +`line.split()` +``` + +If another field separator is needed, something like this will split the line by **:**; the **rstrip** method is needed to remove the last newline: + + +``` +`line.rstrip("\n").split(":")` +``` + +After doing the following, the list **parts** will have the broken-up string: + + +``` +`parts = line.rstrip("\n").split(":")` +``` + +This split is good for choosing what to do with the parameters, but we are in an [off-by-one error][2] scenario. Now **parts[0]** will correspond to awk's **$1**, **parts[1]** will correspond to awk's **$2**, etc. This off-by-one is because awk starts counting the "fields" from 1, while Python counts from 0. In awk's **$0** is the whole line -- equivalent to **line.rstrip("\n") **and awk's **NF** (number of fields) is more easily retrieved as **len(parts)**. + +### Porting awk fields in Python + +As an example, let's convert the one-liner from "[How to remove duplicate lines from files with awk][3]" to Python. + +The original in awk is: + + +``` +`awk '!visited[$0]++' your_file > deduplicated_file` +``` + +An "authentic" Python conversion would be: + + +``` +import collections +import sys + +visited = collections.defaultdict(int) +for line in open("your_file"): +    did_visit = visited[line] +    visited[line] += 1 +    if not did_visit: +        sys.stdout.write(line) +``` + +However, Python has more data structures than awk. Instead of _counting_ visits (which we do not use, except to know whether we saw a line), why not record the visited lines? + + +``` +import sys + +visited = set() +for line in open("your_file"): +    if line in visited: +        continue +    visited.add(line) +    sys.stdout.write(line) +``` + +### Making Pythonic awk code + +The Python community advocates for writing Pythonic code, which means it follows a commonly agreed-upon code style. An even more Pythonic approach will separate the concerns of _uniqueness_ and _input/output_. This change would make it easier to unit test your code: + + +``` +def unique_generator(things): +    visited = set() +    for thing in things: +        if thing in visited: +            continue +        visited.add(things) +        yield thing + +import sys +    +for line in unique_generator(open("your_file")): +    sys.stdout.write(line) +``` + +Putting all logic away from the input/output code leads to better separation of concerns and more usability and testability of code. + +### Conclusion: Python can be a good choice  + +Porting an awk script to Python is often more a matter of reimplementing the core requirements while thinking about proper Pythonic code style than a slavish transliteration of condition/action by condition/action. Take the original context into account and produce a quality Python solution. While there are times when a Bash one-liner with awk can get the job done, Python coding is a path toward more easily maintainable code. + +Also, if you're writing awk scripts, I am confident you can learn Python as well! Let me know if you have any questions in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/awk-to-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/OSDC_women_computing_4.png?itok=VGZO8CxT (Woman sitting in front of her laptop) +[2]: https://en.wikipedia.org/wiki/Off-by-one_error +[3]: https://opensource.com/article/19/10/remove-duplicate-lines-files-awk From 6c3357cef66400c97a73979766e090779d54c9a7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:02:52 +0800 Subject: [PATCH 477/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191115=20Hiring?= =?UTF-8?q?=20a=20technical=20writer=20in=20the=20age=20of=20DevOps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191115 Hiring a technical writer in the age of DevOps.md --- ...a technical writer in the age of DevOps.md | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 sources/tech/20191115 Hiring a technical writer in the age of DevOps.md diff --git a/sources/tech/20191115 Hiring a technical writer in the age of DevOps.md b/sources/tech/20191115 Hiring a technical writer in the age of DevOps.md new file mode 100644 index 0000000000..6716e71f20 --- /dev/null +++ b/sources/tech/20191115 Hiring a technical writer in the age of DevOps.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Hiring a technical writer in the age of DevOps) +[#]: via: (https://opensource.com/article/19/11/hiring-technical-writers-devops) +[#]: author: (Will Kelly https://opensource.com/users/willkelly) + +Hiring a technical writer in the age of DevOps +====== +As organizations mature their DevOps practices, it's time to make the +technical writer a bigger part of the team. +![Women talking][1] + +It's common for enterprises to leave the technical writer's role out of the DevOps discussion. Even the marketing department [joins the discussion][2] in some DevOps-first organizations—so why not the writers? + +Our industry doesn't ask enough of its technical writers. Documentation is an afterthought. Companies farm out technical writing to contractors at the end of the project lifecycle. Corners get cut. Likewise, technical writers don't ask enough of their industry. The expectations for the role vary from company to company. Both circumstances lead to technical writers being left out of the DevOps discussion. + +As your organization matures its DevOps practices, it's time to revisit the role of your technical writer. + +### Recast your technical writer for DevOps + +I remember one of the first agile projects I ever worked on, back when I was still writing technical documentation. One of the other writers on the team had a hard time grasping the fact that we had to write about a product that wasn't 100% complete. Those days are gone. Thank you, DevOps and agile. + +It's time for organizations to revisit how they hire technical writers. Throw out your waterfall technical writer job description. Right. Now. I've always divided up technical writers into operations technical writers, who document infrastructure, and software development technical writers, who document software development. The writers flit back and forth. But, finding a technical writer with a grounding in software development and operations can be helpful for staffing a technical writer position on your DevOps team. + +DevOps means you may need to make changes to your standard "corporate technical writer" job description. For instance, weigh software and operations documentation experience higher than before because the flexibility will only help your team. The same goes for writers with experience creating more modular online documentation using tools such as Twiki or Atlassian Confluence. + +DevOps also requires technical writers who can be full participants. Writers can no longer add value if they expect features to be complete before they get involved. Look for writers with experience driving documentation efforts. Your goal should be to find a technical writer who can work with fewer dependencies that you can plug into various parts of your delivery cycle. This can be easier said than done when it comes to hiring. The only advice I can give is to color outside the lines of the traditional technical writer role and be prepared to pay for it. + +Another skill to seek in a technical writer for your DevOps team is collaboration platform management. Adding that duty to your technical writer job description takes a non-critical task off of a developer's to-do list. + +The DevOps technical writer should take the same onboarding path as the developers and other project team members you bring on board. Give them access to the systems they need to document in a sandbox running the same builds as everybody else. + +Measuring the technical writer's success in a DevOps world takes on some new shades of meaning. You can tie your online documentation to analytics to track readership. You also need to track the technical writer's work the same way you're tracking developers' work. Documentation has bugs, too. + +### Retool your documentation process + +Technical documentation has to take a more toolchain velocity-driven approach to keep pace with DevOps. There have been some stops and starts in rethinking documentation publishing in a high-velocity DevOps world. + +A movement called [DocOps][3], out of CA (now part of Broadcom), brought together technical documentation and DevOps practices, but the original team behind the concept appears to have moved on. The effort fizzled out, but I still recommend researching it online. You will get the [CA.com][4] documentation subsite in your search returns. It's running on Atlassian Confluence with CA branding and other customizations. It's been migrated from the more traditional documentation formats of Webhelp and PDF to separate documentation away from the applications they support. While the development team and documentation still have to be in sync for releases, they aren't as dependent on each other for maintenance and updates. + +[Content-as-Code][5] also holds value for your move to a more DevOps-friendly documentation strategy. It uses software engineering practices to support content reuse. It breaks away from the traditional content management system (CMS) model; it uses Git for content versioning, and technical writers and other content authors use Markdown for authoring. Content-as-Code as a development model supports static website generators such as [Jekyll][6] and [Hugo][7] with interoperability with CMSes. + +Whatever direction you choose for publishing your documentation, it's important to do the upfront work. Start with a small proof of concept. Experiment with tools and workflows. Involve your development team in the initial process to get their feedback on the new publishing model you are building. Make sure to document your publishing tools and workflow, just as you've done with your DevOps toolchain. + +### The DevOps technical writer's time is now + +The cultural and technology transformation DevOps brings to organizations means there could be more work for an experienced and well-placed technical writer. Just as you brought your developers and system administrators into the DevOps age, do the same with your technical writers. + +How is your organization adjusting the technical writer role for DevOps? Please share in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/hiring-technical-writers-devops + +作者:[Will 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/willkelly +[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://martechseries.com/mts-insights/guest-authors/marketing-team-can-learn-devops/ +[3]: https://contentmarketinginstitute.com/2015/04/intelligent-content-application-economy/ +[4]: http://CA.com +[5]: https://iilab.github.io/contentascode/ +[6]: https://jekyllrb.com/ +[7]: https://gohugo.io/ From 0dc57bd497fdf52a519e9aec9ea095351956bb3e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:04:26 +0800 Subject: [PATCH 478/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191115=20PyRadi?= =?UTF-8?q?o:=20An=20open=20source=20alternative=20for=20internet=20radio?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191115 PyRadio- An open source alternative for internet radio.md --- ...n source alternative for internet radio.md | 106 ++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 sources/tech/20191115 PyRadio- An open source alternative for internet radio.md diff --git a/sources/tech/20191115 PyRadio- An open source alternative for internet radio.md b/sources/tech/20191115 PyRadio- An open source alternative for internet radio.md new file mode 100644 index 0000000000..85dd5f2296 --- /dev/null +++ b/sources/tech/20191115 PyRadio- An open source alternative for internet radio.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (PyRadio: An open source alternative for internet radio) +[#]: via: (https://opensource.com/article/19/11/pyradio) +[#]: author: (Lee Tusman https://opensource.com/users/leeto) + +PyRadio: An open source alternative for internet radio +====== +Play your favorite internet radio stations—while keeping your personal +data private—with PyRadio. +![Stereo radio with dials][1] + +[PyRadio][2] is a convenient, open source, command-line application for playing any radio station that has a streaming link. And in 2019, almost every radio station (certainly, every one that has a web presence) has a way to listen online. Using the free PyRadio program, you can add, edit, play and switch between your own selected list of streaming radio stations. It is a command-line tool for Linux that can run on many computers, including Macintosh and tiny computers like Raspberry Pi. To some, a command-line client for playing music might sound needlessly complicated, but it's actually a simple alternative and one that serves as an instant text-based dashboard to easily select music to listen to. + +A little background about myself: I spend a lot of time browsing for and listening to new music on [Bandcamp][3], on various blogs, and even Spotify. I don't spend time casually listening to app *radio* stations, which are really algorithmically-generated continuous streams of similarly tagged music. Rather, I prefer listening to non-profit, college and locally-produced independent radio stations that are run by a community and don't rely on advertisements to sustain themselves. + +I have always been a huge fan of community radio, from Drexel University's great reggae weekends on WKDU; the uncanny experimental WFMU from Orange, N.J.; and WNYC's eclectic schedule, including New Sounds. In my college days, I was a DJ on Brandeis' WBRS 100.1FM, playing experimental electronic music on the show Frequency. And as recently as 2018, I helped manage the station managers and schedule for [KCHUNG Radio][4], an artist-run internet and low-power AM station run out of Chinatown, Los Angeles. + +![The PyRadio interface][5] + +Just as a car radio (in days of yore) had buttons with presets for the owner's favorite radio stations, PyRadio lets me create a very simple list of radio stations that I can easily turn on and switch between. Since I spend most days working, researching, or writing to music, it's become my go-to software for listening. In an era where many people are used to commercial streaming services like curated Spotify mood playlists or Pandora "stations," it's nice to be able to set my own radio stations from a variety of sources outside of a commercial app and sans additional advertising. + +Importantly, by not using commercial clients in the cloud, nothing is sending my user data or preferences to a company for whatever purposes they see fit. Nothing is collecting my preferences to build a profile to sell me more things. + +PyRadio just works, and it's easy to use. Like some other Linux software, the hardest part of using PyRadio is installing it. This tutorial will help you install and run PyRadio for the first time. It assumes some basic knowledge of the command line. If you have no experience working in the terminal, I recommend reading a beginner-friendly [introduction to the command line][6] first. + +### Installing PyRadio + +In the past, I've used the Python package installer [pip][7] to install PyRadio, but the latest version is not yet installable from pip, and I couldn't find a package on Homebrew for my Mac. On my laptop running Ubuntu, I really wanted the latest version of PyRadio for its excellent new features, but I couldn't find an installation on Apt. + +**[[Download our pip cheat sheet][8]]** + +To get the current version on these computers, I built it from source. You can download the latest release from [github.com/coderholic/pyradio/releases][9], and then unzip or [untar][10] it. Change directory into the PyRadio source folder, and you're ready to begin. + +Install the dependencies using your distribution's package manager (such as **dnf** on Fedora or **apt** on Ubuntu): + + * python3-setuptools + * git + * MPV, MPlayer, or VLC + + + +On a Mac, install [Git][11], [sed][12], and [MPlayer][13] dependencies using Homebrew: + + +``` +brew install git +brew install gnu-sed --default-names +brew install mplayer +``` + +Once all dependencies are resolved, run the installer script, using the argument **3** to indicate that you want PyRadio to build for Python3: + + +``` +`$ sh devel/build_install_pyradio 3` +``` + +The installation process takes about a minute. + +### Using and tweaking the station list + +To launch the application, just run **pyradio**. You can navigate up and down the default station list with the arrow or [Vim][14] keys and select a station with Enter. The artist name and track title currently streaming from the station should be displayed, if they are available. Typing **?** brings up a help text box that lists available commands. You can change the interface color themes with **t** or modify your configuration with **c**. + +Out of the box, PyRadio comes with an extensive list of internet streaming stations. But I wanted to add my favorite public radio and college radio stations to the list, as well as some online music playlists. You can find streaming URLs on your favorite radio stations' websites or by browsing online station directories such as [Shoutcast][15]. In particular, I recommend the variety of excellent stations from [Soma FM][16]. You'll need to input the station's streaming playlist file, a URL that ends in **.pls**. You can also enter direct links to streaming audio files, such as MP3s. + +The easiest way to add a station is to type **a**. PyRadio will ask you for the name of the station and its streaming URL, and you can press Enter to add it to your **stations** file. To delete any station, navigate to it and press **x**. You'll be prompted to confirm. The default station list is stored in **~/.config/pyradio/stations.csv**. The station list is a two-column CSV file with the station names and the stream URLs. + +![Adding a station to PyRadio][17] + +Those are the basics of PyRadio. You can find additional information in its [GitHub repo][18]. I hope you have many hours of audio enjoyment ahead of you. If you have any other PyRadio tips or suggestions for stations, please leave a comment below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/pyradio + +作者:[Lee Tusman][a] +选题:[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/leeto +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-stereo-radio-music.png?itok=st66SdwS (Stereo radio with dials) +[2]: http://www.coderholic.com/pyradio/ +[3]: http://bandcamp.com +[4]: https://kchungradio.org/ +[5]: https://opensource.com/sites/default/files/interface_0.png (The PyRadio interface) +[6]: https://www.redhat.com/sysadmin/navigating-filesystem-linux-terminal +[7]: https://pypi.org/project/pip/ +[8]: https://opensource.com/article/19/11/introducing-our-python-pip-cheat-sheet +[9]: https://github.com/coderholic/pyradio/releases +[10]: https://opensource.com/article/17/7/how-unzip-targz-file +[11]: https://git-scm.com/ +[12]: https://www.gnu.org/software/sed/manual/sed.html +[13]: http://www.mplayerhq.hu/design7/news.html +[14]: https://www.vim.org/ +[15]: https://directory.shoutcast.com/ +[16]: https://somafm.com/ +[17]: https://opensource.com/sites/default/files/pyradio-add.png (Adding a station to PyRadio) +[18]: https://github.com/coderholic/pyradio From 8c34c9048b557c3736119650c124bdb96654ed6d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:25:41 +0800 Subject: [PATCH 479/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191115=20Cray?= =?UTF-8?q?=20to=20license=20Fujitsu=20Arm=20processor=20for=20supercomput?= =?UTF-8?q?ers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191115 Cray to license Fujitsu Arm processor for supercomputers.md --- ...ujitsu Arm processor for supercomputers.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/talk/20191115 Cray to license Fujitsu Arm processor for supercomputers.md diff --git a/sources/talk/20191115 Cray to license Fujitsu Arm processor for supercomputers.md b/sources/talk/20191115 Cray to license Fujitsu Arm processor for supercomputers.md new file mode 100644 index 0000000000..5d075bae54 --- /dev/null +++ b/sources/talk/20191115 Cray to license Fujitsu Arm processor for supercomputers.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cray to license Fujitsu Arm processor for supercomputers) +[#]: via: (https://www.networkworld.com/article/3453341/cray-to-license-fujitsu-arm-processor-for-supercomputers.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Cray to license Fujitsu Arm processor for supercomputers +====== +HPE's Cray will co-develop Fujitsu's A64FX CPU to meet the requirements of likely customers such as universities and national research laboratories. +Riken Advanced Institute for Computational Science + +Cray says it will be the first supercomputer vendor to license Fujitsu’s A64FX Arm-based processor with high-bandwidth memory (HBM) for exascale computing. + +Under the agreement, Cray – now a part of HPE – is developing the first-ever commercial supercomputer powered by the A64FX processor, with initial customers being the usual suspects in HPC: Los Alamos National Laboratory, Oak Ridge National Laboratory, RIKEN, Stony Brook University, and University of Bristol. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +As part of this new partnership, Cray and Fujitsu will explore engineering collaboration, co-development, and joint go-to-market to meet customer demand in the supercomputing space. Cray will also bring its Cray Programming Environment (CPE) for Arm processors over to the A64FX to optimize applications and take full advantage of SVE and HBM2. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The A64FX was announced last year as the processor for Fujitsu’s next supercomputer, known as [Post-K][3]. The K supercomputer is a massive system at Japan’s RIKEN Center for Computational Science, based on the Sparc architecture. Fujitsu had a Sparc license from Sun Microsystems and made its own chips for the Japanese market. + +A64FX is the first CPU to adopt the [Scalable Vector Extension][4] (SVE), an extension of Armv8-A instruction set architecture for supercomputers. SVE is focused on parallel processing to run applications faster. + +The A64FX also uses HBM2, which has much greater memory performance than DDR4, the memory standard in servers. The A64FX has a maximum theoretical memory bandwidth greater than 1 terabyte per second (TB/s). + +Fujitsu claims the A64FX will offer a peak double precision (64-bit) floating-point operations performance of over 2.7 teraflops. That pales in comparison to the 100 TFlops for an Nvidia Tesla V100, but the A64FX has a power draw of 160 watts vs. 300 watts for the Tesla. + +However, there is more going on. The 32GB of on-chip HBM2 and high-speed interconnects mean a much faster internal chip, and in early tests, Fujitsu is claiming a 2.5-times performance improvement over the Sparc XIIfx chips used in the K computer. + +The Cray supercomputer powered by Fujitsu A64FX will be available through Cray to customers in mid-2020. + +**Now see** [**10 of the world's fastest supercomputers**][5] + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3453341/cray-to-license-fujitsu-arm-processor-for-supercomputers.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/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3389748/fujitsu-completes-design-of-exascale-supercomputer-promises-to-productize-it.html +[4]: http://www.datacenterdynamics.com/content-tracks/servers-storage/arm-boosts-supercomputing-potential-with-long-vector-support/96823.fullarticle +[5]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 7f63a62cf49ad330cfb1862d012898063e90e45f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:27:27 +0800 Subject: [PATCH 480/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191114=20Cleani?= =?UTF-8?q?ng=20up=20with=20apt-get?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191114 Cleaning up with apt-get.md --- .../tech/20191114 Cleaning up with apt-get.md | 98 +++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 sources/tech/20191114 Cleaning up with apt-get.md diff --git a/sources/tech/20191114 Cleaning up with apt-get.md b/sources/tech/20191114 Cleaning up with apt-get.md new file mode 100644 index 0000000000..5524cf2dc2 --- /dev/null +++ b/sources/tech/20191114 Cleaning up with apt-get.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cleaning up with apt-get) +[#]: via: (https://www.networkworld.com/article/3453032/cleaning-up-with-apt-get.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Cleaning up with apt-get +====== +Most of us with Debian-based systems use apt-get routinely to install packages and upgrades, but how often do we pull out the cleaning tools? Let's check out some of the tool's options for cleaning up after itself. +[Félix Prado Modified by IDG Comm.][1] [(CC0)][2] + +Running **apt-get** commands on a Debian-based system is routine. Packages are updated fairly frequently and commands like **apt-get update** and **apt-get upgrade** make the process quite easy. On the other hand, how often do you use **apt-get clean**, **apt-get autoclean** or **apt-get autoremove**? + +These commands clean up after apt-get's installation operations and remove files that are still on your system but are no longer needed – often because the application that required them is no longer installed. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +### apt-get clean + +The apt-get clean command clears the local repository of retrieved package files that are left in **/var/cache**. The directories it cleans out are **/var/cache/apt/archives/** and **/var/cache/apt/archives/partial/**. The only files it leaves in **/var/cache/apt/archives** are the **lock** file and the **partial** subdirectory. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +You might have a number of files in the directory prior to running the clean operation: + +``` +/var/cache/apt/archives/db5.3-util_5.3.28+dfsg1-0.6ubuntu1_amd64.deb +/var/cache/apt/archives/db-util_1%3a5.3.21~exp1ubuntu2_all.deb +/var/cache/apt/archives/lock +/var/cache/apt/archives/postfix_3.4.5-1ubuntu1_amd64.deb +/var/cache/apt/archives/sasl2-bin_2.1.27+dfsg-1build3_amd64.deb +``` + +You should only have these afterwards: + +``` +$ sudo ls -lR /var/cache/apt/archives +/var/cache/apt/archives: +total 4 +-rw-r----- 1 root root 0 Jan 5 2018 lock +drwx------ 2 _apt root 4096 Nov 12 07:24 partial + +/var/cache/apt/archives/partial: +total 0 <== empty +``` + +The **apt-get clean** command is generally used to clear disk space as needed, generally as part of regularly scheduled maintenance. + +### apt-get autoclean + +The **apt-get** **autoclean** option, like **apt-get clean**, clears the local repository of retrieved package files, but it only removes files that can no longer be downloaded and are virtually useless. It helps to keep your cache from growing too large. + +### apt-get autoremove + +The **autoremove** option removes packages that were automatically installed because some other package required them but, with those other packages removed, they are no longer needed. Sometimes, an upgrade will suggest that you run this command. + +``` +The following packages were automatically installed and are no longer required: + g++-8 gir1.2-mutter-4 libapache2-mod-php7.2 libcrystalhd3 + libdouble-conversion1 libgnome-desktop-3-17 libigdgmm5 libisl19 libllvm8 + liblouisutdml8 libmutter-4-0 libmysqlclient20 libpoppler85 libstdc++-8-dev + libtagc0 libvpx5 libx265-165 php7.2 php7.2-cli php7.2-common php7.2-json + php7.2-opcache php7.2-readline +Use 'sudo apt autoremove' to remove them. <== +``` + +The packages to be removed are often called "unused dependencies". In fact, a good practice to follow is to use **autoremove** after uninstalling a package to be sure that no unneeded files are left behind. + +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/3453032/cleaning-up-with-apt-get.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/nbKaLT4cmRM +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From e8143b95a3ff1eab53d449b42c4a615b358a8847 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:27:51 +0800 Subject: [PATCH 481/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191114=20Space-?= =?UTF-8?q?sourced=20power=20could=20beam=20electricity=20where=20needed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191114 Space-sourced power could beam electricity where needed.md --- ...wer could beam electricity where needed.md | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 sources/talk/20191114 Space-sourced power could beam electricity where needed.md diff --git a/sources/talk/20191114 Space-sourced power could beam electricity where needed.md b/sources/talk/20191114 Space-sourced power could beam electricity where needed.md new file mode 100644 index 0000000000..c095747b36 --- /dev/null +++ b/sources/talk/20191114 Space-sourced power could beam electricity where needed.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Space-sourced power could beam electricity where needed) +[#]: via: (https://www.networkworld.com/article/3453601/space-sourced-power-could-beam-electricity-where-needed.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Space-sourced power could beam electricity where needed +====== +Harvesting solar energy in space would provide off-grid electricity at night, and for areas that don’t receive much sunlight. A project has just received funding. +[dimitrisvetsikas1969][1] [(CC0)][2] + +Capturing solar energy in space and then beaming it down to Earth could provide consistent electricity supplies in places that have never seen it before. Should the as-yet untested idea work and be scalable, it has applications in [IoT][3]-sensor deployments, wireless mobile network mast installs and remote edge data centers. + +The radical idea is that super-efficient solar cells collect the sun’s power in space, convert it to radio waves, and then squirt the energy down to Earth, where it is converted into usable power. The defense industry, which is championing the concept, wants to use the satellite-based tech to provide remote power for forward-operating bases that currently require difficult and sometimes dangerous-to-obtain, escorted fuel deliveries to power electricity generators. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +This replacement system could provide directed solar-produced energy at night or electricity in places without grid delivery. It could also eliminate the alternatives: expensive, wind-solutions and mechanical generators that require maintenance. Extreme northern regions (good spots for [data centers][5] because they’re cold, allowing for ambient cooling), could have, conceivably, for the first time, usable solar power in the predominantly dark winter. + +[][6] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][6] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +“Developers envision a system that is a constellation of satellites with solar panels, about 10,000-square meters, or about the size of a football field or tennis court,” [writes Scott Turner of the Albuquerque Journal][7]. The Air Force Research Laboratory (AFRL), in Albuquerque, along with defense technology company Northrop Grumman have just announced that they plan to spend $100 million dollars developing the hardware, called the Space Solar Power Incremental Demonstrations and Research (SSPIDR) project. + +Two kinds of solar-panel technology are in common use on land now. Photovoltaic solar panels work by converting energy from the sun into electricity. They don’t have moving parts, so are inexpensive to maintain, unlike turbines. Another kind of solar panel uses mirrors and lenses. They grab, and then concentrate sunlight, producing heat, which then operates steam turbines. + +“This whole project is building toward wireless power transmission,” Maj. Tim Allen, a manager on the project, told Turner. It will “beam power down when and where we choose.” Precise power beams will automatically track the target that needs the power, too. “We can put them down in specific locations and keep them there,” he says. + +A significant advantage to placing solar panels in space, as opposed to on land, is that spacecraft get near constant sunlight, explains Rachel Delaney, a systems engineer on the project. Weather also becomes a non-issue, she says. It lets us “capture solar energy in space and precisely beam it to where it is needed,” Col. Eric Felt, director of the Space Vehicles Directorate at AFRL [says in a separate news release][8]. That could be as remote as the satellite footprint allows; single satellites are limited in reach as they only see the part of the Earth that’s in perspective. + +“I believe the commercial industry will be happy to mimic what we’re doing and start providing this power commercially and not just for the military,” Turner quotes Allen as saying. + +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/3453601/space-sourced-power-could-beam-electricity-where-needed.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://pixabay.com/en/sun-bright-yellow-sunset-sky-1953052/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.abqjournal.com/1386648/afrl-looks-to-beam-solar-energy-from-space.html +[8]: https://afresearchlab.com/news/u-s-air-force-research-laboratory-developing-space-solar-power-beaming/ +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world From def747fc6fafeaac97dd2c1b2548104ae082d119 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:28:32 +0800 Subject: [PATCH 482/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191114=20Red=20?= =?UTF-8?q?Hat=20Responds=20to=20Zombieload=20v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191114 Red Hat Responds to Zombieload v2.md --- ...91114 Red Hat Responds to Zombieload v2.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/tech/20191114 Red Hat Responds to Zombieload v2.md diff --git a/sources/tech/20191114 Red Hat Responds to Zombieload v2.md b/sources/tech/20191114 Red Hat Responds to Zombieload v2.md new file mode 100644 index 0000000000..38ae00e052 --- /dev/null +++ b/sources/tech/20191114 Red Hat Responds to Zombieload v2.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat Responds to Zombieload v2) +[#]: via: (https://www.networkworld.com/article/3453596/red-hat-responds-to-zombieload-v2.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Red Hat Responds to Zombieload v2 +====== +Red Hat calls for updating Linux software to address Intel processor flaws that can lead to data-theft exploits +Stephen Lawson/IDG + +Three Common Vulnerabilities and Exposures (CVEs) opened yesterday track three flaws in certain Intel processors, which, if exploited, can put sensitive data at risk. + +Of the flaws reported, the newly discovered Intel processor flaw is a variant of the Zombieload attack discovered earlier this year and is only known to affect Intel’s Cascade Lake chips. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +Red Hat strongly suggests that all Red Hat systems be updated even if they do not believe their configuration poses a direct threat, and it is providing resources to their customers and to the enterprise IT community. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +The three CVEs are: + + * CVE-2018-12207 - Machine Check Error on Page Size Change + * CVE-2019-11135 - TSX Asynchronous Abort + * CVE-2019-0155 and CVE-2019-0154 - i915 graphics driver + + + +### CVE-2018-12207 + +Red Hat rates this vulnerability as important. It is a vulnerability that could allow a local and unprivileged attacker to bypass security controls and cause a system-wide denial of service. + +The hardware flaw was found in Intel microprocessors and is related to the Instruction Translation Lookaside Buffer (ITLB). It caches translations from virtual to physical addresses and is intended to improve performance. However, a delay in invalidating cached entries after cache page changes could lead to a processor using an invalid address translation causing a machine check error exception and moving the system into a hang state. + +This kind of scenario could be crafted by an attacker to take a system down. + +### CVE-2019-11135 + +Red Hat rates this vulnerability as moderate. This Transactional Synchronization Extensions (TSX) Asynchronous Abort is a Microarchitectural Data Sampling (MDS) flaw. A local attacker using custom code could use this flaw to gather information from cache contents on the processor and processors that support simultaneous multithreading (SMT) and TSX. + +### CVE-2019-0155, CVE-2019-0154 + +Red Hat rates the **CVE-2019-0155** flaw as important and the CVE-2019-0154 as moderate. Both flaws are related to the i915 graphics driver. + +CVE-2019-0155 allows allows an attacker to bypass conventional memory security restrictions, allowing write access to privileged memory that ought to be restricted. + +CVE-2019-0154 could allow an local attacker to create an invalid system state when the Graphics Processing Unit (GPU) is in low power mode, leading to the system becoming inaccessible. + +The only affected graphics card affected by CVE-2019-0154 is on the **i915** kernel module. The **lsmod** command can be used to indicate vulnerability. Any output like that shown below (i.e., starting with i915) indicates that this system is vulnerable: + +``` +$ lsmod | grep ^i915 +i915 2248704 10 +``` + +### Additional resources + +Red Hat has provided details and further instructions to its customers and others in the following links: + + + +[https://access.redhat.com/solutions/tsx-asynchronousabort][3] [][4] + + + +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/3453596/red-hat-responds-to-zombieload-v2.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.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://access.redhat.com/solutions/tsx-asynchronousabort%20 +[4]: https://access.redhat.com/solutions/i915-graphics +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From d194c84d48d43e5af071241556b3975b524c6412 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:31:44 +0800 Subject: [PATCH 483/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191113=20USPS?= =?UTF-8?q?=20invests=20in=20GPU-driven=20servers=20to=20speed=20package?= =?UTF-8?q?=20processing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191113 USPS invests in GPU-driven servers to speed package processing.md --- ...ven servers to speed package processing.md | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 sources/talk/20191113 USPS invests in GPU-driven servers to speed package processing.md diff --git a/sources/talk/20191113 USPS invests in GPU-driven servers to speed package processing.md b/sources/talk/20191113 USPS invests in GPU-driven servers to speed package processing.md new file mode 100644 index 0000000000..9c998d457b --- /dev/null +++ b/sources/talk/20191113 USPS invests in GPU-driven servers to speed package processing.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (USPS invests in GPU-driven servers to speed package processing) +[#]: via: (https://www.networkworld.com/article/3452521/usps-invests-in-gpu-driven-servers-to-speed-package-processing.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +USPS invests in GPU-driven servers to speed package processing +====== +U.S. Postal Service plans to use servers powered by Nvidia GPUs and deep learning software to train multiple AI algorithms for image recognition, yielding a tenfold increase in package-processing speed. +Thinkstock + +The U.S. Postal Service is set to purchase GPU-accelerated servers from Hewlett Packard Enterprise that it expects will help accelerate package data processing up to 10 times over previous methods. + +The plan is for a spring 2020 deployment, using HPE's Apollo 6500 servers, which come with up to eight Nvidia V100 Tensor Core GPUs. The Postal Service also will use Nvidia's EGX edge computing servers at nearly 200 of its processing locations in the U.S. + +**READ MORE:** [How AI can improve network capacity planning][1] + +Nvidia announced the USPS's plans at its GPU Technology Conference in Washington, D.C. Ian Buck, the former Stanford professor who created the CUDA language for programming Nvidia GPUs before joining the company to head AI initiatives, made the announcement in an opening keynote focused on AI. + +Buck said half of the world’s enterprises today rely on AI for network protection and security, and 80% of the telcos will rely on it to protect their networks. “AI is a wonderful tool for looking at massive amounts of data and finding anomalies, pulling needles out of a haystack,” he told the audience. + +The USPS — which processes 485 million pieces of mail per day, or 146 billion pieces of mail per year — plans to use servers powered by Nvidia's GPUs and deep learning software to train multiple AI algorithms for image recognition, according to Buck. Those algorithms would then be deployed to the EGX systems at the Postal Service's package processing sites. + +The aim is to improve the speed and accuracy of recognizing package labels, which would improve the speed of package delivery and reduce the need for manual involvement. + +### Nvidia AI deployments and market initiatives + +AI is being embraced by a number of industries, to varying degrees of success. Nvidia uses itself as a guinea pig: + +“At Nvidia we have a fleet of self-driving vehicles, which we use for both collecting data and testing our self-driving capabilities. We ingest and create literally petabytes of data every week that has to be processed by our own team of labelers and processed by AIs,” Buck told the crowd. “We have literally thousands of GPUs doing training every day, which are supporting hundreds of data scientists, which are defining the self-driving car capabilities.” + +The module in Nvidia’s self-driving car is called Pegasus and consists of two Volta GPUs and two Tegra SOCs. “It’s basically an AI supercomputer inside every car processing hundreds of petabytes of data,” Buck said. + +The challenge now is to actually apply AI, he said. To do so, Nvidia has a number of AI projects for the automotive, healthcare, robotics and 5G industries. For healthcare, for example, Nvidia has its Clara software development kit with pretrained models to tackle tasks such as looking for a particular kind of cancer in minutes or hours. + +For IoT, Nvidia has the Metropolis Internet of Things application framework as cities build out sensors to detect unsafe driving conditions, such as a vehicle driving the wrong way onto a freeway. Nvidia also has the DRIVE autonomous vehicle platform, which spans everything from cars to trucks to robotaxis to industrial vehicles. Nvidia's Omniverse kit targets design and media, and its Aerial products are for telcos moving to 5G, along with the EGX server. + +To train new developers to build AI apps on GPUs, Nvidia announced that its Deep Learning Institute just added 12 new courses focused on AI training. So far, DLI has trained more than 180,000 AI workers. + +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/3452521/usps-invests-in-gpu-driven-servers-to-speed-package-processing.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/3338100/using-ai-to-improve-network-capacity-planning-what-you-need-to-know.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world From cdb8fab7d5ee2de0d92491ea069868c8ec5736c7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:32:25 +0800 Subject: [PATCH 484/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191112=20Migrat?= =?UTF-8?q?ing=20to=20SD-WAN=3F=20Avoid=20these=20Pitfalls,=20Say=20IT=20L?= =?UTF-8?q?eaders?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191112 Migrating to SD-WAN- Avoid these Pitfalls, Say IT Leaders.md --- ...N- Avoid these Pitfalls, Say IT Leaders.md | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sources/talk/20191112 Migrating to SD-WAN- Avoid these Pitfalls, Say IT Leaders.md diff --git a/sources/talk/20191112 Migrating to SD-WAN- Avoid these Pitfalls, Say IT Leaders.md b/sources/talk/20191112 Migrating to SD-WAN- Avoid these Pitfalls, Say IT Leaders.md new file mode 100644 index 0000000000..e292bdc712 --- /dev/null +++ b/sources/talk/20191112 Migrating to SD-WAN- Avoid these Pitfalls, Say IT Leaders.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Migrating to SD-WAN? Avoid these Pitfalls, Say IT Leaders) +[#]: via: (https://www.networkworld.com/article/3453198/migrating-to-sd-wan-avoid-these-pitfalls-say-it-leaders.html) +[#]: author: (Cato Networks https://www.networkworld.com/author/Matt-Conran/) + +Migrating to SD-WAN? Avoid these Pitfalls, Say IT Leaders +====== +Every network migration has its hidden challenges. Here are practical tips from IT pros who've already made the switch to SD-WAN +phototechno + +Whether you’re switching from MPLS or Internet VPNs, [SD-WAN][1] can jumpstart network performance, agility, and scalability, particularly for cloud applications. However, as with any migration, there can be challenges and surprises. Don’t squash productivity with unplanned outages or security breaches. Plan your migration carefully, ask the right questions, and cover your bases. Here are some key pitfalls to avoid from those who’ve been there. + +### Security Should Work with Your SD-WAN + +If you’re used to backhauling cloud traffic through data-center security via MPLS, you’re bound to see a big boost in branch office cloud performance using direct Internet access. However, bypassing data-center security means you must find a way to deliver the same level of security at the branch-office level or risk a data breach. Last year, enterprises with completed SD-WAN deployments were 1.3 times more likely to experience a branch-office security breach than without, Shamus McGillicudy, Research Director at analyst firm Enterprise Management Associates reported on a [recent webinar][2]. + +In most cases, you’ll need a full suite of security functions at each location, including next-generation firewalls, IPS, malware protection, a secure Web gateway, and a cloud security broker. Andrew Thomson, director of IT systems and services at [BioIVT, a provider of biological products to life sciences and pharmaceutical firms,][3] found out just how much work securing the branch office could be when he was looking at telco SD-WAN solutions. + +“Updating our security architecture was going to require running to different vendors, piecing together a solution, and going through all the deployment and management pains,” says Thomson. A simpler option may be to move traffic inspection and security policy enforcement into the cloud. + +### Size Appliances with Room to Grow + +Costs may be lowering when comparing [SD-WAN vs. MPLS][4], but that initial SD-WAN appliance purchase can be daunting, especially when you add on all the security functions you need to integrate and deploy. Don’t let the cost scare you into skimping on sizing, especially if you’re a growing business. Your branch offices will likely grow, which means more tunnels, features, and bandwidth. Even if they don’t, WAN usage tends to grow with digital transformation and new applications and cloud services + +A good rule of thumb is to price another 20% capacity beyond what you think you need today and compare that cost to the cost of upgrading or replacing your appliance in three years. You may want to spring for that capacity now. + +### Plan for High Availability + +If your business depends on network uptime, you’d better have a solid plan in place for high availability. This means two SD-WAN appliances with failover capabilities at each location AND dual homing with more than one ISP across diversely routed connections for that precious last mile. (Since it’s often hard to be sure last-mile providers don’t share the same underlying infrastructure, it's even better to use LTE with terrestrial connections.) When you’re planning your SD-WAN budget, make sure to account for the licensing fees for those additional backup appliances. + +[Salcomp, a manufacturer of adapters for mobile phone companies][5], had to rely on backup local Internet connections to compensate for the erratic connectivity of its MPLS provider’s global last mile connectivity partners. + +“In Brazil we had a problem with an MPLS circuit, and the office was out for six months,” says Ville Sarja, CIO and Group Security Officer. “Luckily we had Internet redundancy, so we were able to direct traffic to the Internet, and bandwidth and connectivity were good enough.” + +### Test Your Application Performance + +Make sure your evaluation includes testing your data-center and cloud applications at different times of the day to ensure they perform as expected under various loads and conditions. If you’re a global organization, make sure you test those applications globally at different times as well. As pointed out in the eBook, [The Internet is Broken][6], global connectivity often depends more on service provider commercial peering relationships than actual best path selection or network congestion. This means that packets may travel across longer distances and more hops than they should, with unnecessarily high latency as a result. + +For its SD-WAN evaluation, Salcomp tested SharePoint file transfers and sharing, SAP user experience, and Office 365 performance from its Finland data-center locations across China, Taiwan, and India. By switching from MPLS to a global private backbone, Salcomp was able to reduce costs and improve application performance. + +“Users just aren’t complaining anymore,” says Sarja, “And that’s a very good thing.”  + +### Make Some Changes and See How Long It Takes + +Okay, your SD-WAN seems to be performing, but what about your SD-WAN provider? Are they responsive and competent when you need to make a change or troubleshoot a problem? The only way to find out is to test them as well. Your provider should be able to tell you what its timetable is for every type of change, whether it’s QOS or something else. Ask. Then include a set of predefined changes during the evaluation phase and see if your provider comes through. + +[Fisher & Company][7], parent of a precision metal parts company, was glad it tested changes with its chosen SD-WAN provider. + +“We trialed a telco-managed SD-WAN service, but the provider was difficult to work with,” says Systems Manager Kevin McDaid. “They wanted us to submit requests for configuration changes; it was like our MPLS provider all over again.” + +One way to save valuable time is to choose an SD-WAN provider with a co-management or self-service management model that allows the customer to make some network and security changes directly through a portal. You shouldn’t have to rely on the provider’s staff to make every single change. + +### One Step at a Time + +Transitions can stumble, so most IT managers prefer a phased migration, with the new SD-WAN functioning side by side with your legacy WAN for a time to permit a quick cutover when necessary. + +Draw up a migration plan with your supplier that will cause the least business disruption possible. At minimum, you should be able to transition one network at a time. However, if you want to minimize disruption even further you may want to consider a segment-by-segment transition. If your business depends on application performance, you may even want to transition one business-critical application at a time.  + +Make sure your network and security policies are configured and ready to go with each step. You don’t want to leave your organization open to malware and security breaches during the transition by configuring these on the fly. + +[Financial information provider FDMG Mediagroep][8] used a carefully planned, phased approach when transitioning to a global private backbone to allay internal concerns about working with a new company. It started by connecting a few users at the Amsterdam office. It then connected an internal AWS site to evaluate cloud connectivity. Once those transitions succeeded it began converting individual production sites to SD-WAN. + +And in the end, be sure to have a backup plan if something goes wrong during the cutover to SD-WAN.  Find out how long it takes your vendor to respond when issues come up or even to cut back to your legacy WAN if necessary. + +SD-WAN migration can seem overwhelming when you’ve been relying for so long on MPLS. There’s no question there are potential pitfalls, but if you plan carefully and evaluate your strategy step by step along the way, you can reap all the benefits of SD-WAN without the migration headaches.  + +** ** + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3453198/migrating-to-sd-wan-avoid-these-pitfalls-say-it-leaders.html + +作者:[Cato Networks][a] +选题:[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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.catonetworks.com/sd-wan?utm_source=idg +[2]: https://go.catonetworks.com/VOD_The-6-Keys-to-Successful-WAN-Transformation?utm_source=idg +[3]: https://www.catonetworks.com/customers/bioivt-connects-and-secures-global-network-with-cato-cloud-and-the-cato-managed-threat-detection-and-response-mdr-service?utm_source=idg +[4]: https://www.catonetworks.com/blog/sd-wan-vs-mpls-vs-public-internet?utm_source=idg +[5]: https://www.catonetworks.com/customers/salcomp-replaces-global-mpls-firewalls-and-wan-optimizers-with-cato-cloud?utm_source=idg +[6]: https://go.catonetworks.com/The_Internet_is_Broken?utm_source=idg +[7]: https://www.catonetworks.com/customers/fisher-company-lowers-mpls-costs-improves-wan-performance?utm_source=idg +[8]: https://www.catonetworks.com/customers/fdmg-cuts-costs-revolutionizes-mobile-experience-by-replacing-mpls-and-mobile-vpn?utm_source=idg From 65a77a5e93f9d6fcc80232f05d71d838bed0ce76 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:36:52 +0800 Subject: [PATCH 485/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191115=20Develo?= =?UTF-8?q?ping=20a=20Simple=20Web=20Application=20Using=20Flutter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191115 Developing a Simple Web Application Using Flutter.md --- ... a Simple Web Application Using Flutter.md | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 sources/tech/20191115 Developing a Simple Web Application Using Flutter.md diff --git a/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md b/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md new file mode 100644 index 0000000000..2ea37221c9 --- /dev/null +++ b/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Developing a Simple Web Application Using Flutter) +[#]: via: (https://opensourceforu.com/2019/11/developing-a-simple-web-application-using/) +[#]: author: (Jis Joe Mathew https://opensourceforu.com/author/jis-joe/) + +Developing a Simple Web Application Using Flutter +====== + +[![][1]][2] + +_This article guides readers on how to run and deploy their first Web application using Flutter._ + +Flutter has moved to a new stage, the Web, after having travelled a long way in Android and iOS development. Flutter 1.5 has been released by Google, along with support for Web application development. + +**Configuring Flutter for the Web** +In order to use the Web package, enter the _flutter upgrade_ command to update to Flutter version 1.5.4. + + * Open a terminal + * Type flutter upgrade + * Check the version by typing _flutter –version_ + + + +![Figure 1: Upgrading Flutter to the latest version][3] + +![Figure 2: Starting a new Flutter Web project in VSC][4] + +One can also use Android Studio 3.0 or later versions for Flutter Web development, but we will use Visual Studio Code for this tutorial. + +**Creating a new project with Flutter Web** +Open Visual Studio Code and press _Shift+Ctrl+P_ to start a new project. Type flutter and select _New Web Project_. +Now, name the project. I have named it _open_source_for_you_. +Open the terminal window in VSC, and type in the following commands: + +``` +flutter packages pub global activate webdev + +flutter packages upgrade +``` + +Now use the following command to run the website, on localhost, with the IP address 127.0.0.1 + +``` +flutter packages pub global run webdev serve +``` + +Open any browser and type, __ +There is a Web folder inside the project directory which contains an _index.html_ file. The _dart_ file is compiled into a JavaScript file and is included in the HTML file using the following code: + +``` + +``` + +**Coding and making changes to the demo page** +Let’s create a simple application, which will print ‘Welcome to OSFY’ on the Web page. +Let’s now open the Dart file, which is located in the _lib_ folder _main.dart_ (the default name) (see Figure 5). +We can now remove the debug tag using the property of _MaterialApp_, as follows: + +``` +debugShowCheckedModeBanner: false +``` + +![Figure 3: Naming the project][5] + +![Figure 4: The Flutter demo application running on port 8080][6] + +![Figure 5: Location of main.dart file][7] + +Now, adding more into the Dart file is very similar to writing code in Flutter in Dart. For that, we can declare a class titled _MyClass_, which extends the _StatelessWidget_. +We use a _Center_ widget to position elements to the centre. We can also add a _Padding_ widget to add padding. Use the following code to obtain the output shown in Figure 5. Use the Refresh button to view the changes. + +``` +class MyClass extends StatelessWidget { +@override +Widget build(BuildContext context) { +return Scaffold( +body: Center( +child: Column( +mainAxisAlignment: MainAxisAlignment.center, +children: [ +Padding( +padding: EdgeInsets.all(20.0), +child: Text( +'Welcome to OSFY', +style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), +), +), +], +), +), +); +} +} +``` + +![Figure 6: Output of MyClass][8] + +![Figure 7: Final output][9] + +Let’s add an image from the Internet – I’ve chosen the ‘Open Source for You’ logo from the magazine’s website. We use _Image.network_. + +``` +Image.network( +'https://opensourceforu.com/wp-content/uploads/2014/03/OSFY-Logo.jpg', +height: 100, +width: 150 +), +``` + +The final output is shown in Figure 7. + +![Avatar][10] + +[Jis Joe Mathew][11] + +The author is assistant professor of computer science and engineering at Amal Jyoti College, Kanirapally, Kerala. He can be contacted at [jisjoemathew@gmail.com][12]. + +[![][13]][14] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/developing-a-simple-web-application-using/ + +作者:[Jis Joe Mathew][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/jis-joe/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Screenshot-from-2019-11-15-16-20-30.png?resize=696%2C495&ssl=1 (Screenshot from 2019-11-15 16-20-30) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Screenshot-from-2019-11-15-16-20-30.png?fit=900%2C640&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Upgrading-Flutter-to-the-latest-version.jpg?resize=350%2C230&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-Starting-a-new-Flutter-Web-project-in-VSC.jpg?resize=350%2C93&ssl=1 +[5]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-Naming-the-project.jpg?resize=350%2C147&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-The-Flutter-demo-application-running-on-port-8080.jpg?resize=350%2C111&ssl=1 +[7]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-5-Location-of-main.dart-file.jpg?resize=350%2C173&ssl=1 +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-6-Output-of-MyClass.jpg?resize=350%2C173&ssl=1 +[9]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-7-Final-output.jpg?resize=350%2C167&ssl=1 +[10]: https://secure.gravatar.com/avatar/64db0e07799ae14fd1b51d0633db6593?s=100&r=g +[11]: https://opensourceforu.com/author/jis-joe/ +[12]: mailto:jisjoemathew@gmail.com +[13]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[14]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 72dbbf39597f411ef71f617e2b190009a981620a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:43:36 +0800 Subject: [PATCH 486/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191114=20Creati?= =?UTF-8?q?ng=20Custom=20Themes=20in=20Drupal=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191114 Creating Custom Themes in Drupal 8.md --- ...1114 Creating Custom Themes in Drupal 8.md | 229 ++++++++++++++++++ 1 file changed, 229 insertions(+) create mode 100644 sources/tech/20191114 Creating Custom Themes in Drupal 8.md diff --git a/sources/tech/20191114 Creating Custom Themes in Drupal 8.md b/sources/tech/20191114 Creating Custom Themes in Drupal 8.md new file mode 100644 index 0000000000..f2ebf73568 --- /dev/null +++ b/sources/tech/20191114 Creating Custom Themes in Drupal 8.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Creating Custom Themes in Drupal 8) +[#]: via: (https://opensourceforu.com/2019/11/creating-custom-themes-in-drupal-8/) +[#]: author: (Bhanu Prakash Poluparthi https://opensourceforu.com/author/bhanu-poluparthi/) + +Creating Custom Themes in Drupal 8 +====== + +[![][1]][2] + +_A theme in a website is a set of files that defines the overall look and the user experience of a website. It usually comprises all the graphical elements such as colours and window decorations that help the user to customise the website. Drupal provides the user with a bunch of basic themes for a website that are very generic. However, these default themes do not suit all types of users. So there is a need to build themes that meet one’s requirements._ + +Creating and customising themes in Drupal 8 is easy because of a modern template engine for PHP named Twig, which is a part of the Symfony 2 framework. Moving from a PHP template to Twig, and from the INI format to YAML, are some of the main changes in Drupal 8 theming. These changes in Drupal 8 have improved the security and inheritance, making theming more distinguished. + +With reference to Figure 1, + + * _.info_ provides information about your theme. + * _html.tpl.php_ displays the basic HTML structure of a single Drupal page. + * _page.tpl.php_ is the main template that defines the contents on most of the pages. + * _style.css_ is the CSS file that sets the CSS rules for the template. + * _node.tpl.php_ defines the contents of the nodes. + * _block.tpl.php_ defines the contents in the blocks. + * _comment.tpl.php_ defines the contents in the comments. + * _Template.php_ is used to hold preprocessors for generating variables before they are merged with the markup inside .tpl.php files. + * _Theme-settings.php_ is used to modify the entire theme settings form. + * _.libraries.yml_ defines your libraries (mostly your JS, CSS files). + * _.breakpoints.yml_ defines the points to fit different screen devices. + * _.theme_ is the PHP file that stores conditional logic and data preprocessing of the variables before they are merged with markup inside the .html.twig file. + * _/includes_ is where third-party libraries (like Bootstrap, Foundation, Font Awesome, etc) are put. It is a standard convention to store them in this folder. + + + +The basic requirement to create a new Drupal theme is to have Drupal localhost installed on your system. + +![Figure 1: Drupal 7 theme structure \(https://www.drupal.org/docs/7/theming/ overview-of-theme-files\)][3] + +**Drupal 8 theme structure** +A custom theme can be made by following the steps mentioned below. + +_**Step 1: Creating the custom themes folder**_ +Go to the Drupal folder in which you can find a folder named Theme. + + * Enter the folder ‘theme’. + * Create a folder ‘custom’. + * Enter the folder ‘custom’. + * Create a folder ‘osfy’. + + + +Start creating your theme files over here. The theme name taken here is osfy. + +_**Step 2: Creating a YML file**_ +To inform the website about the existence of this theme, we use _.yml_ files. The basic details required in the YML are mentioned below: +1\. Name +2\. Description +3\. Type +4\. Core + +``` +name: osfy +description: My first responsive custom theme. +type: theme +package: custom +base theme: classy +core: 8.x + +regions: +head: head +header: header +content: content +sidebar: sidebar +footer: Footer + +Stylesheets-remove: +-”Remove Stylesheets” +``` + +We can proceed once the theme appears in the uninstalled section of your website’s _Appearance_ tab. +Open the Drupal website and check for the new theme in the _Appearance_ section. It will be under the uninstalled list of themes in the _Appearance_ tab. + +**Note:** 1\. Base theme indicates which base theme your custom theme is going to inherit. The default base theme provided by Drupal is ‘Stable’. + +2\. Regions defines the regions in which your blocks are to be placed in your theme. If not declared, Drupal uses default regions from the core. + +--- + +_**Step 3: Adding the .libraries.yml file:**_ +We have indicated all the libraries comprising JavaScript and CSS styling, and now we will define them in the _libraries.yml_ file. + +``` +global-components: +version: 1.x +css: +theme: +css/style.css: {} +includes/bootstrap/css/bootstrap.css: {} +``` + +We will use _style.css_ for the theme styling and bootstrap.css for responsive display using Bootstrap libraries. Style.css resides in the core/css folder, whereas bootstrap.css resides in the _includes/bootstrap/css_ folder. + +![Figure 2: Drupal 8 theme structure][4] + +_**Step 4: Creating theme regions**_ +To better understand how Twig has made things easier, use the following code: + +``` + + +

+ +

+ + +{{ title_prefix }} +{% if title %} +

+{{ title }} +

+{% endif %} +``` + +The template file functions are: + +_html.html.twig_ – Theme implementation for the basic structure of a single page +_page.html.twig_ – Theme implementation to display a single page +_node.html.twig_ – Default theme implementation to display a node +_region.html.twig_ – Default theme implementation to display a region +_block.html.twig_ – Default theme implementation to display a block +_field.html.twig_ – Theme implementation for a field + +To create the page.html.twig file, give the following commands: + +``` +/** +* @file +* Default theme implementation to display a single page. +* +* example code for basic header, footer and content page +**/ + +
+{% if page.head %} + +{% endif %} + +
+
+
+
+{{ page.content }} +
+{% if page.sidebar %} + +{% endif %} +
+
+
+{% if page.footer %} +
+
+{{ page.footer }} +
+
+{% endif %} +
+``` + +_**Step 5: Enabling the theme**_ +To place content in the respective regions, in the Manage administrative menu, navigate to _Structure > Block layout > Custom block library (admin/structure/block/block-content)_. Click Add custom block. The Add custom block page appears. Fill in the fields and click on _Save_. +The block design used here is as in Figure 2. + +**A few more things to do** + + * Place a _logo.svg_ file in the theme folder. Drupal will look for it by default and enable the logo for the theme. + * To show your theme picture in the admin interface next to your theme name, place an image screenshot.png in your theme directory itself. + * Use your creativity from here onwards to style and customise the appearance of your theme. + * While writing the code for Twig files, remember to comment all the important information for future reference. + + + +To make your theme work on your Drupal localhost, go to _/admin/appearance_ where you can find the theme ‘osfy’. Choose the option ‘Set as default’. + +You can start using your theme from now. + +![Avatar][5] + +[Bhanu Prakash Poluparthi][6] + +The author is an open source enthusiast and has been a part of +the Drupal organisation since 2017. He was an intern at Google +Summer of Code 2017 and a mentor at Google Code-In 2018. + +[![][7]][8] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/creating-custom-themes-in-drupal-8/ + +作者:[Bhanu Prakash Poluparthi][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/bhanu-poluparthi/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/d8-1.jpg?resize=696%2C397&ssl=1 (d8) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/d8-1.jpg?fit=788%2C449&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Drupal-7-theme-structure.jpg?resize=350%2C308&ssl=1 +[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Screenshot-from-2019-11-14-16-13-53.png?resize=350%2C298&ssl=1 +[5]: https://secure.gravatar.com/avatar/a0a27865017dd4456f47f0a9e7d964a6?s=100&r=g +[6]: https://opensourceforu.com/author/bhanu-poluparthi/ +[7]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[8]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From da98c10ba6f657d2faa2ea2889ad5ae3ef3c3889 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 16 Nov 2019 01:48:44 +0800 Subject: [PATCH 487/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191114=20Debugg?= =?UTF-8?q?ing=20Software=20Deployments=20with=20strace?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191114 Debugging Software Deployments with strace.md --- ...ugging Software Deployments with strace.md | 347 ++++++++++++++++++ 1 file changed, 347 insertions(+) create mode 100644 sources/tech/20191114 Debugging Software Deployments with strace.md diff --git a/sources/tech/20191114 Debugging Software Deployments with strace.md b/sources/tech/20191114 Debugging Software Deployments with strace.md new file mode 100644 index 0000000000..1754792ab5 --- /dev/null +++ b/sources/tech/20191114 Debugging Software Deployments with strace.md @@ -0,0 +1,347 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Debugging Software Deployments with strace) +[#]: via: (https://theartofmachinery.com/2019/11/14/deployment_debugging_strace.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Debugging Software Deployments with strace +====== + +Most of my paid work involves deploying software systems, which means I spend a lot of time trying to answer the following questions: + + * This software works on the original developer’s machine, so why doesn’t it work on mine? + * This software worked on my machine yesterday, so why doesn’t it work today? + + + +That’s a kind of debugging, but it’s a different kind of debugging from normal software debugging. Normal debugging is usually about the logic of the code, but deployment debugging is usually about the interaction between the code and its environment. Even when the root cause is a logic bug, the fact that the software apparently worked on another machine means that the environment is usually involved somehow. + +So, instead of using normal debugging tools like `gdb`, I have another toolset for debugging deployments. My favourite tool for “Why isn’t this software working on this machine?” is `strace`. + +### What is `strace`? + +[`strace`][1] is a tool for “system call tracing”. It’s primarily a Linux tool, but you can do the same kind of debugging tricks with tools for other systems (such as [DTrace][2] and [ktrace][3]). + +The basic usage is very simple. Just run it against a command and it dumps all the system calls (you’ll probably need to install `strace` first): + +``` +$ strace echo Hello +...Snip lots of stuff... +write(1, "Hello\n", 6) = 6 +close(1) = 0 +close(2) = 0 +exit_group(0) = ? ++++ exited with 0 +++ +``` + +What are these system calls? They’re like the API for the operating system kernel. Once upon a time, software used to have direct access to the hardware it ran on. If it needed to display something on the screen, for example, it could twiddle with ports and/or memory-mapped registers for the video hardware. That got chaotic when multitasking computer systems became popular because different applications would “fight” over hardware, and bugs in one application could crash other applications, or even bring down the whole system. So CPUs started supporting different privilege modes (or “protection rings”). They let an operating system kernel run in the most privileged mode with full hardware access, while spawning less-privileged software applications that must ask the kernel to interact with the hardware for them using system calls. + +At the binary level, making a system call is a bit different from making a simple function call, but most programs use wrappers in a standard library. E.g. the POSIX C standard library contains a `write()` function call that contains all the architecture-dependent code for making the `write` system call. + +![][4] + +In short, an application’s interaction with its environment (the computer system) is all done through system calls. So when software works on one machine but not another, looking at system call traces is a good way to find what’s wrong. More specifically, here are the typical things you can analyse using a system call trace: + + * Console input and output (IO) + * Network IO + * Filesystem access and file IO + * Process/thread lifetime management + * Raw memory management + * Access to special device drivers + + + +### When can `strace` be used? + +In theory, `strace` can be used with any userspace program because all userspace programs have to make system calls. It’s more effective with compiled, lower-level programs, but still works with high-level languages like Python if you can wade through the extra noise from the runtime environment and interpreter. + +`strace` shines with debugging software that works fine on one machine, but on another machine fails with a vague error message about files or permissions or failure to run some command or something. Unfortunately, it’s not so great with higher-level problems, like a certificate verification failure. They usually need a combination of `strace`, sometimes [`ltrace`][5], and higher-level tooling (like the `openssl` command line tool for certificate debugging). + +The examples in this post are based on a standalone server, but system call tracing can often be done on more complicated deployment platforms, too. Just search for appropriate tooling. + +### A simple debugging example + +Let’s say you’re trying to run an awesome server application called foo, but here’s what happens: + +``` +$ foo +Error opening configuration file: No such file or directory +``` + +Obviously it’s not finding the configuration file that you’ve written. This can happen because package managers sometimes customise the expected locations of files when compiling an application, so following an installation guide for one distro leads to files in the wrong place on another distro. You could fix the problem in a few seconds if only the error message told you where the configuration file is expected to be, but it doesn’t. How can you find out? + +If you have access to the source code, you could read it and work it out. That’s a good fallback plan, but not the fastest solution. You also could use a stepping debugger like `gdb` to see what the program does, but it’s more efficient to use a tool that’s specifically designed to show the interaction with the environment: `strace`. + +The output of `strace` can be a bit overwhelming at first, but the good news is that you can ignore most of it. It often helps to use the `-o` switch to save the trace to a separate file: + +``` +$ strace -o /tmp/trace foo +Error opening configuration file: No such file or directory +$ cat /tmp/trace +execve("foo", ["foo"], 0x7ffce98dc010 /* 16 vars */) = 0 +brk(NULL) = 0x56363b3fb000 +access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +fstat(3, {st_mode=S_IFREG|0644, st_size=25186, ...}) = 0 +mmap(NULL, 25186, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2f12cf1000 +close(3) = 0 +openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 +read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260A\2\0\0\0\0\0"..., 832) = 832 +fstat(3, {st_mode=S_IFREG|0755, st_size=1824496, ...}) = 0 +mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2f12cef000 +mmap(NULL, 1837056, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2f12b2e000 +mprotect(0x7f2f12b50000, 1658880, PROT_NONE) = 0 +mmap(0x7f2f12b50000, 1343488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f2f12b50000 +mmap(0x7f2f12c98000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16a000) = 0x7f2f12c98000 +mmap(0x7f2f12ce5000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f2f12ce5000 +mmap(0x7f2f12ceb000, 14336, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2f12ceb000 +close(3) = 0 +arch_prctl(ARCH_SET_FS, 0x7f2f12cf0500) = 0 +mprotect(0x7f2f12ce5000, 16384, PROT_READ) = 0 +mprotect(0x56363b08b000, 4096, PROT_READ) = 0 +mprotect(0x7f2f12d1f000, 4096, PROT_READ) = 0 +munmap(0x7f2f12cf1000, 25186) = 0 +openat(AT_FDCWD, "/etc/foo/config.json", O_RDONLY) = -1 ENOENT (No such file or directory) +dup(2) = 3 +fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) +brk(NULL) = 0x56363b3fb000 +brk(0x56363b41c000) = 0x56363b41c000 +fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x8), ...}) = 0 +write(3, "Error opening configuration file"..., 60) = 60 +close(3) = 0 +exit_group(1) = ? ++++ exited with 1 +++ +``` + +The first page or so of `strace` output is typically low-level process startup. (You can see a lot of `mmap`, `mprotect`, `brk` calls for things like allocating raw memory and mapping dynamic libraries.) Actually, when debugging an error, `strace` output is best read from the bottom up. You can see the `write` call that outputs the error message at the end. If you work up, the first failing system call is the `openat` call that fails with `ENOENT` (“No such file or directory”) trying to open `/etc/foo/config.json`. And now we know where the configuration file is supposed to be. + +That’s a simple example, but I’d say at least 90% of the time I use `strace`, I’m not doing anything more complicated. Here’s the complete debugging formula step-by-step: + + 1. Get frustrated by a vague system-y error message from a program + 2. Run the program again with `strace` + 3. Find the error message in the trace + 4. Work upwards to find the first failing system call + + + +There’s a very good chance the system call in step 4 shows you what went wrong. + +### Some tips + +Before walking through a more complicated example, here are some useful tips for using `strace` effectively: + +#### `man` is your friend + +On many *nix systems, you can get a list of all kernel system calls by running `man syscalls`. You’ll see things like `brk(2)`, which means you can get more information by running `man 2 brk`. + +One little gotcha: `man 2 fork` shows me the man page for the `fork()` wrapper in GNU `libc`, which is actually now implemented using the `clone` system call instead. The semantics of `fork` are the same, but if I write a program using `fork()` and `strace` it, I won’t find any `fork` calls in the trace, just `clone` calls. Gotchas like that are only confusing if you’re comparing source code to `strace` output. + +#### Use `-o` to save output to a file + +`strace` can generate a lot of output so it’s often helpful to store the trace in a separate file (as in the example above). It also avoids mixing up program output with `strace` output in the console. + +#### Use `-s` to see more argument data + +You might have noticed that the second part of the error message doesn’t appear in the example trace above. That’s because `strace` only shows the first 32 bytes of string arguments by default. If you need to capture more, add something like `-s 128` to the `strace` invocation. + +#### `-y` makes it easier to track files/sockets/etc + +“Everything is a file” means *nix systems do all IO using file descriptors, whether it’s to an actual file or over networks or through interprocess pipes. That’s convenient for programming, but makes it harder to follow what’s really going on when you see generic `read` and `write` in the system call trace. + +Adding the `-y` switch makes `strace` annotate every file descriptor in the output with a note about what it points to. + +#### Attach to an already-running process with `-p` + +As we’ll see in the example later, sometimes you want to trace a program that’s already running. If you know it’s running as process 1337 (say, by looking at the output of `ps`), you can trace it like this: + +``` +$ strace -p 1337 +...system call trace output... +``` + +You probably need root. + +#### Use `-f` to follow child processes + +By default, `strace` only traces the one process. If that process spawns a child process, you’ll see the system call for spawning the process (normally `clone` nowadays), but not any of the calls made by the child process. + +If you think the bug is in a child process, you’ll need to use the `-f` switch to enable tracing it. A downside is that the output can be more confusing. When tracing one process and one thread, `strace` can show you a single stream of call events. When tracing multiple processes, you might see the start of a call cut off with ``, then a bunch of calls for other threads of execution, before seeing the end of the original call with `<... foocall resumed>`. Alternatively, you can separate all the traces into different files by using the `-ff` switch as well (see [the `strace` manual][6] for details). + +#### You can filter the trace with `-e` + +As you’ve seen, the default trace output is a firehose of all system calls. You can filter which calls get traced using the `-e` flag (see [the `strace` manual][6]). The main advantage is that it’s faster to run the program under a filtered `strace` than to trace everything and `grep` the results later. Honestly, I don’t bother most of the time. + +#### Not all errors are bad + +A simple and common example is a program searching for a file in multiple places, like a shell searching for which `bin/` directory has an executable: + +``` +$ strace sh -c uname +... +stat("/home/user/bin/uname", 0x7ffceb817820) = -1 ENOENT (No such file or directory) +stat("/usr/local/bin/uname", 0x7ffceb817820) = -1 ENOENT (No such file or directory) +stat("/usr/bin/uname", {st_mode=S_IFREG|0755, st_size=39584, ...}) = 0 +... +``` + +The “last failed call before the error message” heuristic is pretty good at finding relevent errors. In any case, working from the bottom up makes sense. + +#### C programming guides are good for understanding system calls + +Standard C library calls aren’t system calls, but they’re only thin layers on top. So if you understand (even just roughly) how to do something in C, it’s easier to read a system call trace. For example, if you’re having trouble debugging networking system calls, you could try skimming through [Beej’s classic Guide to Network Programming][7]. + +### A more complicated debugging example + +As I said, that simple debugging example is representative of most of my `strace` usage. However, sometimes a little more detective work is required, so here’s a slightly more complicated (and real) example. + +[`bcron`][8] is a job scheduler that’s yet another implementation of the classic *nix `cron` daemon. It’s been installed on a server, but here’s what happens when someone tries to edit a job schedule: + +``` +# crontab -e -u logs +bcrontab: Fatal: Could not create temporary file +``` + +Okay, so bcron tried to write some file, but it couldn’t, and isn’t telling us why. This is a debugging job for `strace`: + +``` +# strace -o /tmp/trace crontab -e -u logs +bcrontab: Fatal: Could not create temporary file +# cat /tmp/trace +... +openat(AT_FDCWD, "bcrontab.14779.1573691864.847933", O_RDONLY) = 3 +mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82049b4000 +read(3, "#Ansible: logsagg\n20 14 * * * lo"..., 8192) = 150 +read(3, "", 8192) = 0 +munmap(0x7f82049b4000, 8192) = 0 +close(3) = 0 +socket(AF_UNIX, SOCK_STREAM, 0) = 3 +connect(3, {sa_family=AF_UNIX, sun_path="/var/run/bcron-spool"}, 110) = 0 +mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82049b4000 +write(3, "156:Slogs\0#Ansible: logsagg\n20 1"..., 161) = 161 +read(3, "32:ZCould not create temporary f"..., 8192) = 36 +munmap(0x7f82049b4000, 8192) = 0 +close(3) = 0 +write(2, "bcrontab: Fatal: Could not creat"..., 49) = 49 +unlink("bcrontab.14779.1573691864.847933") = 0 +exit_group(111) = ? ++++ exited with 111 +++ +``` + +There’s the error message `write` near the end, but a couple of things are different this time. First, there’s no relevant system call error that happens before it. Second, we see that the error message has just been `read` from somewhere else. It looks like the real problem is happening somewhere else, and `bcrontab` is just replaying the message. + +If you look at `man 2 read`, you’ll see that the first argument (the 3) is a file descriptor, which is what *nix uses for all IO handles. How do you know what file descriptor 3 represents? In this specific case, you could run `strace` with the `-y` switch (as explained above) and it would tell you automatically, but it’s useful to know how to read and analyse traces to figure things like this out. + +A file descriptor can come from one of many system calls (depending on whether it’s a descriptor for the console, a network socket, an actual file, or something else), but in any case we can search for calls returning 3 (i.e., search for “= 3” in the trace). There are two in this trace: the `openat` at the top, and the `socket` in the middle. `openat` opens a file, but the `close(3)` afterwards shows that it gets closed again. (Gotcha: file descriptors can be reused as they’re opened and closed.) The `socket` call is the relevant one (it’s the last one before the `read`), which tells us `bcrontab` is talking to something over a network socket. The next line, `connect` shows file descriptor 3 being configured as a Unix domain socket connection to `/var/run/bcron-spool`. + +So now we need to figure out what’s listening on the other side of the Unix socket. There are a couple of neat tricks for that, both useful for debugging server deployments. One is to use `netstat` or the newer `ss` (“socket status”). Both commands describe active network sockets on the system, and take the `-l` switch for describing listening (server) sockets, and the `-p` switch to get information about what program is using the socket. (There are many more useful options, but those two are enough to get this job done.) + +``` +# ss -pl | grep /var/run/bcron-spool +u_str LISTEN 0 128 /var/run/bcron-spool 1466637 * 0 users:(("unixserver",pid=20629,fd=3)) +``` + +That tells us that the listener is a command `unixserver` running as process ID 20629. (It’s a coincidence that it’s also using file descriptor 3 for the socket.) + +The second really useful tool for finding the same information is `lsof`. It can list all open files (or file descriptors) on the system. Alternatively, we can get information about a specific file: + +``` +# lsof /var/run/bcron-spool +COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME +unixserve 20629 cron 3u unix 0x000000005ac4bd83 0t0 1466637 /var/run/bcron-spool type=STREAM +``` + +Process 20629 is a long-running server, so we can attach `strace` to it using something like `strace -o /tmp/trace -p 20629`. If we then try to edit the cron schedule in another terminal, we can capture a trace while the error is happening. Here’s the result: + +``` +accept(3, NULL, NULL) = 4 +clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21181 +close(4) = 0 +accept(3, NULL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) +--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21181, si_uid=998, si_status=0, si_utime=0, si_stime=0} --- +wait4(0, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED, NULL) = 21181 +wait4(0, 0x7ffe6bc36764, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes) +rt_sigaction(SIGCHLD, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, 8) = 0 +rt_sigreturn({mask=[]}) = 43 +accept(3, NULL, NULL) = 4 +clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21200 +close(4) = 0 +accept(3, NULL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) +--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21200, si_uid=998, si_status=111, si_utime=0, si_stime=0} --- +wait4(0, [{WIFEXITED(s) && WEXITSTATUS(s) == 111}], WNOHANG|WSTOPPED, NULL) = 21200 +wait4(0, 0x7ffe6bc36764, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes) +rt_sigaction(SIGCHLD, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, 8) = 0 +rt_sigreturn({mask=[]}) = 43 +accept(3, NULL, NULL +``` + +(The last `accept` doesn’t complete during the trace period.) Unfortunately, once again, this trace doesn’t contain the error we’re after. We don’t see any of the messages that we saw `bcrontab` sending to and receiving from the socket. Instead, we see a lot of process management (`clone`, `wait4`, `SIGCHLD`, etc.). This process is spawning a child process, which we can guess is doing the real work. If we want to catch a trace of that, we have to add `-f` to the `strace` invocation. Here’s what we find if we search for the error message after getting a new trace with `strace -f -o /tmp/trace -p 20629`: + +``` +21470 openat(AT_FDCWD, "tmp/spool.21470.1573692319.854640", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) +21470 write(1, "32:ZCould not create temporary f"..., 36) = 36 +21470 write(2, "bcron-spool[21470]: Fatal: logs:"..., 84) = 84 +21470 unlink("tmp/spool.21470.1573692319.854640") = -1 ENOENT (No such file or directory) +21470 exit_group(111) = ? +21470 +++ exited with 111 +++ +``` + +Now we’re getting somewhere. Process ID 21470 is getting a permission denied error trying to create a file at the path `tmp/spool.21470.1573692319.854640` (relative to the current working directory). If we just knew the current working directory, we would know the full path and could figure out why the process can’t create create its temporary file there. Unfortunately, the process has already exited, so we can’t just use `lsof -p 21470` to find out the current directory, but we can work backwards looking for PID 21470 system calls that change directory. (If there aren’t any, PID 21470 must have inherited it from its parent, and we can `lsof -p` that.) That system call is `chdir` (which is easy to find out using today’s web search engines). Here’s the result of working backwards through the trace, all the way to the server PID 20629: + +``` +20629 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21470 +... +21470 execve("/usr/sbin/bcron-spool", ["bcron-spool"], 0x55d2460807e0 /* 27 vars */) = 0 +... +21470 chdir("/var/spool/cron") = 0 +... +21470 openat(AT_FDCWD, "tmp/spool.21470.1573692319.854640", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) +21470 write(1, "32:ZCould not create temporary f"..., 36) = 36 +21470 write(2, "bcron-spool[21470]: Fatal: logs:"..., 84) = 84 +21470 unlink("tmp/spool.21470.1573692319.854640") = -1 ENOENT (No such file or directory) +21470 exit_group(111) = ? +21470 +++ exited with 111 +++ +``` + +(If you’re getting lost here, you might want to read [my previous post about *nix process management and shells][9].) Okay, so the server PID 20629 doesn’t have permission to create a file at `/var/spool/cron/tmp/spool.21470.1573692319.854640`. The most likely reason would be classic *nix filesystem permission settings. Let’s check: + +``` +# ls -ld /var/spool/cron/tmp/ +drwxr-xr-x 2 root root 4096 Nov 6 05:33 /var/spool/cron/tmp/ +# ps u -p 20629 +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +cron 20629 0.0 0.0 2276 752 ? Ss Nov14 0:00 unixserver -U /var/run/bcron-spool -- bcron-spool +``` + +There’s the problem! The server is running as user `cron`, but only `root` has permissions to write to that `/var/spool/cron/tmp/` directory. A simple `chown cron /var/spool/cron/tmp/` makes `bcron` work properly. (If that weren’t the problem, the next most likely suspect would be a kernel security module like SELinux or AppArmor, so I’d check the kernel logs with `dmesg`.) + +### Summary + +System call traces can be overwhelming at first, but I hope I’ve shown that they’re a fast way to debug a whole class of common deployment problems. Imagine trying to debug that multi-process `bcron` problem using a stepping debugger. + +Working back through a chain of system calls takes practice, but as I said, most of the time I use `strace` I just get a trace and look for errors, working from the bottom up. In any case, `strace` has saved me hours and hours of debugging time. I hope it’s useful for you, too. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2019/11/14/deployment_debugging_strace.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://strace.io/ +[2]: http://dtrace.org/blogs/about/ +[3]: https://man.openbsd.org/ktrace +[4]: https://theartofmachinery.com/images/strace/system_calls.svg +[5]: https://linux.die.net/man/1/ltrace +[6]: https://linux.die.net/man/1/strace +[7]: https://beej.us/guide/bgnet/html/index.html +[8]: https://untroubled.org/bcron/ +[9]: https://theartofmachinery.com/2018/11/07/writing_a_nix_shell.html From 1c05c23b3c87b3fee073379ad84f73c2a7892408 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 09:36:41 +0800 Subject: [PATCH 488/800] PRF @geekpi --- ...How to manage music tags using metaflac.md | 40 +++++++++---------- 1 file changed, 19 insertions(+), 21 deletions(-) diff --git a/translated/tech/20191108 How to manage music tags using metaflac.md b/translated/tech/20191108 How to manage music tags using metaflac.md index 0945e04ac6..d1a2614c79 100644 --- a/translated/tech/20191108 How to manage music tags using metaflac.md +++ b/translated/tech/20191108 How to manage music tags using metaflac.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to manage music tags using metaflac) @@ -9,25 +9,26 @@ 如何使用 metaflac 管理音乐标签 ====== -使用这个强大的开源工具可以在命令行中纠正音乐标签错误。 -![website design image][1] -我将 CD 翻录到电脑已经有很长一段时间了。在此期间,我用过几种不同的翻录工具,观察到每种工具在标记上似乎有不同的做法,特别是在保存哪些音乐元数据上。所谓“观察”,是指音乐播放器似乎按照有趣的顺序对专辑进行排序,他们将一个目录中的曲目分为两张专辑,或者产生了其他令人沮丧的烦恼。 +> 使用这个强大的开源工具可以在命令行中纠正音乐标签错误。 -我还看到有些标签非常模糊,许多音乐播放器和标签编辑器没有显示它们。即使这样,在某些极端情况下,它们仍可以使用这些标签来分类或显示音乐,例如播放器将所有包含 XYZ 标签的音乐文件与不包含该标签的所有文件分离到不同的专辑中。 +![](https://img.linux.net.cn/data/attachment/album/201911/16/093629njth88bej8ttekh2.jpg) + +很早我就会将 CD 翻录到电脑。在此期间,我用过几种不同的翻录工具,观察到每种工具在标记上似乎有不同的做法,特别是在保存哪些音乐元数据上。所谓“观察”,我是指音乐播放器似乎按照有趣的顺序对专辑进行排序,它们将一个目录中的曲目分为两张专辑,或者产生了其他令人沮丧的烦恼。 + +我还看到有些标签非常不明确,许多音乐播放器和标签编辑器没有显示它们。即使这样,在某些极端情况下,它们仍可以使用这些标签来分类或显示音乐,例如播放器将所有包含 XYZ 标签的音乐文件与不包含该标签的所有文件分离到不同的专辑中。 那么,如果标记应用和音乐播放器没有显示“奇怪”的标记,但是它们受到了某种影响,你该怎么办? ### Metaflac 来拯救! -我一直想要熟悉 **[metaflac][2]**,它是一款开源命令行 [FLAC文件][3] 元数据编辑器,这是我选择的开源音乐文件格式。并不是说 [EasyTAG][4] 这样的出色标签编辑软件有什么问题,但我想起“如果你手上有个锤子。。”这句老话(译注:原文是如果你手上有个锤子, 那么所有的东西看起来都像钉子。意指人们惯于用熟悉的方式解决问题,而不管合不合适)。另外,从实际的角度来看,运行 [Armbian][5] 和 [MPD][6]、音乐存储在本地、运行精简、仅限音乐的无头环境的小型专用服务器可以满足我的家庭和办公室立体音乐的需求,因此命令行元数据管理工具将非常有用。 +我一直想要熟悉 [metaflac][2],它是一款开源命令行 [FLAC 文件][3]元数据编辑器,这是我选择的开源音乐文件格式。并不是说 [EasyTAG][4] 这样出色的标签编辑软件有什么问题,但我想起“如果你手上有个锤子……”这句老话(LCTT 译注:指如果你手上有个锤子,那么所有的东西看起来都像钉子。意指人们惯于用熟悉的方式解决问题,而不管合不合适)。另外,从实际的角度来看,带有 [Armbian][5] 和 [MPD][6] 的小型专用服务器,音乐存储在本地、运行精简的仅限音乐的无头环境就可以满足我的家庭和办公室的立体音乐的需求,因此命令行元数据管理工具将非常有用。 -下面的截图显示了我的长期翻录程序产生的典型问题:Putumayo 的哥伦比亚音乐汇编显示为两张单独的专辑,一张包含单首曲目,另一张包含其余 11 首: +下面的截图显示了我的长期翻录过程中产生的典型问题:Putumayo 的哥伦比亚音乐汇编显示为两张单独的专辑,一张包含单首曲目,另一张包含其余 11 首: ![Album with incorrect tags][7] -我使用 metaflac 为目录中包含这些曲目的所有 FLAC 文件生成了所有标签的列表: - +我使用 `metaflac` 为目录中包含这些曲目的所有 FLAC 文件生成了所有标签的列表: ``` rm -f tags.txt @@ -39,7 +40,7 @@ for f in *.flac; do done ``` -我将其保存为可执行的 shell 脚本(请参阅我的同事 [David Both][8] 关于 Bash shell 脚本的精彩系列专栏文章,[特别是关于循环这章][9])。基本上,我在这做的是创建一个文件 _tags.txt_,包含文件名(**echo** 命令),后面是它的所有标签,然后是下一个文件名,依此类推。 这是结果的前几行: +我将其保存为可执行的 shell 脚本(请参阅我的同事 [David Both][8] 关于 Bash shell 脚本的精彩系列专栏文章,[特别是关于循环这章][9])。基本上,我在这做的是创建一个文件 `tags.txt`,包含文件名(`echo` 命令),后面是它的所有标签,然后是下一个文件名,依此类推。这是结果的前几行: ``` @@ -63,17 +64,15 @@ ALBUMARTISTSORT=50 de Joselito, Los Cumbia Del Caribe.flac ``` -经过一番调查,结果发现我同时翻录了很多 Putumayo CD,并且当时我所使用的所有软件似乎给除了一个之外的所有文件加上了 MUSICBRAINZ_ 标签。 (是 bug 么?大概吧。我在六张专辑中都看到了。)此外,关于有时不寻常的排序,注意到,ALBUMARTISTSORT 标签将西班牙语标题 “Los” 移到了标题的最后面(逗号之后)。 - -我使用了一个简单的 **awk** 脚本来列出 _tags.txt_ 中报告的所有标签: +经过一番调查,结果发现我同时翻录了很多 Putumayo CD,并且当时我所使用的所有软件似乎给除了一个之外的所有文件加上了 `MUSICBRAINZ_*` 标签。(是 bug 么?大概吧。我在六张专辑中都看到了。)此外,关于有时不寻常的排序,我注意到,`ALBUMARTISTSORT` 标签将西班牙语标题 “Los” 移到了标题的最后面(逗号之后)。 +我使用了一个简单的 `awk` 脚本来列出 `tags.txt` 中报告的所有标签: ``` -`awk -F= 'index($0,"=") > 0 {print $1}' tags.txt | sort -u` +awk -F= 'index($0,"=") > 0 {print $1}' tags.txt | sort -u ``` -这会使用 **=** 作为字段分隔符将所有行拆分为字段,并打印包含等号的行的第一个字段。结果通过使用 sort 带上 **-u** 标志来传递,从而消除了输出中的所有重复项(请参阅我的同事 Seth Kenlon 的[关于 **sort** 程序的文章][10])。对于这个 _tags.txt_ 文件,输出为: - +这会使用 `=` 作为字段分隔符将所有行拆分为字段,并打印包含等号的行的第一个字段。结果通过使用 `sort` 及其 `-u` 标志来传递,从而消除了输出中的所有重复项(请参阅我的同事 Seth Kenlon 的[关于 `sort` 程序的文章][10])。对于这个 `tags.txt` 文件,输出为: ``` ALBUM @@ -94,8 +93,7 @@ TITLE TRACKTOTAL ``` -研究一会后,我发现 MUSICBRAINZ_ 标签出现在除了一个 FLAC 文件之外的所有文件上,因此我使用 metaflac 命令删除了这些标签: - +研究一会后,我发现 `MUSICBRAINZ_*` 标签出现在除了一个 FLAC 文件之外的所有文件上,因此我使用 `metaflac` 命令删除了这些标签: ``` for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_ALBUMARTISTID "$f"; done @@ -111,11 +109,11 @@ for f in *.flac; do metaflac --remove-tag MUSICBRAINZ_TRACKID "$f"; done 完成了,12 首曲目出现在了一张专辑中。 -太好了,我很喜欢 metaflac。我希望我会更频繁地使用它,因为我会试图去纠正最后一些我弄乱的音乐收藏标签。强烈推荐! +太好了,我很喜欢 `metaflac`。我希望我会更频繁地使用它,因为我会试图去纠正最后一些我弄乱的音乐收藏标签。强烈推荐! ### 关于音乐 -我花了几个晚上在 CBC 音乐(CBC 是加拿大的公共广播公司)上收听 Odario Williams 的节目 _After Dark_。感谢 Odario,我听到了让我非常享受的 [Kevin Fox 的 _Songs for Cello and Voice_] [12]。在这里,他演唱了 Eurythmics 的歌曲 “[Sweet Dreams(Are Made of This)][13]”。 +我花了几个晚上在 CBC 音乐(CBC 是加拿大的公共广播公司)上收听 Odario Williams 的节目 After Dark。感谢 Odario,我听到了让我非常享受的 [Kevin Fox 的 Songs for Cello and Voice] [12]。在这里,他演唱了 Eurythmics 的歌曲 “[Sweet Dreams(Are Made of This)][13]”。 我购买了这张 CD,现在它在我的音乐服务器上,还有组织正确的标签! @@ -126,7 +124,7 @@ via: https://opensource.com/article/19/11/metaflac-fix-music-tags 作者:[Chris Hermansen][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 1fb00d38b880c2d495543fdbcd527c7f85e43b1f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 09:37:48 +0800 Subject: [PATCH 489/800] PUB @geekpi https://linux.cn/article-11579-1.html --- .../20191108 How to manage music tags using metaflac.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191108 How to manage music tags using metaflac.md (93%) diff --git a/translated/tech/20191108 How to manage music tags using metaflac.md b/published/20191108 How to manage music tags using metaflac.md similarity index 93% rename from translated/tech/20191108 How to manage music tags using metaflac.md rename to published/20191108 How to manage music tags using metaflac.md index d1a2614c79..91943bccbc 100644 --- a/translated/tech/20191108 How to manage music tags using metaflac.md +++ b/published/20191108 How to manage music tags using metaflac.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11579-1.html) [#]: subject: (How to manage music tags using metaflac) [#]: via: (https://opensource.com/article/19/11/metaflac-fix-music-tags) [#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) @@ -14,7 +14,7 @@ ![](https://img.linux.net.cn/data/attachment/album/201911/16/093629njth88bej8ttekh2.jpg) -很早我就会将 CD 翻录到电脑。在此期间,我用过几种不同的翻录工具,观察到每种工具在标记上似乎有不同的做法,特别是在保存哪些音乐元数据上。所谓“观察”,我是指音乐播放器似乎按照有趣的顺序对专辑进行排序,它们将一个目录中的曲目分为两张专辑,或者产生了其他令人沮丧的烦恼。 +很久以来我就将 CD 翻录到电脑。在此期间,我用过几种不同的翻录工具,观察到每种工具在标记上似乎有不同的做法,特别是在保存哪些音乐元数据上。所谓“观察”,我是指音乐播放器似乎按照有趣的顺序对专辑进行排序,它们将一个目录中的曲目分为两张专辑,或者产生了其他令人沮丧的烦恼。 我还看到有些标签非常不明确,许多音乐播放器和标签编辑器没有显示它们。即使这样,在某些极端情况下,它们仍可以使用这些标签来分类或显示音乐,例如播放器将所有包含 XYZ 标签的音乐文件与不包含该标签的所有文件分离到不同的专辑中。 From 6d318c4a03f1e0bc5e944b872a9540eafa24b3a6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Nov 2019 09:52:43 +0800 Subject: [PATCH 490/800] Rename sources/tech/20191114 Red Hat Responds to Zombieload v2.md to sources/news/20191114 Red Hat Responds to Zombieload v2.md --- .../{tech => news}/20191114 Red Hat Responds to Zombieload v2.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191114 Red Hat Responds to Zombieload v2.md (100%) diff --git a/sources/tech/20191114 Red Hat Responds to Zombieload v2.md b/sources/news/20191114 Red Hat Responds to Zombieload v2.md similarity index 100% rename from sources/tech/20191114 Red Hat Responds to Zombieload v2.md rename to sources/news/20191114 Red Hat Responds to Zombieload v2.md From df9ae0a9becad0362f1f3a4c01f1b8785795fb85 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 10:14:32 +0800 Subject: [PATCH 491/800] PRF @geekpi --- ...ompliance Report on CentOS-RHEL Systems.md | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md b/translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md index c4e92c23cc..0230967fa8 100644 --- a/translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md +++ b/translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Bash Script to Generate Patching Compliance Report on CentOS/RHEL Systems) @@ -10,15 +10,13 @@ 在 CentOS/RHEL 系统上生成补丁合规报告的 Bash 脚本 ====== -如果你运行的是大型 Linux 环境,那么你可能已经将 Red Hat 与 Satellite 集成了。 +![](https://img.linux.net.cn/data/attachment/album/201911/16/101428n1nsj74wifp4k1dz.jpg) -如果是的话,有一种方法可以从 Satellite 服务器导出它,因此不必担心补丁合规性报告。 +如果你运行的是大型 Linux 环境,那么你可能已经将 Red Hat 与 Satellite 集成了。如果是的话,你不必担心补丁合规性报告,因为有一种方法可以从 Satellite 服务器导出它。 -但是,如果你运行的是没有 Satellite 集成的小型 Red Hat 环境,或者它是 CentOS 系统,那么此脚本将帮助你创建报告。 +但是,如果你运行的是没有 Satellite 集成的小型 Red Hat 环境,或者它是 CentOS 系统,那么此脚本将帮助你创建该报告。 -补丁合规性报告通常每月创建一次或三个月一次,具体取决于公司的需求。 - -根据你的需要添加 cronjob 来自动执行此功能。 +补丁合规性报告通常每月创建一次或三个月一次,具体取决于公司的需求。根据你的需要添加 cronjob 来自动执行此功能。 此 [bash 脚本][1] 通常适合于少于 50 个系统运行,但没有限制。 @@ -26,13 +24,11 @@ 以下文章可以帮助你了解有关在红帽 (RHEL) 和 CentOS 系统上安装安全修补程序的更多详细信息。 - * **[如何检查红帽 (RHEL) 和 CentOS 系统上的可用安全更新][2]** - * **[在红帽 (RHEL) 和 CentOS 系统上安装安全更新的四种方法][3]** - * **[两种用来检查或列出红帽 (RHEL) 和 CentOS 系统上已安装的安全更新的方法][4]** + * [如何在 CentOS 或 RHEL 系统上检查可用的安全更新?][2] + * [在 RHEL 和 CentOS 系统上安装安全更新的四种方法][3] + * [在 RHEL 和 CentOS 上检查或列出已安装的安全更新的两种方法][4] - - -此教程中包含四个 [shell 脚本][5],选择适合你的脚本。 +此教程中包含四个 [shell 脚本][5],请选择适合你的脚本。 ### 方法 1:为 CentOS / RHEL 系统上的安全修补生成补丁合规性报告的 Bash 脚本 @@ -79,7 +75,7 @@ server4 +-----------------------------------+ ``` -现价下面的 cronjob 来每个月得到一份补丁合规性报告。 +添加下面的 cronjob 来每个月得到一份补丁合规性报告。 ``` # crontab -e @@ -198,7 +194,7 @@ rm /tmp/sec-up.csv 你会看到下面的输出。 -![][6] +![][7] -------------------------------------------------------------------------------- @@ -207,15 +203,16 @@ via: https://www.2daygeek.com/bash-script-to-generate-patching-compliance-report 作者:[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/category/bash-script/ -[2]: https://www.2daygeek.com/check-list-view-find-available-security-updates-on-redhat-rhel-centos-system/ +[2]: https://linux.cn/article-10938-1.html [3]: https://www.2daygeek.com/install-security-updates-on-redhat-rhel-centos-system/ -[4]: https://www.2daygeek.com/check-installed-security-updates-on-redhat-rhel-and-centos-system/ +[4]: https://linux.cn/article-10960-1.html [5]: https://www.2daygeek.com/category/shell-script/ -[6]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[6]: https://www.2daygeek.com/wp-content/uploads/2019/11/bash-script-to-generate-patching-compliance-report-on-centos-rhel-systems-2.png +[7]: https://www.2daygeek.com/wp-content/uploads/2019/11/bash-script-to-generate-patching-compliance-report-on-centos-rhel-systems-3.png From 6c25f9d912cecce51c416ef5ce43b15ec4242af1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 10:15:14 +0800 Subject: [PATCH 492/800] PUB @geekpi https://linux.cn/article-11580-1.html --- ...erate Patching Compliance Report on CentOS-RHEL Systems.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md (99%) diff --git a/translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md b/published/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md similarity index 99% rename from translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md rename to published/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md index 0230967fa8..8631d45fd7 100644 --- a/translated/tech/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md +++ b/published/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11580-1.html) [#]: subject: (Bash Script to Generate Patching Compliance Report on CentOS/RHEL Systems) [#]: via: (https://www.2daygeek.com/bash-script-to-generate-patching-compliance-report-on-centos-rhel-systems/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From f781f08b7439b36557b1f9cf295a2151f5273d7f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sat, 16 Nov 2019 12:35:58 +0800 Subject: [PATCH 493/800] Rename sources/tech/20191115 Hiring a technical writer in the age of DevOps.md to sources/talk/20191115 Hiring a technical writer in the age of DevOps.md --- .../20191115 Hiring a technical writer in the age of DevOps.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191115 Hiring a technical writer in the age of DevOps.md (100%) diff --git a/sources/tech/20191115 Hiring a technical writer in the age of DevOps.md b/sources/talk/20191115 Hiring a technical writer in the age of DevOps.md similarity index 100% rename from sources/tech/20191115 Hiring a technical writer in the age of DevOps.md rename to sources/talk/20191115 Hiring a technical writer in the age of DevOps.md From e9789201bc0ef2907a8ecde3c4810ec62eace5a1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 13:09:17 +0800 Subject: [PATCH 494/800] APL --- ...le Monitors Without Creating Multiple Docks With autoplank.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md b/sources/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md index 29164e3510..1bc3cf7ef8 100644 --- a/sources/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md +++ b/sources/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md @@ -1,3 +1,4 @@ +wxy Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank ====== From 57e35b73be124499c4a07e48e4feda273a4090c4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 16:09:12 +0800 Subject: [PATCH 495/800] TSL&PRF --- ... Creating Multiple Docks With autoplank.md | 78 ------------------- ... Creating Multiple Docks With autoplank.md | 76 ++++++++++++++++++ 2 files changed, 76 insertions(+), 78 deletions(-) delete mode 100644 sources/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md create mode 100644 translated/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md diff --git a/sources/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md b/sources/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md deleted file mode 100644 index 1bc3cf7ef8..0000000000 --- a/sources/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md +++ /dev/null @@ -1,78 +0,0 @@ -wxy -Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank -====== - -![](https://3.bp.blogspot.com/-BNHa6rP_kGk/W22cJrT3ghI/AAAAAAAABWA/TAKZgxJfYuwz-Me-M135-LWYl5qvs6cIwCLcBGAs/s640/plank-dock.png) - -**[autoplank][1] is a small tool written in Go which adds multi-monitor support to Plank dock without having to create [multiple][2] docks.** - -**When you move your mouse cursor to the bottom of a monitor, autoplank detect your mouse movement using** `xdotool` and it automatically moves Plank to that monitor. This tool **only works if Plank is set to run at the bottom of the screen** , at least for now. - -There's a slight delay until Plank actually shows up on the monitor where the mouse is though. The developer says this is intentional, to make sure you actually want to access Plank on that monitor. The time delay before showing plank is not currently configurable, but that may change in the future. - -autoplank should work with elementary OS, as well as any desktop environment or Linux distribution you use Plank dock on. - -Plank is a simple dock that shows icons of running applications / windows. The application allows pinning applications to the dock, and comes with a few built-in simple "docklets": a clipboard manager, clock, CPU monitor, show desktop and trash. To access its settings, hold down the `Ctrl` key while right clicking anywhere on the Plank dock, and then clicking on `Preferences` . - -Plank is used by default in elementary OS, but it can be used on any desktop environment or Linux distribution you wish. - -### Install autoplank - -On its GitHub page, it's mentioned that you need Go 1.8 or newer to build autoplank but I was able to successfully build it with Go 1.6 in Ubuntu 16.04 (elementary OS 0.4 Loki). - -The developer has said on - -**1\. Install required dependencies.** - -To build autoplank you'll need Go (`golang-go` in Debian, Ubuntu, elementary OS, etc.). To get the latest Git code you'll also need `git` , and for detecting the monitor on which you move the mose, you'll also need to install `xdotool` . - -Install these in Ubuntu, Debian, elementary OS and so on, by using this command: -``` -sudo apt install git golang-go xdotool - -``` - -**2\. Get the latest autoplank from[Git][1], build it, and install it in** `/usr/local/bin` : -``` -git clone https://github.com/abiosoft/autoplank -cd autoplank -go build -o autoplank -sudo mv autoplank /usr/local/bin/ - -``` - -You can remove the autoplank folder from your home directory now. - -When you want to uninstall autoplank, simply remove the `/usr/local/bin/autoplank` binary (`sudo rm /usr/local/bin/autoplank`). - -**3\. Add autoplank to startup.** - -If you want to try autoplank before adding it to startup or creating a systemd service for it, you can simply type `autoplank` in a terminal to start it. - -To have autoplank work between reboots, you'll need to add it to your startup applications. The exact steps for doing this depend on your desktop environments, so I won't tell you exactly how to do that for every desktop environment, but remember to use `/usr/local/bin/autoplank` as the executable in Startup Applications. - -In elementary OS, you can open `System Settings` , then in `Applications` , on the `Startup` tab, click the `+` button in the bottom left-hand side corner of the window, then add `/usr/local/bin/autoplank` in the `Type in a custom command` field: - -![](https://4.bp.blogspot.com/-hbh1PLDX-0A/W22eIhEQ1iI/AAAAAAAABWM/GkgrzaPPjA8CHnxF5L4UPPUG_vPa9VT-gCLcBGAs/s640/autoplank-startup-elementaryos.png) - -**Another way of using autoplank is by creating a systemd service for it, as explained[here][3].** Using a systemd service for autoplank has the advantage of restarting autoplank if it crashes for whatever reason. Use either the systemd service or add autoplank to your startup applications (don't use both). - -**4\. After you do this, logout, login and autoplank should be running so you can move the mouse at the bottom of a monitor to move Plank dock there.** - - --------------------------------------------------------------------------------- - -via: https://www.linuxuprising.com/2018/08/use-plank-on-multiple-monitors-without.html - -作者:[Logix][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/118280394805678839070 -[1]:https://github.com/abiosoft/autoplank -[2]:https://answers.launchpad.net/plank/+question/204593 -[3]:https://github.com/abiosoft/autoplank#optional-create-a-service -[4]:https://www.reddit.com/r/elementaryos/comments/95a879/autoplank_use_plank_on_multimonitor_setup/e3r9saq/ diff --git a/translated/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md b/translated/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md new file mode 100644 index 0000000000..f2cfed5680 --- /dev/null +++ b/translated/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md @@ -0,0 +1,76 @@ +用 autoplank 在多个显示器上使用 Plank 扩展坞 +====== + +![](https://3.bp.blogspot.com/-BNHa6rP_kGk/W22cJrT3ghI/AAAAAAAABWA/TAKZgxJfYuwz-Me-M135-LWYl5qvs6cIwCLcBGAs/s640/plank-dock.png) + +[autoplank][1] 是用 Go 语言编写的小型工具,它为 Plank 扩展坞增加了多显示器支持,而无需创建[多个][2]扩展坞。 + +当你将鼠标光标移动到显示器的底部时,`autoplank` 会使用 `xdotool` 检测到你的鼠标移动,并且自动将 Plank 扩展坞移动到该显示器。该工具仅在将 Plank 设置为在屏幕底部的情况下工作(至少目前如此)。 + +在 Plank 实际出现在鼠标所在的显示器上前会稍有延迟。开发人员说这是有意设计的,以确保你确实要在该显示器上访问 Plank。显示 Plank 之前的时间延迟目前尚不可配置,但将来可能会改变。 + +`autoplank` 可以在 elementary OS 以及其它的桌面环境或发行版上使用。 + +Plank 是一个简单的扩展坞,它显示了正在运行的应用程序/窗口的图标。它允许将应用程序固定到扩展坞,并带有一些内置的简单“扩展组件”:剪贴板管理器、时钟、CPU 监视器、显示桌面和垃圾桶。要访问其设置,请按住 `Ctrl` 键,同时右键单击 Plank 扩展坞上的任意位置,然后单击 “Preferences”。 + +Plank 默认用在 elementary OS 中,但也可以在任何桌面环境或 Linux 发行版中使用。 + +### 安装 autoplank + +在其 GitHub 页面上,提到你需要 Go 1.8 或更高版本才能构建 `autoplank`,但我能够在 Ubuntu 16.04(elementary OS 0.4 Loki)中使用 Go 1.6 成功构建它。 + +开发者说: + +1、安装所需的依赖项。 + +要构建 `autoplank`,你需要 Go(在 Debian、Ubuntu、elementary OS 等中使用 golang-go)。要获取最新的 Git 代码,你还需要 `git`,要在显示器上检测你的鼠标移动,还需要安装 `xdotool`。 + +使用以下命令将它们安装在 Ubuntu、Debian、elementary OS 等中: + +``` +sudo apt install git golang-go xdotool +``` + +2、从 [Git][1] 获取最新的 `autoplank`,构建并将其安装在 `/usr/local/bin` 中: + +``` +git clone https://github.com/abiosoft/autoplank +cd autoplank +go build -o autoplank +sudo mv autoplank /usr/local/bin/ +``` + +你现在可以从主目录中删除 `autoplank` 文件夹。 + +当你想卸载 `autoplank` 时,只需删除 `/usr/local/bin/autoplank` 二进制文件(`sudo rm /usr/local/bin/autoplank`)。 + +3、将 `autoplank` 添加到启动中。 + +如果你想在将 `autoplank` 添加到启动项或为其创建 systemd 服务之前尝试使用 `autoplank`,则只需在终端中键入 `/usr/local/bin/autoplank` 即可启动它。 + +要使 `autoplank` 在重新启动后起作用,你需要将其添加到启动项中。确切的操作步骤取决于你的桌面环境,因此我不会确切告诉你如何在每个桌面环境中执行此操作,但是请记住在启动项中将 `/usr/local/bin/autoplank` 设置为可执行文件。 + +在 elementary OS 中,你可以打开“系统设置”,然后在“应用程序”的“启动”选项卡上,单击窗口左下角的“+”按钮,然后在“键入自定义命令”字段中添加 “/usr/local/bin/autoplank”: + +![](https://4.bp.blogspot.com/-hbh1PLDX-0A/W22eIhEQ1iI/AAAAAAAABWM/GkgrzaPPjA8CHnxF5L4UPPUG_vPa9VT-gCLcBGAs/s640/autoplank-startup-elementaryos.png) + +如[此处][3]的解释,使用 `autoplank` 的另一种方法是通过为其创建 systemd 服务。将 systemd 服务用于 autoplank 的优点是,无论它出于何种原因而崩溃,都可以重新启动 `autoplank`。可以使用 systemd 服务或将 `autoplank` 添加到启动应用程序中(但不要同时使用两者)。 + +4、完成此操作后,注销、登录,`autoplank` 应该已在运行,因此你可以将鼠标移至显示器底部以将 Plank 停靠此处。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxuprising.com/2018/08/use-plank-on-multiple-monitors-without.html + +作者:[Logix][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/118280394805678839070 +[1]:https://github.com/abiosoft/autoplank +[2]:https://answers.launchpad.net/plank/+question/204593 +[3]:https://github.com/abiosoft/autoplank#optional-create-a-service +[4]:https://www.reddit.com/r/elementaryos/comments/95a879/autoplank_use_plank_on_multimonitor_setup/e3r9saq/ From 5c955e583b93857edc83effb6361393e834601f6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 16:27:07 +0800 Subject: [PATCH 496/800] PUB @wxy https://linux.cn/article-11582-1.html --- ...ple Monitors Without Creating Multiple Docks With autoplank.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md (100%) diff --git a/translated/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md b/published/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md similarity index 100% rename from translated/tech/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md rename to published/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md From 2d38553a828d72f305cdc37fb3e43ad871e646e2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 22:08:56 +0800 Subject: [PATCH 497/800] APL --- sources/news/20191114 Red Hat Responds to Zombieload v2.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191114 Red Hat Responds to Zombieload v2.md b/sources/news/20191114 Red Hat Responds to Zombieload v2.md index 38ae00e052..abb1a2d0d2 100644 --- a/sources/news/20191114 Red Hat Responds to Zombieload v2.md +++ b/sources/news/20191114 Red Hat Responds to Zombieload v2.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 75b21dcfdb8c7e9287784ecb059049c325c70b35 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 22:31:08 +0800 Subject: [PATCH 498/800] TSL&PRF --- ...91114 Red Hat Responds to Zombieload v2.md | 96 ------------------- ...91114 Red Hat Responds to Zombieload v2.md | 82 ++++++++++++++++ 2 files changed, 82 insertions(+), 96 deletions(-) delete mode 100644 sources/news/20191114 Red Hat Responds to Zombieload v2.md create mode 100644 translated/news/20191114 Red Hat Responds to Zombieload v2.md diff --git a/sources/news/20191114 Red Hat Responds to Zombieload v2.md b/sources/news/20191114 Red Hat Responds to Zombieload v2.md deleted file mode 100644 index abb1a2d0d2..0000000000 --- a/sources/news/20191114 Red Hat Responds to Zombieload v2.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Red Hat Responds to Zombieload v2) -[#]: via: (https://www.networkworld.com/article/3453596/red-hat-responds-to-zombieload-v2.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Red Hat Responds to Zombieload v2 -====== -Red Hat calls for updating Linux software to address Intel processor flaws that can lead to data-theft exploits -Stephen Lawson/IDG - -Three Common Vulnerabilities and Exposures (CVEs) opened yesterday track three flaws in certain Intel processors, which, if exploited, can put sensitive data at risk. - -Of the flaws reported, the newly discovered Intel processor flaw is a variant of the Zombieload attack discovered earlier this year and is only known to affect Intel’s Cascade Lake chips. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - -Red Hat strongly suggests that all Red Hat systems be updated even if they do not believe their configuration poses a direct threat, and it is providing resources to their customers and to the enterprise IT community. - -[][2] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][2] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -The three CVEs are: - - * CVE-2018-12207 - Machine Check Error on Page Size Change - * CVE-2019-11135 - TSX Asynchronous Abort - * CVE-2019-0155 and CVE-2019-0154 - i915 graphics driver - - - -### CVE-2018-12207 - -Red Hat rates this vulnerability as important. It is a vulnerability that could allow a local and unprivileged attacker to bypass security controls and cause a system-wide denial of service. - -The hardware flaw was found in Intel microprocessors and is related to the Instruction Translation Lookaside Buffer (ITLB). It caches translations from virtual to physical addresses and is intended to improve performance. However, a delay in invalidating cached entries after cache page changes could lead to a processor using an invalid address translation causing a machine check error exception and moving the system into a hang state. - -This kind of scenario could be crafted by an attacker to take a system down. - -### CVE-2019-11135 - -Red Hat rates this vulnerability as moderate. This Transactional Synchronization Extensions (TSX) Asynchronous Abort is a Microarchitectural Data Sampling (MDS) flaw. A local attacker using custom code could use this flaw to gather information from cache contents on the processor and processors that support simultaneous multithreading (SMT) and TSX. - -### CVE-2019-0155, CVE-2019-0154 - -Red Hat rates the **CVE-2019-0155** flaw as important and the CVE-2019-0154 as moderate. Both flaws are related to the i915 graphics driver. - -CVE-2019-0155 allows allows an attacker to bypass conventional memory security restrictions, allowing write access to privileged memory that ought to be restricted. - -CVE-2019-0154 could allow an local attacker to create an invalid system state when the Graphics Processing Unit (GPU) is in low power mode, leading to the system becoming inaccessible. - -The only affected graphics card affected by CVE-2019-0154 is on the **i915** kernel module. The **lsmod** command can be used to indicate vulnerability. Any output like that shown below (i.e., starting with i915) indicates that this system is vulnerable: - -``` -$ lsmod | grep ^i915 -i915 2248704 10 -``` - -### Additional resources - -Red Hat has provided details and further instructions to its customers and others in the following links: - - - -[https://access.redhat.com/solutions/tsx-asynchronousabort][3] [][4] - - - -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/3453596/red-hat-responds-to-zombieload-v2.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.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[3]: https://access.redhat.com/solutions/tsx-asynchronousabort%20 -[4]: https://access.redhat.com/solutions/i915-graphics -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/news/20191114 Red Hat Responds to Zombieload v2.md b/translated/news/20191114 Red Hat Responds to Zombieload v2.md new file mode 100644 index 0000000000..5f5fa28eb1 --- /dev/null +++ b/translated/news/20191114 Red Hat Responds to Zombieload v2.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat Responds to Zombieload v2) +[#]: via: (https://www.networkworld.com/article/3453596/red-hat-responds-to-zombieload-v2.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +红帽对 Zombieload v2 缺陷的应对 +====== +![](https://images.techhive.com/images/article/2015/10/20151027-red-hat-logo-100625237-large.jpg) + +> 红帽呼吁更新 Linux 软件,以解决可能导致数据盗用的英特尔处理器缺陷。 + +前两天公开的三个“常见漏洞和披露”(CVE)跟踪的是某些英特尔处理器中的三个漏洞,如果利用这些漏洞,可能会使敏感数据面临风险。 + +在报告的缺陷中,新发现的英特尔处理器缺陷是今年早些时候发现的 Zombieload 攻击的变种,并且仅会影响英特尔的 Cascade Lake 芯片。 + +红帽强烈建议,所有的红帽系统即使不认为其配置构成直接威胁,也要对其进行更新,并且红帽正在向其客户和企业 IT 社区提供资源。 + +这三个 CVE 是: + +* CVE-2018-12207:页面大小更改时的机器检查错误 +* CVE-2019-11135:TSX异步中止 +* CVE-2019-0155 和 CVE-2019-0154:i915 图形驱动程序 + +### CVE-2018-12207 + +红帽将该漏洞评为重要。此漏洞可能使本地和非特权的攻击者绕过安全控制并导致系统范围的拒绝服务。 + +硬件缺陷是在英特尔微处理器中发现的,并且与指令翻译后备缓冲区(ITLB)有关。它缓存从虚拟地址到物理地址的转换,旨在提高性能。但是,在缓存页面更改后,使缓存的条目无效的延迟可能导致处理器使用无效的地址转换,从而导致机器检查错误异常并使系统进入挂起状态。 + +攻击者可以制作这种情况来关闭系统。 + +### CVE-2019-11135 + +红帽将此漏洞评为中级。这个事务同步扩展(TSX)异步中止是一个微体系结构数据采样(MDS)缺陷。使用定制代码的本地攻击者可以利用此漏洞从处理器以及支持同时多线程(SMT)和 TSX 的处理器上的缓存内容中收集信息。 + +### CVE-2019-0155,CVE-2019-0154 + +红帽将 CVE-2019-0155 漏洞评为重要,将 CVE-2019-0154 漏洞评为中级。这两个缺陷都与 i915 图形驱动程序有关。 + +CVE-2019-0155 允许攻击者绕过常规的内存安全限制,从而允许对应该受到限制的特权内存进行写访问。 + +当图形处理单元(GPU)处于低功耗模式时,CVE-2019-0154 可能允许本地攻击者创建无效的系统状态,从而导致系统无法访问。 + +唯一受 CVE-2019-0154 影响的的显卡在 i915 内核模块上受到影响。`lsmod` 命令可用于指示该漏洞。 如下所示的任何输出(即以 i915 开头)都表明该系统易受攻击: + +``` +$ lsmod | grep ^i915 +i915 2248704 10 +``` + +### 更多资源 + +红帽在以下链接中向其客户和其他人提供了详细信息和进一步的说明: + +- +- +- + + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3453596/red-hat-responds-to-zombieload-v2.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.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://access.redhat.com/solutions/tsx-asynchronousabort%20 +[4]: https://access.redhat.com/solutions/i915-graphics +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 7fc8ef4b97b831fba3b20269d12ca09835f1f4c3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 22:48:20 +0800 Subject: [PATCH 499/800] PUB @wxy https://linux.cn/article-11583-1.html --- .../20191114 Red Hat Responds to Zombieload v2.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191114 Red Hat Responds to Zombieload v2.md (98%) diff --git a/translated/news/20191114 Red Hat Responds to Zombieload v2.md b/published/20191114 Red Hat Responds to Zombieload v2.md similarity index 98% rename from translated/news/20191114 Red Hat Responds to Zombieload v2.md rename to published/20191114 Red Hat Responds to Zombieload v2.md index 5f5fa28eb1..ef755c9c78 100644 --- a/translated/news/20191114 Red Hat Responds to Zombieload v2.md +++ b/published/20191114 Red Hat Responds to Zombieload v2.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11583-1.html) [#]: subject: (Red Hat Responds to Zombieload v2) [#]: via: (https://www.networkworld.com/article/3453596/red-hat-responds-to-zombieload-v2.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From c8daad30972b1c7483c84679cf41cb01ecb3cea4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 23:16:21 +0800 Subject: [PATCH 500/800] PRF --- ...How to add a user to your Linux desktop.md | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/translated/tech/20191107 How to add a user to your Linux desktop.md b/translated/tech/20191107 How to add a user to your Linux desktop.md index 743ca8245e..2261a762bb 100644 --- a/translated/tech/20191107 How to add a user to your Linux desktop.md +++ b/translated/tech/20191107 How to add a user to your Linux desktop.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to add a user to your Linux desktop) @@ -9,24 +9,26 @@ 如何在 Linux 桌面添加用户 ====== -无论是在安装中还是在桌面中,通过图形界面管理用户都非常容易。 + +> 无论是在安装过程中还是在桌面中,通过图形界面管理用户都非常容易。 + ![Team of people around the world][1] 添加用户是你在一个新系统上要做的第一件事。而且,你通常需要在计算机的整个生命周期中管理用户。 -我的关于 [**useradd** 命令][2]文章提供了更深入的对 Linux 的用户管理的了解。useradd 是一个命令行工具,但是你也可以在 Linux 上以图形方式管理用户。这就是本文的主题。 +我的关于 [useradd 命令][2]文章提供了更深入的对 Linux 的用户管理的了解。`useradd` 是一个命令行工具,但是你也可以在 Linux 上以图形方式管理用户。这就是本文的主题。 ### 在 Linux 安装过程中添加用户 -大多数 Linux 发行版都提供了在安装过程中创建用户的步骤。例如,Fedora 30 安装程序 Anaconda 创建标准的 _root_ 用户和另一个本地用户帐户。在安装过程中进入“配置”页面时,单击“用户设置”下的“用户创建”。 +大多数 Linux 发行版都提供了在安装过程中创建用户的步骤。例如,Fedora 30 安装程序 Anaconda 创建标准的 `root` 用户和另一个本地用户帐户。在安装过程中进入“配置”页面时,单击“用户设置”下的“用户创建”。 ![Fedora Anaconda Installer - Add a user][3] -在用户创建页面上,输入用户的详细信息:**全名**、**用户名**和**密码**。你还可以选择是否使用户成为管理员。 +在用户创建页面上,输入用户的详细信息:全名、用户名和密码。你还可以选择是否使用户成为管理员。 ![Create a user during installation][4] -点击**高级**按钮打开**高级用户配置**页面。如果需要除默认设置以外的其他设置,那么可以在此处指定主目录的路径以及用户和组 ID。你也可以输入用户所属的其他组。 +点击“高级”按钮打开“高级用户配置”页面。如果需要除默认设置以外的其他设置,那么可以在此处指定主目录的路径以及用户和组 ID。你也可以输入用户所属的其他组。 ![Advanced user configuration][5] @@ -36,13 +38,13 @@ 许多 Linux 发行版都使用 GNOME 桌面。以下截图来自 Red Hat Enterprise Linux 8.0,但是在其他发行版(如 Fedora、Ubuntu 或 Debian)中,该过程相似。 -首先打开“设置”。然后打开**详细**,选择**用户**,单击**解锁**,然后输入密码(除非你已经以 root 用户登录)。这样将用“添加用户”按钮代替“解锁”按钮。 +首先打开“设置”。然后打开“详细”,选择“用户”,单击“解锁”,然后输入密码(除非你已经以 root 用户登录)。这样将用“添加用户”按钮代替“解锁”按钮。 ![GNOME user settings][6] -现在,你可以通过单击**添加用户**,然后选择帐户**类型**然后输入**用户名**和**密码**来添加用户。 +现在,你可以通过单击“添加用户”,然后选择“帐户类型”然后输入“用户名”和“密码”来添加用户。 -在下面的截图中,已经输入了用户名,设置保留为默认设置。我不必输入**用户名**,因为它是在我在“全名”字段中输入时自动创建的。如果你不喜欢自动补全,你仍然可以对其进行修改。 +在下面的截图中,已经输入了用户名,设置保留为默认设置。我不必输入“用户名”,因为它是在我在“全名”字段中输入时自动创建的。如果你不喜欢自动补全,你仍然可以对其进行修改。 ![GNOME settings - add user][7] @@ -69,7 +71,7 @@ via: https://opensource.com/article/19/11/add-user-gui-linux 作者:[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 57dac1fbfd219e316f9a819f039d584f86af6e5a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 16 Nov 2019 23:25:55 +0800 Subject: [PATCH 501/800] PUB @geekpi https://linux.cn/article-11584-1.html --- .../20191107 How to add a user to your Linux desktop.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191107 How to add a user to your Linux desktop.md (98%) diff --git a/translated/tech/20191107 How to add a user to your Linux desktop.md b/published/20191107 How to add a user to your Linux desktop.md similarity index 98% rename from translated/tech/20191107 How to add a user to your Linux desktop.md rename to published/20191107 How to add a user to your Linux desktop.md index 2261a762bb..9242826ebe 100644 --- a/translated/tech/20191107 How to add a user to your Linux desktop.md +++ b/published/20191107 How to add a user to your Linux desktop.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11584-1.html) [#]: subject: (How to add a user to your Linux desktop) [#]: via: (https://opensource.com/article/19/11/add-user-gui-linux) [#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) From 342e419ca2fd6c26824d1171487e98b5b7a6484d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 17 Nov 2019 00:53:47 +0800 Subject: [PATCH 502/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191116=204=20cr?= =?UTF-8?q?itical=20growth=20opportunities=20for=20open=20source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191116 4 critical growth opportunities for open source.md --- ...al growth opportunities for open source.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20191116 4 critical growth opportunities for open source.md diff --git a/sources/tech/20191116 4 critical growth opportunities for open source.md b/sources/tech/20191116 4 critical growth opportunities for open source.md new file mode 100644 index 0000000000..f6faf87deb --- /dev/null +++ b/sources/tech/20191116 4 critical growth opportunities for open source.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 critical growth opportunities for open source) +[#]: via: (https://opensource.com/article/19/11/open-source-growth-opportunities) +[#]: author: (Tony Wasserman https://opensource.com/users/tonywasserman) + +4 critical growth opportunities for open source +====== +There has been tremendous growth in open source; now the issue is +predicting its strongest opportunities. +![Green graph of measurements][1] + +I recently served on a panel about growth opportunities in open source at the [Open Source India][2] conference in Bengaluru. As you might expect, my fellow panelists and I approached the topic from widely varying perspectives, and I came away with the feeling that we may have confused many in the audience rather than enlightening them. With that in mind, I thought it would be useful to consolidate the panel's ideas about open source growth opportunities, drawing upon many of the points put forth in the session as well as my own thoughts. + +### The state of open source + +Adoption and use of free and open source software (FOSS) in India (and elsewhere) have grown remarkably over the past 15 years, going back to the first Open Source India conference (then called Linux Asia). At that time, FOSS was largely the province of technologists and developers, with very little adoption by governments, industry, and other organizations. On the contrary, there was some active resistance to FOSS, with Microsoft's then-CEO, Steve Ballmer, calling it a "Communist plot." The earliest commercial ventures in FOSS started a decade earlier with leaders such as Red Hat, [Mandrake][3], and MySQL. Traditional system integrators, such as TCS and Wipro, built their customer solutions with proprietary, closed source software. + +Today, the picture is very different. Microsoft's current CEO, Satya Nadella, said Microsoft is "all-in on open source" when he announced its US$ 7.5 billion acquisition of GitHub earlier this year and the appointment of Nat Friedman, former CEO of a commercial FOSS business, as the new head of GitHub. + +There are now hundreds of companies all over the world that have developed businesses that provide FOSS and related services. Beyond that, many companies have moved up the FOSS adoption curve, going from initial experimentation, through using FOSS in their products, then contributing FOSS code to various projects, and releasing their own FOSS projects (such as [Cassandra][4] and [TensorFlow][5]) as open source. + +One significant outcome of this shift is that FOSS has moved from a "copycat" of proprietary software to being the basis for innovative advances. Much of the leading software in areas such as management of large data sets, microservices, and Internet of Things (IoT) has been released under an Open Source Initiative [(OSI)-approved open source license][6]. More than a third of all servers worldwide and all supercomputers run Linux. On the consumer side, more than 80% of all smartphones run the Linux-based Android operating system, with many vendors adding their own enhancements to the foundation code. + +In short, there has already been tremendous growth in the adoption and use of FOSS. It's unusual to find large companies whose developers don't make extensive use of open source components and libraries in their products. The issues now are projecting where FOSS is headed and identifying the areas with sizeable growth potential. + +### Technology growth opportunities + +The number of FOSS projects has grown exponentially. GitHub hosts more than 100 million projects from more than 40 million contributors. Only a tiny percentage of these projects are suitable to be adopted for production use in business-critical systems; millions have been abandoned by their creator(s). Perhaps 0.01% (10,000) of them would satisfy the needs of someone building product-quality software. There are ample evidence and general agreement that the best FOSS code is equal in quality to, if not better than, closed proprietary code. + +But there's a lot of room for technology growth. First, there's growing adoption of FOSS technology—from programming languages to specialized libraries and from infrastructure software to end-user applications—particularly among developers. Next, the size of communities around successful projects (such as Python) is growing quickly, not only with new versions of projects and numbers of maintainers but also with organizations that provide support services, including documentation, translation, and extensions and add-ons, for these technology projects. In some cases, these extensions and add-ons are proprietary, yielding an "open core" approach, where the core retains its FOSS status but customers must pay for some of the add-ons. + +Software developers have been on the leading edge of this technology growth. Expensive commercial developer tools have largely been displaced by FOSS tools. An excellent example is the [Eclipse][7] environment, supported by contributors to the Eclipse Foundation, which was derived from IBM's commercial VisualAge tools. Microsoft's Visual Studio once sold for as much as US$ 2,000 per user. Today's tools for coding, testing, continuous integration, DevOps, and collaboration are often free, and developers, particularly in startups, have chosen them over other options. + +There's also a place for new FOSS projects as technology evolves and traditional products become increasingly software-dependent. Automobiles and medical devices fall into this category. Newer automobiles are highly dependent on software in virtually every aspect of their operation, not just for autonomous operation but also for overall efficiency, self-detection of faults, and over-the-air software updates. Today, much of that software is proprietary, but it contains vast amounts of FOSS. For example, many of the entertainment systems offered by commercial airlines are built on Linux. It's possible that regulatory agencies or public sentiment will eventually require life-critical applications to be open. + +The venture capitalist Mark Andreesen is known (among other things) for saying "software is eating the world." That means not only more software but also more societal dependence on that software's secure and proper functioning. There's a great impact on FOSS as user expectations for usability, reliability, and overall quality continue to grow. The role of open source foundations is also important here because the larger foundations host more projects, involve more contributors in their projects, and maintain governance over those projects, all of which give users greater confidence in the quality and long-term viability of these FOSS projects. + +### Employment growth + +These trends point clearly to the need for a big jump in jobs for professionals interested in working with open source. While developers are an obvious need, the range of employment opportunities is much larger and includes quality assurance (QA) and release engineers, engineering managers, support engineers, consultants, service providers, executives, and even legal experts to help with licenses and contracts that involve FOSS. For example, many companies will need to establish an open source project office (OSPO) to keep track of their use of FOSS code and staff it with FOSS-knowledgeable people who can work with internal groups on the company's use of FOSS and their contributions to various external FOSS projects and organizations, such as the Apache Foundation. Another example is the growth of information services related to FOSS, including publications, conferences, newsletters, blogs, and consultancies. + +These requirements suggest the need for expanded educational programs related to FOSS. Many programs are emerging to encourage young people to learn how to code, and it is a straightforward extension to introduce FOSS at an early stage to create a growing pool of talent coming through secondary and university-level educational programs to meet employment needs. This also increases the demand for experienced FOSS-aware professionals to teach technology and related topics to students. + +### Business growth + +The growth of FOSS use implies growth opportunities for businesses that develop FOSS and provide FOSS-related services, including project hosting, system integration, and commercial support (e.g., training and QA). As noted above, companies and governments will need people within their organizations and in the broader community around the projects that are most important to their businesses. + +The economies of the world have natural business cycles, with newer companies growing and often displacing incumbents. For example, early database systems were replaced by relational database systems such as Oracle and DB2, which are now competing for market share with non-relational database applications, many of them open source, such as Apache CouchDB and [Neo4j][8]. The former are mature businesses, while the latter are growing at a rapid rate. Employment applicants seek out these growing companies since they not only provide greater internal career advancement opportunities but also the chance to work on leading-edge technology and potentially to benefit from the increased value of such companies as they grow. For example, GitHub and Red Hat employees benefited when these companies were acquired by Microsoft and IBM, respectively, earlier this year. + +Technology customers reinforce these patterns since few want to spend their money on the trailing edge of technology. Unless they regularly update their systems, they will fall behind competitors that make more effective use of technology. Walmart, one of the world's largest retailers, ascribes much of its historic growth to the software technology used to manage its supply chain; by contrast, the international retail clothing chain Forever21 recently filed for bankruptcy, with analysts noting that the company made very poor use of technology. + +These corporate technology buying decisions often create situations where a small number of software vendors come to dominate the market. For a long time, those decisions favored proprietary technology vendors, in part because industry analysts recommended them over FOSS. Now, however, FOSS companies are receiving greater attention, not only because they offer a lower total cost of ownership for their customers, but also because these commercially-focused FOSS businesses have added support services and service level agreements to match traditional vendors. These developments suggest that the leading FOSS companies and products will continue to grow as technology buyers become more comfortable with these newer entries in the software market. + +### Investment growth + +With the topic of "growth opportunities" as the Open Source India panel's theme, one natural aspect for discussion involved opportunities for angel investors, business accelerators, venture capitalists, and others to benefit financially from funding commercial FOSS companies or investing in publicly traded companies with a significant role in FOSS. + +The [OSS Capital][9] website has a tab labeled COSSCI (for Commercial Open Source Software Company Index) that lists more than 40 FOSS companies with annual revenue exceeding US$ 100 million and valuations in excess of US$ 1 billion. All but three of the companies on the list have received venture capital funding averaging US$ 240 million. At that level, not all of the FOSS companies will provide a return to their investors, but the overall data shows that a growing number of knowledgeable investors are acting on the belief that FOSS companies will continue to grow their revenue and profitability, whether they are entries in a new market segment or capturing market share in market segments historically dominated by proprietary vendors. + +It's not that technology customers will abandon the systems on which they manage their businesses, but rather that decision-makers in up-and-coming companies will be more likely to choose FOSS solutions than their counterparts in legacy businesses. One can also view IBM's acquisition of Red Hat in this light, using Red Hat's products as a FOSS alternative to IBM's previous generations of software products. + +It's clear that such investments of capital can assist companies from their earliest stages through their lifetimes, often resulting in their acquisition or public offering. Companies need funding to grow beyond their initial development, especially to generate awareness of their products and services through marketing programs, create auxiliary support services, and invest in further product development in response to customer requirements, changing markets, and evolving platforms. The founders of such companies spend a disproportionate amount of time seeking investment funding and negotiating the terms of such funding since their growth potential depends on their ability to hire and adequately compensate their employees, as well as to launch their products and build the sales and marketing channels to establish themselves in the market. + +Over time, though, these companies must generate revenue and profits from customer purchases so that they are no longer dependent on investor funding. Some companies, such as WhatsApp, are acquired while they are very small, as larger companies see their potential, and are then in a position to fund their ongoing growth. Nonetheless, many startup companies fail to achieve "liftoff" and join the large percentage of startups that don't make it past the initial development stage. These companies tend to fail from being underfunded, from poor management decisions related to hiring, and from an inability to identify a market need that will attract customers. + +### Conclusion + +In summary, the past growth and the potential for continued growth in FOSS-related products and services have far exceeded the expectations of experts from a decade ago. Looking back, it's clear that the worldwide [Great Recession][10] caused many companies to explore FOSS more thoroughly. Also, FOSS's growing availability and quality led organizations to expand its use beyond developers and pilot projects into business-critical situations. Investors were attracted by the US$ 1 billion acquisition of MySQL AB by Sun Microsystems, more than 15x the annual sales revenue of MySQL at that time. + +However, there are still many opportunities for growth. Only a tiny percentage of apps for mobile devices are open source (see [F-Droid][11] for open source Android apps). Also, technology companies, including telecommunications and computer systems, are much more likely to have made significant FOSS deployments. Adoption has been much slower in domains such as insurance, but they are now using machine-learning (ML) and artificial intelligence (AI) tools, such as the FOSS R statistical package, to help them with decision-making. Beyond that, the growth of "smart devices" and "smart cities" draws heavily upon the use of these ML and AI tools, ensuring that the world will become more and more dependent not just upon software, but upon open source. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/open-source-growth-opportunities + +作者:[Tony Wasserman][a] +选题:[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/tonywasserman +[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://www.opensourceindia.in/ +[3]: https://openmandriva.org/ +[4]: https://opensource.com/life/16/5/basics-cassandra-and-spark-data-processing +[5]: https://opensource.com/article/17/2/machine-learning-projects-tensorflow-raspberry-pi +[6]: https://opensource.org/licenses +[7]: https://opensource.com/education/16/4/5-great-eclipse-scientific-workbenches +[8]: https://opensource.com/article/17/7/fundamentals-graph-databases-neo4j +[9]: https://oss.capital/ +[10]: https://en.wikipedia.org/wiki/Great_Recession +[11]: https://f-droid.org/ From 980e85abc7f994bc32621de432c62a1f6f78ff67 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 17 Nov 2019 00:54:49 +0800 Subject: [PATCH 503/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191116=20IoT=20?= =?UTF-8?q?in=202020:=20The=20awkward=20teenage=20years?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191116 IoT in 2020- The awkward teenage years.md --- ... IoT in 2020- The awkward teenage years.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/talk/20191116 IoT in 2020- The awkward teenage years.md diff --git a/sources/talk/20191116 IoT in 2020- The awkward teenage years.md b/sources/talk/20191116 IoT in 2020- The awkward teenage years.md new file mode 100644 index 0000000000..7997d95629 --- /dev/null +++ b/sources/talk/20191116 IoT in 2020- The awkward teenage years.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IoT in 2020: The awkward teenage years) +[#]: via: (https://www.networkworld.com/article/3453643/iot-in-2020-the-awkward-teenage-years.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +IoT in 2020: The awkward teenage years +====== +The internet of things will see more growth in 2020, along with more growing pains - security, lack of complete solutions +Thinkstock + +Much of the hyperbole around the [Internet of Things][1] isn’t really hyperbole anymore – the instrumentation of everything from cars to combine harvesters to factories is just a fact of life these days. IoT’s here to stay. + +Yet despite the explosive growth – one widely cited prediction from Gartner says that the number of enterprise and automotive IoT endpoints will reach 5.8 billion in 2020 – the IoT market’s ability to address its known flaws and complications has progressed at a far more pedestrian pace. That means ongoing security woes and a lack of complete solutions are most of what can be safely predicted for the coming year. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Part of the problem, according to experts, is that there are still two distinct, recognizable types of vendor competing in the IoT market: IT companies with plenty of technological expertise but little hands-on operational experience, and established vendors across the various verticals without much IT sophistication. + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][3] ]** + +What this means from a practical standpoint is that, most of the time, no single vendor is able to offer a complete solution to a given IoT problem and, therefore, unable to solve the broader issues with IoT technology in a unitary way. + +### Security + +The main issue, of course, remains security. From the standpoint of the IT networking professional, implementing IoT can be like actively inviting security breaches, according to IDC senior research analyst Patrick Filkins. + +“IoT is a massive challenge for an IT admin,” he said. “You’re putting hundreds of thousands of low-cost, high-risk devices on the network.” + +The  divide between IT and OT is one of the central causes of the security problem. The companies that make most of the sensors for IoT are companies that have experience in their particular area – oil drilling equipment makers, industrial vendors, medical device manufacturers, and so on. Such companies are used to delivering value for money. + +“If you want [IoT at scale], you need to bring the price point down on all those sensors, and that affects security,” Filkins said. + +451 Research vice president Christian Renaud said that despite the fact that there’s a growing recognition that the security issue is very serious, the sheer volume of new endpoints and types of endpoints flooding into the market in the next few years makes a serious breach all but certain. + +One of the keys to securing the IoT, he said, is the use of behavioral analytics on the network – even if individual IoT devices remain difficult to secure, a machine-learning-based system that recognizes malicious traffic – what he calls the “Why is my sensor calling the Ukraine?” problem – could help address the problem. + +### IT– OT collaboration + +What’s coming, according to Renaud, is a more pragmatic understanding of what IoT means. + +“More than anything, we’ve matured past the early confusion, ambiguity and hyperbole,” he said, “to understanding that it’s a whole bunch of different technologies across dozens of use cases in dozens of markets.” + +And what that implies is an even greater degree of collaboration throughout the IoT sector. IT companies have been aggressive in partnering up with OT companies, and there’s a general recognition that most complete IoT solutions will involve products from multiple vendors. + +Part of the reason for that is money. An IT mega-giant like Google or Microsoft could, in theory, target a particular IoT vertical, acquire existing companies for their operational know-how, and offer a floor-to-ceiling, say, medical-device management system. But the sense is that it simply wouldn’t be cost-effective, according to Filkins. + +“It’s less advantageous for them to do vertical solutions,” he said,” because those cost more money for a smaller market.” + +That isn’t to say that the major IT players aren’t targeting different verticals, just that they’re doing it in what, for them, is a somewhat uncharacteristic manner – repackaging their offerings for different industries and partnering with OT companies, said Renaud. + +“What we’re accustomed to is a winner-take all mentality, where someone in IT just owns a sector,” he said. “But if you look at the [IoT] verticals, a lot of it is dominated by incumbents.” + +It doesn’t help that the IoT sector has only recently begun to realize that many verticals have enormously long equipment lifecycles, meaning that the brownfield is infinitely larger than the greenfield. For IT companies used to dominating particular corners of their industry – or, indeed, creating new markets altogether – the idea that nothing gets fully ripped-and-replaced is an adjustment. + +### Edge networking + +Another one of the major trends for 2020, Filkins noted, will be that enterprises start to move away from cloud-driven IoT deployments and more toward systems that do their computing close to the edge – [edge computing][4]. The cloud can be a limiting factor in a lot of IoT deployments, mostly due to the fact that having to send information from a sensor all the way back to a public cloud, processing it there, and having the results sent from the cloud to the user involves delay. + +“That’s limiting from an application performance point of view,” said Filkins. “We’ve all heard about the edge, I think it’s overhyped, but I think it’s happening.” + +**Read more about edge networking** + + * [How edge networking and IoT will reshape data centers][5] + * [Edge computing best practices][6] + * [How edge computing can help secure the IoT][7] + + + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3453643/iot-in-2020-the-awkward-teenage-years.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/3207535/what-is-iot-how-the-internet-of-things-works.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[4]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[5]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html +[6]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html +[7]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From ff7b2dec3ae173cbab079c12306a2b2a7a91e67e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 17 Nov 2019 01:00:29 +0800 Subject: [PATCH 504/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191116=20Should?= =?UTF-8?q?=20I=20Choose=20a=20Managed=20WordPress=20Hosting=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191116 Should I Choose a Managed WordPress Hosting.md --- ...ld I Choose a Managed WordPress Hosting.md | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 sources/talk/20191116 Should I Choose a Managed WordPress Hosting.md diff --git a/sources/talk/20191116 Should I Choose a Managed WordPress Hosting.md b/sources/talk/20191116 Should I Choose a Managed WordPress Hosting.md new file mode 100644 index 0000000000..240adb355c --- /dev/null +++ b/sources/talk/20191116 Should I Choose a Managed WordPress Hosting.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Should I Choose a Managed WordPress Hosting?) +[#]: via: (https://opensourceforu.com/2019/11/should-i-choose-a-managed-wordpress-hosting/) +[#]: author: (Mark Hanson https://opensourceforu.com/author/mark-hanson/) + +Should I Choose a Managed WordPress Hosting? +====== + +[![WordPress][1]][2] + +_After the first wave of the great eCommerce revolution of the 21st century, businesses began to question what it is they really needed out of a website. Web 1.0 was fraught with false starts: guestbooks, webrings, Flash intro pages, and all sorts of frills. Then online commerce began to dial it back. It turns out that for many businesses, a blog really is all you need._ + +For a vast chunk of the online business world, that means “a WordPress install,” and then you’re done. [_WordPress makes up a whopping one-third_][3] of the top 10 million websites. Not only is this an overwhelming vote of confidence, but it also means that most bloggers, editors, website maintainers, and social media marketers will be trained in WordPress as a standard tool, so it’s easy to find staff to maintain it and difficult to find anybody experienced in other content management systems. + +**Other Options** + +Before most businesses stumble upon the idea of managed WordPress hosting, they typically go to one of the cheaper routes: + + * Building a freebie blog on Blogger or Wix + * Shared hosting on some third-rate server warehouse + * Getting a “web guy” who knows how to maintain a VPS + + + +All of these options are rock-bottom cheap, but the old axiom “you get what you pay for” soon becomes apparent. Small sites hosted by the hundreds on the same server tend to get small traffic, be prone to break and end up being tougher to maintain. + +At the opposite end is the dedicated server, which, while it is just the thing for a Fortune 500 company, is far more than any start-up needs. Full server hosting will typically require someone to maintain it 24/7, with more sophisticated skills required. + +**A WordPress Site That Runs Itself** + +More businesses are turning to managed WordPress hosting for the practical advantage it offers. It’s a right-size fit offering the balance between heavy-duty enough to take a pounding in web traffic, but not so massive that it’s a time and money sink to maintain. + + * Support on a managed account beats any other service. + * The site is tuned to run WordPress better without bothering with peripheral matters. + * Maintenance tasks like backups and are handled automatically. + * Easier maintenance. + * More robust security than the average WordPress install. + * Better performance overall. + + + +Since you’re not on a shared server, a managed WordPress host gives you better DNS access, and lets you use tools like SSH, Git, and WP-CLI. Whoever you get to mage your online presence, they’ll appreciate the greater selection of tools at their disposal. + +**Staging with Softaculous** + +There is one important aspect to managed WordPress hosting which is often overlooked: [_Staging_][4]. When you need to install new plugins or templates on a site, it’s a risky proposition every time. If you install something that breaks the site, it’s messy to remove and costs you downtime. Manually backing-up the site, testing on the scratch copy, then figuring out how to port the changes back to the main site is also time-consuming. + +Staged installs allow a one-click managed scripting process which tests the proposed install before you commit to it. It’s like a virtual sandbox where you can freely test changes before committing to them. Softaculous, an open-source script library for website maintenance, is a typical managed WordPress package manager that supports staging. You can even [_install WordPress with Softaculous_][5], and from there other package additions are a breeze. + +**A Worry-Free Website** + +The biggest plus to getting a host with a managed WordPress plan is that the set-up is done for you. You simply pick up your blog and go, as simply as you would open a notebook and begin writing. New website owners are best off if they leave the engineering details to an expert. Between coming up with content, priming it for SEO, posting it, and promoting it through social media, you’ll have plenty to worry about as it is. + +Managed WordPress hosting is great for beginners or those who are more focused on the content itself than the nuts and bolts of network engineering. The only partial caveats is, of course, if your online presence will hinge on something besides WordPress, perhaps needing Drupal or Joomla, then you’d be better off getting a more sophisticated package deal. But for most web businesses, from sole proprietors to budding enterprises, WordPress is a flexible one-size-fits-all solution. + +![Avatar][6] + +[Mark Hanson][7] + +[![][8]][9] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/should-i-choose-a-managed-wordpress-hosting/ + +作者:[Mark Hanson][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/mark-hanson/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/09/WordPress.jpg?resize=696%2C421&ssl=1 (WordPress) +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2016/09/WordPress.jpg?fit=750%2C454&ssl=1 +[3]: https://en.wikipedia.org/wiki/WordPress +[4]: https://www.softaculous.com/docs/enduser/create-staging/ +[5]: https://www.greengeeks.com/tutorials/article/how-to-install-wordpress-using-softaculous/ +[6]: https://secure.gravatar.com/avatar/e827144d3e2406d876d7222a4ac74782?s=100&r=g +[7]: https://opensourceforu.com/author/mark-hanson/ +[8]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[9]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 3bfde928375e1caa87671584aed67208ee3bfb10 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 17 Nov 2019 18:59:38 +0800 Subject: [PATCH 505/800] Rename sources/tech/20191116 4 critical growth opportunities for open source.md to sources/talk/20191116 4 critical growth opportunities for open source.md --- .../20191116 4 critical growth opportunities for open source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191116 4 critical growth opportunities for open source.md (100%) diff --git a/sources/tech/20191116 4 critical growth opportunities for open source.md b/sources/talk/20191116 4 critical growth opportunities for open source.md similarity index 100% rename from sources/tech/20191116 4 critical growth opportunities for open source.md rename to sources/talk/20191116 4 critical growth opportunities for open source.md From 48da4f3f9b62c8e083cccec83daee1c839010835 Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 17 Nov 2019 19:41:51 +0800 Subject: [PATCH 506/800] =?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 --- ...lls with the Python ORM tool SQLAlchemy.md | 208 ------------------ ...lls with the Python ORM tool SQLAlchemy.md | 191 ++++++++++++++++ 2 files changed, 191 insertions(+), 208 deletions(-) delete mode 100644 sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md create mode 100644 translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md diff --git a/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md b/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md deleted file mode 100644 index c373e85502..0000000000 --- a/sources/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md +++ /dev/null @@ -1,208 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MjSeven ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to fix common pitfalls with the Python ORM tool SQLAlchemy) -[#]: via: (https://opensource.com/article/19/9/common-pitfalls-python) -[#]: author: (Zach Todd https://opensource.com/users/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez) - -How to fix common pitfalls with the Python ORM tool SQLAlchemy -====== -Seemingly small choices made when using SQLAlchemy can have important -implications on the object-relational mapping toolkit's performance. -![A python with a package.][1] - -Object-relational mapping ([ORM][2]) makes life easier for application developers, in no small part because it lets you interact with a database in a language you may know (such as Python) instead of raw SQL queries. [SQLAlchemy][3] is a Python ORM toolkit that provides access to SQL databases using Python. It is a mature ORM tool that adds the benefit of model relationships, a powerful query construction paradigm, easy serialization, and much more. Its ease of use, however, makes it easy to forget what is going on behind the scenes. Seemingly small choices made using SQLAlchemy can have important performance implications. - -This article explains some of the top performance issues developers encounter when using SQLAlchemy and how to fix them. - -### Retrieving an entire result set when you only need the count - -Sometimes a developer just needs a count of results, but instead of utilizing a database count, all the results are fetched and the count is done with **len** in Python. - - -``` -`count = len(User.query.filter_by(acct_active=True).all())` -``` - -Using SQLAlchemy's **count** method instead will do the count on the server side, resulting in far less data sent to the client. Calling **all()** in the prior example also results in the instantiation of model objects, which can become expensive quickly, given enough rows. - -Unless more than the count is required, just use the **count** method. - - -``` -`count = User.query.filter_by(acct_active=True).count()` -``` - -### Retrieving entire models when you only need a few columns - -In many cases, only a few columns are needed when issuing a query. Instead of returning entire model instances, SQLAlchemy can fetch only the columns you're interested in. This not only reduces the amount of data sent but also avoids the need to instantiate entire objects. Working with tuples of column data instead of models can be quite a bit faster. - - -``` -result = User.query.all() -for user in result: -    print(user.name, user.email) -``` - -Instead, select only what is needed using the **with_entities** method. - - -``` -result = User.query.with_entities(User.name, User.email).all() -for (username, email) in result: -    print(username, email) -``` - -### Updating one object at a time inside a loop - -Avoid using loops to update collections individually. While the database may execute a single update very quickly, the roundtrip time between the application and database servers will quickly add up. In general, strive for fewer queries where reasonable. - - -``` -for user in users_to_update: -  user.acct_active = True -  db.session.add(user) -``` - -Use the bulk update method instead. - - -``` -query = User.query.filter(user.id.in_([user.id for user in users_to_update])) -query.update({"acct_active": True}, synchronize_session=False) -``` - -### Triggering cascading deletes - -ORM allows easy configuration of relationships on models, but there are some subtle behaviors that can be surprising. Most databases maintain relational integrity through foreign keys and various cascade options. SQLAlchemy allows you to define models with foreign keys and cascade options, but the ORM has its own cascade logic that can preempt the database. - -Consider the following models. - - -``` -class Artist(Base): -    __tablename__ = "artist" - -    id = Column(Integer, primary_key=True) -    songs = relationship("Song", cascade="all, delete") - -class Song(Base): -    __tablename__ = "song" - -    id = Column(Integer, primary_key=True) -    artist_id = Column(Integer, ForeignKey("artist.id", ondelete="CASCADE")) -``` - -Deleting artists will cause the ORM to issue **delete** queries on the Song table, thus preventing the deletes from happening as a result of the foreign key. This behavior can become a bottleneck with complex relationships and a large number of records. - -Include the **passive_deletes** option to ensure that the database is managing relationships. Be sure, however, that your database is capable of this. SQLite, for example, does not manage foreign keys by default. - - -``` -`songs = relationship("Song", cascade="all, delete", passive_deletes=True)` -``` - -### Relying on lazy loading when eager loading should be used - -Lazy loading is the default SQLAlchemy approach to relationships. Building from the last example, this implies that loading an artist does not simultaneously load his or her songs. This is usually a good idea, but the separate queries can be wasteful if certain relationships always need to be loaded. - -Popular serialization frameworks like [Marshmallow][4] can trigger a cascade of queries if relationships are allowed to load in a lazy fashion. - -There are a few ways to control this behavior. The simplest method is through the relationship function itself. - - -``` -`songs = relationship("Song", lazy="joined", cascade="all, delete")` -``` - -This will cause a left join to be added to any query for artists, and as a result, the **songs** collection will be immediately available. Although more data is returned to the client, there are potentially far fewer roundtrips. - -SQLAlchemy offers finer-grained control for situations where such a blanket approach can't be taken. The **joinedload()** function can be used to toggle joined loading on a per-query basis. - - -``` -from sqlalchemy.orm import joinedload - -artists = Artist.query.options(joinedload(Artist.songs)) -print(artists.songs) # Does not incur a roundtrip to load -``` - -### Using the ORM for a bulk record import - -The overhead of constructing full model instances becomes a major bottleneck when importing thousands of records. Imagine, for example, loading thousands of song records from a file where each song has first been converted to a dictionary. - - -``` -for song in songs: -    db.session.add(Song(**song)) -``` - -Instead, bypass the ORM and use just the parameter binding functionality of core SQLAlchemy. - - -``` -batch = [] -insert_stmt = Song.__table__.insert() -for song in songs: -    if len(batch) > 1000: -       db.session.execute(insert_stmt, batch) -       batch.clear() -    batch.append(song) -if batch: -    db.session.execute(insert_stmt, batch) -``` - -Keep in mind that this method naturally skips any client-side ORM logic you might depend on, such as Python-based column defaults. While this method is faster than loading objects as full model instances, your database may have bulk loading methods that are faster. PostgreSQL, for example, has the **COPY** command that offers perhaps the best performance for loading large numbers of records. - -### Calling commit or flush prematurely - -There are many occasions when you need to associate a child record to its parent, or vice versa. One obvious way of doing this is to flush the session so that the record in question will be assigned an ID. - - -``` -artist = Artist(name="Bob Dylan") -song = Song(title="Mr. Tambourine Man") - -db.session.add(artist) -db.session.flush() - -song.artist_id = artist.id -``` - -Committing or flushing more than once per request is usually unnecessary and undesirable. A database flush involves forcing disk writes on the database server, and in most circumstances, the client will block until the server can acknowledge that the data has been written. - -SQLAlchemy can track relationships and manage keys behind the scenes. - - -``` -artist = Artist(name="Bob Dylan") -song = Song(title="Mr. Tambourine Man") - -artist.songs.append(song) -``` - -### Wrapping up - -I hope this list of common pitfalls can help you avoid these issues and keep your application running smoothly. As always, when diagnosing a performance problem, measurement is key. Most databases offer performance diagnostics that can help you pinpoint issues, such as the PostgreSQL **pg_stat_statements** module. - -* * * - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/9/common-pitfalls-python - -作者:[Zach Todd][a] -选题:[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/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_snake_file_box.jpg?itok=UuDVFLX- (A python with a package.) -[2]: https://en.wikipedia.org/wiki/Object-relational_mapping -[3]: https://www.sqlalchemy.org/ -[4]: https://marshmallow.readthedocs.io/en/stable/ diff --git a/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md b/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md new file mode 100644 index 0000000000..0d706249ba --- /dev/null +++ b/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md @@ -0,0 +1,191 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to fix common pitfalls with the Python ORM tool SQLAlchemy) +[#]: via: (https://opensource.com/article/19/9/common-pitfalls-python) +[#]: author: (Zach Todd https://opensource.com/users/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez) + +如何使用 Python ORM 工具 SQLAlchemy 修复常见的陷阱 +====== +在使用 SQLAlchemy 对象关系映射工具包时,那些看似很小的选择可能对性能产生重要影响。 +![A python with a package.][1] + +对象关系映射([ORM][2])使应用程序开发人员的工作更轻松,在很大程度是因为它允许你使用你可能知道的语言(例如 Python)与数据库交互,而不是使用原始 SQL 语句查询。[SQLAlchemy][3] 是一个 Python ORM 工具包,它提供使用 Python 访问 SQL 数据库的功能。它是一个成熟的 ORM 工具,增加了模型关系、强大的查询构造范式、简单的序列化等优点。然而,它的易用性使得人们很容易忘记其背后发生了什么。使用 SQLAlchemy 时做出的看似很小的选择可能产生非常大的性能影响。 + +本文解释了开发人员在使用 SQLAlchemy 时遇到的一些最重要的性能问题,以及如何解决这些问题。 + +### 只需要计数但检索整个结果集 + +有时开发人员只需要一个结果计数,而不是使用数据库计数,获取了所有结果,然后使用 Python 中的 **len** 完成计数。 +``` +count = len(User.query.filter_by(acct_active=True).all()) +``` + +相反,使用 SQLAlchemy 的 **count** 方法将在服务器端执行计数,从而减少发送到客户端的数据。在前面的例子中调用 **all()** 也会导致模型对象的实例化,如果有很多数据,那么时间代价可能会非常昂贵。 + +除非还需要做其他的事情,否则只需使用 **count** 方法。 + +``` +count = User.query.filter_by(acct_active=True).count() +``` + +### 只需要几列时检索整个模型 + +在许多情况下,发出查询时只需要几列数据。SQLAlchemy 可以只获取你想要的列,而不是返回整个模型实例。这不仅减少了发送的数据量,还避免了实例化整个对象。使用列数据的元组而不是模型可以快得多。 + +``` +result = User.query.all() +for user in result: +    print(user.name, user.email) +``` + +使用 **with_entities** 方法只选择所需要的内容。 + +``` +result = User.query.with_entities(User.name, User.email).all() +for (username, email) in result: +    print(username, email) +``` + +### 每次循环都更新一个对象 + +避免使用循环来单独更新集合。虽然数据库可以非常快地执行单个更新,但应用程序和数据库服务器之间的往返时间将快速累加。通常,在合理的情况下争取更少的查询。 + +``` +for user in users_to_update: +  user.acct_active = True +  db.session.add(user) +``` +改用批量更新方法。 + +``` +query = User.query.filter(user.id.in_([user.id for user in users_to_update])) +query.update({"acct_active": True}, synchronize_session=False) +``` + +### 触发级联删除 + +ORM 允许在模型关系上进行简单的配置,但是有一些微妙的行为可能会令人吃惊。大多数数据库通过外键和各种级联选项维护关系完整性。SQLAlchemy 允许你使用外键和级联选项定义模型,但是 ORM 具有自己的级联逻辑,可以取代数据库。 + +考虑以下模型: +``` +class Artist(Base): +    __tablename__ = "artist" + +    id = Column(Integer, primary_key=True) +    songs = relationship("Song", cascade="all, delete") + + +class Song(Base): +    __tablename__ = "song" + +    id = Column(Integer, primary_key=True) +    artist_id = Column(Integer, ForeignKey("artist.id", ondelete="CASCADE")) +``` + +删除歌手将导致 ORM 在 Song 表上发出 **delete** 查询,从而防止由于外键导致的删除操作。这种行为可能会成为复杂关系和大量记录的瓶颈。 + +请包含 **passive_deletes** 选项,以确保数据库正在管理关系。但是,请确保你的数据库具有此功能。例如,SQLite 默认情况下不管理外键。 + +``` +songs = relationship("Song", cascade all, delete", passive_deletes=True) +``` + +### 在使用预先加载时,应使用延迟加载 + +延迟加载是 SQLAlchemy 处理关系的默认方法。从上一个例子构建来看,加载一个歌手时不会同时加载他或她的歌曲。这通常是一个好主意,但是如果总是需要加载某些关系,单独的查询可能会造成浪费。 + +如果允许以延迟方式加载关系,像 [Marshmallow][4] 这样流行的序列化框架可以触发级联查询。 + +有几种方法可以控制此行为。最简单的方法是通过 relationship 函数本身。 + +``` +songs = relationship("Song", lazy="joined", cascade="all, delete") +``` + +这将导致一个左连接被添加到任何歌手的查询中,因此,**songs** 集合将立即可用。尽管有更多数据返回给客户端,但往返次数可能会少得多。 + +SQLAlchemy 为无法采用这种综合方法的情况提供了更细粒度的控制,可以使用 **joinedload()** 函数在每个查询的基础上切换联合加载。 + +``` +from sqlalchemy.orm import joinedload + +artists = Artist.query.options(joinedload(Artist.songs)) +print(artists.songs) # Does not incur a roundtrip to load +``` + +### 使用 ORM 进行批量记录导入 + +导入成千上万条记录时,构建完整模型实例的开销会成为主要瓶颈。想象一下,从一个文件中加载数千首歌曲记录,其中每首歌曲都先被转换为字典。 + +``` +for song in songs: +    db.session.add(Song(**song)) +``` + +相反,绕过 ORM,只使用 SQLAlchemy 核心的参数绑定功能。 + +``` +batch = [] +insert_stmt = Song.__table__.insert() +for song in songs: +    if len(batch) > 1000: +       db.session.execute(insert_stmt, batch) +       batch.clear() +    batch.append(song) +if batch: +    db.session.execute(insert_stmt, batch) +``` + +请记住,此方法会跳过你可能依赖的任何客户端 ORM 逻辑,例如基于 Python 的列默认值。尽管此方法比将对象加载为完整的模型实例要快,但是你的数据库可能具有更快的批量加载方法。例如,PostgreSQL 的 **COPY** 命令为加载大量记录提供了最佳性能。 + +### 过早调用 commit 或 flush + +在很多情况下,你需要将子记录与其父记录相关联,反之亦然。一种明显的方法是刷新会话,以便为有问题的记录分配一个 ID。 + +``` +artist = Artist(name="Bob Dylan") +song = Song(title="Mr. Tambourine Man") + +db.session.add(artist) +db.session.flush() + +song.artist_id = artist.id +``` + +对于每个请求,commit 或 flush 多次通常是不必要的,也是不可取的。数据库刷新涉及强制在数据库服务器上进行磁盘写入,在大多数情况下,客户端将阻塞,直到服务器确认已写入数据为止。 + +SQLAlchemy 可以在幕后跟踪关系和管理相关键。 + +``` +artist = Artist(name="Bob Dylan") +song = Song(title="Mr. Tambourine Man") + +artist.songs.append(song) +``` + +### 总结 + +我希望这一系列常见的陷阱可以帮助你避免这些问题,并使你的应用平稳运行。通常,在诊断性能问题时,测量是关键。大多数数据库都提供性能诊断功能,可以帮助你定位问题,例如 PostgreSQL的 **pg_stat_statements** 模块。 + +* * * + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/common-pitfalls-python + +作者:[Zach Todd][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/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_snake_file_box.jpg?itok=UuDVFLX- (A python with a package.) +[2]: https://en.wikipedia.org/wiki/Object-relational_mapping +[3]: https://www.sqlalchemy.org/ +[4]: https://marshmallow.readthedocs.io/en/stable/ From 9f38c25c84f72c300aa51cff8b86a6da4e13b568 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 Nov 2019 20:32:58 +0800 Subject: [PATCH 507/800] PRF --- ...Why I made the switch from Mac to Linux.md | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/translated/talk/20191025 Why I made the switch from Mac to Linux.md b/translated/talk/20191025 Why I made the switch from Mac to Linux.md index fba4581795..f15c9b28de 100644 --- a/translated/talk/20191025 Why I made the switch from Mac to Linux.md +++ b/translated/talk/20191025 Why I made the switch from Mac to Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Why I made the switch from Mac to Linux) @@ -10,48 +10,48 @@ 为什么我从 Mac 换到了 Linux ====== -> 感谢这么多的开源开发人员,使用 Linux 作为日常使用比以往任何时候都容易得多。 +> 感谢这么多的开源开发人员,日常使用 Linux 比以往任何时候都容易得多。 -![Hands programming][1] +![](https://img.linux.net.cn/data/attachment/album/201911/17/203212qes7o7zpeefbpffe.jpg) -自 2004 年开始从事 IT 工作以来,我一直是 Mac 的忠实粉丝。但是几个月前,由于种种原因,我决定将 Linux 用作日常使用。这不是我第一次尝试完全采用 Linux,但是我发现它比以往更容易。这就是促使我转换的原因。 +自 2004 年开始从事 IT 工作以来,我一直是 Mac 的忠实粉丝。但是几个月前,由于种种原因,我决定将 Linux 用作日常使用的系统。这不是我第一次尝试完全采用 Linux,但是我发现它比以往更加容易。下面是促使我转换的原因。 -### 我在个人电脑上的第一次的 Linux 尝试 +### 我在个人电脑上的首次 Linux 体验 -我记得我抬头看着投影机,而它和我面面相觑。我们俩都不明白为什么它不会显示。VGA 线完全接好了,针脚也没有弯折。我按了我可能想到的所有按键组合,以向笔记本电脑发出信号,想让它克服舞台恐惧症。 +我记得,我抬头看着投影机,而它和我面面相觑。我们俩都不明白为什么它不显示。VGA 线完全接好了,针脚也没有弯折。我按了我所有想到的可能的按键组合,以向我的笔记本电脑发出信号,想让它克服“舞台恐惧症”。 -我在大学里运行 Linux 只是作为实验。我在 IT 部门的经理是多种口味的倡导者,随着我对桌面支持和编写脚本的信心增强,我想了解更多有关它的信息。对我来说,IT 比我的计算机科学学位课程有趣得多,课程感觉是如此抽象和理论化:“二叉树有啥用?”,我如是想 —— 而我们的系统管理员团队的工作却是如此的切实。 +我在大学里运行 Linux 只是作为实验。而我在 IT 部门的经理是多种口味的倡导者,随着我对桌面支持和编写脚本的信心增强,我想了解更多 Linux 的信息。对我来说,IT 比我的计算机科学学位课程有趣得多,课程的感觉是如此抽象和理论化:“二叉树有啥用?”,我如是想 —— 而我们的系统管理员团队的工作却是如此的真真切切。 -这个故事的结尾是,我登录 Windows 工作站通过了我的课堂演讲,标志着我将 Linux 作为我的日常操作系统的第一次尝试的终结。我很欣赏 Linux 的灵活性,但是它缺乏兼容性。我偶尔会写一个脚本,该脚本通过 SSH 连接到一个机器中以运行另一个脚本,但是我对 Linux 的日常使用仅止于此。 +这个故事的结尾是,我登录到 Windows 工作站完成了我的课堂演讲,这标志着我将 Linux 作为我的日常操作系统的第一次尝试的终结。我很欣赏 Linux 的灵活性,但是它缺乏兼容性。我偶尔会写个脚本,脚本通过 SSH 连接到一个机器中以运行另一个脚本,但是我对 Linux 的日常使用仅止于此。 -### Linux 兼容性的全新印象 +### 对 Linux 兼容性的全新印象 几个月前,当我决定再试一次 Linux 时,我曾觉得我遇到更多的兼容性噩梦,但我错了。 -安装过程完成后,我立即插入 USB-C 集线器以了解兼容性到底如何。一切立即工作。连接 HDMI 的超宽显示器作为镜像显示器弹出到我的笔记本电脑屏幕上,我轻松地将其调整为第二台显示器。USB 连接的网络摄像头对我的[在家工作方式][2]至关重要,它可以毫无问题地显示视频。甚至自从我使用 Mac 以来就一直插在集线器的 Mac 充电器可以为我非常不 Mac 的硬件充电。 +安装过程完成后,我立即插入了 USB-C 集线器以了解兼容性到底如何。一切立即工作。连接 HDMI 的超宽显示器作为镜像显示器弹出到我的笔记本电脑屏幕上,我轻松地将其调整为第二台显示器。USB 连接的网络摄像头对我的[在家工作方式][2]至关重要,它可以毫无问题地显示视频。甚至自从我使用 Mac 以来就一直插在集线器的 Mac 充电器可以为我的非常不 Mac 的硬件充电。 -我的正面经历可能与 USB-C 的一些更新有关,它在 2018 年得到一些需要的关注,因此才能与其他 OS 体验相媲美。如 [Phoronix 解释的那样][3]: +我的正面体验可能与 USB-C 的一些更新有关,它在 2018 年得到一些所需的关注,因此才能与其他操作系统的体验相媲美。正如 [Phoronix 解释的那样][3]: -> “USB Type-C 接口为非 USB 信号提供了‘替代模式’扩展,在规范中该替代模式的最大使用场景是允许 DisplayPort。除此之外,另一个替代模式是 Thunderbolt 3 的支持。DisplayPort 替代模式支持 4K甚至 8Kx4K 的视频输出,包括多声道音频。 +> “USB Type-C 接口为非 USB 信号提供了‘替代模式’扩展,在规范中该替代模式的最大使用场景是支持 DisplayPort。除此之外,另一个替代模式是支持 Thunderbolt 3。DisplayPort 替代模式支持 4K 甚至 8Kx4K 的视频输出,包括多声道音频。 > > “虽然 USB-C 替代模式和 DisplayPort 已经存在了一段时间,并且在 Windows 上很常见,但是主线 Linux 内核不支持此功能。所幸的是,多亏英特尔,这种情况正在改变。” > -而在端口之外,快速浏览一下 [笔记本电脑 Linux][4] 的硬件选择,可以显示比我 2000 年代初期经历的更加完整的选择集。 +而在端口之外,快速浏览一下 [笔记本电脑 Linux][4] 的硬件选择,列出了比我 2000 年代初期所经历的更加完整的选择集。 -与我第一次尝试采用 Linux 相比,这已经天差地别,这是我所张开双臂欢迎的。 +与我第一次尝试采用 Linux 相比,这已经天差地别,这是我张开双臂欢迎的。 ### 突破 Apple 的樊篱 使用 Linux 给我的日常工作流程增加了一些新的麻烦,而我喜欢这种麻烦。 -我的 Mac 工作流程是无缝的:早上打开 iPad,写下关于我今天想要做什么的想法,然后开始在 Safari 中阅读一些文章;转到我的 iPhone 上继续阅读;然后登录我的 MacBook,这些地方我进行了多年的微调,已经弄清楚了所有这些部分之间的连接方式。键盘快捷键已内置在我的大脑中;用户体验一如既往。简直不要太舒服了。 +我的 Mac 工作流程是无缝的:早上打开 iPad,写下关于我今天想要做什么的想法,然后开始在 Safari 中阅读一些文章;移到我的 iPhone 上可以继续阅读;然后登录我的 MacBook,这些地方我进行了多年的微调,已经弄清楚了所有这些部分之间的连接方式。键盘快捷键已内置在我的大脑中;用户体验一如既往。简直不要太舒服了。 -这种舒适需要付出代价。我基本上忘记了我的环境如何运作的,无法回答我想回答的问题。我是否自定义了一些 [PLIST 文件][5]以获得快捷方式,还是记得将其签入[我的 dotfiles][6] 当中?当 Firefox 的功能更好时,我如何还如此依赖 Safari 和 Chrome?或为什么我不使用基于 Android 的手机代替我的 i-系列产品呢? +这种舒适需要付出代价。我基本上忘记了我的环境如何运作的,也无法解答我想解答的问题。我是否自定义了一些 [PLIST 文件][5]以获得快捷方式,是不是记得将其签入[我的 dotfiles][6] 当中?当 Firefox 的功能更好时,我为何还如此依赖 Safari 和 Chrome?为什么我不使用基于 Android 的手机代替我的 i-系列产品呢? -关于这一点,我经常考虑过改用基于 Android 的手机,但是我会失去在所有这些设备之间的连接以及为这种生态系统设计的一些便利。例如,我将无法在 iPhone 上为 Apple TV 输入搜索内容,也无法与其他基于 Apple 的朋友共享 AirDrop 密码。这些功能是同类设备环境的巨大好处,并且是一项了不起的工程。就是说,这些便利是被生态系统所困的代价。 +关于这一点,我经常考虑改用基于 Android 的手机,但是我会失去在所有这些设备之间的连接性以及为这种生态系统设计的一些便利。例如,我将无法在 iPhone 上为 Apple TV 输入搜索内容,也无法与其他用 Apple 的朋友用 AirDrop 共享密码。这些功能是同类设备环境的巨大好处,并且是一项了不起的工程。也就是说,这些便利是被生态系统所困的代价。 -我喜欢了解设备的工作方式。我希望能够解释使我的系统变得有趣或容易使用的环境配置,但我也想看看增加一些麻烦对我的观点有什么影响。用 [Marcel Proust][7] 来解释,“真正的发现之旅不在于寻找新的土地,而在于用新的眼光来看待。”我对技术的使用是如此的方便,以至于我不再对它的工作原理感到好奇。Linux 使我有机会再次有了新的眼光。 +我喜欢了解设备的工作方式。我希望能够解释使我的系统变得有趣或容易使用的环境配置,但我也想看看增加一些麻烦对我的观点有什么影响。用 [Marcel Proust][7] 的话来说,“真正的发现之旅不在于寻找新的土地,而在于用新的眼光来看待。”技术的使用是如此的方便,以至于我不再对它的工作原理感到好奇,而 Linux 使我有机会再次有了新的眼光。 ### 受你的启发 From 481a93b6beca6d328afa5e60511e7cdd9d6d90dd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 Nov 2019 20:33:23 +0800 Subject: [PATCH 508/800] PUB @wxy https://linux.cn/article-11586-1.html --- .../20191025 Why I made the switch from Mac to Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20191025 Why I made the switch from Mac to Linux.md (98%) diff --git a/translated/talk/20191025 Why I made the switch from Mac to Linux.md b/published/20191025 Why I made the switch from Mac to Linux.md similarity index 98% rename from translated/talk/20191025 Why I made the switch from Mac to Linux.md rename to published/20191025 Why I made the switch from Mac to Linux.md index f15c9b28de..3a9b399734 100644 --- a/translated/talk/20191025 Why I made the switch from Mac to Linux.md +++ b/published/20191025 Why I made the switch from Mac to Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11586-1.html) [#]: subject: (Why I made the switch from Mac to Linux) [#]: via: (https://opensource.com/article/19/10/why-switch-mac-linux) [#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) From f1126289490678b6a8b84201a598776c085c5d84 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 17 Nov 2019 21:42:37 +0800 Subject: [PATCH 509/800] APL --- ... How I used the wget Linux command to recover lost images.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191025 How I used the wget Linux command to recover lost images.md b/sources/tech/20191025 How I used the wget Linux command to recover lost images.md index 08dd80f053..02cdd087db 100644 --- a/sources/tech/20191025 How I used the wget Linux command to recover lost images.md +++ b/sources/tech/20191025 How I used the wget Linux command to recover lost images.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c974b29f967689835d8b24b3d09a51a19599920a Mon Sep 17 00:00:00 2001 From: MjSeven Date: Sun, 17 Nov 2019 22:05:02 +0800 Subject: [PATCH 510/800] Translating by MjSeven --- ...n advanced look at Python interfaces using zope.interface.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md b/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md index 16b4780710..aa984555d8 100644 --- a/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md +++ b/sources/tech/20190924 An advanced look at Python interfaces using zope.interface.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (MjSeven) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d2fb470d41d3c5ee2f6db837a14a95cd03a9f525 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 18 Nov 2019 00:54:52 +0800 Subject: [PATCH 511/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191117=20How=20?= =?UTF-8?q?to=20Install=20VirtualBox=206.0=20on=20CentOS=208=20/=20RHEL=20?= =?UTF-8?q?8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md --- ...all VirtualBox 6.0 on CentOS 8 - RHEL 8.md | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md diff --git a/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md b/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md new file mode 100644 index 0000000000..094218c6c4 --- /dev/null +++ b/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md @@ -0,0 +1,160 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install VirtualBox 6.0 on CentOS 8 / RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Install VirtualBox 6.0 on CentOS 8 / RHEL 8 +====== + +**VirtualBox** is a free and open source **virtualization tool** which allows techies to run multiple virtual machines of different flavor at the same time. It is generally used at desktop level (Linux and Windows), it becomes very handy when someone try to explore the features of new Linux distribution or want to install software like **OpenStack**, **Ansible** and **Puppet** in one VM, so in such scenarios one can launch a VM using VirtualBox. + +VirtualBox is categorized as **type 2 hypervisor** which means it requires an existing operating system, on top of which VirtualBox software will be installed. VirtualBox provides features to create our own custom host only network and NAT network. In this article we will demonstrate how to install latest version of VirtualBox 6.0 on CentOS 8 and RHEL 8 System and will also demonstrate on how to install VirtualBox Extensions. + +### Installation steps of VirtualBox 6.0 on CentOS 8 / RHEL 8 + +#### Step:1) Enable VirtualBox and EPEL Repository + +Login to your CentOS 8 or RHEL 8 system and open terminal and execute the following commands to enable VirtualBox and EPEL package repository. + +``` +[root@linuxtechi ~]# dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo +``` + +Use below rpm command to import Oracle VirtualBox Public Key + +``` +[root@linuxtechi ~]# rpm --import https://www.virtualbox.org/download/oracle_vbox.asc +``` + +Enable EPEL repo using following dnf command, + +``` +[root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y +``` + +#### Step:2) Install VirtualBox Build tools and dependencies + +Run the following command to install all VirtualBox build tools and dependencies, + +``` +[root@linuxtechi ~]# dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms -y +``` + +Once above dependencies and build tools are installed successfully then proceed with VirtualBox installation using dnf command, + +#### Step:3) Install VirtualBox 6.0 on CentOS 8 / RHEL 8 + +If wish to list available versions of VirtualBox before installing it , then execute the following [dnf command][1], + +``` +[root@linuxtechi ~]# dnf search virtualbox +Last metadata expiration check: 0:14:36 ago on Sun 17 Nov 2019 04:13:16 AM GMT. +=============== Summary & Name Matched: virtualbox ===================== +VirtualBox-5.2.x86_64 : Oracle VM VirtualBox +VirtualBox-6.0.x86_64 : Oracle VM VirtualBox +[root@linuxtechi ~]# +``` + +Let’s install latest version of VirtualBox 6.0 using following dnf command, + +``` +[root@linuxtechi ~]# dnf install VirtualBox-6.0 -y +``` + +If any local user want to attach usb device to VirtualBox VMs then he/she should be part “**vboxuser**s ” group, use the beneath usermod command to add local user to “vboxusers” group. + +``` +[root@linuxtechi ~]# usermod -aG vboxusers pkumar +``` + +#### Step:4) Access VirtualBox on CentOS 8 / RHEL 8 + +There are two ways to access VirtualBox, from the command line type “**virtualbox**” then hit enter + +``` +[root@linuxtechi ~]# virtualbox +``` + +From Desktop environment, Search “VirtualBox” from Search Dash. + +[![Access-VirtualBox-CentOS8][2]][3] + +Click on VirtualBox icon, + +[![VirtualBox-CentOS8][2]][4] + +This confirms that VirtualBox 6.0 has been installed successfully, let’s install its extension pack. + +#### Step:5) Install VirtualBox 6.0 Extension Pack + +As the name suggests, VirtualBox extension pack is used to extend the functionality of VirtualBox. It adds the following features: + + * USB 2.0 & USB 3.0 support + * Virtual RDP (VRDP) + * Disk Image Encryption + * Intel PXE Boot + * Host WebCam + + + +Use below wget command to download virtualbox extension pack under download folder, + +``` +[root@linuxtechi ~]$ cd Downloads/ +[root@linuxtechi Downloads]$ wget https://download.virtualbox.org/virtualbox/6.0.14/Oracle_VM_VirtualBox_Extension_Pack-6.0.14.vbox-extpack +``` + +Once it is downloaded, access VirtualBox and navigate **File** –>**Preferences** –> **Extension** then click on + icon to add downloaded extension pack, + +[![Install-VirtualBox-Extension-Pack-CentOS8][2]][5] + +Click on “Install” to start the installation of extension pack. + +[![Accept-VirtualBox-Extension-Pack-License-CentOS8][2]][6] + +Click on “I Agree” to accept VirtualBox Extension Pack License. + +After successful installation of VirtualBox extension pack, we will get following screen, Click on Ok and start using VirtualBox. + +[![VirtualBox-Extension-Pack-Install-Message-CentOS8][2]][7] + +That’s all from this article, I hope these steps help you install VirtualBox 6.0 on your CentOS 8 and RHEL 8 system. Please do share your valuable feedback and comments. + +**Also Read**: **[How to Manage Oracle VirtualBox Virtual Machines from Command Line][8]** + + * [Facebook][9] + * [Twitter][10] + * [LinkedIn][11] + * [Reddit][12] + + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/ + +作者:[Pradeep Kumar][a] +选题:[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/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/dnf-command-examples-rpm-management-fedora-linux/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Access-VirtualBox-CentOS8.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/VirtualBox-CentOS8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-VirtualBox-Extension-Pack-CentOS8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Accept-VirtualBox-Extension-Pack-License-CentOS8.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/VirtualBox-Extension-Pack-Install-Message-CentOS8.jpg +[8]: https://www.linuxtechi.com/manage-virtualbox-virtual-machines-command-line/ +[9]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&t=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 +[10]: http://twitter.com/share?text=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&via=Linuxtechi +[11]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&title=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 +[12]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&title=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 From 2e9f54425f795c946de2bf96f1020350e84d3e80 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 Nov 2019 08:52:28 +0800 Subject: [PATCH 512/800] translating --- ...0191112 Getting started with PostgreSQL.md | 213 ------------------ ...0191112 Getting started with PostgreSQL.md | 213 ++++++++++++++++++ 2 files changed, 213 insertions(+), 213 deletions(-) delete mode 100644 sources/tech/20191112 Getting started with PostgreSQL.md create mode 100644 translated/tech/20191112 Getting started with PostgreSQL.md diff --git a/sources/tech/20191112 Getting started with PostgreSQL.md b/sources/tech/20191112 Getting started with PostgreSQL.md deleted file mode 100644 index 48f7896c02..0000000000 --- a/sources/tech/20191112 Getting started with PostgreSQL.md +++ /dev/null @@ -1,213 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting started with PostgreSQL) -[#]: via: (https://opensource.com/article/19/11/getting-started-postgresql) -[#]: author: (Greg Pittman https://opensource.com/users/greg-p) - -Getting started with PostgreSQL -====== -Install, set up, create, and start using your first PostgreSQL database. -![Guy on a laptop on a building][1] - -Everyone has things that would be useful to collect in a database. Even if you're obsessive about keeping paperwork or electronic files, they can become cumbersome. Paper documents can be lost or completely disorganized, and information you need to access in electronic files may be buried in depths of paragraphs and pages of information. - -When I was practicing medicine, I used [PostgreSQL][2] to keep track of my hospital patient list and to submit information about my hospital patients. I carried a printout of my daily patient list in my pocket for quick reference and to make quick notes about any changes in the patients' room, diagnosis, or other details. - -I thought that was all behind me, until last year when my wife decided to get a new car, and I "inherited" her previous one. She had kept a folder of car repair and maintenance service receipts, but over time, it lost any semblance of organization. It takes time to sift through all the slips of paper to figure out what was done when, and I thought PostgreSQL would be a better way to keep track of this information. - -### Install PostgreSQL - -It had been a while since I last used PostgreSQL, and I had forgotten how to get going with it. In fact, I didn't even have it on my computer. Installing it was step one. I use Fedora, so in a console, I ran: - - -``` -`dnf list postgresql*` -``` - -Notice that you don't need to use sudo to use the **list** option. This command returned a long list of packages; after scanning them, I decided I only wanted three: postgresql, postgresql-server, and postgresql-docs. - -To find out what I needed to do next, I decided to consult the [PostgreSQL docs][3]. The docs are a very extensive reference—so extensive, in fact, that it is rather daunting. Fortunately, I found some notes I made in the past when I was upgrading Fedora and wanted to efficiently export my database, restart PostgreSQL on the new version, and import my old database. - -### Set up PostgreSQL - -Unlike most other software, you can't just install PostgreSQL and start using it. You must carry out two basic steps beforehand: First, you need to set up PostgreSQL, and second, you need to start it. You must do these as the **root** user (sudo will not work here). - -To set it up, enter: - - -``` -`postgresql-setup –initdb` -``` - -This establishes the location of the PostgreSQL databases on the computer. Then (still as **root**), enter these two commands: - - -``` -systemctl start postgresql.service -systemctl enable postgresql.service -``` - -The first command starts PostgreSQL for the current session on your computer (if you turn it off, PostgreSQL shuts down). The second command causes PostgreSQL to automatically start on subsequent reboots. - -### Create a user - -PostgreSQL is running, but you still can't use it because you haven't been named a user yet. To do this, you need to switch to the special user **postgres**. While you are still running as **root**, type: - - -``` -`su postgres` -``` - -Since you're doing this as **root**, you don't need to enter a password. The **root** user can operate as any user without knowing their password; this is part of what makes it so powerful—and dangerous. - -Now that you're **postgres**, run two commands like the following example (which creates the user **gregp**) to create your user: - - -``` -createuser gregp -createdb gregp -``` - -You will probably get an error message like: **Could not switch to /home/gregp**. This just means that the user **postgres** doesn't have access to that directory. Nonetheless, your user and the database have been created. Next, type **Exit** and **Enter** twice so you're back to being yourself again. - -### Set up a database - -To start using PostgreSQL, type **psql** on the command line. You should see something like **gregp=>** to the left of each line to show that you're using PostgreSQL and can only use commands that it understands. You automatically have a database (mine is named **gregp**)—with absolutely nothing in it. A database, in the sense of PostgreSQL, is just a space to work. Inside that space, you create _tables_. A table contains a list of variables, and underneath each variable is the data that makes up your database. - -Here is how I set up my auto-service database: - - -``` -CREATE TABLE autorepairs ( -        date            date, -        repairs         varchar(80), -        location        varchar(80), -        cost            numeric(6,2) -); -``` - -I could have typed this continuously on a single line, but I broke it up to illustrate the parts better and to show that the white space of tabs and line feeds is not interpreted by PostgreSQL. The data points are contained within parentheses, each variable name and data type is separated from the next by a comma (except for the last), and the command ends with a semicolon. All commands must end with a semicolon! - -The first variable name is **date**, and its datatype is also **date**, which is OK with PostgreSQL. The second and third variables, **repairs** and **location**, are both datatype **varchar(80)**, which means they can be any mixture of up to 80 characters (letters, numbers, whatever). The last variable, **cost**, uses the **numeric** datatype. The numbers in parentheses indicate there is a maximum of six digits and two of them are decimals. At first, I tried the **real** datatype, which would be a floating-point number. The problem with **real** as a datatype comes in more advanced commands using a **WHERE** clause, like **WHERE cost = 0** or any other specific number. Since there is some imprecision in **real** values, specific numbers will never match anything. - -### Enter data - -Next, you can add some data (in PostgreSQL called a **row**) with the command **INSERT INTO**: - - -``` -`INSERT INTO autorepairs VALUES ('2017-08-11', 'airbag recall', 'dealer', 0);` -``` - -Notice that the parentheses form a container for the values, which must be in the correct order, separated by commas, and with a semicolon at the end of the command. The value for the **date** and **varchar(80)** datatypes must be enclosed in single quotes, but number values like **numeric** do not. As feedback, you should see: - - -``` -`INSERT 0 1` -``` - -Just as in your regular terminal session, you will have a history of entered commands, so often you can save a great deal of time when entering subsequent rows by pressing the Up arrow key to show the last command and editing the data as needed. - -What if you get something wrong? Use **UPDATE** to change a value: - - -``` -`UPDATE autorepairs SET date = '2017-11-08' WHERE repairs = 'airbag recall';` -``` - -Or maybe you no longer want something in your table. Use **DELETE**: - - -``` -`DELETE FROM autorepairs WHERE repairs = 'airbag recall';` -``` - -and the whole row will be deleted. - -One last thing: Even though I used all caps in the PostgreSQL commands (which is also done in most documentation), you can type them in lowercase, which is what I generally do. - -### Output data - -If you want to show your data, use **SELECT**: - - -``` -`SELECT * FROM autorepairs ORDER BY date;` -``` - -Without the **ORDER BY** option, the rows would appear however they were entered. For example, here's a selection of my auto-service data as it's output in my terminal: - - -``` -SELECT date, repairs FROM autorepairs ORDER BY date; - -    date   |                             repairs                              -\-----------+----------------------------------------------------------------- -2008-08-08 | oil change, air filter, spark plugs -2011-09-30 | 35000 service, oil change, rotate tires/balance wheels -2012-03-07 | repl battery -2012-11-14 | 45000 maint, oil/filter -2014-04-09 | 55000 maint, oil/filter, spark plugs, air/dust filters -2014-04-21 | replace 4 tires -2014-04-21 | wheel alignment -2016-06-01 | 65000 mile service, oil change -2017-05-16 | oil change, replce oil filt housing -2017-05-26 | rotate tires -2017-06-05 | air filter, cabin filter,spark plugs -2017-06-05 | brake pads and rotors, flush brakes -2017-08-11 | airbag recall -2018-07-06 | oil/filter change, fuel filter, battery svc -2018-07-06 | transmission fl, p steering fl, rear diff fl -2019-07-22 | oil & filter change, brake fluid flush, front differential flush -2019-08-20 | replace 4 tires -2019-10-09 | replace passenger taillight bulb -2019-10-25 | replace passenger taillight assembly -(19 rows) -``` - -To send this to a file, change the output with: - - -``` -`\o autorepairs.txt` -``` - -then run the **SELECT** command again. - -### Exit PostgreSQL - -Finally, to get out of PostgreSQL mode in the terminal, type: - - -``` -`quit` -``` - -or its shorthand version: - - -``` -`\q` -``` - -While this is just a brief introduction to PostgreSQL, I hope it demonstrates that it's neither difficult nor time-consuming to use the database for a simple task like this. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/getting-started-postgresql - -作者:[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/computer_code_programming_laptop.jpg?itok=ormv35tV (Guy on a laptop on a building) -[2]: https://www.postgresql.org/ -[3]: http://www.postgresql.org/docs diff --git a/translated/tech/20191112 Getting started with PostgreSQL.md b/translated/tech/20191112 Getting started with PostgreSQL.md new file mode 100644 index 0000000000..9fe988c3f9 --- /dev/null +++ b/translated/tech/20191112 Getting started with PostgreSQL.md @@ -0,0 +1,213 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with PostgreSQL) +[#]: via: (https://opensource.com/article/19/11/getting-started-postgresql) +[#]: author: (Greg Pittman https://opensource.com/users/greg-p) + +PostgreSQL 入门 +====== +安装,设置,创建和开始使用 PostgreSQL 数据库。 +![Guy on a laptop on a building][1] + +每人或许都有需要在数据库中保存的东西。即使你沉迷于使用文书或电子文件,它们也会变得很麻烦。纸质文档可能会丢失或混乱,你需要访问的电子信息可能会隐藏在段落和页面的深处。 + +在我从事医学工作的时候,我使用 [PostgreSQL][2] 来跟踪我的住院患者名单并提交有关住院患者的信息。我将我的每日患者名单打印在口袋里,以便快速了解并就患者房间、诊断或其他细节的任何变化做出快速记录。 + +我以为一切没问题,直到去年我妻子决定买一辆新车,我“继承”了她以前的那辆车。她保留了汽车维修和保养服务收据的文件夹,但随着时间的流逝,它变得杂乱。花时间筛选所有纸条以弄清楚什么时候做了什么,我认为 PostgreSQL 将是更好的跟踪此信息的方法。 + +### 安装 PostgreSQL + +自上次使用 PostgreSQ L以来已经有一段时间了,我忘记了如何使用它。实际上,我甚至没有在计算机上安装它。安装它是第一步。我使用 Fedora,因此在控制台中运行: + + +``` +`dnf list postgresql*` +``` + +请注意,你无需使用 sudo 即可使用 **list** 选项。该命令返回了很长的软件包列表。看了眼后,我决定只需要三个:postgresql、postgresql-server 和 postgresql-docs。 + +为了了解下一步需要做什么,我决定查看 [PostgreSQL 文档][3]。文档参考内容非常广泛,实际上,广泛到令人生畏。幸运的是,我发现我在升级 Fedora 时曾经做过的一些笔记,希望有效地导出数据库,在新版本上重新启动 PostgreSQL,以及导入旧数据库。 + +### 设置 PostgreSQL + +与大多数其他软件不同,你不能只是安装 PostgreSQL 并开始使用它。你必须预先执行两个基本步骤:首先,你需要设置 PostgreSQL,第二,你需要启动它。你必须以 **root** 用户身份执行这些操作(sudo 在这里不起作用)。 + +要设置它,请输入: + + +``` +`postgresql-setup –initdb` +``` + +这将确定 PostgreSQL 数据库在计算机上的位置。然后(仍为 **root**)输入以下两个命令: + + +``` +systemctl start postgresql.service +systemctl enable postgresql.service +``` + +第一个命令为当前会话启动 PostgreSQL(如果你关闭它,那么 PostgreSQL 就将关闭)。第二个命令使 PostgreSQL 在随后的重启中自动启动。 + +### 创建用户 + +PostgreSQL 正在运行,但是你仍然不能使用它,因为你还没有用户。为此,你需要切换到特殊用户 **postgres**。当你仍以 **root** 身份运行时,输入: + + +``` +`su postgres` +``` + +由于你是以 **root** 的身份执行此操作的,因此无需输入密码。root 用户可以在不知道密码的情况下以任何用户身份操作;这就是使其强大而危险的原因之一。 + +现在你就是 **postgres** 了,请运行下面两个命令,如下所示创建用户(创建用户 **gregp**): + + +``` +createuser gregp +createdb gregp +``` + +你可能会看到错误消息,如:**Could not switch to /home/gregp**。这只是意味着用户 **postgres**不能访问该目录。尽管如此,你的用户和数据库已创建。接下来,输入 **Exit** 和 **Enter** 两次,这样就回到了原来的状态。 + +### 设置数据库 + +要开始使用 PostgreSQL,请在命令行输入 **psql**。你应该在每行左侧看到类似 **gregp=>** 的内容,以显示你使用的是 PostgreSQL,并且只能使用它理解的命令。你自动获得一个数据库(我的名为 **gregp**),它里面完全没有内容。对 PostgreSQL 来说,数据库只是一个工作空间。在空间内,你创建_表_。表包含变量列表,每个变量的下面是构成数据库的数据。 + +以下是我设置汽车服务数据库的方式: + + +``` +CREATE TABLE autorepairs ( +        date            date, +        repairs         varchar(80), +        location        varchar(80), +        cost            numeric(6,2) +); +``` + +我本可以在一行内输入入,但为了更好地说明结构,并表明 PostgreSQL 不会解释制表符和换行的空白,我分成了多行。字段包含在括号中,每个变量名和数据类型与下一个变量用逗号分隔(最后一个逗号除外),命令以分号结尾。所有命令都必须以分号结尾! + +第一个变量名是 **date**,它的数据类型也是 **date**,这在 PostgreSQL 中没关系。第二个和第三个变量 **repairs** 和 **location** 都是 **varchar(80)** 类型,这意味着它们可以是最多 80 个任意字符(字母、数字等)。最后一个变量 **cost** 使用 **numeric** 类型。括号中的数字表示最多有六位数字,其中两位是小数。最初,我尝试了 **real** 类型,这将是一个浮点数。**real** 作为数据类型在使用时,在遇到 **WHERE** 子句,类似 **WHERE cost = 0** 或其他任何特定数字。由于 **real** 值有些不精确,因此特定数字将永远不会匹配。 + +### 输入数据 + +接下来,你可以使用 **INSERT INTO** 命令添加一些数据(在 PostgreSQL 中称为**行**): + + +``` +`INSERT INTO autorepairs VALUES ('2017-08-11', 'airbag recall', 'dealer', 0);` +``` + +请注意,括号为值构成一个容器,它必须以正确的顺序,用逗号分隔,并在命令末尾加上分号。 **date** 和 **varchar(80)** 类型的值必须包含在单引号中,但数字值(如 **numeric**)不用。作为反馈,你应该会看到: + + +``` +`INSERT 0 1` +``` + +与常规终端会话一样,你将有输入命令的历史记录,因此,在输入后续行时,通常可以按向上箭头键来显示最后一个命令并根据需要编辑数据,从而节省大量时间。 + +如果出了什么问题怎么办?使用 **UPDATE** 更改值: + + +``` +`UPDATE autorepairs SET date = '2017-11-08' WHERE repairs = 'airbag recall';` +``` + +或者,也许你不再需要表中的行。使用 **DELETE**: + + +``` +`DELETE FROM autorepairs WHERE repairs = 'airbag recall';` +``` + +这将删除整行。 + +最后一件事:即使我在 PostgreSQL 命令中一直使用大写字母(在大多数文档中也这么做),你也可以用小写字母输入,这是我常做的。 + +### 输出数据 + +如果你想展示数据,使用 **SELECT**: + + +``` +`SELECT * FROM autorepairs ORDER BY date;` +``` + +没有 **ORDER BY** 的话,行将不管你输入的内容来显示。例如,以下就是我终端中输出的我的汽车服务数据: + + +``` +SELECT date, repairs FROM autorepairs ORDER BY date; + +    date   |                             repairs                              +\-----------+----------------------------------------------------------------- +2008-08-08 | oil change, air filter, spark plugs +2011-09-30 | 35000 service, oil change, rotate tires/balance wheels +2012-03-07 | repl battery +2012-11-14 | 45000 maint, oil/filter +2014-04-09 | 55000 maint, oil/filter, spark plugs, air/dust filters +2014-04-21 | replace 4 tires +2014-04-21 | wheel alignment +2016-06-01 | 65000 mile service, oil change +2017-05-16 | oil change, replce oil filt housing +2017-05-26 | rotate tires +2017-06-05 | air filter, cabin filter,spark plugs +2017-06-05 | brake pads and rotors, flush brakes +2017-08-11 | airbag recall +2018-07-06 | oil/filter change, fuel filter, battery svc +2018-07-06 | transmission fl, p steering fl, rear diff fl +2019-07-22 | oil & filter change, brake fluid flush, front differential flush +2019-08-20 | replace 4 tires +2019-10-09 | replace passenger taillight bulb +2019-10-25 | replace passenger taillight assembly +(19 rows) +``` + +要将此发送到文件,将输出更改为: + + +``` +`\o autorepairs.txt` +``` + +然后再次运行 **SELECT** 命令。 + +### 退出 PostgreSQL + +最后,在终端中退出 PostgreSQL,输入: + + +``` +`quit` +``` + +或者它的缩写版: + + +``` +`\q` +``` + +虽然这只是 PostgreSQL 的简要介绍,但我希望它展示了将数据库用于这样的简单任务既不困难也不费时。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/getting-started-postgresql + +作者:[Greg Pittman][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/greg-p +[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 (Guy on a laptop on a building) +[2]: https://www.postgresql.org/ +[3]: http://www.postgresql.org/docs From 6ea530d068603f5ae94cea20116becd8a12886ed Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 18 Nov 2019 09:29:43 +0800 Subject: [PATCH 513/800] translating --- sources/tech/20191114 Cleaning up with apt-get.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191114 Cleaning up with apt-get.md b/sources/tech/20191114 Cleaning up with apt-get.md index 5524cf2dc2..b251d10030 100644 --- a/sources/tech/20191114 Cleaning up with apt-get.md +++ b/sources/tech/20191114 Cleaning up with apt-get.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d5a839870f75a14f281e2f513d5392a04a402b83 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 Nov 2019 10:00:24 +0800 Subject: [PATCH 514/800] PRF @geekpi --- ...e Tools that will help in AI Technology.md | 143 ++++++++---------- 1 file changed, 60 insertions(+), 83 deletions(-) diff --git a/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md b/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md index 3eec69a0b6..9d37aa8864 100644 --- a/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md +++ b/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md @@ -1,148 +1,125 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (7 Best Open Source Tools that will help in AI Technology) [#]: via: (https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/) [#]: author: (Nitin Garg https://opensourceforu.com/author/nitin-garg/) -7 个对 AI 技术有帮助的最佳开源工具 +7 个有助于 AI 技术的最佳开源工具 ====== -[![][1]][2] +![][1] -_人工智能是一种紧跟未来道路的卓越技术。在这个进步的时代,它吸引了所有跨国组织的关注。谷歌、IBM、Facebook、亚马逊、微软等业内知名公司不断投资于这种新时代技术。_ +> 人工智能是一种紧跟未来道路的卓越技术。在这个不断发展的时代,它吸引了所有跨国组织的关注。谷歌、IBM、Facebook、亚马逊、微软等业内知名公司不断投资于这种新时代技术。 -利用人工智能预测业务需求,并在另一个层面上进行研发。这项先进技术正成为提供超智能解决方案的研发组织不可或缺的一部分。它可以帮助你保持准确性并以更好的结果提高生产率。 +预测业务需求需要利用人工智能,并在另一个层面上进行研发。这项先进技术正成为提供超智能解决方案的研发组织不可或缺的一部分。它可以帮助你保持准确性并以更好的结果提高生产率。 -AI 开源工具和技术以频繁且准确的结果吸引了每个行业的关注。这些工具可帮助你分析性能,同时为你带来更大的收益。 +AI 开源工具和技术以频繁且准确的结果吸引了每个行业的关注。这些工具可帮助你分析绩效,同时为你带来更大的收益。 -事不宜迟,这里我们列出了一些最佳的开源工具,来帮助你更好地了解人工智能。 +无需赘言,这里我们列出了一些最佳的开源工具,来帮助你更好地了解人工智能。 -**1\. TensorFlow** +### 1、TensorFlow -TensorFlow 是用于人工智能的开源机器学习框架。它主要是为了进行机器学习和深度学习的研究和生产而开发。TensorFlow 允许开发者创建数据流图形结构,它会在网络或系统节点中移动,图形提供数据的多维数组或张量。 +TensorFlow 是用于人工智能的开源机器学习框架。它主要是为了进行机器学习和深度学习的研究和生产而开发的。TensorFlow 允许开发者创建数据流的图结构,它会在网络或系统节点中移动,图提供了数据的多维数组或张量。 TensorFlow 是一个出色的工具,它有无数的优势。 - * 简化数值计算 -  * TensorFlow 在多种模型上提供了灵活性。 -  * TensorFlow 提高了业务效率 -  * 高度可移植 -  * 自动区分能力 +* 简化数值计算 +* TensorFlow 在多种模型上提供了灵活性。 +* TensorFlow 提高了业务效率 +* 高度可移植 +* 自动区分能力 - - - -**2\. Apache SystemML** +### 2、Apache SystemML Apache SystemML 是由 IBM 创建的非常流行的开源机器学习平台,它提供了使用大数据的良好平台。它可以在 Apache Spark 上高效运行,并自动扩展数据,同时确定代码是否可以在磁盘或 Apache Spark 集群上运行。不仅如此,它丰富的功能使其在行业产品中脱颖而出; - * 算法定制 -  * 多种执行模式 -  * 自动优化 - - +* 算法自定义 +* 多种执行模式 +* 自动优化 它还支持深度学习,让开发者更有效率地实现机器学习代码并优化。 -**3\. OpenNN** +### 3、OpenNN OpenNN 是用于渐进式分析的开源人工智能神经网络库。它可帮助你使用 C++ 和 Python 开发健壮的模型,它还包含用于处理机器学习解决方案(如预测和分类)的算法和程序。它还涵盖了回归和关联,可提供业界的高性能和技术演化。 它有丰富的功能,如: - * 数字化协助 -  * 预测分析 -  * 快速的性能 -  * 虚拟个人协助 -  * 语音识别 -  * 高级分析 - - +* 数字化协助 +* 预测分析 +* 快速的性能 +* 虚拟个人协助 +* 语音识别 +* 高级分析 它可帮助你设计实现数据挖掘的先进方案,而从取得丰硕结果。 -**4\. Caffe** +### 4、Caffe -Caffe(快速特征嵌入的卷积结构)是一个开源深度学习框架。它优先考虑速度、模块化和表达式。Caffe 最初由加州大学伯克利分校视觉和学习中心开发,它使用 C++ 编写,带有一个 python 界面。能在 Linux、macOS 和 Windows 上正常运行。 +Caffe(快速特征嵌入的卷积结构)是一个开源深度学习框架。它优先考虑速度、模块化和表达式。Caffe 最初由加州大学伯克利分校视觉和学习中心开发,它使用 C++ 编写,带有 Python 接口。能在 Linux、macOS 和 Windows 上顺利运行。 Caffe 中的一些有助于 AI 技术的关键特性。 - 1. 具有表现力的结构 - 2. 具有扩展性的代码 - 3. 大型社区 - 4. 开发活跃 - 5. 性能快速 - - +1. 具有表现力的结构 +2. 具有扩展性的代码 +3. 大型社区 +4. 开发活跃 +5. 性能快速 它可以帮助你激发创新,同时引入刺激性增长。充分利用此工具来获得所需的结果。 -**5\. Torch** +### 5、Torch -Torch 是一个开源机器学习库,通过提供多种方便的功能,帮助你简化序列化、面向对象编程等复杂任务。它在机器学习项目中提供了最大的灵活性和速度。Torch 使用脚本语言 Lua 编写,底层使用 C 实现。它被用于多个组织和研究实验室中。 +Torch 是一个开源机器学习库,通过提供多种方便的功能,帮助你简化序列化、面向对象编程等复杂任务。它在机器学习项目中提供了最大的灵活性和速度。Torch 使用脚本语言 Lua 编写,底层使用 C 实现。它用于多个组织和研究实验室中。 Torch 有无数的优势,如: - * 快速高效的 GPU 支持 - * 线性代数子程序 - * 支持 iOS 和 Android 平台 - * 数值优化子程序 - * N 维数组 +* 快速高效的 GPU 支持 +* 线性代数子程序 +* 支持 iOS 和 Android 平台 +* 数值优化子程序 +* N 维数组 +### 6、Accord .NET - -**6\. Accord .NET** - -Accord .NET 是著名的免费开源 AI 开发工具之一。它有一组库,用于组合用 C# 编写的音频和图像处理库。从计算机视觉到计算机听觉、信号处理和统计应用,它可以帮助你构建一切来用于商业用途。它附带了一套全面的示例应用来快速运行各类库。 +Accord .NET 是著名的自由开源 AI 开发工具之一。它有一组库,可以用来组合使用 C# 编写的音频和图像处理库。从计算机视觉到计算机听觉、信号处理和统计应用,它可以帮助你构建用于商业用途一切需求。它附带了一套全面的示例应用来快速运行各类库。 你可以使用 Accord .NET 引人注意的功能开发一个高级应用,例如: - * 统计分析 - * 数据接入 - * 自适应 - * 深度学习 - * 二阶神经网络学习算法 - * 数字协助和多语言 - * 语音识别 +* 统计分析 +* 数据接入 +* 自适应 +* 深度学习 +* 二阶神经网络学习算法 +* 数字协助和多语言 +* 语音识别 +### 7、Scikit-Learn - -**7\. Scikit-Learn** - -Scikit-Learn 是流行的有助于 AI 技术的开源工具之一。它是 Python 中用于机器学习的一个很有价值的库。它包括机器学习和统计建模(包括分类、聚类、回归和降维)等高效工具。 +Scikit-Learn 是流行的辅助 AI 技术的开源工具之一。它是 Python 中用于机器学习的一个很有价值的库。它包括机器学习和统计建模(包括分类、聚类、回归和降维)等高效工具。 让我们了解下 Scikit-Learn 的更多功能: - * 交叉验证 - * 聚类和分类 - * 流形学习 - * 机器学习 - * 虚拟流程自动化 - * 工作流自动化 - - +* 交叉验证 +* 聚类和分类 +* 流形学习 +* 机器学习 +* 虚拟流程自动化 +* 工作流自动化 从预处理到模型选择,Scikit-learn 可帮助你处理所有问题。它简化了从数据挖掘到数据分析的所有任务。 -**最后的想法** +### 总结 -这些是一些流行的开源 AI 工具,它们提供了全面的功能。在开发新时代应用之前,必须选择其中一个工具并做相应的工作。这些工具提供先进的人工智能解决方案,并紧跟最新趋势。 +这些是一些流行的开源 AI 工具,它们提供了全面的功能。在开发新时代应用之前,人们必须选择其中一个工具并做相应的工作。这些工具提供先进的人工智能解决方案,并紧跟最新趋势。 -人工智能在全球范围内被应用,标志着它在世界各地的存在。借助 Amazon Alexa、Siri 等应用,AI 为客户提供了很好的用户体验。它在吸引用户关注的行业中具有显著优势。在医疗保健、银行、金融、电子商务等所有行业中,人工智能在促进增长和生产力的同时节省了大量的时间和精力。 +人工智能在全球范围内应用,无处不在。借助 Amazon Alexa、Siri 等应用,AI 为客户提供了很好的用户体验。它在吸引用户关注的行业中具有显著优势。在医疗保健、银行、金融、电子商务等所有行业中,人工智能在促进增长和生产力的同时节省了大量的时间和精力。 选择这些开源工具中的任何一个,获得更好的用户体验和令人难以置信的结果。它将帮助你成长,并在质量和安全性方面获得更好的结果。 -![Avatar][3] - -[Nitin Garg][4] - -作者是 BR Softech(一家商业智能软件公司) 的 CEO 兼联合创始人。喜欢通过博客分享他对 IT 行业的看法。他的兴趣是写最新的和先进的 IT 技术,包括物联网、VR 和 AR 应用开发,网络和应用开发服务。此外,他还为 RPA、大数据和网络安全服务提供咨询。 - -[![][6]][7] - -------------------------------------------------------------------------------- via: https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/ @@ -150,7 +127,7 @@ via: https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help- 作者:[Nitin Garg][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 a29b5ce6013c16da3c488852f3cb31b123938393 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 Nov 2019 10:01:00 +0800 Subject: [PATCH 515/800] PUB @geekpi https://linux.cn/article-11587-1.html --- ... Best Open Source Tools that will help in AI Technology.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191108 7 Best Open Source Tools that will help in AI Technology.md (98%) diff --git a/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md b/published/20191108 7 Best Open Source Tools that will help in AI Technology.md similarity index 98% rename from translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md rename to published/20191108 7 Best Open Source Tools that will help in AI Technology.md index 9d37aa8864..11c0950e34 100644 --- a/translated/tech/20191108 7 Best Open Source Tools that will help in AI Technology.md +++ b/published/20191108 7 Best Open Source Tools that will help in AI Technology.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11587-1.html) [#]: subject: (7 Best Open Source Tools that will help in AI Technology) [#]: via: (https://opensourceforu.com/2019/11/7-best-open-source-tools-that-will-help-in-ai-technology/) [#]: author: (Nitin Garg https://opensourceforu.com/author/nitin-garg/) From 5ed420b1c704b9e040e169d72381e246e9dad5f7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 Nov 2019 14:08:31 +0800 Subject: [PATCH 516/800] TSL --- ...et Linux command to recover lost images.md | 132 ------------------ ...et Linux command to recover lost images.md | 132 ++++++++++++++++++ 2 files changed, 132 insertions(+), 132 deletions(-) delete mode 100644 sources/tech/20191025 How I used the wget Linux command to recover lost images.md create mode 100644 translated/tech/20191025 How I used the wget Linux command to recover lost images.md diff --git a/sources/tech/20191025 How I used the wget Linux command to recover lost images.md b/sources/tech/20191025 How I used the wget Linux command to recover lost images.md deleted file mode 100644 index 02cdd087db..0000000000 --- a/sources/tech/20191025 How I used the wget Linux command to recover lost images.md +++ /dev/null @@ -1,132 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How I used the wget Linux command to recover lost images) -[#]: via: (https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How I used the wget Linux command to recover lost images -====== -The story of the rise and fall of the Open Clip Art Library and the -birth of FreeSVG.org, a new library of communal artwork. -![White shoes on top of an orange tribal pattern][1] - -In 2004, the Open Clip Art Library (OCAL) was launched as a source of free illustrations for anyone to use, for any purpose, without requiring attribution or anything in return. This site was the open source world’s answer to the big stacks of clip art CDs on the shelf of every home office in the 1990s, and to the art dumps provided by the closed-source office and artistic software titles. - -In the beginning, the clip art library consisted mostly of work by a few contributors, but in 2010 it went live with a brand new interactive website, allowing anyone to create and contribute clip art with a vector illustration application. The site immediately garnered contributions from around the globe, and from all manner of free software and free culture projects. A special importer for this library was even included in [Inkscape][2]. - -However, in early 2019, the website hosting the Open Clip Art Library went offline with no warning or explanation. Its community, which had grown to number in the thousands, assumed at first that this was a temporary glitch. The site remained offline, however, for over six months without any clear explanation of what had happened. - -Rumors started to swell. The site was being updated ("There is years of technical debt to pay off," said site developer Jon Philips in an email). The site had fallen to rampant DDOS attacks, claimed a Twitter account. The maintainer had fallen prey to identity theft, another Twitter account claimed. Today, as of this writing, the site’s one and only remaining page declares that it is in "maintenance and protected mode," the meaning of which is unclear, except that users cannot access its content. - -### Recovering the commons - -Sites appear and disappear over the course of time, but the loss of the Open Clip Art Library was particularly surprising to its community because it was seen as a community project. Few community members understood that the site hosting the library had fallen into the hands of a single maintainer, so while the artwork in the library was owned by everyone due to its [Creative Commons 0 License][3], access to it was functionally owned by a single maintainer. And, because the site’s community kept in touch with one another through the site, that same maintainer effectively owned the community. - -When the site failed, the community lost access to its artwork as well as each other. And without the site, there was no community. - -Initially, everything on the site was blocked when it went down. After several months, though, users started recognizing that the site’s database was still online, which meant that a user could access an individual art file by entering its exact URL. In other words, you couldn’t navigate to the art file through clicking around a website, but if you already knew the address, then you could bring it up in your browser. Similarly, technical (or lazy) users realized it was also possible to "scrape" the site with an automated web browser like **wget**. - -The **wget** Linux command is _technically_ a web browser, although it doesn’t let you browse interactively the way you do with Firefox. Instead, **wget** goes out onto the internet and retrieves a file or a collection of files and downloads them to your hard drive. You can then open those files in Firefox or a text editor, or whatever application is most appropriate, and view the content. - -Usually, **wget** needs to know a specific file to fetch. If you’re on Linux or macOS with **wget** installed, you can try this process by downloading the index page for [example.com][4]: - - -``` -$ wget example.org/index.html -[...] -$ tail index.html - -<body><div> -    <h1>Example Domain</h1> -    <p>This domain is for illustrative examples in documents. -    You may use this domain in examples without permission.</p> -        <p><a href="[http://www.iana.org/domains/example"\>More][5] info</a></p> -</div></body></html> -``` - -To scrape the Open Clip Art Library, I used the **\--mirror** option, so that I could point **wget** to just the directory containing the artwork so it could download everything within that directory. This action resulted in four straight days (96 hours) of constant downloading, ending with an excess of 100,000 SVG files that had been contributed by over 5,000 community members. Unfortunately, the author of any file that did not have proper metadata was irrecoverable because this information was locked in inaccessible files in the database, but the CC0 license meant that this issue _technically_ didn’t matter (because no attribution is required with CC0 files). - -A casual analysis of the downloaded files also revealed that nearly 45,000 of them were copies of the same single file (the site’s logo). This was caused by redirects pointing to the site's logo (for reasons unknown), and careful parsing could extract the original destination. Another 96 hours, and all clip art posted on OCAL up to its last day was recovered: **a total of about 156,000 images.** - -SVG files tend to be small, but this is still an enormous amount of work that poses a few very real problems. First of all, several gigabytes of online storage would be needed so the artwork could be made available to its former community. Secondly, a means of searching the artwork would be necessary, because it’s just not realistic to browse through 55,000 files manually. - -It became apparent that what the community really needed was a platform. - -### Building a new platform - -For some time, the site [Public Domain Vectors][6] had been publishing vector art that was in the public domain. While it remains a popular site, open source users often used it only as a secondary source of art because most of the files there were in the EPS and AI formats, both of which are associated with Adobe. Both file formats can generally be converted to SVG but at a loss of features. - -When the Public Domain Vectors site’s maintainers (Vedran and Boris) heard about the loss of the Open Clip Art Library, they decided to create a site oriented toward the open source community. True to form, they chose the open source [Laravel][7] framework as the backend, which provided the site with an admin dashboard and user access. The framework, being robust and well-developed, also allowed them to respond quickly to bug reports and feature requests, and to upgrade the site as needed. The site they are building is called [FreeSVG.org][8], and is already a robust and thriving library of communal artwork. - -Since then they have been uploading all of the clip art from the Open Clip Art Library, and they're even diligently tagging and categorizing the art as they go. As creators of Public Domain Vectors, they are also contributing their own images in SVG format. Their aim is to become the primary resource for SVG images with a CC0 license on the internet. - -### Contributing - -The maintainers of [FreeSVG.org][8] are aware that they have inherited significant stewardship. They are working to title and describe all images on the site so that users can easily find artwork, and will provide this file to the community once it is ready, believing strongly that the metadata about the art belongs to the people that create and use the art as much as the art itself does. They're also aware that unforeseen circumstances can arise, so they create regular backups of their site and content, and intend to make the most recent backup available to the public, should their site fail. - -If you want to add to the Creative Commons content of [FreeSVG.org][9], then download [Inkscape][10] and start drawing. There’s plenty of public domain artwork out there in the world, like [historical advertisements][11], [tarot cards][12], and [storybooks][13] just waiting to be converted to SVG, so you can contribute even if you aren’t confident in your drawing skills. Visit the [FreeSVG forum][14] to connect with and support other contributors. - -The concept of the _commons_ is important. [Creative Commons benefits everyone][15], whether you’re a student, teacher, librarian, small business owner, or CEO. If you don’t contribute directly, then you can always help promote it. - -That’s a strength of free culture: It doesn’t just scale, it gets better when more people participate. - -### Hard lessons learned - -From the demise of the Open Clip Art Library to the rise of FreeSVG.org, the open culture community has learned several hard lessons. For posterity, here are the ones that I believe are most important. - -#### Maintain your metadata - -If you’re a content creator, help the archivists of the future and add metadata to your files. Most image, music, font, and video file formats can have EXIF data embedded into them, and others have metadata entry interfaces in the applications that create them. Be diligent in tagging your work with your name, website or public email, and license. - -#### Make copies - -Don’t assume that somebody else is doing backups. If you care about communal digital content, then back it up yourself, or else don’t count on having it available forever. The trope that _whatever’s uploaded to the internet is forever_ may be true, but that doesn’t mean it’s _available to you_ forever. If the Open Clip Art Library files hadn’t become secretly available again, it’s unlikely that anyone would have ever successfully uncovered all 55,000 images from random places on the web, or from personal stashes on people’s hard drives around the globe. - -#### Create external channels - -If a community is defined by a single website or physical location, then that community is as good as dissolved should it lose access to that space. If you’re a member of a community that’s driven by a single organization or site, you owe it to yourselves to share contact information with those you care about and to establish a channel for communication even when that site is not available. - -For example, [Opensource.com][16] itself maintains mailing lists and other off-site channels for its authors and correspondents to communicate with one another, with or without the intervention or even existence of the website. - -#### Free culture is worth working for - -The internet is sometimes seen as a lazy person’s social club. You can log on when you want and turn it off when you’re tired, and you can wander into whatever social circle you want. - -But in reality, free culture can be hard work. It’s not hard in the sense that it’s difficult to be a part of, but it’s something you have to work to maintain. If you ignore the community you’re in, then the community may wither and fade before you realize it. - -Take a moment to look around you and identify what communities you’re a part of, and if nothing else, tell someone that you appreciate what they bring to your life. And just as importantly, keep in mind that you’re contributing to the lives of your communities, too. - -Creative Commons held its Gl obal Summit a few weeks ago in Warsaw, with amazing international... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons - -作者:[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/tribal_pattern_shoes.png?itok=e5dSf2hS (White shoes on top of an orange tribal pattern) -[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners -[3]: https://creativecommons.org/share-your-work/public-domain/cc0/ -[4]: http://example.com -[5]: http://www.iana.org/domains/example"\>More -[6]: http://publicdomainvectors.org -[7]: https://github.com/viralsolani/laravel-adminpanel -[8]: https://freesvg.org -[9]: http://freesvg.org -[10]: http://inkscape.org -[11]: https://freesvg.org/drinking-coffee-vector-drawing -[12]: https://freesvg.org/king-of-swords-tarot-card -[13]: https://freesvg.org/space-pioneers-135-scene-vector-image -[14]: http://forum.freesvg.org/ -[15]: https://opensource.com/article/18/1/creative-commons-real-world -[16]: http://Opensource.com diff --git a/translated/tech/20191025 How I used the wget Linux command to recover lost images.md b/translated/tech/20191025 How I used the wget Linux command to recover lost images.md new file mode 100644 index 0000000000..c7c33f1666 --- /dev/null +++ b/translated/tech/20191025 How I used the wget Linux command to recover lost images.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I used the wget Linux command to recover lost images) +[#]: via: (https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +我是如何使用 wget 命令恢复丢失的图像的 +====== + +> 开放剪贴画库兴衰的故事以及一个新的公共艺术品图书馆 FreeSVG.org 的诞生。 + +![White shoes on top of an orange tribal pattern][1] + +开放剪贴画库Open Clip Art Library(OCAL)发布于 2004 年,成为了免费插图的来源,任何人都可以出于任何目的使用它们,而无需注明出处或提供任何回报。针对 1990 年代每个家庭办公室书架上的大量剪贴画 CD 以及由闭源公司和艺术品软件提供的艺术品转储,这个网站是开源世界的答复。 + +最初,这个剪贴画库主要由一些贡献者组成,但是在 2010 年,它重新打造成了一个全新的交互式网站,可以让任何人使用矢量插图应用程序创建和贡献剪贴画。该网站立即获得了来自全球的、各种形式的自由软件和自由文化项目的贡献。[Inkscape][2] 中甚至包含了该库的专用导入器。 + +但是,在 2019 年初,托管开放剪贴画库的网站离线,没有任何警告或解释。它已经成长为有着成千上万的人的社区,起初以为这是暂时的故障。 但是,这个站点一直离线已超过六个月,而没有任何清楚的解释。 + +谣言开始膨胀。该网站正在更新中(“要偿还数年的技术债务”,网站开发者 Jon Philips 在一封电子邮件中说)。一个 Twitter 帐户声称,该网站遭受了猖狂的 DDoS 攻击。另一个 Twitter 帐户声称,该网站维护者已经成为身份盗用的牺牲品。今天,在撰写本文时,该网站的一个且唯一的页面声明它处于“维护和保护模式”,其含义不清楚,只是用户无法访问其内容。 + +### 恢复公地 + +网站会随着时间的流逝而消失,但是对其社区而言开放剪贴画库的丢失尤其令人惊讶,因为它被视为一个社区项目。很少有社区成员知道托管该库的站点已经落入一个维护者手中,因此,由于 [CC0 许可证][3],该库中的艺术品归所有人所有,但对它的访问是功能性的由单个维护者执行。而且,由于该站点的社区通过该站点彼此保持联系,因此该维护者实际上拥有该社区。 + +当站点发生故障时,社区以及彼此之间都无法访问其艺术品。没有该站点,就没有社区。 + +最初,该网站离线后其上的所有东西都是被封挡的。不过,在几个月之后,用户开始意识到该网站的数据库仍然在线,这意味着用户能够通过输入精确的 URL 访问单个剪贴画。换句话说,你不能通过在网站上到处点击来流量剪贴画文件,但是如果你知道该地址,你就可以在浏览器中访问它。类似的,技术型(或偷懒的)用户意识到能够通过类似 `wget` 的自动 Web 浏览器将网站“抓取”下来。 + +Linux 的 `wget` 命令技术上是一个 Web 浏览器,虽然它不能让你像用 Firefox 一样交互式地浏览。相反,`wget` 可以连到互联网,获取文件或文件集,并下载到你的本次硬盘。然后,你可以在 Firefox 或文本编辑器或最合适的应用程序中打开这些文件,然后查看内容。 + +通常,`wget` 需要知道要提取的特定文件。如果你使用的是安装了 `wget` 的 Linux 或 macOS,则可以通过下载 [example.com][4] 的索引页来尝试此过程: + +``` +$ wget example.org/index.html +[...] +$ tail index.html + +
+

Example Domain

+

This domain is for illustrative examples in documents. + You may use this domain in examples without permission.

+

More info

+
+``` + +为了抓取 OCAL,我使用了 `--mirror` 选项,以便可以只是将 `wget` 指向到包含艺术品的目录,就可以下载该目录中的所有内容。此操作导致连续四天(96 个小时)持续下载,最终得到了超过 50000 个社区成员贡献的 100,000 个 SVG 文件。不幸的是,任何没有适当元数据的文件的作者信息都是无法恢复的,因为此信息被锁定在数据库中不可访问的文件中,但是 CC0 许可证意味着此问题*在技术上*无关紧要(因为 CC0 文件不需要属性)。 + +随意分析了一下下载的文件进行还显示,其中近 45,000 个文件是同一文件(该网站的徽标)的副本。这是由于指向该站点徽标的重定向(原因未知)引起的,仔细分析能够提取到原始的文件。又过了 96 个小时,并且恢复了直到最后一天发布在 OCAL 上的所有剪贴画:总共约有 156,000 张图像。 + +SVG 文件通常很小,但这仍然是大量工作,并且会带来一些非常实际的问题。首先,将需要数 GB 的在线存储空间,这样这些剪贴画才能供其先前的社区使用。其次,必须使用一种搜索艺术品的方法,因为手动浏览 55,000 个文件是不现实的。 + +很明显,社区真正需要的是一个平台。 + +### 构建新的平台 + +一段时间以来,[公共领域矢量图][6] 网站一直在发布公共领域的矢量图。虽然它仍然是一个受欢迎的网站,但是开源用户经常将其仅用作辅助的图片资源,因为其中大多数文件都是 EPS 和 AI 格式的,两者均与 Adobe 相关。两种文件格式通常都可以转换为 SVG,但是特性有所损失。 + +当公共领域矢量图网站的维护者(Vedran 和 Boris)得知 OCAL 丢失时,他们决定创建一个面向开源社区的网站。诚然,他们选择了开源 [Laravel][7] 框架作为后端,该框架为网站提供了管理控制台和用户访问权限。该框架功能强大且开发完善,还使他们能够快速响应错误报告和功能请求,并根据需要升级站点。他们正在建立的站点称为 [FreeSVG.org][8],已经是一个强大而繁荣的公共艺术品图书馆。 + +从那时起,他们就一直从 OCAL 上载所有剪贴画,并且他们甚至在努力地对艺术品进行标记和分类。作为公共领域矢量图网站的创建者,他们还以 SVG 格式贡献了自己的图像。他们的目标是成为互联网上具有 CC0 许可证的 SVG 图像的主要资源。 + +### 贡献 + +[FreeSVG.org][8] 的维护者意识到他们已经继承了重要的管理权。他们正在努力对网站上的所有图像加上标题和描述,以便用户可以轻松找到这些艺术品,并在准备就绪后将其提供给社区,同时坚信与这些艺术品有关的元数据和艺术品属于创建和使用它们的人。他们还意识到可能会发生无法预料的情况,因此他们会定期为其网站和内容创建备份,并打算在其站点出现故障时向公众提供最新备份。 + +如果要为 [FreeSVG.org][9]的知识共享内容添砖加瓦,请下载 [Inkscape][10] 并开始绘制。世界上有很多公共领域的艺术品,例如[历史广告][11]、[塔罗牌][12]和[故事书][13],只是在等待转换为 SVG,因此即使你对自己的绘画技巧没有信心你也可以做出贡献。访问 [FreeSVG 论坛][14]与其他贡献者联系并支持他们。 + +*公地*的概念很重要。无论你是学生、老师、图书馆员、小企业主还是首席执行官,[知识共享都会使所有人受益][15]。如果你不直接捐款,那么你随时可以帮助推广。 + +这是自由文化的力量:它不仅可以扩展,而且随着更多人的参与,它会变得更好。 + +### 艰难的教训 + +从 OCAL 的消亡到 FreeSVG.org 的兴起,开放文化社区已经吸取了一些艰辛的经验。对于以后,以下是我认为最重要的那些。 + +#### 维护你的元数据 + +如果你是内容创建者,请帮助将来的档案管理员,将元数据添加到文件中。大多数图像、音乐、字体和视频文件格式都可以嵌入 EXIF 数据,其他格式在创建它们的应用程序中具有元数据输入界面。勤于用你的姓名、网站或公共电子邮件以及许可证来标记你的作品。 + +#### 做个副本 + +不要以为别人在做备份。如果你关心公用数字内容,请自己备份,否则不要指望永远提供它。 无论*任何上传到互联网上的内容是永久的*的说法是不是正确的,但这并不意味着你永远可以使用。如果 OCAL 文件不再隐秘地可用,那么任何人都不太可能成功地从网络上的某个位置或从全球范围内的人们的硬盘中成功地发现所有的 55,000 张图像。Make copies + +#### 创建外部渠道 + +如果一个社区是由单个网站或实际位置来定义的,那么该社区失去访问该空间的能力就如同解散了一样。如果你是由单个组织或网站驱动的社区的成员,则你应该自己与关心的人共享联系信息,并即使在该站点不可用时也可以建立沟通渠道。 + +例如,[Opensource.com][16] 本身维护其作者和通讯者的邮件列表和其他异地渠道,以便在有或没有网站干预或甚至没有网站的情况下相互交流。 + +#### 自由文化值得为此努力 + +互联网有时被视为懒人社交俱乐部。你可以在需要时登录并在感到疲倦时将其关闭,也可以漫步到所需的任何社交圈。 + +但实际上,自由文化可能是项艰难的工作。但是这种艰难从某种意义上讲并不是说要成为其中的一部分很困难,而是你必须努力维护。如果你忽略你所在的社区,那么该社区可能会在你才会意识到之前就枯萎并褪色。 + +花点时间环顾四周,确定你属于哪个社区,如果不是,那么请告诉某人你对他们带给你生活的意义表示赞赏。同样重要的是,请记住,这样你也为社区的生活做出了贡献。 + +几周前,知识共享组织在华沙举行了它的全球峰会,令人惊叹的国际盛会... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tribal_pattern_shoes.png?itok=e5dSf2hS (White shoes on top of an orange tribal pattern) +[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners +[3]: https://creativecommons.org/share-your-work/public-domain/cc0/ +[4]: http://example.com +[5]: http://www.iana.org/domains/example"\>More +[6]: http://publicdomainvectors.org +[7]: https://github.com/viralsolani/laravel-adminpanel +[8]: https://freesvg.org +[9]: http://freesvg.org +[10]: http://inkscape.org +[11]: https://freesvg.org/drinking-coffee-vector-drawing +[12]: https://freesvg.org/king-of-swords-tarot-card +[13]: https://freesvg.org/space-pioneers-135-scene-vector-image +[14]: http://forum.freesvg.org/ +[15]: https://opensource.com/article/18/1/creative-commons-real-world +[16]: http://Opensource.com From 4f7b7890854c62c258595ed19ef1dcd3b3eb8895 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 Nov 2019 14:50:11 +0800 Subject: [PATCH 517/800] APL --- .../tech/20191029 What you probably didn-t know about sudo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191029 What you probably didn-t know about sudo.md b/sources/tech/20191029 What you probably didn-t know about sudo.md index e58c092602..752b215553 100644 --- a/sources/tech/20191029 What you probably didn-t know about sudo.md +++ b/sources/tech/20191029 What you probably didn-t know about sudo.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 044a19da5e7a063978f2545361965beb536a0661 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 18 Nov 2019 22:44:29 +0800 Subject: [PATCH 518/800] TSL --- ...hat you probably didn-t know about sudo.md | 200 ------------------ ...hat you probably didn-t know about sudo.md | 187 ++++++++++++++++ 2 files changed, 187 insertions(+), 200 deletions(-) delete mode 100644 sources/tech/20191029 What you probably didn-t know about sudo.md create mode 100644 translated/tech/20191029 What you probably didn-t know about sudo.md diff --git a/sources/tech/20191029 What you probably didn-t know about sudo.md b/sources/tech/20191029 What you probably didn-t know about sudo.md deleted file mode 100644 index 752b215553..0000000000 --- a/sources/tech/20191029 What you probably didn-t know about sudo.md +++ /dev/null @@ -1,200 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What you probably didn’t know about sudo) -[#]: via: (https://opensource.com/article/19/10/know-about-sudo) -[#]: author: (Peter Czanik https://opensource.com/users/czanik) - -What you probably didn’t know about sudo -====== -Think you know everything about sudo? Think again. -![Command line prompt][1] - -Everybody knows **sudo**, right? This tool is installed by default on most Linux systems and is available for most BSD and commercial Unix variants. Still, after talking to hundreds of **sudo** users, the most common answer I received was that **sudo** is a tool to complicate life. - -There is a root user and there is the **su** command, so why have yet another tool? For many, **sudo** was just a prefix for administrative commands. Only a handful mentioned that when you have multiple administrators for the same system, you can use **sudo** logs to see who did what. - -So, what is **sudo**? According to the [**sudo** website][2]: - -> _"Sudo allows a system administrator to delegate authority by giving certain users the ability to run some commands as root or another user while providing an audit trail of the commands and their arguments."_ - -By default, **sudo** comes with a simple configuration, a single rule allowing a user or a group of users to do practically anything (more on the configuration file later in this article): - - -``` -`%wheel ALL=(ALL) ALL` -``` - -In this example, the parameters mean the following: - - * The first parameter defines the members of the group. - * The second parameter defines the host(s) the group members can run commands on. - * The third parameter defines the usernames under which the command can be executed. - * The last parameter defines the applications that can be run. - - - -So, in this example, the members of the **wheel** group can run all applications as all users on all hosts. Even this really permissive rule is useful because it results in logs of who did what on your machine. - -### Aliases - -Of course, once it is not just you and your best friend administering a shared box, you will start to fine-tune permissions. You can replace the items in the above configuration with lists: a list of users, a list of commands, and so on. Most likely, you will copy and paste some of these lists around in your configuration. - -This situation is where aliases can come handy. Maintaining the same list in multiple places is error-prone. You define an alias once and then you can use it many times. Therefore, when you lose trust in one of your administrators, you can remove them from the alias and you are done. With multiple lists instead of aliases, it is easy to forget to remove the user from one of the lists with elevated privileges.  - -### Enable features for a certain group of users - -The **sudo** command comes with a huge set of defaults. Still, there are situations when you want to override some of these. This is when you use the **Defaults** statement in the configuration. Usually, these defaults are enforced on every user, but you can narrow the setting down to a subset of users based on host, username, and so on. Here is an example that my generation of sysadmins loves to hear about: insults. These are just some funny messages for when someone mistypes a password: - - -``` -czanik@linux-mewy:~> sudo ls -[sudo] password for root: -Hold it up to the light --- not a brain in sight! -[sudo] password for root: -My pet ferret can type better than you! -[sudo] password for root: -sudo: 3 incorrect password attempts -czanik@linux-mewy:~> -``` - -Because not everyone is a fan of sysadmin humor, these insults are disabled by default. The following example shows how to enable this setting only for your seasoned sysadmins, who are members of the **wheel** group: - - -``` -Defaults !insults -Defaults:%wheel insults -``` - -I do not have enough fingers to count how many people thanked me for bringing these messages back. - -### Digest verification - -There are, of course, more serious features in **sudo** as well. One of them is digest verification. You can include the digest of applications in your configuration:  - - -``` -`peter ALL = sha244:11925141bb22866afdf257ce7790bd6275feda80b3b241c108b79c88 /usr/bin/passwd` -``` - -In this case, **sudo** checks and compares the digest of the application to the one stored in the configuration before running the application. If they do not match, **sudo** refuses to run the application. While it is difficult to maintain this information in your configuration—there are no automated tools for this purpose—these digests can provide you with an additional layer of protection. - -### Session recording - -Session recording is also a lesser-known feature of **sudo**. After my demo, many people leave my talk with plans to implement it on their infrastructure. Why? Because with session recording, you see not just the command name, but also everything that happened in the terminal. You can see what your admins are doing even if they have shell access and logs only show that **bash** is started. - -There is one limitation, currently. Records are stored locally, so with enough permissions, users can delete their traces. Stay tuned for upcoming features. - -### Plugins - -Starting with version 1.8, **sudo** changed to a modular, plugin-based architecture. With most features implemented as plugins, you can easily replace or extend the functionality of **sudo** by writing your own. There are both open source and commercial plugins already available for **sudo**. - -In my talk, I demonstrated the **sudo_pair** plugin, which is available [on GitHub][3]. This plugin is developed in Rust, meaning that it is not so easy to compile, and it is even more difficult to distribute the results. On the other hand, the plugin provides interesting functionality, requiring a second admin to approve (or deny) running commands through **sudo**. Not just that, but sessions can be followed on-screen and terminated if there is suspicious activity. - -In a demo I did during a recent talk at the All Things Open conference, I had the infamous: - - -``` -`czanik@linux-mewy:~> sudo  rm -fr /` -``` - -command displayed on the screen. Everybody was holding their breath to see whether my laptop got destroyed, but it survived. - -### Logs - -As I already mentioned at the beginning, logging and alerting is an important part of **sudo**. If you do not check your **sudo** logs regularly, there is not much worth in using **sudo**. This tool alerts by email on events specified in the configuration and logs all events to **syslog**. Debug logs can be turned on and used to debug rules or report bugs. - -### Alerts - -Email alerts are kind of old-fashioned now, but if you use **syslog-ng** for collecting your log messages, your **sudo** log messages are automatically parsed. You can easily create custom alerts and send those to a wide variety of destinations, including Slack, Telegram, Splunk, or Elasticsearch. You can learn more about this feature from [my blog on syslong-ng.com][4]. - -### Configuration - -We talked a lot about **sudo** features and even saw a few lines of configuration. Now, let’s take a closer look at how **sudo** is configured. The configuration itself is available in **/etc/sudoers**, which is a simple text file. Still, it is not recommended to edit this file directly. Instead, use **visudo**, as this tool also does syntax checking. If you do not like **vi**, you can change which editor to use by pointing the **EDITOR** environment variable at your preferred option. - -Before you start editing the **sudo** configuration, make sure that you know the root password. (Yes, even on Ubuntu, where root does not have a password by default.) While **visudo** checks the syntax, it is easy to create a syntactically correct configuration that locks you out of your system. - -When you have a root password at hand in case of an emergency, you can start editing your configuration. When it comes to the **sudoers** file, there is one important thing to remember: This file is read from top to bottom, and the last setting wins. What this fact means for you is that you should start with generic settings and place exceptions at the end, otherwise exceptions are overridden by the generic settings. - -You can find a simple **sudoers** file below, based on the one in CentOS, and add a few lines we discussed previously: - - -``` -Defaults !visiblepw -Defaults always_set_home -Defaults match_group_by_gid -Defaults always_query_group_plugin -Defaults env_reset -Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS" -Defaults env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE" -Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin -root ALL=(ALL) ALL -%wheel ALL=(ALL) ALL -Defaults:%wheel insults -Defaults !insults -Defaults log_output -``` - -This file starts by changing a number of defaults. Then come the usual default rules: The **root** user and members of the **wheel** group have full permissions over the machine. Next, we enable insults for the **wheel** group, but disable them for everyone else. The last line enables session recording. - -The above configuration is syntactically correct, but can you spot the logical error? Yes, there is one: Insults are disabled for everyone since the last, generic setting overrides the previous, more specific setting. Once you switch the two lines, the setup works as expected: Members of the **wheel** group receive funny messages, but the rest of the users do not receive them. - -### Configuration management - -Once you have to maintain the **sudoers** file on multiple machines, you will most likely want to manage your configuration centrally. There are two major open source possibilities here. Both have their advantages and drawbacks. - -You can use one of the configuration management applications that you also use to configure the rest of your infrastructure. Red Hat Ansible, Puppet, and Chef all have modules to configure **sudo**. The problem with this approach is that updating configurations is far from real-time. Also, users can still edit the **sudoers** file locally and change settings. - -The **sudo** tool can also store its configuration in LDAP. In this case, configuration changes are real-time and users cannot mess with the **sudoers** file. On the other hand, this method also has limitations. For example, you cannot use aliases or use **sudo** when the LDAP server is unavailable. - -### New features - -There is a new version of **sudo** right around the corner. Version 1.9 will include many interesting new features. Here are the most important planned features: - - * A recording service to collect session recordings centrally, which offers many advantages compared to local storage: - * It is more convenient to search in one place. - * Recordings are available even if the sender machine is down. - * Recordings cannot be deleted by someone who wants to delete their tracks. - * The **audit** plugin does not add new features to **sudoers**, but instead provides an API for plugins to easily access any kind of **sudo** logs. This plugin enables creating custom logs from **sudo** events using plugins. - * The **approval** plugin enables session approvals without using third-party plugins. - * And my personal favorite: Python support for plugins, which enables you to easily extend **sudo** using Python code instead of coding natively in C. - - - -### Conclusion - -I hope this article proved to you that **sudo** is a lot more than just a simple prefix. There are tons of possibilities to fine-tune permissions on your system. You cannot just fine-tune permissions, but also improve security by checking digests. Session recordings enable you to check what is happening on your systems. You can also extend the functionality of **sudo** using plugins, either using something already available or writing your own. Finally, given the list of upcoming features you can see that even if **sudo** is decades old, it is a living project that is constantly evolving. - -If you want to learn more about **sudo**, here are a few resources: - - * [The **sudo** website][5] - - * [The **sudo** blog][6] - - * [Follow us on Twitter][7] - - - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/know-about-sudo - -作者:[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/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) -[2]: https://www.sudo.ws -[3]: https://github.com/square/sudo_pair/ -[4]: https://www.syslog-ng.com/community/b/blog/posts/alerting-on-sudo-events-using-syslog-ng -[5]: https://www.sudo.ws/ -[6]: https://blog.sudo.ws/ -[7]: https://twitter.com/sudoproject diff --git a/translated/tech/20191029 What you probably didn-t know about sudo.md b/translated/tech/20191029 What you probably didn-t know about sudo.md new file mode 100644 index 0000000000..7843c56405 --- /dev/null +++ b/translated/tech/20191029 What you probably didn-t know about sudo.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What you probably didn’t know about sudo) +[#]: via: (https://opensource.com/article/19/10/know-about-sudo) +[#]: author: (Peter Czanik https://opensource.com/users/czanik) + +关于 sudo 你可能不知道的 +====== + +> 认为你已经了解了 sudo 的所有知识吗?再想想。 + +![Command line prompt][1] + +大家都知道 `sudo`,对吗?默认情况下,该工具已安装在大多数 Linux 系统上,并且可用于大多数 BSD 和商业 Unix 变体。不过,在与数百名 `sudo` 用户交谈之后,我得到的最常见的答案是 `sudo` 是一个使生活复杂化的工具。 + +有 root 用户和 `su` 命令,那么为什么还要使用另一个工具呢?对于许多人来说,`sudo` 只是管理命令的前缀。只有极少数人提到,当你在同一个系统上有多个管理员时,可以使用 `sudo` 日志查看谁做了什么。 + +那么,`sudo` 是什么? 根据 [sudo 网站] [2]: + +> “sudo 允许系统管理员通过授予某些用户以 root 用户或其他用户身份运行某些命令的能力,同时提供命令及其参数的审核记录,从而委派权限。” + +默认情况下,`sudo` 带有简单的配置,一条规则允许一个用户或一组用户执行几乎所有操作(在本文后面的配置文件中有更多信息): + +``` +%wheel ALL=(ALL) ALL +``` + +在此示例中,参数表示以下含义: + +* 第一个参数(`%wheel`)定义组的成员。 +* 第二个参数(`ALL`)定义组成员可以在其上运行命令的主机。 +* 第三个参数(`(ALL)`)定义了可以执行命令的用户名。 +* 最后一个参数(`ALL`)定义可以运行的应用程序。 + +因此,在此示例中,`wheel` 组的成员可以以所有主机上的所有用户身份运行所有应用程序。即使这个一切允许的规则也很有用,因为它会记录谁在的计算机上做了什么。 + +### 别名 + +当然,它不仅可以让你和你最好的朋友管理一个共享机器,你还可以微调权限。你可以将以上配置中的项目替换为列表:用户列表、命令列表等。 多数情况下,你可能会复制并粘贴配置中的一些列表。 + +在这种情况下,别名可以派上用场。在多个位置维护相同的列表容易出错。你可以定义一次别名,然后可以多次使用。因此,当你对一位管理员失去信任时,可以将其从别名中删除就行了。使用多个列表而不是别名,很容易忘记从具有较高特权的列表之一中删除用户。 + +### 为特定组的用户启用功能 + +`sudo` 命令带有大量默认设置。不过,在某些情况下,你想覆盖其中的一些情况,这时你可以在配置中使用 `Defaults` 语句。通常,对每个用户都强制使用这些默认值,但是你可以根据主机、用户名等将设置缩小到一部分用户。这有个我那一代的系统管理员喜欢玩的一个示例:“羞辱”。这些只是一些有人输入错误密码时的有趣信息: + +``` +czanik@linux-mewy:~> sudo ls +[sudo] password for root: +Hold it up to the light --- not a brain in sight! +[sudo] password for root: +My pet ferret can type better than you! +[sudo] password for root: +sudo: 3 incorrect password attempts +czanik@linux-mewy:~> +``` + +由于并非所有人都喜欢系统管理员的这种幽默,因此默认情况下将禁用这些羞辱信息。以下示例说明了如何仅对经验丰富的系统管理员(即 `wheel` 组的成员)启用此设置: + +``` +Defaults !insults +Defaults:%wheel insults +``` + +我想感谢我将这些消息带回来的人用两只手也数不过来吧。 + +### 摘要验证 + +当然,`sudo` 还有更严肃的功能。其中之一是摘要验证。你可以在配置中包括应用程序的摘要: + +``` +peter ALL = sha244:11925141bb22866afdf257ce7790bd6275feda80b3b241c108b79c88 /usr/bin/passwd +``` + +在这种情况下,`sudo` 在运行应用程序之前检查应用程序摘要,并将其与配置中存储的摘要进行比较。如果不匹配,`sudo` 拒绝运行该应用程序。尽管很难在配置中维护此信息(没有用于此目的的自动化工具),但是这些摘要可以为你提供额外的保护层。 + +### 会话记录 + +会话记录也是 `sudo` 鲜为人知的功能。在演示之后,许多人离开我的演讲后就在计划在其基础设施上实施它。为什么?因为使用会话记录,你不仅可以看到命令名称,还可以看到终端中发生的所有事情。你可以看到你的管理员在做什么,即使他们具有 shell 访问权限,而日志仅显示启动了 `bash`。 + +当前有一个限制。记录存储在本地,因此具有足够的权限的话,用户可以删除他们的痕迹。请继续关注即将推出的功能。 + +### 插件 + +从 1.8 版开始,`sudo` 更改为基于插件的模块化体系结构。通过将大多数功能实现为插件,你可以编写自己的功能轻松地替换或扩展 `sudo` 的功能。已有 `sudo` 可用的开源和商业插件。 + +在我的演讲中,我演示了 `sudo_pair` 插件,该插件可在 [GitHub][3] 上获得。这个插件是用 Rust 开发的,这意味着它不是那么容易编译,甚至更难以分发编译结果。另一方面,该插件提供了有趣的功能,需要第二个管理员通过 `sudo` 批准(或拒绝)运行命令。不仅如此,如果有可疑活动,可以在屏幕上跟踪会话并终止会话。 + +在最近的 All Things Open 会议上的一次演示中,我做了一个臭名昭著的演示: + +``` +czanik@linux-mewy:~> sudo  rm -fr / +``` + +看着屏幕上显示的命令。每个人都屏住呼吸,想看看我的笔记本电脑是否被毁了,但它仍然幸免了。 + +### 日志 + +正如我在开始时已经提到的,日志记录和警报是 `sudo` 的重要组成部分。如果你不会定期检查 `sudo` 日志,那么日志在使用 `sudo` 中并没有太多价值。该工具通过电子邮件提醒配置中指定的事件,并将所有事件记录到 syslog 中。可以打开调试日志用于调试规则或报告错误。 + +### 警报 + +电子邮件警报现在有点过时了,但是如果你使用 syslog-ng 来收集日志消息,则会自动解析 `sudo` 日志消息。你可以轻松创建自定义警报并将其发送到各种各样的目的地,包括 Slack、Telegram、Splunk 或 Elasticsearch。你可以从[我在 syslong-ng.com 上的博客][4]中了解有关此功能的更多信息。 + +### 配置 + +我们谈论了很多 `sudo` 功能,甚至看到了几行配置。现在,让我们仔细看看 `sudo` 的配置方式。配置本身可以在 `/etc/sudoers` 中获得,这是一个简单的文本文件。不过,不建议直接编辑此文件。相反,请使用 `visudo`,因为此工具还会执行语法检查。如果你不喜欢 `vi`,则可以通过将 `EDITOR` 环境变量指向你的首选编辑器来更改要使用的编辑器。 + +在开始编辑 `sudo` 配置之前,请确保你知道 root 密码。(是的,即使在默认情况下 root 用户没有密码的 Ubuntu 上也是如此。)虽然 `visudo` 会检查语法,但创建语法正确而将你锁定在系统之外的配置很容易。 + +如果在紧急情况下,而你手头有 root 密码,你也可以编辑配置。当涉及到 `sudoers` 文件时,有一件重要的事情要记住:从上到下读取该文件,以最后的设置为准。这个事实对你来说意味着你应该从通用设置开始,并在末尾放置例外情况,否则,通用设置会覆盖例外情况。 + +你可以在下面看到一个基于 CentOS 的简单 `sudoers` 文件,并添加我们之前讨论的几行: + +``` +Defaults !visiblepw +Defaults always_set_home +Defaults match_group_by_gid +Defaults always_query_group_plugin +Defaults env_reset +Defaults env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE KDEDIR LS_COLORS" +Defaults env_keep += "MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE" +Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin +root ALL=(ALL) ALL +%wheel ALL=(ALL) ALL +Defaults:%wheel insults +Defaults !insults +Defaults log_output +``` + +该文件从更改多个默认值开始。然后是通常的默认规则:`root` 用户和 `wheel` 组的成员对计算机具有完全权限。接下来,我们对 `wheel` 组启用“羞辱”,但对其他所有人禁用它们。最后一行启用会话记录。 + +上面的配置在语法上是正确的,但是你可以发现逻辑错误吗?是的,有一个:上一个通用设置覆盖了先前的更具体设置,所有人均禁用了“羞辱”。一旦交换了这两行的位置,设置就会按预期进行:`wheel` 组的成员会收到有趣的消息,但其他用户则不会收到。 + +### 配置管理 + +一旦必须在多台机器上维护 `sudoers` 文件,你很可能希望集中管理配置。这里主要有两种可能的开源方法。两者都有其优点和缺点。 + +你可以使用也可以用来配置其余基础设施的配置管理应用程序之一:Red Hat Ansible、Puppet 和 Chef 都具有用于配置 `sudo` 的模块。这种方法的问题在于更新配置远非实时。同样,用户仍然可以在本地编辑 `sudoers` 文件并更改设置。 + +`sudo` 工具也可以将其配置存储在 LDAP 中。在这种情况下,配置更改是实时的,用户不能弄乱`sudoers` 文件。另一方面,该方法也有局限性。例如,当 LDAP 服务器不可用时,你不能使用别名或使用 `sudo`。 + +### 新功能 + +新版本的 `sudo` 即将推出。1.9 版将包含许多有趣的新功能。以下是最重要的计划功能: + +* 记录服务可集中收集会话记录,与本地存储相比,它具有许多优点: + * 在一个地方搜索更方便。 + * 即使发送记录的机器关闭,也可以进行记录。 + * 记录不能被想要删除其痕迹的人删除。 +* audit 插件没有向 `sudoers` 添加新功能,而是为插件提供了 API,以方便地访问任何类型的 `sudo` 日志。这个插件允许使用插件从 `sudo` 事件创建自定义日志。 +* approval 插件无需使用第三方插件即可启用会话批准。 +* 以及我个人最喜欢的:插件的 Python 支持,这使你可以轻松地使用 Python 代码扩展 `sudo`,而不是使用 C 语言进行原生编码。 +   +### 总结 + +希望本文能向你证明 `sudo` 不仅仅是一个简单的命令前缀。有无数种可能性可以微调系统上的权限。你不仅可以微调权限,还可以通过检查摘要来提高安全性。会话记录使你能够检查系统上正在发生的事情。你也可以使用插件扩展 `sudo` 的功能,或者使用已有的插件或编写自己的插件。最后,从即将发布的功能列表中,你可以看到,即使 `sudo` 已有数十年的历史,它也是一个不断发展的有生命的项目。 + +如果你想了解有关 `sudo` 的更多信息,请参考以下资源: + +* [sudo `网站][5] +* [sudo 博客][6] +* [在 Twitter 上关注我们][7] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/know-about-sudo + +作者:[Peter Czanik][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/czanik +[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://www.sudo.ws +[3]: https://github.com/square/sudo_pair/ +[4]: https://www.syslog-ng.com/community/b/blog/posts/alerting-on-sudo-events-using-syslog-ng +[5]: https://www.sudo.ws/ +[6]: https://blog.sudo.ws/ +[7]: https://twitter.com/sudoproject From e3b487423a6457f41316e2970b72c9bc413aa5c7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 Nov 2019 00:19:36 +0800 Subject: [PATCH 519/800] PRF --- ...lls with the Python ORM tool SQLAlchemy.md | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md b/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md index 0d706249ba..ccbbdbde61 100644 --- a/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md +++ b/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md @@ -1,31 +1,34 @@ [#]: collector: (lujun9972) -[#]: translator: (MjSeven ) -[#]: reviewer: ( ) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to fix common pitfalls with the Python ORM tool SQLAlchemy) [#]: via: (https://opensource.com/article/19/9/common-pitfalls-python) [#]: author: (Zach Todd https://opensource.com/users/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez) -如何使用 Python ORM 工具 SQLAlchemy 修复常见的陷阱 +如何修复使用 Python ORM 工具 SQLAlchemy 时的常见陷阱 ====== -在使用 SQLAlchemy 对象关系映射工具包时,那些看似很小的选择可能对性能产生重要影响。 + +> 在使用 SQLAlchemy 时,那些看似很小的选择可能对这种对象关系映射工具包的性能产生重要影响。 + ![A python with a package.][1] -对象关系映射([ORM][2])使应用程序开发人员的工作更轻松,在很大程度是因为它允许你使用你可能知道的语言(例如 Python)与数据库交互,而不是使用原始 SQL 语句查询。[SQLAlchemy][3] 是一个 Python ORM 工具包,它提供使用 Python 访问 SQL 数据库的功能。它是一个成熟的 ORM 工具,增加了模型关系、强大的查询构造范式、简单的序列化等优点。然而,它的易用性使得人们很容易忘记其背后发生了什么。使用 SQLAlchemy 时做出的看似很小的选择可能产生非常大的性能影响。 +对象关系映射Object-relational mapping([ORM][2])使应用程序开发人员的工作更轻松,在很大程度是因为它允许你使用你可能知道的语言(例如 Python)与数据库交互,而不是使用原始 SQL 语句查询。[SQLAlchemy][3] 是一个 Python ORM 工具包,它提供使用 Python 访问 SQL 数据库的功能。它是一个成熟的 ORM 工具,增加了模型关系、强大的查询构造范式、简单的序列化等优点。然而,它的易用性使得人们很容易忘记其背后发生了什么。使用 SQLAlchemy 时做出的看似很小的选择可能产生非常大的性能影响。 本文解释了开发人员在使用 SQLAlchemy 时遇到的一些最重要的性能问题,以及如何解决这些问题。 ### 只需要计数但检索整个结果集 -有时开发人员只需要一个结果计数,而不是使用数据库计数,获取了所有结果,然后使用 Python 中的 **len** 完成计数。 +有时开发人员只需要一个结果计数,但是没有使用数据库计数功能,而是获取了所有结果,然后使用 Python 中的 `len` 完成计数。 + ``` count = len(User.query.filter_by(acct_active=True).all()) ``` -相反,使用 SQLAlchemy 的 **count** 方法将在服务器端执行计数,从而减少发送到客户端的数据。在前面的例子中调用 **all()** 也会导致模型对象的实例化,如果有很多数据,那么时间代价可能会非常昂贵。 +相反,使用 SQLAlchemy 的 `count` 方法将在服务器端执行计数,从而减少发送到客户端的数据。在前面的例子中调用 `all()` 也会导致模型对象的实例化,如果有很多数据,那么时间代价可能会非常昂贵。 -除非还需要做其他的事情,否则只需使用 **count** 方法。 +除非还需要做其他的事情,否则只需使用 `count` 方法: ``` count = User.query.filter_by(acct_active=True).count() @@ -41,7 +44,7 @@ for user in result:     print(user.name, user.email) ``` -使用 **with_entities** 方法只选择所需要的内容。 +反之,使用 `with_entities` 方法只选择所需要的内容: ``` result = User.query.with_entities(User.name, User.email).all() @@ -58,7 +61,8 @@ for user in users_to_update:   user.acct_active = True   db.session.add(user) ``` -改用批量更新方法。 + +改用批量更新方法: ``` query = User.query.filter(user.id.in_([user.id for user in users_to_update])) @@ -70,6 +74,7 @@ query.update({"acct_active": True}, synchronize_session=False) ORM 允许在模型关系上进行简单的配置,但是有一些微妙的行为可能会令人吃惊。大多数数据库通过外键和各种级联选项维护关系完整性。SQLAlchemy 允许你使用外键和级联选项定义模型,但是 ORM 具有自己的级联逻辑,可以取代数据库。 考虑以下模型: + ``` class Artist(Base):     __tablename__ = "artist" @@ -85,15 +90,15 @@ class Song(Base):     artist_id = Column(Integer, ForeignKey("artist.id", ondelete="CASCADE")) ``` -删除歌手将导致 ORM 在 Song 表上发出 **delete** 查询,从而防止由于外键导致的删除操作。这种行为可能会成为复杂关系和大量记录的瓶颈。 +删除歌手将导致 ORM 在 `song` 表上发出 `delete` 查询,从而防止由于外键导致的删除操作。这种行为可能会成为复杂关系和大量记录的瓶颈。 -请包含 **passive_deletes** 选项,以确保数据库正在管理关系。但是,请确保你的数据库具有此功能。例如,SQLite 默认情况下不管理外键。 +请包含 `passive_deletes` 选项,以确保让数据库来管理关系。但是,请确保你的数据库具有此功能。例如,SQLite 默认情况下不管理外键。 ``` songs = relationship("Song", cascade all, delete", passive_deletes=True) ``` -### 在使用预先加载时,应使用延迟加载 +### 当要使用贪婪加载时,应使用延迟加载 延迟加载是 SQLAlchemy 处理关系的默认方法。从上一个例子构建来看,加载一个歌手时不会同时加载他或她的歌曲。这通常是一个好主意,但是如果总是需要加载某些关系,单独的查询可能会造成浪费。 @@ -105,9 +110,9 @@ songs = relationship("Song", cascade all, delete", passive_deletes=True) songs = relationship("Song", lazy="joined", cascade="all, delete") ``` -这将导致一个左连接被添加到任何歌手的查询中,因此,**songs** 集合将立即可用。尽管有更多数据返回给客户端,但往返次数可能会少得多。 +这将导致一个左连接被添加到任何歌手的查询中,因此,`songs` 集合将立即可用。尽管有更多数据返回给客户端,但往返次数可能会少得多。 -SQLAlchemy 为无法采用这种综合方法的情况提供了更细粒度的控制,可以使用 **joinedload()** 函数在每个查询的基础上切换联合加载。 +SQLAlchemy 为无法采用这种综合方法的情况提供了更细粒度的控制,可以使用 `joinedload()` 函数在每个查询的基础上切换连接的加载。 ``` from sqlalchemy.orm import joinedload @@ -122,10 +127,10 @@ print(artists.songs) # Does not incur a roundtrip to load ``` for song in songs: -    db.session.add(Song(**song)) +    db.session.add(Song(`song)) ``` -相反,绕过 ORM,只使用 SQLAlchemy 核心的参数绑定功能。 +相反,绕过 ORM,只使用核心的 SQLAlchemy 参数绑定功能。 ``` batch = [] @@ -139,11 +144,11 @@ if batch:     db.session.execute(insert_stmt, batch) ``` -请记住,此方法会跳过你可能依赖的任何客户端 ORM 逻辑,例如基于 Python 的列默认值。尽管此方法比将对象加载为完整的模型实例要快,但是你的数据库可能具有更快的批量加载方法。例如,PostgreSQL 的 **COPY** 命令为加载大量记录提供了最佳性能。 +请记住,此方法会自然而然地跳过你可能依赖的任何客户端 ORM 逻辑,例如基于 Python 的列默认值。尽管此方法比将对象加载为完整的模型实例要快,但是你的数据库可能具有更快的批量加载方法。例如,PostgreSQL 的 `COPY` 命令为加载大量记录提供了最佳性能。 -### 过早调用 commit 或 flush +### 过早调用提交或刷新 -在很多情况下,你需要将子记录与其父记录相关联,反之亦然。一种明显的方法是刷新会话,以便为有问题的记录分配一个 ID。 +在很多情况下,你需要将子记录与其父记录相关联,反之亦然。一种显然的方法是刷新会话,以便为有问题的记录分配一个 ID。 ``` artist = Artist(name="Bob Dylan") @@ -155,7 +160,7 @@ db.session.flush() song.artist_id = artist.id ``` -对于每个请求,commit 或 flush 多次通常是不必要的,也是不可取的。数据库刷新涉及强制在数据库服务器上进行磁盘写入,在大多数情况下,客户端将阻塞,直到服务器确认已写入数据为止。 +对于每个请求,多次提交或刷新通常是不必要的,也是不可取的。数据库刷新涉及强制在数据库服务器上进行磁盘写入,在大多数情况下,客户端将阻塞,直到服务器确认已写入数据为止。 SQLAlchemy 可以在幕后跟踪关系和管理相关键。 @@ -168,9 +173,7 @@ artist.songs.append(song) ### 总结 -我希望这一系列常见的陷阱可以帮助你避免这些问题,并使你的应用平稳运行。通常,在诊断性能问题时,测量是关键。大多数数据库都提供性能诊断功能,可以帮助你定位问题,例如 PostgreSQL的 **pg_stat_statements** 模块。 - -* * * +我希望这一系列常见的陷阱可以帮助你避免这些问题,并使你的应用平稳运行。通常,在诊断性能问题时,测量是关键。大多数数据库都提供性能诊断功能,可以帮助你定位问题,例如 PostgreSQL 的 `pg_stat_statements` 模块。 -------------------------------------------------------------------------------- @@ -179,7 +182,7 @@ via: https://opensource.com/article/19/9/common-pitfalls-python 作者:[Zach Todd][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 e741aad3375ddf7b5aa0b14c1977b4c0f41d9cf5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 19 Nov 2019 00:55:41 +0800 Subject: [PATCH 520/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191119=20App=20?= =?UTF-8?q?Highlight:=20Flameshot=20for=20Taking=20and=20Editing=20Screens?= =?UTF-8?q?hots?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191119 App Highlight- Flameshot for Taking and Editing Screenshots.md --- ...shot for Taking and Editing Screenshots.md | 153 ++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 sources/tech/20191119 App Highlight- Flameshot for Taking and Editing Screenshots.md diff --git a/sources/tech/20191119 App Highlight- Flameshot for Taking and Editing Screenshots.md b/sources/tech/20191119 App Highlight- Flameshot for Taking and Editing Screenshots.md new file mode 100644 index 0000000000..bc287325cd --- /dev/null +++ b/sources/tech/20191119 App Highlight- Flameshot for Taking and Editing Screenshots.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Flameshot for Taking and Editing Screenshots) +[#]: via: (https://itsfoss.com/flameshot/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +App Highlight: Flameshot for Taking and Editing Screenshots +====== + +If you have been following It’s FOSS regularly, you might have come across my coverage on the [best ways to take a screenshot in Linux][1]. + +![][2] + +I did recommend using Flameshot as well because it happens to be my personal favorite to take screenshots. In case you didn’t know, [Flameshot][3] is an open source screenshot tool available for Linux. + +However, in this article, I shall be focusing on ‘Flameshot’ to help you install it, configure it, and highlight the features it has to offer. + +### Flameshot Features + +Flameshot offers almost all the essential features that you would ever require on a screenshot tool in Linux. Here are some of the key features in video format: + +[Subscribe to our YouTube channel for more Linux videos][4] + +#### Upload screenshot to Imgur + +![][5] + +A lot of users want to simply upload their screenshots directly to the cloud in order to easily share it with others. + +You can do that by syncing your saved files to a cloud storage solution and share them later. But, that’s quite a few steps to follow in order to share your screenshot, right? + +So, here, Flameshot lets you upload your image directly to [Imgur][6] with a single click. All you have to do is share the URL. + +Do note that these uploads will not be associated with your Imgur account (if you have one) and will be only accessible to the ones with the link. + +#### Annotation Options + +![][7] + +The whole point of having a 3rd party screenshot utility is the ability to annotate the pictures. + +You can choose to add an arrow mark, highlight a text, blur a section, add a text, draw something, add a rectangular/circular shaped border, and add a solid color box. + +![][8] + +You can take a closer look at the options with the help of the GIF above (from their official [GitHub page][9]): + +#### Customization Options + +![][10] + +In addition to all the useful features, it also gives you the ability to customize the UI, filename (when you save a screenshot), and some general options as well. + +### Installing Flameshot on Linux + +Before configuring Flameshot, you need to get it installed on your Linux system. + +You might find it in your Software Center/App Center/Package Manager, simply search for “flameshot” and get it installed. + +In case you do not find it there, you can head on to its [GitHub releases page][11] and download the setup file suitable for your Linux distro. It is available in DEB (for Ubuntu), RPM (for Fedora) and AppImage (for all Linux distributions) format. + +[Download Flameshot][11] + +### How To Setup Flameshot? + +Now that you are aware of the features (and probably have it installed), how do you use it? + +Of course, you don’t want to launch a screenshot tool by searching for it in the list of applications installed. + +So, the best way to access it would be to press the **PRT SC** key, right? + +But, by default, when you press the **Print Screen** button, it will launch the default screenshot tool (or directly take a full-screen screenshot). + +Fret not, you can easily change it. Here’s how you can set flameshot to launch upon pressing the ‘**Prt Sc**‘ button: + +1\. Head to the system settings and navigate your way to the “**Device**” options. + +2\. Next, head inside the “**Keyboard Shortcuts**” option. + +3\. Now, you need to change the keyboard shortcut for “**Saving a screenshot to Pictures**” from **Prt Sc** to anything else (a button you don’t use frequently). + +![Assign a custom keyboard shortcut to Flameshot][12] + +Refer to the image above to understand it better. + +4\. Once you have done this, scroll down to the bottom and add a new keyboard shortcut by clicking on the “**+**” button. + +5\. Here, you will get the option to name the shortcut (it can be anything) and in place of the command, you will have to enter: + +``` +flameshot gui +``` + +And, hit the **Prt Sc** button when you set the shortcut. That’s it! + +Here’s how it should look after configuration: + +![][13] + +Now, you should be able to launch Flameshot by pressing the **Prt Sc** button. + +### Few Tips To Note + +![][14] + + * By default, Flameshot saves the pictures in [PNG][15] format. So, if you need a [JPEG][16] file, you can simply rename the file extension. + * You can change the color of the text/arrow mark by performing a right-click before adding it. Once you change it, the color remains the same even when you use it the next time. You can change the color again, the same way. + * If you want the option to choose a custom color (instead of the pre-defined color selection), just hit the **SPACE** **bar** after you select a region to take the screenshot. + * If you cannot access the Flameshot configuration option via the app drawer, simply type in “**flameshot config**” in the terminal. + + + +**Wrapping Up** + +Even though there are alternatives to Flameshot available, I find it to be the best screenshot tool for my usage. + +If you found this tutorial helpful, do share it with other Linux users. If you find Flameshot useful, please do consider making a [donation to its developer][17]. + +In either case, if you already use a screenshot tool, which one is it? Do you know of something that happens to be better than Flameshot? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/flameshot/ + +作者:[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/take-screenshot-linux/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/flameshot.png?ssl=1 +[3]: https://flameshot.js.org/ +[4]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/flameshot-cloud-upload-feature.jpg?ssl=1 +[6]: https://imgur.com/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/flameshot-options.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/flameshot-usage.gif?ssl=1 +[9]: https://github.com/lupoDharkael/flameshot +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/flameshot-customization.jpg?ssl=1 +[11]: https://github.com/lupoDharkael/flameshot/releases +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/keyboard-shortcut-option.jpg?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/flameshot-shortcut-config.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/flameshot-tips.jpg?ssl=1 +[15]: https://en.wikipedia.org/wiki/Portable_Network_Graphics +[16]: https://en.wikipedia.org/wiki/JPEG +[17]: https://flameshot.js.org/#/ From ccb03f93f940457b3b7ce3449eb6964e4b318a50 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 19 Nov 2019 01:05:21 +0800 Subject: [PATCH 521/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191118=20How=20?= =?UTF-8?q?to=20use=20regular=20expressions=20in=20awk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191118 How to use regular expressions in awk.md --- ...8 How to use regular expressions in awk.md | 279 ++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 sources/tech/20191118 How to use regular expressions in awk.md diff --git a/sources/tech/20191118 How to use regular expressions in awk.md b/sources/tech/20191118 How to use regular expressions in awk.md new file mode 100644 index 0000000000..cdf1468369 --- /dev/null +++ b/sources/tech/20191118 How to use regular expressions in awk.md @@ -0,0 +1,279 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use regular expressions in awk) +[#]: via: (https://opensource.com/article/19/11/how-regular-expressions-awk) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to use regular expressions in awk +====== +Use regex to search code using dynamic and complex pattern definitions. +![Coding on a computer][1] + +In awk, regular expressions (regex) allow for dynamic and complex pattern definitions. You're not limited to searching for simple strings but also patterns within patterns. + +The syntax for using regular expressions to match lines in awk is: + + +``` +`word ~ /match/` +``` + +The inverse of that is _not_ matching a pattern: + + +``` +`word !~ /match/` +``` + +If you haven't already, create the sample file from our [previous article][2]: + + +``` +name       color  amount +apple      red    4 +banana     yellow 6 +strawberry red    3 +raspberry  red    99 +grape      purple 10 +apple      green  8 +plum       purple 2 +kiwi       brown  4 +potato     brown  9 +pineapple  yellow 5 +``` + +Save the file as **colours.txt** and run: + + +``` +$ awk -e '$1 ~ /p[el]/ {print $0}' colours.txt +apple      red    4 +grape      purple 10 +apple      green  8 +plum       purple 2 +pineapple  yellow 5 +``` + +You have selected all records containing the letter **p** followed by _either_ an **e** or an **l**. + +Adding an **o** inside the square brackets creates a new pattern to match: + + +``` +$ awk -e '$1 ~ /p[el]/ {print $0}' colours.txt +apple      red    4 +grape      purple 10 +apple      green  8 +plum       purple 2 +pineapple  yellow 5 +potato     brown  9 +``` + +### Regular expression basics + +Certain characters have special meanings when they're used in regular expressions. + +#### Anchors + +Anchor | Function +---|--- +**^** | Indicates the beginning of the line +**$** | Indicates the end of a line +**\A** | Denotes the beginning of a string +**\z** | Denotes the end of a string +**\b** | Marks a word boundary + +For example, this awk command prints any record containing an **r** character: + + +``` +$ awk -e '$1 ~ /r/ {print $0}' colours.txt +strawberry red    3 +raspberry  red    99 +grape      purple 10 +``` + +Add a **^** symbol to select only records where **r** occurs at the beginning of the line: + + +``` +$ awk -e '$1 ~ /^r/ {print $0}' colours.txt +raspberry  red    99 +``` + +#### Characters + +Character | Function +---|--- +**[ad]** | Selects **a** or **d** +**[a-d]** | Selects any character **a** through **d** (a, b, c, or d) +**[^a-d]** | Selects any character _except_ **a** through **d** (e, f, g, h…) +**\w** | Selects any word +**\s** | Selects any whitespace character +**\d** | Selects any digit + +The capital versions of w, s, and d are negations; for example, **\D** _does not_ select any digit. + +[POSIX][3] regex offers easy mnemonics for character classes: + +POSIX mnemonic | Function +---|--- +**[:alnum:]** | Alphanumeric characters +**[:alpha:]** | Alphabetic characters +**[:space:]** | Space characters (such as space, tab, and formfeed) +**[:blank:]** | Space and tab characters +**[:upper:]** | Uppercase alphabetic characters +**[:lower:]** | Lowercase alphabetic characters +**[:digit:]** | Numeric characters +**[:xdigit:]** | Characters that are hexadecimal digits +**[:punct:]** | Punctuation characters (i.e., characters that are not letters, digits, control characters, or space characters) +**[:cntrl:]** | Control characters +**[:graph:]** | Characters that are both printable and visible (e.g., a space is printable but not visible, whereas an **a** is both) +**[:print:]** | Printable characters (i.e., characters that are not control characters) + +### Quantifiers + +Quantifier | Function +---|--- +**.** | Matches any character +**+** | Modifies the preceding set to mean _one or more times_ +***** | Modifies the preceding set to mean _zero or more times_ +**?** | Modifies the preceding set to mean _zero or one time_ +**{n}** | Modifies the preceding set to mean _exactly n times_ +**{n,}** | Modifies the preceding set to mean _n or more times_ +**{n,m}** | Modifies the preceding set to mean _between n and m times_ + +Many quantifiers modify the character sets that precede them. For example, **.** means any character that appears exactly once, but **.*** means _any or no_ character. Here's an example; look at the regex pattern carefully: + + +``` +$ printf "red\nrd\n" +red +rd +$ printf "red\nrd\n" | awk -e '$0 ~ /^r.d/ {print}' +red +$ printf "red\nrd\n" | awk -e '$0 ~ /^r.*d/ {print}' +red +rd +``` + +Similarly, numbers in braces specify the number of times something occurs. To find records in which an **e** character occurs exactly twice: + + +``` +$ awk -e '$2 ~ /e{2}/ {print $0}' colours.txt +apple      green  8 +``` + +### Grouped matches + +Quantifier | Function +---|--- +**(red)** | Parentheses indicate that the enclosed letters must appear contiguously +** | ** + +For instance, the pattern **(red)** matches the word **red** and **ordered** but not any word that contains all three of those letters in another order (such as the word **order**). + +### Awk like sed with sub() and gsub() + +Awk features several functions that perform find-and-replace actions, much like the Unix command **sed**. These are functions, just like **print** and **printf**, and can be used in awk rules to replace strings with a new string, whether the new string is a string or a variable. + +The **sub** function substitutes the _first_ matched entity (in a record) with a replacement string. For example, if you have this rule in an awk script: + + +``` +{ sub(/apple/, "nut", $1); +    print $1 } +``` + +running it on the example file **colours.txt** produces this output: + + +``` +name +nut +banana +raspberry +strawberry +grape +nut +plum +kiwi +potato +pinenut +``` + +The reason both **apple** and **pineapple** were replaced with **nut** is that both are the first match of their records. If the records were different, then the results could differ: + + +``` +$ printf "apple apple\npineapple apple\n" | \ +awk -e 'sub(/apple/, "nut")' +nut apple +pinenut apple +``` + +The **gsub** command substitutes _all_ matching items: + + +``` +$ printf "apple apple\npineapple apple\n" | \ +awk -e 'gsub(/apple/, "nut")' +nut nut +pinenut nut +``` + +#### Gensub + +An even more complex version of these functions, called **gensub()**, is also available. + +The **gensub** function allows you to use the **&** character to recall the matched text. For example, if you have a file with the word **Awk** and you want to change it to **GNU Awk**, you could use this rule: + + +``` +`{ print gensub(/(Awk)/, "GNU &", 1) }` +``` + +This searches for the group of characters **Awk** and stores it in memory, represented by the special character **&**. Then it substitutes the string for **GNU &**, meaning **GNU Awk**. The **1** character at the end tells **gensub()** to replace the first occurrence. + + +``` +$ printf "Awk\nAwk is not Awkward" \ +| awk -e ' { print gensub(/(Awk)/, "GNU &",1) }' +GNU Awk +GNU Awk is not Awkward +``` + +### There's a time and a place + +Awk is a powerful tool, and regex are complex. You might think awk is so very powerful that it could easily replace **grep** and **sed** and **tr** and [**sort**][4] and many more, and in a sense, you'd be right. However, awk is just one tool in a toolbox that's overflowing with great options. You have a choice about what you use and when you use it, so don't feel that you have to use one tool for every job great and small. + +With that said, awk really _is_ a powerful tool with lots of great functions. The more you use it, the better you get to know it. Remember its capabilities, and fall back on it occasionally so can you get comfortable with it. + +Our next article will cover looping in Awk, so come back soon! + +* * * + +_This article is adapted from an episode of [Hacker Public Radio][5], a community technology podcast._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/how-regular-expressions-awk + +作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://opensource.com/article/19/10/intro-awk +[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[4]: https://opensource.com/article/19/10/get-sorted-sort +[5]: http://hackerpublicradio.org/eps.php?id=2129 From 469fe600657c685ee28725e9b379de65329c5e14 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 19 Nov 2019 01:08:23 +0800 Subject: [PATCH 522/800] add done: 20191118 How to use regular expressions in awk.md --- ...ternet security works- TLS, SSL, and CA.md | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 sources/tech/20191118 How internet security works- TLS, SSL, and CA.md diff --git a/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md b/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md new file mode 100644 index 0000000000..9746ca39d2 --- /dev/null +++ b/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How internet security works: TLS, SSL, and CA) +[#]: via: (https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +How internet security works: TLS, SSL, and CA +====== +What's behind that lock icon in your web browser? +![Lock][1] + +Multiple times every day, you visit websites that ask you to log in with your username or email address and password. Banking websites, social networking sites, email services, e-commerce sites, and news sites are just a handful of the types of sites that use this mechanism. + +Every time you sign into one of these sites, you are, in essence, saying, "yes, I trust this website, so I am willing to share my personal information with it." This data may include your name, gender, physical address, email address, and sometimes even credit card information. + +But how do you know you can trust a particular website? To put this a different way, what is the website doing to secure your transaction so that you can trust it? + +This article aims to demystify the mechanisms that make a website secure. I will start by discussing the web protocols HTTP and HTTPS and the concept of Transport Layer Security (TLS), which is one of the cryptographic protocols in the internet protocol's (IP) layers. Then, I will explain certificate authorities (CAs) and self-signed certificates and how they can help secure a website. Finally, I will introduce some open source tools you can use to create and manage certificates. + +## Securing routes through HTTPS + +The easiest way to understand a secured website is to see it in action. Fortunately, it is far easier to find a secured website than an unsecured website on the internet today. But, since you are already on Opensource.com, I'll use it as an example. No matter what browser you're using, you should see an icon that looks like a lock next to the address bar. Click on the lock icon, and you should see something similar to this. + +![Certificate information][2] + +By default, a website is not secure if it uses the HTTP protocol. Adding a certificate configured through the website host to the route can transform the website from an unsecured HTTP site to a secured HTTPS site. The lock icon usually indicates that the site is secured through HTTPS. + +Click on Certificate to see the site's CA. Depending on your browser, you may need to download the certificate to see it. + +![Certificate information][3] + +Here, you can learn something about Opensource.com's certificate. For example, you can see that the CA is DigiCert, and it is given to Red Hat under the name Opensource.com. + +This certificate information enables the end user to check that the website is safe to visit. + +> WARNING: If you do not see a certificate sign on a website—or if you see a sign that indicates that the website is not secure—please do not log in or do any activity that requires your private data. Doing so is quite dangerous! + +If you see a warning sign, which is rare for most publicly facing websites, it usually means that the certificate is expired or uses a self-signed certificate instead of one issued through a trusted CA. Before we get into those topics, I want to explain the TLS and SSL. + +## Internet protocols with TLS and SSL + +TLS is the current generation of the old Secure Socket Layer (SSL) protocol. The best way to understand this is by examining the different layers of the IP. + +![IP layers][4] + +There are six layers that make up the internet as we know it today: physical, data, network, transport, security, and application. The physical layer is the base foundation, and it is closest to the actual hardware. The application layer is the most abstract layer and the one closest to the end user. The security layer can be considered a part of the application layer, and TLS and SSL, which are the cryptographic protocols designed to provide communications security over a computer network, are in the security layer. + +This process ensures that communication is secure and encrypted when an end user consumes the service. + +## Certificate authorities and self-signed certificates + +A CA is a trusted organization that can issue a digital certificate. + +TLS and SSL can make a connection secure, but the encryption mechanism needs a way to validate it; this is the SSL/TLS certificate. TLS uses a mechanism called asymmetric encryption, which i \ No newline at end of file From 64dfa786e2e0be8c24693cd30a722f4a060c846c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 19 Nov 2019 01:32:40 +0800 Subject: [PATCH 523/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191118=20Creati?= =?UTF-8?q?ng=20a=20Chat=20Bot=20with=20Recast.AI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191118 Creating a Chat Bot with Recast.AI.md --- ...1118 Creating a Chat Bot with Recast.AI.md | 181 ++++++++++++++++++ 1 file changed, 181 insertions(+) create mode 100644 sources/tech/20191118 Creating a Chat Bot with Recast.AI.md diff --git a/sources/tech/20191118 Creating a Chat Bot with Recast.AI.md b/sources/tech/20191118 Creating a Chat Bot with Recast.AI.md new file mode 100644 index 0000000000..0b86e74c72 --- /dev/null +++ b/sources/tech/20191118 Creating a Chat Bot with Recast.AI.md @@ -0,0 +1,181 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Creating a Chat Bot with Recast.AI) +[#]: via: (https://opensourceforu.com/2019/11/creating-a-chat-bot-with-recast-ai/) +[#]: author: (Athira Lekshmi C.V https://opensourceforu.com/author/athira-lekshmi/) + +Creating a Chat Bot with Recast.AI +====== + +[![][1]][2] + +_According to a Gartner report from February 2018, “25 per cent of customer service and support operations will integrate virtual customer assistant (VCA) or chatbot technology across engagement channels by 2020, up from less than 2 per cent in 2017.” In the light of this, readers will find this tutorial on how the open source Recast. AI bot-creating platform works, helpful._ + +Chat bots, both voice based and others, have been in use for quite a while now. From chatbots that engage the user in a murder mystery game to bots which help in real estate deals and medical diagnosis, chatbots have traversed across domains. + +There are many platforms which enable users to create and deploy bots. Recast.AI (now known as SAP Conversational AI after its acquisition by SAP) is a forerunner amongst these. + +The cool interface, its collaborative nature and the analytics tools it provides, make it a popular choice. +As the Recast official site says, “It is an ultimate collaborative platform to build, train, deploy and monitor intelligent bots.” + +![Figure 1: Setting the bot properties][3] + +![Figure 2: Bot dashboard][4] + +![Figure 3: Searching an intent][5] + +**Building a basic bot in Recast** +Let us look at how to build a basic bot in Recast. + + 1. Create an account in __. Signing up can be done either with an email ID or with a GitHub account. + 2. Once you log in, you will land on the dashboard. Click on the + New Bot icon on the top right-hand side to create a new bot. + 3. On the next screen, you will see that there is a set of predefined skills you can select. Select Greetings for the time being (Figure 1). This bot is already trained to understand basic greetings. + 4. Provide a name for your bot. For now, since this is a very basic bot, you can have the bot crack some jokes, so let us name it Joke Bot and select the default language as English. + 5. Select Non-personal data under the data policy since you won’t be dealing with any sensitive information; then select the Public bot option and click on Create a bot. + + + +So that’s your bot created on the Recast platform. + +![Figure 4: @joke intent][6] + +![Figure 5: Predefined expressions][7] + +**The five stages of developing a bot** +To use the words from the official Recast blog, there are five stages in a bot’s life. + + * Training – Teaching your bot what it needs to understand + * Building – Creating your conversational flow with the Bot Builder tool + * Coding – Connecting your bot with external APIs or a database + * Connecting – Shipping your bot to one or several messaging platforms + * Monitoring – Training your bot to make it sharper and get insights on its usage + + + +**Training a bot through intents** +You will be able to see the options to either search, fork or create an intent in the dashboard. +“An intent is a box of expressions that mean the same thing but which are constructed in different ways. Intents are the heart of your bot’s understanding. Each one of your intents represents an idea your bot is able to understand.” (from the _Recast.AI_ website) +As decided earlier, you need the bot to be able to crack jokes. So the base line is that the bot should be able to understand that the user is asking it to tell a joke; it shouldn’t be that even when the user just says, “Hi,” the bot responds with a joke – that would not be good. +So group the utterances that the user might make, like: + +``` +Tell me a joke. +Tell me a funny fact. +Can you crack a joke? +What’s funny today? +``` + +………………… + +Before going on to create the intent from scratch, let us explore the Search/fork option. Type _Joke_ in the search field (Figure 3). This gives a list of intents created by users of Recast around the globe, which is public, and this is why Recast is said to be collaborative in nature. So there’s no need to create all intents from scratch, one can build upon intents already created. This brings down the effort needed to train the bot with common intents. + + * Select the first intent in the list and fork it into the bot. + * Click on the Fork button. The intent is now added to the bot (Figure 4). + * Click on the intent @joke, and a list of expressions which already exist in the intent will be displayed (Figure 5). + * Add a few more expressions to it (Figure 6). + + + +![Figure 6: Suggested expressions][8] + +![Figure 7: Suggested expressions][9] + +Once a few expressions are added, the bot gives suggestions like shown in Figure 7. Select a few and add them to the intent (Figure 7). +You can also tag your own custom entities to detect keywords, depending on your bot’s context. + +**Skills** +A skill is a block of conversation that has a clear purpose and that your bot can execute to achieve a goal. It can be as simple as the ability to greet someone, but it can also be more complex, like giving movie suggestions based on information provided by the user. + +It need not be just a one query-answer set, but rather, skills running through multiple exchanges. For example, consider a bot which helps you learn about currency exchange rates. It starts by asking the source currency, then the target currency, before giving the exact response. Skills can be combined to create complex conversational flows. +Here’s how you create a skill for the joke bot: + + * Go to the _Build_ tab. Click on the + icon to create a skill. + * Name the skill _Joke_ (Figure 8) + * Once created, click on the skill. You will see four tabs. _Read me, Triggers, Requirements and Actions_. + * Navigate to the Requirements tab. You should store the information only if the intent joke is present. So, add a requirement as shown in Figure 9. + + + +![Figure 8: Skills dashboard][10] + +![Figure 9: Adding a trigger][11] + +Since this is a simple use case, you needn’t consider any specific requirements in the Requirement tab but consider a case for which a response needs to be triggered only if certain keywords or entities are present – in such a case you will need ‘requirements’. + +Requirements are either intents or entities that your skill needs to retrieve before executing actions. Requirements are pieces of information that are important in the conversation and that your bot can use; for example, the user’s name or a location. Once a requirement is completed, the associated value is stored in the bot’s memory for the entire conversation. + +Now let us move to the Action tab to set the responses (see Figure 10). +Click on Add _new message group_. Then select _Send message_ and add a text message, which can be any joke in this case. Also, since you don’t want your bot to crack the same joke each time, you can add multiple messages which will be randomly picked each time. + +![Figure 10: Adding actions][12] + +![Figure 11: Adding text messages][13] + +![Figure 12: Setting up webchat][14] + +**Channel integrations** +Well, the success of a bot also depends upon how easily it is accessible. Recast has built-in integrations with many messaging channels such as Skype for Business, Kik Messenger, Telegram, Line, Facebook Messenger, Slack, Alexa, etc. In addition to that, Recast also provides SDKs to develop custom channels. + +Also, there is a ready-to-use Web chat provided by Recast (in the Connect tab). You can customise the colour schemes, headers, bot pictures, etc. It provides you with a script tag to be injected into the page. Your interface is now up (Figure 12). + +The Web chat code base is open sourced, which makes it easier for developers to play around with the look and feel, the standard response types and much more. +The dashboard provides step-by-step procedures on how to deploy the bot on various channels. The joke bot was deployed in Telegram and in Web chat, as shown in Figure 13. + +![Figure 13: Webchat deployed][15] + +![Figure 14: Bot deployed in Telegram][16] + +![Figure 15: Multi-language bot][17] + +**And there is more** +Recast supports multiple languages, Select one language as the base while creating the bot, but then you also have the option to add as many languages as you want. + +The example considered here is a simple static joke bot, but actual use cases will need interaction with various systems. Recast has a Web hook feature which allows users to connect with various systems to get responses. Also, there is detailed API documentation to help leverage each independent feature of the platform. + +As for analytics, Recast has a monitoring dashboard which helps you understand the accuracy of the bot and train it further. + +![Avatar][18] + +[Athira Lekshmi C.V][19] + +The author is an open-source enthusiast. + +[![][20]][21] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/creating-a-chat-bot-with-recast-ai/ + +作者:[Athira Lekshmi C.V][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/athira-lekshmi/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/04/Build-ChatBoat.jpg?resize=696%2C442&ssl=1 (Build ChatBoat) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/04/Build-ChatBoat.jpg?fit=900%2C572&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Setting-the-bot-properties.jpg?resize=350%2C201&ssl=1 +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-Setting-the-bot-properties.jpg?resize=350%2C217&ssl=1 +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-Searching-an-intent.jpg?resize=350%2C271&ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-@joke-intent.jpg?resize=350%2C214&ssl=1 +[7]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-5-Predefined-expressions-350x227.jpg?resize=350%2C227&ssl=1 +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-6-Suggested-expressions-350x197.jpg?resize=350%2C197&ssl=1 +[9]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-7-Suggested-expressions-350x248.jpg?resize=350%2C248&ssl=1 +[10]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-8-Skills-dashboard.jpg?resize=350%2C187&ssl=1 +[11]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-9-Adding-a-trigger.jpg?resize=350%2C197&ssl=1 +[12]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-10-Adding-actions.jpg?resize=350%2C175&ssl=1 +[13]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-11-Adding-text-messages.jpg?resize=350%2C255&ssl=1 +[14]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-12-Setting-up-webchat.jpg?resize=350%2C326&ssl=1 +[15]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-13-Webchat-deployed.jpg?resize=350%2C425&ssl=1 +[16]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-14-Bot-deployed-in-Telegram.jpg?resize=350%2C269&ssl=1 +[17]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-15-Multi-language-bot.jpg?resize=350%2C419&ssl=1 +[18]: https://secure.gravatar.com/avatar/d24503a2a0bb8bd9eefe502587d67323?s=100&r=g +[19]: https://opensourceforu.com/author/athira-lekshmi/ +[20]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[21]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From c2e845a7ea5e94857cc3a1f0128fac6f56c451f4 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 19 Nov 2019 08:52:10 +0800 Subject: [PATCH 524/800] translated --- ...nfigure Postfix Mail Server on CentOS 8.md | 124 +++++++++--------- 1 file changed, 62 insertions(+), 62 deletions(-) rename {sources => translated}/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md (52%) diff --git a/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md b/translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md similarity index 52% rename from sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md rename to translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md index 45d55b4908..66452903ae 100644 --- a/sources/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md +++ b/translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md @@ -7,56 +7,56 @@ [#]: via: (https://www.linuxtechi.com/install-configure-postfix-mailserver-centos-8/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) -How to install and Configure Postfix Mail Server on CentOS 8 +如何在 CentOS 8 上安装和配置 Postfix 邮件服务器 ====== -**Postfix** is a free and opensource **MTA** (Mail Transfer Agent) used for routing or delivering emails on a Linux system. In this guide, you will learn how to install and configure Postfix on CentOS 8. +**Postfix** 是一个免费的开源 **MTA**(邮件传输代理),用于在 Linux 系统上路由或传递电子邮件。在本指南中,你将学习如何在 CentOS 8 上安装和配置 Postfix。 [![Install-configure-Postfx-Server-CentOS8][1]][2] -Lab set up: +实验室设置: - * OS :                  CentOS 8 server - * IP Address :   192.168.1.13 - * Hostname:     server1.crazytechgeek.info (Ensure the domain name is pointed to the server’s IP) + * 系统:CentOS 8 服务器 + * IP 地址:192.168.1.13 + * 主机名:server1.crazytechgeek.info(确保域名指向服务器的 IP) -### Step 1) Update the system +### 步骤 1)更新系统 -The first step is to ensure that the system packages are up to date. To do so, update the system as follows: +第一步是确保系统软件包是最新的。为此,请按如下所示更新系统: ``` # dnf update ``` -Before proceeding further, also ensure that no other **MTAs** such as **Sendmail** are existing as this will cause conflict with Postfix configuration. To remove Sendmail, for example, run the command: +继续之前,还请确保不存在其他 **MTA**(如 **Sendmail**),因为这将导致与 Postfix 配置冲突。例如,要删除 Sendmail,请运行以下命令: ``` # dnf remove sendmail ``` -### Step 2)  Set Hostname and update /etc/hosts file +### 步骤 2)设置主机名并更新 /etc/hosts -Use below hostnamectl command to set the hostname on your system, +使用下面的 hostnamectl 命令在系统上设置主机名, ``` # hostnamectl set-hostname server1.crazytechgeek.info # exec bash ``` -Additionally, you need to add the system’s hostname and IP entries in the /etc/hosts file +此外,你需要在 /etc/hosts 中添加系统的主机名和 IP。 ``` # vim /etc/hosts 192.168.1.13 server1.crazytechgeek.info ``` -Save and exit the file. +保存并退出文件。 -### Step 3) Install Postfix Mail Server +### 步骤 3)安装 Postfix 邮件服务器 -After verifying that no other MTA is running on the system install Postfix by executing the command: +验证系统上没有其他 MTA 在运行后,运行以下命令安装 Postfix: ``` # dnf install postfix @@ -64,16 +64,16 @@ After verifying that no other MTA is running on the system install Postfix by ex [![Install-Postfix-Centos8][1]][3] -### Step 4) Start and enable Postfix Service +### 步骤 4)启动并启用 Postfix 服务 -Upon successful installation of Postfix, start and enable Postfix service by running: +成功安装 Postfix 后,运行以下命令启动并启用 Postfix 服务: ``` # systemctl start postfix # systemctl enable postfix ``` -To check Postfix status, run the following systemctl command +要检查 Postfix 状态,请运行以下 systemctl 命令 ``` # systemctl status postfix @@ -81,11 +81,11 @@ To check Postfix status, run the following systemctl command ![Start-Postfix-check-status-centos8][1] -Great, we have verified that Postfix is up and running. Next, we are going to configure Postfix to send emails locally to our server. +太好了,我们已经验证了 Postfix 已启动并正在运行。接下来,我们将配置 Postfix 从本地发送邮件到我们的服务器。 -### Step 5) Install mailx email client +### 步骤 5)安装 mailx 邮件客户端 -Before configuring the Postfix server, we need to install mailx feature, To install mailx, run the command: +在配置 Postfix 服务器之前,我们需要安装 mailx,要安装它,请运行以下命令: ``` # dnf install mailx @@ -93,64 +93,64 @@ Before configuring the Postfix server, we need to install mailx feature, To inst ![Install-Mailx-CentOS8][1] -### Step 6)  Configure Postfix Mail Server +### 步骤 6)配置 Postfix 邮件服务器 -Postfix’s configuration file is located in **/etc/postfix/main.cf**. We need to make a few changes in the configuration file, so open it using your favorite text editor. +Postfix 的配置文件位于 **/etc/postfix/main.cf** 中。我们需要对配置文件进行一些修改,因此请使用你喜欢的文本编辑器将其打开。 ``` # vi /etc/postfix/main.cf ``` -Make changes to the following lines: +更改以下几行: ``` myhostname = server1.crazytechgeek.info mydomain = crazytechgeek.info myorigin = $mydomain -## Uncomment and Set inet_interfaces to all ## +## 取消注释并将 inet_interfaces 设置为 all## inet_interfaces = all -## Change to all ## +## 更改为 all ## inet_protocols = all -## Comment ## +## 注释 ## #mydestination = $myhostname, localhost.$mydomain, localhost -##- Uncomment ## +## 取消注释 ## mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain -## Uncomment and add IP range ## +## 取消注释并添加 IP 范围 ## mynetworks = 192.168.1.0/24, 127.0.0.0/8 -## Uncomment ## +## 取消注释 ## home_mailbox = Maildir/ ``` -Once done, save and exit the configuration file. Restart postfix  service for the changes to take effect +完成后,保存并退出配置文件。重新启动 postfix 服务以使更改生效。 ``` # systemctl restart postfix ``` -### Step 7) Testing  Postfix Mail Server +### 步骤 7)测试 Postfix 邮件服务器 -Test whether our configuration is working, first, create a test user +测试我们的配置是否有效,首先,创建一个测试用户。 ``` # useradd postfixuser # passwd postfixuser ``` -Next, run the command below to send email from **pkumar** local user to another user ‘**postfixuser**‘ +接下来,运行以下命令,从本地用户 **pkumar** 发送邮件到另一个用户 “**postfixuser**”。 ``` # telnet localhost smtp -or +或者 # telnet localhost 25 ``` -If telnet service is not installed, you can install it using the command: +如果未安装 telnet 服务,那么可以使用以下命令进行安装: ``` # dnf install telnet -y ``` -When you run the command as earlier indicated, you should get the output as shown +如前所述运行命令时,应获得如下输出: ``` [root@linuxtechi ~]# telnet localhost 25 @@ -160,13 +160,13 @@ Escape character is '^]'. 220 server1.crazytechgeek.info ESMTP Postfix ``` -Above confirm that connectivity to postfix mail server is working fine. Next, type the command: +上面的结果确认与 postfix 邮件服务器的连接正常。接下来,输入命令: ``` # ehlo localhost ``` -Output will be something like this +输出看上去像这样: ``` 250-server1.crazytechgeek.info @@ -181,7 +181,7 @@ Output will be something like this 250 SMTPUTF8 ``` -Next, run the commands highlighted in orange, like “mail from”, “rcpt to”, data and then finally type quit, +接下来,运行橙色高亮的命令,例如 “mail from”、“rcpt to”,“data”,最后输入 “quit”, ``` mail from: @@ -198,11 +198,11 @@ quit Connection closed by foreign host ``` -Complete telnet command to send email from local user “**pkumar**” to another local user “**postfixuser**” would be something like below +完成 telnet 命令可从本地用户 “**pkumar**” 发送邮件到另一个本地用户 “**postfixuser**”,如下所示: ![Send-email-with-telnet-centos8][1] -If everything went according to plan, you should be able to view the email sent at the new user’s home directory. +如果一切都按计划进行,那么你应该可以在新用户的家目录中查看发送的邮件。 ``` # ls /home/postfixuser/Maildir/new @@ -210,7 +210,7 @@ If everything went according to plan, you should be able to view the email sent # ``` -To read the email, simply use the cat command as follows: +要阅读邮件,只需使用 cat 命令,如下所示: ``` # cat /home/postfixuser/Maildir/new/1573580091.Vfd02I20050b8M635437.server1.crazytechgeek.info @@ -218,9 +218,9 @@ To read the email, simply use the cat command as follows: ![Read-postfix-email-linux][1] -### Postfix mail server logs +### Postfix 邮件服务器日志 -Postfix mail server mail logs are stored in the file “**/var/log/maillog**“, use below command to view the live logs, +Postfix 邮件服务器邮件日志保存在文件 “**/var/log/maillog**” 中,使用以下命令查看实时日志, ``` # tail -f /var/log/maillog @@ -228,17 +228,17 @@ Postfix mail server mail logs are stored in the file “**/var/log/maillog**“, ![postfix-maillogs-centos8][1] -### Securing Postfix Mail Server +### 保护 Postfix 邮件服务器 -It is always recommended secure the communication of between clients and postfix server, this can be achieved using SSL certificates, these certificates can be either from trusted authority or Self Signed Certificates. In this tutorial we will generate Self Signed certificated for postfix using **openssl** command, +建议始终确保客户端和 postfix 服务器之间的通信安全,这可以使用 SSL 证书来实现,它们可以来自受信任的权威机构或自签名证书。在本教程中,我们将使用 **openssl** 命令生成用于 postfix 的自签名证书, -I am assuming openssl is already installed on your system, in case it is not installed then use following dnf command, +我假设 openssl 已经安装在你的系统上,如果未安装,请使用以下 dnf 命令, ``` # dnf install openssl -y ``` -Generate Private key and CSR (Certificate Signing Request) using beneath openssl command, +使用下面的 openssl 命令生成私钥和 CSR(证书签名请求), ``` # openssl req -nodes -newkey rsa:2048 -keyout mail.key -out mail.csr @@ -246,7 +246,7 @@ Generate Private key and CSR (Certificate Signing Request) using beneath openssl ![Postfix-Key-CSR-CentOS8][1] -Now Generate Self signed certificate using following openssl command, +现在,使用以下 openssl 命令生成自签名证书, ``` # openssl x509 -req -days 365 -in mail.csr -signkey mail.key -out mail.crt @@ -256,13 +256,13 @@ Getting Private key # ``` -Now copy private key and certificate file to /etc/postfix directory +现在将私钥和证书文件复制到 /etc/postfix 目录下。 ``` # cp mail.key mail.crt /etc/postfix ``` -Update Private key and Certificate file’s path in postfix configuration file, +在 postfix 配置文件中更新私钥和证书文件的路径 ``` # vi /etc/postfix/main.cf @@ -274,21 +274,21 @@ smtpd_tls_security_level = may ……… ``` -Restart postfix service to make above changes into the effect. +重启 postfix 服务以使上述更改生效。 ``` # systemctl restart postfix ``` -Let’s try to send email to internal local domain and external domain using mailx client. +让我们尝试使用 mailx 客户端将邮件发送到内部本地域和外部域。 -**Sending local internal email from pkumar user to postfixuser** +**从 pkumar 发送内部本地邮件到 postfixuser 中** ``` # echo "test email" | mailx -s "Test email from Postfix MailServer" -r root@linuxtechi root@linuxtechi ``` -Check and read the email using the following, +使用以下命令检查并阅读邮件, ``` # cd /home/postfixuser/Maildir/new/ @@ -301,17 +301,17 @@ total 8 ![Read-Postfixuser-Email-CentOS8][1] -**Sending email from postfixuser to external domain ( [root@linuxtechi][4])** +**从 postfixuser 发送邮件到外部域 (( [root@linuxtechi][4]))** ``` # echo "External Test email" | mailx -s "Postfix MailServer" -r root@linuxtechi root@linuxtechi ``` -**Note:** If Your IP is not blacklisted anywhere then your email to external domain will be delivered otherwise it will be bounced saying that IP is blacklisted in so and so spamhaus database. +**注意:** 如果你的 IP 没有被任何地方列入黑名单,那么你发送到外部域的邮件将被发送,否则它将被退回,并提示你的 IP 被 spamhaus 之类的数据库列入黑名单。 -### Check Postfix mail queue +### 检查 Postfix 邮件队列 -Use mailq command to list mails which are in queue. +使用mailq命令列出队列中的邮件。 ``` # mailq @@ -319,7 +319,7 @@ Mail queue is empty # ``` -And that’s it! Our Postfix configuration is working! That’s all for now. We hope you found this tutorial insightful and that you can comfortably set up your local Postfix server. +完成!我们的 Postfix 配置正常工作了!目前就这样了。我们希望你觉得本教程有见地,并且你可以轻松地设置本地 Postfix 服务器。 * [Facebook][5] * [Twitter][6] @@ -334,7 +334,7 @@ via: https://www.linuxtechi.com/install-configure-postfix-mailserver-centos-8/ 作者:[James Kiarie][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 c5568b2ff18f9a8ebb2f7623c8512c2428f23af5 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 19 Nov 2019 08:55:38 +0800 Subject: [PATCH 525/800] translating --- ...0191115 Developing a Simple Web Application Using Flutter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md b/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md index 2ea37221c9..677ed567ee 100644 --- a/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md +++ b/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 15fabb629eff3dfaf139bf12e9e440b7fdc35859 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 Nov 2019 09:33:11 +0800 Subject: [PATCH 526/800] PUB @MjSeven https://linux.cn/article-11590-1.html --- ...fix common pitfalls with the Python ORM tool SQLAlchemy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md (99%) diff --git a/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md b/published/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md similarity index 99% rename from translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md rename to published/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md index ccbbdbde61..b7f51e093b 100644 --- a/translated/tech/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md +++ b/published/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (MjSeven) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11590-1.html) [#]: subject: (How to fix common pitfalls with the Python ORM tool SQLAlchemy) [#]: via: (https://opensource.com/article/19/9/common-pitfalls-python) [#]: author: (Zach Todd https://opensource.com/users/zchtoddhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/liranhaimovitchhttps://opensource.com/users/moshez) From 1b5cd022901a7e7bf62034af060bff5803630d32 Mon Sep 17 00:00:00 2001 From: runningwater Date: Tue, 19 Nov 2019 09:44:35 +0800 Subject: [PATCH 527/800] =?UTF-8?q?=E7=94=B3=E9=A2=86=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/tech/20191007 Using the Java Persistence API.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191007 Using the Java Persistence API.md b/sources/tech/20191007 Using the Java Persistence API.md index e911428044..6b16213fc1 100644 --- a/sources/tech/20191007 Using the Java Persistence API.md +++ b/sources/tech/20191007 Using the Java Persistence API.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (runningwater) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -255,7 +255,7 @@ via: https://opensource.com/article/19/10/using-java-persistence-api 作者:[Stephon Brown][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 31d116cd5707181c74d2062afa7a05cece80f763 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 Nov 2019 10:21:28 +0800 Subject: [PATCH 528/800] PRF --- ...et Linux command to recover lost images.md | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/translated/tech/20191025 How I used the wget Linux command to recover lost images.md b/translated/tech/20191025 How I used the wget Linux command to recover lost images.md index c7c33f1666..df3e6e014b 100644 --- a/translated/tech/20191025 How I used the wget Linux command to recover lost images.md +++ b/translated/tech/20191025 How I used the wget Linux command to recover lost images.md @@ -1,36 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How I used the wget Linux command to recover lost images) [#]: via: (https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -我是如何使用 wget 命令恢复丢失的图像的 +丢失的开放剪贴画库和新的公共艺术品图书馆 FreeSVG.org 的诞生 ====== > 开放剪贴画库兴衰的故事以及一个新的公共艺术品图书馆 FreeSVG.org 的诞生。 -![White shoes on top of an orange tribal pattern][1] +![](https://img.linux.net.cn/data/attachment/album/201911/19/102040imbybpl32vgdibbm.jpg) -开放剪贴画库Open Clip Art Library(OCAL)发布于 2004 年,成为了免费插图的来源,任何人都可以出于任何目的使用它们,而无需注明出处或提供任何回报。针对 1990 年代每个家庭办公室书架上的大量剪贴画 CD 以及由闭源公司和艺术品软件提供的艺术品转储,这个网站是开源世界的答复。 +开放剪贴画库Open Clip Art Library(OCAL)发布于 2004 年,成为了免费插图的来源,任何人都可以出于任何目的使用它们,而无需注明出处或提供任何回报。针对 1990 年代每个家庭办公室书架上的大量剪贴画 CD 以及由闭源公司和艺术品软件提供的艺术品转储,这个网站是开源世界的回应。 -最初,这个剪贴画库主要由一些贡献者组成,但是在 2010 年,它重新打造成了一个全新的交互式网站,可以让任何人使用矢量插图应用程序创建和贡献剪贴画。该网站立即获得了来自全球的、各种形式的自由软件和自由文化项目的贡献。[Inkscape][2] 中甚至包含了该库的专用导入器。 +最初,这个剪贴画库主要由一些贡献者提供,但是在 2010 年,它重新打造成了一个全新的交互式网站,可以让任何人使用矢量插图应用程序创建和贡献剪贴画。该网站立即获得了来自全球的、各种形式的自由软件和自由文化项目的贡献。[Inkscape][2] 中甚至包含了该库的专用导入器。 -但是,在 2019 年初,托管开放剪贴画库的网站离线,没有任何警告或解释。它已经成长为有着成千上万的人的社区,起初以为这是暂时的故障。 但是,这个站点一直离线已超过六个月,而没有任何清楚的解释。 +但是,在 2019 年初,托管开放剪贴画库的网站离线了,没有任何警告或解释。它已经成长为有着成千上万的人的社区,起初以为这是暂时的故障。但是,这个网站一直离线已超过六个月,而没有任何清楚的解释。 -谣言开始膨胀。该网站正在更新中(“要偿还数年的技术债务”,网站开发者 Jon Philips 在一封电子邮件中说)。一个 Twitter 帐户声称,该网站遭受了猖狂的 DDoS 攻击。另一个 Twitter 帐户声称,该网站维护者已经成为身份盗用的牺牲品。今天,在撰写本文时,该网站的一个且唯一的页面声明它处于“维护和保护模式”,其含义不清楚,只是用户无法访问其内容。 +谣言开始膨胀。该网站一直在更新中(“要偿还数年的技术债务”,网站开发者 Jon Philips 在一封电子邮件中说)。一个 Twitter 帐户声称,该网站遭受了猖狂的 DDoS 攻击。另一个 Twitter 帐户声称,该网站维护者已经成为身份盗用的牺牲品。今天,在撰写本文时,该网站的一个且唯一的页面声明它处于“维护和保护模式”,其含义不清楚,只是用户无法访问其内容。 ### 恢复公地 -网站会随着时间的流逝而消失,但是对其社区而言开放剪贴画库的丢失尤其令人惊讶,因为它被视为一个社区项目。很少有社区成员知道托管该库的站点已经落入一个维护者手中,因此,由于 [CC0 许可证][3],该库中的艺术品归所有人所有,但对它的访问是功能性的由单个维护者执行。而且,由于该站点的社区通过该站点彼此保持联系,因此该维护者实际上拥有该社区。 +网站会随着时间的流逝而消失,但是对其社区而言,开放剪贴画库的丢失尤其令人惊讶,因为它被视为一个社区项目。很少有社区成员知道托管该库的网站已经落入单个维护者手中,因此,由于 [CC0 许可证][3],该库中的艺术品归所有人所有,但对它的访问是由单个维护者功能性拥有的。而且,由于该社区通过网站彼此保持联系,因此该维护者实际上拥有该社区。 -当站点发生故障时,社区以及彼此之间都无法访问其艺术品。没有该站点,就没有社区。 +当网站发生故障时,社区以及成员彼此之间都无法访问剪贴画。没有该网站,就没有社区。 -最初,该网站离线后其上的所有东西都是被封挡的。不过,在几个月之后,用户开始意识到该网站的数据库仍然在线,这意味着用户能够通过输入精确的 URL 访问单个剪贴画。换句话说,你不能通过在网站上到处点击来流量剪贴画文件,但是如果你知道该地址,你就可以在浏览器中访问它。类似的,技术型(或偷懒的)用户意识到能够通过类似 `wget` 的自动 Web 浏览器将网站“抓取”下来。 +最初,该网站离线后其上的所有东西都是被封锁的。不过,在几个月之后,用户开始意识到该网站的数据仍然在线,这意味着用户能够通过输入精确的 URL 访问单个剪贴画。换句话说,你不能通过在网站上到处点击来浏览剪贴画文件,但是如果你确切地知道该地址,你就可以在浏览器中访问它。类似的,技术型(或偷懒的)用户意识到能够通过类似 `wget` 的自动 Web 浏览器将网站“抓取”下来。 -Linux 的 `wget` 命令技术上是一个 Web 浏览器,虽然它不能让你像用 Firefox 一样交互式地浏览。相反,`wget` 可以连到互联网,获取文件或文件集,并下载到你的本次硬盘。然后,你可以在 Firefox 或文本编辑器或最合适的应用程序中打开这些文件,然后查看内容。 +Linux 的 `wget` 命令从技术上来说是一个 Web 浏览器,虽然它不能让你像用 Firefox 一样交互式地浏览。相反,`wget` 可以连到互联网,获取文件或文件集,并下载到你的本次硬盘。然后,你可以在 Firefox、文本编辑器或最合适的应用程序中打开这些文件,查看内容。 通常,`wget` 需要知道要提取的特定文件。如果你使用的是安装了 `wget` 的 Linux 或 macOS,则可以通过下载 [example.com][4] 的索引页来尝试此过程: @@ -47,25 +47,25 @@ $ tail index.html ``` -为了抓取 OCAL,我使用了 `--mirror` 选项,以便可以只是将 `wget` 指向到包含艺术品的目录,就可以下载该目录中的所有内容。此操作导致连续四天(96 个小时)持续下载,最终得到了超过 50000 个社区成员贡献的 100,000 个 SVG 文件。不幸的是,任何没有适当元数据的文件的作者信息都是无法恢复的,因为此信息被锁定在数据库中不可访问的文件中,但是 CC0 许可证意味着此问题*在技术上*无关紧要(因为 CC0 文件不需要属性)。 +为了抓取 OCAL,我使用了 `--mirror` 选项,以便可以只是将 `wget` 指向到包含剪贴画的目录,就可以下载该目录中的所有内容。此操作持续下载了连续四天(96 个小时),最终得到了超过 50,000 个社区成员贡献的 100,000 个 SVG 文件。不幸的是,任何没有适当元数据的文件的作者信息都是无法恢复的,因为此信息被锁定在该数据库中不可访问的文件中,但是 CC0 许可证意味着此问题*在技术上*无关紧要(因为 CC0 文件不需要归属)。 -随意分析了一下下载的文件进行还显示,其中近 45,000 个文件是同一文件(该网站的徽标)的副本。这是由于指向该站点徽标的重定向(原因未知)引起的,仔细分析能够提取到原始的文件。又过了 96 个小时,并且恢复了直到最后一天发布在 OCAL 上的所有剪贴画:总共约有 156,000 张图像。 +随意分析了一下下载的文件进行还显示,其中近 45,000 个文件是同一个文件(该网站的徽标)的副本。这是由于指向该网站徽标的重定向引起的(原因未知),仔细分析能够提取到原始的文件,又过了 96 个小时,并且恢复了直到最后一天发布在 OCAL 上的所有剪贴画:总共约有 156,000 张图像。 -SVG 文件通常很小,但这仍然是大量工作,并且会带来一些非常实际的问题。首先,将需要数 GB 的在线存储空间,这样这些剪贴画才能供其先前的社区使用。其次,必须使用一种搜索艺术品的方法,因为手动浏览 55,000 个文件是不现实的。 +SVG 文件通常很小,但这仍然是大量工作,并且会带来一些非常实际的问题。首先,将需要数 GB 的在线存储空间,这样这些剪贴画才能供其先前的社区使用。其次,必须使用一种搜索剪贴画的方法,因为手动浏览 55,000 个文件是不现实的。 很明显,社区真正需要的是一个平台。 ### 构建新的平台 -一段时间以来,[公共领域矢量图][6] 网站一直在发布公共领域的矢量图。虽然它仍然是一个受欢迎的网站,但是开源用户经常将其仅用作辅助的图片资源,因为其中大多数文件都是 EPS 和 AI 格式的,两者均与 Adobe 相关。两种文件格式通常都可以转换为 SVG,但是特性有所损失。 +一段时间以来,[公共领域矢量图][6] 网站一直在发布公共领域的矢量图。虽然它仍然是一个受欢迎的网站,但是开源用户通常只是将其用作辅助的图片资源,因为其中大多数文件都是 EPS 和 AI 格式的,这两者均与 Adobe 相关。这两种文件格式通常都可以转换为 SVG,但是特性会有所损失。 -当公共领域矢量图网站的维护者(Vedran 和 Boris)得知 OCAL 丢失时,他们决定创建一个面向开源社区的网站。诚然,他们选择了开源 [Laravel][7] 框架作为后端,该框架为网站提供了管理控制台和用户访问权限。该框架功能强大且开发完善,还使他们能够快速响应错误报告和功能请求,并根据需要升级站点。他们正在建立的站点称为 [FreeSVG.org][8],已经是一个强大而繁荣的公共艺术品图书馆。 +当公共领域矢量图网站的维护者(Vedran 和 Boris)得知 OCAL 丢失时,他们决定创建一个面向开源社区的网站。诚然,他们选择了开源 [Laravel][7] 框架作为后端,该框架为网站提供了管理控制台和用户访问权限。该框架功能强大且开发完善,还使他们能够快速响应错误报告和功能请求,并根据需要升级网站。他们正在建立的网站称为 [FreeSVG.org][8],已经是一个强大而繁荣的公共艺术品图书馆。 -从那时起,他们就一直从 OCAL 上载所有剪贴画,并且他们甚至在努力地对艺术品进行标记和分类。作为公共领域矢量图网站的创建者,他们还以 SVG 格式贡献了自己的图像。他们的目标是成为互联网上具有 CC0 许可证的 SVG 图像的主要资源。 +从那时起,他们就一直从 OCAL 上载所有剪贴画,并且他们甚至在努力地对这些剪贴画进行标记和分类。作为公共领域矢量图网站的创建者,他们还以 SVG 格式贡献了自己的图像。他们的目标是成为互联网上具有 CC0 许可证的 SVG 图像的主要资源。 ### 贡献 -[FreeSVG.org][8] 的维护者意识到他们已经继承了重要的管理权。他们正在努力对网站上的所有图像加上标题和描述,以便用户可以轻松找到这些艺术品,并在准备就绪后将其提供给社区,同时坚信与这些艺术品有关的元数据和艺术品属于创建和使用它们的人。他们还意识到可能会发生无法预料的情况,因此他们会定期为其网站和内容创建备份,并打算在其站点出现故障时向公众提供最新备份。 +[FreeSVG.org][8] 的维护者意识到他们已经继承了重要的管理权。他们正在努力对网站上的所有图像加上标题和描述,以便用户可以轻松找到这些剪贴画,并在准备就绪后将其提供给社区,同时坚信同这些剪贴画一样,与这些剪贴画有关的元数据属于创建和使用它们的人。他们还意识到可能会发生无法预料的情况,因此他们会定期为其网站和内容创建备份,并打算在其网站出现故障时向公众提供最新备份。 如果要为 [FreeSVG.org][9]的知识共享内容添砖加瓦,请下载 [Inkscape][10] 并开始绘制。世界上有很多公共领域的艺术品,例如[历史广告][11]、[塔罗牌][12]和[故事书][13],只是在等待转换为 SVG,因此即使你对自己的绘画技巧没有信心你也可以做出贡献。访问 [FreeSVG 论坛][14]与其他贡献者联系并支持他们。 @@ -73,7 +73,7 @@ SVG 文件通常很小,但这仍然是大量工作,并且会带来一些非 这是自由文化的力量:它不仅可以扩展,而且随着更多人的参与,它会变得更好。 -### 艰难的教训 +### 艰辛的教训 从 OCAL 的消亡到 FreeSVG.org 的兴起,开放文化社区已经吸取了一些艰辛的经验。对于以后,以下是我认为最重要的那些。 @@ -83,11 +83,11 @@ SVG 文件通常很小,但这仍然是大量工作,并且会带来一些非 #### 做个副本 -不要以为别人在做备份。如果你关心公用数字内容,请自己备份,否则不要指望永远提供它。 无论*任何上传到互联网上的内容是永久的*的说法是不是正确的,但这并不意味着你永远可以使用。如果 OCAL 文件不再隐秘地可用,那么任何人都不太可能成功地从网络上的某个位置或从全球范围内的人们的硬盘中成功地发现所有的 55,000 张图像。Make copies +不要以为别人在做备份。如果你关心公用数字内容,请自己备份,否则不要指望永远提供它。无论*任何上传到互联网上的内容是永久的*的说法是不是正确的,但这并不意味着你永远可以使用。如果 OCAL 文件不再暗地可用,那么任何人都不太可能成功地从网络上的某个位置或从全球范围内的人们的硬盘中成功地发现全部的 55,000 张图像。 #### 创建外部渠道 -如果一个社区是由单个网站或实际位置来定义的,那么该社区失去访问该空间的能力就如同解散了一样。如果你是由单个组织或网站驱动的社区的成员,则你应该自己与关心的人共享联系信息,并即使在该站点不可用时也可以建立沟通渠道。 +如果一个社区是由单个网站或实际位置来定义的,那么该社区失去访问该空间的能力就如同解散了一样。如果你是由单个组织或网站驱动的社区的成员,则你应该自己与关心的人共享联系信息,并即使在该网站不可用时也可以建立沟通渠道。 例如,[Opensource.com][16] 本身维护其作者和通讯者的邮件列表和其他异地渠道,以便在有或没有网站干预或甚至没有网站的情况下相互交流。 @@ -95,7 +95,7 @@ SVG 文件通常很小,但这仍然是大量工作,并且会带来一些非 互联网有时被视为懒人社交俱乐部。你可以在需要时登录并在感到疲倦时将其关闭,也可以漫步到所需的任何社交圈。 -但实际上,自由文化可能是项艰难的工作。但是这种艰难从某种意义上讲并不是说要成为其中的一部分很困难,而是你必须努力维护。如果你忽略你所在的社区,那么该社区可能会在你才会意识到之前就枯萎并褪色。 +但实际上,自由文化可能是项艰难的工作。但是这种艰难从某种意义上讲并不是说要成为其中的一分子很困难,而是你必须努力维护。如果你忽略你所在的社区,那么该社区可能会在你意识到之前就枯萎并褪色。 花点时间环顾四周,确定你属于哪个社区,如果不是,那么请告诉某人你对他们带给你生活的意义表示赞赏。同样重要的是,请记住,这样你也为社区的生活做出了贡献。 @@ -108,7 +108,7 @@ via: https://opensource.com/article/19/10/how-community-saved-artwork-creative-c 作者:[Seth Kenlon][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 b3359f9e2a34e7e10a40ce8e926b0e51323eb5a4 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 Nov 2019 10:22:05 +0800 Subject: [PATCH 529/800] PUB @wxy https://linux.cn/article-11592-1.html --- ...ow I used the wget Linux command to recover lost images.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191025 How I used the wget Linux command to recover lost images.md (99%) diff --git a/translated/tech/20191025 How I used the wget Linux command to recover lost images.md b/published/20191025 How I used the wget Linux command to recover lost images.md similarity index 99% rename from translated/tech/20191025 How I used the wget Linux command to recover lost images.md rename to published/20191025 How I used the wget Linux command to recover lost images.md index df3e6e014b..274a70fff2 100644 --- a/translated/tech/20191025 How I used the wget Linux command to recover lost images.md +++ b/published/20191025 How I used the wget Linux command to recover lost images.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11592-1.html) [#]: subject: (How I used the wget Linux command to recover lost images) [#]: via: (https://opensource.com/article/19/10/how-community-saved-artwork-creative-commons) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 39aebf96abffbfc1e2d3dc35b04e3dbbfd52de1b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 Nov 2019 15:08:12 +0800 Subject: [PATCH 530/800] APL --- .../tech/20191018 How to use Protobuf for data interchange.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191018 How to use Protobuf for data interchange.md b/sources/tech/20191018 How to use Protobuf for data interchange.md index 4de9e2120a..76cb47c5cd 100644 --- a/sources/tech/20191018 How to use Protobuf for data interchange.md +++ b/sources/tech/20191018 How to use Protobuf for data interchange.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f49c159b09c42ad55346619ebac5ff56eef10670 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 Nov 2019 22:25:21 +0800 Subject: [PATCH 531/800] TSL 1 --- ...ow to use Protobuf for data interchange.md | 108 +++++++++--------- 1 file changed, 53 insertions(+), 55 deletions(-) rename {sources => translated}/tech/20191018 How to use Protobuf for data interchange.md (51%) diff --git a/sources/tech/20191018 How to use Protobuf for data interchange.md b/translated/tech/20191018 How to use Protobuf for data interchange.md similarity index 51% rename from sources/tech/20191018 How to use Protobuf for data interchange.md rename to translated/tech/20191018 How to use Protobuf for data interchange.md index 76cb47c5cd..42268a0507 100644 --- a/sources/tech/20191018 How to use Protobuf for data interchange.md +++ b/translated/tech/20191018 How to use Protobuf for data interchange.md @@ -7,34 +7,33 @@ [#]: via: (https://opensource.com/article/19/10/protobuf-data-interchange) [#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) -How to use Protobuf for data interchange +如何使用 Protobuf 做数据交换 ====== -Protobuf encoding increases efficiency when exchanging data between -applications written in different languages and running on different -platforms. + +> 在以不同语言编写并在不同平台上运行的应用程序之间交换数据时,Protobuf 编码可提高效率。 + ![metrics and data shown on a computer screen][1] -Protocol buffers ([Protobufs][2]), like XML and JSON, allow applications, which may be written in different languages and running on different platforms, to exchange data. For example, a sending application written in Go could encode a Go-specific sales order in Protobuf, which a receiver written in Java then could decode to get a Java-specific representation of the received order. Here is a sketch of the architecture over a network connection: - +协议缓冲区Protocol Buffers +([Protobufs][2])像 XML 和 JSON 一样,可以让用不同语言编写并在不同平台上运行的应用程序交换数据。例如,用 Go 编写的发送应用程序可以在 Protobuf 中对 Go 特定的销售订单进行编码,然后用 Java 编写的接收方可以对它进行解码,以获取所接收订单的 Java 特定表示方式。这是在网络连接上的体系结构示意图: ``` -`Go sales order--->Pbuf-encode--->network--->Pbuf-decode--->Java sales order` +Go sales order--->Pbuf-encode--->network--->Pbuf-decode--->Java sales order ``` -Protobuf encoding, in contrast to its XML and JSON counterparts, is binary rather than text, which can complicate debugging. However, as the code examples in this article confirm, the Protobuf encoding is significantly more efficient in size than either XML or JSON encoding. +与 XML 和 JSON 相比,Protobuf 编码是二进制而不是文本,这会使调试复杂化。但是,正如本文中的代码示例所确认的那样,Protobuf 编码在大小上比 XML 或 JSON 编码要有效得多。 -Protobuf is efficient in another way. At the implementation level, Protobuf and other encoding systems serialize and deserialize structured data. Serialization transforms a language-specific data structure into a bytestream, and deserialization is the inverse operation that transforms a bytestream back into a language-specific data structure. Serialization and deserialization may become the bottleneck in data interchange because these operations are CPU-intensive. Efficient serialization and deserialization is another Protobuf design goal. +Protobuf 以另一种方式提供了这种有效性。在实现级别,Protobuf 和其他编码系统对结构化数据进行序列化和反序列化。序列化将特定语言的数据结构转换为字节流,反序列化是将字节流转换回特定语言的数据结构的逆运算。序列化和反序列化可能成为数据交换的瓶颈,因为这些操作会占用大量 CPU。高效的序列化和反序列化是 Protobuf 的另一个设计目标。 -Recent encoding technologies, such as Protobuf and FlatBuffers, derive from the [DCE/RPC][3] (Distributed Computing Environment/Remote Procedure Call) initiative of the early 1990s. Like DCE/RPC, Protobuf contributes to both the [IDL][4] (interface definition language) and the encoding layer in data interchange. +最近的编码技术,例如 Protobuf 和 FlatBuffers,源自 1990 年代初期的 [DCE/RPC][3](分布式计算环境/远程过程调用Distributed Computing Environment/Remote Procedure Call)计划。与 DCE/RPC 一样,Protobuf 在数据交换中为 [IDL][4](接口定义语言)和编码层做出了贡献。 -This article will look at these two layers then provide code examples in Go and Java to flesh out Protobuf details and show that Protobuf is easy to use. +本文将着眼于这两层,然后提供 Go 和 Java 中的代码示例以充实 Protobuf 的细节,并表明 Protobuf 是易于使用的。 -### Protobuf as an IDL and encoding layer +### Protobuf 作为一个 IDL 和编码层 -DCE/RPC, like Protobuf, is designed to be language- and platform-neutral. The appropriate libraries and utilities allow any language and platform to play in the DCE/RPC arena. Furthermore, the DCE/RPC architecture is elegant. An IDL document is the contract between the remote procedure on the one side and callers on the other side. Protobuf, too, centers on an IDL document. - -An IDL document is text and, in DCE/RPC, uses basic C syntax along with syntactic extensions for metadata (square brackets) and a few new keywords such as **interface**. Here is an example: +像 Protobuf 一样,DCE/RPC 被设计为与语言和平台无关。适当的库和实用程序允许任何语言和平台用于 DCE/RPC 领域。此外,DCE/RPC 体系结构非常优雅。IDL 文档是一侧的远程过程与另一侧的调用者之间的协定。Protobuf 也是以 IDL 文档为中心的。 +IDL 文档是文本,在 DCE/RPC 中,使用基本 C 语法以及元数据的语法扩展(方括号)和一些新的关键字,例如 `interface`。这是一个例子: ``` [uuid (2d6ead46-05e3-11ca-7dd1-426909beabcd), version(1.0)] @@ -48,29 +47,28 @@ interface echo { } ``` -This IDL document declares a procedure named **echo**, which takes three arguments: the **[in]** arguments of type **handle_t** (implementation pointer) and **idl_char** (array of ASCII characters) are passed to the remote procedure, whereas the **[out]** argument (also a string) is passed back from the procedure. In this example, the **echo** procedure does not explicitly return a value (the **void** to the left of **echo**) but could do so. A return value, together with one or more **[out]** arguments, allows the remote procedure to return arbitrarily many values. The next section introduces a Protobuf IDL, which differs in syntax but likewise serves as a contract in data interchange. - -The IDL document, in both DCE/RPC and Protobuf, is the input to utilities that create the infrastructure code for exchanging data: +该 IDL 文档声明了一个名为 `echo` 的过程,该过程带有三个参数:类型为 `handle_t`(实现指针)和 `idl_char`(ASCII 字符数组)的 `[in]` 参数被传递给远程过程,而 `[out]` 参数(也是一个字符串)从该过程中传回。在此示例中,`echo` 过程不会显式返回值(`echo` 左侧的 `void`),但也可以返回。返回值,以及一个或多个 `[out]` 参数,允许远程过程任意返回许多值。下一节将介绍 Protobuf IDL,它的语法不同,但同样用作数据交换中的协定。 +DCE/RPC 和 Protobuf 中的 IDL 文档是创建用于交换数据的基础结构代码的实用程序的输入: ``` -`IDL document--->DCE/PRC or Protobuf utilities--->support code for data interchange` +IDL document--->DCE/PRC or Protobuf utilities--->support code for data interchange ``` -As relatively straightforward text, the IDL is likewise human-readable documentation about the specifics of the data interchange—in particular, the number of data items exchanged and the data type of each item. +作为相对简单的文本,IDL 同样是关于数据交换的细节的便于人类阅读的文档(特别是交换的数据项的数量和每个项的数据类型)。 -Protobuf can used in a modern RPC system such as [gRPC][5]; but Protobuf on its own provides only the IDL layer and the encoding layer for messages passed from a sender to a receiver. Protobuf encoding, like the DCE/RPC original, is binary but more efficient. +Protobuf 可用于现代 RPC 系统,例如 [gRPC][5];但是 Protobuf 本身仅提供 IDL 层和编码层,用于从发送者传递到接收者的消息。与原始的 DCE/RPC 一样,Protobuf 编码是二进制的,但效率更高。 -At present, XML and JSON encodings still dominate in data interchange through technologies such as web services, which make use of in-place infrastructure such as web servers, transport protocols (e.g., TCP, HTTP), and standard libraries and utilities for processing XML and JSON documents. Moreover, database systems of various flavors can store XML and JSON documents, and even legacy relational systems readily generate XML encodings of query results. Every general-purpose programming language now has libraries that support XML and JSON. What, then, recommends a return to a _binary_ encoding system such as Protobuf? +目前,XML 和 JSON 编码仍在通过 Web 服务等技术进行的数据交换中占主导地位,这些技术利用 Web 服务器、传输协议(例如 TCP、HTTP)以及标准库和实用程序等原有的基础设施来处理 XML 和 JSON 文档。 此外,各种类型的数据库系统可以存储 XML 和 JSON 文档,甚至旧式关系型系统也可以轻松生成查询结果的 XML 编码。现在,每种通用编程语言都具有支持 XML 和 JSON 的库。那么,是什么建议我们回到 Protobuf 之类的**二进制**编码系统呢? -Consider the negative decimal value **-128**. In the 2's complement binary representation, which dominates across systems and languages, this value can be stored in a single 8-bit byte: 10000000. The text encoding of this integer value in XML or JSON requires multiple bytes. For example, UTF-8 encoding requires four bytes for the string, literally **-128**, which is one byte per character (in hex, the values are 0x2d, 0x31, 0x32, and 0x38). XML and JSON also add markup characters, such as angle brackets and braces, to the mix. Details about Protobuf encoding are forthcoming, but the point of interest now is a general one: Text encodings tend to be significantly less compact than binary ones. +让我们看一下负十进制值 `-128`。在 2 的补码二进制表示形式(在系统和语言中占主导地位)中,此值可以存储在单个 8 位字节中:`10000000`。此整数值在 XML 或 JSON 中的文本编码需要多个字节。例如,UTF-8 编码需要四个字节的字符串,即 `-128`,即每个字符一个字节(十六进制,值为 `0x2d`、`0x31`、`0x32` 和 `0x38`)。XML 和 JSON 还添加了标记字符,例如尖括号和大括号。有关 Protobuf 编码的详细信息下面就会介绍,但现在的关注点是一个通用点:文本编码的压缩性明显低于二进制编码。 ### A code example in Go using Protobuf My code examples focus on Protobuf rather than RPC. Here is an overview of the first example: - * The IDL file named _dataitem.proto_ defines a Protobuf **message** with six fields of different types: integer values with different ranges, floating-point values of a fixed size, and strings of two different lengths. - * The Protobuf compiler uses the IDL file to generate a Go-specific version (and, later, a Java-specific version) of the Protobuf **message** together with supporting functions. + * The IDL file named _dataitem.proto_ defines a Protobuf `message` with six fields of different types: integer values with different ranges, floating-point values of a fixed size, and strings of two different lengths. + * The Protobuf compiler uses the IDL file to generate a Go-specific version (and, later, a Java-specific version) of the Protobuf `message` together with supporting functions. * A Go app populates the native Go data structure with randomly generated values and then serializes the result to a local file. For comparison, XML and JSON encodings also are serialized to local files. * As a test, the Go application reconstructs an instance of its native data structure by deserializing the contents of the Protobuf file. * As a language-neutrality test, the Java application also deserializes the contents of the Protobuf file to get an instance of a native data structure. @@ -101,9 +99,9 @@ message DataItem { } ``` -The IDL uses the current proto3 rather than the earlier proto2 syntax. The package name (in this case, **main**) is optional but customary; it is used to avoid name conflicts. The structured **message** contains eight fields, each of which has a Protobuf data type (e.g., **int64**, **string**), a name (e.g., **oddA**, **short**), and a numeric tag (aka key) after the equals sign **=**. The tags, which are 1 through 8 in this example, are unique integer identifiers that determine the order in which the fields are serialized. +The IDL uses the current proto3 rather than the earlier proto2 syntax. The package name (in this case, `main`) is optional but customary; it is used to avoid name conflicts. The structured `message` contains eight fields, each of which has a Protobuf data type (e.g., `int64`, `string`), a name (e.g., `oddA`, `short`), and a numeric tag (aka key) after the equals sign `=`. The tags, which are 1 through 8 in this example, are unique integer identifiers that determine the order in which the fields are serialized. -Protobuf messages can be nested to arbitrary levels, and one message can be the field type in the other. Here's an example that uses the **DataItem** message as a field type: +Protobuf messages can be nested to arbitrary levels, and one message can be the field type in the other. Here's an example that uses the `DataItem` message as a field type: ``` @@ -112,7 +110,7 @@ message DataItems { } ``` -A single **DataItems** message consists of repeated (none or more) **DataItem** messages. +A single `DataItems` message consists of repeated (none or more) `DataItem` messages. Protobuf also supports enumerated types for clarity: @@ -123,9 +121,9 @@ enum PartnershipStatus { } ``` -The **reserved** qualifier ensures that the numeric values used to implement the three symbolic names cannot be reused. +The `reserved` qualifier ensures that the numeric values used to implement the three symbolic names cannot be reused. -To generate a language-specific version of one or more declared Protobuf **message** structures, the IDL file containing these is passed to the _protoc_ compiler (available in the [Protobuf GitHub repository][7]). For the Go code, the supporting Protobuf library can be installed in the usual way (with **%** as the command-line prompt): +To generate a language-specific version of one or more declared Protobuf `message` structures, the IDL file containing these is passed to the _protoc_ compiler (available in the [Protobuf GitHub repository][7]). For the Go code, the supporting Protobuf library can be installed in the usual way (with `%` as the command-line prompt): ``` @@ -139,7 +137,7 @@ The command to compile the Protobuf IDL file _dataitem.proto_ into Go source cod `% protoc --go_out=. dataitem.proto` ``` -The flag **\--go_out** directs the compiler to generate Go source code; there are similar flags for other languages. The result, in this case, is a file named _dataitem.pb.go_, which is small enough that the essentials can be copied into a Go application. Here are the essentials from the generated code: +The flag `\--go_out` directs the compiler to generate Go source code; there are similar flags for other languages. The result, in this case, is a file named _dataitem.pb.go_, which is small enough that the essentials can be copied into a Go application. Here are the essentials from the generated code: ``` @@ -162,21 +160,21 @@ func (*DataItem) ProtoMessage()    {} func init() {} ``` -The compiler-generated code has a Go structure **DataItem**, which exports the Go fields—the names are now capitalized—that match the names declared in the Protobuf IDL. The structure fields have standard Go data types: **int32**, **int64**, **float32**, and **string**. At the end of each field line, as a string, is metadata that describes the Protobuf types, gives the numeric tags from the Protobuf IDL document, and provides information about JSON, which is discussed later. +The compiler-generated code has a Go structure `DataItem`, which exports the Go fields—the names are now capitalized—that match the names declared in the Protobuf IDL. The structure fields have standard Go data types: `int32`, `int64`, `float32`, and `string`. At the end of each field line, as a string, is metadata that describes the Protobuf types, gives the numeric tags from the Protobuf IDL document, and provides information about JSON, which is discussed later. -There are also functions; the most important is **proto.Marshal** for serializing an instance of the **DataItem** structure into Protobuf format. The helper functions include **Reset**, which clears a **DataItem** structure, and **String**, which produces a one-line string representation of a **DataItem**. +There are also functions; the most important is `proto.Marshal` for serializing an instance of the `DataItem` structure into Protobuf format. The helper functions include `Reset`, which clears a `DataItem` structure, and `String`, which produces a one-line string representation of a `DataItem`. The metadata that describes Protobuf encoding deserves a closer look before analyzing the Go program in more detail. ### Protobuf encoding -A Protobuf message is structured as a collection of key/value pairs, with the numeric tag as the key and the corresponding field as the value. The field names, such as **oddA** and **small**, are for human readability, but the _protoc_ compiler does use the field names in generating language-specific counterparts. For example, the **oddA** and **small** names in the Protobuf IDL become the fields **OddA** and **Small**, respectively, in the Go structure. +A Protobuf message is structured as a collection of key/value pairs, with the numeric tag as the key and the corresponding field as the value. The field names, such as `oddA` and `small`, are for human readability, but the _protoc_ compiler does use the field names in generating language-specific counterparts. For example, the `oddA` and `small` names in the Protobuf IDL become the fields `OddA` and `Small`, respectively, in the Go structure. -The keys and their values both get encoded, but with an important difference: some numeric values have a fixed-size encoding of 32 or 64 bits, whereas others (including the **message** tags) are _varint_ encoded—the number of bits depends on the integer's absolute value. For example, the integer values 1 through 15 require 8 bits to encode in _varint_, whereas the values 16 through 2047 require 16 bits. The _varint_ encoding, similar in spirit (but not in detail) to UTF-8 encoding, favors small integer values over large ones. (For a detailed analysis, see the Protobuf [encoding guide][8].) The upshot is that a Protobuf **message** should have small integer values in fields, if possible, and as few keys as possible, but one key per field is unavoidable. +The keys and their values both get encoded, but with an important difference: some numeric values have a fixed-size encoding of 32 or 64 bits, whereas others (including the `message` tags) are _varint_ encoded—the number of bits depends on the integer's absolute value. For example, the integer values 1 through 15 require 8 bits to encode in _varint_, whereas the values 16 through 2047 require 16 bits. The _varint_ encoding, similar in spirit (but not in detail) to UTF-8 encoding, favors small integer values over large ones. (For a detailed analysis, see the Protobuf [encoding guide][8].) The upshot is that a Protobuf `message` should have small integer values in fields, if possible, and as few keys as possible, but one key per field is unavoidable. Table 1 below gives the gist of Protobuf encoding: -**Table 1. Protobuf data types** +`Table 1. Protobuf data types` Encoding | Sample types | Length ---|---|--- @@ -184,9 +182,9 @@ varint | int32, uint32, int64 | Variable length fixed | fixed32, float, double | Fixed 32-bit or 64-bit length byte sequence | string, bytes | Sequence length -Integer types that are not explicitly **fixed** are _varint_ encoded; hence, in a _varint_ type such as **uint32** (**u** for unsigned), the number 32 describes the integer's range (in this case, 0 to 232 \- 1) rather than its bit size, which differs depending on the value. For fixed types such as **fixed32** or **double**, by contrast, the Protobuf encoding requires 32 and 64 bits, respectively. Strings in Protobuf are byte sequences; hence, the size of the field encoding is the length of the byte sequence. +Integer types that are not explicitly `fixed` are _varint_ encoded; hence, in a _varint_ type such as `uint32` (`u` for unsigned), the number 32 describes the integer's range (in this case, 0 to 232 \- 1) rather than its bit size, which differs depending on the value. For fixed types such as `fixed32` or `double`, by contrast, the Protobuf encoding requires 32 and 64 bits, respectively. Strings in Protobuf are byte sequences; hence, the size of the field encoding is the length of the byte sequence. -Another efficiency deserves mention. Recall the earlier example in which a **DataItems** message consists of repeated **DataItem** instances: +Another efficiency deserves mention. Recall the earlier example in which a `DataItems` message consists of repeated `DataItem` instances: ``` @@ -195,13 +193,13 @@ message DataItems { } ``` -The **repeated** means that the **DataItem** instances are _packed_: the collection has a single tag, in this case, 1. A **DataItems** message with repeated **DataItem** instances is thus more efficient than a message with multiple but separate **DataItem** fields, each of which would require a tag of its own. +The `repeated` means that the `DataItem` instances are _packed_: the collection has a single tag, in this case, 1. A `DataItems` message with repeated `DataItem` instances is thus more efficient than a message with multiple but separate `DataItem` fields, each of which would require a tag of its own. With this background in mind, let's return to the Go program. ### The dataItem program in detail -The _dataItem_ program creates a **DataItem** instance and populates the fields with randomly generated values of the appropriate types. Go has a **rand** package with functions for generating pseudo-random integer and floating-point values, and my **randString** function generates pseudo-random strings of specified lengths from a character set. The design goal is to have a **DataItem** instance with field values of different types and bit sizes. For example, the **OddA** and **EvenA** values are 64-bit non-negative integer values of odd and even parity, respectively; but the **OddB** and **EvenB** variants are 32 bits in size and hold small integer values between 0 and 2047. The random floating-point values are 32 bits in size, and the strings are 16 (**Short**) and 32 (**Long**) characters in length. Here is the code segment that populates the **DataItem** structure with random values: +The _dataItem_ program creates a `DataItem` instance and populates the fields with randomly generated values of the appropriate types. Go has a `rand` package with functions for generating pseudo-random integer and floating-point values, and my `randString` function generates pseudo-random strings of specified lengths from a character set. The design goal is to have a `DataItem` instance with field values of different types and bit sizes. For example, the `OddA` and `EvenA` values are 64-bit non-negative integer values of odd and even parity, respectively; but the `OddB` and `EvenB` variants are 32 bits in size and hold small integer values between 0 and 2047. The random floating-point values are 32 bits in size, and the strings are 16 (`Short`) and 32 (`Long`) characters in length. Here is the code segment that populates the `DataItem` structure with random values: ``` @@ -234,7 +232,7 @@ dataItem := &DataItem { } ``` -Once created and populated with values, the **DataItem** instance is encoded in XML, JSON, and Protobuf, with each encoding written to a local file: +Once created and populated with values, the `DataItem` instance is encoded in XML, JSON, and Protobuf, with each encoding written to a local file: ``` @@ -250,7 +248,7 @@ func encodeAndserialize(dataItem *DataItem) { } ``` -The three serializing functions use the term _marshal_, which is roughly synonymous with _serialize_. As the code indicates, each of the three **Marshal** functions returns an array of bytes, which then are written to a file. (Possible errors are ignored for simplicity.) On a sample run, the file sizes were: +The three serializing functions use the term _marshal_, which is roughly synonymous with _serialize_. As the code indicates, each of the three `Marshal` functions returns an array of bytes, which then are written to a file. (Possible errors are ignored for simplicity.) On a sample run, the file sizes were: ``` @@ -261,7 +259,7 @@ dataitem.pbuf:  88 bytes The Protobuf encoding is significantly smaller than the other two. The XML and JSON serializations could be reduced slightly in size by eliminating indentation characters, in this case, blanks and newlines. -Below is the _dataitem.json_ file resulting eventually from the **json.MarshalIndent** call, with added comments starting with **##**: +Below is the _dataitem.json_ file resulting eventually from the `json.MarshalIndent` call, with added comments starting with `##`: ``` @@ -281,7 +279,7 @@ Although the serialized data goes into local files, the same approach would be u ### Testing serialization/deserialization -The Go program next runs an elementary test by deserializing the bytes, which were written earlier to the _dataitem.pbuf_ file, into a **DataItem** instance. Here is the code segment, with the error-checking parts removed: +The Go program next runs an elementary test by deserializing the bytes, which were written earlier to the _dataitem.pbuf_ file, into a `DataItem` instance. Here is the code segment, with the error-checking parts removed: ``` @@ -291,7 +289,7 @@ testItem.Reset()                            // clear the DataItem err = proto.Unmarshal(filebytes, testItem)  // deserialize into a DataItem instance ``` -The **proto.Unmarshal** function for deserializing Protbuf is the inverse of the **proto.Marshal** function. The original **DataItem** and the deserialized clone are printed to confirm an exact match: +The `proto.Unmarshal` function for deserializing Protbuf is the inverse of the `proto.Marshal` function. The original `DataItem` and the deserialized clone are printed to confirm an exact match: ``` @@ -308,7 +306,7 @@ boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& ### A Protobuf client in Java -The example in Java is to confirm Protobuf's language neutrality. The original IDL file could be used to generate the Java support code, which involves nested classes. To suppress warnings, however, a slight addition can be made. Here is the revision, which specifies a **DataMsg** as the name for the outer class, with the inner class automatically named **DataItem** after the Protobuf message: +The example in Java is to confirm Protobuf's language neutrality. The original IDL file could be used to generate the Java support code, which involves nested classes. To suppress warnings, however, a slight addition can be made. Here is the revision, which specifies a `DataMsg` as the name for the outer class, with the inner class automatically named `DataItem` after the Protobuf message: ``` @@ -353,7 +351,7 @@ public class Main { } ``` -Production-grade testing would be far more thorough, of course, but even this preliminary test confirms the language-neutrality of Protobuf: the _dataitem.pbuf_ file results from the Go program's serialization of a Go **DataItem**, and the bytes in this file are deserialized to produce a **DataItem** instance in Java. The output from the Java test is the same as that from the Go test. +Production-grade testing would be far more thorough, of course, but even this preliminary test confirms the language-neutrality of Protobuf: the _dataitem.pbuf_ file results from the Go program's serialization of a Go `DataItem`, and the bytes in this file are deserialized to produce a `DataItem` instance in Java. The output from the Java test is the same as that from the Go test. ### Wrapping up with the numPairs program @@ -374,9 +372,9 @@ message NumPair { } ``` -A **NumPair** message consists of two **int32** values together with an integer tag for each field. A **NumPairs** message is a sequence of embedded **NumPair** messages. +A `NumPair` message consists of two `int32` values together with an integer tag for each field. A `NumPairs` message is a sequence of embedded `NumPair` messages. -The _numPairs_ program in Go (below) creates 2 million **NumPair** instances, with each appended to the **NumPairs** message. This message can be serialized and deserialized in the usual way. +The _numPairs_ program in Go (below) creates 2 million `NumPair` instances, with each appended to the `NumPairs` message. This message can be serialized and deserialized in the usual way. #### Example 2. The numPairs program @@ -460,11 +458,11 @@ func main() { } ``` -The randomly generated odd and even values in each **NumPair** range from zero to 2 billion and change. In terms of raw rather than encoded data, the integers generated in the Go program add up to 16MB: two integers per **NumPair** for a total of 4 million integers in all, and each value is four bytes in size. +The randomly generated odd and even values in each `NumPair` range from zero to 2 billion and change. In terms of raw rather than encoded data, the integers generated in the Go program add up to 16MB: two integers per `NumPair` for a total of 4 million integers in all, and each value is four bytes in size. -For comparison, the table below has entries for the XML, JSON, and Protobuf encodings of the 2 million **NumPair** instances in the sample **NumsPairs** message. The raw data is included, as well. Because the _numPairs_ program generates random values, output differs across sample runs but is close to the sizes shown in the table. +For comparison, the table below has entries for the XML, JSON, and Protobuf encodings of the 2 million `NumPair` instances in the sample `NumsPairs` message. The raw data is included, as well. Because the _numPairs_ program generates random values, output differs across sample runs but is close to the sizes shown in the table. -**Table 2. Encoding overhead for 16MB of integers** +`Table 2. Encoding overhead for 16MB of integers` Encoding | File | Byte size | Pbuf/other ratio ---|---|---|--- @@ -475,11 +473,11 @@ XML | pairs.xml | 126MB | 21% As expected, Protobuf shines next to XML and JSON. The Protobuf encoding is about a quarter of the JSON one and about a fifth of the XML one. But the raw data make clear that Protobuf incurs the overhead of encoding: the serialized Protobuf message is 11MB larger than the raw data. Any encoding, including Protobuf, involves structuring the data, which unavoidably adds bytes. -Each of the serialized 2 million **NumPair** instances involves _four_ integer values: one apiece for the **Even** and **Odd** fields in the Go structure, and one tag per each field in the Protobuf encoding. As raw rather than encoded data, this would come to 16 bytes per instance, and there are 2 million instances in the sample **NumPairs** message. But the Protobuf tags, like the **int32** values in the **NumPair** fields, use _varint_ encoding and, therefore, vary in byte length; in particular, small integer values (which include the tags, in this case) require fewer than four bytes to encode. +Each of the serialized 2 million `NumPair` instances involves _four_ integer values: one apiece for the `Even` and `Odd` fields in the Go structure, and one tag per each field in the Protobuf encoding. As raw rather than encoded data, this would come to 16 bytes per instance, and there are 2 million instances in the sample `NumPairs` message. But the Protobuf tags, like the `int32` values in the `NumPair` fields, use _varint_ encoding and, therefore, vary in byte length; in particular, small integer values (which include the tags, in this case) require fewer than four bytes to encode. -If the _numPairs_ program is revised so that the two **NumPair** fields hold values less than 2048, which have encodings of either one or two bytes, then the Protobuf encoding drops from 27MB to 16MB—the very size of the raw data. The table below summarizes the new encoding sizes from a sample run. +If the _numPairs_ program is revised so that the two `NumPair` fields hold values less than 2048, which have encodings of either one or two bytes, then the Protobuf encoding drops from 27MB to 16MB—the very size of the raw data. The table below summarizes the new encoding sizes from a sample run. -**Table 3. Encoding with 16MB of integers < 2048** +`Table 3. Encoding with 16MB of integers < 2048` Encoding | File | Byte size | Pbuf/other ratio ---|---|---|--- From fda6fa348ffa41f79047a9cbc74e7a3b78f611ef Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 19 Nov 2019 23:18:03 +0800 Subject: [PATCH 532/800] PRF --- ...hat you probably didn-t know about sudo.md | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/translated/tech/20191029 What you probably didn-t know about sudo.md b/translated/tech/20191029 What you probably didn-t know about sudo.md index 7843c56405..0e6db4b6ad 100644 --- a/translated/tech/20191029 What you probably didn-t know about sudo.md +++ b/translated/tech/20191029 What you probably didn-t know about sudo.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (What you probably didn’t know about sudo) @@ -10,7 +10,7 @@ 关于 sudo 你可能不知道的 ====== -> 认为你已经了解了 sudo 的所有知识吗?再想想。 +> 觉得你已经了解了 sudo 的所有知识了吗?再想想。 ![Command line prompt][1] @@ -18,11 +18,11 @@ 有 root 用户和 `su` 命令,那么为什么还要使用另一个工具呢?对于许多人来说,`sudo` 只是管理命令的前缀。只有极少数人提到,当你在同一个系统上有多个管理员时,可以使用 `sudo` 日志查看谁做了什么。 -那么,`sudo` 是什么? 根据 [sudo 网站] [2]: +那么,`sudo` 是什么? 根据 [sudo 网站][2]: > “sudo 允许系统管理员通过授予某些用户以 root 用户或其他用户身份运行某些命令的能力,同时提供命令及其参数的审核记录,从而委派权限。” -默认情况下,`sudo` 带有简单的配置,一条规则允许一个用户或一组用户执行几乎所有操作(在本文后面的配置文件中有更多信息): +默认情况下,`sudo` 只有简单的配置,一条规则允许一个用户或一组用户执行几乎所有操作(在本文后面的配置文件中有更多信息): ``` %wheel ALL=(ALL) ALL @@ -35,37 +35,37 @@ * 第三个参数(`(ALL)`)定义了可以执行命令的用户名。 * 最后一个参数(`ALL`)定义可以运行的应用程序。 -因此,在此示例中,`wheel` 组的成员可以以所有主机上的所有用户身份运行所有应用程序。即使这个一切允许的规则也很有用,因为它会记录谁在的计算机上做了什么。 +因此,在此示例中,`wheel` 组的成员可以以所有主机上的所有用户身份运行所有应用程序。但即使是这个一切允许的规则也很有用,因为它会记录谁在计算机上做了什么。 ### 别名 -当然,它不仅可以让你和你最好的朋友管理一个共享机器,你还可以微调权限。你可以将以上配置中的项目替换为列表:用户列表、命令列表等。 多数情况下,你可能会复制并粘贴配置中的一些列表。 +当然,它不仅可以让你和你最好的朋友管理一个共享机器,你还可以微调权限。你可以将以上配置中的项目替换为列表:用户列表、命令列表等。多数情况下,你可能会复制并粘贴配置中的一些列表。 -在这种情况下,别名可以派上用场。在多个位置维护相同的列表容易出错。你可以定义一次别名,然后可以多次使用。因此,当你对一位管理员失去信任时,可以将其从别名中删除就行了。使用多个列表而不是别名,很容易忘记从具有较高特权的列表之一中删除用户。 +在这种情况下,别名可以派上用场。在多个位置维护相同的列表容易出错。你可以定义一次别名,然后可以多次使用。因此,当你对一位管理员不再信任时,将其从别名中删除就行了。使用多个列表而不是别名,很容易忘记从具有较高特权的列表之一中删除用户。 ### 为特定组的用户启用功能 -`sudo` 命令带有大量默认设置。不过,在某些情况下,你想覆盖其中的一些情况,这时你可以在配置中使用 `Defaults` 语句。通常,对每个用户都强制使用这些默认值,但是你可以根据主机、用户名等将设置缩小到一部分用户。这有个我那一代的系统管理员喜欢玩的一个示例:“羞辱”。这些只是一些有人输入错误密码时的有趣信息: +`sudo` 命令带有大量默认设置。不过,在某些情况下,你想覆盖其中的一些情况,这时你可以在配置中使用 `Defaults` 语句。通常,对每个用户都强制使用这些默认值,但是你可以根据主机、用户名等将设置缩小到一部分用户。这里有个我那一代的系统管理员都喜欢玩的一个示例:“羞辱”。这些只不过是一些有人输入错误密码时的有趣信息: ``` czanik@linux-mewy:~> sudo ls [sudo] password for root: -Hold it up to the light --- not a brain in sight! +Hold it up to the light --- not a brain in sight! # 把灯举高点,脑仁太小看不到 [sudo] password for root: -My pet ferret can type better than you! +My pet ferret can type better than you! # 我的宠物貂也比你输入的好 [sudo] password for root: sudo: 3 incorrect password attempts czanik@linux-mewy:~> ``` -由于并非所有人都喜欢系统管理员的这种幽默,因此默认情况下将禁用这些羞辱信息。以下示例说明了如何仅对经验丰富的系统管理员(即 `wheel` 组的成员)启用此设置: +由于并非所有人都喜欢系统管理员的这种幽默,因此默认情况下会禁用这些羞辱信息。以下示例说明了如何仅对经验丰富的系统管理员(即 `wheel` 组的成员)启用此设置: ``` Defaults !insults Defaults:%wheel insults ``` -我想感谢我将这些消息带回来的人用两只手也数不过来吧。 +我想,感谢我将这些消息带回来的人用两只手也数不过来吧。 ### 摘要验证 @@ -79,15 +79,15 @@ peter ALL = sha244:11925141bb22866afdf257ce7790bd6275feda80b3b241c108b79c88 /usr ### 会话记录 -会话记录也是 `sudo` 鲜为人知的功能。在演示之后,许多人离开我的演讲后就在计划在其基础设施上实施它。为什么?因为使用会话记录,你不仅可以看到命令名称,还可以看到终端中发生的所有事情。你可以看到你的管理员在做什么,即使他们具有 shell 访问权限,而日志仅显示启动了 `bash`。 +会话记录也是 `sudo` 鲜为人知的功能。在演示之后,许多人离开我的演讲后就计划在其基础设施上实施它。为什么?因为使用会话记录,你不仅可以看到命令名称,还可以看到终端中发生的所有事情。你可以看到你的管理员在做什么,要不他们用 shell 访问了机器而日志仅会显示启动了 `bash`。 -当前有一个限制。记录存储在本地,因此具有足够的权限的话,用户可以删除他们的痕迹。请继续关注即将推出的功能。 +当前有一个限制。记录存储在本地,因此具有足够的权限的话,用户可以删除他们的痕迹。所以请继续关注即将推出的功能。 ### 插件 -从 1.8 版开始,`sudo` 更改为基于插件的模块化体系结构。通过将大多数功能实现为插件,你可以编写自己的功能轻松地替换或扩展 `sudo` 的功能。已有 `sudo` 可用的开源和商业插件。 +从 1.8 版开始,`sudo` 更改为基于插件的模块化体系结构。通过将大多数功能实现为插件,你可以编写自己的功能轻松地替换或扩展 `sudo` 的功能。已经有了 `sudo` 上的开源和商业插件。 -在我的演讲中,我演示了 `sudo_pair` 插件,该插件可在 [GitHub][3] 上获得。这个插件是用 Rust 开发的,这意味着它不是那么容易编译,甚至更难以分发编译结果。另一方面,该插件提供了有趣的功能,需要第二个管理员通过 `sudo` 批准(或拒绝)运行命令。不仅如此,如果有可疑活动,可以在屏幕上跟踪会话并终止会话。 +在我的演讲中,我演示了 `sudo_pair` 插件,该插件可在 [GitHub][3] 上获得。这个插件是用 Rust 开发的,这意味着它不是那么容易编译,甚至更难以分发其编译结果。另一方面,该插件提供了有趣的功能,需要第二个管理员通过 `sudo` 批准(或拒绝)运行命令。不仅如此,如果有可疑活动,可以在屏幕上跟踪会话并终止会话。 在最近的 All Things Open 会议上的一次演示中,我做了一个臭名昭著的演示: @@ -95,11 +95,11 @@ peter ALL = sha244:11925141bb22866afdf257ce7790bd6275feda80b3b241c108b79c88 /usr czanik@linux-mewy:~> sudo  rm -fr / ``` -看着屏幕上显示的命令。每个人都屏住呼吸,想看看我的笔记本电脑是否被毁了,但它仍然幸免了。 +看着屏幕上显示的命令。每个人都屏住呼吸,想看看我的笔记本电脑是否被毁了,然而它逃过一劫。 ### 日志 -正如我在开始时已经提到的,日志记录和警报是 `sudo` 的重要组成部分。如果你不会定期检查 `sudo` 日志,那么日志在使用 `sudo` 中并没有太多价值。该工具通过电子邮件提醒配置中指定的事件,并将所有事件记录到 syslog 中。可以打开调试日志用于调试规则或报告错误。 +正如我在开始时提到的,日志记录和警报是 `sudo` 的重要组成部分。如果你不会定期检查 `sudo` 日志,那么日志在使用 `sudo` 中并没有太多价值。该工具通过电子邮件提醒配置中指定的事件,并将所有事件记录到 syslog 中。可以打开调试日志用于调试规则或报告错误。 ### 警报 @@ -107,11 +107,11 @@ czanik@linux-mewy:~> sudo  rm -fr / ### 配置 -我们谈论了很多 `sudo` 功能,甚至看到了几行配置。现在,让我们仔细看看 `sudo` 的配置方式。配置本身可以在 `/etc/sudoers` 中获得,这是一个简单的文本文件。不过,不建议直接编辑此文件。相反,请使用 `visudo`,因为此工具还会执行语法检查。如果你不喜欢 `vi`,则可以通过将 `EDITOR` 环境变量指向你的首选编辑器来更改要使用的编辑器。 +我们谈论了很多 `sudo` 功能,甚至还看到了几行配置。现在,让我们仔细看看 `sudo` 的配置方式。配置本身可以在 `/etc/sudoers` 中获得,这是一个简单的文本文件。不过,不建议直接编辑此文件。相反,请使用 `visudo`,因为此工具还会执行语法检查。如果你不喜欢 `vi`,则可以通过将 `EDITOR` 环境变量指向你的首选编辑器来更改要使用的编辑器。 -在开始编辑 `sudo` 配置之前,请确保你知道 root 密码。(是的,即使在默认情况下 root 用户没有密码的 Ubuntu 上也是如此。)虽然 `visudo` 会检查语法,但创建语法正确而将你锁定在系统之外的配置很容易。 +在开始编辑 `sudo` 配置之前,请确保你知道 root 密码。(是的,即使在默认情况下 root 用户没有密码的 Ubuntu 上也是如此。)虽然 `visudo` 会检查语法,但创建语法正确而将你锁定在系统之外的配置也很容易。 -如果在紧急情况下,而你手头有 root 密码,你也可以编辑配置。当涉及到 `sudoers` 文件时,有一件重要的事情要记住:从上到下读取该文件,以最后的设置为准。这个事实对你来说意味着你应该从通用设置开始,并在末尾放置例外情况,否则,通用设置会覆盖例外情况。 +如果在紧急情况下,而你手头有 root 密码,你也可以直接编辑配置。当涉及到 `sudoers` 文件时,有一件重要的事情要记住:从上到下读取该文件,以最后的设置为准。这个事实对你来说意味着你应该从通用设置开始,并在末尾放置例外情况,否则,通用设置会覆盖例外情况。 你可以在下面看到一个基于 CentOS 的简单 `sudoers` 文件,并添加我们之前讨论的几行: @@ -133,13 +133,13 @@ Defaults log_output 该文件从更改多个默认值开始。然后是通常的默认规则:`root` 用户和 `wheel` 组的成员对计算机具有完全权限。接下来,我们对 `wheel` 组启用“羞辱”,但对其他所有人禁用它们。最后一行启用会话记录。 -上面的配置在语法上是正确的,但是你可以发现逻辑错误吗?是的,有一个:上一个通用设置覆盖了先前的更具体设置,所有人均禁用了“羞辱”。一旦交换了这两行的位置,设置就会按预期进行:`wheel` 组的成员会收到有趣的消息,但其他用户则不会收到。 +上面的配置在语法上是正确的,但是你可以发现逻辑错误吗?是的,有一个:后一个通用设置覆盖了先前的更具体设置,让所有人均禁用了“羞辱”。一旦交换了这两行的位置,设置就会按预期进行:`wheel` 组的成员会收到有趣的消息,但其他用户则不会收到。 ### 配置管理 一旦必须在多台机器上维护 `sudoers` 文件,你很可能希望集中管理配置。这里主要有两种可能的开源方法。两者都有其优点和缺点。 -你可以使用也可以用来配置其余基础设施的配置管理应用程序之一:Red Hat Ansible、Puppet 和 Chef 都具有用于配置 `sudo` 的模块。这种方法的问题在于更新配置远非实时。同样,用户仍然可以在本地编辑 `sudoers` 文件并更改设置。 +你可以使用也用来配置其余基础设施的配置管理应用程序之一:Red Hat Ansible、Puppet 和 Chef 都具有用于配置 `sudo` 的模块。这种方法的问题在于更新配置远非实时。同样,用户仍然可以在本地编辑 `sudoers` 文件并更改设置。 `sudo` 工具也可以将其配置存储在 LDAP 中。在这种情况下,配置更改是实时的,用户不能弄乱`sudoers` 文件。另一方面,该方法也有局限性。例如,当 LDAP 服务器不可用时,你不能使用别名或使用 `sudo`。 @@ -157,7 +157,7 @@ Defaults log_output    ### 总结 -希望本文能向你证明 `sudo` 不仅仅是一个简单的命令前缀。有无数种可能性可以微调系统上的权限。你不仅可以微调权限,还可以通过检查摘要来提高安全性。会话记录使你能够检查系统上正在发生的事情。你也可以使用插件扩展 `sudo` 的功能,或者使用已有的插件或编写自己的插件。最后,从即将发布的功能列表中,你可以看到,即使 `sudo` 已有数十年的历史,它也是一个不断发展的有生命的项目。 +希望本文能向你证明 `sudo` 不仅仅是一个简单的命令前缀。有无数种可能性可以微调系统上的权限。你不仅可以微调权限,还可以通过检查摘要来提高安全性。会话记录使你能够检查系统上正在发生的事情。你也可以使用插件扩展 `sudo` 的功能,或者使用已有的插件或编写自己的插件。最后,从即将发布的功能列表中你可以看到,即使 `sudo` 已有数十年的历史,它也是一个不断发展的有生命力的项目。 如果你想了解有关 `sudo` 的更多信息,请参考以下资源: @@ -172,7 +172,7 @@ via: https://opensource.com/article/19/10/know-about-sudo 作者:[Peter Czanik][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 0728b0c98ba01606f0017f60421e417036f580a2 Mon Sep 17 00:00:00 2001 From: guevaraya Date: Tue, 19 Nov 2019 23:25:45 +0800 Subject: [PATCH 533/800] Update and rename sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md to translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成,请审核 --- ...ted With ZFS Filesystem on Ubuntu 19.10.md | 144 --------------- ...ted With ZFS Filesystem on Ubuntu 19.10.md | 169 ++++++++++++++++++ 2 files changed, 169 insertions(+), 144 deletions(-) delete mode 100644 sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md create mode 100644 translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md diff --git a/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md b/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md deleted file mode 100644 index 1f1665d5fe..0000000000 --- a/sources/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md +++ /dev/null @@ -1,144 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (guevaraya ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Getting Started With ZFS Filesystem on Ubuntu 19.10) -[#]: via: (https://itsfoss.com/zfs-ubuntu/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Getting Started With ZFS Filesystem on Ubuntu 19.10 -====== - -One of the main [features of Ubuntu 19.10][1] is support for [ZFS][2]. Now you can easily install Ubuntu with on ZFS without any extra effort. - -Normally, you install Linux with Ext4 filesystem. But if you do a fresh install of Ubuntu 19.10, you’ll see the option to use ZFS on the root. You must not use it on a dual boot system though because it will erase the entire disk. - -![You can choose ZFS while installing Ubuntu 19.10][3] - -Let’s see why ZFS matters and how to take advantage of it on ZFS install of Ubuntu. - -### How ZFS is different than other filesystems? - -ZFS is designed with two major goals in mind: to handle large amounts of storage and prevent data corruption. ZFS can handle up to 256 quadrillion Zettabytes of storage. (Hence the Z in ZFS.) It can also handle files up to 16 exabytes in size. - -If you are limited to a single drive laptop, you can still take advantage of the data protection features in ZFS. The copy-on-write feature ensures that data that is in use is not overwritten. Instead, the new information is written to a new block and the filesystem’s metadata is updated to point to the new block. ZFS can easily create snapshots of the filesystem. These snapshots track changes made to the filesystem and share with the filesystem the data that is the same to save space. - -ZFS assigned a checksum to each file on the drive. It is constantly checking the state of the file against that checksum. If it detects that the file has become corrupt, it will attempt to automatically repair that file. - -I have written a detailed article about [what is ZFS and what its features are][2]. Please read it if you are interested in knowing more on this topic. - -Note - -Keep in mind that the data protection features of ZFS can lead to a reduction in performance. - -### Using ZFS on Ubuntu [For intermediate to advanced users] - -![][4] - -Once you have a clean install of Ubuntu with ZFS on the main disk you can start [taking advantage][5] of the features that this filesystem has. - -Please note that all setup of ZFS requires the command line. I am not aware of any GUI tools for it. - -#### Creating a ZFS pool - -_**The section only applies if you have a system with more than one drive. If you only have one drive, Ubuntu will automatically create the pool during installation.**_ - -Before you create your pool, you need to find out the id of the drives for the pool. You can use the command _**lsblk**_ to show this information. - -To create a basic pool with three drives, use the following command: - -``` -sudo zpool create pool-test /dev/sdb /dev/sdc /dev/sdd. -``` - -Remember to replace _**pool-test**_ with the pool name of your choice. - -This command will set up “a zero redundancy RAID-0 pool”. This means that if one of the drives becomes damaged or corrupt, you will lose data. If you do use this setup, it is recommended that you do regular backups. - -You can alos add another disk to the pool by using this command: - -``` -sudo zpool add pool-name /dev/sdx -``` - -#### Check the status of your ZFS pool - -You can check the status of your new pool using this command: - -``` -sudo zpool status pool-test -``` - -![Zpool Status][6] - -#### Mirror a ZFS pool - -To ensure that your data is safe, you can instead set up mirroring. Mirroring means that each drive contains the same data. With mirroring setup, you could lose two out of three drives and still have all of your information. - -To create a mirror, you can use something like this: - -``` -sudo zpool create pool-test mirror /dev/sdb /dev/sdc /dev/sdd -``` - -#### Create ZFS Snapshots for backup and restore - -Snapshots allow you to create a fall-back position in case a file gets deleted or overwritten. For example, let’s create a snapshot, delete some folder in my home directory and restore them. - -First, you need to find the dataset you want to snapshot. You can do that with the - -``` -zfs list -``` - -![Zfs List][7] - -You can see that my home folder is located in **rpool/USERDATA/johnblood_uwcjk7**. - -Let’s create a snapshot named **1910** using this command: - -``` -sudo zfs snapshot rpool/USERDATA/[email protected] -``` - -The snapshot will be created very quickly. Now, I am going to delete the _Downloads_ and _Documents_ directories. - -Now to restore the snapshot, all you have to do is run this command: - -``` -sudo zfs rollback rpool/USERDATA/[email protected] -``` - -The length of the rollback depends on how much the information changed. Now, you can check the home folder and the deleted folders (and their content) will be returned to their correct place. - -### To ZFS or not? - -This is just a quick glimpse at what you can do with ZFS on Ubuntu. For more information, check out [Ubuntu’s wiki page on ZFS.][5] I also recommend reading this [excellent article on ArsTechnica][8]. - -This is an experimental feature and if you are not aware of ZFS and you want to have a simple stable system, please go with the standard install on Ext4. If you have a spare machine that you want to experiment with, then only try something like this to learn a thing or two about ZFS. If you are an ‘expert’ and you know what you are doing, you are free to experiment ZFS wherever you like. - -Have you ever used ZFS? 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][9]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/zfs-ubuntu/ - -作者:[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/ubuntu-19-04-release-features/ -[2]: https://itsfoss.com/what-is-zfs/ -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/zfs-ubuntu-19-10.jpg?ssl=1 -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Using_ZFS_Ubuntu.jpg?resize=800%2C450&ssl=1 -[5]: https://wiki.ubuntu.com/Kernel/Reference/ZFS -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/zpool-status.png?ssl=1 -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/zfs-list.png?ssl=1 -[8]: https://arstechnica.com/information-technology/2019/10/a-detailed-look-at-ubuntus-new-experimental-zfs-installer/ -[9]: https://reddit.com/r/linuxusersgroup diff --git a/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md b/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md new file mode 100644 index 0000000000..7e6f557de1 --- /dev/null +++ b/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (guevaraya ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting Started With ZFS Filesystem on Ubuntu 19.10) +[#]: via: (https://itsfoss.com/zfs-ubuntu/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +在 Ubuntu 19.10 上入门 ZFS 文件系统 +====== + + [Ubuntu 19.01][1] 的一个主要新特性就是 [ZFS][2]。现在你可以很容易的不要太多操作就可以在 Ubuntu 系统上安装 ZFS了。 + +一般情况下,安装 Linux 都会选择 Ext4 文件系统。但是如果是安装 Ubuntu 19.10,在启动阶段可以看到 ZFS 选项。但你绝对不能在双系统上用它,因为它会擦除这个磁盘。 + +![你可以在安装 Ubuntu 19.10 的时候选择 ZFS][3] + +让我们看看 ZFS 有多重要以及如何在已经安装 ZFS 的 Ubuntu 上使用它。 + +### ZFS 与其他文件系统有哪些区别? + +ZFS 的设计初衷是:处理海量存储和避免数据损坏。ZFS 可以处理 256 千万亿的泽它字节(ZB)数据。(这就是ZFS的Z)且它可以处理最大16艾字节(EB)的文件。 + +如果你仅有一个单磁盘的笔记本电脑,你可以体验 ZFS 的数据保护特性。即写及时拷贝特性确保正在使用的数据不会被覆盖,相反,新的数据会被写到一个新的块中,同时文件系统的元数据会被更新到新块中。ZFS 可容易的创建文件系统的快照。这个快照可追踪文件系统的更改,并共享数据块确保节省数据空间。 + +ZFS 为磁盘上的每个文件分配一个校验和。它会不断的校验文件的状态和校验和。如果发现文件被损坏了,它就会尝试修复文件。 + +我写过一个文章详细介绍 [什么是 ZFS以及它有哪些特性][2].如果你感兴趣可以去阅读下。 + +注: + +请谨记 ZFS 的数据保护特性会导致性能下降。 + +### Ubuntu下使用 ZFS [适用于中高级用户] + +![][4] + +一旦你在你的主磁盘上干净安装了 Ubuntu 的 ZFS,你就可以开始体验它的特性。 + +请注意安装 ZFS 这个过程需要命令行。我还没用过它的 GUI 工具。 + +#### 创建一个 ZFS 池 + +_**这段仅针对拥有多个磁盘的系统。如果你只有一个磁盘,Ubuntu会在安装的时候自动的创建池。**_ + +在创建池之前,你需要为池找到磁盘的id。你可以用命令 _**lsblk**_ 查询出这个信息。 + +为三个磁盘创建一个基础池,用以下命令: + +``` +sudo zpool create pool-test /dev/sdb /dev/sdc /dev/sdd. +``` + +请记得替换 _**pool-test**_ 为你自己的命名 + +这个命令将会设置“无冗余RAID-0池”。这意味着如果一个磁盘被破坏或有故障,你将会丢失数据。如果你执行以上命令,还是建议做一个常规备份。 + + +你也可以增加一个磁盘到池,用下面命令: + +``` +sudo zpool add pool-name /dev/sdx +``` + +#### 查看 ZFS 池的状态 + +你可以用这个命令查询新建池的状态: + +``` +sudo zpool status pool-test +``` + +![Zpool 状态][6] + +#### 镜像一个 ZFS 池 + +确保数据的安全性,你可以创建镜像。镜像意味着每个磁盘包含同样的数据。在创建镜像的磁盘上三个磁盘坏掉两个仍然可以不丢数据。 + +创建镜像你可以用下面命令: + +``` +sudo zpool create pool-test mirror /dev/sdb /dev/sdc /dev/sdd +``` + +#### 创建 ZFS 用于备份恢复的快照 + +快照可以是一个需要备份的时间点以防某个文件被删除或被覆盖。比如,我们创建一个快照,当在用户主目录下删除一些目录后,然后把他恢复。 + +首先,你需要找到你想要的快照数据集。你可以这样做: + +``` +zfs list +``` + +![Zfs List][7] + +你可以看到我的目录位于 **rpool/USERDATA/johnblood_uwcjk7**。 + +我们用下面命令创建一个名叫 **1910** 的快照: + +``` +sudo zfs snapshot rpool/USERDATA/[email protected] +``` + +快照很快创建完成。现在你可以删除 _Downloads_ 和 _Documents_ 目录。 + +现在你用以下命令恢复快照: + +``` +sudo zfs rollback rpool/USERDATA/[email protected] +``` + +回滚的数据大小取决于有多少信息改变。现在你可以查看用户目录和被删目录(和它的内容)将会被恢复过来。 + +### 要不要试试 ZFS ? + +这篇文章仅简单介绍的 Ubuntu下 ZFS 的用法。更多的信息请参考 [ Ubuntu 的ZFS Wiki页面][5] 我也推荐阅读 [ArsTechnica的精彩文章][8]。 + +这个是试验性的功能。如果你还不了解 ZFS,你想用一个简单稳定的系统,请安装标准文件系统 EXT4。如果你想用闲置的机器体验,可以参照上面了解 ZFS。如果你是一个‘专家’,你知道你在做什么,那就可以随便咋搞。 + +你之前用过 ZFS 吗?请在下面留言。如果你觉得这个文章还可以,请分享到社交媒体,黑客新闻或 [Reddit][9]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zfs-ubuntu/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[guevaraya](https://github.com/guevaraya) +校对:[校对者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/ubuntu-19-04-release-features/ +[2]: https://itsfoss.com/what-is-zfs/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/zfs-ubuntu-19-10.jpg?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Using_ZFS_Ubuntu.jpg?resize=800%2C450&ssl=1 +[5]: https://wiki.ubuntu.com/Kernel/Reference/ZFS +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/zpool-status.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/zfs-list.png?ssl=1 +[8]: https://arstechnica.com/information-technology/2019/10/a-detailed-look-at-ubuntus-new-experimental-zfs-installer/ +[9]: https://reddit.com/r/linuxusersgroup + 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][9]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zfs-ubuntu/ + +作者:[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/ubuntu-19-04-release-features/ +[2]: https://itsfoss.com/what-is-zfs/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/zfs-ubuntu-19-10.jpg?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Using_ZFS_Ubuntu.jpg?resize=800%2C450&ssl=1 +[5]: https://wiki.ubuntu.com/Kernel/Reference/ZFS +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/zpool-status.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/zfs-list.png?ssl=1 +[8]: https://arstechnica.com/information-technology/2019/10/a-detailed-look-at-ubuntus-new-experimental-zfs-installer/ +[9]: https://reddit.com/r/linuxusersgroup From 33f555ae41a70f2f70d4149ec54b713d837fcfb1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:51:16 +0800 Subject: [PATCH 534/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=20Troubl?= =?UTF-8?q?eshooting=20PCIe=20Bus=20Error=20severity=20Corrected=20on=20Ub?= =?UTF-8?q?untu=20and=20Linux=20Mint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191120 Troubleshooting PCIe Bus Error severity Corrected on Ubuntu and Linux Mint.md --- ...rity Corrected on Ubuntu and Linux Mint.md | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 sources/tech/20191120 Troubleshooting PCIe Bus Error severity Corrected on Ubuntu and Linux Mint.md diff --git a/sources/tech/20191120 Troubleshooting PCIe Bus Error severity Corrected on Ubuntu and Linux Mint.md b/sources/tech/20191120 Troubleshooting PCIe Bus Error severity Corrected on Ubuntu and Linux Mint.md new file mode 100644 index 0000000000..e2051d7401 --- /dev/null +++ b/sources/tech/20191120 Troubleshooting PCIe Bus Error severity Corrected on Ubuntu and Linux Mint.md @@ -0,0 +1,160 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Troubleshooting PCIe Bus Error severity Corrected on Ubuntu and Linux Mint) +[#]: via: (https://itsfoss.com/pcie-bus-error-severity-corrected/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +Troubleshooting PCIe Bus Error severity Corrected on Ubuntu and Linux Mint +====== + +Recently I was trying to install Mint on several nodes in my institute. At times, I was not able to install and got lots of ‘PCIe Bus’ errors on the screen. I have also observed similar issue with Ubuntu 18.04. + +I got stuck into it for more than a month, after using many solution and observations (solution is the same, but observation and treatment may be different), I found something which was helpful for me and I think could be helpful for other Ubuntu and Linux Mint users. + +### Observations about PCIe Bus Error severity Corrected + +![][1] + +It happened with my HP system and it seems that there is some compatibility issues with the HP hardware. The PCIe Bus Error is basically the Linux kernel reporting the hardware issue. + +This error reporting turns into nightmare because of the frequency of error messages generated by the system. I have noticed in various [Linux forums][2] that many HP user have encountered this error, probably HP needs to improve Linux support for their hardware. + +Do note that this doesn’t necessarily mean that you cannot use Linux on your HP system. You might be able to use Linux like everyone else. It’s just that seeing this message flashing on the screen on every boot is annoying and sometimes, it could lead to bigger troubles. + +If the system keeps on reporting, it will increase the log size. If you have limited space for root, it could mean that your system will stuck at the black screen displaying the PCIe error message and your system won’t be able to boot. + +Now that you know a few things, let’s see how to tackle this error. + +### Handling PCIe Bus Error messages if you can boot in to your Linux system + +If you see the PCIe Bus Error message on the screen while booting but you are still able to log in, you could do a workaround for this annoyance. + +You can do little on the hardware compatibility front. I mean you (most probably) cannot go ahead and start coding drivers for your hardware or fix the existing drivers code. If your system works fine, your main concern should be that too much of error reporting doesn’t eat up the disk space. + +In that regard, you can change the Linux kernel parameter and ask it to stop reporting the PCIe errors. To do that, you need to edit the grub configuration. + +Basically, you just have to use a text editor for editing the file. + +First thing first, make a backup of your grub config file so that you can revert in case if you are not sure of things you changed. Open a terminal and use the following command: + +``` +cp /etc/default/grub ~/grub.back +``` + +Now open the file with Gedit for editing: + +``` +sudo gedit /etc/default/grub +``` + +Look for the line that has **GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”** + +Add pci=noaer in this line. AER stands for Advanced Error Reporting and ‘noaer’ asks the kernel to not use/log Advanced Error Reporting. The changed line should look like this: + +``` +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=noaer" +``` + +Once you have saved the file, you should update the grub using this command: + +``` +sudo update-grub +``` + +[Restart Ubuntu][3] and you shouldn’t see the ‘PCIe Bus Error severity Corrected messages’ anymore. + +If this doesn’t fix the issue for you, you can try to change other kernel parameters. + +#### Further troubleshooting: Disable MSI + +Now you are resorting to hit and trial. You may try disabling [MSI][4]. Though Linux kernel supports MSI for several years now, a wrong implementation of MSI from some hardware manufacturer may lead to the PCIe errors. + +The drill is practically the same as you saw in the previous section. You edit the grub configuration and make the GRUB_CMDLINE_LINUX_DEFAULT line look like this: + +``` +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=nomsi" +``` + +Update grub and reboot the system: + +``` +sudo update-grub +``` + +#### Even further troubleshooting: Disable mmconf + +I know it’s getting repetitive but if you are still facing the issue, it could be worth to give this a last try. This time, disable the mmconf parameter in Linux kernel. + +mmconf means memory mapped config and if you have an old computer, a buggy BIOS may lead to this issue. + +The steps remain the same. Just change the line GRUB_CMDLINE_LINUX_DEFAULT in your grub config to make it look like: + +``` +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=nommconf" +``` + +#### Can’t boot! How to edit grub config now? + +In some cases, if you are not even able to boot at all, perhaps your root is out of space. An idea here would be to delete old log files and see if you could boot now and if yes, change the grub config. + +On reboot, if you stuck with logs on the screen and do a hard boot (use power button to turn it off and on again). When you power on, choose to go in to recovery mode from the grub screen. It should be under Advanced options. + +![][5] + +If your system doesn’t show the grub screen, press and hold shift key at boot. In some systems, pressing the Esc key brings the grub screen. + +In the advanced option->recovery mode: + +![][6] + +Drop into root shell: + +![][7] + +If you use the ls command to find large files, you’ll see that sys.log and kern.log take huge space: + +``` +ls -s -S /var/log +``` + +You can [empty the log files in Linux command line][8] this way: + +``` +$ > syslog +$ > kern.log +``` + +Once that is done, reboot your system. You should be able to log in. You should quickly change the grub parameters as discussed above. Adding pci=noaer should help you in this case. + +I know it’s more of a workaround than solution. But this is something that troubled me long and helped me get around the error. Otherwise I had to reinstall the system. + +I just wanted to share what worked for me with the community here. I hope it helps you as well. + +This article is written by Arun Shrimali. Arun is IT Head at Resonance Institute in India and he tries to implement Open Source Software across his organization. + +The article has been edited by Abhishek Prakash. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pcie-bus-error-severity-corrected/ + +作者:[Community][a] +选题:[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/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/troubleshooting_linux.png?ssl=1 +[2]: https://itsfoss.community/ +[3]: https://linuxhandbook.com/restart-ubuntu-server/ +[4]: https://en.wikipedia.org/wiki/Message_Signaled_Interrupts +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2012/07/new-grub-menu-ubuntu.png?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2012/07/boot-into-recovery-mode-ubuntu-1.jpg?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2012/07/drop-to-root-prompt-1.png?ssl=1 +[8]: https://linuxhandbook.com/empty-file-linux/ From bcdfdc44d17788a9b8e7ba0db0c6202306b59056 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:52:08 +0800 Subject: [PATCH 535/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191119=20Contai?= =?UTF-8?q?ner=20reality=20checks=20and=20more=20industry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191119 Container reality checks and more industry trends.md --- ...reality checks and more industry trends.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 sources/tech/20191119 Container reality checks and more industry trends.md diff --git a/sources/tech/20191119 Container reality checks and more industry trends.md b/sources/tech/20191119 Container reality checks and more industry trends.md new file mode 100644 index 0000000000..5f5477e0aa --- /dev/null +++ b/sources/tech/20191119 Container reality checks and more industry trends.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Container reality checks and more industry trends) +[#]: via: (https://opensource.com/article/19/11/container-reality-checks-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Container reality checks and more industry trends +====== +A weekly look at open source community, market, and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [The benefits of gamification in business][2] + +> While its value as an industry is still growing each year, it seems that some organisations are still struggling to implement gamification technology in the first place or engage employees once they have. Early difficulties revolved around a lack of real clarity as to what gamification is and how it can help an organisation. This fed into poor initial results that have dampened enthusiasm among early adopters. There was also a belief that a one-size-fits-all approach could be used, regardless of the circumstances, the demographics of the teams involved or the processes being gamified. For the persistent, these early forays provided valuable lessons that rendered future projects more successful. + +**The impact**: The science fiction fan in me always found the idea of gamification dystopian; a way to trick employees into caring about things they otherwise wouldn't. The summer camp counselor in me recognizes the power of play in learning and teaching. Hopefully, that is the way the pendulum is swinging. + +## [Compare three distinct types of Kubernetes platforms][3] + +> Let's explore the benefits and risks of three types of Kubernetes platforms: the native open source tool, managed cloud services, and integrated ecosystems. We'll examine the technical features each option offers, the extent to which it supports enterprise container and cloud environments, and ease of use. + +**The impact**: This is all the other stuff that you should have been thinking about when you started to get hype on containers, and none of it comes for free. + +## [Deeply understanding the difference between portability, compatibility, and supportability][4] + +> Since the OCI standard governs the images specification, a container image can be created with Podman, pushed to almost any container registry, shared with the world, and consumed by almost any container engine including Docker, RKT, CRI-O, containerd and, of course, other Podman instances. Standardizing on this image format lets us build infrastructure like registry servers which can be used to store any container image, be it RHEL 6, RHEL 7, RHEL8, Fedora, or even Windows container images. + +**The impact**: Another container reality check that also drives home why going through the trouble of standards can be worth it in the long run. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/container-reality-checks-and-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://social.hays.com/2019/11/05/benefits-of-gamification-in-business/ +[3]: https://searchitoperations.techtarget.com/feature/Compare-3-distinct-types-of-Kubernetes-platforms +[4]: http://crunchtools.com/deeply-understanding-the-different-between-portability-compatibility-and-supportability/ From 61b5d1198567f26b5f9d3b181d1df240f77d6920 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:52:56 +0800 Subject: [PATCH 536/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191119=20Top=20?= =?UTF-8?q?10=20Vim=20plugins=20for=20programming=20in=20multiple=20langua?= =?UTF-8?q?ges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md --- ...s for programming in multiple languages.md | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md diff --git a/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md b/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md new file mode 100644 index 0000000000..c194f20d88 --- /dev/null +++ b/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Top 10 Vim plugins for programming in multiple languages) +[#]: via: (https://opensource.com/article/19/11/vim-plugins) +[#]: author: (Maxim Burgerhout https://opensource.com/users/wzzrd) + +Top 10 Vim plugins for programming in multiple languages +====== +Make your life as a programmer or sysadmin a little better with these 10 +plugins for Vim. +![OpenStack source code \(Python\) in VIM][1] + +I've been a user of the [Vim][2] text editor for about two decades. For a little while, I have been customizing my Vim configuration, only using plugins for the last couple of years. + +Recently, when I was redoing my setup (as I do every so often), I decided it was a good opportunity to identify the best Vim plugins for programming in multiple languages and a way to combine those plugins for each language I program in. + +I do use certain plugins for specific languages and profiles (e.g., I only install Rocannon in my Ansible profile), and I won't go into those here—that would be a _long_ list. But the 10 Vim plugins described below are my favorites, the ones I use in virtually every profile I have, no matter what programming language I'm using. + +### 1\. Volt + +My number one pick isn't even a plugin; rather, it replaces plugins like [Vundle][3], so I'm listing it here. + +[Volt][4] is a Vim plugin manager that lives outside Vim. You can use it to install plugins and create combinations of plugins called "profiles." You can enable a new profile with a single command: **volt profile set myprofile**. That way, I can do things like enable the [indentpython][5] plugin for just my Python profile. Volt also offers a simple way to do per-plugin configurations. The configuration is shared between profiles, so you can install plugins once and use them in multiple profiles. + +Volt is still relatively new and not perfect (e.g., you can have just one configuration file per plugin, no matter how many profiles you are using), but apart from that, I find it extremely handy, extremely fast, and extremely simple. + +![Volt plugin][6] + +### 2\. Vim-Rainbow + +Except for Python, virtually all major programming languages use brackets. Round ones, square ones, and curly ones. Often, they use multiple pairs of brackets, with one pair embedded in another. Figuring out which closing bracket belongs to what opening bracket can become difficult and annoying. I often find myself counting round brackets—especially in complicated Bash scripts—to make sure I got everything right. + +Here's the [vim-rainbow][7] plugin to the rescue! It gives every pair of brackets a unique color, so it's easy to identify which brackets belong to each other. It's very useful and very colorful, too. + +![vim-rainbow plugin][8] + +### 3\. lightline + +There are a lot of plugins for Vim, such as [Powerline][9], that put a bar at the bottom of the screen to show you what file you are working on, where you are in the file, what type of file it is, etc. Each of these plugins has advantages and disadvantages, and after briefly weighing them, I chose [lightline][10]. It's relatively small, easy to set up, quite extensible if you are into that kind of thing, and doesn't require any other tooling or plugins. + +![Lightline plugin][11] + +### 4\. NERDTree + +[NERDTree][12] is a classic. In large projects, it can be hard to find the exact name and location of the one file that includes the one line you need to edit. With a quick keystroke (**F7**, in my case, as I bound NERDTree to F7 in my .vimrc configuration file), an explorer window opens in a vertical split, and I can easily browse to the file I want and open it. It's a must for large bodies of code. Or for people that tend to forget filenames, like me. + +![NERDTree vim plugin][13] + +### 5\. NERD Commenter + +All programmers, at some time, write code that introduces a hard-to-debug problem that leads them to decide to comment out or undo the code. This is where [NERD Commenter][14] comes in. Select the code, hit **Leader+cc**, and your code is commented. (The standard Vim Leader key is the **/** character.) Hit **Leader+cn,** and your code is uncommented. NERD Commenter should automatically use the right commenting character for most file types. For example, if you are editing a [BIND zone file][15] and set the file type to bind zone, Vim will correctly use the **;** (semicolon) character to comment lines out. + +![NERD Commenter][16] + +### 6\. Solarized + +I love my Vim colors. Really, I love terminal colors in general. I've been using the [Solarized][17] color scheme for Vim for a long time, and I set up my terminal, dir_colors, and Vim to be consistent. + +Every now and then, though, I toggle between light and dark modes, depending on what kind of environment I'm in, the amount of light falling on my screen, and whether I need to put something on a big screen for others to read. + +Obviously, you can grab any ol' color scheme you like, but I like the fact that Solarized has light and dark modes, an easy way to switch between the two, and it's not too intrusive. My second choice is [Monokai][18]. The Volt plugin manager makes it easy for me to switch between the two, so I can use Monokai for Python programming and Solarized for Bash. + +I'm not including an image for Solarized, because all the other images in this article use Solarized light or dark, so check them out. + +### 7\. fzf + +When you're looking for a file, sometimes you want a file explorer, and sometimes you just want to ram something on your keyboard that vaguely resembles the filename you are looking for, amirite? + +The [fzf][19] (or "fuzzy finder") plugin gives you just that. Hit **:FZF** and start typing. An ever-shortening list will show you files that more or less match what you are looking for. I use this a lot, probably even more than NERDTree these days. A slight downside is that this plugin has an external dependency in the fzf binary, so you'll have to install that, too. It's available for Fedora, Debian and, Arch, but I don't think it exists for EPEL. + +![fzf Vim plugin][20] + +### 8\. ack + +Every once in a while, you want to search for a file that contains a certain line or a certain word. I really like the [ack][21] plugin for this, preferably in combination with **ag**, a command known as "the [silver searcher][22]." This combination is phenomenally fast and covers the vast majority of things I would use **grep** or **vimgrep** for. The downside is you'll need to install either ack or ag for it to work. The good news is that both ag and ack are available for Fedora and EPEL7. + +![ack vim plugin][23] + +### 9\. gitgutter + +The majority of IT folks have worked with [Git][24] and files in Git repositories. The [gitgutter][25] plugin adds a column near your line numbers that shows symbols for changed (**~**), added (**+**), and removed (**-**) lines. This is quite useful for keeping track of what you have changed, and it keeps you focused on the task at hand, like writing a patch to fix one key bug. This plugin has a slight performance gap, and it sometimes takes a quick second for the plugin to catch up with your changes, but it's still quite useful. + +![gitgutter vim plugin][26] + +### 10\. Tag List + +If you are programming in a file of any significant size, it's easy to lose track of where you are, and you might find yourself scrolling up and down looking for a certain function. With the [Tag List][27] plugin, you can just type **:Tlist** and get a vertical split with variables, types, classes, and functions that you can easily jump to. This works for a host of languages, like Java, Python, and any other file type the **ctags** utility works with … which is a lot. + +![Tag List vim plugin][28] + +So there you are: the 10 plugins for Vim that have made my life as a sysadmin and part-time programmer a little easier and a little better. What Vim plugins you are using? Please share your favorites in the comments. + +Vim offers great benefits to writers, regardless of whether they are technically minded or not. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/vim-plugins + +作者:[Maxim Burgerhout][a] +选题:[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/wzzrd +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm (OpenStack source code (Python) in VIM) +[2]: https://www.vim.org/ +[3]: https://github.com/VundleVim/Vundle.vim +[4]: https://github.com/vim-volt/volt +[5]: https://github.com/vim-scripts/indentpython.vim +[6]: https://opensource.com/sites/default/files/uploads/vim-volt.gif (Volt plugin) +[7]: http://github.com/frazrepo/vim-rainbow +[8]: https://opensource.com/sites/default/files/uploads/vim-rainbox.png (vim-rainbow plugin) +[9]: https://github.com/powerline/powerline +[10]: http://github.com/itchyny/lightline.vim +[11]: https://opensource.com/sites/default/files/uploads/lightline.png (Lightline plugin) +[12]: http://github.com/scrooloose/nerdtree +[13]: https://opensource.com/sites/default/files/uploads/nerdtree.gif (NERDTree vim plugin) +[14]: http://github.com/scrooloose/nerdcommenter +[15]: https://en.wikipedia.org/wiki/Zone_file#File_format +[16]: https://opensource.com/sites/default/files/uploads/nerdcommenter.gif (NERD Commenter) +[17]: https://github.com/altercation/vim-colors-solarized +[18]: https://github.com/sickill/vim-monokai +[19]: https://github.com/junegunn/fzf.vim +[20]: https://opensource.com/sites/default/files/uploads/fzf.gif (fzf Vim plugin) +[21]: https://github.com/mileszs/ack.vim +[22]: https://github.com/ggreer/the_silver_searcher +[23]: https://opensource.com/sites/default/files/uploads/ack.gif (ack vim plugin) +[24]: https://opensource.com/resources/what-is-git +[25]: https://github.com/airblade/vim-gitgutter +[26]: https://opensource.com/sites/default/files/uploads/gitgutter.png (gitgutter vim plugin) +[27]: https://github.com/vim-scripts/taglist.vim +[28]: https://opensource.com/sites/default/files/uploads/taglist.gif (Tag List vim plugin) From 72b3d689e8fbf302a9dc6f618f1a8b3812d9e4da Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:54:36 +0800 Subject: [PATCH 537/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191119=20How=20?= =?UTF-8?q?to=20use=20pkgsrc=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191119 How to use pkgsrc on Linux.md --- .../20191119 How to use pkgsrc on Linux.md | 226 ++++++++++++++++++ 1 file changed, 226 insertions(+) create mode 100644 sources/tech/20191119 How to use pkgsrc on Linux.md diff --git a/sources/tech/20191119 How to use pkgsrc on Linux.md b/sources/tech/20191119 How to use pkgsrc on Linux.md new file mode 100644 index 0000000000..2298e4933e --- /dev/null +++ b/sources/tech/20191119 How to use pkgsrc on Linux.md @@ -0,0 +1,226 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use pkgsrc on Linux) +[#]: via: (https://opensource.com/article/19/11/pkgsrc-netbsd-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to use pkgsrc on Linux +====== +NetBSD's package manager is generic, flexible, and easy. Here's how to +use it. +![A person programming][1] + +NetBSD is famous for running on basically anything, but did you know its _second_ claim to fame is the **[pkgsrc][2]** package manager? Like NetBSD, pkgsrc runs on basically anything, or at least anything Unix and Unix-like. You can install pkgsrc on BSD, Linux, Illumos, Solaris, and Mac. All told, over 20 operating systems are supported. + +### Why use pkgsrc? + +With the exception of MacOS, all Unix operating systems ship with a package manager included. You don't necessarily _need_ pkgsrc, but here are three great reasons you may want to try it: + + * **Packaging.** If you're curious about packaging but have yet to try creating a package yourself, pkgsrc is a relatively simple system to use, especially if you're already familiar with Makefiles and build systems like [GNU Autotools][3]. + * **Generic.** If you use multiple operating systems or distributions, then you probably encounter a package manager for each system. You can use pkgsrc across disparate systems so that when you package an application for one, you've packaged it for all of them. + * **Flexible.** In many packaging systems, it's not always obvious how to choose a binary package or a source package. With pkgsrc, the distinction is clear, both methods of installing are equally as easy, and both resolve dependencies for you. + + + +### How to install pkgsrc + +Whether you're on BSD, Linux, Illumos, Solaris, or MacOS, the installation process is basically the same: + + 1. Use CVS to check out the pkgsrc tree + 2. Bootstrap the pkgsrc system + 3. Install packages + + + +#### Use CVS to check out the pkgsrc tree + +Before Git, before Subversion, there was **[CVS][4]**. You don't have to know much about CVS to do a checkout of its code—if you're used to Git, then think of _checkout_ as _clone_. When you perform a CVS checkout of pkgsrc, you're downloading "recipes" detailing how each package is to be built. It's a lot of files, but they're small because you're not actually pulling the source code for each package, just the build infrastructure and Makefiles required to build on it demand. Using CVS makes it easy for you to update your pkgsrc checkout when a new one is released. + +The pkgsrc docs recommend keeping your tree in the **/usr** directory, so you must use **sudo** (or become root) to use this command: + + +``` +$ cd /usr +$ sudo cvs -q -z2 \ +  -d [anoncvs@anoncvs.NetBSD.org][5]:/cvsroot \ +  checkout -r pkgsrc-2019Q3 -P pkgsrc +``` + +As I'm writing, the latest release is 2019Q3. Check the news section of [pkgsrc.org][6]'s homepage or the [NetBSD documentation][7] to determine the latest release version. + +#### Bootstrap pkgsrc + +After the pkgsrc tree has copied to your computer, you have a **/usr/pkgsrc** directory filled with build scripts. Before you can use them, you must bootstrap pkgsrc so that you have easy access to the relevant commands you need to build and install the software. + +The way you bootstrap **pkgsrc** depends on the OS you're on. + +For NetBSD, you can just use the bundled bootstrapper: + + +``` +# cd pkgsrc/bootstrap +# ./bootstrap +``` + +On other systems, there are better ways with some customized features included, provided by Joyent. To find out the exact command to run, visit [pkgsrc.joyent.com][8]. For example, on Linux (Fedora, Debian, Slackware, and so on): + + +``` +$ curl -O \ +  +$ BOOTSTRAP_SHA="eb0d6911489579ca893f67f8a528ecd02137d43a" +``` + +Even though the path suggests that the included files are for RHEL 7, the binaries tend to be compatible with all but the most cutting-edge Linux distributions. And should you find a binary incompatible with the distribution you're on, you have the option to build from source. + +Verify the SHA1 checksum: + + +``` +$ echo "${BOOTSTRAP_SHA}" bootstrap-trunk*gz > check-shasum +sha1sum -c check-shasum +``` + +You can also verify the PGP signature: + + +``` +$ curl -O \ + +curl -sS | gpg --import +gpg --verify ${BOOTSTRAP_TAR}{.asc,} +``` + +Once you're confident that you have the right bootstrap kit, install it to **/usr/pkg**: + + +``` +`sudo tar -zxpf ${BOOTSTRAP_TAR} -C /` +``` + +This provides you with the usual pkgsrc commands. Add these locations to [your PATH][9]: + + +``` +$ echo "PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH" >> ~/.bashrc +$ echo "MANPATH=/usr/pkg/man:$MANPATH" >> ~/.bashrc +``` + +If you'd rather use pkgsrc without relying on Joyent's builds, you can just run the **bootstrap** script you got with the pkgsrc tree. Read the relevant README file in the **bootstrap** directory before running it for important system-specific notes. + +![Bootstrapping pkgsrc on NetBSD][10] + +### How to install software with pkgsrc + +Installing a precompiled binary (as you would with DNF or Apt) with pkgsrc is easy. The command for binary installs is **pgkin**, which has its own dedicated site at [pkgin.net][11]. The process ought to feel pretty familiar to anyone who's used Linux. + +To search for the **tmux** package: + + +``` +`$ pkgin search tmux` +``` + +To install the tmux package: + + +``` +`$ sudo pkgin install tmux` +``` + +The **pkgin** command's aim is to mimic the behavior of typical Linux package managers, so there are options to list available packages, to query available packages to find what provides a specific executable, and so on. + +### How to build from source code with pkgsrc + +The real power of pkgsrc, though, is the ease of building a package from source. You downloaded all 20,000+ build scripts in the first setup step, and you can access those by navigating into your pkgsrc tree directly. + +For example, to build **tcsh** from source, first, locate the build script: + + +``` +$ find /usr/pkgsrc -type d -name "tcsh" +/usr/pkgsrc/shells/tcsh +``` + +Next, change into the source directory: + + +``` +`$ cd /usr/pgksrc/shells/tcsh` +``` + +The build script directory contains a number of files to help the application build on your system, but notably, it contains the **DESCR** file, which contains a description of the software, as well as the **Makefile** that triggers the build. + + +``` +$ ls +CVS    DESCR     Makefile +PLIST  distinfo  patches +$ cat DESCR +TCSH is an extended C-shell with many useful features like +filename completion, history editing, etc. +$ +``` + +When you're ready, build, and install: + + +``` +`$ sudo bmake install` +``` + +The pkgsrc system uses the **bmake** command (provided by the pkgsrc checkout in the first step), so be sure to use **bmake** (and not **make** out of habit). + +If you're building for several systems, you can create a package instead of installing right away: + + +``` +$ cd /usr/pgksrc/shells/tcsh +$ sudo bmake package +[...] +=> Creating binary package in /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz +``` + +The packages that pkgsrc creates are standard tarballs, but they can be installed conveniently with **pkg_add**: + + +``` +$ sudo pkg_add /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz +tcsh-X.Y.Z: adding /usr/pkg/bin/tcsh to /etc/shells +$ tcsh +localhost% +``` + +The **pkgtools** collection from pkgsrc provides the **pkg_add**, **pkg_info**, **pkg_admin**, **pkg_create**, and **pkg_delete** commands to help manage packages you build and maintain on your system. + +### Pkgsrc for easy management + +The pkgsrc system offers a direct, hands-on approach to package management. If you're looking for a package manager that stays out of your way and invites customization, give pkgsrc a try on whatever Unix or Unix-like OS you're running. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/pkgsrc-netbsd-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/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: http://pkgsrc.org +[3]: https://opensource.com/article/19/7/introduction-gnu-autotools +[4]: http://www.netbsd.org/developers/cvs-repos/cvs_intro.html#intro +[5]: mailto:anoncvs@anoncvs.NetBSD.org +[6]: http://pkgsrc.org/ +[7]: http://www.netbsd.org/docs/pkgsrc/getting.html +[8]: http://pkgsrc.joyent.com/ +[9]: https://opensource.com/article/17/6/set-path-linux +[10]: https://opensource.com/sites/default/files/uploads/pkgsrc-bootstrap.jpg (Bootstrapping pkgsrc on NetBSD) +[11]: http://pkgin.net From 3e41d6cbbeb9dd75100f22ea2fc7c5bb37407727 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:56:18 +0800 Subject: [PATCH 538/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191119=20What?= =?UTF-8?q?=20is=20a=20community=20of=20practice=20in=20an=20open=20organi?= =?UTF-8?q?zation=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191119 What is a community of practice in an open organization.md --- ...ity of practice in an open organization.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20191119 What is a community of practice in an open organization.md diff --git a/sources/tech/20191119 What is a community of practice in an open organization.md b/sources/tech/20191119 What is a community of practice in an open organization.md new file mode 100644 index 0000000000..65e9ce464c --- /dev/null +++ b/sources/tech/20191119 What is a community of practice in an open organization.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is a community of practice in an open organization?) +[#]: via: (https://opensource.com/open-organization/19/11/what-is-community-practice) +[#]: author: (Tracy Buckner https://opensource.com/users/tracyb) + +What is a community of practice in an open organization? +====== +If organizational silos are slowing your teams down, consider building +communities of practice to supercharge collaboration. +![Open community, gardeners and food co-op][1] + +Community is a fundamental component of open organizations. The [Open Organization Definition][2] notes that: + +> Shared values and purpose guide participation in open organizations, and these values—more so than arbitrary geographical locations or hierarchical positions—help determine the organization's boundaries and conditions of participation. + +In other words, people in open organizations often define their roles, responsibilities, and affiliations through shared interests and passions—not title, role, or position on an organizational chart. + +That means organizational leaders will find themselves invested in building communities inside their organizations, connecting like-minded people with one another to accelerate business objectives. + +For this reason, communities of practice can be a useful component of open organizations. In this three-part series, I'll explain what communities of practice are, why they are beneficial to an organization, and how you can start a community of practice.  + +### Community at the core + +Community has always been central to organizations built on open principles. In fact, [The Open Source Way][3] explains community as: + +> … the group of people who form intentionally and spontaneously around something important to them. It includes the people who use or benefit from the project, those who participate and share the project to wider audiences, and the contributors who are essential to growth and survival. + +This definition informs our vision for communities of practice (CoPs) at Red Hat. + +In 1991, cognitive anthropologists [Jean Lave][4] and [Etienne Wenger][5] first coined the term "community of practice" while studying group learning. They defined it as “a group of people who share an interest, a craft, and/or a profession.” Communities of practice have been around since the beginning of civilization. Groups of people have come together telling stories, imparting wisdom, and passing on tradition. Any group of people can form a CoP—a group of teachers exploring a new topic, for example, or architects discussing a typical customer problem and identifying a resolution. + +Not all groups are communities of practice. A CoP must have a shared domain of interest, practitioners who share resources (tools, techniques, and ideas), and community members. A CoP forms at the intersection of those factors (see Figure 1). + +![][6] + +### Domain + +A community of practice is defined by a shared _domain_ of interest. It's not merely a group of friends hanging out together; members have a commitment to the success of the domain and a desire to share their knowledge. They value use cases, success stories, feedback, and learning from the other members. + +### Practice  + +A community of practice is not simply a group of people who like the same things (such as certain kinds of music). Members of CoPs are _practitioners_ who engage in shared activities, share resources, tools, techniques, and ideas. Together they develop ways of addressing problems in new ways. Members value interactions and seek knowledge from each other. Many often become thought leaders and experts in the domain. + +### Members + +Not all groups are communities of practice. A CoP must have a shared domain of interest, practitioners who share resources (tools, techniques, and ideas), and community members. + +Community of practice _members_ engage in joint activities and discussions, assist each other, and share their knowledge. They build relationships that enable them to learn from each other; they care about their standing with each other. Members of a community of practice participate regularly but do not necessarily work together on a daily basis.  + +[Wenger][7] suggests several characteristics and potential activities of communities of practice, including: + + * Problem-solving + * Making recommendations + * Sharing experiences + * Hosting community forums + * Developing shared measurement tools + * Building an argument for a policy campaign + * Growing confidence and encouraging representatives to speak out + * Discussing developments in communities and solutions to challenges + * Documenting data needed to move communities forward + * Coordinating visits to participants' sites to learn more about different approaches and perspectives + * Mapping knowledge and identifying gaps + + + +Communities of practice can form inside and across roles and departments in an open organization. When they do, they can help dissolve organizational silos by providing safe spaces for practitioners to come together as a community and work on a domain the members enjoy. + +Together, members can solve current problems—and innovative on new products and solutions. Communities of practice also provide an opportunity to learn from the interaction and open communication in the group. Members mentor and encourage each other to learn more and do more within the community. CoPs provide a place to begin personal branding and to find the confidence to reach out for other thought leadership activities. + +Communities of practice drawn together domain, practice, and members to provide benefits for both the members and the organization. They are a cost-effective way to enhance learning, reduce silos, and promote innovation. And as [Wegner][7] said, “We need others to complement and develop our own expertise.” + +In the next article in this series, we will discuss the benefits of a CoP in an organization. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/11/what-is-community-practice + +作者:[Tracy Buckner][a] +选题:[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/tracyb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_community_lead.jpg?itok=F9KKLI7x (Open community, gardeners and food co-op) +[2]: https://opensource.com/open-organization/resources/open-org-definition +[3]: http://www.theopensourceway.org/book/index.html +[4]: http://en.wikipedia.org/wiki/Jean_Lave +[5]: http://en.wikipedia.org/wiki/Etienne_Wenger +[6]: https://opensource.com/sites/default/files/resize/images/open-org/cop_figure1-500x460.png +[7]: https://wenger-trayner.com/wp-content/uploads/2015/04/07-Brief-introduction-to-communities-of-practice.pdf From 001d1e1b48c5c5da3946381c565b6e5f447167ec Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:56:47 +0800 Subject: [PATCH 539/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191118=20How=20?= =?UTF-8?q?containers=20work:=20overlayfs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191118 How containers work- overlayfs.md --- ...20191118 How containers work- overlayfs.md | 170 ++++++++++++++++++ 1 file changed, 170 insertions(+) create mode 100644 sources/tech/20191118 How containers work- overlayfs.md diff --git a/sources/tech/20191118 How containers work- overlayfs.md b/sources/tech/20191118 How containers work- overlayfs.md new file mode 100644 index 0000000000..c9ef0fe620 --- /dev/null +++ b/sources/tech/20191118 How containers work- overlayfs.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How containers work: overlayfs) +[#]: via: (https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/) +[#]: author: (Julia Evans https://jvns.ca/) + +How containers work: overlayfs +====== + +I wrote a comic about overlay filesystems for a potential future container [zine][1] this morning, and then I got excited about the topic and wanted to write a blog post with more details. Here’s the comic, to start out: + + + +### container images are big + +Container images can be pretty big (though some are really small, like [alpine linux is 2.5MB][2]). Ubuntu 16.04 is about 27MB, and [the Anaconda Python distribution is 800MB to 1.5GB][3]. + +Every container you start with an image starts out with the same blank slate, as if it made a copy of the image just for that container to use. But for big container images, like that 800MB Anaconda image, making a copy would be both a waste of disk space and pretty slow. So Docker doesn’t make copies – instead it uses an **overlay**. + +### how overlays work + +Overlay filesystems, also known as “union filesystems” or “union mounts” let you mount a filesystem using 2 directories: a “lower” directory, and an “upper” directory. + +Basically: + + * the **lower** directory of the filesystem is read-only + * the **upper** directory of the filesystem can be both read to and written from + + + +When a process **reads** a file, the overlayfs filesystem driver looks in the upper directory and reads the file from there if it’s present. Otherwise, it looks in the lower directory. + +When a process **writes** a file, overlayfs will just write it to the upper directory. + +### let’s make an overlay with `mount`! + +That was all a little abstract, so let’s make an overlay filesystem and try it out! This is just going to have a few files in it: I’ll make upper and lower directories, and a `merged` directory to mount the combined filesystem into: + +``` +$ mkdir upper lower merged work +$ echo "I'm from lower!" > lower/in_lower.txt +$ echo "I'm from upper!" > upper/in_upper.txt +$ # `in_both` is in both directories +$ echo "I'm from lower!" > lower/in_both.txt +$ echo "I'm from upper!" > upper/in_both.txt +``` + +Combining the upper and lower directories is pretty easy: we can just do it with `mount!` + +``` +$ sudo mount -t overlay overlay + -o lowerdir=/home/bork/test/lower,upperdir=/home/bork/test/upper,workdir=/home/bork/test/work + /home/bork/test/merged +``` + +There’s was an extremely annoying error message I kept getting while doing this, that said `mount: /home/bork/test/merged: special device overlay does not exist.`. This message is a lie, and actually just means that one of the directories I specified was missing (I’d written `~/test/merged` but it wasn’t being expanded). + +Okay, let’s try to read one of the files from the overlay filesystem! The file `in_both.txt` exists in both `lower/` and `upper/`, so it should read the file from the `upper/` directory. + +``` +$ cat merged/in_both.txt +"I'm from upper! +``` + +It worked! + +And the contents of our directories are what we’d expect: + +``` +find lower/ upper/ merged/ +lower/ +lower/in_lower.txt +lower/in_both.txt +upper/ +upper/in_upper.txt +upper/in_both.txt +merged/ +merged/in_lower.txt +merged/in_both.txt +merged/in_upper.txt +``` + +### what happens when you create a new file? + +``` +$ echo 'new file' > merged/new_file +$ ls -l */new_file +-rw-r--r-- 1 bork bork 9 Nov 18 14:24 merged/new_file +-rw-r--r-- 1 bork bork 9 Nov 18 14:24 upper/new_file +``` + +That makes sense, the new file gets created in the `upper` directory. + +### what happens when you delete a file? + +Reads and writes seem pretty straightforward. But what happens with deletes? Let’s do it! + +``` +$ rm merged/in_both.txt +``` + +What happened? Let’s look with `ls`: + +``` +ls -l upper/in_both.txt lower/lower1.txt merged/lower1.txt +ls: cannot access 'merged/in_both.txt': No such file or directory +-rw-r--r-- 1 bork bork 6 Nov 18 14:09 lower/in_both.txt +c--------- 1 root root 0, 0 Nov 18 14:19 upper/in_both.txt +``` + +So: + + * `in_both.txt` is still in the `lower` directory, and it’s unchanged + * it’s not in the `merged` directory. So far this is all what we expected. + * But what happened in `upper` is a little strange: there’s a file called `upper/in_both.txt`, but it’s a… character device? I guess this is how the overlayfs driver represents a file being deleted. + + + +What happens if we try to copy this weird character device file? + +``` +$ sudo cp upper/in_both.txt upper/in_lower.txt +cp: cannot open 'upper/in_both.txt' for reading: No such device or address +``` + +Okay, that seems reasonable, being able to copy this weird deletion signal file doesn’t really make sense. + +### you can mount multiple “lower” directories + +Docker images are often composed of like 25 “layers”. Overlayfs supports having multiple lower directories, so you can run + +``` +mount -t overlay overlay + -o lowerdir:/dir1:/dir2:/dir3:...:/dir25,upperdir=... +``` + +So I assume that’s how containers with many Docker layers work, it just unpacks each layer into a separate directory and then asks overlayfs to combine them all together together with an empty upper directory that the container will write its changes to it. + +### docker can also use btrfs snapshots + +Right now I’m using ext4, and Docker uses overlayfs snapshots to run containers. But I used to use btrfs, and then Docker would use btrfs copy-on-write snapshots instead. (Here’s a list of when Docker uses which [storage drivers][4]) + +Using btrfs snapshots this way had some interesting consequences – at some point last year I was running hundreds of short-lived Docker containers on my laptop, and this resulted in me running out of btrfs metadata space (like [this person][5]). This was really confusing because I’d never heard of btrfs metadata before and it was tricky to figure out how to clean up my filesystem so I could run Docker containers again. ([this docker github issue][6] describes a similar problem with Docker and btrfs) + +### it’s fun to try out container features in a simple way! + +I think containers often seem like they’re doing “complicated” things and I think it’s fun to break them down like this – you can just run one `mount` incantation without actually doing anything else related to containers at all and see how overlays work! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/ + +作者:[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://wizardzines.com +[2]: https://hub.docker.com/_/alpine?tab=tags +[3]: https://hub.docker.com/r/continuumio/anaconda3/tags +[4]: https://docs.docker.com/storage/storagedriver/select-storage-driver/ +[5]: https://www.reddit.com/r/archlinux/comments/5jrmfe/btrfs_metadata_and_docker/ +[6]: https://github.com/moby/moby/issues/27653 From 94fcc5cd923407113fb073b23b17778b2f926efe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:57:19 +0800 Subject: [PATCH 540/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191118=20Some?= =?UTF-8?q?=20notes=20on=20vector=20drawing=20apps?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191118 Some notes on vector drawing apps.md --- ...91118 Some notes on vector drawing apps.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20191118 Some notes on vector drawing apps.md diff --git a/sources/tech/20191118 Some notes on vector drawing apps.md b/sources/tech/20191118 Some notes on vector drawing apps.md new file mode 100644 index 0000000000..7c57682fc6 --- /dev/null +++ b/sources/tech/20191118 Some notes on vector drawing apps.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Some notes on vector drawing apps) +[#]: via: (https://jvns.ca/blog/2019/11/18/some-notes-on-vector-drawing-apps/) +[#]: author: (Julia Evans https://jvns.ca/) + +Some notes on vector drawing apps +====== + +For the last year and a half I’ve been using the iPad Notability app to draw my [zines][1]. Last week I decided I wanted more features, did a bit of research, and decided to switch to Affinity Designer (a much more complicated program). So here are a few quick notes about it. + +The main difference between them is that Notability is a simple note taking app (aimed at regular people), and Affinity Designer is a vector graphics app (aimed at illustrators / graphic designers), like Adobe Illustrator. + +I’ve never used a serious vector graphics program before, so it’s been cool to learn what kinds of features are available! + +### Notability is super simple + +This is what the Notability UI looks like. There’s a pencil, an eraser, a text tool, and a selection tool. That’s basically it. I LOVED this simplicity when I started using Notability, and I made 4 zines using it (help! i have a manager!, oh shit, git!, bite size networking!, and http: use your browser’s language). + + + +Recently though, I’ve had a couple of problems with it, the main one being that text boxes and things drawn with the pencil tool don’t mix well. (In general Notability has been GREAT though and their support team has always been incredibly helpful when I’ve had questions.) + +### Affinity Designer is really complicated + +Affinity Designer, by comparison, is WAY more complicated. Here’s what the UI looks like: + + + +There are + + * 14 tools on the left + * 14 more panels on the right that alter what the tools do + * a bottom toolbar which has different options for each tool + * 2 menus which together have another 25 things or so that you can do + + + +I still don’t understand what all the tools do (what’s the difference between Pencil and Vector Brush? I don’t know!). But I’m pretty excited about this because (unlike with Notability) there are so many options that if I’m frustrated about something, 90% of the time there’s a way to do the thing I want! + +### switching from Notability to Affinity Designer is really easy + +Switching to Notability wasn’t the best: I [reverse engineered the file format][2] to transfer some files over but the quality was never the best (probably because of problems with my script) and I ended up having to redraw a lot of them in practice. + +With Affinity Designer, I can just + + * export a PDF with Notability (or anything else) + * import the PDF with Affinity Designer + * and then I can easily edit it and that’s it?!? + + + +It’s not perfect – the vector paths it comes up with are kind of weird, probably because of the way the PDF is – but it’s very good! It makes me feel confident that if I need to make a small edit to something I made in the past I can just import the PDF! + +### what can a vector drawing app do? + +here are a few things Affinity Designer can do that Notability can’t: + + * **custom paper sizes**: In Notability every page is 8.5x11, but usually I want something more like 5.5x8.5 which is a different aspect ratio (this is technically sort of possible in Notability by importing a PDF of the correct size but it’s a pain and it means you can’t use a grid) + * **custom colour palettes**: I can have the 10 colours I like to use in my comics all in one place + * **grouping objects together** – I can “group” a bunch of objects together so that I can easily resize and move them all together + * **two kinds of text box**. This is the kind of thing that I wouldn’t have understood 2 years ago but that now I LOVE – you can either have “art text” that acts like an image (no word wrap, gets bigger when you resize it) or “frame text” that has word wrap and doesn’t get bigger when you resize it. + * **really great import** – I can import a PDF or SVG and individually edit / move around parts of the PDF. Notability doesn’t have any import tools that let you edit after importing. + * **custom export options for printing**. I don’t understand what it **does** yet but there are export presets for print PDFs and it fixes some printing problems I was having! + + + +There are also a LOT more features that I’m not interested in but I’m pretty excited about those 6 things and it feels like an app that I won’t grow out of. + +### iPad apps are great + +I’ve been exclusively using Linux for the last 15 years where the image editing/media tools aren’t always great (though I really like Inkscape and I hear good things about Krita!), so it’s really cool to have access to all these great iPad apps. And the prices seem pretty reasonable: + + * Notability is $12 + * Affinity Designer is $20 + * LumaFusion (a nice video editor I’ve been using a little) is $30 + + + +It doesn’t make me want a Mac (I like the Linux desktop experience!), but it’s nice to have access to a bunch of these great tools. And I think a lot of these art tools work better on an iPad than on a computer anyway since you can just draw on the screen :) + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/11/18/some-notes-on-vector-drawing-apps/ + +作者:[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://wizardzines.com +[2]: https://jvns.ca/blog/2018/03/31/reverse-engineering-notability-format/ From a46ff08225630fe6a5648129609735bea8644647 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:58:03 +0800 Subject: [PATCH 541/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191119=20SD-WAN?= =?UTF-8?q?s=20Enable=20Scalable=20Local=20Internet=20Breakout=20but=20Pos?= =?UTF-8?q?e=20Security=20Risk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191119 SD-WANs Enable Scalable Local Internet Breakout but Pose Security Risk.md --- ...nternet Breakout but Pose Security Risk.md | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 sources/talk/20191119 SD-WANs Enable Scalable Local Internet Breakout but Pose Security Risk.md diff --git a/sources/talk/20191119 SD-WANs Enable Scalable Local Internet Breakout but Pose Security Risk.md b/sources/talk/20191119 SD-WANs Enable Scalable Local Internet Breakout but Pose Security Risk.md new file mode 100644 index 0000000000..00d559727b --- /dev/null +++ b/sources/talk/20191119 SD-WANs Enable Scalable Local Internet Breakout but Pose Security Risk.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SD-WANs Enable Scalable Local Internet Breakout but Pose Security Risk) +[#]: via: (https://www.networkworld.com/article/3454282/sd-wans-enable-scalable-local-internet-breakout-but-pose-security-risk.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +SD-WANs Enable Scalable Local Internet Breakout but Pose Security Risk +====== + +NatalyaBurova/istock + +SD-WAN streamlines how application traffic is routed from the branch, making it easier to create local internet breakout and allowing users to access cloud services directly from the branch. In an ideal [SD-WAN][1] scenario, every remote location and device has its own local internet breakout and corresponding security services. Yet, reality looks a lot different for many companies.  + +This is something network professionals have wanted to enable for decades. The problem was that setting up local internet breakout using traditional routers was not trivial and required a tremendous amount of engineering work so most businesses, except for the ones that had high levels of technical talent shied away. The shift to cloud and edge computing has made local internet breakout almost mandatory today, so businesses have turned to SD-WAN as a simpler path to enable it. As this happens, organizations need to understand the security risks.  + +Using broadband internet services to quickly send enterprise application traffic has many benefits, but it’s also risky since it exposes users and their local networks to the untrusted public internet. As [previously mentioned][2] in another post, EMA’s [WAN Transformation research][3] found companies that exclusively relied on the native security features in their SD-WAN devices were 1.3 times more likely to have a data breach, compared to those who supplemented their SD-WAN with additional layers of security.  + +Local internet breakout is a modern approach to the SD-WAN; it provides application awareness and automation that cannot be achieved with traditional routers. However, security shouldn’t be an afterthought when deploying it. Not all local internet breakout solutions can administer application-specific security policies in real-time or keep up with SaaS/IaaS changes and updates. + +In order to deliver the highest SaaS and IaaS performance, there are several local internet breakout requirements that must be addressed: + + * Application-driven security policies must be supported for all apps running over broadband internet + * Performance must be optimized without compromising security + * Security must be enforced with an integrated firewall to safeguard the branch from potential threats + * Service chaining to next generation firewalls or cloud-delivered security services must be automated + + + +When security enforcement is positioned close to branch locations, local internet breakout can provide enterprises with the desired application performance and protection. + +That’s where moving security to the cloud comes in. Cloud-hosted security services help enterprises centralize the entire security stack in the cloud instead of deploying costly security appliances at each branch location. A cloud-hosted security stack, like [Zscaler][4] or [Check Point][5], includes next-gen firewall services, as well as intrusion detection and prevention, URL filtering, antivirus protection, sandboxing, and much more. + +By shifting away from a hub-and-spoke architecture to a cloud-enabled architecture, enterprises can reduce cost and complexity, offer a better user experience, simplify their operations, and deploy new services faster—all without compromising security.  + +Learn more about how we can help with secure local internet breakout with SD -WAN at [SilverPeak.com][6] + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3454282/sd-wans-enable-scalable-local-internet-breakout-but-pose-security-risk.html + +作者:[Zeus Kerravala][a] +选题:[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/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.silver-peak.com/sd-wan/sd-wan-explained +[2]: https://blog.silver-peak.com/integrations-are-essential-to-secure-sd-wan +[3]: https://www.enterprisemanagement.com/research/asset.php/3683/Wide-Area-Network-Transformation:-How-Enterprises-Succeed-with-Software-Defined-WAN +[4]: https://www.silver-peak.com/sites/default/files/infoctr/zscaler-silver-peak-solution-brief.pdf +[5]: https://www.silver-peak.com/sites/default/files/infoctr/silver-peak-solution-brief-point-silver-peak-1019.pdf +[6]: http://www.silverpeak.com/ From eceef5c19fd7f96794ba9a998e7205e874ee3da1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 00:58:53 +0800 Subject: [PATCH 542/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191119=20Fortin?= =?UTF-8?q?et=20CEO:=20Network=20and=20security=20technologies=20give=20ri?= =?UTF-8?q?se=20to=20security-driven=20networking?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191119 Fortinet CEO- Network and security technologies give rise to security-driven networking.md --- ...give rise to security-driven networking.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/talk/20191119 Fortinet CEO- Network and security technologies give rise to security-driven networking.md diff --git a/sources/talk/20191119 Fortinet CEO- Network and security technologies give rise to security-driven networking.md b/sources/talk/20191119 Fortinet CEO- Network and security technologies give rise to security-driven networking.md new file mode 100644 index 0000000000..6a0ace8da9 --- /dev/null +++ b/sources/talk/20191119 Fortinet CEO- Network and security technologies give rise to security-driven networking.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fortinet CEO: Network and security technologies give rise to security-driven networking) +[#]: via: (https://www.networkworld.com/article/3453326/fortinet-ceo-network-and-security-technologies-give-rise-to-security-driven-networking.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Fortinet CEO: Network and security technologies give rise to security-driven networking +====== +A conversation about the future of network security with Fortinet CEO Ken Xie +The network and security industries both continue to evolve at a rate never seen before.  Historically, security and network operation teams have worked in parallel with one another, sometimes being at odds with each other's goals. + +However, that is changing as businesses rely on their networks to operate. It’s fair to say that today, for many companies, the network is the business. As this happens, network and security technologies need to be more closely aligned giving rise to the concept of security-driven networking. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +In this post, ZK Research had a chance to sit down with the co-founder and CEO of Fortinet Ken Xie to discuss the future of networking and security.  + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +**ZK: With things like digital transformation and [5G][3] constantly changing networks, where are we in terms of security today? Is security keeping up?** + +**Xie:** Security has to always be evolving. For a long time, security was all about securing connections. First-generation [firewalls][4] were placed between a LAN and the Internet to prevent criminals from gaining access to network resources. As those connections became faster, and more data was embedded in applications, security had to switch its focus from connections to the content. That’s when the second generation of network security began, with the introduction of the [next-generation firewall] NGFW. + +While those second-generation security tools have served their purposes, they no longer meet the needs of today’s digital businesses. Security can no longer function as a moat around a castle. Instead, today’s digital networks and data are distributed across growing numbers of virtual clouds, edges, and physical devices. Data is not only highly mobile, but it is also at greater risk as the attack surface increases. And as new edge networks emerge, driven by 5G and [SD-WAN][5], the challenges will only get bigger. + +In this new digital world, security needs to not only be integrated into the network but also help drive its development. With many new networking environments, such as [multi-cloud][6], next-gen branch, and the mobile edge, the challenge many organizations face is building a consistent and manageable security framework that can span digital innovation. Achieving this requires a security-driven networking strategy that not only asks, “How do we secure this?” but also, “How will this become part of our larger security-fabric architecture?”  + +Part of the answer involves solutions that seamlessly interoperate with security deployed across the network, such as in the cloud. Security-driven networking ensures that whenever networking infrastructures evolve or expand, security automatically adapts as an integrated part of the network rather than waiting to respond to changes, as traditional overlay security solutions do, which can introduce security gaps and inefficiencies. + +Other top concerns for both networks and security are performance and interconnectivity. Network and security policies both need to follow applications at digital speeds, especially as they move across and between different connected networks. The days of bolting on security and expecting it to protect businesses and consumers are over. To keep pace with the ongoing digital transformation of our interconnected environments, security and the network will have to converge. This is the only way that threat detection and prevention can continue to span the evolving network and respond at network speeds. + +Only security-driven and security-enabled networks will be able to ensure that detection and prevention are woven into every transaction, and then follow those transactions from origin to completion to ensure they are protected along their entire data path. + +**ZK: How does [the edge][7] factor into security, both today and going forward?** + +**Xie**: Traditionally, we interacted with the cyber world through a specific interface, such as a laptop or smart device. However, in this new digital world, traditional networks are being completely transformed. [Data centers][8] are moving to the cloud. Technology is converging with our physical world in the form of smart cars and wearables and even embedded devices and interactive communities. And for that to work, data and compute services will also need to be positioned at the edge, processing data locally. And rather than relying on one or two interfaces, we are now interacting with technology everywhere. + +The number of connected things already outnumbers people and will continue to grow quickly. A smart home today can have many different edges – smart appliances, voice-activated assistants, laptops, smartphones, connected security systems such as smart locks, and entertainment systems. To provide consistent protection for all of these connections, security will have to exist simultaneously in all of them. It has to be woven directly into the infrastructure. There is really no other way for this to work. + +**ZK:** **What are some of the security challenges of the growing [WAN][9] edge?** + +**Xie:** Next-gen branches and SD-WAN are perfect examples of how second-generation security no longer supports modern networking challenges. Organizations are moving to SD-WAN because their [MPLS][10] connections are too rigid for device and application interconnectivity. Traditional hub and spoke models don’t work because the central network hub is disappearing. And while an overlay [VPN][11] solution can support meshed connections between different branch offices, encrypting traffic isn’t enough either. + +SD-WAN is a great starting point to deeply interconnect security and networking into a single solution and where Fortinet has focused. SD-WAN needs to provide connectivity plus support advanced routing protocols, such as load balancing and optimizing connections and provide advanced security. If not, that branch will become the weakest link in your security chain. By tying those elements together into a single solution, and integrating network and security management into a single interface, organizations can realize the performance and interconnectivity benefits of tying networking and security solutions together. +A Secure SD-WAN strategy not only provides business-critical SaaS and productivity applications, and enables and secures live connections between all branch and cloud environments, it can also tie the local-branch LAN to the WAN to support and secure its functions as well. A truly integrated solution can support things like true zero-touch deployment, integrated and centralized management, and advanced traffic and connection management for network and security functions. + +**ZK: How do we provide adequate security performance as the edge becomes everywhere?** + +**Xie:** As end-user devices, applications and [IoT][12] grow and converge, billions of new edges will be created. Many of these edges will create and enable new immersive technologies, such as VR and AR-based communications and interactive tools that tie multiple services together, which will further enable things like autonomous cars and smart cities.  As solutions like these continue to evolve, they will further converge the physical and cyber worlds. Transactions and decisions will need to be made in microseconds, and they will need to be made locally, which means that decision-making can no longer rely on human intervention, whether you are talking about routing traffic, reacting to a physical event or responding to a cyber threat. + +In this new digital world, performance and interconnectivity are table stakes. So network and security convergence is not just about policies and protocols. The true performance will require the implementation of specialized physical and virtual processors that can accelerate decision making. We have spent years refining specially designed security processors that provide unmatched performance at a fraction of the cost of the traditional CPUs used by other vendors. And these aren’t just limited to security. Our new SD-WAN solutions include the world’s first customized processors designed to accelerate both security and networking functions so branch offices can function at the speeds that the digital marketplace requires. +We have also taken those same specialized engineering skills and developed new virtual ASICs to provide the same level of performance acceleration in a virtual environment. These new virtual security processors provide up to two to three  times the performance of traditional virtualized security solutions. This enables us to extend full advanced security solutions to the new 5G-powered network edge and still inspect encrypted data, accelerate local decision making, and support edge networking and computing at network-required speeds. + +**ZK: Is the edge going to replace the cloud?** + +**Xie:** We are going to need both, and they are going to have to be closely aligned. But the edge is going to push digital transformation in another new direction, and organizations need to get ready for that now. +Because of transactional timing requirements, compute resources have always had to be as physically close to data as possible. Mainframes were deployed inside physical data centers for this reason. Applications forced smartphones to be faster and smarter so decisions didn’t have to be made on some remote server. Today, as we move data from the physical data center to the cloud, compute resources have been deployed there as well so that the large amounts of data being collected by today’s businesses can be processed with scale and agility. + +The next big migration of data will be to the remote edge. IoT and mobile devices will need to support immersive technologies, which will require massive amounts of data and processing power. And for those services to respond at the speeds that applications and consumers require, data and computing resources will need to be placed on edge devices. This change will not only have a significant impact on networks but on how and where we deploy and manage security. + +This will affect security in two ways. First, to secure an edge built from an enormous number of interconnected devices, security will need to focus on prevention, which is a lot harder. And second, security will need to operate natively on those edge devices. That’s because high-performance transactions will not only require immediate decision-making, but they will also be rapidly moving across any number of edge devices through new edge-based networks. If security is to keep up, it will need to be converged with the edge and live on new edge-based IoT and networking devices.   + +And even then, things like AI are going to have to be built into the next generation of security solutions to meet the performance demands of 5G networks and beyond. Which is why Fortinet has spent the past decade building, training, and refining the largest and most comprehensive artificial neural network designed for security in the world. This AI network currently includes over billions of interconnected nodes, and since its training cycles were completed, it has now taken over critical threat detection and analysis functions that previously required teams of trained researchers to accomplish. And this success is why we have now begun to weave its advanced AI technology into our portfolio of security solutions – a feat that, like our advanced security and networking processors, no other vendor is even close to replicating. + +**Now see** [**Network pros react to new Cisco certification curriculum**][13] + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3453326/fortinet-ceo-network-and-security-technologies-give-rise-to-security-driven-networking.html + +作者:[Zeus Kerravala][a] +选题:[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/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[4]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html +[5]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[6]: https://www.networkworld.com/article/3429258/real-world-tools-for-multi-cloud-management.html +[7]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[8]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[9]: https://www.networkworld.com/article/3248989/what-is-a-wan-wide-area-network-definition-and-examples.html +[10]: https://www.networkworld.com/article/2297171/network-security-mpls-explained.html +[11]: https://www.networkworld.com/article/3268744/understanding-virtual-private-networks-and-why-vpns-are-important-to-sd-wan.html +[12]: https://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[13]: https://www.networkworld.com/article/3446044/network-pros-react-to-new-cisco-certification-curriculum.html +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world From c8055b136053da39c6eccc1a335fc93b4922b6d3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 20 Nov 2019 01:02:17 +0800 Subject: [PATCH 543/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191119=20Loops?= =?UTF-8?q?=20in=20Emacs=20Lisp?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191119 Loops in Emacs Lisp.md --- sources/tech/20191119 Loops in Emacs Lisp.md | 321 +++++++++++++++++++ 1 file changed, 321 insertions(+) create mode 100644 sources/tech/20191119 Loops in Emacs Lisp.md diff --git a/sources/tech/20191119 Loops in Emacs Lisp.md b/sources/tech/20191119 Loops in Emacs Lisp.md new file mode 100644 index 0000000000..66422100bf --- /dev/null +++ b/sources/tech/20191119 Loops in Emacs Lisp.md @@ -0,0 +1,321 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Loops in Emacs Lisp) +[#]: via: (https://opensourceforu.com/2019/11/loops-in-emacs-lisp/) +[#]: author: (Shakthi Kannan https://opensourceforu.com/author/shakthi-kannan/) + +Loops in Emacs Lisp +====== + +[![][1]][2] + +_This article in the Emacs series explores looping techniques that are available with Emacs Lisp._ + +T here are built-in constructs such as _while_ and _dolist_ that are shipped with the default GNU Emacs. The dash.el library provides functions to iterate over lists, and is written by Magnar Sveen. The latest release of dash.el is v2.16.0, and its source code is available at __ under the GNU General Public License v3.0. +Let us also explore the structures available in loop.el, another library for implementing imperative loops. This has been written by Wilfred Hughes, and has also been released under the GNU General Public License v3.0. + +**Installation** +The dash.el and loop.el packages are available in Milkypostman’s Emacs Lisp Package Archive (MELPA) and in the Marmalede repo. You can install the package using the following commands in GNU Emacs: + +``` +M-x package-install dash +M-x package-install loop +``` + +The other method of installation is to copy the dash.el and loop.el source files to your Emacs load path and load them. In order to get syntax highlighting of dash functions in Emacs buffers, you can add the following command to your Emacs initialisation settings: + +``` +(eval-after-load 'dash '(dash-enable-font-lock)) +``` + +If you are using Cask (__) to manage your Emacs configuration, then you can simply add the following code to your Cask file: + +``` +(depends-on "dash") +(depends-on "loop") +``` + +The usage of various loop construct is as follows. + +**Built-in** +GNU Emacs has built-in loop constructs. The _while_ function, for example, has the following syntax: + +``` +(while TEST BODY...) +``` + +The BODY code segment is evaluated if the result of TEST is not nil. Until TEST returns nil, the BODY will continue to be executed. An example of _while_ function usage is given below: + +``` +(setq alphabets '(a b c d e)) + +(defun print-list-elements (list) +"Print each element of the input LIST" +(while list +(print (car list)) +(setq list (cdr list)))) + +(print-list-elements alphabets) +``` + +The output is as follows: + +``` +a +b +c +d +e +nil +``` + +The ‘dolist’ macro loops over a list and is also built-in with Emacs. Its definition is as follows: + +``` +(dolist (VAR LIST [RESULT]) BODY...) +``` + +The VAR argument represents each element in LIST for every iteration in the BODY segment. The value in RESULT is returned by the function, and is optional. By default, a nil is returned. The ‘alphabet’ list elements can be printed using the _dolist_ macro as shown below: + +``` +(setq alphabets '(a b c d e)) +(dolist (element alphabets) +(print element)) +``` + +The resultant output is the same. + +``` +a +b +c +d +e +nil +``` + +**dash.el** +The dash.el list library provides functions to iterate over lists. The -each function, for example, takes a list and a function, and applies the function to every element in the list. In the following example, a reverse of the input list is created by doubling each element’s value. + +``` +(-each list function) ;; Syntax + +(let (s) (-each '(1 2 3) (lambda (item) (setq s (cons (* item 2) s)))) s) +(6 4 2) +``` + +Another function API from the dash.el library is the -each-while function, which takes three arguments – a list, a predicate and a function. The function is applied to every element in the list that satisfies the predicate. For example: + +``` +(-each-while list predicate function) ;; Syntax + +(defun even? (num) (= 0 (% num 2))) +(let (s) (--each-while '(1 2 3 4) (< it 3) (!cons it s)) s) +(2 1) +``` + +The _-each-r_ function takes a list and a function, and applies the function on every item in the list in the reverse order. An example is given below: + +``` +(-each-r list function) ;; Syntax + +(let (s) (-each-r '(1 2 3) (lambda (item) (setq s (cons (* item 2) s)))) s) + +(2 4 6) +``` + +If you would like to use a predicate function with _-each-r_, you can use the _-each-r-while_ function as illustrated below: + +``` +(-each-r-while list predicate function) ;; Syntax + +(let (s) (-each-r-while '(1 2 3 4 5 6) 'even? (lambda (item) (!cons item s))) s) +(6) +``` + +The _-dotimes_ function will repeatedly call a function from 0 to the input number, minus 1. + +``` +(-dotimes number function) ;; Syntax + +(let (s) (-dotimes 3 (lambda (n) (!cons n s))) s) +(2 1 0) +``` + +You can explore more of the iterative functions available in dash.el under the Side-effects section in the GitHub source repository available at __. + +**loop.el** +We shall now explore the constructs available in the _loop.el_ library. The loop-while construct executes the body of the loop while the condition is true. In the following example, the sum of the numbers from 0 to 5 is computed. + +``` +(require 'loop) + +;; loop-while +loop-while (condition body...) ;; Syntax + +(let ((x 0) +(sum 0)) +;; sum of 0..5 +(loop-while (< x 5) +(setq sum (+ sum x)) +(setq x (1+ x))) +sum) +10 +``` + +If you want to evaluate the body at least once before checking the condition, you can use the _loop-do-while_ construct. In the following example, the value of x is incremented by one and then the condition is satisfied for the loop execution. + +``` +loop-do-while (condition body...) ;; Syntax + +(let ((x 0) +(sum 0)) +;; sum of 1..4 +(loop-do-while (and (> x 0) (< x 5)) +(setq sum (+ sum x)) +(setq x (1+ x))) +sum) +10 +``` + +The _loop-until_ construct repeatedly evaluates the body of the code until the condition becomes true. For example: + +``` +loop-until (condition body...) ;; Syntax + +(let ((x 0) +(sum 0)) +;; sum of 0..4 +(loop-until (= x 5) +(setq sum (+ sum x)) +(setq x (1+ x))) +sum) +10 +``` + +The _loop-for-each_ construct takes three arguments – a var, a list and a body. The var represents an element in the list for the iteration. In the following example, the sum of numbers from 1 to 5 is calculated. + +``` +loop-for-each (var list body...) ;; Syntax + +(let ((sum 0)) +(loop-for-each x (list 1 2 3 4 5) +(setq sum (+ sum x))) +sum) +15 +``` + +A couple of constructs are available to break or continue execution within a loop. The _loop-break_ construct breaks out of the innermost loop. For example: + +``` +loop-break () ;; Syntax + +(let ((sum 0)) +;; sum 1..5 +(loop-for-each x (list 1 2 3 4 5 6) +(setq sum (+ sum x)) +(when (= x 5) +(loop-break))) +sum) +15 +``` + +The _loop-continue_ construct will skip the rest of the current loop-while, loop-do-while or loop-for-each block and will proceed to the next iteration in the loop. In the following example, the list is iterated for elements between 1 and 6, and is skipped when the iteration matches the element 2. + +``` +loop-continue () ;; Syntax + +(let ((sum 0)) +;; sum the numbers 1, 3, 5 +(loop-for-each x (list 1 2 3 4 5 6) +(when (= x 2) +(loop-continue)) +(setq sum (+ sum x))) +sum) +19 +``` + +The loop.el library has unit tests included in the source code, which you can run to validate the defined constructs. In order to run the tests, you need to first clone the source repository using the following commands: + +``` +$ git clone https://github.com/Wilfred/loop.el +Cloning into 'loop.el'... +remote: Enumerating objects: 232, done. +remote: Total 232 (delta 0), reused 0 (delta 0), pack-reused 232 +Receiving objects: 100% (232/232), 31.29 KiB | 801.00 KiB/s, done. +Resolving deltas: 100% (117/117), done. +``` + +If you do not have Cask, install it using the instructions provided in the README file at __. +You can then change the directory into the cloned loop.el folder, and run cask install. This will locally install the required dependencies for running the tests. + +``` +$ cd loop.el/ +$ cask install +Loading package information... Select coding system (default utf-8): +done +Package operations: 3 installs, 0 removals +- Installing [ 1/3] undercover (latest)... done +- Installing [ 2/3] ert-runner (latest)... done +- Installing [ 3/3] f (latest)... already present +``` + +A _Makefile_ exists in the top-level directory, the contents of which are provided below for reference: + +``` +$ cat Makefile +CASK ?= cask +EMACS ?= emacs + +all: test +test: unit + +unit: +${CASK} exec ert-runner + +install: +${CASK} install +``` + +You can now simply run _make_ test at the shell prompt to execute the tests as shown below: + +``` +$ make test +cask exec ert-runner +................. + +Ran 17 tests in 0.001 seconds +``` + +Readers are encouraged to go through the README file at for more information. + +![Avatar][3] + +[Shakthi Kannan][4] + +The author is a free software developer at the Fedora project, and also a blogger. He co-maintains the Fedora Electronic Lab project. + +[![][5]][6] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/loops-in-emacs-lisp/ + +作者:[Shakthi Kannan][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/shakthi-kannan/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/01/Tips-to-hire-a-web-developer-with-skills-in-2019.jpg?resize=696%2C365&ssl=1 (Tips to hire a web developer with skills in 2019) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/01/Tips-to-hire-a-web-developer-with-skills-in-2019.jpg?fit=1200%2C630&ssl=1 +[3]: https://secure.gravatar.com/avatar/d6df0aa46ea197a6e5a6b80bba666830?s=100&r=g +[4]: https://opensourceforu.com/author/shakthi-kannan/ +[5]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[6]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From f35fd42f643e82caa392c0b5b887c71f2152b3c7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 20 Nov 2019 08:44:33 +0800 Subject: [PATCH 544/800] translated --- .../tech/20191114 Cleaning up with apt-get.md | 98 ------------------- .../tech/20191114 Cleaning up with apt-get.md | 90 +++++++++++++++++ 2 files changed, 90 insertions(+), 98 deletions(-) delete mode 100644 sources/tech/20191114 Cleaning up with apt-get.md create mode 100644 translated/tech/20191114 Cleaning up with apt-get.md diff --git a/sources/tech/20191114 Cleaning up with apt-get.md b/sources/tech/20191114 Cleaning up with apt-get.md deleted file mode 100644 index b251d10030..0000000000 --- a/sources/tech/20191114 Cleaning up with apt-get.md +++ /dev/null @@ -1,98 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cleaning up with apt-get) -[#]: via: (https://www.networkworld.com/article/3453032/cleaning-up-with-apt-get.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Cleaning up with apt-get -====== -Most of us with Debian-based systems use apt-get routinely to install packages and upgrades, but how often do we pull out the cleaning tools? Let's check out some of the tool's options for cleaning up after itself. -[Félix Prado Modified by IDG Comm.][1] [(CC0)][2] - -Running **apt-get** commands on a Debian-based system is routine. Packages are updated fairly frequently and commands like **apt-get update** and **apt-get upgrade** make the process quite easy. On the other hand, how often do you use **apt-get clean**, **apt-get autoclean** or **apt-get autoremove**? - -These commands clean up after apt-get's installation operations and remove files that are still on your system but are no longer needed – often because the application that required them is no longer installed. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] - -### apt-get clean - -The apt-get clean command clears the local repository of retrieved package files that are left in **/var/cache**. The directories it cleans out are **/var/cache/apt/archives/** and **/var/cache/apt/archives/partial/**. The only files it leaves in **/var/cache/apt/archives** are the **lock** file and the **partial** subdirectory. - -[][4] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][4] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -You might have a number of files in the directory prior to running the clean operation: - -``` -/var/cache/apt/archives/db5.3-util_5.3.28+dfsg1-0.6ubuntu1_amd64.deb -/var/cache/apt/archives/db-util_1%3a5.3.21~exp1ubuntu2_all.deb -/var/cache/apt/archives/lock -/var/cache/apt/archives/postfix_3.4.5-1ubuntu1_amd64.deb -/var/cache/apt/archives/sasl2-bin_2.1.27+dfsg-1build3_amd64.deb -``` - -You should only have these afterwards: - -``` -$ sudo ls -lR /var/cache/apt/archives -/var/cache/apt/archives: -total 4 --rw-r----- 1 root root 0 Jan 5 2018 lock -drwx------ 2 _apt root 4096 Nov 12 07:24 partial - -/var/cache/apt/archives/partial: -total 0 <== empty -``` - -The **apt-get clean** command is generally used to clear disk space as needed, generally as part of regularly scheduled maintenance. - -### apt-get autoclean - -The **apt-get** **autoclean** option, like **apt-get clean**, clears the local repository of retrieved package files, but it only removes files that can no longer be downloaded and are virtually useless. It helps to keep your cache from growing too large. - -### apt-get autoremove - -The **autoremove** option removes packages that were automatically installed because some other package required them but, with those other packages removed, they are no longer needed. Sometimes, an upgrade will suggest that you run this command. - -``` -The following packages were automatically installed and are no longer required: - g++-8 gir1.2-mutter-4 libapache2-mod-php7.2 libcrystalhd3 - libdouble-conversion1 libgnome-desktop-3-17 libigdgmm5 libisl19 libllvm8 - liblouisutdml8 libmutter-4-0 libmysqlclient20 libpoppler85 libstdc++-8-dev - libtagc0 libvpx5 libx265-165 php7.2 php7.2-cli php7.2-common php7.2-json - php7.2-opcache php7.2-readline -Use 'sudo apt autoremove' to remove them. <== -``` - -The packages to be removed are often called "unused dependencies". In fact, a good practice to follow is to use **autoremove** after uninstalling a package to be sure that no unneeded files are left behind. - -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/3453032/cleaning-up-with-apt-get.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/nbKaLT4cmRM -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.networkworld.com/newsletters/signup.html -[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20191114 Cleaning up with apt-get.md b/translated/tech/20191114 Cleaning up with apt-get.md new file mode 100644 index 0000000000..283ad157fb --- /dev/null +++ b/translated/tech/20191114 Cleaning up with apt-get.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cleaning up with apt-get) +[#]: via: (https://www.networkworld.com/article/3453032/cleaning-up-with-apt-get.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 apt-get 清理 +====== +大多数使用基于 Debian 的系统的人通常会使用 apt-get 来安装软件包和升级,但是我们多久才清理?让我们看下工具本身的一些清理选项。 +[Félix Prado Modified by IDG Comm.][1] [(CC0)][2] + +在基于 Debian 的系统上运行 **apt-get** 命令是很常规的。软件包的更新相当频繁,诸 如 **apt-get update** 和 **apt-get upgrade** 之类的命令使此过程非常容易。另一方面,你多久使用一次 **apt-get clean**,**apt-get autoclean** 或 **apt-get autoremove**? + +这些命令会在 apt-get 的安装操作后清理并删除仍在系统上但不再需要的文件,这通常是因为需要它们的程序已经卸载。 + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +### apt-get clean + +apt-get clean 命令清除遗留在 **/var/cache** 中的已检索包文件的本地仓库。它清除的目录是 **/var/cache/apt/archives/** 和 **/var/cache/apt/archives/partial/**。它留在 **/var/cache/apt/archives** 中的唯一文件是 **lock** 文件和 **partial** 子目录。 + + +在运行清理操作之前,目录中可能包含许多文件: + +``` +/var/cache/apt/archives/db5.3-util_5.3.28+dfsg1-0.6ubuntu1_amd64.deb +/var/cache/apt/archives/db-util_1%3a5.3.21~exp1ubuntu2_all.deb +/var/cache/apt/archives/lock +/var/cache/apt/archives/postfix_3.4.5-1ubuntu1_amd64.deb +/var/cache/apt/archives/sasl2-bin_2.1.27+dfsg-1build3_amd64.deb +``` + +之后,只会存在这些: + +``` +$ sudo ls -lR /var/cache/apt/archives +/var/cache/apt/archives: +total 4 +-rw-r----- 1 root root 0 Jan 5 2018 lock +drwx------ 2 _apt root 4096 Nov 12 07:24 partial + +/var/cache/apt/archives/partial: +total 0 <== 空 +``` + +**apt-get clean** 命令通常用于根据需要清除磁盘空间,通常作为定期计划维护的一部分。 + +### apt-get autoclean + +**apt-get autoclean** 类似于 **apt-get clean**,它会清除已检索包文件的本地仓库,但它只会删除不会再下载且几乎无用的文件。它有助于防止缓存过大 + +### apt-get autoremove + +**autoremove** 选项将删除自动安装的软件包,因为某些其他软件包需要它们,但是在删除了其他软件包之后,而不再需要它们。有时会在升级时建议运行此命令。 + +``` +The following packages were automatically installed and are no longer required: + g++-8 gir1.2-mutter-4 libapache2-mod-php7.2 libcrystalhd3 + libdouble-conversion1 libgnome-desktop-3-17 libigdgmm5 libisl19 libllvm8 + liblouisutdml8 libmutter-4-0 libmysqlclient20 libpoppler85 libstdc++-8-dev + libtagc0 libvpx5 libx265-165 php7.2 php7.2-cli php7.2-common php7.2-json + php7.2-opcache php7.2-readline +Use 'sudo apt autoremove' to remove them. <== +``` + +要删除的软件包通常称为“未使用的依赖项”。实际上,一个好的做法是在卸载软件包后使用 **autoremove**,以确保不会留下不需要的文件。 + +加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,以评论最重要的话题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3453032/cleaning-up-with-apt-get.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 +[1]: https://unsplash.com/photos/nbKaLT4cmRM +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 4643e1cede060c23365ce6a44f47d344fea1db7c Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 20 Nov 2019 08:50:15 +0800 Subject: [PATCH 545/800] translating --- sources/tech/20191118 How containers work- overlayfs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191118 How containers work- overlayfs.md b/sources/tech/20191118 How containers work- overlayfs.md index c9ef0fe620..a360f72ad0 100644 --- a/sources/tech/20191118 How containers work- overlayfs.md +++ b/sources/tech/20191118 How containers work- overlayfs.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 26ad8d47bae4b882b611797f33d0e7c2bb2b041d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 20 Nov 2019 09:00:12 +0800 Subject: [PATCH 546/800] PRF @geekpi --- ...0191112 Getting started with PostgreSQL.md | 98 ++++++++----------- 1 file changed, 43 insertions(+), 55 deletions(-) diff --git a/translated/tech/20191112 Getting started with PostgreSQL.md b/translated/tech/20191112 Getting started with PostgreSQL.md index 9fe988c3f9..cc44d75594 100644 --- a/translated/tech/20191112 Getting started with PostgreSQL.md +++ b/translated/tech/20191112 Getting started with PostgreSQL.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting started with PostgreSQL) @@ -9,77 +9,73 @@ PostgreSQL 入门 ====== -安装,设置,创建和开始使用 PostgreSQL 数据库。 -![Guy on a laptop on a building][1] -每人或许都有需要在数据库中保存的东西。即使你沉迷于使用文书或电子文件,它们也会变得很麻烦。纸质文档可能会丢失或混乱,你需要访问的电子信息可能会隐藏在段落和页面的深处。 +> 安装、设置、创建和开始使用 PostgreSQL 数据库。 -在我从事医学工作的时候,我使用 [PostgreSQL][2] 来跟踪我的住院患者名单并提交有关住院患者的信息。我将我的每日患者名单打印在口袋里,以便快速了解并就患者房间、诊断或其他细节的任何变化做出快速记录。 +![](https://img.linux.net.cn/data/attachment/album/201911/20/085936u10q7eme1euu4ak3.jpg) -我以为一切没问题,直到去年我妻子决定买一辆新车,我“继承”了她以前的那辆车。她保留了汽车维修和保养服务收据的文件夹,但随着时间的流逝,它变得杂乱。花时间筛选所有纸条以弄清楚什么时候做了什么,我认为 PostgreSQL 将是更好的跟踪此信息的方法。 +每个人或许都有需要在数据库中保存的东西。即使你执着于使用纸质文件或电子文件,它们也会变得很麻烦。纸质文档可能会丢失或混乱,你需要访问的电子信息可能会隐藏在段落和页面的深处。 + +在我从事医学工作的时候,我使用 [PostgreSQL][2] 来跟踪我的住院患者名单并提交有关住院患者的信息。我将我的每日患者名单打印在口袋里,以便快速了解患者房间、诊断或其他细节的任何变化并做出快速记录。 + +我以为一切没问题,直到去年我妻子决定买一辆新车,我“接手”了她以前的那辆车。她保留了汽车维修和保养服务收据的文件夹,但随着时间的流逝,它变得杂乱。与其花时间筛选所有纸条以弄清楚什么时候做了什么,我认为 PostgreSQL 将是更好的跟踪此信息的方法。 ### 安装 PostgreSQL -自上次使用 PostgreSQ L以来已经有一段时间了,我忘记了如何使用它。实际上,我甚至没有在计算机上安装它。安装它是第一步。我使用 Fedora,因此在控制台中运行: - +自上次使用 PostgreSQL 以来已经有一段时间了,我已经忘记了如何使用它。实际上,我甚至没有在计算机上安装它。安装它是第一步。我使用 Fedora,因此在控制台中运行: ``` -`dnf list postgresql*` +dnf list postgresql* ``` -请注意,你无需使用 sudo 即可使用 **list** 选项。该命令返回了很长的软件包列表。看了眼后,我决定只需要三个:postgresql、postgresql-server 和 postgresql-docs。 +请注意,你无需使用 `sudo` 即可使用 `list` 选项。该命令返回了很长的软件包列表。看了眼后,我决定只需要三个:postgresql、postgresql-server 和 postgresql-docs。 -为了了解下一步需要做什么,我决定查看 [PostgreSQL 文档][3]。文档参考内容非常广泛,实际上,广泛到令人生畏。幸运的是,我发现我在升级 Fedora 时曾经做过的一些笔记,希望有效地导出数据库,在新版本上重新启动 PostgreSQL,以及导入旧数据库。 +为了了解下一步需要做什么,我决定查看 [PostgreSQL 文档][3]。文档参考内容非常丰富,实际上,丰富到令人生畏。幸运的是,我发现我在升级 Fedora 时曾经做过的一些笔记,希望有效地导出数据库,在新版本上重新启动 PostgreSQL,以及导入旧数据库。 ### 设置 PostgreSQL -与大多数其他软件不同,你不能只是安装 PostgreSQL 并开始使用它。你必须预先执行两个基本步骤:首先,你需要设置 PostgreSQL,第二,你需要启动它。你必须以 **root** 用户身份执行这些操作(sudo 在这里不起作用)。 +与大多数其他软件不同,你不能只是安装好 PostgreSQL 就开始使用它。你必须预先执行两个基本步骤:首先,你需要设置 PostgreSQL,第二,你需要启动它。你必须以 `root` 用户身份执行这些操作(`sudo` 在这里不起作用)。 要设置它,请输入: - ``` -`postgresql-setup –initdb` +postgresql-setup –initdb ``` -这将确定 PostgreSQL 数据库在计算机上的位置。然后(仍为 **root**)输入以下两个命令: - +这将确定 PostgreSQL 数据库在计算机上的位置。然后(仍为 `root`)输入以下两个命令: ``` systemctl start postgresql.service systemctl enable postgresql.service ``` -第一个命令为当前会话启动 PostgreSQL(如果你关闭它,那么 PostgreSQL 就将关闭)。第二个命令使 PostgreSQL 在随后的重启中自动启动。 +第一个命令为当前会话启动 PostgreSQL(如果你关闭机器,那么 PostgreSQL 也将关闭)。第二个命令使 PostgreSQL 在随后的重启中自动启动。 ### 创建用户 -PostgreSQL 正在运行,但是你仍然不能使用它,因为你还没有用户。为此,你需要切换到特殊用户 **postgres**。当你仍以 **root** 身份运行时,输入: - +PostgreSQL 正在运行,但是你仍然不能使用它,因为你还没有用户。为此,你需要切换到特殊用户 `postgres`。当你仍以 `root` 身份运行时,输入: ``` -`su postgres` +su postgres ``` -由于你是以 **root** 的身份执行此操作的,因此无需输入密码。root 用户可以在不知道密码的情况下以任何用户身份操作;这就是使其强大而危险的原因之一。 - -现在你就是 **postgres** 了,请运行下面两个命令,如下所示创建用户(创建用户 **gregp**): +由于你是以 `root` 的身份执行此操作的,因此无需输入密码。root 用户可以在不知道密码的情况下以任何用户身份操作;这就是使其强大而危险的原因之一。 +现在你就是 `postgres` 了,请运行下面两个命令,如下所示创建用户(创建用户 `gregp`): ``` createuser gregp createdb gregp ``` -你可能会看到错误消息,如:**Could not switch to /home/gregp**。这只是意味着用户 **postgres**不能访问该目录。尽管如此,你的用户和数据库已创建。接下来,输入 **Exit** 和 **Enter** 两次,这样就回到了原来的状态。 +你可能会看到错误消息,如:`Could not switch to /home/gregp`。这只是意味着用户 `postgres`不能访问该目录。尽管如此,你的用户和数据库已创建。接下来,输入 `exit` 并按回车两次,这样就回到了原来的用户下(`root`)。 ### 设置数据库 -要开始使用 PostgreSQL,请在命令行输入 **psql**。你应该在每行左侧看到类似 **gregp=>** 的内容,以显示你使用的是 PostgreSQL,并且只能使用它理解的命令。你自动获得一个数据库(我的名为 **gregp**),它里面完全没有内容。对 PostgreSQL 来说,数据库只是一个工作空间。在空间内,你创建_表_。表包含变量列表,每个变量的下面是构成数据库的数据。 +要开始使用 PostgreSQL,请在命令行输入 `psql`。你应该在每行左侧看到类似 `gregp=>` 的内容,以显示你使用的是 PostgreSQL,并且只能使用它理解的命令。你自动获得一个数据库(我的名为 `gregp`),它里面完全没有内容。对 PostgreSQL 来说,数据库只是一个工作空间。在空间内,你可以创建*表*。表包含变量列表,而表中的每个变量是构成数据库的数据。 以下是我设置汽车服务数据库的方式: - ``` CREATE TABLE autorepairs (         date            date, @@ -89,63 +85,57 @@ CREATE TABLE autorepairs ( ); ``` -我本可以在一行内输入入,但为了更好地说明结构,并表明 PostgreSQL 不会解释制表符和换行的空白,我分成了多行。字段包含在括号中,每个变量名和数据类型与下一个变量用逗号分隔(最后一个逗号除外),命令以分号结尾。所有命令都必须以分号结尾! +我本可以在一行内输入,但为了更好地说明结构,并表明 PostgreSQL 不会解释制表符和换行的空白,我分成了多行。字段包含在括号中,每个变量名和数据类型与下一个变量用逗号分隔(最后一个除外),命令以分号结尾。所有命令都必须以分号结尾! -第一个变量名是 **date**,它的数据类型也是 **date**,这在 PostgreSQL 中没关系。第二个和第三个变量 **repairs** 和 **location** 都是 **varchar(80)** 类型,这意味着它们可以是最多 80 个任意字符(字母、数字等)。最后一个变量 **cost** 使用 **numeric** 类型。括号中的数字表示最多有六位数字,其中两位是小数。最初,我尝试了 **real** 类型,这将是一个浮点数。**real** 作为数据类型在使用时,在遇到 **WHERE** 子句,类似 **WHERE cost = 0** 或其他任何特定数字。由于 **real** 值有些不精确,因此特定数字将永远不会匹配。 +第一个变量名是 `date`,它的数据类型也是 `date`,这在 PostgreSQL 中没关系。第二个和第三个变量 `repairs` 和 `location` 都是 `varchar(80)` 类型,这意味着它们可以是最多 80 个任意字符(字母、数字等)。最后一个变量 `cost` 使用 `numeric` 类型。括号中的数字表示最多有六位数字,其中两位是小数。最初,我尝试了 `real` 类型,这将是一个浮点数。`real` 类型的问题是作为数据类型在使用时,在遇到 `WHERE` 子句,类似 `WHERE cost = 0` 或其他任何特定数字。由于 `real` 值有些不精确,因此特定数字将永远不会匹配。 ### 输入数据 -接下来,你可以使用 **INSERT INTO** 命令添加一些数据(在 PostgreSQL 中称为**行**): - +接下来,你可以使用 `INSERT INTO` 命令添加一些数据(在 PostgreSQL 中称为*行*): ``` -`INSERT INTO autorepairs VALUES ('2017-08-11', 'airbag recall', 'dealer', 0);` +INSERT INTO autorepairs VALUES ('2017-08-11', 'airbag recall', 'dealer', 0); ``` -请注意,括号为值构成一个容器,它必须以正确的顺序,用逗号分隔,并在命令末尾加上分号。 **date** 和 **varchar(80)** 类型的值必须包含在单引号中,但数字值(如 **numeric**)不用。作为反馈,你应该会看到: - +请注意,括号构成了一个值的容器,它必须以正确的顺序,用逗号分隔,并在命令末尾加上分号。`date` 和 `varchar(80)` 类型的值必须包含在单引号中,但数字值(如 `numeric`)不用。作为反馈,你应该会看到: ``` -`INSERT 0 1` +INSERT 0 1 ``` -与常规终端会话一样,你将有输入命令的历史记录,因此,在输入后续行时,通常可以按向上箭头键来显示最后一个命令并根据需要编辑数据,从而节省大量时间。 - -如果出了什么问题怎么办?使用 **UPDATE** 更改值: +与常规终端会话一样,你会有输入命令的历史记录,因此,在输入后续行时,通常可以按向上箭头键来显示最后一个命令并根据需要编辑数据,从而节省大量时间。 +如果出了什么问题怎么办?使用 `UPDATE` 更改值: ``` -`UPDATE autorepairs SET date = '2017-11-08' WHERE repairs = 'airbag recall';` +UPDATE autorepairs SET date = '2017-11-08' WHERE repairs = 'airbag recall'; ``` -或者,也许你不再需要表中的行。使用 **DELETE**: - +或者,也许你不再需要表中的行。使用 `DELETE`: ``` -`DELETE FROM autorepairs WHERE repairs = 'airbag recall';` +DELETE FROM autorepairs WHERE repairs = 'airbag recall'; ``` 这将删除整行。 -最后一件事:即使我在 PostgreSQL 命令中一直使用大写字母(在大多数文档中也这么做),你也可以用小写字母输入,这是我常做的。 +最后一件事:即使我在 PostgreSQL 命令中一直使用大写字母(在大多数文档中也这么做),你也可以用小写字母输入,我也经常如此。 ### 输出数据 -如果你想展示数据,使用 **SELECT**: - +如果你想展示数据,使用 `SELECT`: ``` -`SELECT * FROM autorepairs ORDER BY date;` +SELECT * FROM autorepairs ORDER BY date; ``` -没有 **ORDER BY** 的话,行将不管你输入的内容来显示。例如,以下就是我终端中输出的我的汽车服务数据: - +没有 `ORDER BY` 的话,行将不管你输入的内容来显示。例如,以下就是我终端中输出的我的汽车服务数据: ``` SELECT date, repairs FROM autorepairs ORDER BY date;     date   |                             repairs                              -\-----------+----------------------------------------------------------------- +-----------+----------------------------------------------------------------- 2008-08-08 | oil change, air filter, spark plugs 2011-09-30 | 35000 service, oil change, rotate tires/balance wheels 2012-03-07 | repl battery @@ -172,25 +162,23 @@ SELECT date, repairs FROM autorepairs ORDER BY date; ``` -`\o autorepairs.txt` +\o autorepairs.txt ``` -然后再次运行 **SELECT** 命令。 +然后再次运行 `SELECT` 命令。 ### 退出 PostgreSQL 最后,在终端中退出 PostgreSQL,输入: - ``` -`quit` +quit ``` 或者它的缩写版: - ``` -`\q` +\q ``` 虽然这只是 PostgreSQL 的简要介绍,但我希望它展示了将数据库用于这样的简单任务既不困难也不费时。 @@ -202,7 +190,7 @@ via: https://opensource.com/article/19/11/getting-started-postgresql 作者:[Greg Pittman][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 dcc0721b9a00648fefc0c8d29ba338b24be9e895 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 20 Nov 2019 09:00:52 +0800 Subject: [PATCH 547/800] PUB @geekpi https://linux.cn/article-11593-1.html --- .../20191112 Getting started with PostgreSQL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191112 Getting started with PostgreSQL.md (99%) diff --git a/translated/tech/20191112 Getting started with PostgreSQL.md b/published/20191112 Getting started with PostgreSQL.md similarity index 99% rename from translated/tech/20191112 Getting started with PostgreSQL.md rename to published/20191112 Getting started with PostgreSQL.md index cc44d75594..6a987c22c0 100644 --- a/translated/tech/20191112 Getting started with PostgreSQL.md +++ b/published/20191112 Getting started with PostgreSQL.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11593-1.html) [#]: subject: (Getting started with PostgreSQL) [#]: via: (https://opensource.com/article/19/11/getting-started-postgresql) [#]: author: (Greg Pittman https://opensource.com/users/greg-p) From 8bde4ced910744d2edbd17a114c932c5a36419e2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 20 Nov 2019 09:19:03 +0800 Subject: [PATCH 548/800] PUB @wxy https://linux.cn/article-11595-1.html --- .../20191029 What you probably didn-t know about sudo.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) rename {translated/tech => published}/20191029 What you probably didn-t know about sudo.md (98%) diff --git a/translated/tech/20191029 What you probably didn-t know about sudo.md b/published/20191029 What you probably didn-t know about sudo.md similarity index 98% rename from translated/tech/20191029 What you probably didn-t know about sudo.md rename to published/20191029 What you probably didn-t know about sudo.md index 0e6db4b6ad..ce4502ba8a 100644 --- a/translated/tech/20191029 What you probably didn-t know about sudo.md +++ b/published/20191029 What you probably didn-t know about sudo.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11595-1.html) [#]: subject: (What you probably didn’t know about sudo) [#]: via: (https://opensource.com/article/19/10/know-about-sudo) [#]: author: (Peter Czanik https://opensource.com/users/czanik) @@ -12,7 +12,7 @@ > 觉得你已经了解了 sudo 的所有知识了吗?再想想。 -![Command line prompt][1] +![](https://img.linux.net.cn/data/attachment/album/201911/20/091740ape5b74jppjj4q36.jpg) 大家都知道 `sudo`,对吗?默认情况下,该工具已安装在大多数 Linux 系统上,并且可用于大多数 BSD 和商业 Unix 变体。不过,在与数百名 `sudo` 用户交谈之后,我得到的最常见的答案是 `sudo` 是一个使生活复杂化的工具。 @@ -161,7 +161,7 @@ Defaults log_output 如果你想了解有关 `sudo` 的更多信息,请参考以下资源: -* [sudo `网站][5] +* [sudo 网站][5] * [sudo 博客][6] * [在 Twitter 上关注我们][7] From 4ba202c41b2583e63856a22d1181a205b5929001 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 20 Nov 2019 09:55:39 +0800 Subject: [PATCH 549/800] PRF --- ... Schedule and Automate tasks in Linux using Cron Jobs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md index 6d380030f0..93727092b0 100644 --- a/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md +++ b/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md @@ -60,7 +60,7 @@ m h d moy dow /path/to/script * `h`:表示小时,范围是 0 到 23 * `d`:代表一个月中的某天,范围是 1 到 31 * `moy`:这是一年中的月份。范围是 1 到 12 -* `doy`:这是星期几。范围是 0 到 6,其中 0 代表星期日 +* `dow`:这是星期几。范围是 0 到 6,其中 0 代表星期日 * `command`:这是要执行的命令,例如备份命令、重新启动和复制命令等 ### 管理 cron 任务 @@ -197,9 +197,9 @@ m h d moy dow /path/to/script @daily /path/to/script ``` -3)`@weekly` 时间戳等效于 `0 0 1 * mon` +3)`@weekly` 时间戳等效于 `0 0 * * 0` -它在每周的第一分钟执行 cron 任务,一周第一天是从星期一开始的。 +它在每周的第一分钟执行 cron 任务,一周第一天是从星期日开始的。 ``` @weekly /path/to/script From 659956e837a774ac8133ac205aaa60848fb50180 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 20 Nov 2019 16:53:50 +0800 Subject: [PATCH 550/800] TSL --- ...ow to use Protobuf for data interchange.md | 355 +++++++++--------- 1 file changed, 168 insertions(+), 187 deletions(-) diff --git a/translated/tech/20191018 How to use Protobuf for data interchange.md b/translated/tech/20191018 How to use Protobuf for data interchange.md index 42268a0507..959b9ec6b6 100644 --- a/translated/tech/20191018 How to use Protobuf for data interchange.md +++ b/translated/tech/20191018 How to use Protobuf for data interchange.md @@ -63,24 +63,21 @@ Protobuf 可用于现代 RPC 系统,例如 [gRPC][5];但是 Protobuf 本身 让我们看一下负十进制值 `-128`。在 2 的补码二进制表示形式(在系统和语言中占主导地位)中,此值可以存储在单个 8 位字节中:`10000000`。此整数值在 XML 或 JSON 中的文本编码需要多个字节。例如,UTF-8 编码需要四个字节的字符串,即 `-128`,即每个字符一个字节(十六进制,值为 `0x2d`、`0x31`、`0x32` 和 `0x38`)。XML 和 JSON 还添加了标记字符,例如尖括号和大括号。有关 Protobuf 编码的详细信息下面就会介绍,但现在的关注点是一个通用点:文本编码的压缩性明显低于二进制编码。 -### A code example in Go using Protobuf +### 在 Go 中使用 Protobuf 的示例 -My code examples focus on Protobuf rather than RPC. Here is an overview of the first example: +我的代码示例着重于 Protobuf 而不是RPC。以下是第一个示例的概述: - * The IDL file named _dataitem.proto_ defines a Protobuf `message` with six fields of different types: integer values with different ranges, floating-point values of a fixed size, and strings of two different lengths. - * The Protobuf compiler uses the IDL file to generate a Go-specific version (and, later, a Java-specific version) of the Protobuf `message` together with supporting functions. - * A Go app populates the native Go data structure with randomly generated values and then serializes the result to a local file. For comparison, XML and JSON encodings also are serialized to local files. - * As a test, the Go application reconstructs an instance of its native data structure by deserializing the contents of the Protobuf file. - * As a language-neutrality test, the Java application also deserializes the contents of the Protobuf file to get an instance of a native data structure. +* 名为 `dataitem.proto` 的 IDL 文件定义了一个 Protobuf 消息,它具有六个不同类型的字段:具有不同范围的整数值、固定大小的浮点值以及两个不同长度的字符串。 +* Protobuf 编译器使用 IDL 文件生成 Protobuf 消息及支持函数的 Go 特定版本(以及后来的 Java 特定版本)。 +* Go 应用程序使用随机生成的值填充原生 Go 数据结构,然后将结果序列化为本地文件。为了进行比较, XML 和 JSON 编码也被序列化为本地文件。 +* 作为测试,Go 应用程序通过反序列化 Protobuf 文件的内容来重建其原生数据结构的实例。 +* 作为语言中立性测试,Java 应用程序还会对 Protobuf 文件的内容进行反序列化以获取原生数据结构的实例。 +[我的网站][6]上提供了该 IDL 文件以及两个 Go 和一个 Java 源文件,打包为 ZIP 文件。 +最重要的 Protobuf IDL 文档如下所示。该文档存储在文件 `dataitem.proto` 中,并具有常规的`.proto` 扩展名。 -This IDL file and two Go and one Java source files are available as a ZIP file on [my website][6]. - -The all-important Protobuf IDL document is shown below. The document is stored in the file _dataitem.proto_, with the customary _.proto_ extension. - -#### Example 1. Protobuf IDL document - +#### 示例 1、Protobuf IDL 文档 ``` syntax = "proto3"; @@ -99,10 +96,9 @@ message DataItem { } ``` -The IDL uses the current proto3 rather than the earlier proto2 syntax. The package name (in this case, `main`) is optional but customary; it is used to avoid name conflicts. The structured `message` contains eight fields, each of which has a Protobuf data type (e.g., `int64`, `string`), a name (e.g., `oddA`, `short`), and a numeric tag (aka key) after the equals sign `=`. The tags, which are 1 through 8 in this example, are unique integer identifiers that determine the order in which the fields are serialized. - -Protobuf messages can be nested to arbitrary levels, and one message can be the field type in the other. Here's an example that uses the `DataItem` message as a field type: +该 IDL 使用当前的 proto3 而不是较早的 proto2 语法。软件包名称(在本例中为 `main`)是可选的,但是惯用的;它用于避免名称冲突。这个结构化的消息包含八个字段,每个字段都有一个 Protobuf 数据类型(例如,`int64`、`string`)、名称(例如,`oddA`、`short`)和一个等号 `=` 之后的数字标签(即键)。标签(在此示例中为 1 到 8)是唯一的整数标识符,用于确定字段序列化的顺序。 +Protobuf 消息可以嵌套到任意级别,而一个消息可以是另外一个消息的字段类型。这是一个使用 `DataItem` 消息作为字段类型的示例: ``` message DataItems { @@ -110,10 +106,9 @@ message DataItems { } ``` -A single `DataItems` message consists of repeated (none or more) `DataItem` messages. - -Protobuf also supports enumerated types for clarity: +单个 `DataItems` 消息由重复的(零个或多个)`DataItem` 消息组成。 +为了清晰起见,Protobuf 还支持枚举类型: ``` enum PartnershipStatus { @@ -121,71 +116,67 @@ enum PartnershipStatus { } ``` -The `reserved` qualifier ensures that the numeric values used to implement the three symbolic names cannot be reused. - -To generate a language-specific version of one or more declared Protobuf `message` structures, the IDL file containing these is passed to the _protoc_ compiler (available in the [Protobuf GitHub repository][7]). For the Go code, the supporting Protobuf library can be installed in the usual way (with `%` as the command-line prompt): +`reserved` 限定符确保用于实现这三个符号名的数值不能重复使用。 +为了生成一个或多个声明的 Protobuf 消息结构的特定于语言的版本,包含这些结构的 IDL 文件被传递到`protoc` 编译器(可在 [Protobuf GitHub 存储库][7]中找到)。对于 Go 代码,可以以通常的方式安装支持的 Protobuf 库(这里以 `%` 作为命令行提示符): ``` -`% go get github.com/golang/protobuf/proto` +% go get github.com/golang/protobuf/proto ``` -The command to compile the Protobuf IDL file _dataitem.proto_ into Go source code is: - +将 Protobuf IDL 文件 `dataitem.proto` 编译为 Go 源代码的命令是: ``` -`% protoc --go_out=. dataitem.proto` +% protoc --go_out=. dataitem.proto ``` -The flag `\--go_out` directs the compiler to generate Go source code; there are similar flags for other languages. The result, in this case, is a file named _dataitem.pb.go_, which is small enough that the essentials can be copied into a Go application. Here are the essentials from the generated code: - +标志 `--go_out` 指示编译器生成 Go 源代码。其他语言也有类似的标志。在这种情况下,结果是一个名为 `dataitem.pb.go` 的文件,该文件足够小,可以将基本内容复制到 Go 应用程序中。以下是生成的代码的主要部分: ``` var _ = proto.Marshal type DataItem struct { -   OddA  int64   `protobuf:"varint,1,opt,name=oddA" json:"oddA,omitempty"` -   EvenA int64   `protobuf:"varint,2,opt,name=evenA" json:"evenA,omitempty"` -   OddB  int32   `protobuf:"varint,3,opt,name=oddB" json:"oddB,omitempty"` -   EvenB int32   `protobuf:"varint,4,opt,name=evenB" json:"evenB,omitempty"` -   Small float32 `protobuf:"fixed32,5,opt,name=small" json:"small,omitempty"` -   Big   float32 `protobuf:"fixed32,6,opt,name=big" json:"big,omitempty"` -   Short string  `protobuf:"bytes,7,opt,name=short" json:"short,omitempty"` -   Long  string  `protobuf:"bytes,8,opt,name=long" json:"long,omitempty"` + OddA int64 `protobuf:"varint,1,opt,name=oddA" json:"oddA,omitempty"` + EvenA int64 `protobuf:"varint,2,opt,name=evenA" json:"evenA,omitempty"` + OddB int32 `protobuf:"varint,3,opt,name=oddB" json:"oddB,omitempty"` + EvenB int32 `protobuf:"varint,4,opt,name=evenB" json:"evenB,omitempty"` + Small float32 `protobuf:"fixed32,5,opt,name=small" json:"small,omitempty"` + Big float32 `protobuf:"fixed32,6,opt,name=big" json:"big,omitempty"` + Short string `protobuf:"bytes,7,opt,name=short" json:"short,omitempty"` + Long string `protobuf:"bytes,8,opt,name=long" json:"long,omitempty"` } -func (m *DataItem) Reset()         { *m = DataItem{} } +func (m *DataItem) Reset() { *m = DataItem{} } func (m *DataItem) String() string { return proto.CompactTextString(m) } -func (*DataItem) ProtoMessage()    {} +func (*DataItem) ProtoMessage() {} func init() {} ``` -The compiler-generated code has a Go structure `DataItem`, which exports the Go fields—the names are now capitalized—that match the names declared in the Protobuf IDL. The structure fields have standard Go data types: `int32`, `int64`, `float32`, and `string`. At the end of each field line, as a string, is metadata that describes the Protobuf types, gives the numeric tags from the Protobuf IDL document, and provides information about JSON, which is discussed later. +编译器生成的代码具有 Go 结构 `DataItem`,该结构导出 Go 字段(名称现已大写开头),该字段与 Protobuf IDL 中声明的名称匹配。该结构字段具有标准的 Go 数据类型:`int32`、`int64`、`float32` 和 `string`。在每个字段行的末尾,是描述 Protobuf 类型的字符串,提供 Protobuf IDL 文档中的数字标签并提供有关 JSON 信息的元数据,这将在后面讨论。 -There are also functions; the most important is `proto.Marshal` for serializing an instance of the `DataItem` structure into Protobuf format. The helper functions include `Reset`, which clears a `DataItem` structure, and `String`, which produces a one-line string representation of a `DataItem`. +此外也有函数;最重要的是 `Proto.Marshal`,用于将 `DataItem` 结构的实例序列化为 Protobuf格式。辅助函数包括:清除 `DataItem` 结构的 `Reset`,生成 `DataItem` 的单行字符串表示的 `String`。 -The metadata that describes Protobuf encoding deserves a closer look before analyzing the Go program in more detail. +描述 Protobuf 编码的元数据应在更详细地分析 Go 程序之前进行仔细研究。 -### Protobuf encoding +### Protobuf 编码 -A Protobuf message is structured as a collection of key/value pairs, with the numeric tag as the key and the corresponding field as the value. The field names, such as `oddA` and `small`, are for human readability, but the _protoc_ compiler does use the field names in generating language-specific counterparts. For example, the `oddA` and `small` names in the Protobuf IDL become the fields `OddA` and `Small`, respectively, in the Go structure. +Protobuf 消息的结构为键/值对的集合,其中数字标签为键,相应的字段为值。字段名称(例如,`oddA` 和 `small`)是供人类阅读的,但是 `protoc` 编译器的确使用了字段名称来生成特定于语言的对应名称。例如,Protobuf IDL 中的 `oddA` 和 `small` 名称在 Go 结构中分别成为字段 `OddA` 和 `Small`。 -The keys and their values both get encoded, but with an important difference: some numeric values have a fixed-size encoding of 32 or 64 bits, whereas others (including the `message` tags) are _varint_ encoded—the number of bits depends on the integer's absolute value. For example, the integer values 1 through 15 require 8 bits to encode in _varint_, whereas the values 16 through 2047 require 16 bits. The _varint_ encoding, similar in spirit (but not in detail) to UTF-8 encoding, favors small integer values over large ones. (For a detailed analysis, see the Protobuf [encoding guide][8].) The upshot is that a Protobuf `message` should have small integer values in fields, if possible, and as few keys as possible, but one key per field is unavoidable. +键和它们的值都被编码,但是有一个重要的区别:一些数字值具有固定大小的 32 或 64 位的编码,而其他数字(包括消息标签)则是 `varint` 编码的,位数取决于整数的绝对值。例如,整数值 1 到 15 需要 8 位 `varint` 编码,而值 16 到 2047 需要 16 位。`varint` 编码在本质上与 UTF-8 编码类似(但细节不同),它偏爱较小的整数值而不是较大的整数值。(有关详细分析,请参见 Protobuf [编码指南][8])结果是,Protobuf 消息应该在字段中具有较小的整数值(如果可能),并且键数应尽可能少,但每个字段只有一个键是必不可少的。 -Table 1 below gives the gist of Protobuf encoding: +下表 1 列出了 Protobuf 编码的要点: -`Table 1. Protobuf data types` - -Encoding | Sample types | Length +编码 | 示例类型 | 长度 ---|---|--- -varint | int32, uint32, int64 | Variable length -fixed | fixed32, float, double | Fixed 32-bit or 64-bit length -byte sequence | string, bytes | Sequence length +`varint` | `int32`、`uint32`、`int64` | 可变长度 +`fixed` | `fixed32`、`float`、`double` | 固定的 32 位或 64 位长度 +字节序列 | `string`、`bytes` | 序列长度 -Integer types that are not explicitly `fixed` are _varint_ encoded; hence, in a _varint_ type such as `uint32` (`u` for unsigned), the number 32 describes the integer's range (in this case, 0 to 232 \- 1) rather than its bit size, which differs depending on the value. For fixed types such as `fixed32` or `double`, by contrast, the Protobuf encoding requires 32 and 64 bits, respectively. Strings in Protobuf are byte sequences; hence, the size of the field encoding is the length of the byte sequence. +*表 1. Protobuf 数据类型* -Another efficiency deserves mention. Recall the earlier example in which a `DataItems` message consists of repeated `DataItem` instances: +未明确固定长度的整数类型是 `varint` 编码的;因此,在 `varint` 类型中,例如 `uint32`(`u` 代表无符号),数字 32 描述了整数的范围(在这种情况下为 0 到 2^32 - 1),而不是其位的大小,该位大小取决于值。相比之下,对于固定长度类型(例如 `fixed32` 或 `double`),Protobuf 编码分别需要 32 位和 64 位。Protobuf 中的字符串是字节序列;因此,字段编码的大小就是字节序列的长度。 +另一个高效的方法值得一提。回想一下前面的示例,其中的 `DataItems` 消息由重复的 `DataItem` 实例组成: ``` message DataItems { @@ -193,22 +184,21 @@ message DataItems { } ``` -The `repeated` means that the `DataItem` instances are _packed_: the collection has a single tag, in this case, 1. A `DataItems` message with repeated `DataItem` instances is thus more efficient than a message with multiple but separate `DataItem` fields, each of which would require a tag of its own. +`repeated` 表示 `DataItem` 实例是*打包的*:集合具有单个标签,在这种情况下为 1。因此,具有重复的 `DataItem` 实例的 `DataItems` 消息比具有多个但单独的 `DataItem` 字段,每个字段都需要自己的标签的消息的效率更高。 -With this background in mind, let's return to the Go program. +考虑到这一背景,让我们回到 Go 程序。 -### The dataItem program in detail - -The _dataItem_ program creates a `DataItem` instance and populates the fields with randomly generated values of the appropriate types. Go has a `rand` package with functions for generating pseudo-random integer and floating-point values, and my `randString` function generates pseudo-random strings of specified lengths from a character set. The design goal is to have a `DataItem` instance with field values of different types and bit sizes. For example, the `OddA` and `EvenA` values are 64-bit non-negative integer values of odd and even parity, respectively; but the `OddB` and `EvenB` variants are 32 bits in size and hold small integer values between 0 and 2047. The random floating-point values are 32 bits in size, and the strings are 16 (`Short`) and 32 (`Long`) characters in length. Here is the code segment that populates the `DataItem` structure with random values: +### dataItem 程序的细节 +`dataItem` 程序创建一个 `DataItem` 实例,并使用适当类型的随机生成的值填充字段。Go 有一个 `rand` 包,带有用于生成伪随机整数和浮点值的函数,而我的 `randString` 函数可以从字符集中生成指定长度的伪随机字符串。设计目标是要有一个具有不同类型和位大小的字段值的 `DataItem` 实例。例如,`OddA` 和 `EvenA` 值分别是奇偶校验的 64 位非负整数值;但是 `OddB` 和 `EvenB` 变体的大小为 32 位,并存放 0 到 2047 之间的小整数值。随机浮点值的大小为 32 位,字符串为 16(`Short`)和 32(`Long`)字符的长度。这是用随机值填充 `DataItem` 结构的代码段: ``` // variable-length integers -n1 := rand.Int63()        // bigger integer -if (n1 & 1) == 0 { n1++ } // ensure it's odd +n1 := rand.Int63() // bigger integer +if (n1 & 1) == 0 { n1++ } // ensure it's odd ... n3 := rand.Int31() % UpperBound // smaller integer -if (n3 & 1) == 0 { n3++ }       // ensure it's odd +if (n3 & 1) == 0 { n3++ } // ensure it's odd // fixed-length floats ... @@ -220,36 +210,34 @@ str1 := randString(StrShort) str2 := randString(StrLong) // the message -dataItem := &DataItem { -   OddA:  n1, -   EvenA: n2, -   OddB:  n3, -   EvenB: n4, -   Big:   f1, -   Small: f2, -   Short: str1, -   Long:  str2, +dataItem := &DataItem { + OddA: n1, + EvenA: n2, + OddB: n3, + EvenB: n4, + Big: f1, + Small: f2, + Short: str1, + Long: str2, } ``` -Once created and populated with values, the `DataItem` instance is encoded in XML, JSON, and Protobuf, with each encoding written to a local file: - +创建并填充值后,`DataItem` 实例将以 XML、JSON 和 Protobuf 进行编码,每种编码均写入本地文件: ``` func encodeAndserialize(dataItem *DataItem) { -   bytes, _ := xml.MarshalIndent(dataItem, "", " ")  // Xml to dataitem.xml -   ioutil.WriteFile(XmlFile, bytes, 0644)            // 0644 is file access permissions + bytes, _ := xml.MarshalIndent(dataItem, "", " ") // Xml to dataitem.xml + ioutil.WriteFile(XmlFile, bytes, 0644) // 0644 is file access permissions -   bytes, _ = json.MarshalIndent(dataItem, "", " ")  // Json to dataitem.json -   ioutil.WriteFile(JsonFile, bytes, 0644) + bytes, _ = json.MarshalIndent(dataItem, "", " ") // Json to dataitem.json + ioutil.WriteFile(JsonFile, bytes, 0644) -   bytes, _ = proto.Marshal(dataItem)                // Protobuf to dataitem.pbuf -   ioutil.WriteFile(PbufFile, bytes, 0644) + bytes, _ = proto.Marshal(dataItem) // Protobuf to dataitem.pbuf + ioutil.WriteFile(PbufFile, bytes, 0644) } ``` -The three serializing functions use the term _marshal_, which is roughly synonymous with _serialize_. As the code indicates, each of the three `Marshal` functions returns an array of bytes, which then are written to a file. (Possible errors are ignored for simplicity.) On a sample run, the file sizes were: - +这三个序列化函数使用术语 `marshal`,它与 `serialize` 意思大致相同。如代码所示,三个 `Marshal` 函数均返回一个字节数组,然后将其写入文件。(为简单起见,可能的错误将被忽略处理。)在示例运行中,文件大小为: ``` dataitem.xml:  262 bytes @@ -257,57 +245,53 @@ dataitem.json: 212 bytes dataitem.pbuf:  88 bytes ``` -The Protobuf encoding is significantly smaller than the other two. The XML and JSON serializations could be reduced slightly in size by eliminating indentation characters, in this case, blanks and newlines. - -Below is the _dataitem.json_ file resulting eventually from the `json.MarshalIndent` call, with added comments starting with `##`: +Protobuf 编码明显小于其他两个编码方案。通过消除缩进字符(在这种情况下为空白和换行符),可以稍微减小 XML 和 JSON 序列化的大小。 +以下是 `dataitem.json` 文件,该文件最终是由 `json.MarshalIndent` 调用产生的,并添加了以 `##` 开头的注释: ``` { - "oddA":  4744002665212642479,                ## 64-bit >= 0 - "evenA": 2395006495604861128,                ## ditto - "oddB":  57,                                 ## 32-bit >= 0 but < 2048 - "evenB": 468,                                ## ditto - "small": 0.7562016,                          ## 32-bit floating-point - "big":   0.85202795,                         ## ditto - "short": "ClH1oDaTtoX$HBN5",                 ## 16 random chars - "long":  "xId0rD3Cri%3Wt%^QjcFLJgyXBu9^DZI"  ## 32 random chars + "oddA": 4744002665212642479, ## 64-bit >= 0 + "evenA": 2395006495604861128, ## ditto + "oddB": 57, ## 32-bit >= 0 but < 2048 + "evenB": 468, ## ditto + "small": 0.7562016, ## 32-bit floating-point + "big": 0.85202795, ## ditto + "short": "ClH1oDaTtoX$HBN5", ## 16 random chars + "long": "xId0rD3Cri%3Wt%^QjcFLJgyXBu9^DZI" ## 32 random chars } ``` -Although the serialized data goes into local files, the same approach would be used to write the data to the output stream of a network connection. +尽管这些序列化的数据写入到本地文件中,但是也可以使用相同的方法将数据写入网络连接的输出流。 -### Testing serialization/deserialization - -The Go program next runs an elementary test by deserializing the bytes, which were written earlier to the _dataitem.pbuf_ file, into a `DataItem` instance. Here is the code segment, with the error-checking parts removed: +### 测试序列化和反序列化 +Go 程序接下来通过将先前写入 `dataitem.pbuf` 文件的字节反序列化为 `DataItem` 实例来运行基本测试。这是代码段,其中除去了错误检查部分: ``` filebytes, err := ioutil.ReadFile(PbufFile) // get the bytes from the file ... -testItem.Reset()                            // clear the DataItem structure -err = proto.Unmarshal(filebytes, testItem)  // deserialize into a DataItem instance +testItem.Reset() // clear the DataItem structure +err = proto.Unmarshal(filebytes, testItem) // deserialize into a DataItem instance ``` -The `proto.Unmarshal` function for deserializing Protbuf is the inverse of the `proto.Marshal` function. The original `DataItem` and the deserialized clone are printed to confirm an exact match: - +用于 Protbuf 反序列化的 `proto.Unmarshal` 函数与 `proto.Marshal` 函数相反。原始的 `DataItem` 和反序列化的副本将被打印出来以确认完全匹配: ``` Original: 2041519981506242154 3041486079683013705 1192 1879 0.572123 0.326855 -boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& +boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& Deserialized: 2041519981506242154 3041486079683013705 1192 1879 0.572123 0.326855 -boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& +boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& ``` -### A Protobuf client in Java - -The example in Java is to confirm Protobuf's language neutrality. The original IDL file could be used to generate the Java support code, which involves nested classes. To suppress warnings, however, a slight addition can be made. Here is the revision, which specifies a `DataMsg` as the name for the outer class, with the inner class automatically named `DataItem` after the Protobuf message: +### 一个 Java Protobuf 客户端 +Java 中的示例是为了确认 Protobuf 的语言中立性。原始 IDL 文件可用于生成 Java 支持代码,其中涉及嵌套类。但是,为了抑制警告信息,可以进行一些补充。这是修订版,它指定了一个 `DataMsg` 作为外部类的名称,内部类在 Protobuf 消息后自动命名为 `DataItem`: ``` syntax = "proto3"; @@ -320,175 +304,172 @@ message DataItem { ... ``` -With this change in place, the _protoc_ compilation is the same as before, except the desired output is now Java rather than Go: - +进行此更改后,`protoc` 编译与以前相同,只是所预期的输出现在是 Java 而不是 Go: ``` -`% protoc --java_out=. dataitem.proto` +% protoc --java_out=. dataitem.proto ``` -The resulting source file (in a subdirectory named _main_) is _DataMsg.java_ and about 1,120 lines in length: Java is not terse. Compiling and then running the Java code requires a JAR file with the library support for Protobuf. This file is available in the [Maven repository][9]. - -With the pieces in place, my test code is relatively short (and available in the ZIP file as _Main.java_): +生成的源文件(在名为 `main` 的子目录中)为 `DataMsg.java`,长度约为 1,120 行:Java 并不简洁。编译然后运行 Java 代码需要具有 Protobuf 库支持的 JAR 文件。该文件位于 [Maven 存储库][9]中。 +放置好这些片段后,我的测试代码相对较短(并且在 ZIP 文件中以 `Main.java` 形式提供): ``` package main; import java.io.FileInputStream; public class Main { -   public static void main(String[] args) { -      String path = "dataitem.pbuf";  // from the Go program's serialization -      try { -         DataMsg.DataItem deserial = -           DataMsg.DataItem.newBuilder().mergeFrom(new FileInputStream(path)).build(); + public static void main(String[] args) { + String path = "dataitem.pbuf"; // from the Go program's serialization + try { + DataMsg.DataItem deserial = + DataMsg.DataItem.newBuilder().mergeFrom(new FileInputStream(path)).build(); -         System.out.println(deserial.getOddA()); // 64-bit odd -         System.out.println(deserial.getLong()); // 32-character string -      } -      catch(Exception e) { System.err.println(e); } -    } + System.out.println(deserial.getOddA()); // 64-bit odd + System.out.println(deserial.getLong()); // 32-character string + } + catch(Exception e) { System.err.println(e); } + } } ``` -Production-grade testing would be far more thorough, of course, but even this preliminary test confirms the language-neutrality of Protobuf: the _dataitem.pbuf_ file results from the Go program's serialization of a Go `DataItem`, and the bytes in this file are deserialized to produce a `DataItem` instance in Java. The output from the Java test is the same as that from the Go test. +当然,生产级的测试将更加彻底,但是即使是该初步测试也可以证明 Protobuf 的语言中立性:`dataitem.pbuf` 文件是 Go 程序对 Go `DataItem` 进行序列化的结果,并且该文件中的字节被反序列化以在 Java 中产生一个 `DataItem` 实例。Java 测试的输出与 Go 测试的输出相同。 -### Wrapping up with the numPairs program - -Let's end with an example that highlights Protobuf efficiency but also underscores the cost involved in any encoding technology. Consider this Protobuf IDL file: +### 用 numPairs 程序来结束 +让我们以一个突出 Protobuf 效率但又强调在任何编码技术中都会涉及到的成本的示例作为结尾。考虑以下 Protobuf IDL 文件: ``` syntax = "proto3"; package main; message NumPairs { -  repeated NumPair pair = 1; + repeated NumPair pair = 1; } message NumPair { -  int32 odd = 1; -  int32 even = 2; + int32 odd = 1; + int32 even = 2; } ``` -A `NumPair` message consists of two `int32` values together with an integer tag for each field. A `NumPairs` message is a sequence of embedded `NumPair` messages. +`NumPair` 消息由两个 `int32` 值以及每个字段的整数标签组成。`NumPairs` 消息是嵌入的 `NumPair` 消息的序列。 -The _numPairs_ program in Go (below) creates 2 million `NumPair` instances, with each appended to the `NumPairs` message. This message can be serialized and deserialized in the usual way. - -#### Example 2. The numPairs program +Go 语言的 `numPairs` 程序(如下)创建了 200 万个 `NumPair` 实例,每个实例都附加到 `NumPairs` 消息中。该消息可以按常规方式进行序列化和反序列化。 +#### 示例 2、numPairs 程序 ``` package main import ( -   "math/rand" -   "time" -   "encoding/xml" -   "encoding/json" -   "io/ioutil" -   "github.com/golang/protobuf/proto" + "math/rand" + "time" + "encoding/xml" + "encoding/json" + "io/ioutil" + "github.com/golang/protobuf/proto" ) // protoc-generated code: start var _ = proto.Marshal type NumPairs struct { -   Pair []*NumPair `protobuf:"bytes,1,rep,name=pair" json:"pair,omitempty"` + Pair []*NumPair `protobuf:"bytes,1,rep,name=pair" json:"pair,omitempty"` } -func (m *NumPairs) Reset()         { *m = NumPairs{} } +func (m *NumPairs) Reset() { *m = NumPairs{} } func (m *NumPairs) String() string { return proto.CompactTextString(m) } -func (*NumPairs) ProtoMessage()    {} +func (*NumPairs) ProtoMessage() {} func (m *NumPairs) GetPair() []*NumPair { -   if m != nil { return m.Pair } -   return nil + if m != nil { return m.Pair } + return nil } type NumPair struct { -   Odd  int32 `protobuf:"varint,1,opt,name=odd" json:"odd,omitempty"` -   Even int32 `protobuf:"varint,2,opt,name=even" json:"even,omitempty"` + Odd int32 `protobuf:"varint,1,opt,name=odd" json:"odd,omitempty"` + Even int32 `protobuf:"varint,2,opt,name=even" json:"even,omitempty"` } -func (m *NumPair) Reset()         { *m = NumPair{} } +func (m *NumPair) Reset() { *m = NumPair{} } func (m *NumPair) String() string { return proto.CompactTextString(m) } -func (*NumPair) ProtoMessage()    {} +func (*NumPair) ProtoMessage() {} func init() {} // protoc-generated code: finish var numPairsStruct NumPairs -var numPairs = &numPairsStruct +var numPairs = &numPairsStruct func encodeAndserialize() { -   // XML encoding -   filename := "./pairs.xml" -   bytes, _ := xml.MarshalIndent(numPairs, "", " ") -   ioutil.WriteFile(filename, bytes, 0644) + // XML encoding + filename := "./pairs.xml" + bytes, _ := xml.MarshalIndent(numPairs, "", " ") + ioutil.WriteFile(filename, bytes, 0644) -   // JSON encoding -   filename = "./pairs.json" -   bytes, _ = json.MarshalIndent(numPairs, "", " ") -   ioutil.WriteFile(filename, bytes, 0644) + // JSON encoding + filename = "./pairs.json" + bytes, _ = json.MarshalIndent(numPairs, "", " ") + ioutil.WriteFile(filename, bytes, 0644) -   // ProtoBuf encoding -   filename = "./pairs.pbuf" -   bytes, _ = proto.Marshal(numPairs) -   ioutil.WriteFile(filename, bytes, 0644) + // ProtoBuf encoding + filename = "./pairs.pbuf" + bytes, _ = proto.Marshal(numPairs) + ioutil.WriteFile(filename, bytes, 0644) } -const HowMany = 200 * 100  * 100 // two million +const HowMany = 200 * 100 * 100 // two million func main() { -   rand.Seed(time.Now().UnixNano()) + rand.Seed(time.Now().UnixNano()) -   // uncomment the modulus operations to get the more efficient version -   for i := 0; i < HowMany; i++ { -      n1 := rand.Int31() // % 2047 -      if (n1 & 1) == 0 { n1++ } // ensure it's odd -      n2 := rand.Int31() // % 2047 -      if (n2 & 1) == 1 { n2++ } // ensure it's even + // uncomment the modulus operations to get the more efficient version + for i := 0; i < HowMany; i++ { + n1 := rand.Int31() // % 2047 + if (n1 & 1) == 0 { n1++ } // ensure it's odd + n2 := rand.Int31() // % 2047 + if (n2 & 1) == 1 { n2++ } // ensure it's even -      next := &NumPair { -                 Odd:  n1, -                 Even: n2, -              } -      numPairs.Pair = append(numPairs.Pair, next) -   } -   encodeAndserialize() + next := &NumPair { + Odd: n1, + Even: n2, + } + numPairs.Pair = append(numPairs.Pair, next) + } + encodeAndserialize() } ``` -The randomly generated odd and even values in each `NumPair` range from zero to 2 billion and change. In terms of raw rather than encoded data, the integers generated in the Go program add up to 16MB: two integers per `NumPair` for a total of 4 million integers in all, and each value is four bytes in size. +每个 `NumPair` 中随机生成的奇数和偶数值的范围在 0 到 20 亿之间变化。就原始数据(而非编码数据)而言,Go 程序中生成的整数加起来为 16MB:每个 `NumPair` 为两个整数,总计为 400 万个整数,每个值的大小为四个字节。 -For comparison, the table below has entries for the XML, JSON, and Protobuf encodings of the 2 million `NumPair` instances in the sample `NumsPairs` message. The raw data is included, as well. Because the _numPairs_ program generates random values, output differs across sample runs but is close to the sizes shown in the table. +为了进行比较,下表列出了 XML、JSON 和 Protobuf 编码的示例 `NumsPairs` 消息的 200 万个 `NumPair` 实例。原始数据也包括在内。由于 `numPairs` 程序生成随机值,因此样本运行的输出有所不同,但接近表中显示的大小。 -`Table 2. Encoding overhead for 16MB of integers` -Encoding | File | Byte size | Pbuf/other ratio +编码 | 文件 | 字节大小 | Pbuf/其它 比例 ---|---|---|--- -None | pairs.raw | 16MB | 169% +无 | pairs.raw | 16MB | 169% Protobuf | pairs.pbuf | 27MB | — JSON | pairs.json | 100MB | 27% XML | pairs.xml | 126MB | 21% -As expected, Protobuf shines next to XML and JSON. The Protobuf encoding is about a quarter of the JSON one and about a fifth of the XML one. But the raw data make clear that Protobuf incurs the overhead of encoding: the serialized Protobuf message is 11MB larger than the raw data. Any encoding, including Protobuf, involves structuring the data, which unavoidably adds bytes. +*表 2. 16MB 整数的编码开销* -Each of the serialized 2 million `NumPair` instances involves _four_ integer values: one apiece for the `Even` and `Odd` fields in the Go structure, and one tag per each field in the Protobuf encoding. As raw rather than encoded data, this would come to 16 bytes per instance, and there are 2 million instances in the sample `NumPairs` message. But the Protobuf tags, like the `int32` values in the `NumPair` fields, use _varint_ encoding and, therefore, vary in byte length; in particular, small integer values (which include the tags, in this case) require fewer than four bytes to encode. +不出所料,Protobuf 和之后的 XML 和 JSON 差别明显。Protobuf 编码大约是 JSON 的四分之一,而是 XML 的五分之一。但是原始数据清楚地表明 Protobuf 会产生编码开销:序列化的 Protobuf 消息比原始数据大 11MB。包括 Protobuf 在内的任何编码都涉及结构化数据,这不可避免地会增加字节。 -If the _numPairs_ program is revised so that the two `NumPair` fields hold values less than 2048, which have encodings of either one or two bytes, then the Protobuf encoding drops from 27MB to 16MB—the very size of the raw data. The table below summarizes the new encoding sizes from a sample run. +序列化的 200 万个 `NumPair` 实例中的每个实例都包含**四**个整数值:Go 结构中的 `Even` 和 `Odd` 字段分别一个,而 Protobuf 编码中的每个字段每个标签一个。作为原始数据而不是编码数据,每个实例将达到 16 个字节,样本 `NumPairs` 消息中有 200 万个实例。但是 Protobuf 标记(如 `NumPair` 字段中的 `int32` 值)使用 `varint` 编码,因此字节长度有所不同。特别是,小的整数值(在这种情况下,包括标签在内)需要不到四个字节进行编码。 -`Table 3. Encoding with 16MB of integers < 2048` +如果对 `numPairs` 程序进行了修改,以使两个 `NumPair` 字段的值小于 2048,且其编码为一或两个字节,则 Protobuf 编码将从 27MB 下降到 16MB,这正是原始数据的大小。下表总结了样本运行中的新编码大小。 -Encoding | File | Byte size | Pbuf/other ratio +编码 | 文件 | 字节大小 | Pbuf/其它 比例 ---|---|---|--- None | pairs.raw | 16MB | 100% Protobuf | pairs.pbuf | 16MB | — JSON | pairs.json | 77MB | 21% XML | pairs.xml | 103MB | 15% -In summary, the modified _numPairs_ program, with field values less than 2048, reduces the four-byte size for each integer value in the raw data. But the Protobuf encoding still requires tags, which add bytes to the Protobuf message. Protobuf encoding does have a cost in message size, but this cost can be reduced by the _varint_ factor if relatively small integer values, whether in fields or keys, are being encoded. +*表 3. 编码 16MB 的小于 2048 的整数* -For moderately sized messages consisting of structured data with mixed types—and relatively small integer values—Protobuf has a clear advantage over options such as XML and JSON. In other cases, the data may not be suited for Protobuf encoding. For example, if two applications need to share a huge set of text records or large integer values, then compression rather than encoding technology may be the way to go. +总之,修改后的 `numPairs` 程序的字段值小于 2048,可减少原始数据中每个整数值的四字节大小。但是 Protobuf 编码仍然需要标签,这些标签会在 Protobuf 消息中添加字节。Protobuf 编码确实会增加消息大小,但是如果要编码相对较小的整数值(无论是字段还是键),则可以通过 `varint` 因子来减少此开销。 + +对于包含混合类型的结构化数据(且整数值相对较小)的中等大小的消息,Protobuf 明显优于 XML 和 JSON 等选项。在其他情况下,数据可能不适合 Protobuf 编码。例如,如果两个应用程序需要共享大量文本记录或大整数值,则可以采用压缩而不是编码技术。 -------------------------------------------------------------------------------- @@ -496,7 +477,7 @@ via: https://opensource.com/article/19/10/protobuf-data-interchange 作者:[Marty Kalin][a] 选题:[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/) 荣誉推出 From 8d4a1c7db1ab2e6a1584830dc890e6446ae30337 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 20 Nov 2019 15:40:08 +0100 Subject: [PATCH 551/800] Update 20191104 Fields, records, and variables in awk.md --- ...4 Fields, records, and variables in awk.md | 70 +++++++++---------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/sources/tech/20191104 Fields, records, and variables in awk.md b/sources/tech/20191104 Fields, records, and variables in awk.md index 0c0d18adbf..7ab896317d 100644 --- a/sources/tech/20191104 Fields, records, and variables in awk.md +++ b/sources/tech/20191104 Fields, records, and variables in awk.md @@ -7,22 +7,20 @@ [#]: via: (https://opensource.com/article/19/11/fields-records-variables-awk) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Fields, records, and variables in awk +Fields, records, and variables in awk awk中字段,记录和变量 ====== -In the second article in this intro to awk series, learn about fields, -records, and some powerful awk variables. +在我们这个系列的第二部分,我们会学习到字段,记录和一些非常有用的awk变量。 ![Man at laptop on a mountain][1] -Awk comes in several varieties: There is the original **awk**, written in 1977 at AT&T Bell Laboratories, and several reimplementations, such as **mawk**, **nawk**, and the one that ships with most Linux distributions, GNU awk, or **gawk**. On most Linux distributions, awk and gawk are synonyms referring to GNU awk, and typing either invokes the same awk command. See the [GNU awk user's guide][2] for the full history of awk and gawk. - -The [first article][3] in this series showed that awk is invoked on the command line with this syntax: +Awk 有好几个变种: 最早版本的 **awk**, 是1977 年 AT&T Bell 实验室所创造的。还有一些重构版本,例如**mawk**, **nawk**。现在我们能在大多数Linux 发行版中见到的,是 GNU awk,也叫**gawk**。 在大多数 Linux 版本中,awk 和 gawk 都是指向 GNU awk 的链接。 如果输入awk命令,也是一样的效果。 在 [GNU awk 用户手册][2]中能看到 awk 和 gawk 的全部历史。 +这一系列的[第一篇文章][3] 介绍了awk 命令的基本格式: ``` `$ awk [options] 'pattern {action}' inputfile` ``` -Awk is the command, and it can take options (such as **-F** to define the field separator). The action you want awk to perform is contained in single quotes, at least when it's issued in a terminal. To further emphasize which part of the awk command is the action you want it to take, you can precede your program with the **-e** option (but it's not required): +Awk 是一个命令,后面要接选项 (比如用 **-F** 来定义字段分隔符)。 你想让awk 执行的部分需要写在 两个单引号之间,至少在终端中需要这么做。 在awk 命令中,为了进一步强调你想要执行的部分,可以用 **-e** 选项来突出显示 (但这不是必须的): ``` @@ -33,43 +31,42 @@ green [...] ``` -### Records and fields +### Records and fields 记录和字段 Awk views its input data as a series of _records_, which are usually newline-delimited lines. In other words, awk generally sees each line in a text file as a new record. Each record contains a series of _fields_. A field is a component of a record delimited by a _field separator_. +Awk 将输入数据视为 一系列 _记录_ , 通常来说是按行分割的。 换句话说,awk 通常将文本中的每一行视作一个记录。每一记录包含多个 _字段_. 一个字段是由 _字段分隔符_ 分隔出的,记录的一部分. -By default, awk sees whitespace, such as spaces, tabs, and newlines, as indicators of a new field. Specifically, awk treats multiple _space_ separators as one, so this line contains two fields: +默认情况下,awk 将各种空白符,如空格,tab,换行符,视为分隔符。 值得注意的是,awk 将多个 _空格_ 视为一个分隔符。所以下面这行文本有两个字段: ``` `raspberry red` ``` -As does this one: +这行也是: ``` `tuxedo                  black` ``` -Other separators are not treated this way. Assuming that the field separator is a comma, the following example record contains three fields, with one probably being zero characters long (assuming a non-printable character isn't hiding in that field): - +其他分隔符,在程序中不是这么处理的。假设字段分隔符是逗号,如下所示的记录就分为三个字段。其中一个字段可能会只有0个字节长(假设这一字段中不包含隐藏字符) ``` `a,,b` ``` -### The awk program - -The _program_ part of an awk command consists of a series of rules. Normally, each rule begins on a new line in the program (although this is not mandatory). Each rule consists of a pattern and one or more actions: +### awk 程序 +awk 命令的 _程序部分_ 是由一系列规则组成的。通常来说,在程序中每个规则占一行(尽管这不是必须的)。 每个规则由一个模式,或者一个/多个动作组成: ``` `pattern { action }` ``` -In a rule, you can define a pattern as a condition to control whether the action will run on a record. Patterns can be simple comparisons, regular expressions, combinations of the two, and more. +在一个规则中,你可以通过定义模式,来确定行动是否会在记录中执行。 模式可以是简单的比较条件,正则表达式,两者的结合或者更多。 -For instance, this will print a record _only_ if it contains the word "raspberry": +这个例子中,程序 _只会_ 显示包含 单词 “raspberry” 的记录: ``` @@ -77,15 +74,15 @@ $ awk '/raspberry/ { print $0 }' colours.txt raspberry red 99 ``` -If there is no qualifying pattern, the action is applied to every record. +如果没有文本符合模式,最终结果会对应所有记录。 -Also, a rule can consist of only a pattern, in which case the entire record is written as if the action was **{ print }**. +并且,在一条规则只包含一个模式时,相当于在整个记录上执行 **{ print }** 命令。 -Awk programs are essentially _data-driven_ in that actions depend on the data, so they are quite a bit different from programs in many other programming languages. +Awk 程序本质上是 _数据驱动_ 的,命令执行结果取决于数据。所以,与其他编程语言中的程序相比,它还是有些区别的。 -### The NF variable +### NF 变量 -Each field has a variable as a designation, but there are special variables for fields and records, too. The variable **NF** stores the number of fields awk finds in the current record. This can be printed or used in tests. Here is an example using the [text file][3] from the previous article: +每个字段都有指定变量,但针对字段和记录,也有一些特殊的变量。 **NF** 变量能存储awk在当前记录中找到的数字字段。可在屏幕上显示出变量内容,或将其用于测试。 下面例子中的数据,来自前一篇文章中的 [文本][3]: ``` @@ -96,12 +93,11 @@ banana     yellow 6 (3) [...] ``` -Awk's **print** function takes a series of arguments (which may be variables or strings) and concatenates them together. This is why, at the end of each line in this example, awk prints the number of fields as an integer enclosed by parentheses. +Awk 的 **print** 函数会接受一系列参数(可以是变量或者字符),并将它们拼接起来。这就是为什么在这一例子中,在每行结尾处,awk 会显示一个被括号括起来的整数。 -### The NR variable - -In addition to counting the fields in each record, awk also counts input records. The record number is held in the variable **NR**, and it can be used in the same way as any other variable. For example, to print the record number before each line: +### NR 变量 +另外,为了计算每个记录中的字段数,awk 也计算输入记录。 记录数目被存储在变量 **NR** 中,它的使用方法和其他变量没有任何区别。例如,为了在每一行开头显示行号: ``` $ awk '{ print NR ": " $0 }' colours.txt @@ -113,24 +109,23 @@ $ awk '{ print NR ": " $0 }' colours.txt [...] ``` -Note that it's acceptable to write this command with no spaces other than the one after **print**, although it's more difficult for a human to parse: +注意,在这个命令后输入数据时,可以不同于在 **print** 后,参数间可以不写空格,尽管这样会降低可读性: ``` `$ awk '{print NR": "$0}' colours.txt` ``` -### The printf() function +### printf() 函数 -For greater flexibility in how the output is formatted, you can use the awk **printf()** function. This is similar to **printf** in C, Lua, Bash, and other languages. It takes a _format_ argument followed by a comma-separated list of items. The argument list may be enclosed in parentheses. +为了输出结果时格式更灵活,你可以使用 awk 的 **printf()** 函数。 它与C,Lua,Bash和其他语言中的 **printf** 相类似。 它也接受 _格式_ ,后用逗号分隔的参数。参数列表需要写在括号内。 ``` `$ printf format, item1, item2, ...` ``` -The format argument (or _format string_) defines how each of the other arguments will be output. It uses _format specifiers_ to do this, including **%s** to output a string and **%d** to output a decimal number. The following **printf** statement outputs the record followed by the number of fields in parentheses: - +格式这一参数(也叫 _格式符_ ) 定义了其他参数会如何显示。 这一功能是用 _格式修饰符_ 来实现的。 用 **%s** 显示字符, **%d** 显示数字。 下面的**printf** 语句,会在括号内显示字段数量: ``` $ awk 'printf "%s (%d)\n",$0,NF}' colours.txt @@ -140,13 +135,14 @@ banana     yellow 6 (3) [...] ``` -In this example, **%s (%d)** provides the structure for each line, while **$0,NF** defines the data to be inserted into the **%s** and **%d** positions. Note that, unlike with the **print** function, no newline is generated without explicit instructions. The escape sequence **\n** does this. -### Awk scripting +在这个例子里, **%s (%d)** 提供了每一行的输出格式,**$0,NF** 定义了插入 **%s** 和 **%d** 位置的数据。注意,不像**print** 函数,在没有明确指令时下,输出不会转到下一行。 转义字符 **\n** 才会换行。 -All of the awk code in this article has been written and executed in an interactive Bash prompt. For more complex programs, it's often easier to place your commands into a file or _script_. The option **-f FILE** (not to be confused with **-F**, which denotes the field separator) may be used to invoke a file containing a program. +### Awk 脚本编程 -For example, here is a simple awk script. Create a file called **example1.awk** with this content: +这篇文章中出现的所有awk代码,都在Bash终端中执行过。 在更复杂的程序中,将你的命令放在文件( _脚本_ )中,这样会更容易。 **-f FILE** 选项(不要和 **-F** 弄混了,那个选项用于字段分隔符),可用于调用包含可执行程序的文件。 + +例如,这里有一个简单的awk 脚本。 创建一个名为 **example1.awk** 的文件,包含以下内容: ``` @@ -155,6 +151,7 @@ For example, here is a simple awk script. Create a file called **example1.awk** ``` It's conventional to give such files the extension **.awk** to make it clear that they hold an awk program. This naming is not mandatory, but it gives file managers and editors (and you) a useful clue about what the file is. +如果一个文件包含 awk 程序,最好给这些文件 **.awk** 的扩展名。 Run the script: @@ -166,8 +163,7 @@ B: banana     yellow 6 A: apple      green  8 ``` -A file containing awk instructions can be made into a script by adding a **#!** line at the top and making it executable. Create a file called **example2.awk** with these contents: - +一个包含 awk 命令的文件,在最开头一行加上 **#!** ,就可以变成可执行脚本。 创建一个名为 **example2.awk** 的文件,包含以下内容: ``` #!/usr/bin/awk -f From 0444455fcc61c45d63cb1fe4733bb9ad588f1090 Mon Sep 17 00:00:00 2001 From: hopefully2333 <787016457@qq.com> Date: Wed, 20 Nov 2019 23:05:43 +0800 Subject: [PATCH 552/800] translating by hopefully2333 translating by hopefully2333 --- .../20191118 How internet security works- TLS, SSL, and CA.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md b/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md index 9746ca39d2..0247b43ef1 100644 --- a/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md +++ b/sources/tech/20191118 How internet security works- TLS, SSL, and CA.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hopefully2333) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -54,4 +54,4 @@ This process ensures that communication is secure and encrypted when an end user A CA is a trusted organization that can issue a digital certificate. -TLS and SSL can make a connection secure, but the encryption mechanism needs a way to validate it; this is the SSL/TLS certificate. TLS uses a mechanism called asymmetric encryption, which i \ No newline at end of file +TLS and SSL can make a connection secure, but the encryption mechanism needs a way to validate it; this is the SSL/TLS certificate. TLS uses a mechanism called asymmetric encryption, which i From d4e4994b885fb2a69f7dc749d12a19fbcb1e17df Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 00:50:45 +0800 Subject: [PATCH 553/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191121=20Bash?= =?UTF-8?q?=20Script=20to=20View=20System=20Information=20on=20Linux=20Eve?= =?UTF-8?q?ry=20Time=20You=20Log=20into=20Shell?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md --- ... on Linux Every Time You Log into Shell.md | 218 ++++++++++++++++++ 1 file changed, 218 insertions(+) create mode 100644 sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md diff --git a/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md b/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md new file mode 100644 index 0000000000..9efdc87ec1 --- /dev/null +++ b/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md @@ -0,0 +1,218 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to View System Information on Linux Every Time You Log into Shell) +[#]: via: (https://www.2daygeek.com/bash-shell-script-view-linux-system-information/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to View System Information on Linux Every Time You Log into Shell +====== + +There are several commands in Linux to obtain system information such as processor information, manufacturer name, and serial number, etc,. + +You may need to run several commands to collect this information. + +Also, it is very difficult to remember all the commands and their options. + +Instead you can write a **[shell script][1]** to customize the output based on your needs. + +In the past we have written many **[bash scripts][2]** for a variety of purposes. + +Today, we came up with a new shell script, which shows you the required system information every time you log into the shell. + +There are six parts to this script, and more details below. + + * **Part-1:** General System Information + * **Part-2:** CPU/Memory Current Usage + * **Part-3:** Disk Usage >80% + * **Part-4:** List System WWN Details + * **Part-5:** Oracle DB Instances + * **Part-6:** Available Package Updates + + + +We’ve added potential information to each area based on our needs. You can further customize this script to your needs if you wish. + +There are many tools for this, most of which we have already covered. + +To read them, go to the following articles. + + * **[inxi – A Great Tool to Check Hardware Information on Linux][3]** + * **[Dmidecode – Easy Way To Get Linux System Hardware Information][3]** + * **[LSHW (Hardware Lister) – A Nifty Tool To Get A Hardware Information On Linux][3]** + * **[hwinfo (Hardware Info) – A Nifty Tool To Detect System Hardware Information On Linux][3]** + * **[python-hwinfo : Display Summary Of Hardware Information Using Standard Linux Utilities][3]** + * **[How To Use lspci, lsscsi, lsusb, And lsblk To Get Linux System Devices Information][3]** + * **[How To Check System Hardware Manufacturer, Model And Serial Number In Linux][3]** + * **[How To Find WWN, WWNN and WWPN Number Of HBA Card In Linux][3]** + * **[How to check HP iLO Firmware version from Linux command line][3]** + * **[How to check Wireless network card and WiFi information from Linux Command Line][3]** + * **[How to check CPU & Hard Disk temperature on Linux][3]** + * **[Hegemon – A modular System & Hardware monitoring tool for Linux][3]** + * **[How to Check System Configuration and Hardware Information on Linux][3]** + + + +If anyone wants to add any other information in the script, please let us know your requirements in the comment section so that we can help you. + +### Bash Script to View System Information on Linux Every Time You Log into the Shell + +This basic script will bring the system information to your terminal whenever you log into the shell. + +``` +#vi /opt/scripts/system-info.sh + +#!/bin/bash +echo -e "-------------------------------System Information----------------------------" +echo -e "Hostname:\t\t"`hostname` +echo -e "uptime:\t\t\t"`uptime | awk '{print $3,$4}' | sed 's/,//'` +echo -e "Manufacturer:\t\t"`cat /sys/class/dmi/id/chassis_vendor` +echo -e "Product Name:\t\t"`cat /sys/class/dmi/id/product_name` +echo -e "Version:\t\t"`cat /sys/class/dmi/id/product_version` +echo -e "Serial Number:\t\t"`cat /sys/class/dmi/id/product_serial` +echo -e "Machine Type:\t\t"`vserver=$(lscpu | grep Hypervisor | wc -l); if [ $vserver -gt 0 ]; then echo "VM"; else echo "Physical"; fi` +echo -e "Operating System:\t"`hostnamectl | grep "Operating System" | cut -d ' ' -f5-` +echo -e "Kernel:\t\t\t"`uname -r` +echo -e "Architecture:\t\t"`arch` +echo -e "Processor Name:\t\t"`awk -F':' '/^model name/ {print $2}' /proc/cpuinfo | uniq | sed -e 's/^[ \t]*//'` +echo -e "Active User:\t\t"`w | cut -d ' ' -f1 | grep -v USER | xargs -n1` +echo -e "System Main IP:\t\t"`hostname -I` +echo "" +echo -e "-------------------------------CPU/Memory Usage------------------------------" +echo -e "Memory Usage:\t"`free | awk '/Mem/{printf("%.2f%"), $3/$2*100}'` +echo -e "Swap Usage:\t"`free | awk '/Swap/{printf("%.2f%"), $3/$2*100}'` +echo -e "CPU Usage:\t"`cat /proc/stat | awk '/cpu/{printf("%.2f%\n"), ($2+$4)*100/($2+$4+$5)}' | awk '{print $0}' | head -1` +echo "" +echo -e "-------------------------------Disk Usage >80%-------------------------------" +df -Ph | sed s/%//g | awk '{ if($5 > 80) print $0;}' +echo "" + +echo -e "-------------------------------For WWN Details-------------------------------" +vserver=$(lscpu | grep vendor | wc -l) +if [ $vserver -gt 0 ] +then +echo "$(hostname) is a VM" +else +systool -c fc_host -v | egrep "(Class Device path | port_name |port_state)" > systool.out +fi +echo "" + +echo -e "-------------------------------Oracle DB Instances---------------------------" +if id oracle >/dev/null 2>&1; then +/bin/ps -ef|grep pmon +then +else +echo "oracle user does not exist on $(hostname)" +fi +echo "" + +if (( $(cat /etc/*-release | grep -w "Oracle|Red Hat|CentOS|Fedora" | wc -l) > 0 )) +then +echo -e "-------------------------------Package Updates-------------------------------" +yum updateinfo summary | grep 'Security|Bugfix|Enhancement' +echo -e "-----------------------------------------------------------------------------" +else +echo -e "-------------------------------Package Updates-------------------------------" +cat /var/lib/update-notifier/updates-available +echo -e "-----------------------------------------------------------------------------" +fi +``` + +Once the above script is added to a file. Set the executable permission for the “system-info.sh” file. + +``` +# chmod +x ~root/system-info.sh +``` + +When the script is ready, add the file path at the end of the “.bash_profile” file in RHEL-based systems CentOS, Oracle Linux and Fedora. + +``` +# echo "/root/system-info.sh" >> ~root/.bash_profile +``` + +To take this change effect, run the following command. + +``` +# source ~root/.bash_profile +``` + +For Debian-based systems, you may need to add a file path to the “.profile” file. + +``` +# echo "/root/system-info.sh" >> ~root/.profile +``` + +Run the following command to take this change effect. + +``` +# source ~root/.profile +``` + +You may have seen an output like the one below when running the above “source” command. + +From next time on-wards, you will get this information every time you log into the shell. + +Alternatively, you can manually run this script at any time if you need to. + +``` +-------------------------------System Information--------------------------- +Hostname: daygeek-Y700 +uptime: 1:20 1 +Manufacturer: LENOVO +Product Name: 80NV +Version: Lenovo ideapad Y700-15ISK +Serial Number: AA0CMRN1 +Machine Type: Physical +Operating System: Manjaro Linux +Kernel: 4.19.80-1-MANJARO +Architecture: x86_64 +Processor Name: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz +Active User: daygeek renu thanu +System Main IP: 192.168.1.6 192.168.122.1 + +-------------------------------CPU/Memory Usage------------------------------ +Memory Usage: 37.28% +Swap Usage: 0.00% +CPU Usage: 15.43% + +-------------------------------Disk Usage >80%------------------------------- +Filesystem Size Used Avail Use Mounted on +/dev/nvme0n1p1 217G 202G 4.6G 98 / +/dev/loop0 109M 109M 0 100 /var/lib/snapd/snap/odrive-unofficial/2 +/dev/loop1 91M 91M 0 100 /var/lib/snapd/snap/core/6405 +/dev/loop2 90M 90M 0 100 /var/lib/snapd/snap/core/7713 + +-------------------------------For WWN Details------------------------------- +CentOS8.2daygeek.com is a VM + +-------------------------------Oracle DB Instances--------------------------- +oracle user does not exist on CentOS8.2daygeek.com + +-------------------------------Package Updates------------------------------- + 13 Security notice(s) + 9 Important Security notice(s) + 3 Moderate Security notice(s) + 1 Low Security notice(s) + 35 Bugfix notice(s) + 1 Enhancement notice(s) +----------------------------------------------------------------------------- +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-shell-script-view-linux-system-information/ + +作者:[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/category/shell-script/ +[2]: https://www.2daygeek.com/category/bash-script/ +[3]: https://www.2daygeek.com/inxi-system-hardware-information-on-linux/ From cb0020eb7663a58368bbc321f24204d9f8bc3918 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 00:51:00 +0800 Subject: [PATCH 554/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=20Set=20?= =?UTF-8?q?up=20single=20sign-on=20for=20Fedora=20Project=20services?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191120 Set up single sign-on for Fedora Project services.md --- ...gle sign-on for Fedora Project services.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20191120 Set up single sign-on for Fedora Project services.md diff --git a/sources/tech/20191120 Set up single sign-on for Fedora Project services.md b/sources/tech/20191120 Set up single sign-on for Fedora Project services.md new file mode 100644 index 0000000000..e580b1dd21 --- /dev/null +++ b/sources/tech/20191120 Set up single sign-on for Fedora Project services.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Set up single sign-on for Fedora Project services) +[#]: via: (https://fedoramagazine.org/set-up-single-sign-on-for-fedora-project-services/) +[#]: author: (Stephen Gallagher https://fedoramagazine.org/author/sgallagh/) + +Set up single sign-on for Fedora Project services +====== + +![][1] + +In addition to an operating system, the Fedora Project provides [services][2] for users and developers. Services such as [Ask Fedora][3], the [Fedora Project wiki][4] and the [Fedora Project mailing lists][5] help users [learn][6] how to best take advantage of Fedora. For developers of Fedora, there are many other services such as [dist-git][7], [Pagure][8], [Bodhi][9], [COPR][10] and [Bugzilla][11] for the packaging and release process. + +These services are available with a free account from the [Fedora Accounts System][12] (FAS). This account is the passport to all things Fedora! This article covers how to get set up with an account and configure [Fedora Workstation][13] for browser single sign-on. + +### Signing up for a Fedora account + +To create a FAS account, browse to the [account creation page][14]. Here, you will fill out your basic identity data: + +![Account creation page][15] + +Once you enter your data, the account system sends an email to the address you provided, with a temporary password. Pick a strong password and use it. + +![Password reset page][16] + +Next, the account details page appears. If you want to contribute to the Fedora Project, you should complete the [Contributor Agreement][17] now. Otherwise, you are done and you can use your account to log into the various Fedora services. + +![Account details page][18] + +### Configuring Fedora Workstation for single sign-On + +Now that you have your account, you can sign into any of the Fedora Project services. Most of these services support single sign-on (SSO), so you can sign in without re-entering your username and password. + +Fedora Workstation provides an easy workflow to add your Fedora credentials. The GNOME Online Accounts tool helps you quickly set up your system to access many popular services. To access it, go to the _Settings_ menu. + +![][19] + +Click on the option labeled _Fedora_. A prompt opens for you to provide your username and password for your Fedora Account. + +![][20] + +GNOME Online Accounts stores your password in [GNOME Keyring][21] and automatically acquires your single-sign-on credentials for you when you log in. + +### Single sign-on with a web browser + +Today, Fedora Workstation supports three web browsers out of the box with support for single sign-on with the Fedora Project services. These are [Mozilla Firefox][22], [GNOME Web][23], and [Google Chrome][24]. + +Due to a [bug][25] in Chromium, single sign-on doesn’t work currently if you have more than one set of Kerberos (SSO) credentials active on your session. As a result, Fedora doesn’t enable this function out of the box for Chromium in Fedora. + +To sign on to a service, browse to it and select the _login_ option for that service. For most Fedora services, this is all you need to do; the browser handles the rest. Some services such as the [Fedora mailing lists][26] and [Bugzilla][11] support multiple login types. For them, select the _Fedora_ or _Fedora Account System_ login type. + +That’s it! You can now log into any of the Fedora Project services without re-entering your password. + +##### Special consideration for Google Chrome + +To enable single sign-on out of the box for Google Chrome, Fedora takes advantage of certain features in Chrome that are intended for use in “managed” environments. A managed environment is traditionally a corporate or other organization that sets certain security and/or monitoring requirements on the browser. + +Recently, Google Chrome changed its behavior and it now reports _Managed by your organization_ or possibly _Managed by fedoraproject.org_ under the ⋮ menu in Google Chrome. That [link][27] leads to a page that says, “If your Chrome browser is managed, your administrator can set up or restrict certain features, install extensions, monitor activity, and control how you use Chrome.” However, **[Fedora will never monitor your browser activity or restrict your actions][28].** + +Enter _chrome://policy_ in the address bar to see exactly what settings Fedora has enabled in the browser. The _AuthNegotiateDelegateWhitelist_ and _AuthServerWhitelist_ options will be set to _*.fedoraproject.or_g. These are the only changes Fedora makes. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/set-up-single-sign-on-for-fedora-project-services/ + +作者:[Stephen Gallagher][a] +选题:[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/sgallagh/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/05/sso-fedora-web-services-816x345.jpg +[2]: https://apps.fedoraproject.org/ +[3]: https://ask.fedoraproject.org/ +[4]: https://fedoraproject.org/wiki/Fedora_Project_Wiki +[5]: https://lists.fedoraproject.org/archives/ +[6]: https://fedoramagazine.org/check-out-the-new-askfedora/ +[7]: http://src.fedoraproject.org/ +[8]: https://pagure.io +[9]: https://bodhi.fedoraproject.org +[10]: https://copr.fedorainfracloud.org/ +[11]: https://bugzilla.redhat.com +[12]: https://admin.fedoraproject.org/accounts +[13]: https://getfedora.org/ +[14]: https://admin.fedoraproject.org/accounts/user/new +[15]: https://fedoramagazine.org/wp-content/uploads/2019/05/FAS-new.png +[16]: https://fedoramagazine.org/wp-content/uploads/2019/05/changepass-1024x318.png +[17]: https://admin.fedoraproject.org/accounts/fpca/ +[18]: https://fedoramagazine.org/wp-content/uploads/2019/05/account-blurred.png +[19]: https://fedoramagazine.org/wp-content/uploads/2019/09/goa-toplevel.png +[20]: https://fedoramagazine.org/wp-content/uploads/2019/09/goa-fedora-creds.png +[21]: https://wiki.gnome.org/Projects/GnomeKeyring +[22]: https://www.mozilla.org/en-US/firefox +[23]: https://wiki.gnome.org/Apps/Web +[24]: https://www.google.com/chrome/ +[25]: https://bugzilla.redhat.com/show_bug.cgi?id=1640158 +[26]: https://lists.fedoraproject.org +[27]: https://support.google.com/chrome/answer/9281740 +[28]: https://fedoraproject.org/wiki/Legal:PrivacyPolicy From e65b32e87e20f4c5525afbef3c50a2fded8de253 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 00:51:20 +0800 Subject: [PATCH 555/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191121=20The=20?= =?UTF-8?q?Cross-Platform=20Source=20Explorer=20Sourcetrail=20is=20Now=20O?= =?UTF-8?q?pen=20Source?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md --- ...Explorer Sourcetrail is Now Open Source.md | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 sources/tech/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md diff --git a/sources/tech/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md b/sources/tech/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md new file mode 100644 index 0000000000..c4f25f1419 --- /dev/null +++ b/sources/tech/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Cross-Platform Source Explorer Sourcetrail is Now Open Source) +[#]: via: (https://itsfoss.com/sourcetrail/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +The Cross-Platform Source Explorer Sourcetrail is Now Open Source +====== + +[Sourcetrail][1] is a cross-platform source explorer that lets you visualize the unfamiliar source code by using graph visualization. + +![][2] + +In other words, it makes it easy to understand the structure of source code and how it works (technically) by visually representing them using a graph. + +This is particularly helpful when you join a project and you have to work on existing code written in the past by several developers. + +You can use it with your favorite IDE like Eclipse, IntelliJ IDEA, PyCharm or code editors like Atom, Visual Studio Code, Sublime Text etc. It supports C, C++, Java and Python. + +This old video gives you the introduction to Sourcetrail: + +Even though it was free for non-commercial use, they charged for a commercial license. However, they recently decided to make the whole thing free and open source. + +So, yes, you can find their source code listed on [GitHub][3] now. + +### What Has Changed for Sourcetrail? + +The reason they switched as an open-source solution is that they wanted their tool to be accessible to more developers. + +Their commercial licensing plan was supposed to help them make money – however, it limited the reach of their project. + +In their [announcement post][4], they mentioned their idea of this decision as follows: + +> We have been going back and forth, discussing and testing potential solutions to many of those issues for a long time now. Many of our thoughts revolved around how to make more money and use it to solve those issues. Looking at other companies in the field, it seemed that to make more money, our only option was making our licenses more and more expensive, which in turn would limit our audience to fewer developers. We always dismissed the idea because **we started to make Sourcetrail to benefit as many developers as possible** and not to be a premium product for a few people in a handful of companies. + +Also, they found it tough to provide cross-platform support while trying to reproduce the issues and apply a fix to them, especially for Linux distros. So, making their project open source was an ideal choice. + +To further clarify the situation they also explained why their commercial licensing plan wasn’t working out: + +> Initially we received a couple of public grants that allowed us to launch Sourcetrail publicly. We decided to go down the traditional road of selling software licenses to sustain further development. Of course that meant to keep the code private if we wanted to protect our business…In retrospect, this decision really narrowed down our user base, making it hard for developers to start using Sourcetrail for multiple reasons + +You can find all the details for what they plan for the future in their [announcement post][4]. + +### How to get Sourcetrail on Linux? + +You can find and download the latest release of Sourcetrail on its release page on GitHub: + +[Download Sourcetrail][5] + +Extract the downloaded file and you’ll see a Sourcetrail.sh shell script. Run this script with sudo to install Sourcerail. + +You should [read the documentation][6] for the project setup. They also have some [useful tutorial videos on their YouTube channel][7]. + +Sourcetrail was free before but now it’s free in the true sense. It’s good to see that the developers have made it open source and now more programmers can use this tool to understand large, shared code base. You may also checkout a slightly similar open source tool [Sourcegraph][8]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/sourcetrail/ + +作者:[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.sourcetrail.com/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/sourcetrail-ui.png?ssl=1 +[3]: https://github.com/CoatiSoftware/Sourcetrail +[4]: https://www.sourcetrail.com/blog/open_source/ +[5]: https://github.com/CoatiSoftware/Sourcetrail/releases +[6]: https://www.sourcetrail.com/documentation/#PROJECTSETUP +[7]: https://www.youtube.com/channel/UCuKthdG-V4n2RZ1HDJhGVpQ/videos +[8]: https://itsfoss.com/sourcegraph/ From 17dbf7a5a6d7ee3263475602c47bab83cf2295c4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 00:51:52 +0800 Subject: [PATCH 556/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=20How=20?= =?UTF-8?q?to=20Use=20TimeShift=20to=20Backup=20and=20Restore=20Ubuntu=20L?= =?UTF-8?q?inux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md --- ...hift to Backup and Restore Ubuntu Linux.md | 150 ++++++++++++++++++ 1 file changed, 150 insertions(+) create mode 100644 sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md diff --git a/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md new file mode 100644 index 0000000000..cb9fc7f908 --- /dev/null +++ b/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Use TimeShift to Backup and Restore Ubuntu Linux) +[#]: via: (https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to Use TimeShift to Backup and Restore Ubuntu Linux +====== + +Have you ever wondered how you can backup and restore your **Ubuntu** or **Debian system** ? **Timeshift** is a free and opensource tool that allows you to create incremental snapshots of your filesystem. You can create a snapshot using either **RSYNC** or **BTRFS**. + +[![TimeShift-Backup-Restore-Tool-Ubuntu][1]][2] + +With that. let’s delve in and install Timeshift. For this tutorial, we shall install on Ubuntu 18.04 LTS system. + +### Installing TimeShift on Ubuntu / Debian Linux + +TimeShift is not hosted officially on Ubuntu and Debian repositories. With that in mind, we are going to run the command below to add the PPA: + +``` +# add-apt-repository -y ppa:teejee2008/ppa +``` + +![Add-timeshift-repository][1] + +Next, update the system packages with the command: + +``` +# apt update +``` + +After a successful system update, install timeshift by running following apt command : + +``` +# apt install timeshift +``` + +![apt-install-timeshift][1] + +### Preparing a backup storage device + +Best practice demands that we save the system snapshot on a separate storage volume, aside from the system’s hard drive. For this guide, we are using a 16 GB flash drive as the secondary drive on which we are going to save the snapshot. + +``` +# lsblk | grep sdb +``` + +![lsblk-sdb-ubuntu][1] + +For the flash drive to be used as a backup location for the snapshot, we need to create a partition table on the device. Run the following commands: + +``` +# parted /dev/sdb mklabel gpt +# parted /dev/sdb mkpart primary 0% 100% +# mkfs.ext4 /dev/sdb1 +``` + +![create-partition-table-on-drive-ubuntu][1] + +After creating a partition table on the USB flash drive, we are all set to begin creating filesystem’s snapshots! + +### Using Timeshift to create snapshots + +To launch Timeshift, use the application menu to search for the  Timeshift application. + +![Access-Timeshift-Ubuntu][1] + +Click on the Timeshift icon and the system will prompt you for the Administrator’s password. Provide the password and click on Authenticate + +![Authentication-required-ubuntu][1] + +Next, select your preferred snapshot type. + +![Select-Rsync-option-timeshift][1] + +Click ‘**Next**’.  Select the destination drive for the snapshot. In this case, my location is the external USB drive labeled as **/dev/sdb** + +![Select-snapshot location][1] + +Next, define the snapshot levels. Levels refer to the intervals during which the snapshots are created.  You can choose to have either monthly, weekly, daily, or hourly snapshot levels. + +![Select-snapshot-levels-Timeshift][1] + +Click ‘Finish’ + +On the next Window, click on the ‘**Create**’ button to begin creating the snapshot. Thereafter, the system will begin creating the snapshot. + +![Create-snapshot-timeshift][1] + +Finally, your snapshot will be displayed as shown + +![Snapshot-created-TimeShift][1] + +### Restoring Ubuntu / Debian from a snapshot + +Having created a system snapshot, let’s now see how you can restore your system from the same snapshot. On the same Timeshift window, click on the snapshot and click on the ‘**Restore**’ button as shown. + +![Restore-snapshot-timeshift][1] + +Next, you will be prompted to select the target device.  leave the default selection and hit ‘**Next**’. + +![Select-target-device-timeshift][1] + +A dry run will be performed by Timeshift before the restore process commences. + +![Comparing-files-Dry-Run-timeshift][1] + +In the next window, hit the ‘**Next**’  button to confirm actions displayed. + +![Confirm-actions-timeshift][1] + +You’ll get a warning and a disclaimer as shown. Click ‘**Next**’ to initialize the restoration process. + +Thereafter, the restore process will commence and finally, the system will thereafter reboot into an earlier version as defined by the snapshot. + +![Restoring-snapshot-timeshift][1] + +**Conclusion** + +As you have seen it quite easy to use TimeShift to restore your system from a snapshot. It comes in handy when backing up system files and allows you to recover in the event of a system fault. So don’t get scared to tinker with your system or mess up. TimeShift will give you the ability to go back to a point in time when everything was running smoothly. + + * [Facebook][3] + * [Twitter][4] + * [LinkedIn][5] + * [Reddit][6] + + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/ + +作者:[James Kiarie][a] +选题:[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/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/TimeShift-Backup-Restore-Tool-Ubuntu.png +[3]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&t=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux +[4]: http://twitter.com/share?text=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&via=Linuxtechi +[5]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux +[6]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux From 625d6b5bb8a461cb42978df26a942ff666575933 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 00:52:31 +0800 Subject: [PATCH 557/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=20Switch?= =?UTF-8?q?ing=20from=20Python=202=20to=20Python=203:=20What=20you=20need?= =?UTF-8?q?=20to=20know?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md --- ...on 2 to Python 3- What you need to know.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md diff --git a/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md new file mode 100644 index 0000000000..fe5115256e --- /dev/null +++ b/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Switching from Python 2 to Python 3: What you need to know) +[#]: via: (https://opensource.com/article/19/11/end-of-life-python-2) +[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) + +Switching from Python 2 to Python 3: What you need to know +====== +Python 2 will reach its end of life in mere weeks. Here's what to know +before you migrate to Python 3. +![A sunrise][1] + +Python 2.7 will officially become unsupported beginning January 1, 2020. There is one [final bugfix][2] planned after this date, but then that's it. + +What does this end of life (EOL) mean for you? If you run Python 2, you need to migrate. + +### Who decided to EOL Python 2? + +In [2012][3], the team maintaining the Python programming language reviewed its options. There were two increasingly different codebases, Python 2 and Python 3. Both were popular, but the newer version was not as widely adopted. + +In addition to Python 3's disruption of changing the underlying way data is handled by completely reworking Unicode support, a major version change allowed non-backward-compatible changes to happen all at once. This decision was documented [in 2006][4]. To ease the disruption, Python 2 continued to be maintained, with some features backported. To further help the community transition, the EOL date was extended [from 2015 to 2020][5], another five years. + +Maintaining divergent codebases was a hassle the team knew it had to resolve. Ultimately, a decision was [announced][6]: + +> "We are volunteers who make and take care of the Python programming language. We have decided that January 1, 2020, will be the day that we sunset Python 2. That means that we will not improve it anymore after that day, even if someone finds a security problem in it. You should upgrade to Python 3 as soon as you can." + +[Nick Coghlan][7], a core CPython developer and current member of the Python steering council, [adds more information in his blog][8]. And [PEP 404][9], written by [Barry Warsaw][10] (also a member of the Python steering council), details why Python 2.8 will never be a thing. + +### Is anyone still supporting Python 2? + +Support for Python 2 from providers and vendors will vary. [Google Cloud has announced][11] how it plans to support Python 2 going forward. Red Hat has also [announced plans for Red Hat Enterprise Linux (RHEL)][12], and AWS has announced [minor version update requirements][13] for the AWS command-line interface and [SDK][14]. + +You can also read the Stack Overflow blog post "[Why is the Migration to Python 3 Taking So Long?][15]" by [Vicki Boykis][16], in which she identifies three reasons why Python 3 adoption is slow.  + +### Reasons to use Python 3 + +Regardless of ongoing support, it's a really good idea to migrate to Python 3 as soon as you can. Python 3 will continue to be supported, and it has some really neat things that Python 2 just doesn't have. + +The recently released [Python 3.8][17] includes such [features][18] as the [walrus operator][19], [positional-only parameters][20], and [self-documenting f-strings][21]. Earlier releases of Python 3 introduced [features][22] such as [asyncio][23], [f-strings][24], [type hints][25], and [pathlib][26], just to name a few. + +The top 360 most-downloaded packages [have already migrated to Python 3][27]. You can check your requirements.txt file using the [caniusepython3][28] package to see if any packages you depend on haven't yet been migrated. + +### Resources for porting Python 2 to Python 3 + +There are many resources available to ease your migration to Python 3. For example, the [Porting Python 2 to Python 3 guide][29] lists a bunch of tools and tricks to help you achieve single-source Python 2/3 compatibility. There are also some useful tips on [Python3statement.org][30]. + +[Dustin Ingram][31] and [Chris Wilcox][32] gave a [presentation at Cloud Next '19][33] detailing some of the motivations and migration patterns for the transition into Python 3. [Trey Hunner][34] gave a [presentation at PyCon 2018][35] about Python 3's most useful features to encourage you to migrate so you can take advantage of them. + +### Join us! + +January 1, 2020, is now just weeks away. If you need daily reminders of just how soon that is (and you use Twitter), follow the [Countdown to Python 2 sunset][36] Twitter bot. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/end-of-life-python-2 + +作者:[Katie McLaughlin][a] +选题:[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/glasnt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/govt_a%20new%20dawn.png?itok=b4zU-VAY (A sunrise) +[2]: https://www.python.org/dev/peps/pep-0373/#maintenance-releases +[3]: https://github.com/python/peps/commit/a733bc927acbca16bfa3de486fb2c7d3f767a748 +[4]: https://www.python.org/dev/peps/pep-3000/#compatibility-and-transition +[5]: https://github.com/python/peps/commit/f82462002b86feff36215b4230be28967039b0cc +[6]: https://www.python.org/doc/sunset-python-2/ +[7]: https://twitter.com/ncoghlan_dev +[8]: http://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html +[9]: https://www.python.org/dev/peps/pep-0404/ +[10]: https://twitter.com/pumpichank +[11]: https://cloud.google.com/python/docs/python2-sunset/?utm_source=osdc&utm_medium=blog&utm_campaign=pysunset +[12]: https://access.redhat.com/solutions/4455511 +[13]: https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/ +[14]: https://aws.amazon.com/sdk-for-python/ +[15]: https://stackoverflow.blog/2019/11/14/why-is-the-migration-to-python-3-taking-so-long/ +[16]: https://twitter.com/vboykis +[17]: https://www.python.org/downloads/ +[18]: https://docs.python.org/3.8/whatsnew/3.8.html +[19]: https://docs.python.org/3.8/whatsnew/3.8.html#assignment-expressions +[20]: https://docs.python.org/3.8/whatsnew/3.8.html#positional-only-parameters +[21]: https://docs.python.org/3.8/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging +[22]: https://docs.python.org/3.8/whatsnew/index.html +[23]: https://docs.python.org/3.8/library/asyncio.html#module-asyncio +[24]: https://docs.python.org/3.7/whatsnew/3.6.html#pep-498-formatted-string-literals +[25]: https://docs.python.org/3.7/whatsnew/3.5.html#pep-484-type-hints +[26]: https://docs.python.org/3.8/library/pathlib.html#module-pathlib +[27]: http://py3readiness.org/ +[28]: https://pypi.org/project/caniusepython3/ +[29]: https://docs.python.org/3/howto/pyporting.html +[30]: https://python3statement.org/practicalities/ +[31]: https://twitter.com/di_codes +[32]: https://twitter.com/chriswilcox47 +[33]: https://www.youtube.com/watch?v=Bye7Rms0Vgw&utm_source=osdc&utm_medium=blog&utm_campaign=pysunset +[34]: https://twitter.com/treyhunner +[35]: https://www.youtube.com/watch?v=klaGx9Q_SOA +[36]: https://twitter.com/python2sunset From 00d0d93876d268fe4cd88add7d393f4b9975f5a8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 00:53:03 +0800 Subject: [PATCH 558/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=20How=20?= =?UTF-8?q?to=20install=20Java=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191120 How to install Java on Linux.md --- .../20191120 How to install Java on Linux.md | 231 ++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 sources/tech/20191120 How to install Java on Linux.md diff --git a/sources/tech/20191120 How to install Java on Linux.md b/sources/tech/20191120 How to install Java on Linux.md new file mode 100644 index 0000000000..6cebd574e4 --- /dev/null +++ b/sources/tech/20191120 How to install Java on Linux.md @@ -0,0 +1,231 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to install Java on Linux) +[#]: via: (https://opensource.com/article/19/11/install-java-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to install Java on Linux +====== +Embrace Java applications on your desktop, and run them on all of your +desktops. +![Coffee beans][1] + +No matter what operating system you're running, there are usually several ways to install an application. Sometimes you might find an application in an app store, or you might install it with a package manager like DNF on Fedora or Brew on Mac, and other times, you might download an executable or an installer from a website. Because Java is such a popular backend for so many applications, it's good to understand the different ways you can install it. The good news is that you have many options, and this article covers them all. + +The bad news is that Java is _big_, not so much in size as in scope. Java is an open source language and specification, meaning that anyone can, in theory, create an implementation of it. That means, before you can install anything, you have to decide which Java you want to install. + +### Do I need a JVM or a JRE or a JDK? + +Java is broadly split into two downloadable categories. The **Java Virtual Machine** (JVM) is a runtime component; it's the "engine" that enables Java applications to launch and run on your computer. It's included in the Java Runtime Environment (JRE). + +The **Java Development Kit** (JDK) is a development toolkit: you can think of it as a garage where tinkerers sit around making adjustments, repairs, and improvements. The JDK includes the Java Runtime Environment (JRE). + +In terms of downloads, this translates to: + + * If you're a user looking to run a Java application, you only need the JRE (which includes a JVM). + * If you're a developer looking to program in Java, you need the JDK (which includes JRE libraries, which in turn includes a JVM). + + + +### What's the difference between OpenJDK, IcedTea, and OracleJDK? + +When Sun Microsystems was bought by Oracle, Java was a major part of the sale. Luckily, Java is an open source technology, so if you're not happy with the way Oracle maintains the project, you have other options. Oracle bundles proprietary components with its Java downloads, while the OpenJDK project is fully open source. + +The IcedTea project is essentially OpenJDK, but its goal is to make it easier for users to build and deploy OpenJDK when using fully free and open source tools. + +### Which Java should I install? + +If you feel overwhelmed by the choices, then the easy answer of which Java implementation you should install is whichever is easiest for you to install. When an application tells you that you need Java 12, but your repository only has Java 8, it's fine to install whatever implementation of Java 12 you can find from a reliable source. On Linux, you can have several different versions of Java installed all at once, and they won't interfere with one another. + +If you're a developer who needs to make the choice, then you should consider what components you need. If you opt for Oracle's version, be aware that there are proprietary plugins and fonts in the package, which could [interfere with distributing your application][2]. It's safest to develop on IcedTea or OpenJDK. + +### Install OpenJDK from a repository + +Now that you know your choices, you can search for OpenJDK or IcedTea with your package manager and install the version you need. Some distributions use the keyword **latest** to indicate the most recent version, which is usually what you need to run whatever application you're trying to run. Depending on what package manager you use, you might even consider using **grep** to filter the search results to include only the latest versions. For example, on Fedora: + + +``` +$ sudo dnf search openjdk | \ +grep latest | cut -f1 -d':' + +java-latest-openjdk-demo.x86_64 +java-openjdk.i686 +java-openjdk.x86_64 +java-latest-openjdk-jmods.x86_64 +java-latest-openjdk-src.x86_64 +java-latest-openjdk.x86_64 +[...] +``` + +Only if the application you're trying to run insists that you need a legacy version of Java should you look past the **latest** release. + +Install Java on Fedora or similar with: + + +``` +`$ sudo dnf install java-latest-openjdk` +``` + +If your distribution doesn't use the **latest** tag, it may use another keyword, such as **default**. Here's a search for OpenJDK on Debian: + + +``` +$ sudo apt search openjdk | less +default-jdk +  Standard Java development kit + +default-jre +  Standard Java runtime + +openjdk-11-jdk +  OpenJDK development kit (JDK) + +[...] +``` + +In this case, the **default-jre** package is appropriate for users, and the **default-jdk** is suitable for developers. + +For example, to install the JRE on Debian: + + +``` +`$ sudo apt install default-jre` +``` + +Java is now installed. + +There are probably many _many_ Java-related packages in your repository. Search on OpenJDK and look for either the most recent JRE or JVM if you're a user and for the most recent JDK if you're a developer. + +### Install Java from the internet + +If you can't find a JRE or JDK in your repository, or the ones you find don't fit your needs, you can download open source Java packages from the internet. You can find downloads of OpenJDK at [openjdk.java.net][3] in the form of a tarball requiring manual installation, or you can download the [Zulu Community][4] edition from Azul in the form of a tarball or installable RPM or DEB packages. + +#### Installing Java from a TAR file + +If you download a TAR file from either Java.net or Azul, you must install it manually. This is often called a "local" install because you're not installing Java to a "global" location. Instead, you choose a convenient place in your PATH. + +If you don't know what's in your PATH, take a look to find out: + + +``` +$ echo $PATH +/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/seth/bin +``` + +In this example PATH, the locations **/usr/local/bin** and **/home/seth/bin** are good options. If you're the only user on your computer, then your own home directory makes sense. If there are many users on your computer, then a common location, such as **/usr/local** or **/opt**, is the best choice. + +If you don't have access to system-level directories like **/usr/local**, which require **sudo** permissions, then create a local **bin** (for "binary," not a waste bin) or **Applications** folder in your own home folder: + + +``` +`$ mkdir ~/bin` +``` + +Add this to your PATH, if it's not already there: + + +``` +$ echo PATH=$PATH:$HOME/bin >> ~/.bashrc +$ source ~/.bashrc +``` + +Finally, unarchive the tarball into the directory you've chosen. + + +``` +$ tar --extract --file openjdk*linux-x64_bin.tar.gz \ +\--directory=$HOME/bin +``` + +Java is now installed. + +#### Installing Java from an RPM or DEB + +If you download an RPM or DEB file from Azul.com, then you can use your package manager to install it. + +For Fedora, CentOS, RHEL, and similar, download the RPM and install it using DNF: + + +``` +`$ sudo dnf install zulu*linux.x86_64.rpm` +``` + +For Debian, Ubuntu, Pop_OS, and similar distributions, download the DEB package and install it using Apt: + + +``` +`$ sudo dpkg -i zulu*linux_amd64.deb` +``` + +Java is now installed. + +#### Setting your Java version with alternatives + +Some applications are developed for a specific version of Java and don't work with any other version. This is rare, but it does happen, and on Linux, you can use either the local install method (see [Installing Java from a TAR file][5]) or the **alternatives** application to deal with this conflict. + +The **alternatives** command looks at applications installed on your Linux system and lets you choose which version to use. Some distributions, such as Slackware, don't provide an **alternatives** command, so you must use the local install method instead. On Fedora, CentOS, and similar distributions, the command is **alternatives**. On Debian, Ubuntu, and similar, the command is **update-alternatives**. + +To get a list of available versions of an application currently installed on your Fedora system: + + +``` +`$ alternatives --list` +``` + +On Debian, you must specify the application you want alternatives for: + + +``` +`$ update-alternatives --list java` +``` + +To choose which version you want to make the system default on Fedora: + + +``` +`$ sudo alternatives --config java` +``` + +On Debian: + + +``` +`$ sudo updates-alternatives --config java` +``` + +You can change the default Java version as needed based on the application you want to run. + +### Running a Java application + +Java applications are typically distributed as JAR files. Depending on how you installed Java, your system may already be configured to run a Java application, which allows you to just double-click the application icon (or select it from an application menu) to run it. If you had to do a local Java install that isn't integrated with the rest of your system, you can launch Java applications directly from a terminal: + + +``` +`$ java -jar ~/bin/example.jar &` +``` + +### Java is a good thing + +Java is one of the few programming environments that places cross-platform development first. There's nothing quite as liberating as asking whether an application runs on your platform, and then discovering that the application was written in Java. As simply as that, you're freed from any platform anxiety you may have had, whether you're a developer or a user. Embrace Java applications on your desktop, and run them on _all_ of your desktops. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/install-java-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/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html +[3]: http://openjdk.java.net +[4]: https://www.azul.com/downloads/zulu-community +[5]: tmp.wuzOCnXHry#installing-java-from-a-tar-file From 592a2dad86269c558811d6cf0f71b425c2235bff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 00:53:41 +0800 Subject: [PATCH 559/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=203=20em?= =?UTF-8?q?erging=20open=20source=20projects=20to=20keep=20an=20eye=20on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191120 3 emerging open source projects to keep an eye on.md --- ... open source projects to keep an eye on.md | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 sources/tech/20191120 3 emerging open source projects to keep an eye on.md diff --git a/sources/tech/20191120 3 emerging open source projects to keep an eye on.md b/sources/tech/20191120 3 emerging open source projects to keep an eye on.md new file mode 100644 index 0000000000..937dde5839 --- /dev/null +++ b/sources/tech/20191120 3 emerging open source projects to keep an eye on.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 emerging open source projects to keep an eye on) +[#]: via: (https://opensource.com/article/19/11/emerging-projects) +[#]: author: (James Mawson https://opensource.com/users/dxmjames) + +3 emerging open source projects to keep an eye on +====== +Check out these early-stage open source projects that show real promise. +![One lightbulb lit out of several][1] + +The exciting thing about open source is that nobody needs permission to try something new. That's a formula that allows new ideas to emerge all the time. + +Here are three open source projects that are still in their early stages but show real promise. + +### Glimpse + +[Glimpse][2] is a recent fork of the [GNU Image Manipulation Program][3], a well-known and long-running open source project. It's unusual in that the biggest (but not the only) reason for forking is to rebrand it. + +So what's wrong with the name GNU Image Manipulation Program? Well, it abbreviates as "gimp," and in large parts of the English-speaking world, that is a slang word with a variety of derogatory and sexual meanings. + +Headlines have characterized the problem as "[the name is offensive][4]." I'm not sure that totally nails the issue—when I dug into it, I couldn't find anyone claiming strong offense. + +What _does_ come up again and again is that people can't get a fair hearing for the application because of the name. In any kind of grown-up or professional context, the suggestion to use GIMP isn't taken seriously. For most of the world, there's probably little at stake in this, but English-speaking countries account for almost a quarter of the world's economy. That's not nothing. + +Tech journalist Bryan Lunduke thinks [Glimpse isn't ideal branding, either][5], and perhaps he has a point. But for everyone who just wants the open source option to get a fair hearing, that's a second-order concern. + +The Glimpse team has not declared any hostility to the parent project and has even shared some donation money upstream. + +One of the exciting possibilities of this friendlier brand name is that it could open the software up as an option in education settings. This would be a win for the free software movement as a whole. + +### The Editable PDF Initiative + +Anyone with a desk job eventually learns the displeasure of using multiple software packages to put together a really complex document. It's one thing to write a quick letter or article in a word processor. But when you're jugging charts, graphs, tables, data, and images between applications, databases, and programming libraries, it can be quite a headache. + +Often, people end up solving the problem by cutting-and-pasting things using the mouse—especially for the one-off jobs that crop up all the time. We do this manually, even when there are ways to automate the task, because the tools don't work the way we want them to, and different programs aren't written to talk to each other. + +Dr. Tamir Hassan is a document engineering veteran on a one-man mission to fix this with the [Editable PDF Initiative][6]. It is an open, universal standard for document files that any program could use to interact with a document or its individual elements, such as images or tables. + +Editable PDF aims to be an extension of existing PDF standards, which provide the only guarantee of consistent presentation across applications and devices. At the moment, PDF documents are basically just vector files, not built to edit at all. + +[As Dr. Hassan said recently][7]: "Perhaps you would like to edit the text in Word, but make fine adjustments to the layout in InDesign? It's very difficult to switch between different programs today, but Editable PDF, a universally editable format, will let you do exactly that." + +Editable PDF has great potential to benefit open source software in particular. In contrast to non-standard file formats, a universal format that's truly portable creates an even playing field for the best software to win. + +Moreover, one of the big barriers for Linux to go mainstream on the desktop is that so many business users feel extremely attached to Microsoft Word. The open source movement has replied by saying, "well, if we try, we could make ours just as good." But maybe the mindset we really need is, "hey, let's do something many times better." + +### Endeavour OS + +Ahh… [Arch][8]: the Linux so notorious, it became a meme. + +But there's more going on than just, "I use Arch, btw." Part of Arch's notoriety is how intimidating it can be to install. + +This is why some people have gravitated to other distributions built on Arch, such as [Manjaro][9] and—until recently—[Antergos][10]. + +When the Antergos developers had to abandon the project due to lack of time, they left quite a community behind. Out of this, [EndeavourOS][11] was born. + +EndeavourOS might be a spiritual successor to Antergos, but it's not a fork. The team has come up with a lightweight, Arch-based operating system of its own. + +So if Manjaro offers an "Arch made easy" experience, why would you install Endeavour OS? Well, while Manjaro is based on Arch, it's got quite a lot of its own thing going on as well. EndeavourOS is quite close to pure Arch—with an Xfce desktop environment and a graphical installer along for the ride. + +EndeavourOS also advertises an open and friendly community for curious beginners—its front page even says: "Stupid questions simply don't exist with us." + +In just a few months, EndeavourOS has already delivered its first stable release, but it is still an extremely young initiative. + +One thing that really appeals to me about EndeavourOS is the clarity of its ethos. Some Linuxes are all about the data center and the server room; others aim to be the most user-friendly desktop daily driver for the broadest audience. A few have an identity crisis, caught between these things. So, where does EndeavourOS fit in all this? + +This Linux is utterly unapologetic in catering to technology hobbyists, enthusiasts, and power users. It's for the amateurs, in that best and most original sense of the word—those who love what they do. Awesome. So isn't Endeavour the perfect name? + +If what you want is to roll your sleeves up and level up while still enjoying a gentle start and a friendly community, this could be a great way to go about it. + +_What other new open source projects are you keeping an eye on? Please share in the comments._ + +Explore the open source alternatives to Adobe Acrobat for reading, creating, and editing PDF files. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/emerging-projects + +作者:[James Mawson][a] +选题:[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/dxmjames +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_lightbulbs.png?itok=pwp22hTw (One lightbulb lit out of several) +[2]: https://glimpse-editor.org/ +[3]: https://www.gimp.org/ +[4]: https://itsfoss.com/gimp-fork-glimpse/ +[5]: https://www.youtube.com/watch?v=CV1HZU4KFHc +[6]: https://editablepdf.org/ +[7]: https://dxmtechsupport.com.au/editable-pdf-interview +[8]: https://www.archlinux.org/ +[9]: https://manjaro.org/ +[10]: https://antergos.com/ +[11]: https://endeavouros.com/ From 0642103f84196e68e41d8bc4375c77f1513d7a5f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 01:20:29 +0800 Subject: [PATCH 560/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=20Intel?= =?UTF-8?q?=20targets=20Nvidia=20(again)=20with=20GPU=20and=20cross-proces?= =?UTF-8?q?sor=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191120 Intel targets Nvidia (again) with GPU and cross-processor API.md --- ...again) with GPU and cross-processor API.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/talk/20191120 Intel targets Nvidia (again) with GPU and cross-processor API.md diff --git a/sources/talk/20191120 Intel targets Nvidia (again) with GPU and cross-processor API.md b/sources/talk/20191120 Intel targets Nvidia (again) with GPU and cross-processor API.md new file mode 100644 index 0000000000..b145a22fc0 --- /dev/null +++ b/sources/talk/20191120 Intel targets Nvidia (again) with GPU and cross-processor API.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Intel targets Nvidia (again) with GPU and cross-processor API) +[#]: via: (https://www.networkworld.com/article/3454497/intel-targets-nvidia-again-with-gpu-and-cross-processor-api.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Intel targets Nvidia (again) with GPU and cross-processor API +====== +Intel is looking to offer a unified CPU, GPU, and platform architecture that Nvidia doesn’t have but AMD does. +Martyn Williams/IDG + +Third time’s the charm? Intel is hoping so. It released details of its Xe Graphics Architecture, with which it plans to span use cases from mobility to high-performance computing (HPC) servers – and which it hopes will succeed where its [Larrabee][1] GPU and [Xeon Phi][2] manycore processors failed. + +It’s no secret Intel wants a piece of the high-performance computing HPC action, given that it introduced the chip and other products at it Intel HPC Developer Conference in Denver, Colo., this week just ahead of the Supercomputing ’19 tradeshow. + +**Don't miss** [**10 of the world's fastest supercomputers**][3] + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Intel bills the Xe Graphics Architecture card as its first "exascale graphics card," based on a new 7nm architecture called “Ponte Vecchio.” Intel is splitting the Xe Architecture into three designs for different segments: [data center][5], consumer graphics cards, and AI use-cases; integrated graphics for processors; and the high-tier Xe HPC for high performance computing. + +Rather than use the large die for its graphics chips the way Nvidia and AMD do it, Intel is using the Multi-Chip Module (MCM) design that breaks up one big chip into smaller “chiplets” that are connected via a high speed fabric. This is how AMD designed the [Ryzen and EPYC CPUs][6], something Intel initially pooh-poohed but is since [adopting][7] for its Xeons. + +These modules also use other packaging technology advancements such as Foveros 3D chip-packaging technology, which allows for 3D stacking of dies and mixing of CPU, AI, and GPU processors, High Bandwidth Memory (HMB) and Embedded Multi-Die Bridge (EMIB) technology to tie the HBM packages to the compute die. + +Xe Architecture cards will also come with a new scalable fabric called XE Memory Fabric (XEMF), which ties compute and memory together with a coherent memory interface that Intel claims will allow Xe to scale to thousands of nodes. + +Kevin Krewell, principal analyst with Tirias Research, noted that this is not a brand-new graphic architecture, it’s an evolution from Intel’s integrated GPU technology that has been a part of its consumer Core CPUs for several years and has been steadily maturing. + +“This is a design that is more like traditional graphics. [Intel is starting] with their traditional integrated graphics cores and building on top of that. Larrabee tried a GPU built on a CPU. In this case they are building a ground up GPU with GPU-like features and not trying to do anything too weird. And now they've got a real GPU guy running the group,” he said. + +Krewell is referring to Raja Koduri, senior vice president of the company's Core and Visual Computing Group. Koduri has one hell of a resume. He was the brains behind AMD integrating CPU and GPU cores on one die (yet another example of AMD leading) and then went to Apple where he pioneered the [Retina display][8]. So if Intel can’t get graphics right with this guy there is no hope. + +### Taking Aim At CUDA + +One thing that has been a huge boon to Nvidia is its CUDA language for programming GPUs. Intel is taking aim and then some at CUDA with its new OneAPI programming model, which Intel designed to simplify programming across not only its GPU but CPU, FPGA, and AI accelerators as well. + +This means applications can move seamlessly between Intel's different types of compute architectures. If an application is best processed on an FPGA, then it will be processed there. Same for CPUs, GPUs, and AI accelerators. If that’s not enough, Intel has the Data Parallel C++ Conversion Tool to take CUDA code and port it to OneAPI. If they pull this off, it would be a huge advantage over Nvidia, since CUDA is only for its GPUs. + +Interestingly, Intel said OneAPI will be open-source and will also work with other vendors' hardware, although they didn’t say whose. If it ends up ported to AMD’s platform, well, that would be entertaining. + +“It’s more than a shot at CUDA because they want to replace CUDA,” said Krewell. “OneAPI is a very ambitious program, trying to combine all of the different processor elements under one umbrella API. So it’s a very aggressive program and they are building it out piece by piece.  But right now it’s at version 0.5. CUDA is at version ten. So they've got a ways to catch up.” + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][9] + +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/3454497/intel-targets-nvidia-again-with-gpu-and-cross-processor-api.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/2239992/intel-nurses--black-eye--on-larrabee--as-amd--nvidia-get-to-work.html +[2]: https://www.networkworld.com/article/3296004/intel-ends-the-xeon-phi-product-line.html +[3]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[6]: https://www.networkworld.com/article/3321943/amd-s-road-to-the-data-center-and-hpc-isn-t-as-long-as-you-think.html +[7]: https://www.networkworld.com/article/3408177/intel-unveils-new-3d-chip-packaging-design.html +[8]: https://www.networkworld.com/article/2211314/iphone-4-s-retina-display-explained.html +[9]: https://www.networkworld.com/newsletters/signup.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world From 47cb791d117524d1bf609e6ea1c8bf84c24aa429 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 21 Nov 2019 01:22:29 +0800 Subject: [PATCH 561/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=20Tools?= =?UTF-8?q?=20that=20Accelerate=20a=20Newbie=E2=80=99s=20Understanding=20o?= =?UTF-8?q?f=20Machine=20Learning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191120 Tools that Accelerate a Newbie-s Understanding of Machine Learning.md --- ...bie-s Understanding of Machine Learning.md | 215 ++++++++++++++++++ 1 file changed, 215 insertions(+) create mode 100644 sources/tech/20191120 Tools that Accelerate a Newbie-s Understanding of Machine Learning.md diff --git a/sources/tech/20191120 Tools that Accelerate a Newbie-s Understanding of Machine Learning.md b/sources/tech/20191120 Tools that Accelerate a Newbie-s Understanding of Machine Learning.md new file mode 100644 index 0000000000..0b41f3e7f2 --- /dev/null +++ b/sources/tech/20191120 Tools that Accelerate a Newbie-s Understanding of Machine Learning.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tools that Accelerate a Newbie’s Understanding of Machine Learning) +[#]: via: (https://opensourceforu.com/2019/11/tools-that-accelerate-a-newbies-understanding-of-machine-learning/) +[#]: author: (Jatin Karthik Tripathy https://opensourceforu.com/author/jatin-tripathy/) + +Tools that Accelerate a Newbie’s Understanding of Machine Learning +====== + +[![][1]][2] + +_The world of machine learning (ML) and deep learning (DL) is a fascinating one. Many newbies would like to dabble in this field but have some inhibitions. This article introduces readers to some of the best tools to kickstart their journey into the ML/ DL domain._ + +Machine learning is a term that is applied to a broad range of topics which have one thing in common – the use of algorithms and other statistical models to improve the performance of a particular task. All machine learning (ML) models are used to build a mathematical model of the data provided, to help the user predict or make decisions with a very high level of accuracy; thereby considerably reducing the strain of manually sifting through the data. Currently, there are several fields in which ML is used extensively, from filtering out emails and computer vision, to choosing a smart assistant. Readers are urged to spend some time researching only the topics that they are interested in and not get overwhelmed or distracted by the countless other applications of ML. + +Deep learning can be considered a subset of machine learning, though to call it that really does not do it justice. Currently, most applications have moved on from the somewhat old fashioned ML algorithms to employ deep learning (DL) algorithms. The latter provide much more support for the building of more complex mathematical models which cannot be provided by ML. Deep learning algorithms employ multiple ML algorithms in a manner vaguely inspired by how the human brain works, and hence the term‘neural networks’. Deep learning algorithms have been developed to the point where it has been proved that computers can indeed be smarter than humans. + +![Figure 1: Creating a notebook][3] + +This article explores five of the most user-friendly, highly scaleable ML libraries/tools available. These are: + + * Scikit-learn + * OpenCV + * TensorFlow + * Keras + * Google Colaboratory + + + +Some of you may be familiar with a couple of these libraries and even know how to use them. This is not meant to be an in-depth tutorial for any of these tools. The idea is that, hopefully, by the end of this article, readers will discover which of the five libraries featured, interests them enough to read further on the topic. + +**Scikit-learn** +The founders of Scikit-learn started off by trying to find answers to simple problems. I believe that any aspirant must follow the pioneer’s footsteps. Scikit-learn is a free library written for Python which lets users do exactly that. It operates using Python’s NumPy and SciPy libraries to achieve multiple aspects of machine learning with ease, such as various algorithms for classification, regression and clustering. It lets the user easily step into the world of artificial intelligence (AI) without making them feel that they’ve taken too big a leap. With its easy-to-use libraries, you can easily incorporate any of the above ML algorithms into your code. While Scikit-learn is essentially for older ML algorithms, beginners will have their hands full trying to implement various algorithms to see how they affect a particular use case. +This library is largely implemented in Python with some parts of it written in Cython, thus restricting its usage to how much Python you know. Python, incidentally, has a tremendous collection of libraries and third party APIs. + +The advantage of starting off with Scikit-learn is that most programmers with similar aspirations have also started off along the same path. There is huge support for Scikit-learn with the entire code written using the Scikit-learn library, making the learning process fairly simple. It also helps that the official documentation of Scikit-learn is one of the more refined and well written. So, most of your doubts will probably get clarified by just going through the documentation. +To start off with Scikit Learn, just follow the instructions available at the official site, at __. + +![Figure 2: Accessing notebook settings][4] + +**OpenCV** +OpenCV is a cross platform library that lets the user tackle any kind of real-time computer vision. + +**Note:** _Computer vision is a field of computer science that deals with how computers can be made to acquire a high level knowledge from photos or videos. It includes the tasks of acquiring, processing, analysing and understanding the data._ + +OpenCV has a wide range of applications, starting with simple algorithms that deal with 2D images, all the way up to augmented reality, motion tracking, etc. OpenCV is not as user-friendly as Scikit-learn, yet, with a little time anyone can easily understand the flow of things – well enough to use OpenCV to its maximum extent. OpenCV, unlike Scikit-learn, is mostly written in C/C++ and is a cross platform library. This means that the users can truly optimise their code by using lower level and complied languages such as C/C++ or Java. OpenCV also includes a statistical ML library with which it can stand alone to some extent. OpenCV also has integrations with leading DL frameworks such as TensorFlow and Torch/PyTorch, making it a very versatile tool which can be used even if the provided ML library does not meet the user’s demands. + +One of the notable things about OpenCV is that it supports hardware acceleration in three different cases, namely: + + * Intel’s Integrated Performance Primitives + * A CUDA based GPU interface + * An OpenCL based GPU interface + + + +The fact that OpenCV can use hardware acceleration means that the user can easily increase the performance of the code with simple modifications, thereby resulting in smoother real-time applications due to faster code execution. + +**Note:** _It is advisable to use hardware accelerations that are mathematically intensive to perform, else there is a chance of a drop in performance due to the time it takes to shift resources to the GPU from the CPU._ + +Detailed installation instructions for OpenCV are available from the official documentation for the Python programming language at _ py_setup/py_setup_in_windows/py_setup_in_windows.html_. Other installations can also be found in the documentation. + +**TensorFlow** +TensorFlow is an open source library which tackles data flow programming across a range of applications, from a symbolical mathematical library to the core library in neural network programming. Developed by the Google Brain team for the search giant’s internal use, today it is used within the firm for purposes ranging from research to production. + +**Note:** _The TensorFlow library is so named because it operates on multi-dimensional data arrays called tensors, whilst performing calculations for neural networks._ + +Unlike the earlier libraries, TensorFlow has been streamlined to make neural networks and is optimised for DL applications. TensorFlow is best at data crunching at a scale where data can be realistically processed using any other older technique. You can do all this while keeping the usage so simple, that, any devoted Python user will feel right at home with the line-by-line implementation of the neural network, allowing the user to easily implement high level concepts that involve a huge amount of mathematical theory behind them, with the call of a single function. This allows the user to quickly create a neural model and focus on refining it rather than worry about the mathematics behind it, making for faster prototyping. + +Like OpenCV, TensorFlow is not restricted to Python but supports other languages. Support ranges from having direct support to having third party APIs taking care of that. TensorFlow has a very flexible architecture system that allows it to be used in various devices, whether it is CPUs, GPUs or even TPUs (tensor processing units), as well as clustered servers or even handheld devices such as mobile phones. This allows TensorFlow to have a hardware acceleration capability that is unrivalled by most other libraries. + +**Note:** _Keras is a pure Python library unlike TensorFlow_ + +TensorFlow can take code to the browser with the use of TensorFlow.js, making DL projects lightweight and easily scaleable. TensorFlow Lite, which was built for using TensorFlow, specifically for Android development (beginning from Android Oreo) is even lighter. It has a wide reach. There are several applications of this library for different use cases, from being the foundation of some new technologies such as Deep Dream, an automated image captioning software, to being the core in many users’neural network projects. While it can be applied for a great many things, getting started off is not that hard. TensorFlow has huge support online with no lack of example code to go through before you tackle your first project. + +You can begin your TensorFlow journey by getting the Python library at _. org/install/_ and if you have a GPU that meets CUDA requirements, you can even optimise your execution using hardware acceleration. + +![Figure 3: Hardware accelerator][5] + +**Keras** +Keras is an open source Python library which runs on top of other Python libraries such as TensorFlow, Microsoft Cognitive Toolkit, or Theano. Keras focuses on being more user-friendly, modular and extensible compared to the libraries that it runs on top of. +Keras has official support from Google’s TensorFlow team (for the TensorFlow core library), allowing users to quickly build their code using the numerous implementations of commonly used neural networks methods already predefined in the Keras package. Like TensorFlow, Keras also supports hardware acceleration by the use of GPUs or TPUs, allowing the user far easier coding in almost the same execution time. + +Unlike the other tools mentioned in our list, Keras is not a standalone library. Rather, it acts as a high-level API to other libraries that require comparatively more complex ways of coding. This allows users to achieve far more rapid prototyping with their code. As a trade-off for this level of user-friendly Python coding, you lose some level of control over your code. For example, in Keras, while you do have considerable control over your network, any of the lower level packages that implement Keras will control the finer things of the network. + +This might lead you to wonder, why one should even use Keras? The sole reason is that most of the time, while trying out new implementations of neural networks, that high level of control over the hyper parameters isn’t required. The trade-off obtained by dropping that functionality makes far more sense to any programmer who only wants to see how the network performs. You can think of Keras as a way of getting the feel of what you are trying to build before trying to optimise it at a much lower level so that your networks perform the best. Keras has one of the most user-friendly approaches to coding neural networks. For anyone who just wants to try out the latest advances in current technology, Keras will almost always meet such a user’s demands. One small shortcoming is that Keras is a pure Python library unlike TensorFlow. + +**Note:** _As of June 2019, Keras has officially been ported together with Tensorflow to bcome Tensorflow 2.0. This new version of Tensorflow cuts back on a lot of extras previously available, resulting in a more standardised approach of writing code using the Keras API. Tensorflow 2.0 is currently in beta stage, but it already implements a lot of the more commonly used features, so if you feel like foraging into the new and improved library, head over to: _ + +It is possible for one to transform Keras models from Python to lower level languages such as C/C++. +As an example of how easy it is to understand and use Keras as compared to TensorFlow, let us take a look at both these libraries when used for the same application – the classification of handwritten numbers using the Mnist data set. +First let us look at an example of using pure TensorFlow to finish the task, as shown below: + +``` +import tensorflow as tf +mnist = tf.keras.datasets.mnist + +n_nodes = 512 +n_classes = 10 +batch_size = 100 + +x = tf.placeholder('float', [None, 784]) +y = tf.placeholder('float') + +def neural_network_model(data): +layer_1 = {'weights':tf.Variable(tf.random_normal([784, n_nodes])), +'biases':tf.Variable(tf.random_normal([n_nodes]))} +output_layer = {'weights':tf.Variable(tf.random_normal([n_nodes, n_classes])), +'biases':tf.Variable(tf.random_normal([n_classes])),} +l1 = tf.add(tf.matmul(data,layer_1['weights']), layer_1['biases']) +l1 = tf.nn.relu(l1) +output = tf.matmul(l1,output_layer['weights']) + output_layer['biases'] +return output + +def train_neural_network(x): +prediction = neural_network_model(x) +cost = tf.reduce_mean( tf.nn.sparse_softmax_cross_entropy_with_logits(logits=prediction,labels=y) ) +optimizer = tf.train.AdamOptimizer().minimize(cost) +hm_epochs = 5 +with tf.Session() as sess: +sess.run(tf.initialize_all_variables()) +for epoch in range(hm_epochs): +epoch_loss = 0 +for _ in range(int(mnist.train.num_examples/batch_size)): +epoch_x, epoch_y = mnist.train.next_batch(batch_size) +_, c = sess.run([optimizer, cost], feed_dict={x: epoch_x, y: epoch_y}) +epoch_loss += c +print('Epoch', epoch, 'completed out of',hm_epochs,'loss:',epoch_loss) + +correct = tf.equal(tf.argmax(prediction, 1), tf.argmax(y, 1)) +accuracy = tf.reduce_mean(tf.cast(correct, 'float')) +print('Accuracy:',accuracy.eval({x:mnist.test.images, y:mnist.test.labels})) + +train_neural_network(x) +``` + +Now that we have that part done, let us take a look at the same implementation using _tf.keras_ : + +``` +import tensorflow as tf +mnist = tf.keras.datasets.mnist + +(x_train, y_train),(x_test, y_test) = mnist.load_data() +x_train, x_test = x_train / 255.0, x_test / 255.0 + +model = tf.keras.models.Sequential([ +tf.keras.layers.Flatten(), +tf.keras.layers.Dense(512, activation=tf.nn.relu), +tf.keras.layers.Dense(10, activation=tf.nn.softmax) +]) +model.compile(optimizer='adam', +loss='sparse_categorical_crossentropy', +metrics=['accuracy']) +print("running...") +model.fit(x_train, y_train, epochs=5) +model.evaluate(x_test, y_test) +``` + +The Keras code is far simpler and the language is at a higher level than TensorFlow. + +**Colaboratory by Google** +Increased performance in the execution of code is possible through the use of hardware like GPUs or TPUs rather than by running it solely on the CPUs. This is because CPUs, unlike the other two, have a limited number of cores and cannot process the vast mathematical calculations required even for quite a simple neural network. However, what can be done if your GPU is not supported by CUDA or you simply do not have one? + +That is where services such as Colaboratory come into play. Colaboratory is an online service that lets you use an online notebook system called Jupyter to write and execute code which is wholly based on the cloud. This avoids investing in expensive hardware such as a GPU to optimise code. Google Colaboratory gives you access to a Nvidia Tesla K80 GPU at no cost at all. The Colaboratory environment is exactly the same as any offline Python implementation. This means that there is absolutely no learning curve prior to starting off with Colaboratory. The fact that you run you code completely online means that you do not have to install any of the dependencies on your personal computer and this means that you are not restrained from implementing the latest ideas. +Putting your projects completely on the cloud allows you far more freedom and the access to Google TPUs which power the Colaboratory project. Unlike the Nvidia Tesla K80 GPU, the TPU does not come free, but you can use it for a basic fee calculated on TPU usage per second. This allows for the least possible execution time at the cheapest possible price. Like the TPU, Colaboratory also has several plans for other more powerful GPU prices, which are lower than the TPU rates, allowing you to choose what you feel is best for your particular use case. + +As mentioned earlier, Colaboratory is the same as any offline Python development environment that you may already be used to, thus allowing you to use packages that you normally do, such as OpenCV, TensorFlow, Keras, etc. A simple implementation of TensorFlow using Google Colaboratory is given below, starting from the official welcome page, __. + +To start off, first create your Python3 notebook in Colaboratory as shown in Figure 1. +Once you have done that, navigate to the notebook settings (_Edit > Notebook Settings_) as shown in Figure 2. + +Once you have selected the notebook settings, you can now change the runtime type to Python2 or Python3 and you can also change the hardware accelerator. It is here that you will decide on whether you want use the free Nvidia Tesla K80 GPU or the TPU provided by the service (Figure 3). + +![Figure 4: Mnist example][6] + +Now that the environment is set up, we can finally try out some program to test it. The purpose of this article is not to take you through any specific machine learning or deep learning example. For the sake of testing Colaboratory, let’s use the classic Mnist example that has been taken directly from the TensorFlow website __ +Once you have grabbed the code, simply execute it in the notebook and you should see an output as shown in Figure 4. + +Using Colaboratory, you have executed a basic classification example within minutes, without the need for any extra installations of TensorFlow (or even Python) on your computer. Thus, you can fully concentrate only on what you want to achieve and not bother about the dependencies needed for your project. + +We have seen only five of the vast number libraries that are available in the open source world. These five tools will provide the reader with a strong-enough footing to push forward and explore more complex tools that are streamlined for a particular use case. I urge you to also try to learn the mathematics of any new technology that you implement as it gives you a finer understanding of the how and whys of each thing. A nice start to any theory is the Machine Learning Cheatsheet, __ which, while barely scratching the surface of the mathematics behind the implementations, gives a very clear idea about the concepts and code examples to lead you in the right direction + +![Avatar][7] + +[Jatin Karthik Tripathy][8] + +The author takes a keen interest in graphics programming, graphics modelling, artificial intelligence, etc. He can be reached at jatinkarthik (dot) tripathy (at) vitap(dot) ac(dot) in. + +[![][9]][10] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/tools-that-accelerate-a-newbies-understanding-of-machine-learning/ + +作者:[Jatin Karthik Tripathy][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/jatin-tripathy/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Deep-Learning-Machine-learning-Artificial-intelligence.jpg?resize=696%2C502&ssl=1 (Deep Learning Machine learning Artificial intelligence) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Deep-Learning-Machine-learning-Artificial-intelligence.jpg?fit=700%2C505&ssl=1 +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Creating-a-notebook.jpg?resize=350%2C175&ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-Accessing-notebook-settings.jpg?resize=350%2C280&ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-Hardware-accelerator.jpg?resize=350%2C256&ssl=1 +[6]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-Mnist-example-350x281.jpg?resize=350%2C281&ssl=1 +[7]: https://secure.gravatar.com/avatar/19d277f27f20b7db95dacaff344a6948?s=100&r=g +[8]: https://opensourceforu.com/author/jatin-tripathy/ +[9]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[10]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From e1a04c2bb77924520e9e09497074f712cabf3e27 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 20 Nov 2019 22:00:44 +0100 Subject: [PATCH 562/800] Update 20191104 Fields, records, and variables in awk.md --- ...4 Fields, records, and variables in awk.md | 76 ++++++++++--------- 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/sources/tech/20191104 Fields, records, and variables in awk.md b/sources/tech/20191104 Fields, records, and variables in awk.md index 7ab896317d..377be315d0 100644 --- a/sources/tech/20191104 Fields, records, and variables in awk.md +++ b/sources/tech/20191104 Fields, records, and variables in awk.md @@ -7,12 +7,12 @@ [#]: via: (https://opensource.com/article/19/11/fields-records-variables-awk) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -Fields, records, and variables in awk awk中字段,记录和变量 +awk中的字段,记录和变量 ====== -在我们这个系列的第二部分,我们会学习到字段,记录和一些非常有用的awk变量。 +这个系列的第二篇,我们会学到 字段,记录和一些非常有用的awk变量。 ![Man at laptop on a mountain][1] -Awk 有好几个变种: 最早版本的 **awk**, 是1977 年 AT&T Bell 实验室所创造的。还有一些重构版本,例如**mawk**, **nawk**。现在我们能在大多数Linux 发行版中见到的,是 GNU awk,也叫**gawk**。 在大多数 Linux 版本中,awk 和 gawk 都是指向 GNU awk 的链接。 如果输入awk命令,也是一样的效果。 在 [GNU awk 用户手册][2]中能看到 awk 和 gawk 的全部历史。 +Awk 有好几个变种: 最早的 **awk**, 是1977 年 AT&T Bell 实验室所创。它还有一些重构版本,例如 **mawk**, **nawk**。在大多数Linux 发行版中能见到的,是 GNU awk,也叫**gawk**。 在大多数 Linux 发行版中,awk 和 gawk 都是指向 GNU awk 的链接。 输入awk命令,也是同样的效果。 [GNU awk 用户手册][2]中,能看到 awk 和 gawk 的全部历史。 这一系列的[第一篇文章][3] 介绍了awk 命令的基本格式: @@ -20,7 +20,7 @@ Awk 有好几个变种: 最早版本的 **awk**, 是1977 年 AT&T Bell 实 `$ awk [options] 'pattern {action}' inputfile` ``` -Awk 是一个命令,后面要接选项 (比如用 **-F** 来定义字段分隔符)。 你想让awk 执行的部分需要写在 两个单引号之间,至少在终端中需要这么做。 在awk 命令中,为了进一步强调你想要执行的部分,可以用 **-e** 选项来突出显示 (但这不是必须的): +Awk 是一个命令,后面要接选项 (比如用 **-F** 来定义字段分隔符)。 想让awk 执行的部分需要写在 两个单引号之间,至少在终端中需要这么做。 在awk 命令中,为了进一步强调你想要执行的部分,可以用 **-e** 选项来突出显示 (但这不是必须的): ``` @@ -31,12 +31,11 @@ green [...] ``` -### Records and fields 记录和字段 +### 记录和字段 -Awk views its input data as a series of _records_, which are usually newline-delimited lines. In other words, awk generally sees each line in a text file as a new record. Each record contains a series of _fields_. A field is a component of a record delimited by a _field separator_. -Awk 将输入数据视为 一系列 _记录_ , 通常来说是按行分割的。 换句话说,awk 通常将文本中的每一行视作一个记录。每一记录包含多个 _字段_. 一个字段是由 _字段分隔符_ 分隔出的,记录的一部分. +Awk 将输入数据视为 一系列 _记录_ , 通常是按行分割的。 换句话说,awk 将文本中的每一行视作一个记录。每一记录包含多个 _字段_. 一个字段由 _字段分隔符_ 分隔开来,字段是记录的一部分. -默认情况下,awk 将各种空白符,如空格,tab,换行符,视为分隔符。 值得注意的是,awk 将多个 _空格_ 视为一个分隔符。所以下面这行文本有两个字段: +默认情况下,awk 将各种空白符,如空格,tab,换行符等视为分隔符。 值得注意的是,在awk 中,多个 _空格_ 将被视为一个分隔符。所以下面这行文本有两个字段: ``` @@ -50,7 +49,7 @@ Awk 将输入数据视为 一系列 _记录_ , 通常来说是按行分割的 `tuxedo                  black` ``` -其他分隔符,在程序中不是这么处理的。假设字段分隔符是逗号,如下所示的记录就分为三个字段。其中一个字段可能会只有0个字节长(假设这一字段中不包含隐藏字符) +其他分隔符,在程序中不是这么处理的。假设字段分隔符是逗号,如下所示的记录,就有三个字段。其中一个字段可能会是0个字节(假设这一字段中不包含隐藏字符) ``` `a,,b` @@ -58,13 +57,13 @@ Awk 将输入数据视为 一系列 _记录_ , 通常来说是按行分割的 ### awk 程序 -awk 命令的 _程序部分_ 是由一系列规则组成的。通常来说,在程序中每个规则占一行(尽管这不是必须的)。 每个规则由一个模式,或者一个/多个动作组成: +awk 命令的 _程序部分_ 是由一系列规则组成的。通常来说,程序中每个规则占一行(尽管这不是必须的)。 每个规则由一个模式,或一个/多个动作组成: ``` `pattern { action }` ``` -在一个规则中,你可以通过定义模式,来确定行动是否会在记录中执行。 模式可以是简单的比较条件,正则表达式,两者的结合或者更多。 +在一个规则中,你可以通过定义模式,来确定行动是否会在记录中执行。 模式可以是简单的比较条件,正则表达式,甚至两者结合等等。 这个例子中,程序 _只会_ 显示包含 单词 “raspberry” 的记录: @@ -76,13 +75,13 @@ raspberry red 99 如果没有文本符合模式,最终结果会对应所有记录。 -并且,在一条规则只包含一个模式时,相当于在整个记录上执行 **{ print }** 命令。 +并且,在一条规则只包含一个模式时,相当于对整个记录执行 **{ print }** 。 Awk 程序本质上是 _数据驱动_ 的,命令执行结果取决于数据。所以,与其他编程语言中的程序相比,它还是有些区别的。 ### NF 变量 -每个字段都有指定变量,但针对字段和记录,也有一些特殊的变量。 **NF** 变量能存储awk在当前记录中找到的数字字段。可在屏幕上显示出变量内容,或将其用于测试。 下面例子中的数据,来自前一篇文章中的 [文本][3]: +每个字段都有指定变量,但针对字段和记录,也存在一些特殊变量。 **NF** 变量,能存储awk在当前记录中找到的数字字段。其内容可在屏幕上显示,也可用于测试。 下面例子中的数据,来自上篇文章[文本][3]: ``` @@ -93,7 +92,7 @@ banana     yellow 6 (3) [...] ``` -Awk 的 **print** 函数会接受一系列参数(可以是变量或者字符),并将它们拼接起来。这就是为什么在这一例子中,在每行结尾处,awk 会显示一个被括号括起来的整数。 +Awk 的 **print** 函数会接受一系列参数(可以是变量或者字符),并将它们拼接起来。这就是为什么在这个例子里,每行结尾处,awk 会显示一个被括号括起来的整数。 ### NR 变量 @@ -109,7 +108,7 @@ $ awk '{ print NR ": " $0 }' colours.txt [...] ``` -注意,在这个命令后输入数据时,可以不同于在 **print** 后,参数间可以不写空格,尽管这样会降低可读性: +注意,在这个命令下输入数据时,可以不遵循在 **print** 后的规则,参数间可以不写空格,尽管这样会降低可读性: ``` @@ -118,14 +117,14 @@ $ awk '{ print NR ": " $0 }' colours.txt ### printf() 函数 -为了输出结果时格式更灵活,你可以使用 awk 的 **printf()** 函数。 它与C,Lua,Bash和其他语言中的 **printf** 相类似。 它也接受 _格式_ ,后用逗号分隔的参数。参数列表需要写在括号内。 +为了输出结果时格式更灵活,你可以使用 awk 的 **printf()** 函数。 它与C,Lua,Bash和其他语言中的 **printf** 相类似。 它也接受 _格式_ ,加逗号分隔的参数。参数列表需要写在括号里。 ``` `$ printf format, item1, item2, ...` ``` -格式这一参数(也叫 _格式符_ ) 定义了其他参数会如何显示。 这一功能是用 _格式修饰符_ 来实现的。 用 **%s** 显示字符, **%d** 显示数字。 下面的**printf** 语句,会在括号内显示字段数量: +格式这一参数(也叫 _格式符_ ) 定义了其他参数如何显示。 这一功能是用 _格式修饰符_ 来实现的。 **%s** 显示字符, **%d** 显示数字。 下面的**printf** 语句,会在括号内显示字段数量: ``` $ awk 'printf "%s (%d)\n",$0,NF}' colours.txt @@ -136,13 +135,13 @@ banana     yellow 6 (3) ``` -在这个例子里, **%s (%d)** 提供了每一行的输出格式,**$0,NF** 定义了插入 **%s** 和 **%d** 位置的数据。注意,不像**print** 函数,在没有明确指令时下,输出不会转到下一行。 转义字符 **\n** 才会换行。 +在这个例子里, **%s (%d)** 确定了每一行的输出格式,**$0,NF** 定义了插入 **%s** 和 **%d** 位置的数据。注意,和**print** 函数不同,在没有明确指令时,输出不会转到下一行。出现 转义字符 **\n** 时才会换行。 ### Awk 脚本编程 -这篇文章中出现的所有awk代码,都在Bash终端中执行过。 在更复杂的程序中,将你的命令放在文件( _脚本_ )中,这样会更容易。 **-f FILE** 选项(不要和 **-F** 弄混了,那个选项用于字段分隔符),可用于调用包含可执行程序的文件。 +这篇文章中出现的所有awk代码,都在Bash终端中执行过。 面对更复杂的程序,将命令放在文件( _脚本_ )中会更容易。 **-f FILE** 选项(不要和 **-F** 弄混了,那个选项用于字段分隔符),可用于指明包含可执行程序的文件。 -例如,这里有一个简单的awk 脚本。 创建一个名为 **example1.awk** 的文件,包含以下内容: +举个例子,下面是一个简单的awk 脚本。 创建一个名为 **example1.awk** 的文件,包含以下内容: ``` @@ -150,10 +149,9 @@ banana     yellow 6 (3) /^b/ {print "B: " $0} ``` -It's conventional to give such files the extension **.awk** to make it clear that they hold an awk program. This naming is not mandatory, but it gives file managers and editors (and you) a useful clue about what the file is. -如果一个文件包含 awk 程序,最好给这些文件 **.awk** 的扩展名。 +如果一个文件包含 awk 程序,那么在给文件命名时,最好写上 **.awk** 的扩展名。 这样命名不是强制的,但这么做,会给文件管理器,编辑者(和你)一个关于文件内容的,很有用的提示。 -Run the script: +执行这一脚本: ``` @@ -163,12 +161,12 @@ B: banana     yellow 6 A: apple      green  8 ``` -一个包含 awk 命令的文件,在最开头一行加上 **#!** ,就可以变成可执行脚本。 创建一个名为 **example2.awk** 的文件,包含以下内容: +一个包含 awk 命令的文件,在最开头一行加上 **#!** ,就能变成可执行脚本。 创建一个名为 **example2.awk** 的文件,包含以下内容: ``` #!/usr/bin/awk -f # -# Print all but line 1 with the line number on the front +# 除了第一行,在其他行前显示行号 # NR > 1 { @@ -177,15 +175,16 @@ NR > 1 { ``` Arguably, there's no advantage to having just one line in a script, but sometimes it's easier to execute a script than to remember and type even a single line. A script file also provides a good opportunity to document what a command does. Lines starting with the **#** symbol are comments, which awk ignores. +可以说,脚本中只有一行,大多数情况下没什么用。 但在某些情况下,执行一个脚本,比记住,然后打一条命令要容易的多。 一个脚本文件,也提供了一个记录命令具体作用的好机会。 以 **#** 号开头的行是注释,awk 会忽略它们。 -Grant the file executable permission: +给文件可执行权限: ``` `$ chmod u+x example2.awk` ``` -Run the script: +执行脚本: ``` @@ -197,21 +196,25 @@ $ ./example2.awk colours.txt [...] ``` -An advantage of placing your awk instructions in a script file is that it's easier to format and edit. While you can write awk on a single line in your terminal, it can get overwhelming when it spans several lines. -### Try it +将awk 命令放在脚本文件中,有一个好处就是,修改和格式化输出会更容易。在终端中,如果能用一行执行多条awk命令,那么输入多行,才能达到同样效果,就显得有些多余了。 + +### 试一试 You now know enough about how awk processes your instructions to be able to write a complex awk program. Try writing an awk script with more than one rule and at least one conditional pattern. If you want to try more functions than just **print** and **printf**, refer to [the gawk manual][4] online. -Here's an idea to get you started: +你现在已经足够了解, awk 是如何执行指令的了。现在你应该能编写复杂的awk 程序了。 试着编写一个awk 脚本,它需要: 至少包括一个条件模式,以及多个规则。如果你想使用除 **print** 和 **printf** 以外的函数,可以参考在线[ gawk 手册][4] . + + +下面这个例子是个很好的切入点: ``` #!/usr/bin/awk -f # -# Print each record EXCEPT -# IF the first record contains "raspberry", -# THEN replace "red" with "pi" +# 显示所有记录 除了出现以下情况 +# 如果第一个记录 包含 “raspberry” +# 将 “red” 替换成 “pi” $1 == "raspberry" {         gsub(/red/,"pi") @@ -220,13 +223,14 @@ $1 == "raspberry" { { print } ``` -Try this script to see what it does, and then try to write your own. +试着执行这个脚本,看看输出是什么。接下来就看你自己的了。 -The next article in this series will introduce more functions for even more complex (and useful!) scripts. + +这一系列的下一篇文章,将会介绍更多,能在更复杂(更有用!) 脚本中使用的函数。 * * * -_This article is adapted from an episode of [Hacker Public Radio][5], a community technology podcast._ +_这篇文章改编自 [Hacker Public Radio][5] 系列,一个技术社区博客_ -------------------------------------------------------------------------------- From 0f109aa52570958ee8a94cab3d6a5659a3afa1bd Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 20 Nov 2019 22:01:53 +0100 Subject: [PATCH 563/800] Update 20191104 Fields, records, and variables in awk.md --- .../tech/20191104 Fields, records, and variables in awk.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sources/tech/20191104 Fields, records, and variables in awk.md b/sources/tech/20191104 Fields, records, and variables in awk.md index 377be315d0..61acdae6a1 100644 --- a/sources/tech/20191104 Fields, records, and variables in awk.md +++ b/sources/tech/20191104 Fields, records, and variables in awk.md @@ -9,7 +9,7 @@ awk中的字段,记录和变量 ====== -这个系列的第二篇,我们会学到 字段,记录和一些非常有用的awk变量。 +这个系列的第二篇,我们会学习 字段,记录和一些非常有用的awk变量。 ![Man at laptop on a mountain][1] Awk 有好几个变种: 最早的 **awk**, 是1977 年 AT&T Bell 实验室所创。它还有一些重构版本,例如 **mawk**, **nawk**。在大多数Linux 发行版中能见到的,是 GNU awk,也叫**gawk**。 在大多数 Linux 发行版中,awk 和 gawk 都是指向 GNU awk 的链接。 输入awk命令,也是同样的效果。 [GNU awk 用户手册][2]中,能看到 awk 和 gawk 的全部历史。 @@ -174,7 +174,6 @@ NR > 1 { } ``` -Arguably, there's no advantage to having just one line in a script, but sometimes it's easier to execute a script than to remember and type even a single line. A script file also provides a good opportunity to document what a command does. Lines starting with the **#** symbol are comments, which awk ignores. 可以说,脚本中只有一行,大多数情况下没什么用。 但在某些情况下,执行一个脚本,比记住,然后打一条命令要容易的多。 一个脚本文件,也提供了一个记录命令具体作用的好机会。 以 **#** 号开头的行是注释,awk 会忽略它们。 给文件可执行权限: @@ -201,8 +200,6 @@ $ ./example2.awk colours.txt ### 试一试 -You now know enough about how awk processes your instructions to be able to write a complex awk program. Try writing an awk script with more than one rule and at least one conditional pattern. If you want to try more functions than just **print** and **printf**, refer to [the gawk manual][4] online. - 你现在已经足够了解, awk 是如何执行指令的了。现在你应该能编写复杂的awk 程序了。 试着编写一个awk 脚本,它需要: 至少包括一个条件模式,以及多个规则。如果你想使用除 **print** 和 **printf** 以外的函数,可以参考在线[ gawk 手册][4] . From 04c41272fc8b7f4777c5a51707f2bce88e0bbfc2 Mon Sep 17 00:00:00 2001 From: wenwensnow <963555237@qq.com> Date: Wed, 20 Nov 2019 22:03:18 +0100 Subject: [PATCH 564/800] Rename sources/tech/20191104 Fields, records, and variables in awk.md to translated/tech/20191104 Fields, records, and variables in awk.md --- .../tech/20191104 Fields, records, and variables in awk.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191104 Fields, records, and variables in awk.md (100%) diff --git a/sources/tech/20191104 Fields, records, and variables in awk.md b/translated/tech/20191104 Fields, records, and variables in awk.md similarity index 100% rename from sources/tech/20191104 Fields, records, and variables in awk.md rename to translated/tech/20191104 Fields, records, and variables in awk.md From 13f540c772154f5aa88030d84450f7620d453477 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 Nov 2019 07:29:15 +0800 Subject: [PATCH 565/800] PRF @geekpi --- ...nfigure Postfix Mail Server on CentOS 8.md | 94 +++++++++---------- 1 file changed, 44 insertions(+), 50 deletions(-) diff --git a/translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md b/translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md index 66452903ae..ccfccd6297 100644 --- a/translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md +++ b/translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to install and Configure Postfix Mail Server on CentOS 8) @@ -10,9 +10,9 @@ 如何在 CentOS 8 上安装和配置 Postfix 邮件服务器 ====== -**Postfix** 是一个免费的开源 **MTA**(邮件传输代理),用于在 Linux 系统上路由或传递电子邮件。在本指南中,你将学习如何在 CentOS 8 上安装和配置 Postfix。 +Postfix 是一个自由开源的 MTA(邮件传输代理),用于在 Linux 系统上路由或传递电子邮件。在本指南中,你将学习如何在 CentOS 8 上安装和配置 Postfix。 -[![Install-configure-Postfx-Server-CentOS8][1]][2] +![Install-configure-Postfx-Server-CentOS8][2] 实验室设置: @@ -20,8 +20,6 @@ * IP 地址:192.168.1.13 * 主机名:server1.crazytechgeek.info(确保域名指向服务器的 IP) - - ### 步骤 1)更新系统 第一步是确保系统软件包是最新的。为此,请按如下所示更新系统: @@ -30,7 +28,7 @@ # dnf update ``` -继续之前,还请确保不存在其他 **MTA**(如 **Sendmail**),因为这将导致与 Postfix 配置冲突。例如,要删除 Sendmail,请运行以下命令: +继续之前,还请确保不存在其他 MTA(如 Sendmail),因为这将导致与 Postfix 配置冲突。例如,要删除 Sendmail,请运行以下命令: ``` # dnf remove sendmail @@ -38,14 +36,14 @@ ### 步骤 2)设置主机名并更新 /etc/hosts -使用下面的 hostnamectl 命令在系统上设置主机名, +使用下面的 `hostnamectl` 命令在系统上设置主机名: ``` # hostnamectl set-hostname server1.crazytechgeek.info # exec bash ``` -此外,你需要在 /etc/hosts 中添加系统的主机名和 IP。 +此外,你需要在 `/etc/hosts` 中添加系统的主机名和 IP: ``` # vim /etc/hosts @@ -62,7 +60,7 @@ # dnf install postfix ``` -[![Install-Postfix-Centos8][1]][3] +![Install-Postfix-Centos8][3] ### 步骤 4)启动并启用 Postfix 服务 @@ -73,29 +71,29 @@ # systemctl enable postfix ``` -要检查 Postfix 状态,请运行以下 systemctl 命令 +要检查 Postfix 状态,请运行以下 `systemctl` 命令: ``` # systemctl status postfix ``` -![Start-Postfix-check-status-centos8][1] +![Start-Postfix-check-status-centos8][9] 太好了,我们已经验证了 Postfix 已启动并正在运行。接下来,我们将配置 Postfix 从本地发送邮件到我们的服务器。 ### 步骤 5)安装 mailx 邮件客户端 -在配置 Postfix 服务器之前,我们需要安装 mailx,要安装它,请运行以下命令: +在配置 Postfix 服务器之前,我们需要安装 `mailx`,要安装它,请运行以下命令: ``` # dnf install mailx ``` -![Install-Mailx-CentOS8][1] +![Install-Mailx-CentOS8][10] ### 步骤 6)配置 Postfix 邮件服务器 -Postfix 的配置文件位于 **/etc/postfix/main.cf** 中。我们需要对配置文件进行一些修改,因此请使用你喜欢的文本编辑器将其打开。 +Postfix 的配置文件位于 `/etc/postfix/main.cf` 中。我们需要对配置文件进行一些修改,因此请使用你喜欢的文本编辑器将其打开: ``` # vi /etc/postfix/main.cf @@ -121,7 +119,7 @@ mynetworks = 192.168.1.0/24, 127.0.0.0/8 home_mailbox = Maildir/ ``` -完成后,保存并退出配置文件。重新启动 postfix 服务以使更改生效。 +完成后,保存并退出配置文件。重新启动 postfix 服务以使更改生效: ``` # systemctl restart postfix @@ -136,7 +134,7 @@ home_mailbox = Maildir/ # passwd postfixuser ``` -接下来,运行以下命令,从本地用户 **pkumar** 发送邮件到另一个用户 “**postfixuser**”。 +接下来,运行以下命令,从本地用户 `pkumar` 发送邮件到另一个用户 `postfixuser`。 ``` # telnet localhost smtp @@ -181,7 +179,7 @@ Escape character is '^]'. 250 SMTPUTF8 ``` -接下来,运行橙色高亮的命令,例如 “mail from”、“rcpt to”,“data”,最后输入 “quit”, +接下来,运行橙色高亮的命令,例如 `mail from`、`rcpt to`、`data`,最后输入 `quit`: ``` mail from: @@ -198,11 +196,11 @@ quit Connection closed by foreign host ``` -完成 telnet 命令可从本地用户 “**pkumar**” 发送邮件到另一个本地用户 “**postfixuser**”,如下所示: +完成 `telnet` 命令可从本地用户 `pkumar` 发送邮件到另一个本地用户 `postfixuser`,如下所示: -![Send-email-with-telnet-centos8][1] +![Send-email-with-telnet-centos8][11] -如果一切都按计划进行,那么你应该可以在新用户的家目录中查看发送的邮件。 +如果一切都按计划进行,那么你应该可以在新用户的家目录中查看发送的邮件: ``` # ls /home/postfixuser/Maildir/new @@ -216,37 +214,37 @@ Connection closed by foreign host # cat /home/postfixuser/Maildir/new/1573580091.Vfd02I20050b8M635437.server1.crazytechgeek.info ``` -![Read-postfix-email-linux][1] +![Read-postfix-email-linux][12] ### Postfix 邮件服务器日志 -Postfix 邮件服务器邮件日志保存在文件 “**/var/log/maillog**” 中,使用以下命令查看实时日志, +Postfix 邮件服务器邮件日志保存在文件 `/var/log/maillog` 中,使用以下命令查看实时日志, ``` # tail -f /var/log/maillog ``` -![postfix-maillogs-centos8][1] +![postfix-maillogs-centos8][13] ### 保护 Postfix 邮件服务器 -建议始终确保客户端和 postfix 服务器之间的通信安全,这可以使用 SSL 证书来实现,它们可以来自受信任的权威机构或自签名证书。在本教程中,我们将使用 **openssl** 命令生成用于 postfix 的自签名证书, +建议始终确保客户端和 Postfix 服务器之间的通信安全,这可以使用 SSL 证书来实现,它们可以来自受信任的权威机构或自签名证书。在本教程中,我们将使用 `openssl` 命令生成用于 Postfix 的自签名证书, -我假设 openssl 已经安装在你的系统上,如果未安装,请使用以下 dnf 命令, +我假设 `openssl` 已经安装在你的系统上,如果未安装,请使用以下 `dnf` 命令: ``` # dnf install openssl -y ``` -使用下面的 openssl 命令生成私钥和 CSR(证书签名请求), +使用下面的 `openssl` 命令生成私钥和 CSR(证书签名请求): ``` # openssl req -nodes -newkey rsa:2048 -keyout mail.key -out mail.csr ``` -![Postfix-Key-CSR-CentOS8][1] +![Postfix-Key-CSR-CentOS8][14] -现在,使用以下 openssl 命令生成自签名证书, +现在,使用以下 openssl 命令生成自签名证书: ``` # openssl x509 -req -days 365 -in mail.csr -signkey mail.key -out mail.crt @@ -256,13 +254,13 @@ Getting Private key # ``` -现在将私钥和证书文件复制到 /etc/postfix 目录下。 +现在将私钥和证书文件复制到 `/etc/postfix` 目录下: ``` # cp mail.key mail.crt /etc/postfix ``` -在 postfix 配置文件中更新私钥和证书文件的路径 +在 Postfix 配置文件中更新私钥和证书文件的路径: ``` # vi /etc/postfix/main.cf @@ -274,21 +272,21 @@ smtpd_tls_security_level = may ……… ``` -重启 postfix 服务以使上述更改生效。 +重启 Postfix 服务以使上述更改生效: ``` # systemctl restart postfix ``` -让我们尝试使用 mailx 客户端将邮件发送到内部本地域和外部域。 +让我们尝试使用 `mailx` 客户端将邮件发送到内部本地域和外部域。 -**从 pkumar 发送内部本地邮件到 postfixuser 中** +从 `pkumar` 发送内部本地邮件到 `postfixuser` 中: ``` # echo "test email" | mailx -s "Test email from Postfix MailServer" -r root@linuxtechi root@linuxtechi ``` -使用以下命令检查并阅读邮件, +使用以下命令检查并阅读邮件: ``` # cd /home/postfixuser/Maildir/new/ @@ -299,19 +297,19 @@ total 8 # cat 1573612845.Vfd02I20050bbM466643.server1.crazytechgeek.info ``` -![Read-Postfixuser-Email-CentOS8][1] +![Read-Postfixuser-Email-CentOS8][15] -**从 postfixuser 发送邮件到外部域 (( [root@linuxtechi][4]))** +从 `postfixuser` 发送邮件到外部域(`root@linuxtechi.com`): ``` # echo "External Test email" | mailx -s "Postfix MailServer" -r root@linuxtechi root@linuxtechi ``` -**注意:** 如果你的 IP 没有被任何地方列入黑名单,那么你发送到外部域的邮件将被发送,否则它将被退回,并提示你的 IP 被 spamhaus 之类的数据库列入黑名单。 +注意:如果你的 IP 没有被任何地方列入黑名单,那么你发送到外部域的邮件将被发送,否则它将被退回,并提示你的 IP 被 spamhaus 之类的数据库列入黑名单。 ### 检查 Postfix 邮件队列 -使用mailq命令列出队列中的邮件。 +使用 `mailq` 命令列出队列中的邮件: ``` # mailq @@ -321,13 +319,6 @@ Mail queue is empty 完成!我们的 Postfix 配置正常工作了!目前就这样了。我们希望你觉得本教程有见地,并且你可以轻松地设置本地 Postfix 服务器。 - * [Facebook][5] - * [Twitter][6] - * [LinkedIn][7] - * [Reddit][8] - - - -------------------------------------------------------------------------------- via: https://www.linuxtechi.com/install-configure-postfix-mailserver-centos-8/ @@ -335,7 +326,7 @@ via: https://www.linuxtechi.com/install-configure-postfix-mailserver-centos-8/ 作者:[James Kiarie][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/) 荣誉推出 @@ -345,7 +336,10 @@ via: https://www.linuxtechi.com/install-configure-postfix-mailserver-centos-8/ [2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-configure-Postfx-Server-CentOS8.jpg [3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-Postfix-Centos8.png [4]: https://www.linuxtechi.com/cdn-cgi/l/email-protection -[5]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-configure-postfix-mailserver-centos-8%2F&t=How%20to%20install%20and%20Configure%20Postfix%20Mail%20Server%20on%20CentOS%208 -[6]: http://twitter.com/share?text=How%20to%20install%20and%20Configure%20Postfix%20Mail%20Server%20on%20CentOS%208&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-configure-postfix-mailserver-centos-8%2F&via=Linuxtechi -[7]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-configure-postfix-mailserver-centos-8%2F&title=How%20to%20install%20and%20Configure%20Postfix%20Mail%20Server%20on%20CentOS%208 -[8]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-configure-postfix-mailserver-centos-8%2F&title=How%20to%20install%20and%20Configure%20Postfix%20Mail%20Server%20on%20CentOS%208 +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Start-Postfix-check-status-centos8.png +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-Mailx-CentOS8.png +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Send-email-with-telnet-centos8.png +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Read-postfix-email-linux.png +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/11/postfix-maillogs-centos8.png +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Postfix-Key-CSR-CentOS8.png +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Read-Postfixuser-Email-CentOS8.png From e0e0bb0e0c1be7ad0752456e3e888a3825803c55 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 Nov 2019 07:29:49 +0800 Subject: [PATCH 566/800] PUB @geekpi https://linux.cn/article-11597-1.html --- ...o install and Configure Postfix Mail Server on CentOS 8.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md (99%) diff --git a/translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md b/published/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md similarity index 99% rename from translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md rename to published/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md index ccfccd6297..6fa7ef3d4f 100644 --- a/translated/tech/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md +++ b/published/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11597-1.html) [#]: subject: (How to install and Configure Postfix Mail Server on CentOS 8) [#]: via: (https://www.linuxtechi.com/install-configure-postfix-mailserver-centos-8/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) From 9975312ffbde3f5f503176892ae41628143d8a64 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Nov 2019 08:01:33 +0800 Subject: [PATCH 567/800] Rename sources/tech/20191120 3 emerging open source projects to keep an eye on.md to sources/talk/20191120 3 emerging open source projects to keep an eye on.md --- .../20191120 3 emerging open source projects to keep an eye on.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191120 3 emerging open source projects to keep an eye on.md (100%) diff --git a/sources/tech/20191120 3 emerging open source projects to keep an eye on.md b/sources/talk/20191120 3 emerging open source projects to keep an eye on.md similarity index 100% rename from sources/tech/20191120 3 emerging open source projects to keep an eye on.md rename to sources/talk/20191120 3 emerging open source projects to keep an eye on.md From 4d434548a55fc6730747361a31aa8cbf343e08dc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 Nov 2019 08:16:15 +0800 Subject: [PATCH 568/800] PRF @guevaraya --- ...ted With ZFS Filesystem on Ubuntu 19.10.md | 71 +++++++++---------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md b/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md index 7e6f557de1..e950e446c4 100644 --- a/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md +++ b/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) -[#]: translator: (guevaraya ) -[#]: reviewer: ( ) +[#]: translator: (guevaraya) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Getting Started With ZFS Filesystem on Ubuntu 19.10) @@ -10,54 +10,51 @@ 在 Ubuntu 19.10 上入门 ZFS 文件系统 ====== - [Ubuntu 19.01][1] 的一个主要新特性就是 [ZFS][2]。现在你可以很容易的不要太多操作就可以在 Ubuntu 系统上安装 ZFS了。 +![][4] -一般情况下,安装 Linux 都会选择 Ext4 文件系统。但是如果是安装 Ubuntu 19.10,在启动阶段可以看到 ZFS 选项。但你绝对不能在双系统上用它,因为它会擦除这个磁盘。 +Ubuntu 19.10 的主要新特性之一就是 [ZFS][2]。现在你可以很容易的无需额外努力就可以在 Ubuntu 系统上安装 ZFS了。 + +一般情况下,安装 Linux 都会选择 Ext4 文件系统。但是如果是全新安装 Ubuntu 19.10,在安装的启动阶段可以看到 ZFS 选项。 ![你可以在安装 Ubuntu 19.10 的时候选择 ZFS][3] -让我们看看 ZFS 有多重要以及如何在已经安装 ZFS 的 Ubuntu 上使用它。 +让我们看看 ZFS 为何重要,以及如何在已经安装了 ZFS 的 Ubuntu 上使用它。 ### ZFS 与其他文件系统有哪些区别? -ZFS 的设计初衷是:处理海量存储和避免数据损坏。ZFS 可以处理 256 千万亿的泽它字节(ZB)数据。(这就是ZFS的Z)且它可以处理最大16艾字节(EB)的文件。 +ZFS 的设计初衷是:处理海量存储和避免数据损坏。ZFS 可以处理 256 千万亿的 ZB 数据。(这就是 ZFS 的 Z)且它可以处理最大 16 EB 的文件。 -如果你仅有一个单磁盘的笔记本电脑,你可以体验 ZFS 的数据保护特性。即写及时拷贝特性确保正在使用的数据不会被覆盖,相反,新的数据会被写到一个新的块中,同时文件系统的元数据会被更新到新块中。ZFS 可容易的创建文件系统的快照。这个快照可追踪文件系统的更改,并共享数据块确保节省数据空间。 +如果你仅有一个单磁盘的笔记本电脑,你可以体验 ZFS 的数据保护特性。写时复制(COW)特性确保正在使用的数据不会被覆盖,相反,新的数据会被写到一个新的块中,同时文件系统的元数据会被更新到新块中。ZFS 可容易的创建文件系统的快照。这个快照可追踪文件系统的更改,并共享数据块确保节省数据空间。 ZFS 为磁盘上的每个文件分配一个校验和。它会不断的校验文件的状态和校验和。如果发现文件被损坏了,它就会尝试修复文件。 -我写过一个文章详细介绍 [什么是 ZFS以及它有哪些特性][2].如果你感兴趣可以去阅读下。 +我写过一个文章详细介绍 [什么是 ZFS以及它有哪些特性][2]。如果你感兴趣可以去阅读下。 -注: +注:请谨记 ZFS 的数据保护特性会导致性能下降。 -请谨记 ZFS 的数据保护特性会导致性能下降。 +### Ubuntu 下使用 ZFS [适用于中高级用户] -### Ubuntu下使用 ZFS [适用于中高级用户] +一旦你在你的主磁盘上全新安装了带有 ZFS 的 Ubuntu,你就可以开始体验它的特性。 -![][4] - -一旦你在你的主磁盘上干净安装了 Ubuntu 的 ZFS,你就可以开始体验它的特性。 - -请注意安装 ZFS 这个过程需要命令行。我还没用过它的 GUI 工具。 +请注意所有的 ZFS 设置过程都需要命令行。我不知道它有任何 GUI 工具。 #### 创建一个 ZFS 池 -_**这段仅针对拥有多个磁盘的系统。如果你只有一个磁盘,Ubuntu会在安装的时候自动的创建池。**_ +**这段仅针对拥有多个磁盘的系统。如果你只有一个磁盘,Ubuntu 会在安装的时候自动创建池。** -在创建池之前,你需要为池找到磁盘的id。你可以用命令 _**lsblk**_ 查询出这个信息。 +在创建池之前,你需要为池找到磁盘的 id。你可以用命令 `lsblk` 查询出这个信息。 为三个磁盘创建一个基础池,用以下命令: ``` -sudo zpool create pool-test /dev/sdb /dev/sdc /dev/sdd. +sudo zpool create pool-test /dev/sdb /dev/sdc /dev/sdd ``` -请记得替换 _**pool-test**_ 为你自己的命名 +请记得替换 `pool-test` 为你选择的的命名。 -这个命令将会设置“无冗余RAID-0池”。这意味着如果一个磁盘被破坏或有故障,你将会丢失数据。如果你执行以上命令,还是建议做一个常规备份。 +这个命令将会设置“无冗余 RAID-0 池”。这意味着如果一个磁盘被破坏或有故障,你将会丢失数据。如果你执行以上命令,还是建议做一个常规备份。 - -你也可以增加一个磁盘到池,用下面命令: +你可以用下面命令将另一个磁盘增加到池中: ``` sudo zpool add pool-name /dev/sdx @@ -75,9 +72,9 @@ sudo zpool status pool-test #### 镜像一个 ZFS 池 -确保数据的安全性,你可以创建镜像。镜像意味着每个磁盘包含同样的数据。在创建镜像的磁盘上三个磁盘坏掉两个仍然可以不丢数据。 +为确保数据的安全性,你可以创建镜像。镜像意味着每个磁盘包含同样的数据。使用镜像设置,你可能会丢失三个磁盘中的两个,并且仍然拥有所有信息。 -创建镜像你可以用下面命令: +要创建镜像你可以用下面命令: ``` sudo zpool create pool-test mirror /dev/sdb /dev/sdc /dev/sdd @@ -85,7 +82,7 @@ sudo zpool create pool-test mirror /dev/sdb /dev/sdc /dev/sdd #### 创建 ZFS 用于备份恢复的快照 -快照可以是一个需要备份的时间点以防某个文件被删除或被覆盖。比如,我们创建一个快照,当在用户主目录下删除一些目录后,然后把他恢复。 +快照允许你创建一个后备,以防某个文件被删除或被覆盖。比如,我们创建一个快照,当在用户主目录下删除一些目录后,然后把它恢复。 首先,你需要找到你想要的快照数据集。你可以这样做: @@ -95,31 +92,31 @@ zfs list ![Zfs List][7] -你可以看到我的目录位于 **rpool/USERDATA/johnblood_uwcjk7**。 +你可以看到我的家目录位于 `rpool/USERDATA/johnblood_uwcjk7`。 -我们用下面命令创建一个名叫 **1910** 的快照: +我们用下面命令创建一个名叫 `1910` 的快照: ``` -sudo zfs snapshot rpool/USERDATA/[email protected] +sudo zfs snapshot rpool/USERDATA/johnblood_uwcjk7@1019 ``` -快照很快创建完成。现在你可以删除 _Downloads_ 和 _Documents_ 目录。 +快照很快创建完成。现在你可以删除 `Downloads` 和 `Documents` 目录。 现在你用以下命令恢复快照: ``` -sudo zfs rollback rpool/USERDATA/[email protected] +sudo zfs rollback rpool/USERDATA/johnblood_uwcjk7@1019 ``` -回滚的数据大小取决于有多少信息改变。现在你可以查看用户目录和被删目录(和它的内容)将会被恢复过来。 +回滚的时间长短取决于有多少信息改变。现在你可以查看家目录,被删除的目录(和它的内容)将会被恢复过来。 ### 要不要试试 ZFS ? -这篇文章仅简单介绍的 Ubuntu下 ZFS 的用法。更多的信息请参考 [ Ubuntu 的ZFS Wiki页面][5] 我也推荐阅读 [ArsTechnica的精彩文章][8]。 +这篇文章仅简单介绍的 Ubuntu下 ZFS 的用法。更多的信息请参考 [Ubuntu 的 ZFS Wiki页面][5]。我也推荐阅读 [ArsTechnica 的精彩文章][8]。 -这个是试验性的功能。如果你还不了解 ZFS,你想用一个简单稳定的系统,请安装标准文件系统 EXT4。如果你想用闲置的机器体验,可以参照上面了解 ZFS。如果你是一个‘专家’,你知道你在做什么,那就可以随便咋搞。 +这个是试验性的功能。如果你还不了解 ZFS,你想用一个简单稳定的系统,请安装标准文件系统 EXT4。如果你想用闲置的机器体验,可以参照上面了解 ZFS。如果你是一个“专家”,并且知道自己在做什么,则可以随时随地随意尝试ZFS。 -你之前用过 ZFS 吗?请在下面留言。如果你觉得这个文章还可以,请分享到社交媒体,黑客新闻或 [Reddit][9]。 +你之前用过 ZFS 吗?请在下面留言。 -------------------------------------------------------------------------------- @@ -128,7 +125,7 @@ via: https://itsfoss.com/zfs-ubuntu/ 作者:[John Paul][a] 选题:[lujun9972][b] 译者:[guevaraya](https://github.com/guevaraya) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -159,7 +156,7 @@ via: https://itsfoss.com/zfs-ubuntu/ [a]: https://itsfoss.com/author/john/ [b]: https://github.com/lujun9972 [1]: https://itsfoss.com/ubuntu-19-04-release-features/ -[2]: https://itsfoss.com/what-is-zfs/ +[2]: https://linux.cn/article-10034-1.html [3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/zfs-ubuntu-19-10.jpg?ssl=1 [4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/Using_ZFS_Ubuntu.jpg?resize=800%2C450&ssl=1 [5]: https://wiki.ubuntu.com/Kernel/Reference/ZFS From 642a38eefdbcfcc5cba0065c464eb57ba6e91329 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 21 Nov 2019 08:17:34 +0800 Subject: [PATCH 569/800] PUB @guevaraya https://linux.cn/article-11598-1.html --- ...113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md (98%) diff --git a/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md b/published/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md similarity index 98% rename from translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md rename to published/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md index e950e446c4..f416b4e5b7 100644 --- a/translated/tech/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md +++ b/published/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (guevaraya) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11598-1.html) [#]: subject: (Getting Started With ZFS Filesystem on Ubuntu 19.10) [#]: via: (https://itsfoss.com/zfs-ubuntu/) [#]: author: (John Paul https://itsfoss.com/author/john/) From 2920f2dd50ed89c896a64c44ca0431cd2349e831 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 21 Nov 2019 08:52:19 +0800 Subject: [PATCH 570/800] translating --- ... a Simple Web Application Using Flutter.md | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) rename {sources => translated}/tech/20191115 Developing a Simple Web Application Using Flutter.md (58%) diff --git a/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md b/translated/tech/20191115 Developing a Simple Web Application Using Flutter.md similarity index 58% rename from sources/tech/20191115 Developing a Simple Web Application Using Flutter.md rename to translated/tech/20191115 Developing a Simple Web Application Using Flutter.md index 677ed567ee..a29e2e4d91 100644 --- a/sources/tech/20191115 Developing a Simple Web Application Using Flutter.md +++ b/translated/tech/20191115 Developing a Simple Web Application Using Flutter.md @@ -7,21 +7,21 @@ [#]: via: (https://opensourceforu.com/2019/11/developing-a-simple-web-application-using/) [#]: author: (Jis Joe Mathew https://opensourceforu.com/author/jis-joe/) -Developing a Simple Web Application Using Flutter +使用 Flutter 开发简单的 Web 应用 ====== [![][1]][2] -_This article guides readers on how to run and deploy their first Web application using Flutter._ +_本文指导读者如何使用 Flutter 运行和部署第一个 Web 应用。_ -Flutter has moved to a new stage, the Web, after having travelled a long way in Android and iOS development. Flutter 1.5 has been released by Google, along with support for Web application development. +Flutter 在 Android 和 iOS 开发方面走了很长一段路之后,已经迈入了一个新的阶段,即 Web。Google 发布了 Flutter 1.5,同时支持 Web 应用开发。 -**Configuring Flutter for the Web** -In order to use the Web package, enter the _flutter upgrade_ command to update to Flutter version 1.5.4. +**为 Web 配置 Flutter** +为了使用 Web 包,输入命令 _flutter upgrade_ 更新到 Flutter 1.5.4。 - * Open a terminal - * Type flutter upgrade - * Check the version by typing _flutter –version_ + * 打开终端 + * 输入 flutter upgrade + * 输入 _flutter –version_ 检查版本 @@ -29,12 +29,12 @@ In order to use the Web package, enter the _flutter upgrade_ command to update t ![Figure 2: Starting a new Flutter Web project in VSC][4] -One can also use Android Studio 3.0 or later versions for Flutter Web development, but we will use Visual Studio Code for this tutorial. +也可以将 Android Studio 3.0 或更高版本用于 Flutter Web 开发,但在本教程中,我们使用 Visual Studio Code。 -**Creating a new project with Flutter Web** -Open Visual Studio Code and press _Shift+Ctrl+P_ to start a new project. Type flutter and select _New Web Project_. -Now, name the project. I have named it _open_source_for_you_. -Open the terminal window in VSC, and type in the following commands: +**使用 Flutter Web 创建新项目** +打开 Visual Studio Code,然后按 _Shift+Ctrl+P_ 开始一个新项目。输入 flutter 并选择 _New Web Project_。 +现在,为项目命名。我将其命名为 _open_source_for_you_。 +在 VSC 中打开终端窗口,然后输入以下命令: ``` flutter packages pub global activate webdev @@ -42,23 +42,23 @@ flutter packages pub global activate webdev flutter packages upgrade ``` -Now use the following command to run the website, on localhost, with the IP address 127.0.0.1 +现在,使用以下命令在 localhost 上运行网站,IP 地址是 127.0.0.1。 ``` flutter packages pub global run webdev serve ``` -Open any browser and type, __ -There is a Web folder inside the project directory which contains an _index.html_ file. The _dart_ file is compiled into a JavaScript file and is included in the HTML file using the following code: +打开任何浏览器,然后输入 __。 +在项目目录中有个 Web 文件夹,其中包含了 _index.html_。 _dart_ 文件被编译成 JavaScript 文件,并使用以下代码包含在 HTML 文件中: ``` ``` -**Coding and making changes to the demo page** -Let’s create a simple application, which will print ‘Welcome to OSFY’ on the Web page. -Let’s now open the Dart file, which is located in the _lib_ folder _main.dart_ (the default name) (see Figure 5). -We can now remove the debug tag using the property of _MaterialApp_, as follows: +**编码和修改演示页面** +让我们创建一个简单的应用,它会在网页上打印 “ Welcome to OSFY”。 +现在打开 Dart 文件,它位于 _lib_ 文件夹 _main.dart_(默认名)中(参见图 5)。 +现在,我们可以在 _MaterialApp_ 的属性中删除调试标记,如下所示: ``` debugShowCheckedModeBanner: false @@ -70,8 +70,8 @@ debugShowCheckedModeBanner: false ![Figure 5: Location of main.dart file][7] -Now, adding more into the Dart file is very similar to writing code in Flutter in Dart. For that, we can declare a class titled _MyClass_, which extends the _StatelessWidget_. -We use a _Center_ widget to position elements to the centre. We can also add a _Padding_ widget to add padding. Use the following code to obtain the output shown in Figure 5. Use the Refresh button to view the changes. +现在,向 Dart 中添加更多内容与在 Dart 中编写 Flutter 类似。为此,我们可以声明一个名为 _MyClass_ 的类,它继承了 _StatelessWidget_。 +我们使用 _Center_ 部件将元素定位到中心。我们还可以添加 _Padding_ 部件来添加填充。使用以下代码获得图 5 所示的输出。使用刷新按钮查看更改。 ``` class MyClass extends StatelessWidget { @@ -101,7 +101,7 @@ style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), ![Figure 7: Final output][9] -Let’s add an image from the Internet – I’ve chosen the ‘Open Source for You’ logo from the magazine’s website. We use _Image.network_. +让我们从互联网中添加一张图片,我已经从一个杂志网站选择了一张 “Open Source for You” 的 logo。我们使用 _Image.network_。 ``` Image.network( @@ -111,13 +111,13 @@ width: 150 ), ``` -The final output is shown in Figure 7. +最终输出如图 7 所示。 ![Avatar][10] [Jis Joe Mathew][11] -The author is assistant professor of computer science and engineering at Amal Jyoti College, Kanirapally, Kerala. He can be contacted at [jisjoemathew@gmail.com][12]. +作者是喀拉拉邦卡尼拉帕利阿玛尔·乔蒂学院的计算机科学与工程助理教授。可以通过 [jisjoemathew@gmail.com][12] 与他联系。 [![][13]][14] @@ -127,7 +127,7 @@ via: https://opensourceforu.com/2019/11/developing-a-simple-web-application-usin 作者:[Jis Joe Mathew][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 2031c504c628576e4f6a30a1a5ceb1164055d9d1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 21 Nov 2019 09:07:25 +0800 Subject: [PATCH 571/800] translating --- sources/tech/20191119 How to use pkgsrc on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191119 How to use pkgsrc on Linux.md b/sources/tech/20191119 How to use pkgsrc on Linux.md index 2298e4933e..86476df073 100644 --- a/sources/tech/20191119 How to use pkgsrc on Linux.md +++ b/sources/tech/20191119 How to use pkgsrc on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7d24de344bf10aba93c0d6ece63f0445e09daaf2 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 21 Nov 2019 09:33:25 +0800 Subject: [PATCH 572/800] Rename sources/tech/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md to sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md --- ...oss-Platform Source Explorer Sourcetrail is Now Open Source.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md (100%) diff --git a/sources/tech/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md b/sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md similarity index 100% rename from sources/tech/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md rename to sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md From 9d84f68fc0c1213f9730fc293d4f66116605e86f Mon Sep 17 00:00:00 2001 From: lixin <56751837+lixin555@users.noreply.github.com> Date: Thu, 21 Nov 2019 10:37:56 +0800 Subject: [PATCH 573/800] lixin555 is translating --- ...And Upload Files To Compatible Hosting Sites Automatically.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md b/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md index 356a64222f..d307c4f436 100644 --- a/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md +++ b/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md @@ -1,3 +1,4 @@ +lixin555 is translating Share And Upload Files To Compatible Hosting Sites Automatically ====== ![](https://www.ostechnix.com/wp-content/uploads/2017/10/Upload-720x340.png) From 8e90b42f1dfea1a0251e286340378a65411c628d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 22 Nov 2019 00:52:04 +0800 Subject: [PATCH 574/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191122=20Zorin?= =?UTF-8?q?=20OS=2015=20Lite=20Release:=20Good=20Looking=20Lightweight=20L?= =?UTF-8?q?inux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md --- ...Release- Good Looking Lightweight Linux.md | 135 ++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 sources/tech/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md diff --git a/sources/tech/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md b/sources/tech/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md new file mode 100644 index 0000000000..9890afb6e3 --- /dev/null +++ b/sources/tech/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Zorin OS 15 Lite Release: Good Looking Lightweight Linux) +[#]: via: (https://itsfoss.com/zorin-os-lite/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Zorin OS 15 Lite Release: Good Looking Lightweight Linux +====== + +_**Zorin OS 15 Lite edition has just been released. We’ll show take you to a desktop tour of this new release and highlight its main features for you.**_ + +[Zorin OS][1] is an increasingly popular Linux distribution. It is based on Ubuntu and thus , unsurprisingly, it also happens to be one of the [best Linux distributions for beginners][2]. It’s Windows-like interface is one of the major reasons why it is preferred by many Windows-to-Linux migrants. + +Zorin OS comes in two main variants: + + * Zorin Core: It uses GNOME desktop and is intended for newer systems + * Zorin Lite: It uses lightweight [Xfce desktop][3] and is intended to be the [Linux for old laptops and computers][4] + + + +### Zorin OS 15 Lite: What’s New? + +[Subscribe to our YouTube channel for more Linux videos][5] + +Zorin OS 15 Lite edition has finally landed after a long time of Zorin OS 15 Core release. You can get your hands on the free lite editions or the paid ultimate lite edition now. + +I tried the Zorin OS 15 Lite Ultimate edition. In this article, I shall cover the details for this release and what you should know before choosing to download Zorin OS 15 Lite for your computer. + +Zorin OS 15 Lite is almost similar to the full-fledged Zorin OS 15 release. You can check out [Zorin OS 15 features][6] in our original coverage for that. + +This release entirely focuses to be light on resources so that any type of old hardware configuration from the past decade can easily run on it. + +![][7] + +With this release, they rely on the lightweight XFCE 4.14-based desktop environment to give the best possible experience on a low-spec computer. + +In addition to the XFCE desktop environment, there are some under-the-hood changes when compared to its full-fledged version that uses GNOME. + +#### Zorin OS 15 Lite Targets Windows 7 Users + +![][8] + +Primarily, Zorin OS 15 Lite targets the Windows 7 users because the official support for Windows 7 ends this January. + +So, if you are someone who’s comfortable with Windows 7, you can give this a try, it should be a smooth experience switching to this. + +Zorin OS 15 Lite gives you the option to switch the layout to a macOS style / Windows-style appearance from the “**Zorin Appearance**” settings. + +#### 32-bit and 64-bit Support + +It was good to see Zorin OS considering the support for 32-bit/64-bit ISOs just because the lite edition is being targeted for users with low-spec hardware. + +#### Flatpak Support Enabled By Default + +![][9] + +You can utilize Flathub to install Flatpak packages out of the box using the Software Center. Make sure to check out our guide on [using Flatpak][10] if you’re not sure what to do. + +In addition to this, you already have the Snap package support. So, it should be easier to install anything through the Software Center. + +#### User Interface Impression + +![][11] + +To be honest, the default Xfce interface looks old. There are ways to [customize Xfce][12] but Zorin does it out of the box. The customized look gives a good impression. It looks pretty damn neat and works as expected. + +#### Performance + +![][13] + +Even though I haven’t tried this on a super old system, I did install it on a vintage hard disk drive which struggles to boot up Ubuntu or similar distributions. + +As per my experience, I would definitely rate the performance to be super snappy. + +It feels like I have it installed on my SSD. So, that’s obviously a good thing. If you happen to try it on a super old system, you can let me know your experience in the comments section at the bottom of this article. + +### What’s The Difference Between The ‘Ultimate Lite’ edition & Free ‘Lite’ edition? + +![][14] + +Make no mistake, you can download Zorin OS 15 for free. + +However, there’s a separate ‘Ultimate’ edition which is basically meant to support the developers and the project. In addition to that, it also bundles a lot of pre-installed software as an “ultimate” package for your computer. + +So, if you purchase the Ultimate edition, you get access to both the lite and full version. + +In case you do not want to pay for it, you can still opt for the free editions (Core, Lite, Education) depending on your requirements. You can learn more about it on their [download page][15]. + +### How To Download Zorin OS 15 Lite? + +You can just head on to its [official download webpage][15] and scroll down to find the Zorin OS 15 lite edition. + +You will find 32-bit/64-bit ISOs available, download the one you require. + +[Zorin OS 15 Lite][15] + +Installing Zorin OS is similar to installing Ubuntu. + +**Wrapping Up** + +While Zorin OS 15 is already a great offering as a Linux distribution to Windows/macOS veterans, the new Lite edition surely turns more eyes to it. + +Have you tried the ‘Lite’ edition yet? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zorin-os-lite/ + +作者:[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://zorinos.com/ +[2]: https://itsfoss.com/best-linux-beginners/ +[3]: https://www.xfce.org/ +[4]: https://itsfoss.com/lightweight-linux-beginners/ +[5]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[6]: https://itsfoss.com/zorin-os-15-release/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/file-explorer-zorin-os-15-lite.jpg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-lite-ultimate-appearance.jpg?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-software.png?ssl=1 +[10]: https://itsfoss.com/flatpak-guide/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-15-lite-appearance.jpg?ssl=1 +[12]: https://itsfoss.com/customize-xfce/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/homescreen-zorin-os-15-lite.jpg?ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-ultimate.jpg?ssl=1 +[15]: https://zorinos.com/download/ From 87eae8cfdf26e296d53249dad84794bb4e02c28b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 22 Nov 2019 00:52:31 +0800 Subject: [PATCH 575/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191121=20Simula?= =?UTF-8?q?te=20gravity=20in=20your=20Python=20game?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191121 Simulate gravity in your Python game.md --- ...21 Simulate gravity in your Python game.md | 399 ++++++++++++++++++ 1 file changed, 399 insertions(+) create mode 100644 sources/tech/20191121 Simulate gravity in your Python game.md diff --git a/sources/tech/20191121 Simulate gravity in your Python game.md b/sources/tech/20191121 Simulate gravity in your Python game.md new file mode 100644 index 0000000000..977c234d8d --- /dev/null +++ b/sources/tech/20191121 Simulate gravity in your Python game.md @@ -0,0 +1,399 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Simulate gravity in your Python game) +[#]: via: (https://opensource.com/article/19/11/simulate-gravity-python) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Simulate gravity in your Python game +====== +Learn how to program video games with Python's Pygame module and start +manipulating gravity. +![Cosmic stars in outer space][1] + +The real world is full of movement and life. The thing that makes the real world so busy and dynamic is physics. Physics is the way matter moves through space. Since a video game world has no matter, it also has no physics, so game programmers have to _simulate_ physics. + +In terms of most video games, there are basically only two aspects of physics that are important: gravity and collision. + +You implemented some collision detection when you [added an enemy][2] to your game, but this article adds more because gravity requires collision detection. Think about why gravity might involve collisions. If you can't think of any reasons, don't worry—it'll become apparent as you work through the sample code. + +Gravity in the real world is the tendency for objects with mass to be drawn toward one another. The larger the object, the more gravitational influence it exerts. In video game physics, you don't have to create objects with mass great enough to justify a gravitational pull; you can just program a tendency for objects to fall toward the presumed largest object in the video game world: the world itself. + +### Adding a gravity function + +Remember that your player already has a property to determine motion. Use this property to pull the player sprite toward the bottom of the screen. + +In Pygame, higher numbers are closer to the bottom edge of the screen. + +In the real world, gravity affects everything. In platformers, however, gravity is selective—if you add gravity to your entire game world, all of your platforms would fall to the ground. Instead, you add gravity just to your player and enemy sprites. + +First, add a **gravity** function in your **Player** class: + + +``` +    def gravity(self): +        self.movey += 3.2 # how fast player falls +``` + +This is a simple function. First, you set your player in vertical motion, whether your player wants to be in motion or not. In other words, you have programmed your player to always be falling. That's basically gravity. + +For the gravity function to have an effect, you must call it in your main loop. This way, Python applies the falling motion to your player once every clock tick. + +In this code, add the first line to your loop: + + +``` +    player.gravity() # check gravity +    player.update() +``` + +Launch your game to see what happens. Look sharp, because it happens fast: your player falls out of the sky, right off your game screen. + +Your gravity simulation is working, but maybe too well. + +As an experiment, try changing the rate at which your player falls. + +### Adding a floor to gravity + +The problem with your character falling off the world is that there's no way for your game to detect it. In some games, if a player falls off the world, the sprite is deleted and respawned somewhere new. In other games, the player loses points or a life. Whatever you want to happen when a player falls off the world, you have to be able to detect when the player disappears offscreen. + +In Python, to check for a condition, you can use an **if** statement. + +You must check to see **if** your player is falling and how far your player has fallen. If your player falls so far that it reaches the bottom of the screen, then you can do _something_. To keep things simple, set the position of the player sprite to 20 pixels above the bottom edge. + +Make your **gravity** function look like this: + + +``` +    def gravity(self): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty +``` + +Then launch your game. Your sprite still falls, but it stops at the bottom of the screen. You may not be able to _see_ your sprite behind the ground layer, though. An easy fix is to make your player sprite bounce higher by adding another **-ty** to its new Y position after it hits the bottom of the game world: + + +``` +    def gravity(self): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty-ty +``` + +Now your player bounces at the bottom of the screen, just behind your ground sprites. + +What your player really needs is a way to fight gravity. The problem with gravity is, you can't fight it unless you have something to push off of. So, in the next article, you'll add ground and platform collision and the ability to jump. In the meantime, try applying gravity to the enemy sprite. + +Here's all the code so far: + + +``` +#!/usr/bin/env python3 +# draw a world +# add a player and player control +# add player movement +# add enemy and basic collision +# add platform +# add gravity + +# GNU All-Permissive License +# Copying and distribution of this file, with or without modification, +# are permitted in any medium without royalty provided the copyright +# notice and this notice are preserved.  This file is offered as-is, +# without any warranty. + +import pygame +import sys +import os + +''' +Objects +''' + +class Platform(pygame.sprite.Sprite): +    # x location, y location, img width, img height, img file     +    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.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.score = 1 +        self.images = [] +        for i in range(1,9): +            img = pygame.image.load(os.path.join('images','hero' + 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): +        self.movey += 3.2 # how fast player falls +        +        if self.rect.y > worldy and self.movey >= 0: +            self.movey = 0 +            self.rect.y = worldy-ty-ty +        +    def control(self,x,y): +        ''' +        control player movement +        ''' +        self.movex += x +        self.movey += y +        +    def update(self): +        ''' +        Update sprite position +        ''' + +        self.rect.x = self.rect.x + self.movex +        self.rect.y = self.rect.y + self.movey + +        # moving left +        if self.movex < 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[self.frame//ani] + +        # moving right +        if self.movex > 0: +            self.frame += 1 +            if self.frame > ani*3: +                self.frame = 0 +            self.image = self.images[(self.frame//ani)+4] + +        # collisions +        enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) +        for enemy in enemy_hit_list: +            self.health -= 1 +            print(self.health) + +        ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) +        for g in ground_hit_list: +            self.health -= 1 +            print(self.health) + +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 + +class Level(): +    def bad(lvl,eloc): +        if lvl == 1: +            enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy +            enemy_list = pygame.sprite.Group() # create enemy group +            enemy_list.add(enemy)              # add enemy to group +            +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return enemy_list + +    def loot(lvl,lloc): +        print(lvl) + +    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,'ground.png') +                ground_list.add(ground) +                i=i+1 + +        if lvl == 2: +            print("Level " + str(lvl) ) + +        return ground_list + +    def platform(lvl,tx,ty): +        plat_list = pygame.sprite.Group() +        ploc = [] +        i=0 +        if lvl == 1: +            ploc.append((0,worldy-ty-128,3)) +            ploc.append((300,worldy-ty-256,3)) +            ploc.append((500,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,'ground.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 + +''' +Setup +''' +worldx = 960 +worldy = 720 + +fps = 40 # frame rate +ani = 4  # animation cycles +clock = pygame.time.Clock() +pygame.init() +main = True + +BLUE  = (25,25,200) +BLACK = (23,23,23 ) +WHITE = (254,254,254) +ALPHA = (0,255,0) + +world = pygame.display.set_mode([worldx,worldy]) +backdrop = pygame.image.load(os.path.join('images','stage.png')).convert() +backdropbox = world.get_rect() +player = Player() # spawn player +player.rect.x = 0 +player.rect.y = 0 +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 # how fast to move + +eloc = [] +eloc = [200,20] +gloc = [] +#gloc = [0,630,64,630,128,630,192,630,256,630,320,630,384,630] +tx = 64 #tile size +ty = 64 #tile size + +i=0 +while i <= (worldx/tx)+tx: +    gloc.append(i*tx) +    i=i+1 + +enemy_list = Level.bad( 1, eloc ) +ground_list = Level.ground( 1,gloc,tx,ty ) +plat_list = Level.platform( 1,tx,ty ) + +''' +Main loop +''' +while main == True: +    for event in pygame.event.get(): +        if event.type == pygame.QUIT: +            pygame.quit(); sys.exit() +            main = False + +        if event.type == pygame.KEYDOWN: +            if event.key == pygame.K_LEFT or event.key == ord('a'): +                print("LEFT") +                player.control(-steps,0) +            if event.key == pygame.K_RIGHT or event.key == ord('d'): +                print("RIGHT") +                player.control(steps,0) +            if event.key == pygame.K_UP or event.key == ord('w'): +                print('jump') + +        if event.type == pygame.KEYUP: +            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'): +                print('jump') + +            if event.key == ord('q'): +                pygame.quit() +                sys.exit() +                main = False + +    world.blit(backdrop, backdropbox) +    player.gravity() # check gravity +    player.update() +    player_list.draw(world) +    enemy_list.draw(world) +    ground_list.draw(world) +    plat_list.draw(world) +    for e in enemy_list: +        e.move() +    pygame.display.flip() +    clock.tick(fps) +``` + +* * * + +This is part 6 in an ongoing series about creating video games in [Python 3][3] using the [Pygame][4] module. Previous articles are: + + * [Learn how to program in Python by building a simple dice game][5] + * [Build a game framework with Python using the Pygame module][6] + * [How to add a player to your Python game][7] + * [Using Pygame to move your game character around][8] + * [What's a hero without a villain? How to add one to your Python game][2] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/simulate-gravity-python + +作者:[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/space_stars_cosmic.jpg?itok=bE94WtN- (Cosmic stars in outer space) +[2]: https://opensource.com/article/18/5/pygame-enemy +[3]: https://www.python.org/ +[4]: https://www.pygame.org +[5]: https://opensource.com/article/17/10/python-101 +[6]: https://opensource.com/article/17/12/game-framework-python +[7]: https://opensource.com/article/17/12/game-python-add-a-player +[8]: https://opensource.com/article/17/12/game-python-moving-player From 821bef40e4634efe230441c94d52acf84d833cab Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 22 Nov 2019 00:52:44 +0800 Subject: [PATCH 576/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191121=20How=20?= =?UTF-8?q?to=20document=20Python=20code=20with=20Sphinx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191121 How to document Python code with Sphinx.md --- ...How to document Python code with Sphinx.md | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 sources/tech/20191121 How to document Python code with Sphinx.md diff --git a/sources/tech/20191121 How to document Python code with Sphinx.md b/sources/tech/20191121 How to document Python code with Sphinx.md new file mode 100644 index 0000000000..dc6f2c8cbb --- /dev/null +++ b/sources/tech/20191121 How to document Python code with Sphinx.md @@ -0,0 +1,180 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to document Python code with Sphinx) +[#]: via: (https://opensource.com/article/19/11/document-python-sphinx) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +How to document Python code with Sphinx +====== +Documentation is best as part of the development process. Sphinx, along +with Tox, makes it easy to write and beautiful to look at. +![Python in a coffee cup.][1] + +Python code can include documentation right inside its source code. The default way of doing so relies on **docstrings**, which are defined in a triple quote format. While the value of documentation is well... documented, it seems all too common to not document code sufficiently. Let's walk through a scenario on the power of great documentation. + +After one too many whiteboard tech interviews that ask you to implement the Fibonacci sequence, you have had enough. You go home and write a reusable Fibonacci calculator in Python that uses floating-point tricks to get to O(1). + +The code is pretty simple: + + +``` +# fib.py +import math + +_SQRT_5 = math.sqrt(5) +_PHI = (1 + _SQRT_5) / 2 + +def approx_fib(n): +    return round(_PHI**(n+1) / _SQRT_5) +``` + +(That the Fibonacci sequence is a geometric sequence rounded to the nearest whole number is one of my favorite little-known math facts.) + +Being a decent person, you make the code open source and put it on [PyPI][2]. The **setup.py** file is simple enough: + + +``` +import setuptools + +setuptools.setup( +    name='fib', +    version='2019.1.0', +    description='Fibonacci', +    py_modules=["fib"], +) +``` + +However, code without documentation is useless. So you add a docstring to the function. One of my favorite docstring styles is the ["Google" style][3]. It is light on markup, which is nice when it is inside the source code. + + +``` +def approx_fib(n): +    """ +    Approximate Fibonacci sequence + +    Args: +        n (int): The place in Fibonacci sequence to approximate + +    Returns: +        float: The approximate value in Fibonacci sequence +    """ +    # ... +``` + +But the function's documentation is only half the battle. Prose documentation is important for contextualizing code usage. In this case, the context is annoying tech interviews.  + +There is an option to add more documentation, and the Pythonic pattern is to use an **rst** file (short for [reStructuredText][4]) commonly added under a **docs/** directory. So the **docs/index.rst** file ends up looking like this: + + +``` +Fibonacci +========= + +Are you annoyed at tech interviewers asking you to implement +the Fibonacci sequence? +Do you want to have some fun with them? +A simple +:code:`pip install fib` +is all it takes to tell them to, +um, +fib off. + +.. automodule:: fib +   :members: +``` + +And we're done, right? We have the text in a file. Someone should look at it. + +### Making Python documentation beautiful + +To make your documentation look beautiful, you can take advantage of [Sphinx][5], which is designed to make pretty Python documents. In particular, these three Sphinx extensions are helpful: + + * **sphinx.ext.autodoc**: Grabs documentation from inside modules + * **sphinx.ext.napoleon**: Supports Google-style docstrings + * **sphinx.ext.viewcode**: Packages the ReStructured Text sources with the generated docs + + + +In order to tell Sphinx what and how to generate, we configure a helper file at **docs/conf.py**: + + +``` +extensions = [ +    'sphinx.ext.autodoc', +    'sphinx.ext.napoleon', +    'sphinx.ext.viewcode', +] +# The name of the entry point, without the ".rst" extension. +# By convention this will be "index" +master_doc = "index" +# This values are all used in the generated documentation. +# Usually, the release and version are the same, +# but sometimes we want to have the release have an "rc" tag. +project = "Fib" +copyright = "2019, Moshe Zadka" +author = "Moshe Zadka" +version = release = "2019.1.0" +``` + +This file allows us to release our code with all the metadata we want and note our extensions (the comments above explain how). Finally, to document exactly how we want the documentation generated, use [Tox][6] to manage the virtual environment to make sure we generate the documentation smoothly: + + +``` +[tox] +# By default, .tox is the directory. +# Putting it in a non-dot file allows opening the generated +# documentation from file managers or browser open dialogs +# that will sometimes hide dot files. +toxworkdir = {toxinidir}/build/tox + +[testenv:docs] +# Running sphinx from inside the "docs" directory +# ensures it will not pick up any stray files that might +# get into a virtual environment under the top-level directory +# or other artifacts under build/ +changedir = docs +# The only dependency is sphinx +# If we were using extensions packaged separately, +# we would specify them here. +# A better practice is to specify a specific version of sphinx. +deps = +    sphinx +# This is the sphinx command to generate HTML. +# In other circumstances, we might want to generate a PDF or an ebook +commands = +    sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html +# We use Python 3.7. Tox sometimes tries to autodetect it based on the name of +# the testenv, but "docs" does not give useful clues so we have to be explicit. +basepython = python3.7 +``` + +Now, whenever you run Tox, it will generate beautiful documentation for your Python code. + +### Documentation in Python is excellent + +As a Python developer, the toolchain available to us is fantastic. We can start with **docstrings**, add **.rst** files, then add Sphinx and Tox to beautify the results for users.  + +What do you appreciate about good documentation? Do you have other favorite tactics? Share them in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/document-python-sphinx + +作者:[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/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) +[2]: https://pypi.org/ +[3]: http://google.github.io/styleguide/pyguide.html#381-docstrings +[4]: http://docutils.sourceforge.net/rst.html +[5]: http://www.sphinx-doc.org/en/master/ +[6]: https://tox.readthedocs.io/en/latest/ From 9073187747bce515006c901c5f79853b511322ee Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 22 Nov 2019 00:53:01 +0800 Subject: [PATCH 577/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191121=20Three-?= =?UTF-8?q?course=20professional=20specialization=20aims=20to=20close=20th?= =?UTF-8?q?e=20gap=20between=20the=20use=20and=20understanding=20of=20open?= =?UTF-8?q?=20source=20in=20business?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md --- ...nderstanding of open source in business.md | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 sources/tech/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md diff --git a/sources/tech/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md b/sources/tech/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md new file mode 100644 index 0000000000..c2f840d1b5 --- /dev/null +++ b/sources/tech/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Three-course professional specialization aims to close the gap between the use and understanding of open source in business) +[#]: via: (https://opensource.com/article/19/11/open-source-management-course) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Three-course professional specialization aims to close the gap between the use and understanding of open source in business +====== +Quickly climb the learning curve of open source with lessons distilled +from experienced practitioners. +![Coding on a computer][1] + +Even though open source software (OSS) is pervasive in IT, many people in business don't understand what open source is and how it differs from proprietary software. [According to Brandeis University][2], "open source software now accounts for between 78% and 98% of all core digital infrastructure, yet few organizational managers understand the business behind it." + +In an effort to close the gap between open source usage and understanding, Brandeis and the [Open Source Initiative][3] (OSI) have launched a three-course specialization in [Open Source Technology Management][4]. After attending an information session about the new program at [All Things Open 2019][5], I was eager to learn more about it and how it will be delivered and assessed, so I reached out to the leadership at Brandeis and the OSI over email for more information. (The interview has been slightly edited for length and clarity.) + +**Don Watkins:** **How will the course prepare students to successfully deploy open source software and effectively engage in open source production?** + +[**Patrick Masson**][6]**,** **OSI general manager and board director:** The OSI receives many questions from all sorts of organizations—companies, governments, non-profits—and individuals who are just beginning to explore open source software. Many of these inquiries share a few common themes around acquisition, implementation, support, and development, such as: How do we "buy" open source software, and where do we send the RFP? Do we need to hire a programmer if we use open source software? Will the open source project provide end-user or technical support? + +The OSI hopes the courses can prepare students by introducing the business case for open source, including business models, the value proposition, organizational practices, and operational and community processes. There are actually three courses: [The Business of Open Source][2], [Open Source Community Development][7], and [Open Source Development Fundamentals][8]. + +**DW:** **How will students be challenged to assess traditional organizational practices and measure their capacity to manage reform in light of the differences presented by open source? Can you teach open source? How do you assess community building? Can it be assessed?** + +[**James Vasile**][9]**, Open Source Technology Management faculty:** I don't want to frame these classes as presenting an approach in opposition to traditional development models. Free and open source software (FOSS) is its own way of fostering technical collaboration. To think of it as "reform" or to define it in terms of other models is to miss the point. Open source strategies are useful, and they often appear right alongside other approaches. + +Open source is a range of practices, a set of licenses, a diverse community, a strategic approach, and even an ethos. There's no one thing to teach. Rather, it's a whole field. Engaging that field can be useful if you know what you're doing. Right now, the primary way people learn the field is by spending a decade contributing to open source efforts. We are distilling the lessons learned by many experienced practitioners and trying to help people climb the learning curve quicker. + +Metrics are, of course, a huge topic in the FOSS world right now. There's no one-size-fits-all way to measure or assess community health and growth. What we do have is a set of context-specific indicators that can fit narratives. These indicators tell you where to dig. You don't know whether you've struck truth or not until you get below the surface. + +**PM:** I'll echo James' comments. From an OSI perspective, we see successful open source projects using a variety of tools and techniques for governance and decision-making, communication and collaboration, community development, project management, design and development, etc. There is no single path to open source, so rather than telling students "how" to do open source, I am hoping we can help students understand "what" makes open source. I think it's about behavior and principles vs. step-by-step processes. + +That's not to say that working with open source software and communities won't introduce change into how organizations operate. Many examples exist. If an organization has formal procurement processes, it may need to reassess how to include open source options that may not be able to participate in typical RFI/RFPs. If an organization is accustomed to driving development around their technologies, they will need to adjust their practices to work with communities. + +One of the really exciting things the courses can provide is real-world case studies that exemplify how organizations—companies, governments, etc.—are successfully engaging with, contributing to, and developing open source software. Each of these companies, I expect, will have discovered unique approaches, but I suspect there will be common themes. The students will learn to identify and understand those so they can take them back to their own organizations. + +**DW:** **What best practice models will be used?** + +**PM:** Each faculty member will employ teaching methods they are most comfortable with. Brandeis also has a fantastic instructional design group that can help faculty develop the courses, create learning resources, and design activities. + +As to the course content, the courses will introduce successful open source projects, as well as provide case studies showing companies that are successful in their adoption of open source. Students will look at what the companies are doing to create community, raise awareness and adoption, manage development, and all the other things vital to open source communities of practice. Then students are tasked to find common themes, shared practices, and even unique traits. These will inform their own work as they move into open source careers. + +[**Carol Damm**][10]**,** **director of programs and assessment for graduate professional studies at Brandeis:** As Patrick explained, students will review examples or case studies of OSS adoption. This is an established teaching approach that enables students to apply the concepts that they are learning to real-world situations. + +**DW:** **How will students learn about the community? Will there be opportunities for them to join open source communities as members? How?** + +**PM:** We have a dedicated course, "[Open Source Community Development][7]," that is designed to help students understand the various roles in communities of practice supporting open source software development, adoption, and maintenance. + +This course presents a great opportunity to have students involved in open source communities as part of the course. The students may not be contributing directly to the projects, but they can do field observations. Getting students to engage with projects to discover how they share information, foster communication, manage financials, make decisions, and all the other critical practices that open source communities need to be successful. + +I'll also offer that the courses can incorporate any open source projects students' companies may be working with—especially if internal contributions are being made upstream. This would provide a powerful opportunity to assess the issues the students' companies are going through, how they resolved them, and what remains. + +**DW: The production of open, distributed, and community-driven software requires design and development methodologies and workflows that support the advantages of peer-to-peer, highly collaborative, iterative production. How will that be facilitated?** + +**CD**: The intent is to create activities and assignments around the workflow and processes that are part of the OSS organizational practices. These activities and assignments will require students to collaborate, creating a relational experience, common to the OSS community. + +**[Ken Udas][11], Open Source Initiative program chair at Brandeis**: Learning is an iterative process and will be facilitated in these courses through exposure to the practice of experienced faculty members and guest lecturers to guide hands-on practice. Although the activities will be determined and developed by the teaching staff, we all want the students to leave with the benefit of practicing under the guidance of knowledgeable practitioners and teachers. + +So, in a particular class, the production process might be introduced through a semester-long case study, perhaps based on an active OSS community or a situation in which there is an internal development or perhaps an effort within an organization to adopt an open source technology and contribute to a community. We are committed to having the teacher and course designer build learning experiences that expose students to practice such that learning can be meaningfully facilitated and iteratively applied. This process will be unique for each teacher. In short, the learner will participate in learning experiences that are facilitated by the instructor with OSS experience, based on practice. + +Iterative and peer-based production in the courses is promoted through exposure through faculty modeling and observation of active OSS communities in practice. Iterative methodologies will be embedded in weekly forum activities and assignments in each course. In addition, it is important to remember that the course itself is subject to interactive development and improvement. Students will also be expected to contribute, using iterative design principles, to the ongoing development of the course along with the teacher and staff. + +**DW:** **What metrics will be used to assess the effectiveness of instruction? How will credit be assigned? What will assessments look like?** + +**CD:** The students will work collaboratively on assignments that present cases either that are given to them or of their choosing, depending on the course, in which they apply the practice that they are learning about. Problem-based learning is a student-centered approach that creates a space for critical thinking and collaborative work. These assignments are graded and aligned to the course outcomes to evaluate students' achievement. + +**KU:** Instructional effectiveness is a matter of student assessment and self-assessment, which is also reflected in the success of learners, as illustrated through the products created during the class. Although the assessments will vary from class-to-class and teacher-to-teacher, they will take the form of artifacts and evidence of methodology in practice. Credit within the class will be in large part determined by the course developer and learning designer but will generally be a balance between group and individual assignment. + +**DW:** **What** **are** **the** **outcomes for students? An MBA focus? Digital badges?** + +**CD: **With the completion of the three courses, students will receive a digital credential in the form of a badge that will carry the details of the credential in its metadata. + +**DW:** **What's in it for the Open Source Initiative? What are the takeaways for the OSI?** + +**PM:** These courses fit squarely into the OSI's mission to "educate about and advocate for the benefits of open source and to build bridges among different constituencies in the open source community." We currently have several other educational initiatives, for example, in K-12 ([FLOSS Desktops for Kids][12]) and for government ([Open Source and Standards Working Group][13]). + +While the OSI has always been active in education and advocacy, our interest in formal educational opportunities was sparked after reading the [Open Source Program Management 2018 Survey][14]. Its key findings highlighted a growing demand for professionals, not necessarily from technical backgrounds, who may be supporting open source within a company: HR staff hiring for roles that support external projects, procurement officers and contract managers who need to engage open source communities, project and product managers who need to work with external organizations, budgeting staff who need to assess ROI on open source implementations. Where are students from MBA or marketing and communications programs, who are interested in working with technology, learning about open source software? + +There are a small but growing number of individual faculty and departments within colleges and universities that include open source software development in their curriculum—usually for technical programs (e.g., CompSci, EE)—however, open source specializations for non-technical disciplines are rare. I only know of [one][15]. The Brandeis specialization allows us to introduce open source into traditional academic programs. + +The Brandeis specialization also allows us to introduce open source to non-traditional learners. The OSI also needs to help the self-directed, self-motivated learners who may have discovered open source software and development through their own personal educational experiences. One of the great opportunities, rightly, touted by open source advocates is access to "learning by doing" made possible through open source communities. Open source projects can reduce barriers to access, allowing non-traditional students to learn to program, discover the latest technologies, gain new skills, even network to build professional relationships. Again, these opportunities are not limited to those seeking technical skills. Open source projects rely on those with business, finance, marketing, communications, and many other skills. Brandeis will also be offering the three courses as a digital badge for individuals who may not be interested in a degree program. + +The OSI recognizes that open source now spans all industries and impacts every department within the organization, from simple end users to maintainers of internally developed projects. The OSI wants to help both those seeking careers in open source and the industries that need those professionals. As a trusted source and recognized authority within the open source community, we feel we can provide guidance on the design and development of courses and content and lend credibility to assure both students and employers that the program will provide a quality, relevant, educational experience. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/open-source-management-course + +作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://www.brandeis.edu/gps/future-students/learn-about-our-programs/open-source-technology-management.html#business +[3]: https://opensource.org/ +[4]: https://www.brandeis.edu/gps/future-students/learn-about-our-programs/open-source-technology-management.html# +[5]: https://allthingsopen.org/ +[6]: https://www.linkedin.com/in/patrick-masson-4a09b53/ +[7]: https://www.brandeis.edu/gps/future-students/learn-about-our-programs/open-source-technology-management.html#community +[8]: https://www.brandeis.edu/gps/future-students/learn-about-our-programs/open-source-technology-management.html#development +[9]: https://www.linkedin.com/in/jamesvasile/ +[10]: https://www.linkedin.com/in/carol-damm-id/ +[11]: https://www.brandeis.edu/facultyguide/person.html?emplid=9ea81c0b94ebc262f10d2065827733c2e903cafd +[12]: https://opensource.com/article/17/9/floss-desktops-kids +[13]: https://wiki.opensource.org/bin/Working+Groups+%26+Incubator+Projects/OSandStandardsWG/ +[14]: https://todogroup.org/blog/survey-2018/ +[15]: https://www.rit.edu/study/free-and-open-source-software-and-free-culture-minor From 815078ebfbb4ef6118dd38270cff1bc594873d43 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 22 Nov 2019 00:53:46 +0800 Subject: [PATCH 578/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191120=20What?= =?UTF-8?q?=20makes=20a=20programming=20exercise=20good=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191120 What makes a programming exercise good.md --- ... What makes a programming exercise good.md | 158 ++++++++++++++++++ 1 file changed, 158 insertions(+) create mode 100644 sources/tech/20191120 What makes a programming exercise good.md diff --git a/sources/tech/20191120 What makes a programming exercise good.md b/sources/tech/20191120 What makes a programming exercise good.md new file mode 100644 index 0000000000..e924ffc090 --- /dev/null +++ b/sources/tech/20191120 What makes a programming exercise good.md @@ -0,0 +1,158 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What makes a programming exercise good?) +[#]: via: (https://jvns.ca/blog/2019/11/20/what-makes-a-programming-exercise-good/) +[#]: author: (Julia Evans https://jvns.ca/) + +What makes a programming exercise good? +====== + +I’ve been thinking about programming exercises lately, because I want to move into teaching people skills. But what makes a good programming exercise? I [asked about this on Twitter today][1] and got some useful responses so here are some criteria: + +### it’s fun + +This one is sort of self-explanatory and I think it’s really important. Programming is fun and learning is fun so I can’t see why programming exercises would need to be boring. + +### it teaches you something you care about + +I don’t think this has to strictly mean “relevant to your job right this second” – people don’t just have jobs, we also want to make art and games and fun personal projects and sometimes just understand the world around us. But it’s important to know what goals the exercise can help you with and what it’s related to! + +Some arbitrary examples: + + * take an image of something from a website and reproduce it from scratch with CSS (towards using CSS to make your own websites that look awesome) + * write a webserver from scratch without any frameworks (to learn the HTTP protocol, so that you can debug issues with a real webserver more easily) + * write a small raytracer (so you can make cool art with raytracing techniques on shaderhub!) + * write a tiny bit of assembly (as a very initial step towards understanding of what Spectre and Meltdown are even about and why we need to make all our computers run slower to prevent them) + + + +### it’s a challenge + +I don’t know if this is everyone’s experience but I often start programming exercises and get bored quickly (“oh, I know how to do this, this is boring”). For me it’s really important for the exercise to teach me something I really don’t know how to do and that’s a little bit hard for me. + +My favourite set of programming exercises is the [cryptopals crypto challenges][2] because they get harder pretty fast – by exercise #6, you’re already breaking toy encryption protocols, and by #12 you’re breaking an Actual Encryption Protocol (AES in ECB mode)! + +### you can tell if you succeeded + +It’s easy to write exercises that are too vaguely specified (“write a toy tcp stack!“). But what does that mean? How much of a TCP stack am I supposed to write? Having test cases and clear criteria for “yay! you did it! congratulations!” is really important. + +### you can do it quickly + +In less than 2-3 hours (an evening after work), say. It’s hard to find time to spend like 8 hours on an exercise unless it’s REALLY exciting. + +I also think that giving some specific real-world benchmark data seems nice (“I did this from scratch in 97 minutes”). + +### the author believes in you + +This is a bit fuzzier but very lovely – [this person on Twitter wrote][3]: + +> Similar to that, the writing is patient and gives me the impression that it believes in my ability to accomplish the task. … I learned a ton in the early days from Linux HOWTOs. Some gave me the sense that it was impossible to fail. Just follow the steps. It’s all there. + +Especially if you’re doing a somewhat challenging exercise like we talked about above, I think it’s nice for the author to believe in your! (and of course it’s crucial that they’ve actually written the exercises so that they’re _right_ and you can likely do the thing!) + +### it’s been tested + +I read the (great) biography [Dearie: The Remarkable Life of Julia Child][4] recently and one thing that stood out to me is that she _tested_ all of the recipes in Mastering the Art Of French Cooking. It took her _years_ to write the book and test the recipes and make sure that American home cooks actually had access to all the ingredients and had the. + +I don’t think all cookbook authors test their recipes, but I think testing really improves cookbooks. + +I started writing some SQL exercises (like [this prototype of one on GROUP BY][5]) a while back, and at some point I realized the big thing holding me back was that I didn’t have testers! I couldn’t find out if people were actually learning from them or not! + +This is a new thing for me because when I write blog posts I don’t test them (I barely even proofread them!). I just write them and publish and people often like them and that’s it! I said to [Amy Hoy][6] (who is amazing) on Twitter that I didn’t understand why you have to test exercises if you don’t have to test blog posts and she [pointed out][7] that people have much higher expectations for exercises than for blog posts – with the blog posts you maybe expect to learn 1-2 new facts, but with exercises you expect to actually develop a new skill! + +Also, people are often investing a lot more time in exercises (especially if they have to set up a dev environment or something!), so it’s extra important to make sure that they actually work. + +### you won’t get stuck + +It’s SO EASY to get stuck on some random irrelevant point in a programming exercise that’s totally unrelated to the skill you’re trying to learn. For example there might be an easily-avoidable mistake that you can make with the exercise and spend a lot of time debugging but it doesn’t actually teach you a lot. + +### it’s easy to get help + +If you’re doing a challenging exercise, you might want to get help from your friends / colleagues / the internet! + +Some things that can go wrong: + + * None of your friends have ever heard of the thing the exercise is teaching so you can’t talk about it with them + * The exercise expects you to be using the newest version of some software, but actually all the examples on the internet are for some older version so it’s difficult to search for help even though the exercise is technically correct + * The community around the tech used in the exercise is hostile/unhelpful + + + +One obvious way to accomplish this is by letting people use the programming language they’re most comfortable in, because they probably already know how to Google for help in that environment. + +### no time-consuming setup required + +Installing software is boring, and a lot of programming projects require installing software! A few things that can go wrong with this (though there are a lot more than this!) + + * I get a compiler error when I try to install this package on my computer + * The example actually requires some very specific package versions to work properly and if you don’t have those exact versions installed you get a bunch of cryptic errors and need to google for 3 hours to fix them + + + +This kind of thing is a huge waste of time and super demoralizing. And it’s not trivial to avoid! If you’re trying to teach someone a specific piece of software, often that software + +A few options I’ve seen or used to manage this: + + * tell people what you know works (“I’ve tested this in Mac/Linux but not Windows”) + * avoid requiring any software to be installed (“just use python”) + * use Docker to run everything + * run all the code in the person’s browser (because browsers usually do about the same thing) + * use a cloud system (so everything runs on someone else’s computer). This is what I do for my [pandas cookbook][8], which lets you run it in Binder, this really great free service for hosting Jupyter notebooks. + + + +### it’s easy to extend + +@tef has this great talk on Scratch [A million things to do with a computer!][9] which explains the 3 ideas of Scratch: + + * low floors + * wide walls + * high ceilings + + + +It sucks when you start learning something and then learn that what you can do with the Thing is very limited! It’s exciting when you learn something and see “oh, wow, there are SO MANY POSSIBILITIES, what if I did X instead?” + +### that’s a lot of things! + +The criteria we arrived at: + + * fun exercises + * that teach you something you care about + * that are challenging + * with clear success criteria + * that can be done quickly + * with no complicated setup + * and few hidden gotchas + * using a tech stack that’s easy for you to get help with + * where there’s a lot of room to grow + + + +That seems pretty hard, but it seems like a good goal to aspire to! I’m going to keep very slowly working on exercises! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/11/20/what-makes-a-programming-exercise-good/ + +作者:[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://twitter.com/b0rk/status/1197282185230860288 +[2]: https://cryptopals.com/ +[3]: https://twitter.com/mojavelinux/status/1197323090427953152 +[4]: https://www.amazon.com/exec/obidos/ASIN/0307473414/metafilter-20/ref=nosim/ +[5]: https://joins-238123.netlify.com/aggregations/ +[6]: https://stackingthebricks.com/ +[7]: https://twitter.com/amyhoy/status/1197291805449940993 +[8]: https://github.com/jvns/pandas-cookbook +[9]: https://www.youtube.com/watch?v=vU9myNJI9l4 From 9396bb2d118f3f3cea7610252d4c027c7f1727a3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 22 Nov 2019 00:56:25 +0800 Subject: [PATCH 579/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191121=20IoT=20?= =?UTF-8?q?sensors=20must=20have=20two=20radios=20for=20efficiency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191121 IoT sensors must have two radios for efficiency.md --- ...ors must have two radios for efficiency.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 sources/talk/20191121 IoT sensors must have two radios for efficiency.md diff --git a/sources/talk/20191121 IoT sensors must have two radios for efficiency.md b/sources/talk/20191121 IoT sensors must have two radios for efficiency.md new file mode 100644 index 0000000000..174b47e53f --- /dev/null +++ b/sources/talk/20191121 IoT sensors must have two radios for efficiency.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IoT sensors must have two radios for efficiency) +[#]: via: (https://www.networkworld.com/article/3454404/iot-sensors-must-have-two-radios-for-efficiency.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +IoT sensors must have two radios for efficiency +====== +To extend battery life, IoT radios that send data should be powered only when there's data to send, and a second, power-sipper radio should just listen for a wake-up signal for the principal radio. Academics say they’re making progress getting that all to work. +Jorgen Norgaard / WhatAWin / Getty Images + +For the [Internet of Things][1] to become ubiquitous, many believe that inefficiencies in the powering of sensors and radios has got to be eliminated. Battery chemistry just isn’t good enough, and it’s simply too expensive to continually perform truck-rolls, for example, whenever batteries need changing out. In many cases, solar battery-top-ups aren’t the solution because that, usually-fixed, technology isn’t particularly suited to mobile, or impromptu, ad hoc networks. + +Consequently, there’s a dash going on to try to find either better chemistries that allow longer battery life or more efficient chips and electronics that just sip electricity. An angle of thought being followed is to wake-up network radios only when they need to transmit a burst of data. Universities say they are making significant progress in this area. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“The problem now is that these [existing] devices do not know exactly when to synchronize with the network, so they periodically wake up to do this even when there’s nothing to communicate,” explains Patrick Mercier, a professor of electrical and computer engineering at the University of California, San Diego, in a [media release][3]. “By adding a wake-up receiver, we could improve the battery life of small IoT devices from months to years,” he says. + +[][4] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][4] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +### Wake-up + +The school says that the key to getting the wake-up receivers to be useful is to implement them at very high frequencies. The reason: everything gets smaller, including antennas the higher in spectrum one goes. It “allowed researchers to shrink everything, including the antenna, transformer and other off-chip components down into a much smaller package,” the school explains. The school’s solution is at 9 GHz, in X Band. + +The device functions using specific radio signals, called a wake-up signature, being directed at an IoT sensor’s dedicated wake-up receiver chip. That radio can operate with less energy consumption than the data radio chip because its only purpose is to listen for the wake-up signature. UC San Diego’s device uses only 22.3 nanowatts. That’s around half-a-millionth of the power that an LED night light uses, the school claims. Another, more energy-consuming radio, then, which is switched on as necessary by the wake-up radio, performs the more heavy-duty tasks – like actually sending the data. + +Stanford University has also been working on IoT wake-up solutions. [I wrote about its one nanowatt, ultrasound device in 2018][5]. That’s dog-whistle-like frequency. That school, too, is working on the premise that using higher frequencies means one can design smaller electronics packages. The university claimed then on its website that its chip used “about a billionth the power it takes to light a single old-fashioned Christmas bulb.” + +Importantly, both universities’ solutions allow the actual power-hog data radio to be off while not in use, not just dormant or sleeping as is common now. + +### High sensitivity + +UC San Diego believes its X Band device has advantages over anything that has come before on two additional counts. It explains that its design performs well in varied ambient temperatures: It claims usability from 14 F to 104 F. That temperature range means wake-up could be used in implementations outside, such as in the maritime vertical, for example. + +The university also says its sensitivity numbers are the best that have ever been [published in a study][6] at -69.5 dBm. Latency is a trade-off, though, as there’s a 540ms delay. But that’s likely not a problem for much IoT use, like short burst, periodic data sends, such as are used for environmental sensing, for example. + +“These numbers are pretty impressive in the field of wireless communications. Power consumption that low, while still retaining temperature robustness, all in a small, highly sensitive system,” Mercier says. "This will enable all sorts of new IoT applications.” + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3454404/iot-sensors-must-have-two-radios-for-efficiency.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://www.networkworld.com/article/3207535/what-is-iot-how-the-internet-of-things-works.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://ucsdnews.ucsd.edu/pressrelease/new-chip-for-waking-up-small-wireless-devices-could-extend-battery-life +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.networkworld.com/article/3254200/small-wake-up-receivers-could-extend-iot-sensor-life.html +[6]: https://ieeexplore.ieee.org/document/8890666 +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world From 591fec145c8b4bee2b7d3bd95147ca57fa76d6ff Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 22 Nov 2019 00:56:49 +0800 Subject: [PATCH 580/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191121=20Cumulu?= =?UTF-8?q?s=20Networks=20updates=20its=20network-centric=20Linux=20distri?= =?UTF-8?q?bution?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191121 Cumulus Networks updates its network-centric Linux distribution.md --- ... its network-centric Linux distribution.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/talk/20191121 Cumulus Networks updates its network-centric Linux distribution.md diff --git a/sources/talk/20191121 Cumulus Networks updates its network-centric Linux distribution.md b/sources/talk/20191121 Cumulus Networks updates its network-centric Linux distribution.md new file mode 100644 index 0000000000..77c718bde7 --- /dev/null +++ b/sources/talk/20191121 Cumulus Networks updates its network-centric Linux distribution.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cumulus Networks updates its network-centric Linux distribution) +[#]: via: (https://www.networkworld.com/article/3454338/cumulus-networks-updates-its-network-centric-linux-distribution.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Cumulus Networks updates its network-centric Linux distribution +====== +Company says its Linux is to networking what Red Hat is to servers. +Thinkstock + +The [Linux][1] distribution ecosystem is pretty set, with Red Hat and Canonical in the leadership positions, followed closely by SuSe and home brews from the likes of IBM and other major vendors. Even Microsoft has its own distro for Azure users. + +And then there is Cumulus Networks, which specializes in networking software. It just released Cumulus Linux 4.0 and NetQ 2.4, its cloud network deployment and management console. With this release, Cumulus is claiming its Linux is its most stable and reliable software stack yet and NetQ is the most comprehensive end-to-end network automation product. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Roopa Prabhu, chief Linux architect at Cumulus, said that just as Red Hat Enterprise Linux is designed for servers, Cumulus Linux is specifically designed for networking. + +**[ [Become a Microsoft Office 365 administrator in record time with this quick start course from PluralSight.][3] ]** + +"Unlike RHEL, Ubuntu or Suse, Cumulus Linux is specially designed for the unique needs of a network device, like a [data-center][4] switch," he said in an email to me. "Cumulus Linux comes packaged with drivers for data-center switch hardware, the latest and greatest in Linux-kernel networking, a rich networking protocol stack with Free Range Routing (FRR), multi-homing protocol software, networking tools and Linux defaults optimized for networking.” + +“RHEL for example, complements Cumulus Linux in the data center, rather than compete with it, allowing similar management and orchestration tools across compute and network devices," he added. + +By being native Linux, Cumulus says it provides support for all the tooling and applications of the Linux ecosystem while providing advanced networking features and support, including kernel additions for VRF, VxLAN or the upstreamed ifupdown2 network-interface manager.  + +Cumulus Linux 4.0 includes: + + * Support for 134 hardware platforms across 14 ASICs. + * Support for Mellanox’s Spectrum-2 chipset for faster performance, Broadcom’s Qumran chipset for deep buffering at the top of rack, Facebook’s Minipack – an open, modular chassis with a single 12.8TB chip, and additional campus networking platforms with Dell. + * Migration to the latest and most advanced Linux kernel for greater route scale, the latest security updates, and thousands of contributions from the broader Linux community. + * Support for SwitchDev, an open source in-kernel abstraction model, providing a standardized way to program switch ASICs and speed development time. + * Enhancements to its EVPN implementation (EVPN-PIM and EVPN multi-homing) for Layer 2/Layer3 connectivity. + * Comprehensive end-to-end automation for CI/CD workflows including simulation, validation, troubleshooting and NetDevOps practices such as Infrastructure-as-Code (IaC). + * The ability to build a single fabric across data center and campus environments enabling a common operational model. + *   + + + +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/3454338/cumulus-networks-updates-its-network-centric-linux-distribution.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/3215226/what-is-linux-uses-featres-products-operating-systems.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fadministering-office-365-quick-start +[4]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 1e6d8e77cd67a0cce979d5ae0cf23a856cc694a0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 Nov 2019 07:58:17 +0800 Subject: [PATCH 581/800] PRF --- ...ow to use Protobuf for data interchange.md | 90 +++++++++---------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/translated/tech/20191018 How to use Protobuf for data interchange.md b/translated/tech/20191018 How to use Protobuf for data interchange.md index 959b9ec6b6..0ad4896ec2 100644 --- a/translated/tech/20191018 How to use Protobuf for data interchange.md +++ b/translated/tech/20191018 How to use Protobuf for data interchange.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to use Protobuf for data interchange) @@ -12,18 +12,15 @@ > 在以不同语言编写并在不同平台上运行的应用程序之间交换数据时,Protobuf 编码可提高效率。 -![metrics and data shown on a computer screen][1] +![](https://img.linux.net.cn/data/attachment/album/201911/22/075757pn2fxfth30ntwefg.jpg) -协议缓冲区Protocol Buffers -([Protobufs][2])像 XML 和 JSON 一样,可以让用不同语言编写并在不同平台上运行的应用程序交换数据。例如,用 Go 编写的发送应用程序可以在 Protobuf 中对 Go 特定的销售订单进行编码,然后用 Java 编写的接收方可以对它进行解码,以获取所接收订单的 Java 特定表示方式。这是在网络连接上的体系结构示意图: +协议缓冲区Protocol Buffers([Protobufs][2])像 XML 和 JSON 一样,可以让用不同语言编写并在不同平台上运行的应用程序交换数据。例如,用 Go 编写的发送程序可以在 Protobuf 中对以 Go 表示的销售订单数据进行编码,然后用 Java 编写的接收方可以对它进行解码,以获取所接收订单数据的 Java 表示方式。这是在网络连接上的结构示意图: -``` -Go sales order--->Pbuf-encode--->network--->Pbuf-decode--->Java sales order -``` +> Go 销售订单 ---> Pbuf 编码 ---> 网络 ---> Pbuf 界面 ---> Java 销售订单 与 XML 和 JSON 相比,Protobuf 编码是二进制而不是文本,这会使调试复杂化。但是,正如本文中的代码示例所确认的那样,Protobuf 编码在大小上比 XML 或 JSON 编码要有效得多。 -Protobuf 以另一种方式提供了这种有效性。在实现级别,Protobuf 和其他编码系统对结构化数据进行序列化和反序列化。序列化将特定语言的数据结构转换为字节流,反序列化是将字节流转换回特定语言的数据结构的逆运算。序列化和反序列化可能成为数据交换的瓶颈,因为这些操作会占用大量 CPU。高效的序列化和反序列化是 Protobuf 的另一个设计目标。 +Protobuf 以另一种方式提供了这种有效性。在实现级别,Protobuf 和其他编码系统对结构化数据进行序列化serialize反序列化deserialize。序列化将特定语言的数据结构转换为字节流,反序列化是将字节流转换回特定语言的数据结构的逆运算。序列化和反序列化可能成为数据交换的瓶颈,因为这些操作会占用大量 CPU。高效的序列化和反序列化是 Protobuf 的另一个设计目标。 最近的编码技术,例如 Protobuf 和 FlatBuffers,源自 1990 年代初期的 [DCE/RPC][3](分布式计算环境/远程过程调用Distributed Computing Environment/Remote Procedure Call)计划。与 DCE/RPC 一样,Protobuf 在数据交换中为 [IDL][4](接口定义语言)和编码层做出了贡献。 @@ -47,29 +44,27 @@ interface echo { } ``` -该 IDL 文档声明了一个名为 `echo` 的过程,该过程带有三个参数:类型为 `handle_t`(实现指针)和 `idl_char`(ASCII 字符数组)的 `[in]` 参数被传递给远程过程,而 `[out]` 参数(也是一个字符串)从该过程中传回。在此示例中,`echo` 过程不会显式返回值(`echo` 左侧的 `void`),但也可以返回。返回值,以及一个或多个 `[out]` 参数,允许远程过程任意返回许多值。下一节将介绍 Protobuf IDL,它的语法不同,但同样用作数据交换中的协定。 +该 IDL 文档声明了一个名为 `echo` 的过程,该过程带有三个参数:类型为 `handle_t`(实现指针)和 `idl_char`(ASCII 字符数组)的 `[in]` 参数被传递给远程过程,而 `[out]` 参数(也是一个字符串)从该过程中传回。在此示例中,`echo` 过程不会显式返回值(`echo` 左侧的 `void`),但也可以返回值。返回值,以及一个或多个 `[out]` 参数,允许远程过程任意返回许多值。下一节将介绍 Protobuf IDL,它的语法不同,但同样用作数据交换中的协定。 DCE/RPC 和 Protobuf 中的 IDL 文档是创建用于交换数据的基础结构代码的实用程序的输入: -``` -IDL document--->DCE/PRC or Protobuf utilities--->support code for data interchange -``` +> IDL 文档 ---> DCE/PRC 或 Protobuf 实用程序 ---> 数据交换的支持代码 -作为相对简单的文本,IDL 同样是关于数据交换的细节的便于人类阅读的文档(特别是交换的数据项的数量和每个项的数据类型)。 +作为相对简单的文本,IDL 是同样便于人类阅读的关于数据交换细节的文档(特别是交换的数据项的数量和每个项的数据类型)。 -Protobuf 可用于现代 RPC 系统,例如 [gRPC][5];但是 Protobuf 本身仅提供 IDL 层和编码层,用于从发送者传递到接收者的消息。与原始的 DCE/RPC 一样,Protobuf 编码是二进制的,但效率更高。 +Protobuf 可用于现代 RPC 系统,例如 [gRPC][5];但是 Protobuf 本身仅提供 IDL 层和编码层,用于从发送者传递到接收者的消息。与原本的 DCE/RPC 一样,Protobuf 编码是二进制的,但效率更高。 -目前,XML 和 JSON 编码仍在通过 Web 服务等技术进行的数据交换中占主导地位,这些技术利用 Web 服务器、传输协议(例如 TCP、HTTP)以及标准库和实用程序等原有的基础设施来处理 XML 和 JSON 文档。 此外,各种类型的数据库系统可以存储 XML 和 JSON 文档,甚至旧式关系型系统也可以轻松生成查询结果的 XML 编码。现在,每种通用编程语言都具有支持 XML 和 JSON 的库。那么,是什么建议我们回到 Protobuf 之类的**二进制**编码系统呢? +目前,XML 和 JSON 编码仍在通过 Web 服务等技术进行的数据交换中占主导地位,这些技术利用 Web 服务器、传输协议(例如 TCP、HTTP)以及标准库和实用程序等原有的基础设施来处理 XML 和 JSON 文档。 此外,各种类型的数据库系统可以存储 XML 和 JSON 文档,甚至旧式关系型系统也可以轻松生成查询结果的 XML 编码。现在,每种通用编程语言都具有支持 XML 和 JSON 的库。那么,是什么让我们回到 Protobuf 之类的**二进制**编码系统呢? -让我们看一下负十进制值 `-128`。在 2 的补码二进制表示形式(在系统和语言中占主导地位)中,此值可以存储在单个 8 位字节中:`10000000`。此整数值在 XML 或 JSON 中的文本编码需要多个字节。例如,UTF-8 编码需要四个字节的字符串,即 `-128`,即每个字符一个字节(十六进制,值为 `0x2d`、`0x31`、`0x32` 和 `0x38`)。XML 和 JSON 还添加了标记字符,例如尖括号和大括号。有关 Protobuf 编码的详细信息下面就会介绍,但现在的关注点是一个通用点:文本编码的压缩性明显低于二进制编码。 +让我们看一下负十进制值 `-128`。以 2 的补码二进制表示形式(在系统和语言中占主导地位)中,此值可以存储在单个 8 位字节中:`10000000`。此整数值在 XML 或 JSON 中的文本编码需要多个字节。例如,UTF-8 编码需要四个字节的字符串,即 `-128`,即每个字符一个字节(十六进制,值为 `0x2d`、`0x31`、`0x32` 和 `0x38`)。XML 和 JSON 还添加了标记字符,例如尖括号和大括号。有关 Protobuf 编码的详细信息下面就会介绍,但现在的关注点是一个通用点:文本编码的压缩性明显低于二进制编码。 ### 在 Go 中使用 Protobuf 的示例 -我的代码示例着重于 Protobuf 而不是RPC。以下是第一个示例的概述: +我的代码示例着重于 Protobuf 而不是 RPC。以下是第一个示例的概述: * 名为 `dataitem.proto` 的 IDL 文件定义了一个 Protobuf 消息,它具有六个不同类型的字段:具有不同范围的整数值、固定大小的浮点值以及两个不同长度的字符串。 -* Protobuf 编译器使用 IDL 文件生成 Protobuf 消息及支持函数的 Go 特定版本(以及后来的 Java 特定版本)。 -* Go 应用程序使用随机生成的值填充原生 Go 数据结构,然后将结果序列化为本地文件。为了进行比较, XML 和 JSON 编码也被序列化为本地文件。 +* Protobuf 编译器使用 IDL 文件生成 Go 版本(以及后面的 Java 版本)的 Protobuf 消息及支持函数。 +* Go 应用程序使用随机生成的值填充原生的 Go 数据结构,然后将结果序列化为本地文件。为了进行比较, XML 和 JSON 编码也被序列化为本地文件。 * 作为测试,Go 应用程序通过反序列化 Protobuf 文件的内容来重建其原生数据结构的实例。 * 作为语言中立性测试,Java 应用程序还会对 Protobuf 文件的内容进行反序列化以获取原生数据结构的实例。 @@ -96,7 +91,7 @@ message DataItem { } ``` -该 IDL 使用当前的 proto3 而不是较早的 proto2 语法。软件包名称(在本例中为 `main`)是可选的,但是惯用的;它用于避免名称冲突。这个结构化的消息包含八个字段,每个字段都有一个 Protobuf 数据类型(例如,`int64`、`string`)、名称(例如,`oddA`、`short`)和一个等号 `=` 之后的数字标签(即键)。标签(在此示例中为 1 到 8)是唯一的整数标识符,用于确定字段序列化的顺序。 +该 IDL 使用当前的 proto3 而不是较早的 proto2 语法。软件包名称(在本例中为 `main`)是可选的,但是惯例使用它以避免名称冲突。这个结构化的消息包含八个字段,每个字段都有一个 Protobuf 数据类型(例如,`int64`、`string`)、名称(例如,`oddA`、`short`)和一个等号 `=` 之后的数字标签(即键)。标签(在此示例中为 1 到 8)是唯一的整数标识符,用于确定字段序列化的顺序。 Protobuf 消息可以嵌套到任意级别,而一个消息可以是另外一个消息的字段类型。这是一个使用 `DataItem` 消息作为字段类型的示例: @@ -118,7 +113,7 @@ enum PartnershipStatus { `reserved` 限定符确保用于实现这三个符号名的数值不能重复使用。 -为了生成一个或多个声明的 Protobuf 消息结构的特定于语言的版本,包含这些结构的 IDL 文件被传递到`protoc` 编译器(可在 [Protobuf GitHub 存储库][7]中找到)。对于 Go 代码,可以以通常的方式安装支持的 Protobuf 库(这里以 `%` 作为命令行提示符): +为了生成一个或多个声明 Protobuf 消息结构的特定于语言的版本,包含这些结构的 IDL 文件被传递到`protoc` 编译器(可在 [Protobuf GitHub 存储库][7]中找到)。对于 Go 代码,可以以通常的方式安装支持的 Protobuf 库(这里以 `%` 作为命令行提示符): ``` % go get github.com/golang/protobuf/proto @@ -130,7 +125,7 @@ enum PartnershipStatus { % protoc --go_out=. dataitem.proto ``` -标志 `--go_out` 指示编译器生成 Go 源代码。其他语言也有类似的标志。在这种情况下,结果是一个名为 `dataitem.pb.go` 的文件,该文件足够小,可以将基本内容复制到 Go 应用程序中。以下是生成的代码的主要部分: +标志 `--go_out` 指示编译器生成 Go 源代码。其他语言也有类似的标志。在这种情况下,结果是一个名为 `dataitem.pb.go` 的文件,该文件足够小,可以将其基本内容复制到 Go 应用程序中。以下是生成的代码的主要部分: ``` var _ = proto.Marshal @@ -152,9 +147,9 @@ func (*DataItem) ProtoMessage() {} func init() {} ``` -编译器生成的代码具有 Go 结构 `DataItem`,该结构导出 Go 字段(名称现已大写开头),该字段与 Protobuf IDL 中声明的名称匹配。该结构字段具有标准的 Go 数据类型:`int32`、`int64`、`float32` 和 `string`。在每个字段行的末尾,是描述 Protobuf 类型的字符串,提供 Protobuf IDL 文档中的数字标签并提供有关 JSON 信息的元数据,这将在后面讨论。 +编译器生成的代码具有 Go 结构 `DataItem`,该结构导出 Go 字段(名称现已大写开头),该字段与 Protobuf IDL 中声明的名称匹配。该结构字段具有标准的 Go 数据类型:`int32`、`int64`、`float32` 和 `string`。在每个字段行的末尾,是描述 Protobuf 类型的字符串,提供 Protobuf IDL 文档中的数字标签及有关 JSON 信息的元数据,这将在后面讨论。 -此外也有函数;最重要的是 `Proto.Marshal`,用于将 `DataItem` 结构的实例序列化为 Protobuf格式。辅助函数包括:清除 `DataItem` 结构的 `Reset`,生成 `DataItem` 的单行字符串表示的 `String`。 +此外也有函数;最重要的是 `Proto.Marshal`,用于将 `DataItem` 结构的实例序列化为 Protobuf 格式。辅助函数包括:清除 `DataItem` 结构的 `Reset`,生成 `DataItem` 的单行字符串表示的 `String`。 描述 Protobuf 编码的元数据应在更详细地分析 Go 程序之前进行仔细研究。 @@ -162,7 +157,7 @@ func init() {} Protobuf 消息的结构为键/值对的集合,其中数字标签为键,相应的字段为值。字段名称(例如,`oddA` 和 `small`)是供人类阅读的,但是 `protoc` 编译器的确使用了字段名称来生成特定于语言的对应名称。例如,Protobuf IDL 中的 `oddA` 和 `small` 名称在 Go 结构中分别成为字段 `OddA` 和 `Small`。 -键和它们的值都被编码,但是有一个重要的区别:一些数字值具有固定大小的 32 或 64 位的编码,而其他数字(包括消息标签)则是 `varint` 编码的,位数取决于整数的绝对值。例如,整数值 1 到 15 需要 8 位 `varint` 编码,而值 16 到 2047 需要 16 位。`varint` 编码在本质上与 UTF-8 编码类似(但细节不同),它偏爱较小的整数值而不是较大的整数值。(有关详细分析,请参见 Protobuf [编码指南][8])结果是,Protobuf 消息应该在字段中具有较小的整数值(如果可能),并且键数应尽可能少,但每个字段只有一个键是必不可少的。 +键和它们的值都被编码,但是有一个重要的区别:一些数字值具有固定大小的 32 或 64 位的编码,而其他数字(包括消息标签)则是 `varint` 编码的,位数取决于整数的绝对值。例如,整数值 1 到 15 需要 8 位 `varint` 编码,而值 16 到 2047 需要 16 位。`varint` 编码在本质上与 UTF-8 编码类似(但细节不同),它偏爱较小的整数值而不是较大的整数值。(有关详细分析,请参见 Protobuf [编码指南][8])结果是,Protobuf 消息应该在字段中具有较小的整数值(如果可能),并且键数应尽可能少,但每个字段至少得有一个键。 下表 1 列出了 Protobuf 编码的要点: @@ -184,32 +179,32 @@ message DataItems { } ``` -`repeated` 表示 `DataItem` 实例是*打包的*:集合具有单个标签,在这种情况下为 1。因此,具有重复的 `DataItem` 实例的 `DataItems` 消息比具有多个但单独的 `DataItem` 字段,每个字段都需要自己的标签的消息的效率更高。 +`repeated` 表示 `DataItem` 实例是*打包的*:集合具有单个标签,在这里是 1。因此,具有重复的 `DataItem` 实例的 `DataItems` 消息比具有多个但单独的 `DataItem` 字段、每个字段都需要自己的标签的消息的效率更高。 -考虑到这一背景,让我们回到 Go 程序。 +了解了这一背景,让我们回到 Go 程序。 ### dataItem 程序的细节 -`dataItem` 程序创建一个 `DataItem` 实例,并使用适当类型的随机生成的值填充字段。Go 有一个 `rand` 包,带有用于生成伪随机整数和浮点值的函数,而我的 `randString` 函数可以从字符集中生成指定长度的伪随机字符串。设计目标是要有一个具有不同类型和位大小的字段值的 `DataItem` 实例。例如,`OddA` 和 `EvenA` 值分别是奇偶校验的 64 位非负整数值;但是 `OddB` 和 `EvenB` 变体的大小为 32 位,并存放 0 到 2047 之间的小整数值。随机浮点值的大小为 32 位,字符串为 16(`Short`)和 32(`Long`)字符的长度。这是用随机值填充 `DataItem` 结构的代码段: +`dataItem` 程序创建一个 `DataItem` 实例,并使用适当类型的随机生成的值填充字段。Go 有一个 `rand` 包,带有用于生成伪随机整数和浮点值的函数,而我的 `randString` 函数可以从字符集中生成指定长度的伪随机字符串。设计目标是要有一个具有不同类型和位大小的字段值的 `DataItem` 实例。例如,`OddA` 和 `EvenA` 值分别是 64 位非负整数值的奇数和偶数;但是 `OddB` 和 `EvenB` 变体的大小为 32 位,并存放 0 到 2047 之间的小整数值。随机浮点值的大小为 32 位,字符串为 16(`Short`)和 32(`Long`)字符的长度。这是用随机值填充 `DataItem` 结构的代码段: ``` -// variable-length integers -n1 := rand.Int63() // bigger integer -if (n1 & 1) == 0 { n1++ } // ensure it's odd +// 可变长度整数 +n1 := rand.Int63() // 大整数 +if (n1 & 1) == 0 { n1++ } // 确保其是奇数 ... -n3 := rand.Int31() % UpperBound // smaller integer -if (n3 & 1) == 0 { n3++ } // ensure it's odd +n3 := rand.Int31() % UpperBound // 小整数 +if (n3 & 1) == 0 { n3++ } // 确保其是奇数 -// fixed-length floats +// 固定长度浮点数 ... t1 := rand.Float32() t2 := rand.Float32() ... -// strings +// 字符串 str1 := randString(StrShort) str2 := randString(StrLong) -// the message +// 消息 dataItem := &DataItem { OddA: n1, EvenA: n2, @@ -237,7 +232,7 @@ func encodeAndserialize(dataItem *DataItem) { } ``` -这三个序列化函数使用术语 `marshal`,它与 `serialize` 意思大致相同。如代码所示,三个 `Marshal` 函数均返回一个字节数组,然后将其写入文件。(为简单起见,可能的错误将被忽略处理。)在示例运行中,文件大小为: +这三个序列化函数使用术语 `marshal`,它与 `serialize` 意思大致相同。如代码所示,三个 `Marshal` 函数均返回一个字节数组,然后将其写入文件。(为简单起见,忽略可能的错误处理。)在示例运行中,文件大小为: ``` dataitem.xml:  262 bytes @@ -266,7 +261,7 @@ Protobuf 编码明显小于其他两个编码方案。通过消除缩进字符 ### 测试序列化和反序列化 -Go 程序接下来通过将先前写入 `dataitem.pbuf` 文件的字节反序列化为 `DataItem` 实例来运行基本测试。这是代码段,其中除去了错误检查部分: +Go 程序接下来通过将先前写入 `dataitem.pbuf` 文件的字节反序列化为 `DataItem` 实例来运行基本测试。这是代码段,其中去除了错误检查部分: ``` filebytes, err := ioutil.ReadFile(PbufFile) // get the bytes from the file @@ -291,7 +286,7 @@ boPb#T0O8Xd&Ps5EnSZqDg4Qztvo7IIs 9vH66AiGSQgCDxk& ### 一个 Java Protobuf 客户端 -Java 中的示例是为了确认 Protobuf 的语言中立性。原始 IDL 文件可用于生成 Java 支持代码,其中涉及嵌套类。但是,为了抑制警告信息,可以进行一些补充。这是修订版,它指定了一个 `DataMsg` 作为外部类的名称,内部类在 Protobuf 消息后自动命名为 `DataItem`: +用 Java 写的示例是为了确认 Protobuf 的语言中立性。原始 IDL 文件可用于生成 Java 支持代码,其中涉及嵌套类。但是,为了抑制警告信息,可以进行一些补充。这是修订版,它指定了一个 `DataMsg` 作为外部类的名称,内部类在该 Protobuf 消息后面自动命名为 `DataItem`: ``` syntax = "proto3"; @@ -304,7 +299,7 @@ message DataItem { ... ``` -进行此更改后,`protoc` 编译与以前相同,只是所预期的输出现在是 Java 而不是 Go: +进行此更改后,`protoc` 编译与以前相同,只是所期望的输出现在是 Java 而不是 Go: ``` % protoc --java_out=. dataitem.proto @@ -333,11 +328,11 @@ public class Main { } ``` -当然,生产级的测试将更加彻底,但是即使是该初步测试也可以证明 Protobuf 的语言中立性:`dataitem.pbuf` 文件是 Go 程序对 Go `DataItem` 进行序列化的结果,并且该文件中的字节被反序列化以在 Java 中产生一个 `DataItem` 实例。Java 测试的输出与 Go 测试的输出相同。 +当然,生产级的测试将更加彻底,但是即使是该初步测试也可以证明 Protobuf 的语言中立性:`dataitem.pbuf` 文件是 Go 程序对 Go 语言版的 `DataItem` 进行序列化的结果,并且该文件中的字节被反序列化以产生一个 Java 语言的 `DataItem` 实例。Java 测试的输出与 Go 测试的输出相同。 ### 用 numPairs 程序来结束 -让我们以一个突出 Protobuf 效率但又强调在任何编码技术中都会涉及到的成本的示例作为结尾。考虑以下 Protobuf IDL 文件: +让我们以一个示例作为结尾,来突出 Protobuf 效率,但又强调在任何编码技术中都会涉及到的成本。考虑以下 Protobuf IDL 文件: ``` syntax = "proto3"; @@ -438,11 +433,10 @@ func main() { } ``` -每个 `NumPair` 中随机生成的奇数和偶数值的范围在 0 到 20 亿之间变化。就原始数据(而非编码数据)而言,Go 程序中生成的整数加起来为 16MB:每个 `NumPair` 为两个整数,总计为 400 万个整数,每个值的大小为四个字节。 +每个 `NumPair` 中随机生成的奇数和偶数值的范围在 0 到 20 亿之间变化。就原始数据(而非编码数据)而言,Go 程序中生成的整数总共为 16MB:每个 `NumPair` 为两个整数,总计为 400 万个整数,每个值的大小为四个字节。 为了进行比较,下表列出了 XML、JSON 和 Protobuf 编码的示例 `NumsPairs` 消息的 200 万个 `NumPair` 实例。原始数据也包括在内。由于 `numPairs` 程序生成随机值,因此样本运行的输出有所不同,但接近表中显示的大小。 - 编码 | 文件 | 字节大小 | Pbuf/其它 比例 ---|---|---|--- 无 | pairs.raw | 16MB | 169% @@ -452,9 +446,9 @@ XML | pairs.xml | 126MB | 21% *表 2. 16MB 整数的编码开销* -不出所料,Protobuf 和之后的 XML 和 JSON 差别明显。Protobuf 编码大约是 JSON 的四分之一,而是 XML 的五分之一。但是原始数据清楚地表明 Protobuf 会产生编码开销:序列化的 Protobuf 消息比原始数据大 11MB。包括 Protobuf 在内的任何编码都涉及结构化数据,这不可避免地会增加字节。 +不出所料,Protobuf 和之后的 XML 和 JSON 差别明显。Protobuf 编码大约是 JSON 的四分之一,是 XML 的五分之一。但是原始数据清楚地表明 Protobuf 也会产生编码开销:序列化的 Protobuf 消息比原始数据大 11MB。包括 Protobuf 在内的任何编码都涉及结构化数据,这不可避免地会增加字节。 -序列化的 200 万个 `NumPair` 实例中的每个实例都包含**四**个整数值:Go 结构中的 `Even` 和 `Odd` 字段分别一个,而 Protobuf 编码中的每个字段每个标签一个。作为原始数据而不是编码数据,每个实例将达到 16 个字节,样本 `NumPairs` 消息中有 200 万个实例。但是 Protobuf 标记(如 `NumPair` 字段中的 `int32` 值)使用 `varint` 编码,因此字节长度有所不同。特别是,小的整数值(在这种情况下,包括标签在内)需要不到四个字节进行编码。 +序列化的 200 万个 `NumPair` 实例中的每个实例都包含**四**个整数值:Go 结构中的 `Even` 和 `Odd` 字段分别一个,而 Protobuf 编码中的每个字段、每个标签一个。对于原始数据(而不是编码数据),每个实例将达到 16 个字节,样本 `NumPairs` 消息中有 200 万个实例。但是 Protobuf 标记(如 `NumPair` 字段中的 `int32` 值)使用 `varint` 编码,因此字节长度有所不同。特别是,小的整数值(在这种情况下,包括标签在内)需要不到四个字节进行编码。 如果对 `numPairs` 程序进行了修改,以使两个 `NumPair` 字段的值小于 2048,且其编码为一或两个字节,则 Protobuf 编码将从 27MB 下降到 16MB,这正是原始数据的大小。下表总结了样本运行中的新编码大小。 @@ -467,7 +461,7 @@ XML | pairs.xml | 103MB | 15% *表 3. 编码 16MB 的小于 2048 的整数* -总之,修改后的 `numPairs` 程序的字段值小于 2048,可减少原始数据中每个整数值的四字节大小。但是 Protobuf 编码仍然需要标签,这些标签会在 Protobuf 消息中添加字节。Protobuf 编码确实会增加消息大小,但是如果要编码相对较小的整数值(无论是字段还是键),则可以通过 `varint` 因子来减少此开销。 +总之,修改后的 `numPairs` 程序的字段值小于 2048,可减少原始数据中每个四字节整数值的大小。但是 Protobuf 编码仍然需要标签,这些标签会在 Protobuf 消息中添加字节。Protobuf 编码确实会增加消息大小,但是如果要编码相对较小的整数值(无论是字段还是键),则可以通过 `varint` 因子来减少此开销。 对于包含混合类型的结构化数据(且整数值相对较小)的中等大小的消息,Protobuf 明显优于 XML 和 JSON 等选项。在其他情况下,数据可能不适合 Protobuf 编码。例如,如果两个应用程序需要共享大量文本记录或大整数值,则可以采用压缩而不是编码技术。 @@ -478,7 +472,7 @@ via: https://opensource.com/article/19/10/protobuf-data-interchange 作者:[Marty Kalin][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 06e3631fe3a8442eb0cc9eb8fe9fd6e287d09e4b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 Nov 2019 07:59:35 +0800 Subject: [PATCH 582/800] PUB @wxy https://linux.cn/article-11600-1.html --- .../20191018 How to use Protobuf for data interchange.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191018 How to use Protobuf for data interchange.md (99%) diff --git a/translated/tech/20191018 How to use Protobuf for data interchange.md b/published/20191018 How to use Protobuf for data interchange.md similarity index 99% rename from translated/tech/20191018 How to use Protobuf for data interchange.md rename to published/20191018 How to use Protobuf for data interchange.md index 0ad4896ec2..cecba89611 100644 --- a/translated/tech/20191018 How to use Protobuf for data interchange.md +++ b/published/20191018 How to use Protobuf for data interchange.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11600-1.html) [#]: subject: (How to use Protobuf for data interchange) [#]: via: (https://opensource.com/article/19/10/protobuf-data-interchange) [#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) From f8cb2c7b8322c44674165f36ebffd0bbbde076ce Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 22 Nov 2019 08:03:37 +0800 Subject: [PATCH 583/800] Rename sources/tech/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md to sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md --- ...22 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md (100%) diff --git a/sources/tech/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md b/sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md similarity index 100% rename from sources/tech/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md rename to sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md From bdb348f10f41496539dfceeebdd0c68ce6a9ea66 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 Nov 2019 08:20:54 +0800 Subject: [PATCH 584/800] PRF @geekpi --- .../tech/20191114 Cleaning up with apt-get.md | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/translated/tech/20191114 Cleaning up with apt-get.md b/translated/tech/20191114 Cleaning up with apt-get.md index 283ad157fb..b1ed1812c8 100644 --- a/translated/tech/20191114 Cleaning up with apt-get.md +++ b/translated/tech/20191114 Cleaning up with apt-get.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Cleaning up with apt-get) @@ -9,19 +9,18 @@ 使用 apt-get 清理 ====== -大多数使用基于 Debian 的系统的人通常会使用 apt-get 来安装软件包和升级,但是我们多久才清理?让我们看下工具本身的一些清理选项。 -[Félix Prado Modified by IDG Comm.][1] [(CC0)][2] -在基于 Debian 的系统上运行 **apt-get** 命令是很常规的。软件包的更新相当频繁,诸 如 **apt-get update** 和 **apt-get upgrade** 之类的命令使此过程非常容易。另一方面,你多久使用一次 **apt-get clean**,**apt-get autoclean** 或 **apt-get autoremove**? +> 大多数使用基于 Debian 的系统的人通常会使用 apt-get 来安装软件包和升级,但是我们多久才清理一次?让我们看下该工具本身的一些清理选项。 -这些命令会在 apt-get 的安装操作后清理并删除仍在系统上但不再需要的文件,这通常是因为需要它们的程序已经卸载。 +![](https://img.linux.net.cn/data/attachment/album/201911/22/082025p39oeuufdote517e.jpg) -[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] +在基于 Debian 的系统上运行 `apt-get` 命令是很常规的。软件包的更新相当频繁,诸如 `apt-get update` 和 `apt-get upgrade` 之类的命令使此过程非常容易。另一方面,你多久使用一次 `apt-get clean`、`apt-get autoclean` 或 `apt-get autoremove`? + +这些命令会在 `apt-get` 的安装操作后清理并删除仍在系统上但不再需要的文件,这通常是因为需要它们的程序已经卸载。 ### apt-get clean -apt-get clean 命令清除遗留在 **/var/cache** 中的已检索包文件的本地仓库。它清除的目录是 **/var/cache/apt/archives/** 和 **/var/cache/apt/archives/partial/**。它留在 **/var/cache/apt/archives** 中的唯一文件是 **lock** 文件和 **partial** 子目录。 - +`apt-get clean` 命令清除遗留在 `/var/cache` 中的已取回的包文件的本地仓库。它清除的目录是 `/var/cache/apt/archives/` 和 `/var/cache/apt/archives/partial/`。它留在 `/var/cache/apt/archives` 中的唯一文件是 `lock` 文件和 `partial` 子目录。 在运行清理操作之前,目录中可能包含许多文件: @@ -46,15 +45,15 @@ drwx------ 2 _apt root 4096 Nov 12 07:24 partial total 0 <== 空 ``` -**apt-get clean** 命令通常用于根据需要清除磁盘空间,通常作为定期计划维护的一部分。 +`apt-get clean` 命令通常用于根据需要清除磁盘空间,一般作为定期计划维护的一部分。 ### apt-get autoclean -**apt-get autoclean** 类似于 **apt-get clean**,它会清除已检索包文件的本地仓库,但它只会删除不会再下载且几乎无用的文件。它有助于防止缓存过大 +`apt-get autoclean` 类似于 `apt-get clean`,它会清除已检索包文件的本地仓库,但它只会删除不会再下载且几乎无用的文件。它有助于防止缓存过大。 ### apt-get autoremove -**autoremove** 选项将删除自动安装的软件包,因为某些其他软件包需要它们,但是在删除了其他软件包之后,而不再需要它们。有时会在升级时建议运行此命令。 +`apt-get autoremove` 将删除自动安装的软件包,因为某些其他软件包需要它们,但是在删除了其他软件包之后,而不再需要它们。有时会在升级时建议运行此命令。 ``` The following packages were automatically installed and are no longer required: @@ -66,9 +65,7 @@ The following packages were automatically installed and are no longer required: Use 'sudo apt autoremove' to remove them. <== ``` -要删除的软件包通常称为“未使用的依赖项”。实际上,一个好的做法是在卸载软件包后使用 **autoremove**,以确保不会留下不需要的文件。 - -加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,以评论最重要的话题。 +要删除的软件包通常称为“未使用的依赖项”。实际上,一个好的做法是在卸载软件包后使用 `autoremove`,以确保不会留下不需要的文件。 -------------------------------------------------------------------------------- @@ -77,7 +74,7 @@ via: https://www.networkworld.com/article/3453032/cleaning-up-with-apt-get.html 作者:[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 5984260002dc7ed70f12dd9e97fb9fbc76baa35a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 Nov 2019 08:22:10 +0800 Subject: [PATCH 585/800] PUB @geekpi https://linux.cn/article-11601-1.html --- .../tech => published}/20191114 Cleaning up with apt-get.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191114 Cleaning up with apt-get.md (98%) diff --git a/translated/tech/20191114 Cleaning up with apt-get.md b/published/20191114 Cleaning up with apt-get.md similarity index 98% rename from translated/tech/20191114 Cleaning up with apt-get.md rename to published/20191114 Cleaning up with apt-get.md index b1ed1812c8..7ae6d9779b 100644 --- a/translated/tech/20191114 Cleaning up with apt-get.md +++ b/published/20191114 Cleaning up with apt-get.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11601-1.html) [#]: subject: (Cleaning up with apt-get) [#]: via: (https://www.networkworld.com/article/3453032/cleaning-up-with-apt-get.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From de579b66cfdbd8fa074217243e2a840a0d22ffba Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 22 Nov 2019 09:04:19 +0800 Subject: [PATCH 586/800] translating --- ...20191118 How containers work- overlayfs.md | 170 ------------------ ...20191118 How containers work- overlayfs.md | 170 ++++++++++++++++++ 2 files changed, 170 insertions(+), 170 deletions(-) delete mode 100644 sources/tech/20191118 How containers work- overlayfs.md create mode 100644 translated/tech/20191118 How containers work- overlayfs.md diff --git a/sources/tech/20191118 How containers work- overlayfs.md b/sources/tech/20191118 How containers work- overlayfs.md deleted file mode 100644 index a360f72ad0..0000000000 --- a/sources/tech/20191118 How containers work- overlayfs.md +++ /dev/null @@ -1,170 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How containers work: overlayfs) -[#]: via: (https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/) -[#]: author: (Julia Evans https://jvns.ca/) - -How containers work: overlayfs -====== - -I wrote a comic about overlay filesystems for a potential future container [zine][1] this morning, and then I got excited about the topic and wanted to write a blog post with more details. Here’s the comic, to start out: - - - -### container images are big - -Container images can be pretty big (though some are really small, like [alpine linux is 2.5MB][2]). Ubuntu 16.04 is about 27MB, and [the Anaconda Python distribution is 800MB to 1.5GB][3]. - -Every container you start with an image starts out with the same blank slate, as if it made a copy of the image just for that container to use. But for big container images, like that 800MB Anaconda image, making a copy would be both a waste of disk space and pretty slow. So Docker doesn’t make copies – instead it uses an **overlay**. - -### how overlays work - -Overlay filesystems, also known as “union filesystems” or “union mounts” let you mount a filesystem using 2 directories: a “lower” directory, and an “upper” directory. - -Basically: - - * the **lower** directory of the filesystem is read-only - * the **upper** directory of the filesystem can be both read to and written from - - - -When a process **reads** a file, the overlayfs filesystem driver looks in the upper directory and reads the file from there if it’s present. Otherwise, it looks in the lower directory. - -When a process **writes** a file, overlayfs will just write it to the upper directory. - -### let’s make an overlay with `mount`! - -That was all a little abstract, so let’s make an overlay filesystem and try it out! This is just going to have a few files in it: I’ll make upper and lower directories, and a `merged` directory to mount the combined filesystem into: - -``` -$ mkdir upper lower merged work -$ echo "I'm from lower!" > lower/in_lower.txt -$ echo "I'm from upper!" > upper/in_upper.txt -$ # `in_both` is in both directories -$ echo "I'm from lower!" > lower/in_both.txt -$ echo "I'm from upper!" > upper/in_both.txt -``` - -Combining the upper and lower directories is pretty easy: we can just do it with `mount!` - -``` -$ sudo mount -t overlay overlay - -o lowerdir=/home/bork/test/lower,upperdir=/home/bork/test/upper,workdir=/home/bork/test/work - /home/bork/test/merged -``` - -There’s was an extremely annoying error message I kept getting while doing this, that said `mount: /home/bork/test/merged: special device overlay does not exist.`. This message is a lie, and actually just means that one of the directories I specified was missing (I’d written `~/test/merged` but it wasn’t being expanded). - -Okay, let’s try to read one of the files from the overlay filesystem! The file `in_both.txt` exists in both `lower/` and `upper/`, so it should read the file from the `upper/` directory. - -``` -$ cat merged/in_both.txt -"I'm from upper! -``` - -It worked! - -And the contents of our directories are what we’d expect: - -``` -find lower/ upper/ merged/ -lower/ -lower/in_lower.txt -lower/in_both.txt -upper/ -upper/in_upper.txt -upper/in_both.txt -merged/ -merged/in_lower.txt -merged/in_both.txt -merged/in_upper.txt -``` - -### what happens when you create a new file? - -``` -$ echo 'new file' > merged/new_file -$ ls -l */new_file --rw-r--r-- 1 bork bork 9 Nov 18 14:24 merged/new_file --rw-r--r-- 1 bork bork 9 Nov 18 14:24 upper/new_file -``` - -That makes sense, the new file gets created in the `upper` directory. - -### what happens when you delete a file? - -Reads and writes seem pretty straightforward. But what happens with deletes? Let’s do it! - -``` -$ rm merged/in_both.txt -``` - -What happened? Let’s look with `ls`: - -``` -ls -l upper/in_both.txt lower/lower1.txt merged/lower1.txt -ls: cannot access 'merged/in_both.txt': No such file or directory --rw-r--r-- 1 bork bork 6 Nov 18 14:09 lower/in_both.txt -c--------- 1 root root 0, 0 Nov 18 14:19 upper/in_both.txt -``` - -So: - - * `in_both.txt` is still in the `lower` directory, and it’s unchanged - * it’s not in the `merged` directory. So far this is all what we expected. - * But what happened in `upper` is a little strange: there’s a file called `upper/in_both.txt`, but it’s a… character device? I guess this is how the overlayfs driver represents a file being deleted. - - - -What happens if we try to copy this weird character device file? - -``` -$ sudo cp upper/in_both.txt upper/in_lower.txt -cp: cannot open 'upper/in_both.txt' for reading: No such device or address -``` - -Okay, that seems reasonable, being able to copy this weird deletion signal file doesn’t really make sense. - -### you can mount multiple “lower” directories - -Docker images are often composed of like 25 “layers”. Overlayfs supports having multiple lower directories, so you can run - -``` -mount -t overlay overlay - -o lowerdir:/dir1:/dir2:/dir3:...:/dir25,upperdir=... -``` - -So I assume that’s how containers with many Docker layers work, it just unpacks each layer into a separate directory and then asks overlayfs to combine them all together together with an empty upper directory that the container will write its changes to it. - -### docker can also use btrfs snapshots - -Right now I’m using ext4, and Docker uses overlayfs snapshots to run containers. But I used to use btrfs, and then Docker would use btrfs copy-on-write snapshots instead. (Here’s a list of when Docker uses which [storage drivers][4]) - -Using btrfs snapshots this way had some interesting consequences – at some point last year I was running hundreds of short-lived Docker containers on my laptop, and this resulted in me running out of btrfs metadata space (like [this person][5]). This was really confusing because I’d never heard of btrfs metadata before and it was tricky to figure out how to clean up my filesystem so I could run Docker containers again. ([this docker github issue][6] describes a similar problem with Docker and btrfs) - -### it’s fun to try out container features in a simple way! - -I think containers often seem like they’re doing “complicated” things and I think it’s fun to break them down like this – you can just run one `mount` incantation without actually doing anything else related to containers at all and see how overlays work! - --------------------------------------------------------------------------------- - -via: https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/ - -作者:[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://wizardzines.com -[2]: https://hub.docker.com/_/alpine?tab=tags -[3]: https://hub.docker.com/r/continuumio/anaconda3/tags -[4]: https://docs.docker.com/storage/storagedriver/select-storage-driver/ -[5]: https://www.reddit.com/r/archlinux/comments/5jrmfe/btrfs_metadata_and_docker/ -[6]: https://github.com/moby/moby/issues/27653 diff --git a/translated/tech/20191118 How containers work- overlayfs.md b/translated/tech/20191118 How containers work- overlayfs.md new file mode 100644 index 0000000000..0d2cac8e56 --- /dev/null +++ b/translated/tech/20191118 How containers work- overlayfs.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How containers work: overlayfs) +[#]: via: (https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/) +[#]: author: (Julia Evans https://jvns.ca/) + +容器如何工作:overlayfs +====== + +今天早上,我在未来潜在容器[杂志][1]上画了一幅 overlay 文件系统漫画,我对这个主题感到兴奋,想写一篇关于它的博客来提供更多详细信息。下面是漫画: + + + +### 容器镜像很大 + +容器镜像可能会很大(尽管有些很小,例如 [alpine linux 是 2.5MB][2])。Ubuntu 16.04 约为 27 MB,[Anaconda Python 发行版为 800MB 至 1.5GB][3]。 + +你以镜像启动的每个容器都是原始空白状态,仿佛它只是为使用容器而复制的一份镜像拷贝一样。但是对于大的容器镜像,像 800MB 的 Anaconda 镜像,复制一份拷贝既浪费磁盘空间也很慢。因此 Docker 不会复制,而是采用**叠加**。 + +### 叠加如何工作 + +overlayfs,也被称为 **Union 文件系统**或 **Union 挂载**, 它可让你使用 2 个目录挂载文件系统:“下层”目录和“上层”目录。 + +基本上: + + * 文件系统的**下层**目录是只读的 + * 文件系统的**上层**目录可以读写 + + + +当进程“读取”文件时,overlayfs 文件系统驱动将在上层目录中查找并从该目录中读取文件(如果存在)。否则,它将在下层目录中查找。 + +当进程“写入”文件时,overlayfs 会将其写入上层目录。 + +### 让我们使用 `mount` 制造一个叠加层! + +这有点抽象,所以让我们制作一个 overlayfs 并尝试一下!这将只包含一些文件:我将创建上,下层目录,并将合并的文件系统挂载到的`合并`目录: + +``` +$ mkdir upper lower merged work +$ echo "I'm from lower!" > lower/in_lower.txt +$ echo "I'm from upper!" > upper/in_upper.txt +$ # `in_both` is in both directories +$ echo "I'm from lower!" > lower/in_both.txt +$ echo "I'm from upper!" > upper/in_both.txt +``` + +合并上层目录和下层目录非常容易:我们可以通过 `mount` 来完成! + +``` +$ sudo mount -t overlay overlay + -o lowerdir=/home/bork/test/lower,upperdir=/home/bork/test/upper,workdir=/home/bork/test/work + /home/bork/test/merged +``` + +在执行此操作时,我不断收到一条非常烦人的错误消息,内容为:`mount: /home/bork/test/merged: special device overlay does not exist.`。这条消息是错误的,实际上只是意味着我指定的一个目录缺失(我写成了 `~/test/merged`,但它没有被扩展)。 + +让我们尝试从 overlayfs 中读取其中一个文件!文件 `in_both.txt` 同时存在于 `lower/` 和 `upper/` 中,因此应从 `upper/` 目录中读取该文件。 + +``` +$ cat merged/in_both.txt +"I'm from upper! +``` + +可以成功! + +目录的内容就是我们所期望的: + +``` +find lower/ upper/ merged/ +lower/ +lower/in_lower.txt +lower/in_both.txt +upper/ +upper/in_upper.txt +upper/in_both.txt +merged/ +merged/in_lower.txt +merged/in_both.txt +merged/in_upper.txt +``` + +### 创建新文件时会发生什么? + +``` +$ echo 'new file' > merged/new_file +$ ls -l */new_file +-rw-r--r-- 1 bork bork 9 Nov 18 14:24 merged/new_file +-rw-r--r-- 1 bork bork 9 Nov 18 14:24 upper/new_file +``` + +这是有作用的,新文件会在 `upper` 目录创建。 + +### 删除文件时会发生什么? + +读写似乎很简单。但是删除会发生什么?开始试试! + +``` +$ rm merged/in_both.txt +``` + +发生了什么?让我们用 `ls` 看下: + +``` +ls -l upper/in_both.txt lower/lower1.txt merged/lower1.txt +ls: cannot access 'merged/in_both.txt': No such file or directory +-rw-r--r-- 1 bork bork 6 Nov 18 14:09 lower/in_both.txt +c--------- 1 root root 0, 0 Nov 18 14:19 upper/in_both.txt +``` + +所以: + + * `in_both.txt` 仍在 `lower` 目录中,并且保持不变 + * 它不在 `merged` 目录中。到目前为止,这就是我们所期望的。 + * 但是在 `upper` 中发生的事情有点奇怪:有一个名为 `upper/in_both.txt` 的文件,但是它是字符设备?我想这就是 overlayfs 驱动表示删除的文件的方式。 + + + +如果我们尝试复制这个奇怪的字符设备文件,会发生什么? + +``` +$ sudo cp upper/in_both.txt upper/in_lower.txt +cp: cannot open 'upper/in_both.txt' for reading: No such device or address +``` + +好吧,这似乎很合理,复制这个奇怪的删除信号文件并没有任何意义。 + +### 你可以挂载多个“下层”目录 + +Docker 镜像通常由 25 个“层”组成。overlayfs 支持具有多个下层目录,因此你可以运行 + +``` +mount -t overlay overlay + -o lowerdir:/dir1:/dir2:/dir3:...:/dir25,upperdir=... +``` + +因此,我假设这是有多个 Docker 层的容器的工作方式,它只是将每个层解压缩到一个单独的目录中,然后要求 overlayfs 将它们全部合并在一起,并使用一个空的上层目录,容器将对其进行更改。 + +### Docker 也可以使用 btrfs 快照 + +现在,我使用的是 ext4,而 Docker 使用 overlayfs 快照来运行容器。但是我曾经用过 btrfs,接着 Docker 将改为使用 btrfs 的写时复制快照。 (这是 Docker 何时使用哪种[存储驱动][4]的列表) + +以这种方式使用 btrfs 快照会产生一些有趣的结果-去年某个时候,我在笔记本上运行了数百个临时的 Docker 容器,这导致我用尽了 btrfs 元数据空间(像[这个人][5])。这真的很令人困惑,因为我以前从未听说过 btrfs 元数据,而且弄清楚如何清理文件系统以便再次运行 Docker 容器非常棘手。([这个 docker github 上的问题][6]描述了 Docker 和 btrfs 的类似问题) + +### 以简单的方式尝试容器功能很有趣! + +我认为容器通常看起来像是在做“复杂的”事情,我认为将它们分解成这样很有趣。你可以运行一条 `mount` 咒语,而实际上并没有做任何与容器相关的其他事情,看看叠加层是如何工作的! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/ + +作者:[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://wizardzines.com +[2]: https://hub.docker.com/_/alpine?tab=tags +[3]: https://hub.docker.com/r/continuumio/anaconda3/tags +[4]: https://docs.docker.com/storage/storagedriver/select-storage-driver/ +[5]: https://www.reddit.com/r/archlinux/comments/5jrmfe/btrfs_metadata_and_docker/ +[6]: https://github.com/moby/moby/issues/27653 From d1b1ef6f3b04e18c691ae21248f7dee1dedec99f Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 22 Nov 2019 09:08:04 +0800 Subject: [PATCH 587/800] translating --- ...0 How to Use TimeShift to Backup and Restore Ubuntu Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md index cb9fc7f908..d074cd4dd9 100644 --- a/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md +++ b/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9d5c01a7bf27e271f12251453a62138dc6c2825b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 22 Nov 2019 09:12:59 +0800 Subject: [PATCH 588/800] Rename sources/tech/20191120 What makes a programming exercise good.md to sources/talk/20191120 What makes a programming exercise good.md --- .../20191120 What makes a programming exercise good.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191120 What makes a programming exercise good.md (100%) diff --git a/sources/tech/20191120 What makes a programming exercise good.md b/sources/talk/20191120 What makes a programming exercise good.md similarity index 100% rename from sources/tech/20191120 What makes a programming exercise good.md rename to sources/talk/20191120 What makes a programming exercise good.md From ff43893f1b2d55afc3ccf8ab646281349ff3d9ee Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Fri, 22 Nov 2019 09:15:40 +0800 Subject: [PATCH 589/800] Rename sources/tech/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md to sources/talk/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md --- ...etween the use and understanding of open source in business.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md (100%) diff --git a/sources/tech/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md b/sources/talk/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md similarity index 100% rename from sources/tech/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md rename to sources/talk/20191121 Three-course professional specialization aims to close the gap between the use and understanding of open source in business.md From f2a7deef284c62b4ed0bc1b2c276d0efc608b1fd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 22 Nov 2019 18:00:38 +0800 Subject: [PATCH 590/800] APL --- ... Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md b/sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md index 9890afb6e3..e28abfe024 100644 --- a/sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md +++ b/sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From d775dc41e0e82c78451f2e868ce428ba67bbd9d0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 09:35:44 +0800 Subject: [PATCH 591/800] TSL&PRF --- ...Release- Good Looking Lightweight Linux.md | 135 ------------------ ...Release- Good Looking Lightweight Linux.md | 125 ++++++++++++++++ 2 files changed, 125 insertions(+), 135 deletions(-) delete mode 100644 sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md create mode 100644 translated/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md diff --git a/sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md b/sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md deleted file mode 100644 index e28abfe024..0000000000 --- a/sources/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md +++ /dev/null @@ -1,135 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Zorin OS 15 Lite Release: Good Looking Lightweight Linux) -[#]: via: (https://itsfoss.com/zorin-os-lite/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Zorin OS 15 Lite Release: Good Looking Lightweight Linux -====== - -_**Zorin OS 15 Lite edition has just been released. We’ll show take you to a desktop tour of this new release and highlight its main features for you.**_ - -[Zorin OS][1] is an increasingly popular Linux distribution. It is based on Ubuntu and thus , unsurprisingly, it also happens to be one of the [best Linux distributions for beginners][2]. It’s Windows-like interface is one of the major reasons why it is preferred by many Windows-to-Linux migrants. - -Zorin OS comes in two main variants: - - * Zorin Core: It uses GNOME desktop and is intended for newer systems - * Zorin Lite: It uses lightweight [Xfce desktop][3] and is intended to be the [Linux for old laptops and computers][4] - - - -### Zorin OS 15 Lite: What’s New? - -[Subscribe to our YouTube channel for more Linux videos][5] - -Zorin OS 15 Lite edition has finally landed after a long time of Zorin OS 15 Core release. You can get your hands on the free lite editions or the paid ultimate lite edition now. - -I tried the Zorin OS 15 Lite Ultimate edition. In this article, I shall cover the details for this release and what you should know before choosing to download Zorin OS 15 Lite for your computer. - -Zorin OS 15 Lite is almost similar to the full-fledged Zorin OS 15 release. You can check out [Zorin OS 15 features][6] in our original coverage for that. - -This release entirely focuses to be light on resources so that any type of old hardware configuration from the past decade can easily run on it. - -![][7] - -With this release, they rely on the lightweight XFCE 4.14-based desktop environment to give the best possible experience on a low-spec computer. - -In addition to the XFCE desktop environment, there are some under-the-hood changes when compared to its full-fledged version that uses GNOME. - -#### Zorin OS 15 Lite Targets Windows 7 Users - -![][8] - -Primarily, Zorin OS 15 Lite targets the Windows 7 users because the official support for Windows 7 ends this January. - -So, if you are someone who’s comfortable with Windows 7, you can give this a try, it should be a smooth experience switching to this. - -Zorin OS 15 Lite gives you the option to switch the layout to a macOS style / Windows-style appearance from the “**Zorin Appearance**” settings. - -#### 32-bit and 64-bit Support - -It was good to see Zorin OS considering the support for 32-bit/64-bit ISOs just because the lite edition is being targeted for users with low-spec hardware. - -#### Flatpak Support Enabled By Default - -![][9] - -You can utilize Flathub to install Flatpak packages out of the box using the Software Center. Make sure to check out our guide on [using Flatpak][10] if you’re not sure what to do. - -In addition to this, you already have the Snap package support. So, it should be easier to install anything through the Software Center. - -#### User Interface Impression - -![][11] - -To be honest, the default Xfce interface looks old. There are ways to [customize Xfce][12] but Zorin does it out of the box. The customized look gives a good impression. It looks pretty damn neat and works as expected. - -#### Performance - -![][13] - -Even though I haven’t tried this on a super old system, I did install it on a vintage hard disk drive which struggles to boot up Ubuntu or similar distributions. - -As per my experience, I would definitely rate the performance to be super snappy. - -It feels like I have it installed on my SSD. So, that’s obviously a good thing. If you happen to try it on a super old system, you can let me know your experience in the comments section at the bottom of this article. - -### What’s The Difference Between The ‘Ultimate Lite’ edition & Free ‘Lite’ edition? - -![][14] - -Make no mistake, you can download Zorin OS 15 for free. - -However, there’s a separate ‘Ultimate’ edition which is basically meant to support the developers and the project. In addition to that, it also bundles a lot of pre-installed software as an “ultimate” package for your computer. - -So, if you purchase the Ultimate edition, you get access to both the lite and full version. - -In case you do not want to pay for it, you can still opt for the free editions (Core, Lite, Education) depending on your requirements. You can learn more about it on their [download page][15]. - -### How To Download Zorin OS 15 Lite? - -You can just head on to its [official download webpage][15] and scroll down to find the Zorin OS 15 lite edition. - -You will find 32-bit/64-bit ISOs available, download the one you require. - -[Zorin OS 15 Lite][15] - -Installing Zorin OS is similar to installing Ubuntu. - -**Wrapping Up** - -While Zorin OS 15 is already a great offering as a Linux distribution to Windows/macOS veterans, the new Lite edition surely turns more eyes to it. - -Have you tried the ‘Lite’ edition yet? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/zorin-os-lite/ - -作者:[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://zorinos.com/ -[2]: https://itsfoss.com/best-linux-beginners/ -[3]: https://www.xfce.org/ -[4]: https://itsfoss.com/lightweight-linux-beginners/ -[5]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[6]: https://itsfoss.com/zorin-os-15-release/ -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/file-explorer-zorin-os-15-lite.jpg?ssl=1 -[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-lite-ultimate-appearance.jpg?ssl=1 -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-software.png?ssl=1 -[10]: https://itsfoss.com/flatpak-guide/ -[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-15-lite-appearance.jpg?ssl=1 -[12]: https://itsfoss.com/customize-xfce/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/homescreen-zorin-os-15-lite.jpg?ssl=1 -[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-ultimate.jpg?ssl=1 -[15]: https://zorinos.com/download/ diff --git a/translated/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md b/translated/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md new file mode 100644 index 0000000000..391569ff8a --- /dev/null +++ b/translated/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Zorin OS 15 Lite Release: Good Looking Lightweight Linux) +[#]: via: (https://itsfoss.com/zorin-os-lite/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Zorin OS 15 Lite 发布:好看的轻量级 Linux +====== + +> Zorin OS 15 Lite 版刚刚发布。我们将向你展示此新版本的桌面体验,并向你重点展示其主要功能。 + +[Zorin OS][1] 是一款日益流行的 Linux 发行版。它基于 Ubuntu,因此,毫不奇怪,它也正是[适合初学者的最佳 Linux 发行版][2]之一。 类似 Windows 的界面是许多从 Windows 到 Linux 的迁移者偏爱它的主要原因之一。 + +Zorin OS 有两个主要变体: + +* Zorin Core:它使用 GNOME 桌面,用于较新的机器。 +* Zorin Lite:它使用轻量级的 [Xfce 桌面][3],可以用作[老旧的笔记本电脑和计算机的 Linux][4]。 + +### Zorin OS 15 Lite:新特性 + +Zorin OS 15 Core 发布之后过了很久,Zorin OS 15 Lite 版终于出现了。你现在就可以使用免费的 Lite 版或付费的 Lite Ultimate 版。 + +我尝试了 Zorin OS 15 Lite Ultimate 版。在本文中,我将介绍此版本的详细信息以及在为你的计算机下载 Zorin OS 15 Lite 之前应了解的知识。 + +Zorin OS 15 Lite 与全面的 Zorin OS 15 版本基本差不多。你可以在我们的原来的报道中查看 [Zorin OS 15 的功能][6]。 + +此发行版重点关注资源,因此过去十年中任何类型的旧硬件配置都可以轻松地在其上运行。 + +![][7] + +在此版本中,它们依靠基于 Xfce 4.14 的轻量级桌面环境在低规格计算机上提供了最佳体验。除了 Xfce 桌面环境外,与使用 GNOME 的完整版本相比,它还做了一些底层更改。 + +#### Zorin OS 15 Lite 是针对 Windows 7 用户的 + +![][8] + +Zorin OS 15 Lite 主要针对 Windows 7 用户,因为对 Windows 7 的官方支持结束于今年 1 月。因此,如果你对 Windows 7 感到满意,可以尝试一下,切换到此版本应该是一种流畅的体验。 + +Zorin OS 15 Lite 允许你在 “Zorin 外观”设置中将布局切换为 macOS 风格/ Windows 风格的外观。 + +#### 32 位和 64 位支持 + +很高兴看到 Zorin OS 考虑到对 32 位/ 64 位 ISO 的支持,因为 Lite 版本是针对具有低规格硬件的用户的。 + +#### 默认启用 Flatpak 支持 + +![][9] + +你可以使用软件中心利用 Flathub 来立即安装 Flatpak 软件包。如果你不确定该怎么做,请务必查看有关[使用 Flatpak][10]的指南。 + +除此之外,你已经拥有 Snap 软件包支持。因此,通过软件中心安装任何内容应该更容易。 + +#### 用户界面的印象 + +![][11] + +老实说,默认的 Xfce 界面看起来很陈旧。有一些方法可以 [定制 Xfce][12],但是 Zorin 也可以开箱即用。定制外观给人以良好印象。它看起来非常整洁,可以按预期工作。 + +#### 性能 + +![][13] + +即使我没有在超级老旧的系统上尝试过,但我也在老式硬盘上安装了它,它难以启动 Ubuntu 或类似发行版。 + +根据我的体验,我可以肯定该性能非常出色。感觉就好像我将其安装在 SSD 上。这显然是一件好事。如果你碰巧在超级老旧的系统上尝试使用它,可以在本文底部的评论部分中告诉我您的经验。 + +### Ultimate Lite 版和免费的 Lite 版有何区别? + +![][14] + +没错,你可以免费下载 Zorin OS 15。 + +但是,有一个单独的“终极版”(Ultimate),其基本目的是用来支持该项目及其开发者。除此之外,它还捆绑了许多预安装的软件,作为计算机的“最终”软件包。 + +因此,如果你购买 Ultimate 版,则可以访问 Lite 版和完整版。 + +如果你不想为此付费,仍然可以根据需要选择免费版本(Core、Lite、Education)。你可以在它们的[下载页面][15]上了解更多信息。 + +### 如何下载 Zorin OS 15 Lite? + +你可以转到其[官方下载网页][15],然后向下滚动找到 Zorin OS 15 Lite 版。 + +你可以找到 32 位/ 64 位的 ISO,可以下载所需的 ISO。 + +- [Zorin OS 15 Lite] [15] + +安装 Zorin OS 与安装 Ubuntu 类似。 + +### 总结 + +虽然 Zorin OS 15 作为向 Windows / macOS 老手提供的 Linux 发行版已经是一个不错的产品,但新的 Lite 版本肯定会吸引更多的眼球。 + +您是否尝试过 Lite 版?在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zorin-os-lite/ + +作者:[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://zorinos.com/ +[2]: https://itsfoss.com/best-linux-beginners/ +[3]: https://www.xfce.org/ +[4]: https://itsfoss.com/lightweight-linux-beginners/ +[5]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[6]: https://linux.cn/article-11058-1.html +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/file-explorer-zorin-os-15-lite.jpg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-lite-ultimate-appearance.jpg?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-software.png?ssl=1 +[10]: https://itsfoss.com/flatpak-guide/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-15-lite-appearance.jpg?ssl=1 +[12]: https://itsfoss.com/customize-xfce/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/homescreen-zorin-os-15-lite.jpg?ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-ultimate.jpg?ssl=1 +[15]: https://zorinos.com/download/ From e1a0dd75fbd4931d296f74113fea799e2a5f4d6e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 09:39:02 +0800 Subject: [PATCH 592/800] PUB @wxy https://linux.cn/article-11603-1.html --- ...orin OS 15 Lite Release- Good Looking Lightweight Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md (98%) diff --git a/translated/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md b/published/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md similarity index 98% rename from translated/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md rename to published/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md index 391569ff8a..2f1932ddec 100644 --- a/translated/news/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md +++ b/published/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11603-1.html) [#]: subject: (Zorin OS 15 Lite Release: Good Looking Lightweight Linux) [#]: via: (https://itsfoss.com/zorin-os-lite/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) From eeb26e1aa95efae3626ae0ad3b4e3e9bbbe63ff8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 10:01:34 +0800 Subject: [PATCH 593/800] PRF @geekpi --- ... a Simple Web Application Using Flutter.md | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/translated/tech/20191115 Developing a Simple Web Application Using Flutter.md b/translated/tech/20191115 Developing a Simple Web Application Using Flutter.md index a29e2e4d91..2fb198f595 100644 --- a/translated/tech/20191115 Developing a Simple Web Application Using Flutter.md +++ b/translated/tech/20191115 Developing a Simple Web Application Using Flutter.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Developing a Simple Web Application Using Flutter) @@ -10,35 +10,39 @@ 使用 Flutter 开发简单的 Web 应用 ====== -[![][1]][2] +![][2] -_本文指导读者如何使用 Flutter 运行和部署第一个 Web 应用。_ +> 本文指导读者如何使用 Flutter 运行和部署第一个 Web 应用。 -Flutter 在 Android 和 iOS 开发方面走了很长一段路之后,已经迈入了一个新的阶段,即 Web。Google 发布了 Flutter 1.5,同时支持 Web 应用开发。 +Flutter 在 Android 和 iOS 开发方面走了很长一段路之后,已经迈入了一个新的阶段,即 Web 开发。Google 发布了 Flutter 1.5,同时支持 Web 应用开发。 -**为 Web 配置 Flutter** -为了使用 Web 包,输入命令 _flutter upgrade_ 更新到 Flutter 1.5.4。 +### 为 Web 开发配置 Flutter + +为了使用 Web 包,输入命令 `flutter upgrade` 更新到 Flutter 1.5.4。 * 打开终端 - * 输入 flutter upgrade - * 输入 _flutter –version_ 检查版本 + * 输入 `flutter upgrade` + * 输入 `flutter –version` 检查版本 - -![Figure 1: Upgrading Flutter to the latest version][3] - -![Figure 2: Starting a new Flutter Web project in VSC][4] +![图 1: 升级 Flutter 到最新版][3] 也可以将 Android Studio 3.0 或更高版本用于 Flutter Web 开发,但在本教程中,我们使用 Visual Studio Code。 -**使用 Flutter Web 创建新项目** -打开 Visual Studio Code,然后按 _Shift+Ctrl+P_ 开始一个新项目。输入 flutter 并选择 _New Web Project_。 -现在,为项目命名。我将其命名为 _open_source_for_you_。 +### 使用 Flutter Web 创建新项目 + +打开 Visual Studio Code,然后按 `Shift+Ctrl+P` 开始一个新项目。输入 `flutter` 并选择 “New Web Project”。 + +![图 2:在 VSC 中开始一个新的 Flatter 项目][4] + +现在,为项目命名。我将其命名为 `open_source_for_you`。 + +![图 3: 给项目命名][5] + 在 VSC 中打开终端窗口,然后输入以下命令: ``` flutter packages pub global activate webdev - flutter packages upgrade ``` @@ -48,78 +52,74 @@ flutter packages upgrade flutter packages pub global run webdev serve ``` -打开任何浏览器,然后输入 __。 -在项目目录中有个 Web 文件夹,其中包含了 _index.html_。 _dart_ 文件被编译成 JavaScript 文件,并使用以下代码包含在 HTML 文件中: +打开任何浏览器,然后输入 `http://127.0.0.1:8080/`。 + + +![图 4:运行于 8080 端口的 Flutter 演示应用][6] + +在项目目录中有个 Web 文件夹,其中包含了 `index.html`。`dart` 文件被编译成 JavaScript 文件,并使用以下代码包含在 HTML 文件中: ``` ``` -**编码和修改演示页面** -让我们创建一个简单的应用,它会在网页上打印 “ Welcome to OSFY”。 -现在打开 Dart 文件,它位于 _lib_ 文件夹 _main.dart_(默认名)中(参见图 5)。 -现在,我们可以在 _MaterialApp_ 的属性中删除调试标记,如下所示: +### 编码和修改演示页面 + +让我们创建一个简单的应用,它会在网页上打印 “Welcome to OSFY”。 + +现在打开 Dart 文件,它位于 `lib` 文件夹 `main.dart`(默认名)中(参见图 5)。 + +![图 5:main.dart 文件的位置][7] + +现在,我们可以在 `MaterialApp` 的属性中删除调试标记,如下所示: ``` debugShowCheckedModeBanner: false ``` -![Figure 3: Naming the project][5] +现在,向 Dart 中添加更多内容与用 Dart 编写 Flutter 很类似。为此,我们可以声明一个名为 `MyClass` 的类,它继承了 `StatelessWidget`。 -![Figure 4: The Flutter demo application running on port 8080][6] - -![Figure 5: Location of main.dart file][7] - -现在,向 Dart 中添加更多内容与在 Dart 中编写 Flutter 类似。为此,我们可以声明一个名为 _MyClass_ 的类,它继承了 _StatelessWidget_。 -我们使用 _Center_ 部件将元素定位到中心。我们还可以添加 _Padding_ 部件来添加填充。使用以下代码获得图 5 所示的输出。使用刷新按钮查看更改。 +我们使用 `Center` 部件将元素定位到中心。我们还可以添加 `Padding` 部件来添加填充。使用以下代码获得图 5 所示的输出。使用刷新按钮查看更改。 ``` class MyClass extends StatelessWidget { -@override -Widget build(BuildContext context) { -return Scaffold( -body: Center( -child: Column( -mainAxisAlignment: MainAxisAlignment.center, -children: [ -Padding( -padding: EdgeInsets.all(20.0), -child: Text( -'Welcome to OSFY', -style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), -), -), -], -), -), -); -} + @override + Widget build(BuildContext context) { + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.all(20.0), + child: Text( + 'Welcome to OSFY', + style: TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold), + ), + ), + ], + ), + ), + ); + } } ``` -![Figure 6: Output of MyClass][8] +![图 6:MyClass 的输出][8] -![Figure 7: Final output][9] - -让我们从互联网中添加一张图片,我已经从一个杂志网站选择了一张 “Open Source for You” 的 logo。我们使用 _Image.network_。 +让我们从互联网中添加一张图片,我已经从一个杂志网站选择了一张 “Open Source for You” 徽标。我们使用 `Image.network`。 ``` Image.network( -'https://opensourceforu.com/wp-content/uploads/2014/03/OSFY-Logo.jpg', -height: 100, -width: 150 + 'https://opensourceforu.com/wp-content/uploads/2014/03/OSFY-Logo.jpg', + height: 100, + width: 150 ), ``` 最终输出如图 7 所示。 -![Avatar][10] - -[Jis Joe Mathew][11] - -作者是喀拉拉邦卡尼拉帕利阿玛尔·乔蒂学院的计算机科学与工程助理教授。可以通过 [jisjoemathew@gmail.com][12] 与他联系。 - -[![][13]][14] +![图 7:最终输出][9] -------------------------------------------------------------------------------- @@ -128,7 +128,7 @@ via: https://opensourceforu.com/2019/11/developing-a-simple-web-application-usin 作者:[Jis Joe Mathew][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 69fe25e3b4ef509399d79dfe04c62b61b3aed64e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 10:05:12 +0800 Subject: [PATCH 594/800] PUB @geekpi https://linux.cn/article-11604-1.html --- ... a Simple Web Application Using Flutter.md | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) rename {translated/tech => published}/20191115 Developing a Simple Web Application Using Flutter.md (89%) diff --git a/translated/tech/20191115 Developing a Simple Web Application Using Flutter.md b/published/20191115 Developing a Simple Web Application Using Flutter.md similarity index 89% rename from translated/tech/20191115 Developing a Simple Web Application Using Flutter.md rename to published/20191115 Developing a Simple Web Application Using Flutter.md index 2fb198f595..e52d81885a 100644 --- a/translated/tech/20191115 Developing a Simple Web Application Using Flutter.md +++ b/published/20191115 Developing a Simple Web Application Using Flutter.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11604-1.html) [#]: subject: (Developing a Simple Web Application Using Flutter) [#]: via: (https://opensourceforu.com/2019/11/developing-a-simple-web-application-using/) [#]: author: (Jis Joe Mathew https://opensourceforu.com/author/jis-joe/) @@ -134,15 +134,15 @@ via: https://opensourceforu.com/2019/11/developing-a-simple-web-application-usin [a]: https://opensourceforu.com/author/jis-joe/ [b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Screenshot-from-2019-11-15-16-20-30.png?resize=696%2C495&ssl=1 (Screenshot from 2019-11-15 16-20-30) -[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Screenshot-from-2019-11-15-16-20-30.png?fit=900%2C640&ssl=1 -[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Upgrading-Flutter-to-the-latest-version.jpg?resize=350%2C230&ssl=1 -[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-Starting-a-new-Flutter-Web-project-in-VSC.jpg?resize=350%2C93&ssl=1 -[5]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-Naming-the-project.jpg?resize=350%2C147&ssl=1 -[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-The-Flutter-demo-application-running-on-port-8080.jpg?resize=350%2C111&ssl=1 -[7]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-5-Location-of-main.dart-file.jpg?resize=350%2C173&ssl=1 -[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-6-Output-of-MyClass.jpg?resize=350%2C173&ssl=1 -[9]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-7-Final-output.jpg?resize=350%2C167&ssl=1 +[1]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Screenshot-from-2019-11-15-16-20-30.png +[2]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Screenshot-from-2019-11-15-16-20-30.png +[3]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Upgrading-Flutter-to-the-latest-version.jpg +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-Starting-a-new-Flutter-Web-project-in-VSC.jpg +[5]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-Naming-the-project.jpg +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-The-Flutter-demo-application-running-on-port-8080.jpg +[7]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-5-Location-of-main.dart-file.jpg +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-6-Output-of-MyClass.jpg +[9]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-7-Final-output.jpg [10]: https://secure.gravatar.com/avatar/64db0e07799ae14fd1b51d0633db6593?s=100&r=g [11]: https://opensourceforu.com/author/jis-joe/ [12]: mailto:jisjoemathew@gmail.com From fee1c25063ca99a976a174adb31892c4458b685d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 10:25:31 +0800 Subject: [PATCH 595/800] PRF @geekpi --- ...20191118 How containers work- overlayfs.md | 38 +++++++++---------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/translated/tech/20191118 How containers work- overlayfs.md b/translated/tech/20191118 How containers work- overlayfs.md index 0d2cac8e56..5e50aed42e 100644 --- a/translated/tech/20191118 How containers work- overlayfs.md +++ b/translated/tech/20191118 How containers work- overlayfs.md @@ -1,43 +1,41 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How containers work: overlayfs) [#]: via: (https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/) [#]: author: (Julia Evans https://jvns.ca/) -容器如何工作:overlayfs +容器如何工作:OverlayFS ====== -今天早上,我在未来潜在容器[杂志][1]上画了一幅 overlay 文件系统漫画,我对这个主题感到兴奋,想写一篇关于它的博客来提供更多详细信息。下面是漫画: +今天早上,我为未来潜在容器[杂志][1]画了一幅 OverlayFS 的漫画,我对这个主题感到兴奋,想写一篇关于它的博客来提供更多详细信息。 - +![](https://jvns.ca/images/overlay.jpeg) ### 容器镜像很大 -容器镜像可能会很大(尽管有些很小,例如 [alpine linux 是 2.5MB][2])。Ubuntu 16.04 约为 27 MB,[Anaconda Python 发行版为 800MB 至 1.5GB][3]。 +容器镜像可能会很大(尽管有些很小,例如 [alpine linux 才 2.5MB][2])。Ubuntu 16.04 约为 27 MB,[Anaconda Python 发行版为 800MB 至 1.5GB][3]。 你以镜像启动的每个容器都是原始空白状态,仿佛它只是为使用容器而复制的一份镜像拷贝一样。但是对于大的容器镜像,像 800MB 的 Anaconda 镜像,复制一份拷贝既浪费磁盘空间也很慢。因此 Docker 不会复制,而是采用**叠加**。 ### 叠加如何工作 -overlayfs,也被称为 **Union 文件系统**或 **Union 挂载**, 它可让你使用 2 个目录挂载文件系统:“下层”目录和“上层”目录。 +OverlayFS,也被称为 **联合文件系统**或 **联合挂载**,它可让你使用 2 个目录挂载文件系统:“下层”目录和“上层”目录。 基本上: * 文件系统的**下层**目录是只读的 * 文件系统的**上层**目录可以读写 +当进程“读取”文件时,OverlayFS 文件系统驱动将在上层目录中查找并从该目录中读取文件(如果存在)。否则,它将在下层目录中查找。 +当进程“写入”文件时,OverlayFS 会将其写入上层目录。 -当进程“读取”文件时,overlayfs 文件系统驱动将在上层目录中查找并从该目录中读取文件(如果存在)。否则,它将在下层目录中查找。 +### 让我们使用 mount 制造一个叠加层! -当进程“写入”文件时,overlayfs 会将其写入上层目录。 - -### 让我们使用 `mount` 制造一个叠加层! - -这有点抽象,所以让我们制作一个 overlayfs 并尝试一下!这将只包含一些文件:我将创建上,下层目录,并将合并的文件系统挂载到的`合并`目录: +这有点抽象,所以让我们制作一个 OverlayFS 并尝试一下!这将只包含一些文件:我将创建上、下层目录,以及用来挂载合并的文件系统的 `merged ` 目录: ``` $ mkdir upper lower merged work @@ -56,9 +54,9 @@ $ sudo mount -t overlay overlay /home/bork/test/merged ``` -在执行此操作时,我不断收到一条非常烦人的错误消息,内容为:`mount: /home/bork/test/merged: special device overlay does not exist.`。这条消息是错误的,实际上只是意味着我指定的一个目录缺失(我写成了 `~/test/merged`,但它没有被扩展)。 +在执行此操作时,我不断收到一条非常烦人的错误消息,内容为:`mount: /home/bork/test/merged: special device overlay does not exist.`。这条消息是错误的,实际上只是意味着我指定的一个目录缺失(我写成了 `~/test/merged`,但它没有被展开)。 -让我们尝试从 overlayfs 中读取其中一个文件!文件 `in_both.txt` 同时存在于 `lower/` 和 `upper/` 中,因此应从 `upper/` 目录中读取该文件。 +让我们尝试从 OverlayFS 中读取其中一个文件!文件 `in_both.txt` 同时存在于 `lower/` 和 `upper/` 中,因此应从 `upper/` 目录中读取该文件。 ``` $ cat merged/in_both.txt @@ -117,8 +115,6 @@ c--------- 1 root root 0, 0 Nov 18 14:19 upper/in_both.txt * 它不在 `merged` 目录中。到目前为止,这就是我们所期望的。 * 但是在 `upper` 中发生的事情有点奇怪:有一个名为 `upper/in_both.txt` 的文件,但是它是字符设备?我想这就是 overlayfs 驱动表示删除的文件的方式。 - - 如果我们尝试复制这个奇怪的字符设备文件,会发生什么? ``` @@ -130,20 +126,20 @@ cp: cannot open 'upper/in_both.txt' for reading: No such device or address ### 你可以挂载多个“下层”目录 -Docker 镜像通常由 25 个“层”组成。overlayfs 支持具有多个下层目录,因此你可以运行 +Docker 镜像通常由 25 个“层”组成。OverlayFS 支持具有多个下层目录,因此你可以运行: ``` mount -t overlay overlay -o lowerdir:/dir1:/dir2:/dir3:...:/dir25,upperdir=... ``` -因此,我假设这是有多个 Docker 层的容器的工作方式,它只是将每个层解压缩到一个单独的目录中,然后要求 overlayfs 将它们全部合并在一起,并使用一个空的上层目录,容器将对其进行更改。 +因此,我假设这是有多个 Docker 层的容器的工作方式,它只是将每个层解压缩到一个单独的目录中,然后要求 OverlayFS 将它们全部合并在一起,并使用一个空的上层目录,容器将对其进行更改。 ### Docker 也可以使用 btrfs 快照 -现在,我使用的是 ext4,而 Docker 使用 overlayfs 快照来运行容器。但是我曾经用过 btrfs,接着 Docker 将改为使用 btrfs 的写时复制快照。 (这是 Docker 何时使用哪种[存储驱动][4]的列表) +现在,我使用的是 ext4,而 Docker 使用 OverlayFS 快照来运行容器。但是我曾经用过 btrfs,接着 Docker 将改为使用 btrfs 的写时复制快照。(这是 Docker 何时使用哪种[存储驱动][4]的列表) -以这种方式使用 btrfs 快照会产生一些有趣的结果-去年某个时候,我在笔记本上运行了数百个临时的 Docker 容器,这导致我用尽了 btrfs 元数据空间(像[这个人][5])。这真的很令人困惑,因为我以前从未听说过 btrfs 元数据,而且弄清楚如何清理文件系统以便再次运行 Docker 容器非常棘手。([这个 docker github 上的问题][6]描述了 Docker 和 btrfs 的类似问题) +以这种方式使用 btrfs 快照会产生一些有趣的结果:去年某个时候,我在笔记本上运行了数百个临时的 Docker 容器,这导致我用尽了 btrfs 元数据空间(像[这个人][5]一样)。这真的很令人困惑,因为我以前从未听说过 btrfs 元数据,而且弄清楚如何清理文件系统以便再次运行 Docker 容器非常棘手。([这个 docker github 上的提案][6]描述了 Docker 和 btrfs 的类似问题) ### 以简单的方式尝试容器功能很有趣! @@ -156,7 +152,7 @@ via: https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/ 作者:[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 47ea01bd5bdb174976a258dd9a344efbd252e4b1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 10:26:01 +0800 Subject: [PATCH 596/800] PUB @geekpi https://linux.cn/article-11605-1.html --- .../20191118 How containers work- overlayfs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191118 How containers work- overlayfs.md (98%) diff --git a/translated/tech/20191118 How containers work- overlayfs.md b/published/20191118 How containers work- overlayfs.md similarity index 98% rename from translated/tech/20191118 How containers work- overlayfs.md rename to published/20191118 How containers work- overlayfs.md index 5e50aed42e..294e55e42b 100644 --- a/translated/tech/20191118 How containers work- overlayfs.md +++ b/published/20191118 How containers work- overlayfs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11605-1.html) [#]: subject: (How containers work: overlayfs) [#]: via: (https://jvns.ca/blog/2019/11/18/how-containers-work--overlayfs/) [#]: author: (Julia Evans https://jvns.ca/) From fedb2a628deea80e8b999b06aaeba809e1b8b65f Mon Sep 17 00:00:00 2001 From: WWWN Date: Sat, 23 Nov 2019 16:30:18 +0800 Subject: [PATCH 597/800] translating --- ... Top 10 Vim plugins for programming in multiple languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md b/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md index c194f20d88..26a719c8fd 100644 --- a/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md +++ b/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hello-wn) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 74fe3c74ffeed28e2acfb088588de6a14824fb70 Mon Sep 17 00:00:00 2001 From: Valonia Kim <34000495+Valoniakim@users.noreply.github.com> Date: Sat, 23 Nov 2019 16:46:31 +0800 Subject: [PATCH 598/800] translating --- ...global- How to overcome cultural communication challenges.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md b/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md index 1d36d5e88d..1244f13079 100644 --- a/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md +++ b/sources/talk/20181018 Think global- How to overcome cultural communication challenges.md @@ -1,3 +1,5 @@ +translating + Think global: How to overcome cultural communication challenges ====== Use these tips to ensure that every member of your global development team feels involved and understood. From 8a26109223a16d072f904927595f128cf53ca8e0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 22:44:23 +0800 Subject: [PATCH 599/800] APL --- .../tech/20190328 Can Better Task Stealing Make Linux Faster.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md b/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md index bae14a2f5c..54617aedf4 100644 --- a/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md +++ b/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 3e30353c8d0acc2ed34588f3dcae36d437c02a3b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 23:54:58 +0800 Subject: [PATCH 600/800] TSL&PRF --- ... Better Task Stealing Make Linux Faster.md | 133 ------------------ ... Better Task Stealing Make Linux Faster.md | 75 ++++++++++ 2 files changed, 75 insertions(+), 133 deletions(-) delete mode 100644 sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md create mode 100644 translated/tech/20190328 Can Better Task Stealing Make Linux Faster.md diff --git a/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md b/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md deleted file mode 100644 index 54617aedf4..0000000000 --- a/sources/tech/20190328 Can Better Task Stealing Make Linux Faster.md +++ /dev/null @@ -1,133 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Can Better Task Stealing Make Linux Faster?) -[#]: via: (https://www.linux.com/blog/can-better-task-stealing-make-linux-faster) -[#]: author: (Oracle ) - -Can Better Task Stealing Make Linux Faster? -====== - -_Oracle Linux kernel developer Steve Sistare contributes this discussion on kernel scheduler improvements._ - -### Load balancing via scalable task stealing - -The Linux task scheduler balances load across a system by pushing waking tasks to idle CPUs, and by pulling tasks from busy CPUs when a CPU becomes idle. Efficient scaling is a challenge on both the push and pull sides on large systems. For pulls, the scheduler searches all CPUs in successively larger domains until an overloaded CPU is found, and pulls a task from the busiest group. This is very expensive, costing 10's to 100's of microseconds on large systems, so search time is limited by the average idle time, and some domains are not searched. Balance is not always achieved, and idle CPUs go unused. - -I have implemented an alternate mechanism that is invoked after the existing search in idle_balance() limits itself and finds nothing. I maintain a bitmap of overloaded CPUs, where a CPU sets its bit when its runnable CFS task count exceeds 1. The bitmap is sparse, with a limited number of significant bits per cacheline. This reduces cache contention when many threads concurrently set, clear, and visit elements. There is a bitmap per last-level cache. When a CPU becomes idle, it searches the bitmap to find the first overloaded CPU with a migratable task, and steals it. This simple stealing yields a higher CPU utilization than idle_balance() alone, because the search is cheap, costing 1 to 2 microseconds, so it may be called every time the CPU is about to go idle. Stealing does not offload the globally busiest queue, but it is much better than running nothing at all. - -### Results - -Stealing improves utilization with only a modest CPU overhead in scheduler code. In the following experiment, hackbench is run with varying numbers of groups (40 tasks per group), and the delta in /proc/schedstat is shown for each run, averaged per CPU, augmented with these non-standard stats: - - * %find - percent of time spent in old and new functions that search for idle CPUs and tasks to steal and set the overloaded CPUs bitmap. - * steal - number of times a task is stolen from another CPU. Elapsed time improves by 8 to 36%, costing at most 0.4% more find time. - - - -![load balancing][1] - -[Used with permission][2] - -​​CPU busy utilization is close to 100% for the new kernel, as shown by the green curve in the following graph, versus the orange curve for the baseline kernel: - -![][3] - -Stealing improves Oracle database OLTP performance by up to 9% depending on load, and we have seen some nice improvements for mysql, pgsql, gcc, java, and networking. In general, stealing is most helpful for workloads with a high context switch rate. - -### The code - -As of this writing, this work is not yet upstream, but the latest patch series is at [https://lkml.org/lkml/2018/12/6/1253. ][4]If your kernel is built with CONFIG_SCHED_DEBUG=y, you can verify that it contains the stealing optimization using - -``` -# grep -q STEAL /sys/kernel/debug/sched_features && echo Yes -Yes -``` - -If you try it, note that stealing is disabled for systems with more than 2 NUMA nodes, because hackbench regresses on such systems, as I explain in [https://lkml.org/lkml/2018/12/6/1250 .][5]However, I suspect this effect is specific to hackbench and that stealing will help other workloads on many-node systems. To try it, reboot with kernel parameter sched_steal_node_limit = 8 (or larger). - -### Future work - -After the basic stealing algorithm is pushed upstream, I am considering the following enhancements: - - * If stealing within the last-level cache does not find a candidate, steal across LLC's and NUMA nodes. - * Maintain a sparse bitmap to identify stealing candidates in the RT scheduling class. Currently pull_rt_task() searches all run queues. - * Remove the core and socket levels from idle_balance(), as stealing handles those levels. Remove idle_balance() entirely when stealing across LLC is supported. - * Maintain a bitmap to identify idle cores and idle CPUs, for push balancing. - - - -_This article originally appeared at[Oracle Developers Blog][6]._ - -_Oracle Linux kernel developer Steve Sistare contributes this discussion on kernel scheduler improvements._ - -### Load balancing via scalable task stealing - -The Linux task scheduler balances load across a system by pushing waking tasks to idle CPUs, and by pulling tasks from busy CPUs when a CPU becomes idle. Efficient scaling is a challenge on both the push and pull sides on large systems. For pulls, the scheduler searches all CPUs in successively larger domains until an overloaded CPU is found, and pulls a task from the busiest group. This is very expensive, costing 10's to 100's of microseconds on large systems, so search time is limited by the average idle time, and some domains are not searched. Balance is not always achieved, and idle CPUs go unused. - -I have implemented an alternate mechanism that is invoked after the existing search in idle_balance() limits itself and finds nothing. I maintain a bitmap of overloaded CPUs, where a CPU sets its bit when its runnable CFS task count exceeds 1. The bitmap is sparse, with a limited number of significant bits per cacheline. This reduces cache contention when many threads concurrently set, clear, and visit elements. There is a bitmap per last-level cache. When a CPU becomes idle, it searches the bitmap to find the first overloaded CPU with a migratable task, and steals it. This simple stealing yields a higher CPU utilization than idle_balance() alone, because the search is cheap, costing 1 to 2 microseconds, so it may be called every time the CPU is about to go idle. Stealing does not offload the globally busiest queue, but it is much better than running nothing at all. - -### Results - -Stealing improves utilization with only a modest CPU overhead in scheduler code. In the following experiment, hackbench is run with varying numbers of groups (40 tasks per group), and the delta in /proc/schedstat is shown for each run, averaged per CPU, augmented with these non-standard stats: - - * %find - percent of time spent in old and new functions that search for idle CPUs and tasks to steal and set the overloaded CPUs bitmap. - * steal - number of times a task is stolen from another CPU. Elapsed time improves by 8 to 36%, costing at most 0.4% more find time. - - - -![load balancing][1] - -[Used with permission][2] - -​​CPU busy utilization is close to 100% for the new kernel, as shown by the green curve in the following graph, versus the orange curve for the baseline kernel: - -![][3] - -Stealing improves Oracle database OLTP performance by up to 9% depending on load, and we have seen some nice improvements for mysql, pgsql, gcc, java, and networking. In general, stealing is most helpful for workloads with a high context switch rate. - -### The code - -As of this writing, this work is not yet upstream, but the latest patch series is at [https://lkml.org/lkml/2018/12/6/1253. ][4]If your kernel is built with CONFIG_SCHED_DEBUG=y, you can verify that it contains the stealing optimization using - -``` -# grep -q STEAL /sys/kernel/debug/sched_features && echo Yes -Yes -``` - -If you try it, note that stealing is disabled for systems with more than 2 NUMA nodes, because hackbench regresses on such systems, as I explain in [https://lkml.org/lkml/2018/12/6/1250 .][5]However, I suspect this effect is specific to hackbench and that stealing will help other workloads on many-node systems. To try it, reboot with kernel parameter sched_steal_node_limit = 8 (or larger). - -### Future work - -After the basic stealing algorithm is pushed upstream, I am considering the following enhancements: - - * If stealing within the last-level cache does not find a candidate, steal across LLC's and NUMA nodes. - * Maintain a sparse bitmap to identify stealing candidates in the RT scheduling class. Currently pull_rt_task() searches all run queues. - * Remove the core and socket levels from idle_balance(), as stealing handles those levels. Remove idle_balance() entirely when stealing across LLC is supported. - * Maintain a bitmap to identify idle cores and idle CPUs, for push balancing. - - - -_This article originally appeared at[Oracle Developers Blog][6]._ - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/can-better-task-stealing-make-linux-faster - -作者:[Oracle][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.linux.com/sites/lcom/files/styles/rendered_file/public/linux-load-balancing.png?itok=2Uk1yALt (load balancing) -[2]: /LICENSES/CATEGORY/USED-PERMISSION -[3]: https://cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/b7a700fe-edc3-4ea0-876a-c91e1850b59b/Image/00c074f4282bcbaf0c10dd153c5dfa76/steal_graph.png -[4]: https://lkml.org/lkml/2018/12/6/1253 -[5]: https://lkml.org/lkml/2018/12/6/1250 -[6]: https://blogs.oracle.com/linux/can-better-task-stealing-make-linux-faster diff --git a/translated/tech/20190328 Can Better Task Stealing Make Linux Faster.md b/translated/tech/20190328 Can Better Task Stealing Make Linux Faster.md new file mode 100644 index 0000000000..bdefcdf145 --- /dev/null +++ b/translated/tech/20190328 Can Better Task Stealing Make Linux Faster.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Can Better Task Stealing Make Linux Faster?) +[#]: via: (https://www.linux.com/blog/can-better-task-stealing-make-linux-faster) +[#]: author: (Oracle ) + +更好的任务窃取可以使 Linux 更快吗? +====== + +> Oracle Linux 内核开发人员 Steve Sistare 参与了这场有关内核调度程序改进的讨论。 + +### 通过可扩展的任务窃取进行负载平衡 + +Linux 任务调度程序通过将唤醒的任务推送到空闲的 CPU,以及在 CPU 空闲时从繁忙的 CPU 中拉取任务来平衡整个系统的负载。在大型系统上的推送侧和拉取侧,有效的伸缩都是挑战。对于拉取,调度程序搜索连续的更大范围中的所有 CPU,直到找到过载的 CPU,然后从最繁忙的组中拉取任务。这代价非常昂贵,在大型系统上要花费 10 到 100 微秒,因此搜索时间受到平均空闲时间的限制,并且某些范围不会被搜索。并非总能达到平衡,而且闲置的 CPU 依旧闲置。 + +我实现了一种备用机制,该机制在 `idle_balance()` 中的现有搜索中自身受限并且没有找到之后被调用。我维护了一个过载的 CPU 的位图,当可运行的 CFS 任务计数超过 1 时,CPU 会设置该位。这个位图是稀疏的,每个高速缓存线的有效位数量有限。当许多线程同时设置、清除和访问元素时,这可以减少缓存争用。每个末级缓存都有一个位图。当 CPU 空闲时,它将搜索该位图以查找第一个具有可迁移任务的过载 CPU,然后将其窃取。这种简单的窃取会比单独的 `idle_balance()` 产生更高的 CPU 利用率,因为该搜索的成本很便宜,花费 1 到 2 微秒,因此每次 CPU 即将空闲时都可以调用它。窃取不会减轻全局最繁忙的队列的负担,但是它比根本不执行任何操作要好得多。 + +### 结果 + +偷窃仅在调度程序代码中占用少量 CPU 开销即可提高利用率。在以下实验中,以不同数量的组(每个组 40 个任务)运行 hackbench,并对每次运行结果显示 `/proc/schedstat` 中的增量(按 CPU 平均),并增加了这些非标准的统计信息: + +* `%find`:在旧函数和新函数中花费的时间百分比,这些函数用于搜索空闲的 CPU 和任务以窃取并设置过载的 CPU 位图。 +* `steal`:任务从另一个 CPU 窃取的次数。经过的时间增加了 8% 到 36%,最多增加了 0.4% 的发现时间。 + +![load balancing][1] + +​​如下图的绿色曲线所示,新内核的 CPU 繁忙利用率接近 100%,作为比较的基线内核是橙色曲线: +​​ +![][3] + +根据负载的不同,窃取可将 Oracle 数据库 OLTP 性能提高多达 9%,并且我们已经看到 MySQL、Pgsql、gcc、Java 和网络方面有了一些不错的改进。通常,窃取对上下文切换率高的工作负载最有帮助。 + +### 代码 + +截至撰写本文时,这项工作尚未完成,但最新的修补程序系列位于 [https://lkml.org/lkml/2018/12/6/1253][4]。如果你的内核是使用 `CONFIG_SCHED_DEBUG=y` 构建的,则可以使用以下命令验证其是否包含窃取优化: + +``` +# grep -q STEAL /sys/kernel/debug/sched_features && echo Yes +Yes +``` + +如果要尝试使用,请注意,对于具有 2 个以上 NUMA 节点的系统,禁用了窃取功能,因为 hackbench 在此类系统上发生了回归,正如我在 [https://lkml.org/lkml/2018/12/6/1250][5] 中解释的那样。但是,我怀疑这种影响是特定于 hackbench 的,并且窃取将有助于多节点系统上的其他工作负载。要尝试使用它,请用内核参数 `sched_steal_node_limit=8`(或更大)重新启动。 + +### 进一步工作 + +在将基本盗用算法推向上游之后,我正在考虑以下增强功能: + +* 如果在末级缓存中进行窃取找不到候选者,在 LLC 和 NUMA 节点之间进行窃取。 +* 维护稀疏位图以标识 RT 调度类中的偷窃候选者。当前 `pull_rt_task()` 搜索所有运行队列。 +* 从 `idle_balance()` 中删除核心和套接字级别,因为窃取会处理这些级别。当支持跨 LLC 窃取时,完全删除 `idle_balance()`。 +* 维护位图以标识空闲核心和空闲 CPU,以实现推平衡。 + +这篇文章最初发布于 [Oracle Developers Blog][6]。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/can-better-task-stealing-make-linux-faster + +作者:[Oracle][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.linux.com/author/oracle/ +[b]: https://github.com/lujun9972 +[1]: https://lcom.static.linuxfound.org/sites/lcom/files/linux-load-balancing.png (load balancing) +[3]: https://cdn.app.compendium.com/uploads/user/e7c690e8-6ff9-102a-ac6d-e4aebca50425/b7a700fe-edc3-4ea0-876a-c91e1850b59b/Image/00c074f4282bcbaf0c10dd153c5dfa76/steal_graph.png +[4]: https://lkml.org/lkml/2018/12/6/1253 +[5]: https://lkml.org/lkml/2018/12/6/1250 +[6]: https://blogs.oracle.com/linux/can-better-task-stealing-make-linux-faster From 6dd08246ae3965ce55a2634e320f658eb755f071 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 23 Nov 2019 23:59:30 +0800 Subject: [PATCH 601/800] PUB @wxy https://linux.cn/article-11607-1.html --- .../20190328 Can Better Task Stealing Make Linux Faster.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190328 Can Better Task Stealing Make Linux Faster.md (97%) diff --git a/translated/tech/20190328 Can Better Task Stealing Make Linux Faster.md b/published/20190328 Can Better Task Stealing Make Linux Faster.md similarity index 97% rename from translated/tech/20190328 Can Better Task Stealing Make Linux Faster.md rename to published/20190328 Can Better Task Stealing Make Linux Faster.md index bdefcdf145..338343daee 100644 --- a/translated/tech/20190328 Can Better Task Stealing Make Linux Faster.md +++ b/published/20190328 Can Better Task Stealing Make Linux Faster.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11607-1.html) [#]: subject: (Can Better Task Stealing Make Linux Faster?) [#]: via: (https://www.linux.com/blog/can-better-task-stealing-make-linux-faster) [#]: author: (Oracle ) @@ -10,6 +10,8 @@ 更好的任务窃取可以使 Linux 更快吗? ====== +![](https://img.linux.net.cn/data/attachment/album/201911/23/235729l71755he6e4mpvkq.jpg) + > Oracle Linux 内核开发人员 Steve Sistare 参与了这场有关内核调度程序改进的讨论。 ### 通过可扩展的任务窃取进行负载平衡 From b1c1e12f3d3932ea4fe383d02e82317feda29b3f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 24 Nov 2019 00:57:00 +0800 Subject: [PATCH 602/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191124=20Bauh?= =?UTF-8?q?=20=E2=80=93=20Manage=20Snaps,=20Flatpaks=20and=20AppImages=20f?= =?UTF-8?q?rom=20One=20Interface?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md --- ...atpaks and AppImages from One Interface.md | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md diff --git a/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md b/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md new file mode 100644 index 0000000000..cba1d0704f --- /dev/null +++ b/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bauh – Manage Snaps, Flatpaks and AppImages from One Interface) +[#]: via: (https://itsfoss.com/bauh-package-manager/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Bauh – Manage Snaps, Flatpaks and AppImages from One Interface +====== + +One of the biggest problems with universal packages like [Snap][1], [Flatpak][2] and [AppImage][3] is managing them. Most built-in package managers do not support all of these new formats. + +Thankfully, I stumbled across an application that supports several universal package formats. + +### Bauh – a Manager for Your Multi-Package Needs + +Originally named fpakman, [bauh][4] is designed to handle Flatpak, Snap, [AppImage][5], and [AUR][6] packages. Creator [vinifmor][7] started the project in June’19 with the [intention][8] of “giving a graphical interface to manage Flatpaks for Manjaro users.” Since then, he has expanded the application to add support for Debian-based systems. + +![Bauh About][9] + +When you first open bauh, it will scan your installed applications and check for updates. If there are any that need to be updated, they will be listed front and center. Once all the packages are updated, you will see a list of packages you have installed. You can deselect a package with updates to prevent it from being updated. You can also choose to install a previous version of the application. + +![With Bauh you can manage various types of packages from one application][10] + +You can also search for applications. Bauh has detailed information for both installed and searched packages. If you are not interested in one (or more) of the packaging types, you can deselect them in settings. + +### Installing bauh on your Linux distribution + +Let’s see how to install bauh. + +#### Arch-based distributions + +If you have a recent install of [Manjaro][11], you should be all set. Bauh comes installed by default. If you have an older install of Manjaro (like I do) or a different Arch-based distro, you can install it from the [AUR][12] by typing this in terminal: + +``` +sudo pacman -S bauh +``` + +![Bauh Package Info][13] + +#### Debian/Ubuntu based distributions + +If you have a Debianor Ubuntubased Linux distribution, you can install bauh with pip. First, make sure to [install pip on Ubuntu][14]. + +``` +sudo apt install python3-pip +``` + +And then use it to install bauh: + +``` +pip3 install bauh +``` + +However, the creator recommends installing it [manually][15] to avoid messing up your system’s libraries. + +To install bauh manually, you have to first download the [latest release][16]. Once you download it, you can [unzip using a graphical tool][17] or the [unzip command][18]. Next, open up the folder in your terminal. You will need to use the following steps to complete the install. + +First, create a virtualenv in a folder called env: + +``` +python3 -m venv env +``` + +Now install the application code inside the env: + +``` +env/bin/pip install . +``` + +And launch the application: + +``` +env/bin/bauh +``` + +![Bauh Updating][19] + +Once you finish installing bauh, you can [fine-tune][20] it by changing the environment setting and arguments. + +### The road ahead for bauh + +Bauh has grown quite a bit in a few short months. It plans to continue to grow. The current [road map][21] includes: + + * Support for other packaging technologies + * Separate modules for each packaging technology + * Memory and performance improvements + * Improve the user experience + + + +![Bauh Search][22] + +### Final thoughts + +When I tried out bauh, I ran into a couple of issues. When I opened it up for the first time, it told me that Snap was not installed and that I would have to install it if I wanted to use Snaps. I know that Snap is installed because I ran `snap list` in the terminal and it worked. I restarted the system and snaps worked. + +The other issue I ran into was that one of my AUR packages failed to update. I was able to update the package without any issue with `yay`. There might be an issue with my install of Manjaro, I’ve had it going for 3 or 4 years. + +Overall, bauh worked. It did what was printed on the tin. I can’t ask for more than that. + +Have you ever used bauh? What is your favorite tool to manage different package formats if there is one? 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][23]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bauh-package-manager/ + +作者:[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://snapcraft.io/ +[2]: https://flatpak.org/ +[3]: https://appimage.org/ +[4]: https://github.com/vinifmor/bauh +[5]: https://itsfoss.com/use-appimage-linux/ +[6]: https://itsfoss.com/best-aur-helpers/ +[7]: https://github.com/vinifmor +[8]: https://forum.manjaro.org/t/bauh-formerly-known-as-fpakman-a-gui-for-flatpak-and-snap-management/96180 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-about.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh.jpg?ssl=1 +[11]: https://manjaro.org/ +[12]: https://aur.archlinux.org/packages/bauh +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-package-info.jpg?ssl=1 +[14]: https://itsfoss.com/install-pip-ubuntu/ +[15]: https://github.com/vinifmor/bauh#manual-installation +[16]: https://github.com/vinifmor/bauh/releases +[17]: https://itsfoss.com/unzip-linux/ +[18]: https://linuxhandbook.com/unzip-command/ +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-updating.jpg?ssl=1 +[20]: https://github.com/vinifmor/bauh#general-settings +[21]: https://github.com/vinifmor/bauh#roadmap +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-search.png?resize=800%2C319&ssl=1 +[23]: https://reddit.com/r/linuxusersgroup From 418c6b8abd5d210869c25129106158b9482c0773 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 24 Nov 2019 00:59:55 +0800 Subject: [PATCH 603/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191122=20How=20?= =?UTF-8?q?to=20use=20Bitwarden=20for=20password=20protection=20on=20Activ?= =?UTF-8?q?e=20Directory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191122 How to use Bitwarden for password protection on Active Directory.md --- ...password protection on Active Directory.md | 219 ++++++++++++++++++ 1 file changed, 219 insertions(+) create mode 100644 sources/tech/20191122 How to use Bitwarden for password protection on Active Directory.md diff --git a/sources/tech/20191122 How to use Bitwarden for password protection on Active Directory.md b/sources/tech/20191122 How to use Bitwarden for password protection on Active Directory.md new file mode 100644 index 0000000000..67b79f1c64 --- /dev/null +++ b/sources/tech/20191122 How to use Bitwarden for password protection on Active Directory.md @@ -0,0 +1,219 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Bitwarden for password protection on Active Directory) +[#]: via: (https://opensource.com/article/19/11/bitwarden-password-protection-active-directory) +[#]: author: (Stephen Bancroft https://opensource.com/users/stevereaver) + +How to use Bitwarden for password protection on Active Directory +====== +Integrate your Linux self-hosted Bitwarden instance with AD using +Bitwarden Directory Connector. +![A lock on the side of a building][1] + +[Bitwarden][2] is a fantastic tool for managing passwords. It has applications for every platform, a browser plugin, and a self-hosted version, and it offers some great password management tricks like folders and collections. One of my favorite features is that it will keep a history of your old passwords, which is a great feature for enterprise users. + +If you are an enterprise user, you are probably self-hosting Bitwarden and want to sync your users with a staff directory. My organization uses Active Directory (AD), which is the standard for user directories and integrates seamlessly with Windows desktops. I also need it to work with our open source tools, and herein lies the secret sauce shared in this article. + +The tool that allows you to do this is [Bitwarden Directory Connector][3] (BWDC). If you do a Google search, you will not find much information on using BWDC with AD on Linux. [Bitwarden's blog][4] is a great starting point if you're using the Windows version but it won't help you integrate it into your Linux environment. You can find instructions to do that on Bitwarden's GitHub page, but they aren't very clear. So, here I'll explain how to get your Linux self-hosted version of Bitwarden to integrate with your enterprise Active Directory (and, hopefully, provide more fruitful results for future Google searchers looking for this information). + +In my setup, both Bitwarden and Active Directory are hosted on AWS, the former in an EC2 instance and the latter in AWS Simple Directory. The Bitwarden Docker container is installed in the home directory of a user called **bitwarden**. [Bitwarden's instructions][5] make this easy to set up. But setting up BWDC is not as clear, so I will try to fix that here. + +### Install BWDC + +Start by setting up a directory for BWDC, then download the ZIP file and unzip it: + + +``` +cd /home/bitwarden +mkdir directory-connector +cd directory-connector +wget +unzip bwdc-linux-2.6.2.zip +chmod +x bwdc +``` + +(At the time of this writing, BWDC 2.6.2 was the current version; that may change, so make sure to download the latest release.) + +You will now have a binary file called **bwdc** and a file called **keytar.node**; leave both files right where they are. + +Next, edit the profile of the **bitwarden** user: + + +``` +`vi /home/bitwarden/.profile` +``` + +and add the lines: + + +``` +export BITWARDENCLI_CONNECTOR_PLAINTEXT_SECRETS=true +export PATH=$PATH:/home/bitwarden/directory-connector +``` + +Log out and back in to pick up the new settings, or you can source the profile with: + + +``` +`  . ~/.profile` +``` + +The line **BITWARDENCLI_CONNECTOR_PLAINTEXT_SECRETS=true** tells BWDC not to use any desktop-based keystore. Since this is a server and it's unlikely to have a desktop installed, you will have to keep the password in plain text (but you will take precautions to protect it later). The second line sets up a path to the **bwdc** binary so it can run from any directory you are in. + +### Configure BWDC + +Once BWDC is installed, configure it to connect to your Bitwarden instance: + + +``` +bwdc login +? Email address: <your email for your master account> +? Master password: [hidden] +``` + +After you are logged in, you're ready to work on the **data.json** file. + +If you set up BWDC using the steps above, its configuration information will be stored in **/home/bitwarden/.config/Bitwarden Directory Connector/data.json**. This file contains the **appId** and **access token**; these are the login credentials for your Bitwarden instance. But what about Active Directory, you say? You can add that manually by editing your **data.json** file (I assume you are on a server and are using Vi): + + +``` +`vi '/home/bitwarden/.config/Bitwarden Directory Connector/data.json'` +``` + +Add the following just underneath the **appId** line: + + +``` +"rememberEmail": true, +  "rememberedEmail": "<the email address you logged in with>", +  "organizationId": "<your organization id>", +  "directoryType": 0, +  "directoryConfig_0": { +    "ssl": false, +    "sslAllowUnauthorized": false, +    "port": 389, +    "currentUser": false, +    "ad": true, +    "hostname": "<hostname of your active directory>", +    "rootPath": "<root path of AD, something like; dc=com,dc=au>", +    "username": "<username with privilege to read the AD; DOMAIN\\\Username>", +    "password": "<password for the above account>" +  }, +  "directoryConfig_2": {}, +  "directoryConfig_1": {}, +  "directoryConfig_3": {}, +  "syncConfig": { +    "users": true, +    "groups": true, +    "interval": 5, +    "removeDisabled": true, +    "overwriteExisting": true, +    "useEmailPrefixSuffix": false, +    "creationDateAttribute": "whenCreated", +    "revisionDateAttribute": "whenChanged", +    "emailPrefixAttribute": "sAMAccountName", +    "memberAttribute": "member", +    "userObjectClass": "person", +    "groupObjectClass": "group", +    "userEmailAttribute": "mail", +    "groupNameAttribute": "name", +    "userFilter": "(&(memberOf=CN=bitwarden,OU=groups,DC=work,DC=corp))", +    "groupPath": "OU=Groups", +    "userPath": "CN=Users" +  }, +  "environmentUrls": { +    "base": "<base url of your bitwarden instance; [https://bitwarden.yourdomain\>][6]", +    "api": null, +    "identity": null, +    "webVault": null, +    "icons": null, +    "notifications": null, +    "events": null +  }, +``` + +If you look through this, you'll see that you need to change several values in this entry, including the **userFilter**, **groupPath**, and **userPath**. (I will assume you are familiar with LDAP and AD and know what those values should be for your instance.) Keep the **CN=bitwarden** part for the Bitwarden AD group you will create later. The other value you need to change is **organizationID**, which you can find in your **bwdata** directory as the name of one of the JSON files. List the files: + + +``` +`ls /home/bitwarden/bwdata/core/licenses/organization` +``` + +This should return a directory listing, containing a single filename in the form **<organization id>.json**. The filename itself is your organization's ID. Insert it into the **organizationID** line in the code above. + +Once you get your **data.json** file right, _I **highly** recommend you back up this file_. There seems to be an issue that sets this file back to default settings if BWDC finds a problem with it. This means if you innocently make a change to the file and there is a mistake, you will lose the entire configuration. + +Next, test connectivity to your AD as the **bitwarden** user: + + +``` +`bwdc test` +``` + +This should return a dump of the groups in your AD. To protect your password, set the permissions on that file so that only the **bitwarden** user can read it: + + +``` +`chmod 700 '/home/bitwarden/.config/Bitwarden Directory Connector/data.json'` +``` + +### Set up your group + +Now add a group to your AD (my group is called **bitwarden**), where you will add and remove users as they need access to Bitwarden. This group is necessary because, if you don't filter the users based on this group, BWDC will try to use ALL users in your AD. If the number of users is greater than your Bitwarden license allows, BWDC will fail silently, and you will hate yourself for a long time…. much like I did! + +Once the group is set up and has at least one user, run the test again. You should see your user's email address in the output. + +Now it is time to sync. Once you sync, any users that appear in the **bitwarden** group will be added to Bitwarden, and an email will be sent to them to invite them to sign up. Working as the **bitwarden** user, sync the directories with: + + +``` +`bwdc sync` +``` + +Given that **removeDisabled** is set to **true** in the **data.json** file, you can set up a cron job to keep the members of the **bitwarden** group and the Bitwarden users in constant sync so that any changes you make in your AD are immediately reflected in your Bitwarden instance. Add the following to your **/etc/crontab**: + + +``` +# Sync for Active Directory to Bitwarden +* *     * * *   bitwarden export BITWARDENCLI_CONNECTOR_PLAINTEXT_SECRETS=true ; /home/bitwarden/directory-connector/bwdc sync >/dev/null 2>&1 +``` + +Once you have auto-sync going, you will have a complete list of all your AD groups in Bitwarden. From there, it's just a simple matter of assigning a group to a collection and then adding members to groups in your AD. The users will be automatically assigned to the correct password collections and see the passwords they need. + +### Potential traps + +Finally, I will tell you about a few little traps that I fell into when setting this up. First, be aware of the **AD Primary Group**. You may have set this for a user if any of your Linux or other POSIX systems get login credentials from AD. It seems that AD will not include a user in group search results if that group is set as the primary group; this could remove a user from a group and therefore lose access to a collection. + +Second, when you need to delete a user, you might think that removing an account from the group in AD would remove the user… wrong! It seems that Bitwarden keeps some user information hanging around in its database. This became painfully obvious when I removed my own account and then discovered that I was no longer able to log in after recreating it because the multi-factor authentication (MFA) was still active and the token had expired, effectively locking me out. You must explicitly tell Bitwarden to remove that stuff in the database. To do so, go to the URL: + + +``` +`https:///#/recover-delete` +``` + +Enter the email address the user signed up with. They will get an email instructing them to click a link to confirm to remove the account. Once that is done, the user can be put back in the Bitwarden AD group and go through the sign-on process again. + +Now you know how to get your self-hosted Bitwarden working with your AD. I think you will still experience a few issues, but with a little bit of patience and tinkering with the configuration, it will work. Just don't muck around with it too much once it is working! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/bitwarden-password-protection-active-directory + +作者:[Stephen Bancroft][a] +选题:[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/stevereaver +[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://bitwarden.com/ +[3]: https://github.com/bitwarden/directory-connector +[4]: https://blog.bitwarden.com/organization-user-groups-directory-sync-ba674cb78a5c +[5]: https://help.bitwarden.com/article/install-on-premise/ +[6]: https://bitwarden.yourdomain\> From 98cc122aeb5c50d84adabe3530e2651d1575566e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 24 Nov 2019 08:58:03 +0800 Subject: [PATCH 604/800] APL --- sources/tech/20190718 What you need to know to be a sysadmin.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190718 What you need to know to be a sysadmin.md b/sources/tech/20190718 What you need to know to be a sysadmin.md index 55947b8456..8769d7a246 100644 --- a/sources/tech/20190718 What you need to know to be a sysadmin.md +++ b/sources/tech/20190718 What you need to know to be a sysadmin.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ecefa32b454b51435871e29ce557e276ff7dd071 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 24 Nov 2019 10:33:22 +0800 Subject: [PATCH 605/800] TSL&PRF --- ... What you need to know to be a sysadmin.md | 121 ----------------- ... What you need to know to be a sysadmin.md | 122 ++++++++++++++++++ 2 files changed, 122 insertions(+), 121 deletions(-) delete mode 100644 sources/tech/20190718 What you need to know to be a sysadmin.md create mode 100644 translated/talk/20190718 What you need to know to be a sysadmin.md diff --git a/sources/tech/20190718 What you need to know to be a sysadmin.md b/sources/tech/20190718 What you need to know to be a sysadmin.md deleted file mode 100644 index 8769d7a246..0000000000 --- a/sources/tech/20190718 What you need to know to be a sysadmin.md +++ /dev/null @@ -1,121 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What you need to know to be a sysadmin) -[#]: via: (https://opensource.com/article/19/7/be-a-sysadmin) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/kimvila) - -What you need to know to be a sysadmin -====== -Kickstart your sysadmin career by gaining these minimum competencies. -![People work on a computer server with devices][1] - -The system administrator of yesteryear jockeyed users and wrangled servers all day, in between mornings and evenings spent running hundreds of meters of hundreds of cables. This is still true today, with the added complexity of cloud computing, containers, and virtual machines. - -Looking in from the outside, it can be difficult to pinpoint what exactly a sysadmin does, because they play at least a small role in so many places. Nobody goes into a career already knowing everything they need for a job, but everyone needs a strong foundation. If you're looking to start down the path of system administration, here's what you should be concentrating on in your personal or formal training. - -### Bash - -When you learn the Bash shell, you don't just learn the Bash shell. You learn a common interface to Linux systems, BSD, MacOS, and even Windows (under the right conditions). You learn the importance of syntax, so you can quickly adapt to systems like Cisco routers' command line or Microsoft's PowerShell, and eventually, you can even learn more powerful languages like Python or Go. And you also begin to think procedurally so you can analyze complex problems and break them down into individual components, which is key because _that's_ how systems, like the internet, or an organization's intranet, or a web server, or a backup solution, are designed. - -But wait. There's more. - -Knowing the Bash shell has become particularly important because of the recent trend toward DevOps and [containers][2]. Your career as a sysadmin may lead you into a world where infrastructure is treated like code, which usually means you'll have to know the basics of scripting, the structure of [YAML-based][3] configuration, and how to [interact][4] with [containers][5] (tiny Linux systems running inside a [sandboxed file][6]). Knowing Bash is the gateway to efficient management of the most exciting open source technology, so go get [Bourne Again][7]. - -#### Resources - -There are many ways to get practice in the Bash shell. - -Try a [portable Linux distribution][8]. You don't have to install Linux to use Linux, so grab a spare thumb drive and spend your evenings or weekends getting comfortable with a text-based interface. - -There are several excellent [Bash articles][9] available here on opensource.com as well as [on Enable SysAdmin][10]. - -The problem with telling someone to practice with Bash is that to practice, you must have something to do. And until you know how to use Bash, you probably won't be able to think of anything to do. If that's your situation, go to Over The Wire and play [Bandit][11]. It's a game aimed at absolute beginners, with 34 levels of interactive basic hacking to get you comfortable with the Linux shell. - -### Web server setup - -Once you're comfortable with Bash, you should try setting up a web server. Not all sysadmins go around setting up web servers or even maintain web servers, but the skills you acquire while installing and starting the HTTP daemon, configuring Apache or Nginx, setting up the [correct permissions][12], and [configuring a firewall][13], are the same skills you need on a daily basis. After a little bit of effort, you may start to notice certain patterns in your labor. There are concepts you probably took for granted before trying to administer production-ready software and hardware, and you're no longer shielded from them in your fledgling role as an administrator. It might be frustrating at first because everyone likes to be good at everything they do, but that's actually a good thing. Let yourself be bad at new skills. That's how you learn. - -And besides, the more you struggle through your first steps, the sweeter it is when you finally see that triumphant "it works!" default index.html. - -#### Resources - -David Both wrote an excellent article on [Apache web server][14] configuration. For extra credit, step through his follow-up article on how to [host multiple sites][15] on one machine. - -### DHCP - -The Dynamic Host Configuration Protocol (DHCP) is the system that assigns IP addresses to devices on a network. At home, the modem or router your ISP (internet service provider) supports probably has an embedded DHCP server in it, so it's likely out of your purview. If you've ever logged into your home router to adjust the IP address range or set up a static address for some of your network devices, then you're at least somewhat familiar with the concept. You may understand that devices on a network are assigned the equivalent of phone numbers in the form of IP addresses, and you may realize that computers communicate with one another by broadcasting messages addressed to a specific IP address. Message headers are read by routers along the path, each of which works to direct the message to the next most logical router along the path toward its ultimate goal. - -Even if you understand these concepts, the inevitable escalation of basic familiarity with DHCP is to set up a DHCP server. Installing and configuring your own DHCP server provides you the opportunity to introduce DHCP collisions on your home network (try to avoid that, if you can, as it will definitely kill your network until it's resolved), control the distribution of addresses, create subnets, and monitor connections and lease times. - -More importantly, setting up DHCP and experimenting with different configurations helps you understand inter-networking. You understand how networks represent "partitions" in data transference and what steps you have to take to pass information from one to the other. That's vital for a sysadmin to know because the network is easily one of the most important aspects of the job. - -#### Resources - -Before running your own DHCP server, ensure that the DHCP server in your home router (if you have one) is inactive. Once you have it up and running, read Archit Modi's [guide to network commands][16] for tips on how to explore your network. - -### Network cables - -It might sound mundane, but getting familiar with how network cables work not only makes for a really fun weekend but also gives you a whole new understanding of how data gets across the wires. The best way to learn is to go to your local hobby shop and purchase a Cat 5 cutter and crimper and a few Cat 5 terminators. Then head home, grab a spare Ethernet cable, and cut the terminators off. Spend whatever amount of time it takes to get that cable back in commission. - -Once you have solved that puzzle, do it again, this time creating a working [crossover cable][17]. - -You should also start obsessing _now_ about cable management. If you're not naturally inclined to run cables neatly along the floor molding or the edges of a desk or to bind cables together to keep them orderly, then make it a goal to permanently condition yourself with a phobia of messy cables. You won't understand why this is necessary at first, but the first time you walk into a server room, you will immediately know. - -### Ansible - -[Ansible][18] is configuration management software, and it's a bit of a bridge between sysadmin and DevOps. Sysadmins use Ansible to configure fresh installs of an operating system and to maintain specific states on machines. DevOps uses Ansible to reduce time and effort spent on tooling so that more time and effort gets spent on developing. You should learn Ansible as part of your sysadmin training, with an eye toward the practices of DevOps, because most of what DevOps is pioneering now will end up as part of your workflow in the system administration of the future. - -The good thing about Ansible is that you can start using it now. It's cross-platform, and it scales both up and down. Ansible may be overkill for a single-user computer, but then again, Ansible could change the way you spin up virtual machines, or it could help you synchronize the states of all the computers in your home or [home lab][19]. - -#### Resources - -Read "[How to manage your workstation configuration with Ansible][20]" by Jay LaCroix for the quintessential introduction to get started with Ansible on a casual basis. - -### Break stuff - -Problems arise on computers because of user error, buggy software, administrator (that's you!) error, and any number of other factors. There's no way to predict what's going to fail or why, so part of your personal sysadmin training regime should be to poke at the systems you set up until they fail. The worse you are to your own lab infrastructure, the more likely you are to find weak points. And the more often you repair those weak spots, the more confident you become in your problem-solving skills. - -Aside from the rigors of setting up all the usual software and hardware, your primary job as a sysadmin is to find solutions. There will be times when you encounter a problem outside your job description, and it may not even be possible for you to fix it, but it'll be up to you to find a workaround. - -The more you break stuff now and work to fix it, the better prepared you will be to work as a sysadmin. - -* * * - -Are you a working sysadmin? Are there tasks you wish you'd prepared better for? Add them in the comments below! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/be-a-sysadmin - -作者:[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/sethhttps://opensource.com/users/marcobravohttps://opensource.com/users/kimvila -[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://opensource.com/article/19/6/kubernetes-dump-truck -[3]: https://www.redhat.com/sysadmin/yaml-tips -[4]: https://opensource.com/article/19/6/how-ssh-running-container -[5]: https://opensource.com/resources/what-are-linux-containers -[6]: https://opensource.com/article/18/11/behind-scenes-linux-containers -[7]: https://opensource.com/article/18/7/admin-guide-bash -[8]: https://opensource.com/article/19/6/linux-distros-to-try -[9]: https://opensource.com/tags/bash -[10]: https://www.redhat.com/sysadmin/managing-files-linux-terminal -[11]: http://overthewire.org/wargames/bandit -[12]: https://opensource.com/article/19/6/understanding-linux-permissions -[13]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd -[14]: https://opensource.com/article/18/2/how-configure-apache-web-server -[15]: https://opensource.com/article/18/3/configuring-multiple-web-sites-apache -[16]: https://opensource.com/article/18/7/sysadmin-guide-networking-commands -[17]: https://en.wikipedia.org/wiki/Ethernet_crossover_cable -[18]: https://opensource.com/sitewide-search?search_api_views_fulltext=ansible -[19]: https://opensource.com/article/19/6/create-centos-homelab-hour -[20]: https://opensource.com/article/18/3/manage-workstation-ansible diff --git a/translated/talk/20190718 What you need to know to be a sysadmin.md b/translated/talk/20190718 What you need to know to be a sysadmin.md new file mode 100644 index 0000000000..0c105f90ae --- /dev/null +++ b/translated/talk/20190718 What you need to know to be a sysadmin.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What you need to know to be a sysadmin) +[#]: via: (https://opensource.com/article/19/7/be-a-sysadmin) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +你需要知道什么才能成为系统管理员? +====== + +> 通过获得这些起码的能力,开始你的系统管理员职业。 + +![People work on a computer server with devices][1] + +昔日的系统管理员整天都在调教用户和摆弄服务器,一天的时间都奔波在几百米长的电缆之间。随着云计算、容器和虚拟机的复杂性的增加,而今依然如此。 + +以外行人来看,很难准确确定系统管理员的确切职能,因为他们在许多地方都扮演着一个不起眼的角色。没人能在培训中知道自己工作中所需要的一切知识,但是每个人其实都需要一个坚实的基础。如果你想走上系统管理的道路,那么这是你个人自学或在正式培训中应重点关注的内容。 + +### Bash + +当你学习 Bash Shell 时,你学习的不仅是 Bash Shell,你学习的也是 Linux、BSD、MacOS 甚至Windows(在适当条件下)的通用界面。你将了解语法的重要性,因此可以快速适应思科路由器的命令行或微软 PowerShell 等系统,最终你甚至可以学习更强大的语言,如 Python 或 Go。而且,你还会开始进行程序性思考,以便可以分析复杂的问题并将其分解为单个组件,这很关键,因为这就是系统(例如互联网、组织的内部网、Web 服务器、备份解决方案)是如何设计的。 + +不止于此,还有更多。 + +由于最近 DevOps 和[容器][2]的发展趋势,了解 Bash shell 变得尤为重要。你的系统管理员职业可能会将你带入一个视基础设施为代码的世界,这通常意味着你必须了解脚本编写的基础知识、[基于 YAML][3]配置的结构,以及如何与[容器][5](运行在[沙盒文件][6]内部的微型 Linux 系统)[交互][4]。你会知道 Bash 是高效管理激动人心的开源技术的门户,因此请进入 [Bash][7] 世界吧。 + +#### 资源 + +有很多方法可以在 Bash shell 中进行练习。 + +尝试一下[便携式 Linux 发行版][8]。你无需安装 Linux 即可使用 Linux,因此,请拿一块闲置的 U 盘,花个晚上或周末的空闲时光,来适应基于文本的界面。 + +这里有[几篇很棒的][10] [Bash 文章][9]。 + +要注意的是 Bash 练习的关键在于要练习,你必须有要做的练习才行。而且,在你知道如何使用 Bash 之前,你可能不知道该练习什么。如果是这样,请去 Over The Wire 玩一下 [Bandit][11] 游戏。这是一款针对绝对初学者的游戏,具有 34 个级别的交互式基本技巧,可让你熟悉 Linux shell。 + +### Web 服务器设置 + +一旦你习惯了 Bash,你应该尝试设置一个 Web 服务器。并不是所有的系统管理员都会四处设置 Web 服务器甚至维护 Web 服务器,但是你在安装和启动 HTTP 守护程序、配置 Apache 或 Nginx,设置[正确权限][12]和[配置防火墙][13]时所掌握的技能是你每天都需要使用的技能。经过一些努力,你可能会开始注意到自己的某些工作模式。在尝试管理可用于生产环境的软件和硬件之前,你可能认为某些概念是理所当然的,而你在成为新手的管理员角色时,将不再受到它们的影响。起初这可能会令人沮丧,因为每个人都喜欢在自己做好所做的事情,但这实际上是一件好事。让自己接触新技能,那就是你学习的方式。 + +此外,你在第一步中付出的努力越多,最终当你在默认的 index.html 上看到胜利的“it works!”就越甜蜜! + +#### 资源 + +David Both 撰写了有关 [Apache Web 服务器][14]配置的出色文章。值得一提的是,请逐步阅读他的后续文章,其中介绍了如何在一台计算机上[托管多个站点][15]。 + +### DHCP + +动态主机配置协议(DHCP)是为网络上的设备分配 IP 地址的系统。在家里,ISP(互联网服务提供商)支持的调制解调器或路由器可能内置了 DHCP 服务器,因此可能不在你的权限范围内。如果你曾经登录家用路由器来调整 IP 地址范围或为某些网络设备设置了静态地址,那么你至少对该概念有所了解。你可能会将其理解为对网络上的设备分配了一种 IP 地址形式的电话号码,并且你可能会意识到计算机之间通过广播发送到特定 IP 地址的消息彼此进行通信。消息标头由路径上的路由器读取,每个消息标头都将消息定向到路径上的第二个逻辑路由器,以达到其最终目标。 + +即使你了解了这些概念,要从对 DHCP 的基本了解再进一步是架设 DHCP 服务器。安装和配置自己的 DHCP 服务器可能会导致家庭网络中的 DHCP 冲突(如果可以的话,请尽量避免这样做,因为它肯定会干掉你的网络,直到解决为止),要控制地址的分配、创建子网,并监控连接和租赁时间。 + +更重要的是,设置 DHCP 并尝试不同的配置有助于你了解网络之间的关系。你会了解网络如何在数据传输中表示“分区”,以及必须采取哪些步骤才能将信息从一个网络传递到另一个。这对于系统管理员来说至关重要,因为网络肯定是工作中最重要的方面之一。 + +#### 资源 + +在运行自己的 DHCP 服务器之前,请确保家庭路由器(如果有)中的 DHCP 服务器处于非活动状态。一旦启动并运行了 DHCP 服务器,请阅读 Archit Modi 的[网络命令指南][16],以获取有关如何探索网络的提示。 + +### 网络电缆 + +这听起来很普通,但是熟悉网络电缆的工作方式不仅使你的周末变得非常有趣,而且还使你对数据是如何通过缆线的得到了全新的了解。最好的学习方法是去当地的业余爱好商店并购买五类线剥线钳和压线钳以及一些五类线水晶头。然后回家,拿一根备用的以太网电缆,切断水晶头,花一些时间重新制作网线接头,将电缆重新投入使用。 + +解决了这个难题后,请再做一次,这次创建一条有效的[交叉电缆][17]。 + +你现在应该还在沉迷于有关电缆管理。如果你有些强迫症,喜欢沿着地板线或桌子的边缘整齐地排列电缆,或者将电缆绑在一起以保持它们的整齐有序,那么就可以使自己免受永久混乱的电缆困扰。你一开始可能不会理解这样做的必要性,但是当你第一次走进服务器机房时,你会马上知道原因。 + +### Ansible + +[Ansible][18] 是配置管理软件,它在系统管理员和 DevOps 之间架起了一座桥梁。系统管理员使用 Ansible 来配置全新安装的操作系统并在计算机上维护特定的状态。DevOps 使用 Ansible 减少了在工具上花费的时间和精力,从而在开发上可以花费更多的时间和精力。作为系统管理员培训的一部分,你应该学习 Ansible,并着眼于 DevOps 实践,因为 DevOps 现在开创的大多数功能将最终成为将来系统管理中工作流的一部分。 + +Ansible 的好处是你可以立即开始使用它。它是跨平台的,并且可以向上和向下缩放。对于单用户计算机, Ansible 可能是小题大做,但是话又说回来,Ansible 可能会改变你启动虚拟机的方式,或者可以帮助你同步家庭或[家庭实验室][19]中所有计算机的状态。 + + +#### 资源 + +阅读 Jay LaCroix 的[如何使用 Ansible 管理工作站配置][20]中的典型介绍,以轻松地在日常之中开始使用 Ansible。 + +### 破坏 + +由于用户的错误、软件的错误、管理员(就是你!)的错误以及许多其他因素,计算机上会出现问题。无法预测将要失败的原因,因此你的个人系统管理员培训制度的一部分应该是破坏你设置的系统,直到它们失败为止。你自己的实验室基础设施越是脆弱,发现弱点的可能性就越大。而且,你越是经常修复这些弱点,你对解决问题的能力就越有信心。 + +除了严格设置所有常见的软件和硬件之外,作为系统管理员的主要工作是查找解决方案。有时候,你可能会遇到职位描述之外的问题,甚至可能无法解决,但这完全取决于你的解决方法。 + +现在,你越多地折腾并努力加以解决,则以系统管理员的身份进行的准备就越充分。 + +你是系统管理员吗?你是否希望自己为更好的任务做好准备?在下面的评论中写下它们! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/be-a-sysadmin + +作者:[Seth Kenlon][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/seth +[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://opensource.com/article/19/6/kubernetes-dump-truck +[3]: https://www.redhat.com/sysadmin/yaml-tips +[4]: https://opensource.com/article/19/6/how-ssh-running-container +[5]: https://opensource.com/resources/what-are-linux-containers +[6]: https://opensource.com/article/18/11/behind-scenes-linux-containers +[7]: https://opensource.com/article/18/7/admin-guide-bash +[8]: https://opensource.com/article/19/6/linux-distros-to-try +[9]: https://opensource.com/tags/bash +[10]: https://www.redhat.com/sysadmin/managing-files-linux-terminal +[11]: http://overthewire.org/wargames/bandit +[12]: https://opensource.com/article/19/6/understanding-linux-permissions +[13]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd +[14]: https://opensource.com/article/18/2/how-configure-apache-web-server +[15]: https://opensource.com/article/18/3/configuring-multiple-web-sites-apache +[16]: https://opensource.com/article/18/7/sysadmin-guide-networking-commands +[17]: https://en.wikipedia.org/wiki/Ethernet_crossover_cable +[18]: https://opensource.com/sitewide-search?search_api_views_fulltext=ansible +[19]: https://opensource.com/article/19/6/create-centos-homelab-hour +[20]: https://opensource.com/article/18/3/manage-workstation-ansible From 4e4270d47cae45960e5497aa2f59cb0b5c9729a5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 24 Nov 2019 10:46:39 +0800 Subject: [PATCH 606/800] PUB --- .../20190718 What you need to know to be a sysadmin.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/talk => published}/20190718 What you need to know to be a sysadmin.md (98%) diff --git a/translated/talk/20190718 What you need to know to be a sysadmin.md b/published/20190718 What you need to know to be a sysadmin.md similarity index 98% rename from translated/talk/20190718 What you need to know to be a sysadmin.md rename to published/20190718 What you need to know to be a sysadmin.md index 0c105f90ae..02361c4766 100644 --- a/translated/talk/20190718 What you need to know to be a sysadmin.md +++ b/published/20190718 What you need to know to be a sysadmin.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11608-1.html) [#]: subject: (What you need to know to be a sysadmin) [#]: via: (https://opensource.com/article/19/7/be-a-sysadmin) [#]: author: (Seth Kenlon https://opensource.com/users/seth) @@ -12,7 +12,7 @@ > 通过获得这些起码的能力,开始你的系统管理员职业。 -![People work on a computer server with devices][1] +![](https://img.linux.net.cn/data/attachment/album/201911/24/103900w5m09jyyyeyrnovu.jpg) 昔日的系统管理员整天都在调教用户和摆弄服务器,一天的时间都奔波在几百米长的电缆之间。随着云计算、容器和虚拟机的复杂性的增加,而今依然如此。 From db00ee1168582ff2c91e449fd75ba2ee723bee9a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 24 Nov 2019 21:56:43 +0800 Subject: [PATCH 607/800] APL --- ...20181109 Must-Have Tools for Writers on the Linux Platform.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md b/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md index 0ab375a008..e7c9a53e2e 100644 --- a/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md +++ b/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md @@ -1,3 +1,4 @@ +wxy Must-Have Tools for Writers on the Linux Platform ====== From 3a72b8cde9a1584f7da696287ddd212528e583a6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 Nov 2019 00:00:10 +0800 Subject: [PATCH 608/800] TSL&PRF --- ...Tools for Writers on the Linux Platform.md | 119 ------------------ ...Tools for Writers on the Linux Platform.md | 101 +++++++++++++++ 2 files changed, 101 insertions(+), 119 deletions(-) delete mode 100644 sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md create mode 100644 translated/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md diff --git a/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md b/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md deleted file mode 100644 index e7c9a53e2e..0000000000 --- a/sources/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md +++ /dev/null @@ -1,119 +0,0 @@ -wxy -Must-Have Tools for Writers on the Linux Platform -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writing-main.jpg?itok=qe96IkKm) -I’ve been a writer for more than 20 years. I’ve written thousands of articles and how-tos on various technical topics and have penned more than 40 works of fiction. So, the written word is not only important to me, it’s familiar to the point of being second nature. And through those two decades (and counting) I’ve done nearly all my work on the Linux platform. I must confess, during those early years it wasn’t always easy. Formats didn’t always mesh with what an editor required and, in some cases, the open source platform simply didn’t have the necessary tools required to get the job done. - -That was then, this is now. - -A perfect storm of Linux evolution and web-based tools have made it such that any writer can get the job done (and done well) on Linux. But what tools will you need? You might be surprised to find out that, in some instances, the job cannot be efficiently done with 100% open source tools. Even with that caveat, the job can be done. Let’s take a look at the tools I’ve been using as both a tech writer and author of fiction. I’m going to outline this by way of my writing process for both nonfiction and fiction (as the process is different and requires specific tools). - -A word of warning to seriously hard-core Linux users. A long time ago, I gave up on using tools like LaTeX and DocBook for my writing. Why? Because, for me, the focus must be on the content, not the process. When you’re facing deadlines, efficiency must take precedent. - -### Nonfiction - -We’ll start with nonfiction, as that process is the simpler of the two. For writing technical how-tos, I collaborate with different editors and, in some cases, have to copy/paste content into a CMS. But like with my fiction, the process always starts with Google Drive. This is the point at which many open source purists will check out. Fear not, you can always opt to either keep all of your files locally, or use a more open-friendly cloud service (such as [Zoho][1] or [nextCloud][2]). - -Why start on the cloud? Over the years, I’ve found I need to be able to access that content from anywhere at any time. The simplest solution was to migrate the cloud. I’ve also become paranoid about losing work. To that end, I make use of a tool like [Insync][3] to keep my Google Drive in sync with my desktop. With that desktop sync in place, I know there’s always a backup of my work, in case something should go awry with Google Drive. - -For those clients with whom I must enter content into a Content Management System (CMS), the process ends there. I can copy/paste directly from a Google Doc into the CMS and be done with it. Of course, with technical content, there are always screenshots involved. For that, I use [Gimp][4], which makes taking screenshots simple: - -![screenshot with Gimp][6] - -Figure 1: Taking a screenshot with Gimp. - -[Used with permission][7] - - 1. Open Gimp. - - 2. Click File > Create > Screenshot. - - 3. Select from a single window, the entire screen, or a region to grab (Figure 1). - - 4. Click Snap. - - - - -The majority of my clients tend to prefer I work with Google Docs, because I can share folders so that they have reliable access to the content. There are a few clients I have that do not work with Google Docs, and so I must download the files into a format that can be used. What I do for this is download in .odt format, open the document in [LibreOffice][8] (Figure 2), format as needed, save in a format required by the client, and send the document on. - -![Google Doc][10] - -Figure 2: My Google Doc download opened in LibreOffice. - -[Used with permission][7] - -And that, is the end of the line for nonfiction. - -### Fiction - -This is where it gets a bit more complicated. The beginning steps are the same, as I always write every first draft of a novel in Google Docs. Once that is complete, I then download the file to my Linux desktop, open the file in LibreOffice, format as necessary, and then save as a file type supported by my editor (unfortunately, that means .docx). - -The next step in the process gets a bit dicey. My editor prefers to use comments over track changes (as it makes it easier for both of us to read the document as we make changes). Because of this, a 60k word doc can include hundreds upon hundreds of comments, which slows LibreOffice to a useless crawl. Once upon a time, you could up the memory used for documents, but as of LibreOffice 6, that is no longer possible. This means any larger, novel-length, document with numerous comments will become unusable. Because of that, I’ve had to take drastic measures and use [WPS Office][11] (Figure 3). Although this isn’t an open source solution, WPS Office does a fine job with numerous comments in a document, so there’s no need to deal with the frustration that is LibreOffice (when working with these large files with hundreds of comments). - -![comments][13] - -Figure 3: WPS handles numerous comments with ease. - -[Used with permission][7] - -Once my editor and I finish up the edits for the book (and all comments have been removed), I can then open the file in LibreOffice for final formatting. When the formatting is complete, I save the file in .html format and then open the file in [Calibre][14] for exporting the file to .mobi and .epub formats. - -Calibre is a must-have for anyone looking to publish on Amazon, Barnes & Noble, Smashwords, or other platforms. One thing Calibre does better than other, similar, solutions is enable you to directly edit the .epub files (Figure 4). For the likes of Smashword, this is an absolute necessity (as the export process will add elements not accepted on the Smashwords conversion tool). - -![Calibre][16] - -Figure 4: Editing an epub file directly in Calibre. - -[Creative Commons Zero][17] - -After the writing process is over (or sometimes while waiting for an editor to complete a pass), I’ll start working on the cover for the book. That task is handled completely in Gimp (Figure 5). - -![Using Gimp][19] - -Figure 5: Creating the cover of POTUS in Gimp. - -[Used with permission][7] - -And that finishes up the process of creating a work of fiction on the Linux platform. Because of the length of the documents, and how some editors work, it can get a bit more complicated than the process of creating nonfiction, but it’s far from challenging. In fact, creating fiction on Linux is just as simple (and more reliable) than other platforms. - -### HTH - -I hope this helps aspiring writers to have the confidence to write on the Linux platform. There are plenty of other tools available to use, but the ones I have listed here have served me quite well over the years. And although I do make use of a couple of proprietary tools, as long as they keep working well on Linux, I’m okay with that. - -Learn more about Linux in the[ Introduction to Open Source Development, Git, and Linux (LFD201) ][20]training course from The Linux Foundation, and sign up now to start your open source journey. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/learn/2018/11/must-have-tools-writers-linux-platform - -作者:[Jack Wallen][a] -选题:[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/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.zoho.com/ -[2]: https://nextcloud.com/ -[3]: https://www.insynchq.com -[4]: https://www.gimp.org/ -[5]: /files/images/writingtools1jpg -[6]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/writingtools_1.jpg?itok=Uko7DZ8U (screenshot with Gimp) -[7]: /licenses/category/used-permission -[8]: https://www.libreoffice.org/ -[9]: /files/images/writingtools2jpg -[10]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writingtools_2.jpg?itok=vDgxd8hu (Google Doc) -[11]: https://www.wps.com/en-US/ -[12]: /files/images/writingtools3jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writingtools_3.jpg?itok=AYrsfz01 (comments) -[14]: https://calibre-ebook.com/ -[15]: /files/images/writingtools4jpg -[16]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writingtools_4.jpg?itok=wFMEsL7b (Calibre) -[17]: /licenses/category/creative-commons-zero -[18]: /files/images/writingtools5jpg -[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/writingtools_5.jpg?itok=e7SZCgip (Using Gimp) -[20]: https://training.linuxfoundation.org/training/introduction-to-open-source-development-git-and-linux/?utm_source=linux.com&utm_medium=article&utm_campaign=lfd201 diff --git a/translated/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md b/translated/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md new file mode 100644 index 0000000000..b4359ba825 --- /dev/null +++ b/translated/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md @@ -0,0 +1,101 @@ +Linux 平台上的写作者必备工具 +====== + +![](https://www.linux.com/wp-content/uploads/2019/08/writing-main.jpg) + +我从事作家已有 20 多年了。我撰写了数千篇有关各种技术主题的文章和指南,并撰写了 40 多本小说。因此,书面文字不仅对我很重要,还很熟悉,成为了我的第二种自然交流的方式。在过去的二十年中(而且还在继续),我几乎都是在 Linux 平台上完成的所有工作。我必须承认,在早期,这并不总是那么容易。格式并不总是与编辑器所需要的相吻合,在某些情况下,开源平台根本没有完成工作所需的必要工具。 + +那时已经过去,现在已经不同了。 + +Linux 演进和基于 Web 的工具的相得益彰使得它可以让任何写作者都能在 Linux 上完成工作(并且做得很好)。但是你需要什么工具?你可能会惊讶地发现,在某些情况下,使用 100% 开源的工具无法有效完成这项工作。不过即使如此,工作总是可以完成的。让我们来看看我作为技术作家和小说作者一直使用的工具。我将通过小说和非小说类的写作过程来概述这一点(因为过程不同,需要特定的工具)。 + +对认真的 Linux 硬核用户预先做个预警。很久以前,我就放弃了使用 LaTeX 和 DocBook 之类的工具进行写作。为什么?因为对我而言,重点必须放在内容上,而不是过程上。当你面临最后期限时,必须以效率为先。 + +### 非小说类 + +我们将从非虚构写作入手,因为这是两者中较简单的过程。为了编写技术指南,我与不同的编辑人员合作,并且在某些情况下,必须将内容复制/粘贴到 CMS 中。但是就像我的小说一样,整个过程总是从 Google 云端硬盘开始。在这一点上,许多开源纯粹主义者会转身走开。不用担心,你始终可以选择将所有文件保存在本地,也可以使用更开放友好的云服务(例如 [Zoho][1] 或 [nextCloud][2])。 + +为什么要从云端开始?多年来,我发现我需要能够随时随地访问那些内容。最简单的解决方案是迁移到云上。我对丢失工作成果这件事也很偏执。为此,我使用了 [Insync][3] 之类的工具来使我的 Google 云端硬盘与桌面保持同步。有了桌面同步功能,我知道我的工作成果总是有备份,以防万一 Google 云端硬盘出了问题。 + +对于那些我必须与之一起将内容输入到内容管理系统(CMS)的客户,该过程到此结束。我可以直接从 Google 文档复制/粘贴到 CMS 中,并完成此操作。当然,对于技术内容,总是涉及到屏幕截图。为此,我使用 [Gimp][4],它使得截取屏幕截图变得简单: + +![screenshot with Gimp][6] + +*图 1:使用 Gimp 截屏。* + +1. 打开 Gimp。 +2. 单击“文件>创建>屏幕快照”。 +3. 选择单个窗口、整个屏幕或要抓取的区域(图 1)。 +4. 单击“抓取”。 + +我的大多数客户倾向于使用 Google 文档,因为我可以共享文件夹,以便他们可以可靠地访问该内容。我有一些无法使用 Google 文档的客户,因此我必须将文件下载为可以使用的格式。为此,我要做的是下载 .odt 格式,以 [LibreOffice][8] 打开文档(图 2),根据需要设置格式,保存为客户所需的格式,然后发送文档。 + +![Google Doc][10] + +*图 2:在 LibreOffice 中打开我下载的 Google 文档。* + +非小说类作品这样就行了。 + +### 小说类 + +这里会稍微变得有点复杂。开始的步骤是相同的​​,因为我总是在 Google 文档中写小说的每个初稿。完成后,我将文件下载到 Linux 桌面,在 LibreOffice 中打开文件,根据需要设置格式,然后另存为编辑器支持的文件类型(不幸的是,这意味着是 .docx)。 + +该过程的下一步变得有些琐碎。我的编辑更喜欢使用注释来跟踪更改(因为这使我们俩阅读文档和做出更改一样容易)。因此,一个 60k 的 word 文档可以包含成百上千的注释,这会使 LibreOffice 慢的像爬一样。从前,你可以增加用于文档的内存,但是从 LibreOffice 6 开始,这不再可行。这意味着任何较大的、像小说一样长的、带有大量注释的文档都将无法使用。因此,我不得不采取一些极端的措施,使用 [WPS Office][11](图 3)。尽管这不是开源解决方案,但 WPS Office 在文档中包含大量注释的情况下做得很好,因此无需处理 LibreOffice 所带来的麻烦(当处理带有数百个注释的大型文件时)。 + +![comments][13] + +*图 3:WPS 可以轻松处理大量注释。* + +一旦我和我的编辑完成了对书的编辑(所有评论都已删除),我就可以在 LibreOffice 中打开文件进行最终格式化。格式化完成后,我将文件保存为 .html 格式,然后以 [Calibre][14] 打开文件以将文件导出为 .mobi 和 .epub 格式。 + +对于希望在 Amazon、Barnes&Noble、Smashwords 或其他平台上出版的任何人,Calibre 都是必备工具。Caliber 比其他类似解决方案更好地方是,它使你可以直接编辑 .epub 文件(图 4)。对于 Smashword 来说,这是绝对必要的(因为导出过程将添加 Smashwords 转换工具上不接受的元素)。 + +![Calibre][16] + +*图 4:直接在 Calibre 中编辑 epub 文件。* + +写作过程结束后(或有时在等待编辑完成一校时),我将开始为书制作封面。该任务完全在 Gimp 中处理(图 5)。 + +![Using Gimp][19] + +*图 5:在 Gimp 中创建 POTUS 的封面。* + +这样就完成了在 Linux 平台上创建小说的过程。由于文档的篇幅以及某些编辑人员的工作方式,与创建非小说类的过程相比,它可能会变得有些复杂,但这远没有挑战性。实际上,在 Linux 上创建小说与其他平台一样简单(并且更可靠)。 + +### 希望这可以帮助你 + +我希望这可以帮助有抱负的作家有信心在 Linux 平台上进行写作。还有许多其他工具可供使用,但是多年来我在这里列出的工具很好地服务了我。而且,尽管我确实使用了几个专有的工具,但只要它们在 Linux 上都能正常运行,我觉得是可以的。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/learn/2018/11/must-have-tools-writers-linux-platform + +作者:[Jack Wallen][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.linux.com/users/jlwallen +[b]: https://github.com/lujun9972 +[1]: https://www.zoho.com/ +[2]: https://nextcloud.com/ +[3]: https://www.insynchq.com +[4]: https://www.gimp.org/ +[5]: /files/images/writingtools1jpg +[6]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_1.jpg (screenshot with Gimp) +[7]: /licenses/category/used-permission +[8]: https://www.libreoffice.org/ +[9]: /files/images/writingtools2jpg +[10]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_2.jpg (Google Doc) +[11]: https://www.wps.com/en-US/ +[12]: /files/images/writingtools3jpg +[13]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_3.jpg (comments) +[14]: https://calibre-ebook.com/ +[15]: /files/images/writingtools4jpg +[16]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_4.jpg (Calibre) +[17]: /licenses/category/creative-commons-zero +[18]: /files/images/writingtools5jpg +[19]: https://lcom.static.linuxfound.org/sites/lcom/files/writingtools_5.jpg (Using Gimp) +[20]: https://training.linuxfoundation.org/training/introduction-to-open-source-development-git-and-linux/?utm_source=linux.com&utm_medium=article&utm_campaign=lfd201 From 0b27bfa20ac76c68a340b017c9d37a58952af64e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 Nov 2019 00:07:26 +0800 Subject: [PATCH 609/800] PUB @wxy https://linux.cn/article-11610-1.html --- ...0181109 Must-Have Tools for Writers on the Linux Platform.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {translated/tech => published}/20181109 Must-Have Tools for Writers on the Linux Platform.md (98%) diff --git a/translated/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md b/published/20181109 Must-Have Tools for Writers on the Linux Platform.md similarity index 98% rename from translated/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md rename to published/20181109 Must-Have Tools for Writers on the Linux Platform.md index b4359ba825..c82c4f1fe2 100644 --- a/translated/tech/20181109 Must-Have Tools for Writers on the Linux Platform.md +++ b/published/20181109 Must-Have Tools for Writers on the Linux Platform.md @@ -1,7 +1,7 @@ Linux 平台上的写作者必备工具 ====== -![](https://www.linux.com/wp-content/uploads/2019/08/writing-main.jpg) +![](https://img.linux.net.cn/data/attachment/album/201911/25/000129eee2zydelz22vj9h.jpg) 我从事作家已有 20 多年了。我撰写了数千篇有关各种技术主题的文章和指南,并撰写了 40 多本小说。因此,书面文字不仅对我很重要,还很熟悉,成为了我的第二种自然交流的方式。在过去的二十年中(而且还在继续),我几乎都是在 Linux 平台上完成的所有工作。我必须承认,在早期,这并不总是那么容易。格式并不总是与编辑器所需要的相吻合,在某些情况下,开源平台根本没有完成工作所需的必要工具。 From a3b5d1ce12d0e3545d87593c31f166c7ccf5d26c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 25 Nov 2019 00:52:55 +0800 Subject: [PATCH 610/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=2025=20R?= =?UTF-8?q?aspberry=20Pi=20Project=20Ideas=20to=20Put=20Your=20Pi=20to=20S?= =?UTF-8?q?ome=20Good=20Use?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191125 25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use.md --- ...t Ideas to Put Your Pi to Some Good Use.md | 303 ++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 sources/tech/20191125 25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use.md diff --git a/sources/tech/20191125 25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use.md b/sources/tech/20191125 25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use.md new file mode 100644 index 0000000000..37912e7e20 --- /dev/null +++ b/sources/tech/20191125 25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use.md @@ -0,0 +1,303 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use) +[#]: via: (https://itsfoss.com/raspberry-pi-projects/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +25 Raspberry Pi Project Ideas to Put Your Pi to Some Good Use +====== + +It won’t be an exaggeration if I call Raspberry Pi a revolutionary gadget. When it was first launched in the year 2011-12, people just couldn’t believe that a computer can be available in just $25. + +If you bought a Pi and wondering what should do with my Raspberry Pi, I have got your back. I am going to list some cool Raspberry Pi projects that you can start following in your free time. + +These Raspberry Pi project ideas are not limited to Pi. You can use them with other [Raspberry Pi like devices such as Orange Pi, Khadas][1] etc. + +### 25 Cool Raspberry Pi Projects + +I have listed several these project ideas by categorizing them in terms of the level of complexity (beginner, intermediate, and advanced). Some projects need additional equipment and sensors as well. + +Of course, it is worth noting that it will be subjective to what expertise you have. So, let us take a look at the project ideas. + +**Beginner Level Raspberry Pi Projects** + +#### 1\. Media Server + +Building a media server using Rasberry Pi is the most common and probably the easiest project there is. + +You can take a look at some of the [best media server software][2] available for Linux and get started. + +To know more about it, you can refer to the official documentation of [using Kodi with Raspberry Pi][3] (which is one of the media server software available). + +[Using Kodi On Raspberry Pi][3] + +#### 2\. Weather Station + +![][4] + +If you’re good at building projects with electronic components, building a weather station using Raspberry Pi should be fun for you. + +This may not be the easiest one to start with – but it’s quite simple if you carefully look into the project requirements. + +You will be able to collect weather data using a variety of sensors as per your requirements. The project has been listed on the official website to help you build it as easily as possible. + +[Weather Station Project][5] + +#### 3\. The Parent Detector + +![][6] + +Yet another project from Raspberry Pi’s official website, this project uses minimal hardware to set up a motion detector which then triggers a video recording using the Raspberry Pi camera module. + +The use-case for this can be a lot of things. If you are a parent, you can keep an eye on your child when they enter their room. In either case, this can also come in handy to keep an eye on your door as a security measure to check when someone arrives. + +You can find all the necessary details on Raspberry Pi’s official site. + +[The Parent Detector][7] + +#### 4\. FM Radio Station + +Raspberry Pi is an inexpensive device for making an FM radio station. The pre-requisites may not be much but is worth exploring for fun. + +Do note that you may not want to interfere with the local FM frequencies. You can find all the details to set it up by clicking the button below. + +[FM Radio Transmitter][8] + +#### 5\. Minecraft Game Sever + +![][9] + +Minecraft is a quite popular game. However, if you want a personal server, you might have to pay a premium. + +Fret not, you can use your Raspberry Pi to build a local server, create your own world and have fun with your family/friends. + +[Minecraft Game Server][10] + +#### 6\. Temperature Log + +It was something interesting I found on the official website to help you learn a few things like – how to write data to a file etc. + +Here, you will be recording the temperature using the sensor present. + +For this, you will be utilizing the command-line to monitor the temperature of Raspberry Pi. + +[Temperature Log][11] + +#### 7\. Retro Gaming Console + +You can turn your Raspberry Pi into a gaming console by simply installing an OS on an SD card and transfer a few files to it. + +We also have an article on how you can [turn your old PC into a Retrogaming console][12] if you are curious. + +I have linked a resource to help you make this project in the button below: + +[Retro Gaming Console][13] + +#### 8\. Full-Fledged Desktop + +![][14] + +If you do not want to invest a lot to build a PC, you can easily utilize your Raspberry Pi to build one. + +Technically, your Raspberry Pi will be the heart of your PC and you will need to add accessories (monitor, keyboard, mouse, etc) to turn it into a PC. You can also choose to build a custom case for the board if you want – which is totally optional. + +Obviously, the PC won’t be powerful enough for all kinds of tasks – but it will be usable. You can also check out the experience of having [Raspberry Pi 4 as a desktop replacement][15] on their official website as a reference to this project. + +[Full-Fledged Desktop][16] + +**Intermediate Level Raspberry Pi Project Ideas** + +#### 9\. Build a LAMP Web Server with WordPress + +If you are into web development, you can try setting up a LAMP (Linux + Apache + MySQL + PHP) server and install WordPress to create a website. You can also choose to make something else from scratch without installing WordPress. + +You will be able to access the site on any device on the same network as your Raspberry Pi. + +[Build a LAMP Web Server][17] + +#### 10\. Laser Tripwire + +It is a similar concept to the parent detector that uses a motion sensor. In this case, a laser beam is used to detect activity whenever someone breaks the beam. + +You just need a few things to set up the alarm and complete the tripwire. Of course, this is a simple project to start with that has potentially different applications. + +[Laser Tripwire][18] + +#### 11\. Print Server + +What if you can turn your old printer to work on a network of devices even without requiring a built-in WiFi feature? + +Well, that’s what this project is about. You will be able to access your printer from multiple devices using a print server. Check out all the details to help build one by clicking the button below. + +[Raspberry Pi Print Server][19] + +#### 12\. Time Lapse Camera + +Looking for a cheap dedicated time-lapse camera? Well, you can do it yourself with a Raspberry Pi. + +You can use the Pi camera module or explore other options as well. + +[Time-Lapse Camera][20] + +#### 13\. Music Box + +You can build a button-controlled music box using Raspberry Pi to have a great time with your kids or anyone who loves music. + +When you press a button, it will play a sound. You can find the short description of the project in the video above, for more details click on the button below. + +[Music Box][21] + +#### 14\. Google Home On Raspberry Pi + +If you could configure and set up Google Assistant on your Raspberry Pi, you can turn it into an inexpensive Google Home DIY alternative, right? + +Fortunately, you can achieve that with your Raspberry Pi. Find out more about it in the video above. + +#### 15\. Build Smart TV Box + +If you know how to set up a media server on Raspberry Pi (as mentioned in the first project idea of this article), you can make this happen too. + +With the help of the Kodi box (or similar), you can build your own personal smart TV box powered by the media server of your choice. + +[Smart TV Box][22] + +#### 16\. Add Gesture Controls To Raspberry Pi + +You can add the ability to have gesture controls for any of your projects on Raspberry Pi using a [Flick board][23]. + +It may not be the cheapest project but it is an impressive touch for your Raspberry Pi project. + +[Gesture Controls][23] + +**Advanced Level Raspberry Pi Project Ideas** + +#### 17\. Tor Router + +If you are someone who wants to explore ways to enhance your personal digital privacy, you can start by building your own local Tor onion router. + +With this, you can scramble your Internet connection and remain anonymous with your browsing activities. It is just something like a VPN but technically different. + +[Tor Router][24] + +#### 18\. Control LEDs with your voice + +![][25] + +This is quite interesting. I have already mentioned a project where you can set up Google Assistant on your Raspberry Pi. However, in this case, you will be able to control the LEDs with your voice. + +You will not need the assistant this time, all you need is the [Google AIY voice kit][26]. This has been featured on the list of official DIY projects using Raspberry Pi, you can get more information there. + +[Control LEDs With Voice][27] + +#### 19\. WiFi Extender + +If you want to increase the range of your WiFi network, you might have to opt for a premium gadget that can help you do that or you can utilize Raspberry Pi to get the job done. + +Yes, that’s right, you can build a WiFi extender by just using your Raspberry Pi. + +[WiFi Extender][28] + +#### 20\. VPN Server + +You do not need to trust the VPN providers if you can build your own local VPN server. It can be quite challenging to make it happen. + +So, if you are up for some action, you can use your Raspberry Pi to make a private VPN server for your connection. Explore more about it here: + +[VPN Server][29] + +#### 21\. Home Automation Using Raspberry Pi + +A lot of powerful projects can be done using the Raspberry Pi, one of which is – ‘Home Automation’. + +If I want to implement home automation, it will be expensive. But, if I end up using Raspberry Pi to create something similar, it will require less investment. Of course, you will have to explore and improve to make it a reliable system but you can get started with the basics. + +[Home Automation][30] + +#### 22\. Local Cloud Server + +You can also build your own cloud using Raspberry Pi. You can also install Nextcloud on it to protect and store your data. + +A lot of exciting things to explore once you have your own cloud, right? + +[Local Cloud Server][31] + +#### 23\. Portable Hacking Device + +Let me make one thing clear, I am not encouraging you to do something illegal (just like the movies) by building a portable hacking device. + +So, just for educational/testing purposes, feel free to try making your own portable device for hacking using Raspberry Pi. + +[Portable Hacking Device][32] + +#### 24\. Smart Gloves + +Making a pair of smart gloves is really a cool project with Raspberry Pi. In my college days, I witnessed a senior make this thing, it was interesting. + +You can refer to the official resource for this project and get started. + +[Smart Gloves][33] + +#### 25\. Ad Blocker + +With Raspberry Pi, you can easily implement a network-wide Adblocker so that you won’t have to install adblockers separately on devices or browsers. + +You need to utilize Pi-Hole (the ad blocker) to set it up. Check out the video above and the official resource through the button below. + +[Ad Blocker][34] + +**Wrapping Up** + +Here, I listed some of the most interesting projects that I could find that might come in handy for you. + +If you know some other cool ideas, let me know in the comments down below. I might update this list of Raspberry Pi projects with your idea. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-projects/ + +作者:[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/raspberry-pi-alternatives/ +[2]: https://itsfoss.com/best-linux-media-server/ +[3]: https://www.raspberrypi.org/documentation/usage/kodi/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/diy-weather-station.jpg?ssl=1 +[5]: https://projects.raspberrypi.org/en/projects/build-your-own-weather-station +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/parents-detector-pi.png?ssl=1 +[7]: https://projects.raspberrypi.org/en/projects/parent-detector +[8]: https://circuitdigest.com/microcontroller-projects/raspberry-pi-fm-transmitter +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/minecraft-game-server.jpg?ssl=1 +[10]: https://www.makeuseof.com/tag/setup-minecraft-server-raspberry-pi/ +[11]: https://projects.raspberrypi.org/en/projects/temperature-log +[12]: https://itsfoss.com/lakka-retrogaming-linux/ +[13]: https://lifehacker.com/how-to-turn-your-raspberry-pi-into-a-retro-game-console-498561192 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/raspberry-pi-desktop.jpg?ssl=1 +[15]: https://www.raspberrypi.org/blog/raspberry-pi-4-a-full-desktop-replacement/ +[16]: https://www.makeuseof.com/tag/use-your-raspberry-pi-like-a-desktop-pc/ +[17]: https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress +[18]: https://projects.raspberrypi.org/en/projects/laser-tripwire +[19]: https://circuitdigest.com/microcontroller-projects/raspberry-pi-print-server +[20]: https://projects.raspberrypi.org/en/projects/raspberry-pi-zero-time-lapse-cam +[21]: https://projects.raspberrypi.org/en/projects/gpio-music-box +[22]: https://www.modmy.com/kodi-box-guide +[23]: https://magpi.raspberrypi.org/articles/flick-hat-swipe-gestures-raspberry-pi +[24]: https://magpi.raspberrypi.org/articles/tor-router +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/control-led-voice-raspberry-pi.jpg?fit=800%2C450&ssl=1 +[26]: https://aiyprojects.withgoogle.com/voice +[27]: https://projects.raspberrypi.org/en/projects/google-voice-aiy/ +[28]: https://pimylifeup.com/raspberry-pi-wifi-extender/ +[29]: https://www.comparitech.com/blog/vpn-privacy/raspberry-pi-vpn/ +[30]: https://circuitdigest.com/microcontroller-projects/iot-raspberry-pi-home-automation +[31]: https://opensource.com/article/18/9/host-cloud-nas-raspberry-pi +[32]: https://www.hackster.io/mehedishakeel/portable-hacking-machine-kali-linux-raspberry-pi-touch-18b7c3 +[33]: https://www.raspberrypi.org/blog/raspberry-pi-glove/ +[34]: https://www.raspberrypi.org/blog/pi-hole-raspberry-pi/ From 2ac66bd8f396b2e06d263670bc2884d64191c206 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 Nov 2019 09:04:08 +0800 Subject: [PATCH 611/800] PRF @wenwensnow --- ...4 Fields, records, and variables in awk.md | 109 ++++++++---------- 1 file changed, 47 insertions(+), 62 deletions(-) diff --git a/translated/tech/20191104 Fields, records, and variables in awk.md b/translated/tech/20191104 Fields, records, and variables in awk.md index 61acdae6a1..f8fb9d5c55 100644 --- a/translated/tech/20191104 Fields, records, and variables in awk.md +++ b/translated/tech/20191104 Fields, records, and variables in awk.md @@ -1,27 +1,28 @@ [#]: collector: (lujun9972) -[#]: translator: (liwenwensnow) -[#]: reviewer: ( ) +[#]: translator: (wenwensnow) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Fields, records, and variables in awk) [#]: via: (https://opensource.com/article/19/11/fields-records-variables-awk) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -awk中的字段,记录和变量 +awk 中的字段、记录和变量 ====== -这个系列的第二篇,我们会学习 字段,记录和一些非常有用的awk变量。 -![Man at laptop on a mountain][1] -Awk 有好几个变种: 最早的 **awk**, 是1977 年 AT&T Bell 实验室所创。它还有一些重构版本,例如 **mawk**, **nawk**。在大多数Linux 发行版中能见到的,是 GNU awk,也叫**gawk**。 在大多数 Linux 发行版中,awk 和 gawk 都是指向 GNU awk 的链接。 输入awk命令,也是同样的效果。 [GNU awk 用户手册][2]中,能看到 awk 和 gawk 的全部历史。 +> 这个系列的第二篇,我们会学习字段,记录和一些非常有用的 Awk 变量。 -这一系列的[第一篇文章][3] 介绍了awk 命令的基本格式: +![](https://img.linux.net.cn/data/attachment/album/201911/25/090333m34qx395vwtxx5vx.jpg) + +Awk 有好几个变种:最早的 `awk`,是 1977 年 AT&T 贝尔实验室所创。它还有一些重构版本,例如 `mawk`、`nawk`。在大多数 Linux 发行版中能见到的,是 GNU awk,也叫 `gawk`。在大多数 Linux 发行版中,`awk` 和 `gawk` 都是指向 GNU awk 的软链接。输入 `awk`,调用的是同一个命令。[GNU awk 用户手册][2]中,能看到 `awk` 和 `gawk` 的全部历史。 + +这一系列的[第一篇文章][3] 介绍了 `awk` 命令的基本格式: ``` -`$ awk [options] 'pattern {action}' inputfile` +$ awk [选项] '模式 {动作}' 输入文件 ``` -Awk 是一个命令,后面要接选项 (比如用 **-F** 来定义字段分隔符)。 想让awk 执行的部分需要写在 两个单引号之间,至少在终端中需要这么做。 在awk 命令中,为了进一步强调你想要执行的部分,可以用 **-e** 选项来突出显示 (但这不是必须的): - +`awk` 是一个命令,后面要接选项 (比如用 `-F` 来定义字段分隔符)。想让 `awk` 执行的部分需要写在两个单引号之间,至少在终端中需要这么做。在 `awk` 命令中,为了进一步强调你想要执行的部分,可以用 `-e` 选项来突出显示(但这不是必须的): ``` $ awk -F, -e '{print $2;}' colours.txt @@ -33,56 +34,53 @@ green ### 记录和字段 -Awk 将输入数据视为 一系列 _记录_ , 通常是按行分割的。 换句话说,awk 将文本中的每一行视作一个记录。每一记录包含多个 _字段_. 一个字段由 _字段分隔符_ 分隔开来,字段是记录的一部分. - -默认情况下,awk 将各种空白符,如空格,tab,换行符等视为分隔符。 值得注意的是,在awk 中,多个 _空格_ 将被视为一个分隔符。所以下面这行文本有两个字段: +`awk` 将输入数据视为一系列*记录*,通常是按行分割的。换句话说,`awk` 将文本中的每一行视作一个记录。每一记录包含多个*字段*。一个字段由*字段分隔符*分隔开来,字段是记录的一部分。 +默认情况下,`awk` 将各种空白符,如空格、制表符、换行符等视为分隔符。值得注意的是,在 `awk` 中,多个*空格*将被视为一个分隔符。所以下面这行文本有两个字段: ``` -`raspberry red` +raspberry red ``` 这行也是: ``` -`tuxedo                  black` +tuxedo                  black ``` -其他分隔符,在程序中不是这么处理的。假设字段分隔符是逗号,如下所示的记录,就有三个字段。其中一个字段可能会是0个字节(假设这一字段中不包含隐藏字符) +其他分隔符,在程序中不是这么处理的。假设字段分隔符是逗号,如下所示的记录,就有三个字段。其中一个字段可能会是 0 个字节(假设这一字段中不包含隐藏字符) ``` -`a,,b` +a,,b ``` ### awk 程序 -awk 命令的 _程序部分_ 是由一系列规则组成的。通常来说,程序中每个规则占一行(尽管这不是必须的)。 每个规则由一个模式,或一个/多个动作组成: +`awk` 命令的*程序部分*是由一系列规则组成的。通常来说,程序中每个规则占一行(尽管这不是必须的)。每个规则由一个模式,或一个或多个动作组成: ``` -`pattern { action }` +模式 { 动作 } ``` -在一个规则中,你可以通过定义模式,来确定行动是否会在记录中执行。 模式可以是简单的比较条件,正则表达式,甚至两者结合等等。 - -这个例子中,程序 _只会_ 显示包含 单词 “raspberry” 的记录: +在一个规则中,你可以通过定义模式,来确定动作是否会在记录中执行。模式可以是简单的比较条件、正则表达式,甚至两者结合等等。 +这个例子中,程序*只会*显示包含单词 “raspberry” 的记录: ``` $ awk '/raspberry/ { print $0 }' colours.txt raspberry red 99 ``` -如果没有文本符合模式,最终结果会对应所有记录。 +如果没有文本符合模式,该动作将会应用到所有记录上。 -并且,在一条规则只包含一个模式时,相当于对整个记录执行 **{ print }** 。 +并且,在一条规则只包含模式时,相当于对整个记录执行 `{ print }`,全部打印出来。 -Awk 程序本质上是 _数据驱动_ 的,命令执行结果取决于数据。所以,与其他编程语言中的程序相比,它还是有些区别的。 +Awk 程序本质上是*数据驱动*的,命令执行结果取决于数据。所以,与其他编程语言中的程序相比,它还是有些区别的。 ### NF 变量 -每个字段都有指定变量,但针对字段和记录,也存在一些特殊变量。 **NF** 变量,能存储awk在当前记录中找到的数字字段。其内容可在屏幕上显示,也可用于测试。 下面例子中的数据,来自上篇文章[文本][3]: - +每个字段都有指定变量,但针对字段和记录,也存在一些特殊变量。`NF` 变量,能存储 `awk` 在当前记录中找到的字段数量。其内容可在屏幕上显示,也可用于测试。下面例子中的数据,来自上篇文章[文本][3]: ``` $ awk '{ print $0 " (" NF ")" }' colours.txt @@ -92,11 +90,11 @@ banana     yellow 6 (3) [...] ``` -Awk 的 **print** 函数会接受一系列参数(可以是变量或者字符),并将它们拼接起来。这就是为什么在这个例子里,每行结尾处,awk 会显示一个被括号括起来的整数。 +`awk` 的 `print` 函数会接受一系列参数(可以是变量或者字符串),并将它们拼接起来。这就是为什么在这个例子里,每行结尾处,`awk` 会以一个被括号括起来的整数表示字段数量。 ### NR 变量 -另外,为了计算每个记录中的字段数,awk 也计算输入记录。 记录数目被存储在变量 **NR** 中,它的使用方法和其他变量没有任何区别。例如,为了在每一行开头显示行号: +另外,除了统计每个记录中的字段数,`awk` 也统计输入记录数。记录数被存储在变量 `NR` 中,它的使用方法和其他变量没有任何区别。例如,为了在每一行开头显示行号: ``` $ awk '{ print NR ": " $0 }' colours.txt @@ -108,23 +106,21 @@ $ awk '{ print NR ": " $0 }' colours.txt [...] ``` -注意,在这个命令下输入数据时,可以不遵循在 **print** 后的规则,参数间可以不写空格,尽管这样会降低可读性: - +注意,写这个命令时可以不在 `print` 后的多个参数间添加空格,尽管这样会降低可读性: ``` -`$ awk '{print NR": "$0}' colours.txt` +$ awk '{print NR": "$0}' colours.txt ``` ### printf() 函数 -为了输出结果时格式更灵活,你可以使用 awk 的 **printf()** 函数。 它与C,Lua,Bash和其他语言中的 **printf** 相类似。 它也接受 _格式_ ,加逗号分隔的参数。参数列表需要写在括号里。 - +为了让输出结果时格式更灵活,你可以使用 `awk` 的 `printf()` 函数。 它与 C、Lua、Bash 和其他语言中的 `printf` 相类似。它也接受以逗号分隔的*格式*参数。参数列表需要写在括号里。 ``` -`$ printf format, item1, item2, ...` +$ printf 格式, 项目1, 项目2, ... ``` -格式这一参数(也叫 _格式符_ ) 定义了其他参数如何显示。 这一功能是用 _格式修饰符_ 来实现的。 **%s** 显示字符, **%d** 显示数字。 下面的**printf** 语句,会在括号内显示字段数量: +格式这一参数(也叫*格式符*)定义了其他参数如何显示。这一功能是用*格式修饰符*实现的。`%s` 输出字符,`%d` 输出十进制数字。下面的 `printf` 语句,会在括号内显示字段数量: ``` $ awk 'printf "%s (%d)\n",$0,NF}' colours.txt @@ -134,26 +130,23 @@ banana     yellow 6 (3) [...] ``` - -在这个例子里, **%s (%d)** 确定了每一行的输出格式,**$0,NF** 定义了插入 **%s** 和 **%d** 位置的数据。注意,和**print** 函数不同,在没有明确指令时,输出不会转到下一行。出现 转义字符 **\n** 时才会换行。 +在这个例子里,`%s (%d)` 确定了每一行的输出格式,`$0,NF` 定义了插入 `%s` 和 `%d` 位置的数据。注意,和 `print` 函数不同,在没有明确指令时,输出不会转到下一行。出现转义字符 `\n` 时才会换行。 ### Awk 脚本编程 -这篇文章中出现的所有awk代码,都在Bash终端中执行过。 面对更复杂的程序,将命令放在文件( _脚本_ )中会更容易。 **-f FILE** 选项(不要和 **-F** 弄混了,那个选项用于字段分隔符),可用于指明包含可执行程序的文件。 - -举个例子,下面是一个简单的awk 脚本。 创建一个名为 **example1.awk** 的文件,包含以下内容: +这篇文章中出现的所有 `awk` 代码,都在 Bash 终端中执行过。面对更复杂的程序,将命令放在文件(*脚本*)中会更容易。`-f FILE` 选项(不要和 `-F` 弄混了,那个选项用于字段分隔符),可用于指明包含可执行程序的文件。 +举个例子,下面是一个简单的 awk 脚本。创建一个名为 `example1.awk` 的文件,包含以下内容: ``` /^a/ {print "A: " $0} /^b/ {print "B: " $0} ``` -如果一个文件包含 awk 程序,那么在给文件命名时,最好写上 **.awk** 的扩展名。 这样命名不是强制的,但这么做,会给文件管理器,编辑者(和你)一个关于文件内容的,很有用的提示。 +如果一个文件包含 `awk` 程序,那么在给文件命名时,最好写上 `.awk` 的扩展名。 这样命名不是强制的,但这么做,会给文件管理器、编辑器(和你)一个关于文件内容的很有用的提示。 执行这一脚本: - ``` $ awk -f example1.awk colours.txt A: raspberry  red    4 @@ -161,7 +154,7 @@ B: banana     yellow 6 A: apple      green  8 ``` -一个包含 awk 命令的文件,在最开头一行加上 **#!** ,就能变成可执行脚本。 创建一个名为 **example2.awk** 的文件,包含以下内容: +一个包含 `awk` 命令的文件,在最开头一行加上释伴 `#!`,就能变成可执行脚本。创建一个名为 `example2.awk` 的文件,包含以下内容: ``` #!/usr/bin/awk -f @@ -169,23 +162,21 @@ A: apple      green  8 # 除了第一行,在其他行前显示行号 # -NR > 1 { -    printf "%d: %s\n",NR,$0 +NR > 1 { + printf "%d: %s\n",NR,$0 } ``` -可以说,脚本中只有一行,大多数情况下没什么用。 但在某些情况下,执行一个脚本,比记住,然后打一条命令要容易的多。 一个脚本文件,也提供了一个记录命令具体作用的好机会。 以 **#** 号开头的行是注释,awk 会忽略它们。 +可以说,脚本中只有一行,大多数情况下没什么用。但在某些情况下,执行一个脚本,比记住,然后打一条命令要容易的多。一个脚本文件,也提供了一个记录命令具体作用的好机会。以 `#` 号开头的行是注释,`awk` 会忽略它们。 给文件可执行权限: - ``` -`$ chmod u+x example2.awk` +$ chmod u+x example2.awk ``` 执行脚本: - ``` $ ./example2.awk colours.txt 2: apple      red    4 @@ -195,17 +186,14 @@ $ ./example2.awk colours.txt [...] ``` - -将awk 命令放在脚本文件中,有一个好处就是,修改和格式化输出会更容易。在终端中,如果能用一行执行多条awk命令,那么输入多行,才能达到同样效果,就显得有些多余了。 +将 `awk` 命令放在脚本文件中,有一个好处就是,修改和格式化输出会更容易。在终端中,如果能用一行执行多条 `awk` 命令,那么输入多行,才能达到同样效果,就显得有些多余了。 ### 试一试 -你现在已经足够了解, awk 是如何执行指令的了。现在你应该能编写复杂的awk 程序了。 试着编写一个awk 脚本,它需要: 至少包括一个条件模式,以及多个规则。如果你想使用除 **print** 和 **printf** 以外的函数,可以参考在线[ gawk 手册][4] . - +你现在已经足够了解,`awk` 是如何执行指令的了。现在你应该能编写复杂的 `awk` 程序了。试着编写一个 awk 脚本,它需要: 至少包括一个条件模式,以及多个规则。如果你想使用除 `print` 和 `printf` 以外的函数,可以参考在线 [gawk 手册][4]。 下面这个例子是个很好的切入点: - ``` #!/usr/bin/awk -f # @@ -222,12 +210,9 @@ $1 == "raspberry" { 试着执行这个脚本,看看输出是什么。接下来就看你自己的了。 - 这一系列的下一篇文章,将会介绍更多,能在更复杂(更有用!) 脚本中使用的函数。 -* * * - -_这篇文章改编自 [Hacker Public Radio][5] 系列,一个技术社区博客_ +这篇文章改编自 [Hacker Public Radio][5] 系列,一个技术社区博客。 -------------------------------------------------------------------------------- @@ -235,8 +220,8 @@ via: https://opensource.com/article/19/11/fields-records-variables-awk 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[wenwensnow](https://github.com/wenwensnow) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -244,6 +229,6 @@ via: https://opensource.com/article/19/11/fields-records-variables-awk [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_laptop_code_programming_mountain_view.jpg?itok=yx5buqkr (Man at laptop on a mountain) [2]: https://www.gnu.org/software/gawk/manual/html_node/History.html#History -[3]: https://opensource.com/article/19/10/intro-awk +[3]: https://linux.cn/article-11543-1.html [4]: https://www.gnu.org/software/gawk/manual/ [5]: http://hackerpublicradio.org/eps.php?id=2129 From c29d14ca214a07bf7100e0c3f71b60fc10bdc4c9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 Nov 2019 09:04:36 +0800 Subject: [PATCH 612/800] PUB @wenwensnow https://linux.cn/article-11611-1.html --- .../20191104 Fields, records, and variables in awk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191104 Fields, records, and variables in awk.md (99%) diff --git a/translated/tech/20191104 Fields, records, and variables in awk.md b/published/20191104 Fields, records, and variables in awk.md similarity index 99% rename from translated/tech/20191104 Fields, records, and variables in awk.md rename to published/20191104 Fields, records, and variables in awk.md index f8fb9d5c55..259bde6f89 100644 --- a/translated/tech/20191104 Fields, records, and variables in awk.md +++ b/published/20191104 Fields, records, and variables in awk.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wenwensnow) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11611-1.html) [#]: subject: (Fields, records, and variables in awk) [#]: via: (https://opensource.com/article/19/11/fields-records-variables-awk) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 336497601eeb5354a9314fe1e300223cc2db3323 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 25 Nov 2019 09:07:58 +0800 Subject: [PATCH 613/800] translated --- .../20191119 How to use pkgsrc on Linux.md | 226 ------------------ .../20191119 How to use pkgsrc on Linux.md | 221 +++++++++++++++++ 2 files changed, 221 insertions(+), 226 deletions(-) delete mode 100644 sources/tech/20191119 How to use pkgsrc on Linux.md create mode 100644 translated/tech/20191119 How to use pkgsrc on Linux.md diff --git a/sources/tech/20191119 How to use pkgsrc on Linux.md b/sources/tech/20191119 How to use pkgsrc on Linux.md deleted file mode 100644 index 86476df073..0000000000 --- a/sources/tech/20191119 How to use pkgsrc on Linux.md +++ /dev/null @@ -1,226 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use pkgsrc on Linux) -[#]: via: (https://opensource.com/article/19/11/pkgsrc-netbsd-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to use pkgsrc on Linux -====== -NetBSD's package manager is generic, flexible, and easy. Here's how to -use it. -![A person programming][1] - -NetBSD is famous for running on basically anything, but did you know its _second_ claim to fame is the **[pkgsrc][2]** package manager? Like NetBSD, pkgsrc runs on basically anything, or at least anything Unix and Unix-like. You can install pkgsrc on BSD, Linux, Illumos, Solaris, and Mac. All told, over 20 operating systems are supported. - -### Why use pkgsrc? - -With the exception of MacOS, all Unix operating systems ship with a package manager included. You don't necessarily _need_ pkgsrc, but here are three great reasons you may want to try it: - - * **Packaging.** If you're curious about packaging but have yet to try creating a package yourself, pkgsrc is a relatively simple system to use, especially if you're already familiar with Makefiles and build systems like [GNU Autotools][3]. - * **Generic.** If you use multiple operating systems or distributions, then you probably encounter a package manager for each system. You can use pkgsrc across disparate systems so that when you package an application for one, you've packaged it for all of them. - * **Flexible.** In many packaging systems, it's not always obvious how to choose a binary package or a source package. With pkgsrc, the distinction is clear, both methods of installing are equally as easy, and both resolve dependencies for you. - - - -### How to install pkgsrc - -Whether you're on BSD, Linux, Illumos, Solaris, or MacOS, the installation process is basically the same: - - 1. Use CVS to check out the pkgsrc tree - 2. Bootstrap the pkgsrc system - 3. Install packages - - - -#### Use CVS to check out the pkgsrc tree - -Before Git, before Subversion, there was **[CVS][4]**. You don't have to know much about CVS to do a checkout of its code—if you're used to Git, then think of _checkout_ as _clone_. When you perform a CVS checkout of pkgsrc, you're downloading "recipes" detailing how each package is to be built. It's a lot of files, but they're small because you're not actually pulling the source code for each package, just the build infrastructure and Makefiles required to build on it demand. Using CVS makes it easy for you to update your pkgsrc checkout when a new one is released. - -The pkgsrc docs recommend keeping your tree in the **/usr** directory, so you must use **sudo** (or become root) to use this command: - - -``` -$ cd /usr -$ sudo cvs -q -z2 \ -  -d [anoncvs@anoncvs.NetBSD.org][5]:/cvsroot \ -  checkout -r pkgsrc-2019Q3 -P pkgsrc -``` - -As I'm writing, the latest release is 2019Q3. Check the news section of [pkgsrc.org][6]'s homepage or the [NetBSD documentation][7] to determine the latest release version. - -#### Bootstrap pkgsrc - -After the pkgsrc tree has copied to your computer, you have a **/usr/pkgsrc** directory filled with build scripts. Before you can use them, you must bootstrap pkgsrc so that you have easy access to the relevant commands you need to build and install the software. - -The way you bootstrap **pkgsrc** depends on the OS you're on. - -For NetBSD, you can just use the bundled bootstrapper: - - -``` -# cd pkgsrc/bootstrap -# ./bootstrap -``` - -On other systems, there are better ways with some customized features included, provided by Joyent. To find out the exact command to run, visit [pkgsrc.joyent.com][8]. For example, on Linux (Fedora, Debian, Slackware, and so on): - - -``` -$ curl -O \ -  -$ BOOTSTRAP_SHA="eb0d6911489579ca893f67f8a528ecd02137d43a" -``` - -Even though the path suggests that the included files are for RHEL 7, the binaries tend to be compatible with all but the most cutting-edge Linux distributions. And should you find a binary incompatible with the distribution you're on, you have the option to build from source. - -Verify the SHA1 checksum: - - -``` -$ echo "${BOOTSTRAP_SHA}" bootstrap-trunk*gz > check-shasum -sha1sum -c check-shasum -``` - -You can also verify the PGP signature: - - -``` -$ curl -O \ - -curl -sS | gpg --import -gpg --verify ${BOOTSTRAP_TAR}{.asc,} -``` - -Once you're confident that you have the right bootstrap kit, install it to **/usr/pkg**: - - -``` -`sudo tar -zxpf ${BOOTSTRAP_TAR} -C /` -``` - -This provides you with the usual pkgsrc commands. Add these locations to [your PATH][9]: - - -``` -$ echo "PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH" >> ~/.bashrc -$ echo "MANPATH=/usr/pkg/man:$MANPATH" >> ~/.bashrc -``` - -If you'd rather use pkgsrc without relying on Joyent's builds, you can just run the **bootstrap** script you got with the pkgsrc tree. Read the relevant README file in the **bootstrap** directory before running it for important system-specific notes. - -![Bootstrapping pkgsrc on NetBSD][10] - -### How to install software with pkgsrc - -Installing a precompiled binary (as you would with DNF or Apt) with pkgsrc is easy. The command for binary installs is **pgkin**, which has its own dedicated site at [pkgin.net][11]. The process ought to feel pretty familiar to anyone who's used Linux. - -To search for the **tmux** package: - - -``` -`$ pkgin search tmux` -``` - -To install the tmux package: - - -``` -`$ sudo pkgin install tmux` -``` - -The **pkgin** command's aim is to mimic the behavior of typical Linux package managers, so there are options to list available packages, to query available packages to find what provides a specific executable, and so on. - -### How to build from source code with pkgsrc - -The real power of pkgsrc, though, is the ease of building a package from source. You downloaded all 20,000+ build scripts in the first setup step, and you can access those by navigating into your pkgsrc tree directly. - -For example, to build **tcsh** from source, first, locate the build script: - - -``` -$ find /usr/pkgsrc -type d -name "tcsh" -/usr/pkgsrc/shells/tcsh -``` - -Next, change into the source directory: - - -``` -`$ cd /usr/pgksrc/shells/tcsh` -``` - -The build script directory contains a number of files to help the application build on your system, but notably, it contains the **DESCR** file, which contains a description of the software, as well as the **Makefile** that triggers the build. - - -``` -$ ls -CVS    DESCR     Makefile -PLIST  distinfo  patches -$ cat DESCR -TCSH is an extended C-shell with many useful features like -filename completion, history editing, etc. -$ -``` - -When you're ready, build, and install: - - -``` -`$ sudo bmake install` -``` - -The pkgsrc system uses the **bmake** command (provided by the pkgsrc checkout in the first step), so be sure to use **bmake** (and not **make** out of habit). - -If you're building for several systems, you can create a package instead of installing right away: - - -``` -$ cd /usr/pgksrc/shells/tcsh -$ sudo bmake package -[...] -=> Creating binary package in /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz -``` - -The packages that pkgsrc creates are standard tarballs, but they can be installed conveniently with **pkg_add**: - - -``` -$ sudo pkg_add /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz -tcsh-X.Y.Z: adding /usr/pkg/bin/tcsh to /etc/shells -$ tcsh -localhost% -``` - -The **pkgtools** collection from pkgsrc provides the **pkg_add**, **pkg_info**, **pkg_admin**, **pkg_create**, and **pkg_delete** commands to help manage packages you build and maintain on your system. - -### Pkgsrc for easy management - -The pkgsrc system offers a direct, hands-on approach to package management. If you're looking for a package manager that stays out of your way and invites customization, give pkgsrc a try on whatever Unix or Unix-like OS you're running. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/pkgsrc-netbsd-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/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) -[2]: http://pkgsrc.org -[3]: https://opensource.com/article/19/7/introduction-gnu-autotools -[4]: http://www.netbsd.org/developers/cvs-repos/cvs_intro.html#intro -[5]: mailto:anoncvs@anoncvs.NetBSD.org -[6]: http://pkgsrc.org/ -[7]: http://www.netbsd.org/docs/pkgsrc/getting.html -[8]: http://pkgsrc.joyent.com/ -[9]: https://opensource.com/article/17/6/set-path-linux -[10]: https://opensource.com/sites/default/files/uploads/pkgsrc-bootstrap.jpg (Bootstrapping pkgsrc on NetBSD) -[11]: http://pkgin.net diff --git a/translated/tech/20191119 How to use pkgsrc on Linux.md b/translated/tech/20191119 How to use pkgsrc on Linux.md new file mode 100644 index 0000000000..dc24aa44c5 --- /dev/null +++ b/translated/tech/20191119 How to use pkgsrc on Linux.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use pkgsrc on Linux) +[#]: via: (https://opensource.com/article/19/11/pkgsrc-netbsd-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Linux 上使用 pkgsrc +====== +NetBSD 的软件包管理器通用、灵活又容易。下面是如何使用它。 +![A person programming][1] + +NetBSD 以能在几乎所有平台上运行而闻名,但你知道它_第二_有名的 **[pkgsrc][2]** 包管理器吗?像 NetBSD 一样,pkgsrc 基本上可以在任何系统上运行,或者至少在任意 Unix 和类 Unix 的系统上上运行。你可以在 BSD、Linux、Illumos、Solaris 和 Mac 上安装 pkgsrc。它总共支持 20 多种操作系统。 + +### 为什么使用 pkgsrc? + +除了 MacOS 之外,所有 Unix 操作系统均自带包管理器。你不一定 _需要_ pkgsrc,但这可能是你想尝试的三个重要原因: + + * **打包**。如果你对打包感到好奇,但尚未尝试自己创建一个软件包,那么 pkgsrc 是一个相对简单的系统,尤其是如果你已经熟悉 Makefile 和类似 [GNU Autotools][3] 之类的构建系统时。 + * **通用**。如果你使用多个操作系统或发行版,那么可能会遇到每个系统的包管理器。你可以在不同的系统上使用 pkgsrc,以便在一个系统中打包了程序,就为所有系统打包了该程序。 + * **灵活**。在许多打包系统中,如何选择二进制包或源码包并不总是很明显。使用 pkgsrc,区别很明显,两种安装方法都一样容易,并且都可以为你解决依赖关系。 + + + +### 如何安装 pkgsrc + +无论你使用的是 BSD、Linux、Illumos、Solaris 还是 MacOS,安装过程都基本相同: + + 1. 使用 CVS 检出 pkgsrc 树 + 2. 引导 pkgsrc 系统 + 3. 安装软件包 + + + +#### 使用 CVS 检出 pkgsrc 树 + +在 Git 和 Subversion 之前,就有了 **[CVS][4]**。要检出代码你无需了解 CVS 太多,如果你习惯 Git,那么可以将_检出_ (checkout) 称为 _克隆_ (clone)。当你用 CVS 检出 pkgsrc 时,你就在下载详细说明如何构建每个软件包的“配方”(“recipes”)。它有很多文件,但是它们都很小,因为你实际上并没有拉取每个包的源码,而只有按需构建时需要的构建基础架构和 Makefile。使用 CVS,你可以轻松地在新版本发布时更新 pkgsrc 检出。 + +pkgsrc 文档建议将树放在 **/usr** 目录下,因此你必须使用 **sudo** (或成为 root)运行此命令: + + +``` +$ cd /usr +$ sudo cvs -q -z2 \ +  -d [anoncvs@anoncvs.NetBSD.org][5]:/cvsroot \ +  checkout -r pkgsrc-2019Q3 -P pkgsrc +``` + +在我撰写本文时,最新版本是 2019Q3。请检查 [pkgsrc.org][6] 主页的新闻部分或 [NetBSD文档][7],以确定最新版本。 + +#### 引导 pkgsrc + +pkgsrc 树复制到你的计算机后,你会看到一个充满构建脚本的 **/usr/pkgsrc** 目录。在使用之前,你必须引导 pkgsrc,以便你可以轻松地访问构建和安装软件所需的相关命令。 + +引导 **pkgsrc** 的方式取决于你所使用操作系统。 + +对于 NetBSD,你只需使用捆绑的引导器: + + +``` +# cd pkgsrc/bootstrap +# ./bootstrap +``` + +在其他系统上,还有更好的方法,包括一些自定义功能,它由 Joyent 提供。要了解运行的确切命令,请访问 [pkgsrc.joyent.com][8]。比如,在 Linux(Fedora、Debian、Slackware 等)上: + +``` +$ curl -O \ +  +$ BOOTSTRAP_SHA="eb0d6911489579ca893f67f8a528ecd02137d43a" +``` + +尽管路径暗示文件适用于 RHEL 7,但二进制文件往往与所有(最前沿的 Linux 发行版)兼容。如果你发现二进制文件与你的发行版不兼容,你可以选择从源码构建。 + +验证 SHA1 校验和: + + +``` +$ echo "${BOOTSTRAP_SHA}" bootstrap-trunk*gz > check-shasum +sha1sum -c check-shasum +``` + +你还可以验证 PGP 签名: + + +``` +$ curl -O \ + +curl -sS | gpg --import +gpg --verify ${BOOTSTRAP_TAR}{.asc,} +``` + +当你确认你已有正确的引导套件,将其安装到 **/usr/pkg**: + + +``` +`sudo tar -zxpf ${BOOTSTRAP_TAR} -C /` +``` + +它为你提供了通常的 pkgsrc 命令。将这些位置添加到[你的 PATH 环境变量中][9]: + + +``` +$ echo "PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH" >> ~/.bashrc +$ echo "MANPATH=/usr/pkg/man:$MANPATH" >> ~/.bashrc +``` + +如果你宁愿使用 pkgsrc 而不依赖于 Joyent 的构建,那么只需运行 pkgsrc 树的**引导**脚本即可。在运行特定于系统的脚本之前,请先阅读 **bootstrap** 目录中相关 README 文件。 + +![Bootstrapping pkgsrc on NetBSD][10] + +### 如何使用 pkgsrc 安装软件 + +使用 pkgsrc 安装预编译的二进制文件(就像使用 DNF 或 Apt 一样)是很容易的。二进制安装的命令是 **pgkin**,它有自己的专门网站 [pkgin.net][11]。对于任何用过 Linux 的人来说,这个过程应该感觉相当熟悉。 + +要搜索 **tmux** 包: + +``` +`$ pkgin search tmux` +``` + +要安装 tmux 包: + + +``` +`$ sudo pkgin install tmux` +``` + +**pkgin** 命令的目的是模仿典型的 Linux 包管理器的行为,因此有选项可以列出可用的包、查找包提供的特定可执行文件,等等。 + +### 如何使用 pkgsrc 从源码构建 + +然而,pkgsrc 真正强大的地方是方便地从源码构建包。你在第一步中检出了所有 20000 多个构建脚本,你可以直接进入 pkgsrc 树来访问这些脚本。 + +例如,要从源码构建 **tcsh**,首先找到构建脚本: + + +``` +$ find /usr/pkgsrc -type d -name "tcsh" +/usr/pkgsrc/shells/tcsh +``` + +接下来,进入源码目录: + + +``` +`$ cd /usr/pgksrc/shells/tcsh` +``` + +构建脚本目录包含许多文件来帮助在你的系统上构建应用,但值得注意的是,这里面有 **DESCR** 文件,它包含软件说明,以及触发构建的 **Makefile**。 + +``` +$ ls +CVS    DESCR     Makefile +PLIST  distinfo  patches +$ cat DESCR +TCSH is an extended C-shell with many useful features like +filename completion, history editing, etc. +$ +``` + +准备就绪后,构建并安装: + + +``` +`$ sudo bmake install` +``` + +pkgsrc 系统使用 **bmake** 命令(在第一步检出 pkgsrc 后提供),因此请务必使用 **bmake**(而不是出于习惯使用 **make**)。 + +如果要为多个系统构建,那么你可以创建一个包,而不是立即安装: + + +``` +$ cd /usr/pgksrc/shells/tcsh +$ sudo bmake package +[...] +=> Creating binary package in /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz +``` + +pkgsrc 创建的包是标准的 tarball,但它可以方便地通过 **pkg_add** 安装: + +``` +$ sudo pkg_add /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz +tcsh-X.Y.Z: adding /usr/pkg/bin/tcsh to /etc/shells +$ tcsh +localhost% +``` + +pkgsrc 的 **pkgtools** 集合提供 **pkg_add**、**pkg_info**、**pkg_admin**、**pkg_create** 和 **pkg_delete** 命令,来帮助管理你在系统上构建和维护软件包。 + +### Pkgsrc,易于管理 + +pkgsrc 系统提供了直接,容易上手的软件包管理方法。 如果你正在寻找一个不妨碍你并且可以定制的包管理器,请在任何运行 Unix 或类 Unix 的系统上试试 pkgsrc。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/pkgsrc-netbsd-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/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: http://pkgsrc.org +[3]: https://opensource.com/article/19/7/introduction-gnu-autotools +[4]: http://www.netbsd.org/developers/cvs-repos/cvs_intro.html#intro +[5]: mailto:anoncvs@anoncvs.NetBSD.org +[6]: http://pkgsrc.org/ +[7]: http://www.netbsd.org/docs/pkgsrc/getting.html +[8]: http://pkgsrc.joyent.com/ +[9]: https://opensource.com/article/17/6/set-path-linux +[10]: https://opensource.com/sites/default/files/uploads/pkgsrc-bootstrap.jpg (Bootstrapping pkgsrc on NetBSD) +[11]: http://pkgin.net From f573b1572fab2d308e978fa1b1308272d17912e7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 25 Nov 2019 09:15:06 +0800 Subject: [PATCH 614/800] translating --- .../tech/20191121 How to document Python code with Sphinx.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191121 How to document Python code with Sphinx.md b/sources/tech/20191121 How to document Python code with Sphinx.md index dc6f2c8cbb..0394d17dd9 100644 --- a/sources/tech/20191121 How to document Python code with Sphinx.md +++ b/sources/tech/20191121 How to document Python code with Sphinx.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 7dcac3423366eac705b7ce8c64f6e932a1aee8d1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 Nov 2019 12:20:18 +0800 Subject: [PATCH 615/800] APL --- sources/tech/20191120 How to install Java on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191120 How to install Java on Linux.md b/sources/tech/20191120 How to install Java on Linux.md index 6cebd574e4..e1ccd9a04e 100644 --- a/sources/tech/20191120 How to install Java on Linux.md +++ b/sources/tech/20191120 How to install Java on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 484bf86ba458b4a94e67a5dae8358eaedc4b0f18 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 25 Nov 2019 22:52:49 +0800 Subject: [PATCH 616/800] TSL&PRF --- .../20191120 How to install Java on Linux.md | 231 ------------------ .../20191120 How to install Java on Linux.md | 215 ++++++++++++++++ 2 files changed, 215 insertions(+), 231 deletions(-) delete mode 100644 sources/tech/20191120 How to install Java on Linux.md create mode 100644 translated/tech/20191120 How to install Java on Linux.md diff --git a/sources/tech/20191120 How to install Java on Linux.md b/sources/tech/20191120 How to install Java on Linux.md deleted file mode 100644 index e1ccd9a04e..0000000000 --- a/sources/tech/20191120 How to install Java on Linux.md +++ /dev/null @@ -1,231 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install Java on Linux) -[#]: via: (https://opensource.com/article/19/11/install-java-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to install Java on Linux -====== -Embrace Java applications on your desktop, and run them on all of your -desktops. -![Coffee beans][1] - -No matter what operating system you're running, there are usually several ways to install an application. Sometimes you might find an application in an app store, or you might install it with a package manager like DNF on Fedora or Brew on Mac, and other times, you might download an executable or an installer from a website. Because Java is such a popular backend for so many applications, it's good to understand the different ways you can install it. The good news is that you have many options, and this article covers them all. - -The bad news is that Java is _big_, not so much in size as in scope. Java is an open source language and specification, meaning that anyone can, in theory, create an implementation of it. That means, before you can install anything, you have to decide which Java you want to install. - -### Do I need a JVM or a JRE or a JDK? - -Java is broadly split into two downloadable categories. The **Java Virtual Machine** (JVM) is a runtime component; it's the "engine" that enables Java applications to launch and run on your computer. It's included in the Java Runtime Environment (JRE). - -The **Java Development Kit** (JDK) is a development toolkit: you can think of it as a garage where tinkerers sit around making adjustments, repairs, and improvements. The JDK includes the Java Runtime Environment (JRE). - -In terms of downloads, this translates to: - - * If you're a user looking to run a Java application, you only need the JRE (which includes a JVM). - * If you're a developer looking to program in Java, you need the JDK (which includes JRE libraries, which in turn includes a JVM). - - - -### What's the difference between OpenJDK, IcedTea, and OracleJDK? - -When Sun Microsystems was bought by Oracle, Java was a major part of the sale. Luckily, Java is an open source technology, so if you're not happy with the way Oracle maintains the project, you have other options. Oracle bundles proprietary components with its Java downloads, while the OpenJDK project is fully open source. - -The IcedTea project is essentially OpenJDK, but its goal is to make it easier for users to build and deploy OpenJDK when using fully free and open source tools. - -### Which Java should I install? - -If you feel overwhelmed by the choices, then the easy answer of which Java implementation you should install is whichever is easiest for you to install. When an application tells you that you need Java 12, but your repository only has Java 8, it's fine to install whatever implementation of Java 12 you can find from a reliable source. On Linux, you can have several different versions of Java installed all at once, and they won't interfere with one another. - -If you're a developer who needs to make the choice, then you should consider what components you need. If you opt for Oracle's version, be aware that there are proprietary plugins and fonts in the package, which could [interfere with distributing your application][2]. It's safest to develop on IcedTea or OpenJDK. - -### Install OpenJDK from a repository - -Now that you know your choices, you can search for OpenJDK or IcedTea with your package manager and install the version you need. Some distributions use the keyword **latest** to indicate the most recent version, which is usually what you need to run whatever application you're trying to run. Depending on what package manager you use, you might even consider using **grep** to filter the search results to include only the latest versions. For example, on Fedora: - - -``` -$ sudo dnf search openjdk | \ -grep latest | cut -f1 -d':' - -java-latest-openjdk-demo.x86_64 -java-openjdk.i686 -java-openjdk.x86_64 -java-latest-openjdk-jmods.x86_64 -java-latest-openjdk-src.x86_64 -java-latest-openjdk.x86_64 -[...] -``` - -Only if the application you're trying to run insists that you need a legacy version of Java should you look past the **latest** release. - -Install Java on Fedora or similar with: - - -``` -`$ sudo dnf install java-latest-openjdk` -``` - -If your distribution doesn't use the **latest** tag, it may use another keyword, such as **default**. Here's a search for OpenJDK on Debian: - - -``` -$ sudo apt search openjdk | less -default-jdk -  Standard Java development kit - -default-jre -  Standard Java runtime - -openjdk-11-jdk -  OpenJDK development kit (JDK) - -[...] -``` - -In this case, the **default-jre** package is appropriate for users, and the **default-jdk** is suitable for developers. - -For example, to install the JRE on Debian: - - -``` -`$ sudo apt install default-jre` -``` - -Java is now installed. - -There are probably many _many_ Java-related packages in your repository. Search on OpenJDK and look for either the most recent JRE or JVM if you're a user and for the most recent JDK if you're a developer. - -### Install Java from the internet - -If you can't find a JRE or JDK in your repository, or the ones you find don't fit your needs, you can download open source Java packages from the internet. You can find downloads of OpenJDK at [openjdk.java.net][3] in the form of a tarball requiring manual installation, or you can download the [Zulu Community][4] edition from Azul in the form of a tarball or installable RPM or DEB packages. - -#### Installing Java from a TAR file - -If you download a TAR file from either Java.net or Azul, you must install it manually. This is often called a "local" install because you're not installing Java to a "global" location. Instead, you choose a convenient place in your PATH. - -If you don't know what's in your PATH, take a look to find out: - - -``` -$ echo $PATH -/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/seth/bin -``` - -In this example PATH, the locations **/usr/local/bin** and **/home/seth/bin** are good options. If you're the only user on your computer, then your own home directory makes sense. If there are many users on your computer, then a common location, such as **/usr/local** or **/opt**, is the best choice. - -If you don't have access to system-level directories like **/usr/local**, which require **sudo** permissions, then create a local **bin** (for "binary," not a waste bin) or **Applications** folder in your own home folder: - - -``` -`$ mkdir ~/bin` -``` - -Add this to your PATH, if it's not already there: - - -``` -$ echo PATH=$PATH:$HOME/bin >> ~/.bashrc -$ source ~/.bashrc -``` - -Finally, unarchive the tarball into the directory you've chosen. - - -``` -$ tar --extract --file openjdk*linux-x64_bin.tar.gz \ -\--directory=$HOME/bin -``` - -Java is now installed. - -#### Installing Java from an RPM or DEB - -If you download an RPM or DEB file from Azul.com, then you can use your package manager to install it. - -For Fedora, CentOS, RHEL, and similar, download the RPM and install it using DNF: - - -``` -`$ sudo dnf install zulu*linux.x86_64.rpm` -``` - -For Debian, Ubuntu, Pop_OS, and similar distributions, download the DEB package and install it using Apt: - - -``` -`$ sudo dpkg -i zulu*linux_amd64.deb` -``` - -Java is now installed. - -#### Setting your Java version with alternatives - -Some applications are developed for a specific version of Java and don't work with any other version. This is rare, but it does happen, and on Linux, you can use either the local install method (see [Installing Java from a TAR file][5]) or the **alternatives** application to deal with this conflict. - -The **alternatives** command looks at applications installed on your Linux system and lets you choose which version to use. Some distributions, such as Slackware, don't provide an **alternatives** command, so you must use the local install method instead. On Fedora, CentOS, and similar distributions, the command is **alternatives**. On Debian, Ubuntu, and similar, the command is **update-alternatives**. - -To get a list of available versions of an application currently installed on your Fedora system: - - -``` -`$ alternatives --list` -``` - -On Debian, you must specify the application you want alternatives for: - - -``` -`$ update-alternatives --list java` -``` - -To choose which version you want to make the system default on Fedora: - - -``` -`$ sudo alternatives --config java` -``` - -On Debian: - - -``` -`$ sudo updates-alternatives --config java` -``` - -You can change the default Java version as needed based on the application you want to run. - -### Running a Java application - -Java applications are typically distributed as JAR files. Depending on how you installed Java, your system may already be configured to run a Java application, which allows you to just double-click the application icon (or select it from an application menu) to run it. If you had to do a local Java install that isn't integrated with the rest of your system, you can launch Java applications directly from a terminal: - - -``` -`$ java -jar ~/bin/example.jar &` -``` - -### Java is a good thing - -Java is one of the few programming environments that places cross-platform development first. There's nothing quite as liberating as asking whether an application runs on your platform, and then discovering that the application was written in Java. As simply as that, you're freed from any platform anxiety you may have had, whether you're a developer or a user. Embrace Java applications on your desktop, and run them on _all_ of your desktops. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/install-java-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/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) -[2]: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html -[3]: http://openjdk.java.net -[4]: https://www.azul.com/downloads/zulu-community -[5]: tmp.wuzOCnXHry#installing-java-from-a-tar-file diff --git a/translated/tech/20191120 How to install Java on Linux.md b/translated/tech/20191120 How to install Java on Linux.md new file mode 100644 index 0000000000..b44d10c65e --- /dev/null +++ b/translated/tech/20191120 How to install Java on Linux.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to install Java on Linux) +[#]: via: (https://opensource.com/article/19/11/install-java-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Linux 上安装 Java +====== + +> 在桌面上拥抱 Java 应用程序,然后在所有桌面上运行它们。 + +![Coffee beans][1] + +无论你运行的是哪种操作系统,通常都有几种安装应用程序的方法。有时你可能会在应用程序商店中找到一个应用程序,或者使用 Fedora 上的 DNF 或 Mac 上的 Brew 这样的软件包管理器进行安装,而有时你可能会从网站上下载可执行文件或安装程序。因为 Java 是这么多流行的应用程序的后端,所以最好了解安装它的不同方法。好消息是你有很多选择,本文涵盖了所有这些内容。 + +坏消息是 Java *太大*,我说的不仅仅是文件大小。Java 是一种开放源代码语言和规范,这意味着从理论上讲,任何人都可以创建它的实现版本。这意味着,在安装任何东西之前,必须确定要安装的 Java 发行版。 + +### 我需要 JVM 还是 JRE 或者 JDK? + +Java 大致分为两个下载类别。Java 虚拟机Java Virtual Machine(JVM)是运行时组件;它是使 Java 应用程序能够在计算机上启动和运行的“引擎”。它包含在 Java 运行时环境Java Runtime Environment(JRE)中。 + +Java 开发工具包Java Development Kit(JDK)是一个开发工具包:你可以将其视为一个车库,修理工可以坐在那里进行调整、修理和改进。JDK 包含 Java 运行时环境(JRE)。 + +以下载来说,这意味着: + +* 如果你是希望运行 Java 应用程序的用户,则只需 JRE(包括了 JVM)。 +* 如果你是希望使用 Java 进行编程的开发人员,则需要 JDK(包括 JRE 库,而 JRE 库又包括 JVM)。 +   +### OpenJDK、IcedTea 和 OracleJDK 有什么不同? + +当太阳微系统Sun Microsystems被 Oracle 收购时,Java 是该交易的主要部分。幸运的是,Java 是一种开源技术,因此,如果你对 Oracle 维护该项目的方式不满意,则可以选择其他方法。Oracle 将专有组件与 Java 下载捆绑在一起,而 OpenJDK 项目是完全开源的。 + +IcedTea 项目本质上是 OpenJDK,但其目标是使用户在使用完全自由开源的工具时更容易构建和部署 OpenJDK。 + +(LCTT 译注:阿里巴巴也有一个它自己维护的 Open JDK 发行版“龙井Dragonwell”。以下引自其官网:“Alibaba Dragonwell 是一款免费的,生产就绪型 Open JDK 发行版,提供长期支持,包括性能增强和安全修复。……Alibaba Dragonwell 作为 Java 应用的基石,支撑了阿里经济体内所有的 Java 业务。Alibaba Dragonwell 完全兼容 Java SE 标准,……”) + +### 我应该安装哪个 Java? + +如果你对这些选择感到不知所措,那么简单的答案就是你应该安装的 Java 实现应该是最容易安装的那个。当应用程序告诉你需要 Java 12,但你的存储库中只有 Java 8 时,可以安装可以从可靠来源中找到的 Java 12 的任何实现。在 Linux 上,你可以一次安装几个不同版本的 Java,它们不会互相干扰。 + +如果你是需要选择使用哪个版本的开发人员,则应考虑所需的组件。如果选择 Oracle 的版本,请注意,软件包中包含专有的插件和字体,可能会[影响你分发你的应用程序][2]。在 IcedTea 或 OpenJDK 上进行开发是最安全的。 + +### 从存储库安装 OpenJDK? + +现在,你已经知道要选择什么了,你可以使用软件包管理器搜索 OpenJDK 或 IcedTea,然后安装所需的版本。有些发行版使用关键字 `latest` 来指示最新版本,这通常是你要运行的应用程序所需要的。根据你使用的软件包管理器,你甚至可以考虑使用 `grep` 过滤搜索结果以仅包括最新版本。例如,在 Fedora 上: + +``` +$ sudo dnf search openjdk | grep latest | cut -f1 -d':' + +java-latest-openjdk-demo.x86_64 +java-openjdk.i686 +java-openjdk.x86_64 +java-latest-openjdk-jmods.x86_64 +java-latest-openjdk-src.x86_64 +java-latest-openjdk.x86_64 +[...] +``` + +只有当你尝试运行的应用程序坚持要求你使用 Java 的旧版本时,你才应该看看 `latest` 之前的版本。 + +在 Fedora 或类似系统上安装 Java: + +``` +$ sudo dnf install java-latest-openjdk +``` + +如果你的发行版不使用 `latest` 标签,则可以使用其他关键字,例如 `default`。以下是在 Debian 上搜索 OpenJDK 的信息: + +``` +$ sudo apt search openjdk | less +default-jdk +  Standard Java development kit + +default-jre +  Standard Java runtime + +openjdk-11-jdk +  OpenJDK development kit (JDK) + +[...] +``` + +在这种情况下,`default-jre` 软件包适合用户,而 `default-jdk` 则适合开发人员。 + +例如,要在 Debian 上安装 JRE: + +``` +$ sudo apt install default-jre +``` + +现在已安装好 Java。 + +你的存储库中可能有*许多*与 Java 相关的软件包。要搜索 OpenJDK,如果你是用户,则查找最新的 JRE 或 JVM,如果你是开发人员,则查找最新的 JDK。 + +### 从互联网上安装 Java + +如果在存储库中找不到 JRE 或 JDK,或者找不到满足你需求的 JRE 或 JDK,则可以从互联网上下载开源的 Java 软件包。你可以在 [openjdk.java.net][3] 中找到需要手动安装的 tar 形式的 OpenJDK 下载文件,或者可以从 Azul 下载 tar 形式的 [Zulu 社区版][4]或其可安装的 RPM 或 DEB 软件包。 + +#### 从 TAR 文件安装 Java + +如果从 Java.net 或 Azul 下载 TAR 文件,则必须手动安装。这通常称为“本地”安装,因为你没有将 Java 安装到“全局”位置。你可以在 `PATH` 中选择一个合适的位置。 + +如果你不知道 `PATH` 中包含什么,请查看一下以找出: + +``` +$ echo $PATH +/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/home/seth/bin +``` + +在此示例 `PATH` 中,位置 `/usr/local/bin` 和 `/home/seth/bin` 是不错的选择。如果你是计算机上的唯一用户,那么你自己的家目录就很有意义。如果你的计算机上有很多用户,则最好选择一个通用位置,例如 `/usr/local` 或 `/opt`。 + +如果你无权访问需要 `sudo` 权限的 `/usr/local` 之类的系统级目录,则可以在你自己的家目录中创建一个本地 `bin`(意思是 “二进制binary”,而不是“垃圾箱waste bin”)或 `Applications` 文件夹: + +``` +$ mkdir ~/bin +``` + +如果它不在你的 `PATH` 中,请将其添加到其中: + +``` +$ echo PATH=$PATH:$HOME/bin >> ~/.bashrc +$ source ~/.bashrc +``` + +最后,将压缩包解压缩到你选择的目录中。 + +``` +$ tar --extract --file openjdk*linux-x64_bin.tar.gz --directory=$HOME/bin +``` + +Java 现在安装好了。 + +#### 从 RPM 或 DEB 安装 Java + +如果从 Azul.com 下载 RPM 或 DEB 文件,则可以使用软件包管理器进行安装。 + +对于 Fedora、CentOS、RHEL 等,请下载 RPM 并使用 DNF 进行安装: + +``` +$ sudo dnf install zulu*linux.x86_64.rpm +``` + +对于 Debian、Ubuntu、Pop_OS 和类似发行版,请下载 DEB 软件包并使用 Apt 安装它: + +``` +$ sudo dpkg -i zulu*linux_amd64.deb +``` + +Java 现在安装好了。 + +#### 用 alternatives 安装你的 Java 版本 + +一些应用程序是为特定版本的 Java 开发的,不能与其他任何版本一起使用。这种情况很少见,但确实会发生,在 Linux 上,你可以使用本地安装方法(请参阅上面“从 TAR 文件安装 Java”一节)或使用 `alternatives` 应用程序来解决此冲突。 + +`alternatives` 命令会查找 Linux 系统上安装的应用程序,并让你选择要使用的版本。有些发行版,例如 Slackware,不提供 `alternatives` 命令,因此你必须使用本地安装方法。在 Fedora、CentOS 和类似的发行版上,该命令是 `alternatives`。在 Debian、Ubuntu 和类似的系统上,该命令是 `update-alternatives`。 + +要获取当前已安装在 Fedora 系统上的应用程序的可用版本列表: + +``` +$ alternatives --list +``` + +在 Debian 上,你必须指定可供替代的应用程序: + +``` +$ update-alternatives --list java +``` + +在 Fedora 上选择要使系统将哪个版本作为默认版本: + +``` +$ sudo alternatives --config java +``` + +在 Debian 上: + +``` +$ sudo updates-alternatives --config java +``` + +你可以根据需要运行的应用程序,根据需要更改默认的 Java 版本。 + +### 运行 Java 应用 + +Java 应用程序通常以 JAR 文件的形式分发。根据你安装 Java 的方式,你的系统可能已经为运行 Java 应用程序配置好了,这使你只需双击应用程序图标(或从应用程序菜单中选择它)即可运行。如果必须执行未与系统其余部分集成的本地 Java 安装,则可以直接从终端启动 Java 应用程序: + +``` +$ java -jar ~/bin/example.jar & +``` + +### Java 是个好东西 + +Java 是少数将跨平台开发放在首位的编程环境之一。没有什么比问一个应用程序是否能在你的平台上运行然后发现该应用程序是用 Java 编写要让人感到松一口气的了。它是如此简单,无论你是开发人员还是用户,你都可以摆脱任何平台上的焦虑。在桌面上拥抱 Java 应用程序,然后在*所有*桌面上运行它们吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/install-java-linux + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html +[3]: http://openjdk.java.net +[4]: https://www.azul.com/downloads/zulu-community +[5]: tmp.wuzOCnXHry#installing-java-from-a-tar-file From fe01375fac94968ecf3a5d755dfc7e2b6ed3472b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:50:52 +0800 Subject: [PATCH 617/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191126=205=20Co?= =?UTF-8?q?mmands=20to=20Find=20the=20IP=20Address=20of=20a=20Domain=20in?= =?UTF-8?q?=20the=20Linux=20Terminal?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md --- ...dress of a Domain in the Linux Terminal.md | 275 ++++++++++++++++++ 1 file changed, 275 insertions(+) create mode 100644 sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md diff --git a/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md new file mode 100644 index 0000000000..e26dd79244 --- /dev/null +++ b/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md @@ -0,0 +1,275 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Commands to Find the IP Address of a Domain in the Linux Terminal) +[#]: via: (https://www.2daygeek.com/linux-command-find-check-domain-ip-address/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +5 Commands to Find the IP Address of a Domain in the Linux Terminal +====== + +This tutorial shows you how to verify a domain name’s or computer name IP address from a Linux terminal. + +This tutorial will allow you to check multiple domains at once. + +You may have already used these commands to verify information. + +However, we will teach you how to use these commands effectively to identify multiple domain IP address information from the Linux terminal. + +This can be done using the following 5 commands. + + * **dig Command:** dig is a flexible cli tool for interrogating DNS name servers. + * **host Command:** host is a simple utility for performing DNS lookups. + * **nslookup Command:** Nslookup command is used to query Internet domain name servers. + * **fping Command:** fping command is used to send ICMP ECHO_REQUEST packets to network hosts. + * **ping Command:** ping command is used to send ICMP ECHO_REQUEST packets to network hosts. + + + +To test this, we created a file called “domains-list.txt” and added the below domains. + +``` +# vi /opt/scripts/domains-list.txt + +2daygeek.com +magesh.co.in +linuxtechnews.com +``` + +### Method-1: How to Find a IP Address of the Domain Using the dig Command + +**[dig command][1]** stands for “domain information groper”‘ is a powerful and flexible command-line tool for querying DNS name servers. + +It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. + +Most DNS administrators use dig command to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. + +It also has a batch mode functionality to read search requests from a file. + +``` +# dig 2daygeek.com | awk '{print $1,$5}' + +2daygeek.com. 104.27.157.177 +2daygeek.com. 104.27.156.177 +``` + +Use the following bash script to find the multiple domain’s IP address. + +``` +# vi /opt/scripts/dig-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +dig $server +short +done | paste -d " " - - - +``` + +Once the above script is added to a file. Set the executable permission for the “dig-command.sh” file. + +``` +# chmod +x /opt/scripts/dig-command.sh +``` + +Finally run the bash script to get the output. + +``` +# sh /opt/scripts/dig-command.sh + +2daygeek.com - 104.27.156.177 104.27.157.177 +magesh.co.in - 104.18.35.52 104.18.34.52 +linuxtechnews.com - 104.27.144.3 104.27.145.3 +``` + +If you want to run the above script in one line, use the following script. + +``` +# for server in 2daygeek.com magesh.co.in linuxtechnews.com; do echo $server "-"; dig $server +short; done | paste -d " " - - - +``` + +Alternatively, you can use the following shell script to find the IP address of the multiple domain. + +``` +# for server in 2daygeek.com magesh.co.in linuxtechnews.com; do dig $server | awk '{print $1,$5}'; done + +2daygeek.com. 104.27.157.177 +2daygeek.com. 104.27.156.177 +magesh.co.in. 104.18.34.52 +magesh.co.in. 104.18.35.52 +linuxtechnews.com. 104.27.144.3 +linuxtechnews.com. 104.27.145.3 +``` + +### Method-2: How to Find a Domain’s IP Address Using the host Command + +**[Host Command][2]** is a simple CLI application to perform **[DNS lookup][3]**. + +It is commonly used to convert names to IP addresses and vice versa. + +When no arguments or options are given, host prints a short summary of its command line arguments and options. + +You can view all types of records in the domain by adding a specific option or type of record in the host command. + +``` +# host 2daygeek.com | grep "has address" | sed 's/has address/-/g' + +2daygeek.com - 104.27.157.177 +2daygeek.com - 104.27.156.177 +``` + +Use the following bash script to find the multiple domain’s IP address. + +``` +# vi /opt/scripts/host-command.sh + +for server in `cat /opt/scripts/domains-list.txt` +do host $server | grep "has address" | sed 's/has address/-/g' +done +``` + +Once the above script is added to a file. Set the executable permission for the “host-command.sh” file. + +``` +# chmod +x /opt/scripts/host-command.sh +``` + +Finally run the bash script to get the output. + +``` +# sh /opt/scripts/host-command.sh + +2daygeek.com - 104.27.156.177 +2daygeek.com - 104.27.157.177 +magesh.co.in - 104.18.35.52 +magesh.co.in - 104.18.34.52 +linuxtechnews.com - 104.27.144.3 +linuxtechnews.com - 104.27.145.3 +``` + +### Method-3: How to Find the IP Address of a Domain Using the nslookup Command + +**[nslookup command][4]** is a program for querying Internet **[domain name servers (DNS)][5]**. + +nslookup has two modes, which are interactive and interactive. + +Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. + +Non-interactive mode is used to print just the name and requested information for a host or domain. + +It is a network administration tool that helps diagnose and resolve DNS related issues. + +``` +# nslookup -q=A 2daygeek.com | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 + +104.27.157.177 +104.27.156.177 +``` + +Use the following bash script to find the multiple domain’s IP address. + +``` +# vi /opt/scripts/nslookup-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +nslookup -q=A $server | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 done | paste -d " " - - - +``` + +Once the above script is added to a file. Set the executable permission for the “nslookup-command.sh” file. + +``` +# chmod +x /opt/scripts/nslookup-command.sh +``` + +Finally run the bash script to get the output. + +``` +# sh /opt/scripts/nslookup-command.sh + +2daygeek.com - 104.27.156.177 104.27.157.177 +magesh.co.in - 104.18.35.52 104.18.34.52 +linuxtechnews.com - 104.27.144.3 104.27.145.3 +``` + +### Method-4: How to Find a Domain’s IP Address Using the fping Command + +**[fping command][6]** is a program such as ping, which uses the Internet Control Message Protocol (ICMP) echo request to determine whether a target host is responding. + +fping differs from ping because it allows users to ping any number of host in parallel. Also, hosts can be entered from a text file. + +fping sends an ICMP echo request, moves the next target in a round-robin fashion, and does not wait until the target host responds. + +If a target host replies, it is noted as active and removed from the list of targets to check; if a target does not respond within a certain time limit and/or retry limit it is designated as unreachable. + +``` +# fping -A -d 2daygeek.com magesh.co.in linuxtechnews.com + +104.27.157.177 (104.27.157.177) is alive +104.18.35.52 (104.18.35.52) is alive +104.27.144.3 (104.27.144.3) is alive +``` + +### Method-5: How to Find the IP Address of the Domain Using the ping Command + +**[ping command][6]** stands for (Packet Internet Groper) command is a networking utility that used to test the target of a host availability/connectivity on an Internet Protocol (IP) network. + +It’s verify a host availability by sending Internet Control Message Protocol (ICMP) Echo Request packets to the target host and waiting for an ICMP Echo Reply. + +It summarize statistical results based on the packets transmitted, packets received, packet loss, typically including the min/avg/max times. + +``` +# ping -c 2 2daygeek.com | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' + +104.27.157.177 +``` + +Use the following bash script to find the multiple domain’s IP address. + +``` +# vi /opt/scripts/ping-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +ping -c 2 $server | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' +done | paste -d " " - - +``` + +Once the above script is added to a file. Set the executable permission for the “dig-command.sh” file. + +``` +# chmod +x /opt/scripts/ping-command.sh +``` + +Finally run the bash script to get the output. + +``` +# sh /opt/scripts/ping-command.sh + +2daygeek.com - 104.27.156.177 +magesh.co.in - 104.18.35.52 +linuxtechnews.com - 104.27.144.3 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-command-find-check-domain-ip-address/ + +作者:[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/dig-command-check-find-dns-records-lookup-linux/ +[2]: https://www.2daygeek.com/linux-host-command-check-find-dns-records-lookup/ +[3]: https://www.2daygeek.com/category/dns-lookup/ +[4]: https://www.2daygeek.com/nslookup-command-check-find-dns-records-lookup-linux/ +[5]: https://www.2daygeek.com/check-find-dns-records-of-domain-in-linux-terminal/ +[6]: https://www.2daygeek.com/how-to-use-ping-fping-gping-in-linux/ From 94ee2e7932792cfefbfbbdcfacc084c95a985a7b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:52:12 +0800 Subject: [PATCH 618/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191126=20App=20?= =?UTF-8?q?Highlight:=20Penguin=20Subtitle=20Player=20for=20Adding=20Subti?= =?UTF-8?q?tles=20to=20Online=20Videos?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191126 App Highlight- Penguin Subtitle Player for Adding Subtitles to Online Videos.md --- ...r for Adding Subtitles to Online Videos.md | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 sources/tech/20191126 App Highlight- Penguin Subtitle Player for Adding Subtitles to Online Videos.md diff --git a/sources/tech/20191126 App Highlight- Penguin Subtitle Player for Adding Subtitles to Online Videos.md b/sources/tech/20191126 App Highlight- Penguin Subtitle Player for Adding Subtitles to Online Videos.md new file mode 100644 index 0000000000..9907322467 --- /dev/null +++ b/sources/tech/20191126 App Highlight- Penguin Subtitle Player for Adding Subtitles to Online Videos.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Penguin Subtitle Player for Adding Subtitles to Online Videos) +[#]: via: (https://itsfoss.com/penguin-subtitle-player/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +App Highlight: Penguin Subtitle Player for Adding Subtitles to Online Videos +====== + +I must confess. I am addicted to subtitles. It helps me understand the dialogues completely, specially if some dialogues are in a different accent or in a different language. + +This has led to a habit of watching online videos with subtitles. + +While streaming services like Netflix and Amazon Prime provide subtitles for their content, the same is not true for all the websites. + +I often discover interesting content that are on YouTube, Dailymotion or other websites. And that becomes a problem because most of the time, these videos don’t have subtitles. + +The good news is that you have the possibility to watch any online video content with subtitles and I’ll share that neat little trick with you in this article. + +### Watch any online video with subtitles using Penguin subtitle player + +![][1] + +What the heck is a Subtitle player? + +The [open source video players][2] you use allow you to add subtitles. Players like [VLC allow you to download subtitles automatically][3]. + +But they are video player and their main task is to play video. + +A subtitle player on the other hand has only one task and that is to play subtitles. Confused? Let me explain. + +A subtitle player basically provides an interface where you can add subtitle file and play the subtitles with a semi transparent background. The trick here is that this player will be visible all the time on top of any other application. + +So if you are running the subtitle player even while using a website, it will still be visible. That actually is the trick to watch any online video with subtitles. + +![An external subtitle playing on top of YouTube video][4] + +All you have to do is to find appropriate subtitles from an online website like OpenSubtitles and add it to the subtitle player. Now open the website where you want to watch the video. Play it full screen (if that option is available) and it will feel like that the subtitles are part of the video itself. + +![][5] + +#### Install Penguin subtitle player + +[Penguin][6] is a free and open source subtitle player. It is available for Linux, macOS and Windows. + +If you are using Ubuntu-based distribution, you can [use this PPA][7] to easily install Penguin subtitle player. + +``` +sudo add-apt-repository ppa:nilarimogard/webupd8 +sudo apt update +sudo apt install penguin-subtitle-player +``` + +For other Linux distributions, Windows and macOS, you can download the installer files from SourceForge: + +[Download Penguin Subtitle Player][8] + +#### Using Penguin subtitle player + +Once you have installed the application, look for it in the menu and start it. You’ll see an interface like this: + +![Penguin Subtitle Player Interface][9] + +If you have already downloaded the .srt subtitle file, you can add it to the player by clicking the folder icon. + +![Add Subtitle In Penguin Subtitle Player][10] + +You can play/pause the subtitles, skip it to a new time. This helps in adjusting the subtitles with the video. + +![Adjust Subtitle In Penguin Subtitle Player][11] + +You can also tweak the appearance of the subtitles and subtitle player. + +![Configure Penguin Subtitle Player][12] + +You also have the option to change the fonts, font size and color of the subtitle text. You may also increase or decrease the transparency and color of the background. + +![Config Options In Penguin Subtitle Player][13] + +You can also resize the subtitle player interface and move it around anywhere on the screen. + +#### Keep in mind + +There are a few things to keep in mind while using Penguin subtitle player. + +Not all video files and subtitle files are made for each other. Subtitle synchronization is a common problem so you’ll have to make sure that the subtitle you downloaded is best suited for the video you want to play. + +Most video players, even the one embedded on the websites, allow to pause and play the video with the space key. Unfortunately, there is no keyboard shortcut to pause the Penguin subtitle player. In other words, you cannot pause the video and the subtitle player in one keystroke. + +With this much configuration, you should be set for watching online videos with subtitles. + +I hope you enjoy this nifty little open source application. Do let me know whether you find it useful or not. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/penguin-subtitle-player/ + +作者:[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/2019/11/Add_subtitle_online_videos.png?ssl=1 +[2]: https://itsfoss.com/video-players-linux/ +[3]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/penguin_subtitle_player.jpg?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2015/05/Penguin_Subtitle_Player.jpg?ssl=1 +[6]: https://github.com/carsonip/Penguin-Subtitle-Player +[7]: https://itsfoss.com/ppa-guide/ +[8]: https://sourceforge.net/projects/penguinsubtitleplayer/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/penguin-subtitle-player-interface.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/add_subtitle_in_penguin_subtitle_player.jpg?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/adjust_subtitle_in_penguin_subtitle_player.jpg?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/configure_penguin_subtitle_player.jpg?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/config_options_in_penguin_subtitle_player.jpg?ssl=1 From 4641a898cbd91ff4422fa72fc2e92af5949bc0c8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:52:25 +0800 Subject: [PATCH 619/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191126=20Google?= =?UTF-8?q?=20to=20Add=20Mainline=20Linux=20Kernel=20Support=20to=20Androi?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191126 Google to Add Mainline Linux Kernel Support to Android.md --- ...ainline Linux Kernel Support to Android.md | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 sources/tech/20191126 Google to Add Mainline Linux Kernel Support to Android.md diff --git a/sources/tech/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/sources/tech/20191126 Google to Add Mainline Linux Kernel Support to Android.md new file mode 100644 index 0000000000..cf6b39cbf9 --- /dev/null +++ b/sources/tech/20191126 Google to Add Mainline Linux Kernel Support to Android.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Google to Add Mainline Linux Kernel Support to Android) +[#]: via: (https://itsfoss.com/mainline-linux-kernel-android/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Google to Add Mainline Linux Kernel Support to Android +====== + +The current Android ecosystem is polluted with hundreds of different versions of Android, each running a different variant of the Linux kernel. Each version is designed for a different phone and it’s different configurations. Google has been working to fix the problem by adding the mainline Linux kernel to Android. + +### How the Linux kernel is currently handled in Android + +Before it reaches you, the Linux kernel on your cellphone goes through [three major steps][1]. + +First, Google takes the LTS (Long Term Support) version of the Linux kernel and adds all of the Android-specific code. This becomes the “Android Common kernel”. + +Google then sends this code to the company that creates the System on a Chip (SoC) that runs your phone. This is usually Qualcomm. + +Once the SoC maker finishes add code to support the CPU and other chips, the kernel is then passed on to the actual device maker, such as Samsung or Motorola. The device maker then adds code to support the rest of the phone, such as the display and camera. + +Each of these steps takes a while to complete and results in a kernel that won’t work with any other device. It also means that the kernel is very old, usually about two years old. For example, the Google Pixel 4, which shipped last month, has a kernel from November 2017, which will never get updated. + +Google has pledged to create security patches for older devices, which means they’re stuck keeping an eye on a huge hodge-podge of old code. + +### The Future + +![][2] + +Last year, Google announced [plans][3] to fix this mess. This year they revealed what progress they made at the 2019 Linux Plumbers Conference. + +> “We know what it takes to run Android but not necessarily on any given hardware. So our goal is to basically find all of that out, then upstream it and try to be as close to mainline as possible.” +> +> Sandeep Patil, [Android Kernel Team Lead][1] + +They did show off a Xiaomi Poco F1 running Android with a proper Linux kernel. However, it some things did not [appear to be working][4], such as the battery percentage which was stuck at 0%. + +So, how does Google plan to make this work? By taking a page from their [Project Treble][5] playbook. Before Project Treble, the low-level code that interacted with the device and Android itself was one big mess of code. Project Treble separated the two and made them modular so that Android updates could be shipped quicker and the low-level code could remain unchanged between updates. + +Google wants to bring the same modularity to the kernel. Their [plan][1] “involves stabilizing Linux’s in-kernel ABI and having a stable interface for the Linux kernel and hardware vendors to write to. Google wants to decouple the Linux kernel from its hardware support.” + +So this means that Google would ship a kernel and hardware drivers would be loaded as kernel modules. Currently, this is just a proposal. There are still quite a few technical problems that have to be solved. so, this won’t happen any time soon. + +### Opposition from Open Source + +The Open Source community will not be happy with the idea of putting proprietary code in the kernel. The [Linux kernel guidelines][6] state that drivers have to have a GPL license to be included in the kernel. They also point out that if a change in the driver causes an error, it will be resolved by the person who created the error. This means less work for device makers in the long run. + +### Final Thoughts on including mainline kernel to Andorid + +So far, this is just a proposal. There is a good chance that Google will start working on the project only to abandon it once they realize how much work this will take. Just take a look at how many projects Google has [already abandoned][7]. + +[Android Police][4] made a good point by mentioned that Google is working on its [Fuchsia operating system][8], which seems to have the goal of replacing Android one day. + +So, the question is which monumental task will Google try to complete, getting Android running with a mainline Linux kernel or complete work on their unified Android replacement? Only time can answer that. + +What are your thoughts on this topic? 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][9]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mainline-linux-kernel-android/ + +作者:[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://arstechnica.com/gadgets/2019/11/google-outlines-plans-for-mainline-linux-kernel-support-in-android/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/mainline_linux_kernel_android.png?ssl=1 +[3]: https://lwn.net/Articles/771974/ +[4]: https://www.androidpolice.com/2019/11/19/google-wants-android-to-use-regular-linux-kernel-potentially-improving-updates-and-security/ +[5]: https://www.computerworld.com/article/3306443/what-is-project-treble-android-upgrade-fix-explained.html +[6]: https://www.kernel.org/doc/Documentation/process/stable-api-nonsense.rst +[7]: https://killedbygoogle.com/ +[8]: https://itsfoss.com/fuchsia-os-what-you-need-to-know/ +[9]: https://reddit.com/r/linuxusersgroup From 626b9ebc72fd825bea8e787f80f02d0c05864529 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:52:51 +0800 Subject: [PATCH 620/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=20How=20?= =?UTF-8?q?to=20Install=20Ansible=20(Automation=20Tool)=20on=20CentOS=208/?= =?UTF-8?q?RHEL=208?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md --- ...le (Automation Tool) on CentOS 8-RHEL 8.md | 209 ++++++++++++++++++ 1 file changed, 209 insertions(+) create mode 100644 sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md diff --git a/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md new file mode 100644 index 0000000000..d23a8aaf52 --- /dev/null +++ b/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md @@ -0,0 +1,209 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8) +[#]: via: (https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8 +====== + +**Ansible** is an awesome automation tool for Linux sysadmins. It is an open source configuration tool which allows sysadmins to manage hundreds of servers from one centralize node i.e **Ansible Server**. Ansible is the preferred configuration tool when it is compared with similar tools like **Puppet**, **Chef** and **Salt** because it doesn’t need any agent and it works on SSH and python. + +[![Install-Ansible-CentOS8-RHEL8][1]][2] + +In this tutorial we will learn how to install and use Ansible on CentOS 8 and RHEL 8 system + +Ansible Lab Details: + + * Minimal CentOS 8 / RHEL 8 Server (192.168.1.10) with Internet Connectivity + * Two Ansible Nodes – Ubuntu 18.04 LTS (192.168.1.20) & CentOS 7 (192.168.1.30) + + + +### Ansible Installation steps on CentOS 8  + +Ansible package is not available in default CentOS 8 package repository. so we need to enable [EPEL Repository][3] by executing the following command, + +``` +[root@linuxtechi ~]$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y +``` + +Once the epel repository is enabled, execute the following dnf command to install Ansible + +``` +[root@linuxtechi ~]$ sudo dnf install ansible +``` + +Output of above command : + +![dnf-install-ansible-centos8][1] + +Once the ansible is installed successfully, verify its version by running the following command + +``` +[root@linuxtechi ~]$ sudo ansible --version +``` + +![Ansible-version-CentOS8][1] + +Above output confirms that Installation is completed successfully on CentOS 8. + +Let’s move to RHEL 8 system + +### Ansible Installation steps on RHEL 8 + +If you have a valid RHEL 8 subscription then use following subscription-manager command to enable Ansible Repo, + +``` +[root@linuxtechi ~]$ sudo subscription-manager repos --enable ansible-2.8-for-rhel-8-x86_64-rpms +``` + +Once the repo is enabled then execute the following dnf command to install Ansible, + +``` +[root@linuxtechi ~]$ sudo dnf install ansible -y +``` + +Once the ansible and its dependent packages are installed then verify ansible version by executing the following command, + +``` +[root@linuxtechi ~]$ sudo ansible --version +``` + +### Alternate Way to Install Ansible via pip3 on CentOS 8 / RHEL 8 + +If you wish to install Ansible using **pip** (**python’s package manager**) then first install pyhton3 and python3-pip packages using following command, + +``` +[root@linuxtechi ~]$ sudo dnf install python3 python3-pip -y +``` + +After pyhthon3 installation, verify its version by running + +``` +[root@linuxtechi ~]$ python3 -V +Python 3.6.8 +[root@linuxtechi ~]$ +``` + +Now run below pip3 command to install Ansible, + +``` +[root@linuxtechi ~]$ pip3 install ansible --user +``` + +Output, + +![Ansible-Install-pip3-centos8][1] + +Above output confirms that Ansible has been installed successfully using pip3. Let’s see how we can use Ansible + +### How to Use Ansible Automation Tool? + +When we install Ansible using yum or dnf command then its configuration file, inventory file and roles directory created automatically under /etc/ansible folder. + +So, let’s add a group with name “**labservers**” and under this group add ubuntu 18.04 and CentOS 7 System’s ip address in **/etc/ansible/hosts** file + +``` +[root@linuxtechi ~]$ sudo vi /etc/ansible/hosts +… +[labservers] +192.168.1.20 +192.168.1.30 +… +``` + +Save & exit file. + +Once the inventory file (/etc/ansible/hosts) is updated then exchange your user’s ssh public keys with remote systems which are part of “labservers” group. + +Let’s first generate your local user’s public and private key using ssh-keygen command, + +``` +[root@linuxtechi ~]$ ssh-keygen +``` + +Now exchange public key between the ansible server and its clients using the following command, + +``` +[root@linuxtechi ~]$ ssh-copy-id root@linuxtechi +[root@linuxtechi ~]$ ssh-copy-id root@linuxtechi +``` + +Now let’s try couple of Ansible commands, first verify the connectivity from Ansible server to its clients using ping module, + +``` +[root@linuxtechi ~]$ ansible -m ping "labservers" +``` + +**Note:** If we don’t specify the inventory file in above command then it will refer the default hosts file (i.e /etc/ansible/hosts) + +Output, + +![ansible-ping-module-centos8][1] + +Let’s check kernel version of each client using Ansible shell command, + +``` +[root@linuxtechi ~]$ ansible -m command -a "uname -r" "labservers" +192.168.1.30 | CHANGED | rc=0 >> +4.15.0-20-generic +192.168.1.20 | CHANGED | rc=0 >> +3.10.0-327.el7.x86_64 +[root@linuxtechi ~]$ +``` + +Use the following ansible command to list all hosts from the inventory file, + +``` +[root@linuxtechi ~]$ ansible all -i /etc/ansible/hosts --list-hosts + hosts (4): + 192.168.100.1 + 192.168.100.10 + 192.168.1.20 + 192.168.1.30 +[root@linuxtechi ~]$ +``` + +Use the following ansible command to list only hosts from “labservers” group + +``` +root@linuxtechi ~]$ ansible labservers -i /etc/ansible/hosts --list-hosts + hosts (2): + 192.168.1.20 + 192.168.1.30 +[root@linuxtechi ~]$ +``` + +That’s all from this article, we have successfully demonstrated on how to install and use Ansible on CentOS 8 and RHEL 8 System. Please do you share your feedback and comments. + + * [Facebook][4] + * [Twitter][5] + * [LinkedIn][6] + * [Reddit][7] + + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/ + +作者:[Pradeep Kumar][a] +选题:[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/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.linuxtechi.com/wp-content/uploads/2019/11/Install-Ansible-CentOS8-RHEL8.png +[3]: http://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/ +[4]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-ansible-centos-8-rhel-8%2F&t=How%20to%20Install%20Ansible%20%28Automation%20Tool%29%20on%20CentOS%208%2FRHEL%208 +[5]: http://twitter.com/share?text=How%20to%20Install%20Ansible%20%28Automation%20Tool%29%20on%20CentOS%208%2FRHEL%208&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-ansible-centos-8-rhel-8%2F&via=Linuxtechi +[6]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-ansible-centos-8-rhel-8%2F&title=How%20to%20Install%20Ansible%20%28Automation%20Tool%29%20on%20CentOS%208%2FRHEL%208 +[7]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-ansible-centos-8-rhel-8%2F&title=How%20to%20Install%20Ansible%20%28Automation%20Tool%29%20on%20CentOS%208%2FRHEL%208 From e52c593e7b0f7d61f9cad0288951bb5151c2e3b1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:53:35 +0800 Subject: [PATCH 621/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=20My=20t?= =?UTF-8?q?op=205=20Ansible=20modules?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191125 My top 5 Ansible modules.md --- .../tech/20191125 My top 5 Ansible modules.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/tech/20191125 My top 5 Ansible modules.md diff --git a/sources/tech/20191125 My top 5 Ansible modules.md b/sources/tech/20191125 My top 5 Ansible modules.md new file mode 100644 index 0000000000..9a76342854 --- /dev/null +++ b/sources/tech/20191125 My top 5 Ansible modules.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My top 5 Ansible modules) +[#]: via: (https://opensource.com/article/19/11/ansible-modules) +[#]: author: (Mark Phillips https://opensource.com/users/markp) + +My top 5 Ansible modules +====== +Learn how to achieve almost anything with these Ansible modules. +![][1] + +When I was growing up, my grandfather had a shed in his garden. He would spend hours in there, making and fixing things. This was way before we had the internet, so I spent a lot of time studying him creating things in that shed. Although the shed was full of many tools, from drills to lathes to electrical gubbins and lots of things I doubt I could identify even today, he made use of only a tiny subset of what he had at hand. Yet there never seemed to be limits to what he could achieve. + +I tell you that story because I feel like my career has been spent in a metaphorical shed. Computers are so many tools, all in a small (virtual?) space. And there are tool sheds within tool sheds—my favourite being Ansible. The recent 2.9 release ships with 3,681 modules! **3,681!** When I first started using Ansible in the summer of 2013, version 1.2.1 had just 113 modules, yet, as [I wrote at the time][2], I could still achieve anything I imagined. + +Modules are the backbone of Ansible, the gears to make light of heavy lifting. They're designed to do one job well, thus realising [the Unix philosophy][3]. This is how we've come to bundle so many of them; Ansible as the conductor of the orchestra now has a lot of instruments at its command. + +Reviewing a Git repository of my Ansible plays and roles over the years reveals that I have used just 35 modules. This small subset was used to build large infrastructures. I wonder what could be achieved with an even smaller subset, though? As I reviewed those 35, I pondered if I could achieve the same results with only five modules at my disposal. So here are my five favourite modules, in a rather tenuous order of precedence. + +### 5. [authorized_key][4] + +Secure shell (SSH) is at the heart of Ansible, at least for almost everything besides Windows. Key (no pun intended) to using SSH efficiently with Ansible is… [keys][5]! Slight aside—there are a lot of very cool things you can do for security with SSH keys. It's worth perusing the **authorized_keys** section of the [sshd manual page][6]. Managing SSH keys can become laborious if you're getting into the realms of granular user access, and although we could do it with either of my next two favourites, I prefer to use the module because it [enables easy management through variables][7]. + +### 4. [file][8] + +Besides the obvious function of placing a file somewhere, the **file** module also sets ownership and permissions. I'd say that's a lot of _bang for your buck_ with one module. I'd proffer a substantial portion of security relates to setting permissions too, so the **file** module plays nicely with **authorized_keys**. + +### 3. [template][9] + +There are so many ways to manipulate the contents of files, and I see lots of folk use **[lineinfile][10]**. I've used it myself for small tasks. However, the **template** module is so much clearer because you maintain the entire file for context. My preference is to write Ansible content in such a way that anyone can understand it _easily_—which to me means not making it hard to understand what is happening. Use of **template** means being able to see the entire file you're putting into place, complete with the variables you are using to change pieces. + +### 2. [uri][11] + +Many modules in the current distribution leverage Ansible as an orchestrator. They talk to another service, rather than doing something specific like putting a file into place. Usually, that talking is over HTTP too. In the days before many of these modules existed, you _could_ program an API directly using the **uri** module. It's a powerful access tool, enabling you to do a lot. I wouldn't be without it in my fictitious Ansible shed. + +### 1. [shell][12] + +The joker card in our pack. The Swiss Army Knife. If you're absolutely stuck for how to control something else, use **shell**. Some will argue we're now talking about making Ansible a Bash script—but, I would say it's still better because with the use of the **name** parameter in your plays and roles, you document every step. To me, that's as big a bonus as anything. Back in the days when I was still consulting, I once helped a database administrator (DBA) migrate to Ansible. The DBA wasn't one for change and pushed back at changing working methods. So, to ease into the Ansible way, we called some existing DB management scripts from Ansible using the **shell** module. With an informative **name** statement to accompany the task. + +You can achieve a lot with these five modules. Yes, modules designed to do a specific task will make your life even easier. But with a smidgen of engineering simplicity, you can achieve a lot with very little. Ansible developer Brian Coca is a master at it, and [his tips and tricks talk][13] is always worth a watch. + +* * * + +What do you think about my top five? What five modules would you pick and why, if you were so limited? Let me know in the comments below! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/ansible-modules + +作者:[Mark Phillips][a] +选题:[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/markp +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mandelbrot_set.png?itok=bmPc0np5 +[2]: http://probably.co.uk/post/puppet-vs-chef-vs-ansible/ +[3]: https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well +[4]: https://docs.ansible.com/ansible/latest/modules/authorized_key_module.html +[5]: https://linux.die.net/man/1/ssh-keygen +[6]: https://linux.die.net/man/8/sshd +[7]: https://github.com/phips/ansible-demos/blob/3bf59df1eb2390b31b5c42333197e2fbb7fec93f/roles/ansible-users/tasks/main.yml#L35 +[8]: https://docs.ansible.com/ansible/latest/modules/file_module.html +[9]: https://docs.ansible.com/ansible/latest/modules/template_module.html +[10]: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html +[11]: https://docs.ansible.com/ansible/latest/modules/uri_module.html +[12]: https://docs.ansible.com/ansible/latest/modules/shell_module.html +[13]: https://www.ansible.com/ansible-tips-and-tricks From 72790a22a17e0fd2026ee60f50c3f5d85a161be1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:53:47 +0800 Subject: [PATCH 622/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=20My=20j?= =?UTF-8?q?ourney=20to=20becoming=20an=20open=20source=20maintainer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191125 My journey to becoming an open source maintainer.md --- ...y to becoming an open source maintainer.md | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 sources/tech/20191125 My journey to becoming an open source maintainer.md diff --git a/sources/tech/20191125 My journey to becoming an open source maintainer.md b/sources/tech/20191125 My journey to becoming an open source maintainer.md new file mode 100644 index 0000000000..aee390002d --- /dev/null +++ b/sources/tech/20191125 My journey to becoming an open source maintainer.md @@ -0,0 +1,251 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My journey to becoming an open source maintainer) +[#]: via: (https://opensource.com/article/19/11/journey-open-source-maintainer) +[#]: author: (Juliano Alves https://opensource.com/users/juliano) + +My journey to becoming an open source maintainer +====== +Hacktoberfest got me thinking. My first contribution to open source was +challenging, but everything I've learned since then has made me a better +developer. +![Guy on a laptop on a building][1] + +[Hacktoberfest][2] is an initiative that invites developers from around the world to participate and contribute to open source. This is the second year in a row that I participated to completion of the challenge, and I was so inspired by it that I want to share my slightly longer journey to open source software. + +### A long time ago, in a galaxy far, far away… + +The year was 2010. The universe made its move to make me cross paths with my good friend, [Jonas Abreu][3]. Jonas is the creator of [Mirror][4], a simple domain-specific language (DSL) layer over the Java Reflection API, which makes [meta-programming][5] easier. There was a feature request open for a proxy creation capability, and Jonas asked me if I was interested in implementing it. I accepted the challenge. + +I suffered for three days, dealing with code that I didn’t understand… until I did. I still remember the feeling that my triumph brought me that day. That pain was knowledge invading my brain! + +This code was my first contribution to open source. I took quite a lot away from my experience contributing to Mirror: + + * A lot about Java meta-programming + * The concept of proxy classes + * [Javassist][6] and [cglib][7] frameworks + * How to receive and provide useful and respectful feedback + * How to design a tool that will be used by others + * Some interesting [dark magic][8] + + + +Most importantly, I took away a sense of purpose. I love the idea of contributing to the greater good while challenging myself and working with brilliant engineers who were way smarter than me. + +### Exploring ways to contribute to open source + +I started taking part in community initiatives, like running coding dojos. While doing this, I met more great devs, and we started a small group. At some point, that group decided to learn Scala. We studied and coded together, and eventually started [Scaladores][9], the Scala user group of São Paulo. + +Eventually, Jonas started talking about a different approach for learning, called [deliberate practice][10]. + +> _What if we could put all this recently acquired knowledge altogether?_ + +The resulting project from studying this practice is [Aprenda][11], a learning platform that mixes gamification and deliberate practice to make it easier to learn HTML, regular expressions, or Git. Building something this significant felt like leveling up in my pursuit of open source contribution. I also found that I picked up more knowledge about programming and practices to motivate both others and myself.  + +As much as I enjoyed this pursuit, I couldn’t dedicate a lot of time to this project. At the same time as I was making progress on Aprenda, I had to shift focus to a new job. + +### Contributing through my own Ruby gem + +My new work had me in a common pattern: Every problem was solved by writing code that creates, reads, updates, or deletes data (CRUD). It gave me an idea, so I started a new project. I wanted to generate code the same way Ruby on Rails, a powerful web framework, allowed me to set up an environment with a simple command: **rails g scaffold**. Using [Thor][12], the same gem that powers Rails generators, I created [Spring MVC Scaffold][13]. Now, any time I needed to create a CRUD I typed: + + +``` +$ springmvc scaffold product name:string value:double active:boolean +``` + +The code I wrote reducing the work my team had to do to get their job done, and I shared it further by posting it publicly. Here are some of the highlights of what I learned: + + * Generating code and files with Thor + * Defining commands for a CLI + * Organizing Ruby lib code + * Creating a Ruby gem + * Building projects with [Travis CI][14] + * Publishing to RubyGems + + + +> _After solving a common problem, think about making that solution available. Most likely, other people have similar problems._ + +Even though it’s not being maintained anymore, Spring MVC Scaffold is still available on [RubyGems][15]. And I tell you what, after that project, I went to work in a tech environment full of problems. + +### Shifting technology + +My new work required a shift in languages. I started working with Microsoft .NET, and I found issues that other communities had already solved. That recognition excited me because I knew it was my opportunity. My new opportunity to contribute came in the form of porting those solutions. + +#### Selenia + +[Selenium][16] is the dominate way to programmatically interact with websites as if the code is a "real" user (accessing it via a web browser). The API has always been too complex in my opinion. So I built a tool, we called Selenia, that could be used to write concise UI tests in C#, so instead of using: + + +``` +IWebDriver driver; +ChromeOptions options = [new][17] ChromeOptions(); +options.addExtensions([new][17] File("/path/to/extension.crx")); +ChromeDriver driver = [new][17] ChromeDriver(options); +driver = [new][17] ChromeDriver(); +driver.Navigate().GoToUrl(""); + +IWebElement query = driver.FindElement(By.Name("q")); +query.SendKeys("Selenium"); +query.Submit(); + +driver.Quit(); +``` + +We can write as: + + +``` +Open(""); +S(By.Name("q").Value("Selenia").Enter(); +``` + +Selenium users may have a question at this point. If you are wondering, the answer is "no." It’s not necessary to close the driver yourself. + +#### Designing for immutability with Ioget + +Immutability, which means never changing an object that already exists, makes a developer’s life easy. This opinion is a newer one, however. Back in the day, ASP.NET MVCs would recommend updating information in place. The only way to instantiate objects was via **setters**. + +I built [Ioget][18] to help with unmarshalling request parameters in web applications. HTTP request parameters are strings, so Ioget looks for the best way to parse those params according to the given class, instantiating objects via their constructors and therefore making them immutable. + +I published this project publicly to NuGet, but I never managed to integrate Ioget with ASP.NET like I intended to. I stopped working with Microsoft technology, and thus this project fell behind from its once lofty goals. + +Continuing with my deliberate practice, I kept track of the lessons learned along the way. + + * [Reification][19] + * ASP.NET MVC internals + * Monad implementation + * .NET framework internals + + + +I also took note of a pattern I used with Selenia. I really like this snippet, which I used to close the driver: + + +``` +private void MarkForAutoClose(IWebDriver driver) => +  AppDomain.CurrentDomain.DomainUnload += (s, e) => driver.Quit(); +``` + +### Contributing to Quill + +I moved to London in 2016, which paused my contributions for a while. Eventually, I watched a talk by [Gustavo Amigo][20] about his project, [quill-pgsql][21], which is an extension to support PostgreSQL data types with [Quill][22]. He mentioned that this project was in its early moments, which meant it was ideal for someone to join, and I was interested in writing in Scala. After a few pull requests, I decided to contribute to the main project. + +Quill transforms regular collection-like code into SQL queries in compile-time. I consider it the most challenging (and interesting) project I have ever contributed to. It’s been a few years since I started, and today I am [one of the maintainers][23]. + +Here’s what I learned by working on Quill: + + * Abstract syntax trees (AST) + * The Dark Arts (also known as [Scala macros][24]) + * How to make code extensible via [implicits][25] + * Exclusive and weird [SQL rules][26] + + + +Quill has a module called quill-async, which uses [an asynchronous database driver][27] that is no longer maintained. Quill’s creator, [Flavio Brasil][28], suggested that we could write a new async driver. That’s how [Non-Blocking Database Connectivity (NDBC)][29] got started. + +NDBC is a fully async alternative to Java Database Connectivity (JDBC). Its architecture was designed to provide high-performance, non-blocking connectivity to the database on top of [Trane.io Futures][30] and [Netty 4][31]: + + +``` +// Create a Config with an Embedded Postgres +Config config = Config.create("io.trane.ndbc.postgres.netty4.DataSourceSupplier", "localhost", 0, "user") +                      .database("test_schema") +                      .password("test") +                      .embedded("io.trane.ndbc.postgres.embedded.EmbeddedSupplier"); + +// Create a DataSource +DataSource<[PreparedStatement][32], Row> ds = DataSource.fromConfig(config); + +// Define a timeout +Duration timeout = Duration.ofSeconds(10); + +// Send a query to the db defining a timeout and receiving back a List +List<Row> rows = ds.query("SELECT 1 AS value").get(timeout); + +// iterate over awesome strongly typed rows +rows.forEach(row -> [System][33].out.println(row.getLong("value"))); +``` + +More knowledge was acquired along the way: + + * Understanding binary protocols + * Using Netty 4 + * Weaknesses of the Java type system + * Fully implementing functional structures + + + +That’s where I am at the moment. I divide my attention between Quill and NDBC, trying to make them work together. + +### Plans for the future + +The contributions I have in mind for the near future are implementing: + + * Array support in [Finagle Postgres][34] + * A Clojure wrapper for NDBC + * A ndbc-spring module + * A CLI in [Rust][35] + + + +I now have almost 10 years of open source in my journey, and it taught me something extremely valuable: Open source is about sharing knowledge. When I am solving an issue, I am acquiring knowledge. When I send a pull request, I am spreading that knowledge. Knowledge brings more knowledge! + +I strongly recommend that you become part of the open source community. It can be difficult, especially in the beginning, but everything you will learn will make you a better developer. I promise. + +> _Open source is about sharing knowledge. When I am solving an issue, I am acquiring knowledge. When I send a pull request, I am spreading that knowledge. Knowledge brings more knowledge!_ + +_This article was originally posted on [Juliano Alves' Programming Blog][36]. It has been edited for style and clarity._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/journey-open-source-maintainer + +作者:[Juliano Alves][a] +选题:[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/juliano +[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 (Guy on a laptop on a building) +[2]: https://hacktoberfest.digitalocean.com/ +[3]: https://twitter.com/jonasabreu +[4]: http://projetos.vidageek.net/mirror/mirror/ +[5]: https://www.ibm.com/developerworks/library/l-metaprog1/index.html +[6]: https://www.javassist.org/ +[7]: https://github.com/cglib/cglib +[8]: https://github.com/vidageek/mirror/blob/master/src/main/java/net/vidageek/mirror/provider/java/ObjenesisConstructorBypassingReflectionProvider.java +[9]: https://www.meetup.com/scaladores/ +[10]: https://jamesclear.com/deliberate-practice-theory +[11]: https://aprenda.vidageek.net/ +[12]: http://whatisthor.com/ +[13]: https://github.com/juliano/springmvc-scaffold +[14]: https://travis-ci.com/ +[15]: https://rubygems.org/gems/springmvc-scaffold +[16]: https://www.seleniumhq.org/ +[17]: http://www.google.com/search?q=new+msdn.microsoft.com +[18]: https://www.nuget.org/packages/Ioget/ +[19]: https://en.wikipedia.org/wiki/Reification_(computer_science) +[20]: https://github.com/gustavoamigo +[21]: https://github.com/gustavoamigo/quill-pgsql +[22]: https://getquill.io/ +[23]: https://github.com/getquill/quill +[24]: http://scalamacros.org/ +[25]: https://docs.scala-lang.org/tour/implicit-parameters.html +[26]: https://teamsql.io/blog/?p=923 +[27]: https://github.com/mauricio/postgresql-async +[28]: https://twitter.com/flaviowbrasil +[29]: https://ndbc.io/ +[30]: http://trane.io/ +[31]: https://netty.io/ +[32]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+preparedstatement +[33]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[34]: https://github.com/finagle/finagle-postgres/issues/55 +[35]: https://opensource.com/tags/rust +[36]: https://juliano-alves.com/2019/11/02/the-journey-of-an-open-source-developer/ From b22a6a6933f26225c8d117cfe6a0d71083c8216e Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:53:59 +0800 Subject: [PATCH 623/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=20How=20?= =?UTF-8?q?to=20use=20loops=20in=20awk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191125 How to use loops in awk.md --- .../tech/20191125 How to use loops in awk.md | 162 ++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 sources/tech/20191125 How to use loops in awk.md diff --git a/sources/tech/20191125 How to use loops in awk.md b/sources/tech/20191125 How to use loops in awk.md new file mode 100644 index 0000000000..cf7abb6f62 --- /dev/null +++ b/sources/tech/20191125 How to use loops in awk.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use loops in awk) +[#]: via: (https://opensource.com/article/19/11/loops-awk) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to use loops in awk +====== +Learn how to use different types of loops to run commands on a record +multiple times. +![arrows cycle symbol for failing faster][1] + +Awk scripts have three main sections: the optional BEGIN and END functions and the functions you write that are executed on each record. In a way, the main body of an awk script is a loop, because the commands in the functions run for each record. However, sometimes you want to run commands on a record more than once, and for that to happen, you must write a loop. + +There are several kinds of loops, each serving a unique purpose. + +### While loop + +A **while** loop tests a condition and performs commands _while_ the test returns _true_. Once a test returns _false_, the loop is broken. + + +``` +#!/bin/awk -f + +BEGIN { +        # Print the squares from 1 to 10 + +    i=1; +    while (i <= 10) { +        print "The square of ", i, " is ", i*i; +        i = i+1; +    } +exit; +} +``` + +In this simple example, awk prints the square of whatever integer is contained in the variable _i_. The **while (i <= 10)** phrase tells awk to perform the loop only as long as the value of _i_ is less than or equal to 10. After the final iteration (while _i_ is 10), the loop ends. + +### Do while loop + +The **do while** loop performs commands after the keyword **do**. It performs a test afterward to determine whether the stop condition has been met. The commands are repeated only _while_ the test returns true (that is, the end condition has _not_ been met). If a test fails, the loop is broken because the end condition has been met. + + +``` +#!/usr/bin/awk -f +BEGIN { + +        i=2; +        do { +                print "The square of ", i, " is ", i*i; +                i = i + 1 +        } +        while (i < 10) + +exit; +} +``` + +### For loops + +There are two kinds of **for** loops in awk. + +One kind of **for** loop initializes a variable, performs a test, and increments the variable together, performing commands while the test is true. + + +``` +#!/bin/awk -f + +BEGIN { +    for (i=1; i <= 10; i++) { +        print "The square of ", i, " is ", i*i; +    } +exit; +} +``` + +Another kind of **for** loop sets a variable to successive indices of an array, performing a collection of commands for each index. In other words, it uses an array to "collect" data from a record. + +This example implements a simplified version of the Unix command **uniq**. By adding a list of strings into an array called **a** as a key and incrementing the value each time the same key occurs, you get a count of the number of times a string appears (like the **\--count** option of **uniq**). If you print the keys of the array, you get every string that appears one or more times. + +For example, using the demo file **colours.txt** (from the previous articles): + + +``` +name       color  amount +apple      red    4 +banana     yellow 6 +raspberry  red    99 +strawberry red    3 +grape      purple 10 +apple      green  8 +plum       purple 2 +kiwi       brown  4 +potato     brown  9 +pineapple  yellow 5 +``` + +Here is a simple version of **uniq -c** in awk form: + + +``` +#! /usr/bin/awk -f + +NR != 1 { +    a[$2]++ +} +END { +    for (key in a) { +                print a[key] " " key +    } +} +``` + +The third column of the sample data file contains the number of items listed in the first column. You can use an array and a **for** loop to tally the items in the third column by color: + + +``` +#! /usr/bin/awk -f + +BEGIN { +    FS=" "; +    OFS="\t"; +    print("color\tsum"); +} +NR != 1 { +    a[$2]+=$3; +} +END { +    for (b in a) { +        print b, a[b] +    } +} +``` + +As you can see, you are also printing a header column in the BEFORE function (which always happens only once) prior to processing the file. + +### Loops + +Loops are a vital part of any programming language, and awk is no exception. Using loops can help you control how your awk script runs, what information it's able to gather, and how it processes your data. Our next article will cover switch statements, **continue**, and **next**. + +* * * + +Would you rather listen to this article? It was adapted from an episode of [Hacker Public Radio][2], a community technology podcast by hackers, for hackers. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/loops-awk + +作者:[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/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) +[2]: http://hackerpublicradio.org/eps.php?id=2330 From 6015672d3e7846663dbd30bbb5fbcae9b72a5222 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:56:27 +0800 Subject: [PATCH 624/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=20The=20?= =?UTF-8?q?many=20faces=20of=20awk?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191125 The many faces of awk.md --- .../tech/20191125 The many faces of awk.md | 234 ++++++++++++++++++ 1 file changed, 234 insertions(+) create mode 100644 sources/tech/20191125 The many faces of awk.md diff --git a/sources/tech/20191125 The many faces of awk.md b/sources/tech/20191125 The many faces of awk.md new file mode 100644 index 0000000000..0d498605f8 --- /dev/null +++ b/sources/tech/20191125 The many faces of awk.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The many faces of awk) +[#]: via: (https://www.networkworld.com/article/3454979/the-many-faces-of-awk.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +The many faces of awk +====== +The awk command provides a lot more than simply selecting fields from input strings, including pulling out columns of data, printing simple text, evaluating content – even doing math. +Thinkstock + +If you only use **awk** when you need to select a specific field from lines of text, you might be missing out on a lot of other services that the command can provide. In this post, we'll look at this simple use along with some of the other things that **awk** can do for you and provide some examples. + +### Plucking out columns of data + +The easiest and most commonly used service that **awk** provides is selecting specific fields from files or from data that is piped to it. With the default of using white space as a field separator, this is very simple. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +``` +$ echo one two three four five | awk ‘{print $4}’ +four +$ who | awk ‘{print $1}’ +jdoe +fhenry +``` + +White space is any sequence of blanks and tabs. In the commands shown above, **awk** is extracting just the fourth and first fields from the data provided. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Awk can also pull text from files by just adding the name of the file after the **awk** command. + +``` +$ awk '{print $1,$5,$NF}' HelenKellerQuote +The beautiful heart. +``` + +In this case, **awk** has picked out the first, fifth and last words in the single line of test. + +The **$NF** specification in the command picks the last piece of text on each line. That is because **NF** represents the number of fields in a line (23) while **$NF** then represents the _value_ of that field ("heart."). The period is included because it's part of the final text string. + +Fields can be printed in any order that you might find useful. In this example, we are rearranging the fields in **date** command output. + +``` +$ date | awk '{print $4,$3,$2}' +2019 Nov 22 +``` + +If you omit the commas between the field designators in an **awk** command, the output will be pushed into a single string. + +``` +$ date | awk '{print $4 $3 $2}' +2019Nov21 +``` + +If you replace the usual commas with hyphens, **awk** will attempt to subtract one field from another – probably not what you intended. It doesn't take the hyphens as characters to be inserted into the print output. Instead, it puts some of its mathematical prowess into play. + +``` +$ date | awk '{print $4-$3-$2}' +1997 +``` + +In this case, it's subtracting 22 (the day of the month) from the year (2019) and simply ignoring "Nov". + +If you want your output to be separated by something other than white space, you can specify your output separator with **OFS** (output field separator) like this: + +``` +$ date | awk '{OFS="-"; print $4,$3,$2}' +2019-Nov-22 +``` + +### Printing simple text + +You can also use **awk** to simply display some text. Of course, if all you want to do is print a line of text, you'd be better off using an **echo** command. On the other hand, as part of an **awk** script, printing some relevant text can be very useful. Here's a practically useless example: + +``` +$ awk 'BEGIN {print "Hello, World" }' +Hello, World +``` + +Here's a more sensible example in which adding a line of text to label your data can help identify what you're looking at: + +``` +$ who | awk 'BEGIN {print "Current logins:"} {print $1}' +Current logins: +shs +nemo +``` + +### Specifying a field separator + +Not all input is going to be separated by white space. If your text is separated by some other character (e.g., commas, colons or semicolons), you can inform **awk** by using the **-F** (input separator) option as shown here: + +``` +$ cat testfile +a:b:c,d:e +$ awk -F : '{print $2,$3}' testfile +b c,d +``` + +Here's a more useful example – pulling a field from the colon-separated **/etc/passwd** file: + +``` +$ awk -F: '{print $1}' /etc/passwd | head -11 +root +daemon +bin +sys +sync +games +man +lp +mail +news +uucp +``` + +### Evaluating content + +You can also evaluate fields using **awk**. If you, for example, want to list only _user accounts_ in **/etc/passwd**, you can include a test for the 3rd field. Here we're only going after UIDs that are 1000 and above: + +``` +$ awk -F":" ' $3 >= 1000 ' /etc/passwd +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin +shs:x:1000:1000:Sandra Henry-Stocker,,,:/home/shs:/bin/bash +nemo:x:1001:1001:Nemo,,,:/home/nemo:/usr/bin/zsh +dory:x:1002:1002:Dory,,,:/home/dory:/bin/bash +... +``` + +If you want to add a title for your listing, you can add a BEGIN clause: + +``` +$ awk -F":" 'BEGIN {print "user accounts:"} $3 >= 1000 ' /etc/passwd +user accounts: +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin +shs:x:1000:1000:Sandra Henry-Stocker,,,:/home/shs:/bin/bash +nemo:x:1001:1001:Nemo,,,:/home/nemo:/usr/bin/zsh +dory:x:1002:1002:Dory,,,:/home/dory:/bin/bash +``` + +If you want more than one line in your title, you can separate your intended output lines with "\n" (newline characters). + +``` +$ awk -F":" 'BEGIN {print "user accounts\n============="} $3 >= 1000 ' /etc/passwd +user accounts +============= +nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin +shs:x:1000:1000:Sandra Henry-Stocker,,,:/home/shs:/bin/bash +nemo:x:1001:1001:Nemo,,,:/home/nemo:/usr/bin/zsh +dory:x:1002:1002:Dory,,,:/home/dory:/bin/bash +``` + +### Doing math with awk + +**awk** provides a surprising mathematical ability and can calculate square roots, logs, tangents, etc. + +Here are a couple examples: + +``` +$ awk 'BEGIN {print sqrt(2019)}' +44.9333 +$ awk 'BEGIN {print log(2019)}' +7.61036 +``` + +For more details on **awk**'s mathematical skills, check out [Doing math with awk][3]. + +### awk scripts + +You can also write standalone scripts with **awk**. Here's an example that mimics one of the examples provided earlier, but also counts the number of users with accounts on the system. + +``` +#!/usr/bin/awk -f + +# This line is a comment + +BEGIN { + printf "%s\n","User accounts:" + print "==============" + FS=":" + n=0 +} + +# Now we'll run through the data +{ + if ($3 >= 1000) { + print $1 + n ++ + } +} + +END { + print "==============" + print n " accounts" +} +``` + +Notice how the BEGIN section, which is run only when the script starts, provides a heading, dictates the field separator and sets up a counter to start with 0. The script also includes an END section which only runs after all the lines in the text provided to the script have been processed. It displays the final count of lines that meet the specification in the middle section (third field is 1,000 or larger) + +A long-standing Unix command, **awk** still provides very useful services and remains one of the reasons that I fell in love with Unix many decades ago. + +To see **awk** in action, click below. + +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/3454979/the-many-faces-of-awk.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.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/2974753/doing-math-with-awk.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 4faa99d0133ba99750f8919010cf708c0d63cda5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 26 Nov 2019 00:57:03 +0800 Subject: [PATCH 625/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=208=20wa?= =?UTF-8?q?ys=20to=20prepare=20your=20data=20center=20for=20AI=E2=80=99s?= =?UTF-8?q?=20power=20draw?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191125 8 ways to prepare your data center for AI-s power draw.md --- ...re your data center for AI-s power draw.md | 142 ++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 sources/talk/20191125 8 ways to prepare your data center for AI-s power draw.md diff --git a/sources/talk/20191125 8 ways to prepare your data center for AI-s power draw.md b/sources/talk/20191125 8 ways to prepare your data center for AI-s power draw.md new file mode 100644 index 0000000000..2b05df201a --- /dev/null +++ b/sources/talk/20191125 8 ways to prepare your data center for AI-s power draw.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 ways to prepare your data center for AI’s power draw) +[#]: via: (https://www.networkworld.com/article/3454626/8-ways-to-prepare-your-data-center-for-ai-s-power-draw.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +8 ways to prepare your data center for AI’s power draw +====== +Artificial intelligence requires greater processor density, which increases the demand for cooling and raises power requirements. +Thinkstock + +As artificial intelligence takes off in enterprise settings, so will data center power usage. AI is many things, but power efficient is not one of them. + +For data centers running typical enterprise applications, the average power consumption for a rack is around 7 kW. Yet it’s common for AI applications to use more than 30 kW per rack, according to data center organization [AFCOM][1]. That’s because AI requires much higher processor utilization, and the processors – especially GPUs – are power hungry. Nvidia GPUs, for example, may run several orders of magnitude faster than a CPU, but they also consume twice as much power per chip. Complicating the issue is that many data centers are already power constrained. + +**READ MORE:** [Do you really need high performance computing?][2] + +Cooling is also an issue: AI-oriented servers require greater processor density, which means more chips crammed into the box, and they all run very hot. Greater density, along with higher utilization, increases the demand for cooling as compared to a typical back-office server. Higher cooling requirements in turn raise power demands.  + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +So what can you do if you want to embrace AI for competitive reasons but the power capacity of your existing facility isn’t up to the high-density infrastructure requirements of AI? Here are some options. + +### Consider liquid cooling + +Fan cooling typically loses viability once a rack exceeds 15 kW. Water, however, has 3,000 times the heat capacity of air, according to [CoolIT Systems][4], a maker of enterprise liquid cooling products. As a result, server cabinet makers have been adding liquid pipes to their cabinets and connecting water piping to their heat sinks instead of fans. + +“Liquid cooling is definitely a very good option for higher density loads,” says John Sasser, senior vice president for data center operations at [Sabey][5], a developer and operator of data centers. “That removes the messy airflow issue. Water removes a lot more heat than air does, and you can direct it through pipes. A lot of HPC [high performance computing] is done with liquid cooling.” + +Most data centers are set up for air cooling, so liquid cooling will require a capital investment, “but that might be a much more sensible solution for these efforts, especially if a company decides to move in the direction [of AI],” Sasser says. + +### Run AI workloads at lower resolutions + +Existing data centers might be able to handle AI computational workloads but in a reduced fashion, says Steve Conway, senior research vice president for [Hyperion Research][6]. Many, if not most, workloads can be operated at half or quarter precision rather than 64-bit double precision. + +“For some problems, half precision is fine,” Conway says. “Run it at lower resolution, with less data. Or with less science in it.” + +Double-precision floating point calculations are primarily needed in scientific research, which is often done at the molecular level. Double precision is not typically used in AI training or inference on deep learning models because it is not needed. Even Nvidia [advocates][7] for use of single- and half-precision calculations in deep neural networks. + +### Build an AI containment segment + +AI will be a part of your business but not all, and that should be reflected in your data center. “The new facilities that are being built are contemplating allocating some portion of their facilities to higher power usage,” says Doug Hollidge, a partner with [Five 9s Digital][8], which builds and operates data centers. “You’re not going to put all of your facilities to higher density because there are other apps that have lower draw.” + +The first thing to do is assess the energy supply to the building, Hollidge says. “If you are going to increase energy use in the building, you’ve got to make sure the power provider can increase the power supply.” + +Bring in an engineer to assess which portion of the data center is best equipped for higher density capabilities. Workload requirements will determine the best solution, whether it be hot aisle containment or liquid cooling or some other technology. “It’s hard to give one-size-fits-all solution since all data centers are different,” Hollidge says. + +### Spread out your AI systems + +An alternative approach – rather than crowding all your AI systems into one spot hotter than Death Valley in August – is to spread them out among the racks. + +“Most of the apps are not high density. They run at eight to 10 kilowatts and up to 15 kilowatts. You can handle that with air,” says David McCall, chief innovation officer with [QTS][9], a builder of data centers. + +In an optimized heterogeneous environment, a collocation provider might have a rack or two in a cabinet to host an HPC or AI environment, and the rest of the racks in the cabinet are dedicated to hosting less power-hungry applications, such as databases and back-office apps. That won't yield a 5 kW rack, but it gets a rack closer to 12 kW or 15 kW, which is an environment that air cooling can handle, McCall says. + +### Control hot air flow in the data center + +Standard data center layout is hot aisle/cold aisle, where the cabinets are laid out in alternating rows so that cold air intakes face each other on one front-facing aisle, and hot air exhausts face each other on the alternating back-facing aisle. That works fine, but access can be tricky if an IT worker needs to get behind a cabinet to work on a server. + +The other problem is that air is “messy,” as Sasser put it. Power is often easier to model because it flows through conductors, and you can control (and thus plan and model) where power goes. Air goes where it wants and is hard to control. + +Sabey customers that want higher density environments use a hot aisle containment pod to control air flow. The company puts doors at the end of the hot aisle and plastic plates over the top, so heat is directed into a ceiling intake pipe and the barriers keep hot air and cold air from mixing. + +"In an air-cooled server world, the advice I give is go with a hot aisle containment environment,” Sasser says. "The other advice I would give is make sure the data center is tested for air flow, not just modeled for airflow. Modeling is dependent on a lot of variables, and they easily change." + +### Consider a chimney cabinet + +Another way to help manage temperatures in data centers is to use a chimney cabinet. Instead of venting the hot air out the back, a chimney cabinet uses good old physics convection to send hot air up into a chimney, which is then connected to an air conditioning vent. [Chatsworth Systems][10] is best known for this style of cabinets. + +“The air pathway is more constrained this way,” Sasser says. “Since that air pathway is more constrained, you can get greater density into a cabinet than with a hot aisle pod.” + +### Process data where it resides + +Moving data around has a very high energy cost: It can take up to 100 times more energy to move data than it takes to process data, Conway says. Any form of data movement requires electricity, and that power drain increases with the volume of data – a significant issue for data-intensive AI applications. “You want to move data as rarely and as little distance as you can,” Conway says. + +“The solution is not to have to move the data any more or further than is absolutely necessary. So people are striving to put data closer to where it is processed. One thing cloud services providers and people who use cloud services agree on is it doesn’t make sense to move a massive amount of data to a third-party cloud,” he says. + +### Consider leasing data center space + +Most of the companies looking to implement AI are corporations that lease data center space from a data center operator, Hollidge says. There are some data center operators that are not capable of handling high density AI computation, but some have transitioned to offering a portion of high density environments for AI. + +“You might have to go through a few providers before finding it, but there is more attention being paid to that on the data center operations side,” Hollidge says. And a third-party data center provider gives you more growth options. “Most of the time you are better off entering into a flexible lease that allows you to expand and grow your AI business as opposed to building ground up.” + +### Wait for next-generation servers + +Supercomputers to date haven’t been very data friendly, Conway says. As supercomputers have gotten bigger, the designs have gotten less data-centric. The result is that more data has to be moved around and shuttled between processors, memory, and storage systems. And as discussed above, it costs more power to move data than to process it. + +The first exascale systems will come with more accelerators and more powerful interconnections for moving around data. And many innovations that start in supercomputing, including GPUs and storage-class memory (SCM), eventually work their way down to more mainstream servers. + +Future servers also will come with a more heterogeneous chip layout; instead of all x86 CPUs, they will include GPUs, FPGAs, and AI accelerators. And for high speed storage, NVMe-over-Fabric and SCM will become more affordable. Servers are set to change in the coming years, and many of the advances will benefit enterprise AI application environments. + +**Learn more about HPC and supercomputers** + + * [HPE to buy Cray, offer HPC as a service][11] + * [Decommissioning the Titan supercomputer][12] + * [10 of the world's fastest supercomputers][13] + * [What’s quantum computing and why should enterprises care?][14] + * [Who’s developing quantum computers?][15] + + + +Join the Network World communities on [Facebook][16] and [LinkedIn][17] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3454626/8-ways-to-prepare-your-data-center-for-ai-s-power-draw.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.afcom.com/ +[2]: https://www.networkworld.com/article/3444399/high-performance-computing-do-you-need-it.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.coolitsystems.com/ +[5]: https://sabeydatacenters.com/ +[6]: https://hyperionresearch.com/ +[7]: https://devblogs.nvidia.com/mixed-precision-training-deep-neural-networks/ +[8]: https://five9sdigital.com/ +[9]: https://www.qtsdatacenters.com/ +[10]: https://www.chatsworth.com/en-us/products/families/teraframe +[11]: https://www.networkworld.com/article/3396220/hpe-to-buy-cray-offer-hpc-as-a-service.html +[12]: https://www.networkworld.com/article/3408176/the-titan-supercomputer-is-being-decommissioned-a-costly-time-consuming-project.html +[13]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html#slide1 +[14]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html#nww-fsb +[15]: https://www.networkworld.com/article/3275385/who-s-developing-quantum-computers.html +[16]: https://www.facebook.com/NetworkWorld/ +[17]: https://www.linkedin.com/company/network-world From 3296185e65e72b4eadeeb9e6dac77a1ea510cb73 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 Nov 2019 06:46:29 +0800 Subject: [PATCH 626/800] PRF @geekpi --- .../20191119 How to use pkgsrc on Linux.md | 109 ++++++++---------- 1 file changed, 46 insertions(+), 63 deletions(-) diff --git a/translated/tech/20191119 How to use pkgsrc on Linux.md b/translated/tech/20191119 How to use pkgsrc on Linux.md index dc24aa44c5..a88fad5ef0 100644 --- a/translated/tech/20191119 How to use pkgsrc on Linux.md +++ b/translated/tech/20191119 How to use pkgsrc on Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to use pkgsrc on Linux) @@ -9,66 +9,59 @@ 如何在 Linux 上使用 pkgsrc ====== -NetBSD 的软件包管理器通用、灵活又容易。下面是如何使用它。 -![A person programming][1] -NetBSD 以能在几乎所有平台上运行而闻名,但你知道它_第二_有名的 **[pkgsrc][2]** 包管理器吗?像 NetBSD 一样,pkgsrc 基本上可以在任何系统上运行,或者至少在任意 Unix 和类 Unix 的系统上上运行。你可以在 BSD、Linux、Illumos、Solaris 和 Mac 上安装 pkgsrc。它总共支持 20 多种操作系统。 +> NetBSD 的软件包管理器通用、灵活又容易。下面是如何使用它。 + +![](https://img.linux.net.cn/data/attachment/album/201911/26/064538fbktfzxba18wykde.jpg) + +NetBSD 以能在几乎所有平台上运行而闻名,但你知道它*第二*有名的 [pkgsrc][2] 包管理器吗?像 NetBSD 一样,pkgsrc 基本上可以在任何系统上运行,或者至少在任意 Unix 和类 Unix 的系统上上运行。你可以在 BSD、Linux、Illumos、Solaris 和 Mac 上安装 pkgsrc。它总共支持 20 多种操作系统。 ### 为什么使用 pkgsrc? -除了 MacOS 之外,所有 Unix 操作系统均自带包管理器。你不一定 _需要_ pkgsrc,但这可能是你想尝试的三个重要原因: - - * **打包**。如果你对打包感到好奇,但尚未尝试自己创建一个软件包,那么 pkgsrc 是一个相对简单的系统,尤其是如果你已经熟悉 Makefile 和类似 [GNU Autotools][3] 之类的构建系统时。 - * **通用**。如果你使用多个操作系统或发行版,那么可能会遇到每个系统的包管理器。你可以在不同的系统上使用 pkgsrc,以便在一个系统中打包了程序,就为所有系统打包了该程序。 - * **灵活**。在许多打包系统中,如何选择二进制包或源码包并不总是很明显。使用 pkgsrc,区别很明显,两种安装方法都一样容易,并且都可以为你解决依赖关系。 - +除了 MacOS 之外,所有 Unix 操作系统均自带包管理器。你不一定*需要* pkgsrc,但这可能是你想尝试的三个重要原因: +* **打包**。如果你对打包感到好奇,但尚未尝试自己创建一个软件包,那么 pkgsrc 是一个相对简单的系统,尤其是如果你已经熟悉 Makefile 和类似 [GNU Autotools][3] 之类的构建系统时。 +* **通用**。如果你使用多个操作系统或发行版,那么可能会遇到每个系统的包管理器。你可以在不同的系统上使用 pkgsrc,以便你为一个系统打包了程序,就为所有系统打包了。 +* **灵活**。在许多打包系统中,如何选择二进制包或源码包并不总是很明显。使用 pkgsrc,区别很明显,两种安装方法都一样容易,并且都可以为你解决依赖关系。 ### 如何安装 pkgsrc 无论你使用的是 BSD、Linux、Illumos、Solaris 还是 MacOS,安装过程都基本相同: - 1. 使用 CVS 检出 pkgsrc 树 - 2. 引导 pkgsrc 系统 - 3. 安装软件包 - - +1. 使用 CVS 检出 pkgsrc 树 +2. 引导 pkgsrc 系统 +3. 安装软件包 #### 使用 CVS 检出 pkgsrc 树 -在 Git 和 Subversion 之前,就有了 **[CVS][4]**。要检出代码你无需了解 CVS 太多,如果你习惯 Git,那么可以将_检出_ (checkout) 称为 _克隆_ (clone)。当你用 CVS 检出 pkgsrc 时,你就在下载详细说明如何构建每个软件包的“配方”(“recipes”)。它有很多文件,但是它们都很小,因为你实际上并没有拉取每个包的源码,而只有按需构建时需要的构建基础架构和 Makefile。使用 CVS,你可以轻松地在新版本发布时更新 pkgsrc 检出。 - -pkgsrc 文档建议将树放在 **/usr** 目录下,因此你必须使用 **sudo** (或成为 root)运行此命令: +在 Git 和 Subversion 之前,就有了 [CVS][4]。要检出代码你无需了解 CVS 太多,如果你习惯 Git,那么可以将检出checkout称为克隆clone。当你用 CVS 检出 pkgsrc 时,你就下载了详细说明如何构建每个软件包的“配方recipes”。它有很多文件,但是它们都很小,因为你实际上并没有拉取每个包的源码,而只有按需构建时需要的构建基础架构和 Makefile。使用 CVS,你可以轻松地在新版本发布时更新 pkgsrc 检出。 +pkgsrc 文档建议将其源码树放在 `/usr` 目录下,因此你必须使用 `sudo`(或成为 root)运行此命令: ``` $ cd /usr -$ sudo cvs -q -z2 \ -  -d [anoncvs@anoncvs.NetBSD.org][5]:/cvsroot \ -  checkout -r pkgsrc-2019Q3 -P pkgsrc +$ sudo cvs -q -z2 -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout -r pkgsrc-2019Q3 -P pkgsrc ``` 在我撰写本文时,最新版本是 2019Q3。请检查 [pkgsrc.org][6] 主页的新闻部分或 [NetBSD文档][7],以确定最新版本。 #### 引导 pkgsrc -pkgsrc 树复制到你的计算机后,你会看到一个充满构建脚本的 **/usr/pkgsrc** 目录。在使用之前,你必须引导 pkgsrc,以便你可以轻松地访问构建和安装软件所需的相关命令。 +pkgsrc 树复制到你的计算机后,你会看到一个充满构建脚本的 `/usr/pkgsrc` 目录。在使用之前,你必须引导 pkgsrc,以便你可以轻松地访问构建和安装软件所需的相关命令。 -引导 **pkgsrc** 的方式取决于你所使用操作系统。 +引导 pkgsrc 的方式取决于你所使用操作系统。 对于 NetBSD,你只需使用捆绑的引导器: - ``` # cd pkgsrc/bootstrap # ./bootstrap ``` -在其他系统上,还有更好的方法,包括一些自定义功能,它由 Joyent 提供。要了解运行的确切命令,请访问 [pkgsrc.joyent.com][8]。比如,在 Linux(Fedora、Debian、Slackware 等)上: +在其他系统上,还有更好的方法,包括一些自定义功能,它是由 Joyent 提供的。要了解运行的确切命令,请访问 [pkgsrc.joyent.com][8]。比如,在 Linux(Fedora、Debian、Slackware 等)上: ``` -$ curl -O \ -  +$ curl -O https://pkgsrc.joyent.com/packages/Linux/el7/bootstrap/bootstrap-trunk-x86_64-20170127.tar.gz $ BOOTSTRAP_SHA="eb0d6911489579ca893f67f8a528ecd02137d43a" ``` @@ -76,66 +69,59 @@ $ BOOTSTRAP_SHA="eb0d6911489579ca893f67f8a528ecd02137d43a" 验证 SHA1 校验和: - ``` -$ echo "${BOOTSTRAP_SHA}" bootstrap-trunk*gz > check-shasum +$ echo "${BOOTSTRAP_SHA}" bootstrap-trunk*gz > check-shasum sha1sum -c check-shasum ``` 你还可以验证 PGP 签名: - ``` -$ curl -O \ - -curl -sS | gpg --import -gpg --verify ${BOOTSTRAP_TAR}{.asc,} +$ curl -O https://pkgsrc.joyent.com/packages/Linux/el7/bootstrap/bootstrap-trunk-x86_64-20170127.tar.gz.asc +$ curl -sS https://pkgsrc.joyent.com/pgp/56AAACAF.asc | gpg --import +$ gpg --verify ${BOOTSTRAP_TAR}{.asc,} ``` -当你确认你已有正确的引导套件,将其安装到 **/usr/pkg**: - +当你确认你已有正确的引导套件,将其安装到 `/usr/pkg`: ``` -`sudo tar -zxpf ${BOOTSTRAP_TAR} -C /` +sudo tar -zxpf ${BOOTSTRAP_TAR} -C / ``` 它为你提供了通常的 pkgsrc 命令。将这些位置添加到[你的 PATH 环境变量中][9]: - ``` -$ echo "PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH" >> ~/.bashrc -$ echo "MANPATH=/usr/pkg/man:$MANPATH" >> ~/.bashrc +$ echo "PATH=/usr/pkg/sbin:/usr/pkg/bin:$PATH" >> ~/.bashrc +$ echo "MANPATH=/usr/pkg/man:$MANPATH" >> ~/.bashrc ``` -如果你宁愿使用 pkgsrc 而不依赖于 Joyent 的构建,那么只需运行 pkgsrc 树的**引导**脚本即可。在运行特定于系统的脚本之前,请先阅读 **bootstrap** 目录中相关 README 文件。 +如果你宁愿使用 pkgsrc 而不依赖于 Joyent 的构建,那么只需运行 pkgsrc 源码树的引导脚本即可。在运行特定于系统的脚本之前,请先阅读 `bootstrap` 目录中相关 `README` 文件。 ![Bootstrapping pkgsrc on NetBSD][10] ### 如何使用 pkgsrc 安装软件 -使用 pkgsrc 安装预编译的二进制文件(就像使用 DNF 或 Apt 一样)是很容易的。二进制安装的命令是 **pgkin**,它有自己的专门网站 [pkgin.net][11]。对于任何用过 Linux 的人来说,这个过程应该感觉相当熟悉。 +使用 pkgsrc 安装预编译的二进制文件(就像使用 DNF 或 Apt 一样)是很容易的。二进制安装的命令是 `pgkin`,它有自己的专门网站 [pkgin.net][11]。对于任何用过 Linux 的人来说,这个过程应该感觉相当熟悉。 -要搜索 **tmux** 包: +要搜索 `tmux` 包: ``` -`$ pkgin search tmux` +$ pkgin search tmux ``` 要安装 tmux 包: - ``` -`$ sudo pkgin install tmux` +$ sudo pkgin install tmux ``` -**pkgin** 命令的目的是模仿典型的 Linux 包管理器的行为,因此有选项可以列出可用的包、查找包提供的特定可执行文件,等等。 +`pkgin` 命令的目的是模仿典型的 Linux 包管理器的行为,因此有选项可以列出可用的包、查找包提供的特定可执行文件,等等。 ### 如何使用 pkgsrc 从源码构建 -然而,pkgsrc 真正强大的地方是方便地从源码构建包。你在第一步中检出了所有 20000 多个构建脚本,你可以直接进入 pkgsrc 树来访问这些脚本。 - -例如,要从源码构建 **tcsh**,首先找到构建脚本: +然而,pkgsrc 真正强大的地方是方便地从源码构建包。你在第一步中检出了所有 20000 多个构建脚本,你可以直接进入 pkgsrc 源码树来访问这些脚本。 +例如,要从源码构建 `tcsh`,首先找到构建脚本: ``` $ find /usr/pkgsrc -type d -name "tcsh" @@ -144,12 +130,11 @@ $ find /usr/pkgsrc -type d -name "tcsh" 接下来,进入源码目录: - ``` -`$ cd /usr/pgksrc/shells/tcsh` +$ cd /usr/pgksrc/shells/tcsh ``` -构建脚本目录包含许多文件来帮助在你的系统上构建应用,但值得注意的是,这里面有 **DESCR** 文件,它包含软件说明,以及触发构建的 **Makefile**。 +构建脚本目录包含许多文件来帮助在你的系统上构建应用,但值得注意的是,这里面有包含了软件说明的 `DESCR` 文件,以及触发构建的 `Makefile`。 ``` $ ls @@ -163,24 +148,22 @@ $ 准备就绪后,构建并安装: - ``` -`$ sudo bmake install` +$ sudo bmake install ``` -pkgsrc 系统使用 **bmake** 命令(在第一步检出 pkgsrc 后提供),因此请务必使用 **bmake**(而不是出于习惯使用 **make**)。 +pkgsrc 系统使用 `bmake` 命令(在第一步检出 pkgsrc 后提供),因此请务必使用 `bmake`(而不是出于习惯使用 `make`)。 如果要为多个系统构建,那么你可以创建一个包,而不是立即安装: - ``` $ cd /usr/pgksrc/shells/tcsh $ sudo bmake package [...] -=> Creating binary package in /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz +=> Creating binary package in /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz ``` -pkgsrc 创建的包是标准的 tarball,但它可以方便地通过 **pkg_add** 安装: +pkgsrc 创建的包是标准的 tarball,但它可以方便地通过 `pkg_add` 安装: ``` $ sudo pkg_add /usr/pkgsrc/packages/All/tcsh-X.Y.Z.tgz @@ -189,11 +172,11 @@ $ tcsh localhost% ``` -pkgsrc 的 **pkgtools** 集合提供 **pkg_add**、**pkg_info**、**pkg_admin**、**pkg_create** 和 **pkg_delete** 命令,来帮助管理你在系统上构建和维护软件包。 +pkgsrc 的 pkgtools 集合提供 `pkg_add`、`pkg_info`、`pkg_admin`、`pkg_create` 和 `pkg_delete` 命令,来帮助管理你在系统上构建和维护软件包。 -### Pkgsrc,易于管理 +### pkgsrc,易于管理 -pkgsrc 系统提供了直接,容易上手的软件包管理方法。 如果你正在寻找一个不妨碍你并且可以定制的包管理器,请在任何运行 Unix 或类 Unix 的系统上试试 pkgsrc。 +pkgsrc 系统提供了直接,容易上手的软件包管理方法。如果你正在寻找一个不妨碍你并且可以定制的包管理器,请在任何运行 Unix 或类 Unix 的系统上试试 pkgsrc。 -------------------------------------------------------------------------------- @@ -202,7 +185,7 @@ via: https://opensource.com/article/19/11/pkgsrc-netbsd-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 d0d9530a4389899a2a0b7b06692c8b5fb0e60fde Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 Nov 2019 06:47:03 +0800 Subject: [PATCH 627/800] PUB @geekpi https://linux.cn/article-11613-1.html --- .../tech => published}/20191119 How to use pkgsrc on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191119 How to use pkgsrc on Linux.md (99%) diff --git a/translated/tech/20191119 How to use pkgsrc on Linux.md b/published/20191119 How to use pkgsrc on Linux.md similarity index 99% rename from translated/tech/20191119 How to use pkgsrc on Linux.md rename to published/20191119 How to use pkgsrc on Linux.md index a88fad5ef0..8ca44c9dcc 100644 --- a/translated/tech/20191119 How to use pkgsrc on Linux.md +++ b/published/20191119 How to use pkgsrc on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11613-1.html) [#]: subject: (How to use pkgsrc on Linux) [#]: via: (https://opensource.com/article/19/11/pkgsrc-netbsd-linux) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 0a001943b8b9775daac63f159d105779d9b7362d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 Nov 2019 06:54:09 +0800 Subject: [PATCH 628/800] PUB @wxy https://linux.cn/article-11614-1.html --- .../20191120 How to install Java on Linux.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191120 How to install Java on Linux.md (98%) diff --git a/translated/tech/20191120 How to install Java on Linux.md b/published/20191120 How to install Java on Linux.md similarity index 98% rename from translated/tech/20191120 How to install Java on Linux.md rename to published/20191120 How to install Java on Linux.md index b44d10c65e..db94ace738 100644 --- a/translated/tech/20191120 How to install Java on Linux.md +++ b/published/20191120 How to install Java on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11614-1.html) [#]: subject: (How to install Java on Linux) [#]: via: (https://opensource.com/article/19/11/install-java-linux) [#]: author: (Seth Kenlon https://opensource.com/users/seth) @@ -12,7 +12,7 @@ > 在桌面上拥抱 Java 应用程序,然后在所有桌面上运行它们。 -![Coffee beans][1] +![](https://img.linux.net.cn/data/attachment/album/201911/26/065307hk22caubakkos0u0.jpg) 无论你运行的是哪种操作系统,通常都有几种安装应用程序的方法。有时你可能会在应用程序商店中找到一个应用程序,或者使用 Fedora 上的 DNF 或 Mac 上的 Brew 这样的软件包管理器进行安装,而有时你可能会从网站上下载可执行文件或安装程序。因为 Java 是这么多流行的应用程序的后端,所以最好了解安装它的不同方法。好消息是你有很多选择,本文涵盖了所有这些内容。 From ee2c8924e45c1d0a2f3d9220d3186a1f734629a1 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 26 Nov 2019 08:59:13 +0800 Subject: [PATCH 629/800] translated --- ...hift to Backup and Restore Ubuntu Linux.md | 150 ------------------ ...hift to Backup and Restore Ubuntu Linux.md | 150 ++++++++++++++++++ 2 files changed, 150 insertions(+), 150 deletions(-) delete mode 100644 sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md create mode 100644 translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md diff --git a/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md deleted file mode 100644 index d074cd4dd9..0000000000 --- a/sources/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md +++ /dev/null @@ -1,150 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Use TimeShift to Backup and Restore Ubuntu Linux) -[#]: via: (https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/) -[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) - -How to Use TimeShift to Backup and Restore Ubuntu Linux -====== - -Have you ever wondered how you can backup and restore your **Ubuntu** or **Debian system** ? **Timeshift** is a free and opensource tool that allows you to create incremental snapshots of your filesystem. You can create a snapshot using either **RSYNC** or **BTRFS**. - -[![TimeShift-Backup-Restore-Tool-Ubuntu][1]][2] - -With that. let’s delve in and install Timeshift. For this tutorial, we shall install on Ubuntu 18.04 LTS system. - -### Installing TimeShift on Ubuntu / Debian Linux - -TimeShift is not hosted officially on Ubuntu and Debian repositories. With that in mind, we are going to run the command below to add the PPA: - -``` -# add-apt-repository -y ppa:teejee2008/ppa -``` - -![Add-timeshift-repository][1] - -Next, update the system packages with the command: - -``` -# apt update -``` - -After a successful system update, install timeshift by running following apt command : - -``` -# apt install timeshift -``` - -![apt-install-timeshift][1] - -### Preparing a backup storage device - -Best practice demands that we save the system snapshot on a separate storage volume, aside from the system’s hard drive. For this guide, we are using a 16 GB flash drive as the secondary drive on which we are going to save the snapshot. - -``` -# lsblk | grep sdb -``` - -![lsblk-sdb-ubuntu][1] - -For the flash drive to be used as a backup location for the snapshot, we need to create a partition table on the device. Run the following commands: - -``` -# parted /dev/sdb mklabel gpt -# parted /dev/sdb mkpart primary 0% 100% -# mkfs.ext4 /dev/sdb1 -``` - -![create-partition-table-on-drive-ubuntu][1] - -After creating a partition table on the USB flash drive, we are all set to begin creating filesystem’s snapshots! - -### Using Timeshift to create snapshots - -To launch Timeshift, use the application menu to search for the  Timeshift application. - -![Access-Timeshift-Ubuntu][1] - -Click on the Timeshift icon and the system will prompt you for the Administrator’s password. Provide the password and click on Authenticate - -![Authentication-required-ubuntu][1] - -Next, select your preferred snapshot type. - -![Select-Rsync-option-timeshift][1] - -Click ‘**Next**’.  Select the destination drive for the snapshot. In this case, my location is the external USB drive labeled as **/dev/sdb** - -![Select-snapshot location][1] - -Next, define the snapshot levels. Levels refer to the intervals during which the snapshots are created.  You can choose to have either monthly, weekly, daily, or hourly snapshot levels. - -![Select-snapshot-levels-Timeshift][1] - -Click ‘Finish’ - -On the next Window, click on the ‘**Create**’ button to begin creating the snapshot. Thereafter, the system will begin creating the snapshot. - -![Create-snapshot-timeshift][1] - -Finally, your snapshot will be displayed as shown - -![Snapshot-created-TimeShift][1] - -### Restoring Ubuntu / Debian from a snapshot - -Having created a system snapshot, let’s now see how you can restore your system from the same snapshot. On the same Timeshift window, click on the snapshot and click on the ‘**Restore**’ button as shown. - -![Restore-snapshot-timeshift][1] - -Next, you will be prompted to select the target device.  leave the default selection and hit ‘**Next**’. - -![Select-target-device-timeshift][1] - -A dry run will be performed by Timeshift before the restore process commences. - -![Comparing-files-Dry-Run-timeshift][1] - -In the next window, hit the ‘**Next**’  button to confirm actions displayed. - -![Confirm-actions-timeshift][1] - -You’ll get a warning and a disclaimer as shown. Click ‘**Next**’ to initialize the restoration process. - -Thereafter, the restore process will commence and finally, the system will thereafter reboot into an earlier version as defined by the snapshot. - -![Restoring-snapshot-timeshift][1] - -**Conclusion** - -As you have seen it quite easy to use TimeShift to restore your system from a snapshot. It comes in handy when backing up system files and allows you to recover in the event of a system fault. So don’t get scared to tinker with your system or mess up. TimeShift will give you the ability to go back to a point in time when everything was running smoothly. - - * [Facebook][3] - * [Twitter][4] - * [LinkedIn][5] - * [Reddit][6] - - - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/ - -作者:[James Kiarie][a] -选题:[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/james/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/TimeShift-Backup-Restore-Tool-Ubuntu.png -[3]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&t=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux -[4]: http://twitter.com/share?text=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&via=Linuxtechi -[5]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux -[6]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux diff --git a/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md new file mode 100644 index 0000000000..cd234c7277 --- /dev/null +++ b/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Use TimeShift to Backup and Restore Ubuntu Linux) +[#]: via: (https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +如何使用 TimeShift 备份和还原 Ubuntu Linux +====== + +你是否曾经想过如何备份和还原 **Ubuntu** 或 **Debian** 系统? **Timeshift**是一款免费的开源工具,可让你创建文件系统的增量快照。你也可以使用 **RSYNC** 或 **BTRFS** 创建快照。 + +[![TimeShift-Backup-Restore-Tool-Ubuntu][1]][2] + +让我们深入研究并安装 Timeshift。对于本教程,我们将安装在 Ubuntu 18.04 LTS 系统上。 + +### 在 Ubuntu / Debian Linux 上安装 TimeShift + +TimeShift 尚未正式托管在 Ubuntu 和 Debian 仓库中。考虑到这一点,我们将运行以下命令来添加 PPA: + +``` +# add-apt-repository -y ppa:teejee2008/ppa +``` + +![Add-timeshift-repository][1] + +接下来,使用以下命令更新系统软件包: + +``` +# apt update +``` + +成功更新系统后,使用以下 apt 命令安装 Timeshift: + +``` +# apt install timeshift +``` + +![apt-install-timeshift][1] + +### 准备备份存储设备 + +最佳实践要求我们将系统快照保存在系统硬盘之外的单独的存储卷上。对于本指南,我们将使用 16GB 闪存作为辅助存储,并在该辅助存储上保存快照。 + +``` +# lsblk | grep sdb +``` + +![lsblk-sdb-ubuntu][1] + +为了将闪存用作快照的备份位置,我们需要在设备上创建一个分区表。运行以下命令: + +``` +# parted /dev/sdb mklabel gpt +# parted /dev/sdb mkpart primary 0% 100% +# mkfs.ext4 /dev/sdb1 +``` + +![create-partition-table-on-drive-ubuntu][1] + +在 USB 闪存上创建分区表后,我们可以开始创建文件系统的快照! + +### 使用 Timeshift 创建快照 + +要启动 Timeshift,使用应用程序菜单搜索 Timeshift。 + +![Access-Timeshift-Ubuntu][1] + +单击 Timeshift 图标,系统将提示你输入管理员密码。提供密码,然后单击验证 + +![Authentication-required-ubuntu][1] + +接下来,选择你喜欢的快照类型。 + +![Select-Rsync-option-timeshift][1] + +点击 “**Next**”。选择快照的目标驱动器。在这里,我的位置是标记为 **/dev/sdb** 的外部 USB 驱动器 + +![Select-snapshot location][1] + +接下来,定义快照级别。级别是指创建快照的时间间隔。你可以选择每月、每周、每天或每小时的快照级别。 + +![Select-snapshot-levels-Timeshift][1] + +点击 “Finish” + +在下一个窗口中,单击 “**Create**” 按钮开始创建快照。此后,系统将开始创建快照。 + +![Create-snapshot-timeshift][1] + +最后,你的快照将显示如下: + +![Snapshot-created-TimeShift][1] + +### 从快照还原 Ubuntu / Debian + +创建系统快照后,现在让我们看看如何从同一快照还原系统。在同一个 Timeshift 中,单击快照,然后单击 “**Restore**” 按钮,如图所示。 + +![Restore-snapshot-timeshift][1] + +接下来,将提示你选择目标设备。保留默认选择,然后点击 “**Next**”。 + +![Select-target-device-timeshift][1] + +恢复过程开始之前,Timeshift 将试运行。 + +![Comparing-files-Dry-Run-timeshift][1] + +在下一个窗口中,点击 “**Next**” 按钮确认显示的操作。 + +![Confirm-actions-timeshift][1] + +如图所示,你会看到警告和免责声明。点击 “**Next**” 初始化恢复过程。 + +此后,将开始还原过程,最后,系统之后将重新启动到快照定义的早期版本。 + +![Restoring-snapshot-timeshift][1] + +**总结** + +如你所见,使用 TimeShift 从快照还原系统非常容易。在备份系统文件时,它非常方便,并允许你在系统故障时进行恢复。因此,不要害怕修改系统或弄乱系统。TimeShift 使你能够返回到一切运行平稳的时间点。 + + * [Facebook][3] + * [Twitter][4] + * [LinkedIn][5] + * [Reddit][6] + + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/ + +作者:[James Kiarie][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.linuxtechi.com/author/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/TimeShift-Backup-Restore-Tool-Ubuntu.png +[3]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&t=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux +[4]: http://twitter.com/share?text=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&via=Linuxtechi +[5]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux +[6]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux From b0b9787024126c75b8192002d67926bdd2f2372d Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 26 Nov 2019 09:05:25 +0800 Subject: [PATCH 630/800] translating --- ...191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md b/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md index 094218c6c4..ffbf7103ee 100644 --- a/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md +++ b/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 15d260a9f4007e96101a4967fc054f5dfa5ebb5a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Nov 2019 22:28:07 +0800 Subject: [PATCH 631/800] Rename sources/tech/20191125 My journey to becoming an open source maintainer.md to sources/talk/20191125 My journey to becoming an open source maintainer.md --- .../20191125 My journey to becoming an open source maintainer.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191125 My journey to becoming an open source maintainer.md (100%) diff --git a/sources/tech/20191125 My journey to becoming an open source maintainer.md b/sources/talk/20191125 My journey to becoming an open source maintainer.md similarity index 100% rename from sources/tech/20191125 My journey to becoming an open source maintainer.md rename to sources/talk/20191125 My journey to becoming an open source maintainer.md From 8df32bc6ca7dafe2955efddf32c336d82cea15cc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Tue, 26 Nov 2019 22:33:14 +0800 Subject: [PATCH 632/800] Rename sources/tech/20191126 Google to Add Mainline Linux Kernel Support to Android.md to sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md --- ...1126 Google to Add Mainline Linux Kernel Support to Android.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191126 Google to Add Mainline Linux Kernel Support to Android.md (100%) diff --git a/sources/tech/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md similarity index 100% rename from sources/tech/20191126 Google to Add Mainline Linux Kernel Support to Android.md rename to sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md From 5cb0b274ec07da1f03aac92f65b3806797285f7d Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 Nov 2019 23:06:10 +0800 Subject: [PATCH 633/800] APL --- ...- Manage Snaps, Flatpaks and AppImages from One Interface.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md b/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md index cba1d0704f..8ac3b07c5e 100644 --- a/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md +++ b/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 679465a97c61fc51154525fcbf10318ff083392c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 26 Nov 2019 23:48:01 +0800 Subject: [PATCH 634/800] TSL&PRF --- ...atpaks and AppImages from One Interface.md | 143 ------------------ ...atpaks and AppImages from One Interface.md | 139 +++++++++++++++++ 2 files changed, 139 insertions(+), 143 deletions(-) delete mode 100644 sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md create mode 100644 translated/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md diff --git a/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md b/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md deleted file mode 100644 index 8ac3b07c5e..0000000000 --- a/sources/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md +++ /dev/null @@ -1,143 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Bauh – Manage Snaps, Flatpaks and AppImages from One Interface) -[#]: via: (https://itsfoss.com/bauh-package-manager/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Bauh – Manage Snaps, Flatpaks and AppImages from One Interface -====== - -One of the biggest problems with universal packages like [Snap][1], [Flatpak][2] and [AppImage][3] is managing them. Most built-in package managers do not support all of these new formats. - -Thankfully, I stumbled across an application that supports several universal package formats. - -### Bauh – a Manager for Your Multi-Package Needs - -Originally named fpakman, [bauh][4] is designed to handle Flatpak, Snap, [AppImage][5], and [AUR][6] packages. Creator [vinifmor][7] started the project in June’19 with the [intention][8] of “giving a graphical interface to manage Flatpaks for Manjaro users.” Since then, he has expanded the application to add support for Debian-based systems. - -![Bauh About][9] - -When you first open bauh, it will scan your installed applications and check for updates. If there are any that need to be updated, they will be listed front and center. Once all the packages are updated, you will see a list of packages you have installed. You can deselect a package with updates to prevent it from being updated. You can also choose to install a previous version of the application. - -![With Bauh you can manage various types of packages from one application][10] - -You can also search for applications. Bauh has detailed information for both installed and searched packages. If you are not interested in one (or more) of the packaging types, you can deselect them in settings. - -### Installing bauh on your Linux distribution - -Let’s see how to install bauh. - -#### Arch-based distributions - -If you have a recent install of [Manjaro][11], you should be all set. Bauh comes installed by default. If you have an older install of Manjaro (like I do) or a different Arch-based distro, you can install it from the [AUR][12] by typing this in terminal: - -``` -sudo pacman -S bauh -``` - -![Bauh Package Info][13] - -#### Debian/Ubuntu based distributions - -If you have a Debianor Ubuntubased Linux distribution, you can install bauh with pip. First, make sure to [install pip on Ubuntu][14]. - -``` -sudo apt install python3-pip -``` - -And then use it to install bauh: - -``` -pip3 install bauh -``` - -However, the creator recommends installing it [manually][15] to avoid messing up your system’s libraries. - -To install bauh manually, you have to first download the [latest release][16]. Once you download it, you can [unzip using a graphical tool][17] or the [unzip command][18]. Next, open up the folder in your terminal. You will need to use the following steps to complete the install. - -First, create a virtualenv in a folder called env: - -``` -python3 -m venv env -``` - -Now install the application code inside the env: - -``` -env/bin/pip install . -``` - -And launch the application: - -``` -env/bin/bauh -``` - -![Bauh Updating][19] - -Once you finish installing bauh, you can [fine-tune][20] it by changing the environment setting and arguments. - -### The road ahead for bauh - -Bauh has grown quite a bit in a few short months. It plans to continue to grow. The current [road map][21] includes: - - * Support for other packaging technologies - * Separate modules for each packaging technology - * Memory and performance improvements - * Improve the user experience - - - -![Bauh Search][22] - -### Final thoughts - -When I tried out bauh, I ran into a couple of issues. When I opened it up for the first time, it told me that Snap was not installed and that I would have to install it if I wanted to use Snaps. I know that Snap is installed because I ran `snap list` in the terminal and it worked. I restarted the system and snaps worked. - -The other issue I ran into was that one of my AUR packages failed to update. I was able to update the package without any issue with `yay`. There might be an issue with my install of Manjaro, I’ve had it going for 3 or 4 years. - -Overall, bauh worked. It did what was printed on the tin. I can’t ask for more than that. - -Have you ever used bauh? What is your favorite tool to manage different package formats if there is one? 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][23]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/bauh-package-manager/ - -作者:[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://snapcraft.io/ -[2]: https://flatpak.org/ -[3]: https://appimage.org/ -[4]: https://github.com/vinifmor/bauh -[5]: https://itsfoss.com/use-appimage-linux/ -[6]: https://itsfoss.com/best-aur-helpers/ -[7]: https://github.com/vinifmor -[8]: https://forum.manjaro.org/t/bauh-formerly-known-as-fpakman-a-gui-for-flatpak-and-snap-management/96180 -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-about.jpg?ssl=1 -[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh.jpg?ssl=1 -[11]: https://manjaro.org/ -[12]: https://aur.archlinux.org/packages/bauh -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-package-info.jpg?ssl=1 -[14]: https://itsfoss.com/install-pip-ubuntu/ -[15]: https://github.com/vinifmor/bauh#manual-installation -[16]: https://github.com/vinifmor/bauh/releases -[17]: https://itsfoss.com/unzip-linux/ -[18]: https://linuxhandbook.com/unzip-command/ -[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-updating.jpg?ssl=1 -[20]: https://github.com/vinifmor/bauh#general-settings -[21]: https://github.com/vinifmor/bauh#roadmap -[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-search.png?resize=800%2C319&ssl=1 -[23]: https://reddit.com/r/linuxusersgroup diff --git a/translated/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md b/translated/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md new file mode 100644 index 0000000000..0a499a49b2 --- /dev/null +++ b/translated/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bauh – Manage Snaps, Flatpaks and AppImages from One Interface) +[#]: via: (https://itsfoss.com/bauh-package-manager/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +bauh:在一个界面中管理 Snap、Flatpak 和 AppImage +====== + +[Snap][1]、[Flatpak][2] 和 [AppImage][3] 等通用软件包的最大问题之一就是管理它们。大多数内置的软件包管理器不能全部支持这些新格式。 + +幸运的是,我偶然发现了一个支持几种通用包格式的应用程序。 + +### Bauh:多包装需求的管理器 + +[bauh][4](LCTT:给该软件建议一个中文名:“包豪”)最初名为 fpakman,旨在处理 Flatpak、Snap、[AppImage][5] 和 [AUR][6] 软件包。创建者 [vinifmor][7] 在 2019 年 6 月启动了该项目,[意图][8]“为 Manjaro 用户提供管理 Flatpak 的图形界面”。此后,他扩展了该应用程序,以添加对基于 Debian 的系统的支持。 + +![Bauh About][9] + +首次打开 bauh 时,它将扫描已安装的应用程序并检查更新。如果有任何需要更新的内容,它们将列在前面并居中。更新所有软件包后,你将看到已安装的软件包列表。你可以取消选择需要更新的软件包,以防止其被更新。你也可以选择安装该应用程序的早期版本。 + +![With Bauh you can manage various types of packages from one application][10] + +你也可以搜索应用程序。bauh 提供了有关已安装和已搜索软件包的详细信息。如果你对一种(或多种)打包类型不感兴趣,则可以在设置中取消选择它们。 + +### 在你的 Linux 发行版上安装 bauh + +让我们看看如何安装 bauh。 + +#### 基于 Arch 的发行版 + +如果你安装的是最近的 [Manjaro][11],则应该一切已经就绪。bauh 默认情况下已安装。如果你安装的是较早版本的 Manjaro(如我一样)或其他基于 Arch 的发行版,则可以在终端中输入以下内容从 [AUR][12] 中进行安装: + +``` +sudo pacman -S bauh +``` + +![Bauh Package Info][13] + +#### 基于 Debian/Ubuntu 的发行版 + +如果你拥有基于 Debian 或 Ubuntu 的 Linux 发行版,则可以使用 `pip` 安装 bauh。首先,请确保[在 Ubuntu 上安装了 pip][14]。 + +``` +sudo apt install python3-pip +``` + +然后使用它来安装 bauh: + +``` +pip3 install bauh +``` + +但是,该软件的创建者建议[手动][15]安装它,以避免弄乱系统的库。 + +要手动安装 bauh,你必须先下载其[最新版本][16]。下载后,可以[使用图形工具][17]或 [unzip 命令][18]解压缩。接下来,在终端中打开该文件夹。你将需要使用以下步骤来完成安装。 + +首先,在名为 `env` 的文件夹中创建一个虚拟环境: + +``` +python3 -m venv env +``` + +现在在该环境中安装该应用程序的代码: + +``` +env/bin/pip install . +``` + +启动该应用程序: + +``` +env/bin/bauh +``` + +![Bauh Updating][19] + +一旦完成了 bauh 的安装,就可以通过更改环境设置和参数来对其进行[微调][20]。 + +### bauh 的未来之路 + +bauh 在短短的几个月中增长了很多。它有计划继续增长。当前的[路线图][21]包括: + +* 支持其他打包技术 +* 每种打包技术一个单独模块 +* 内存和性能改进 +* 改善用户体验 +   +![Bauh Search][22] + +### 结语 + +当我尝试 bauh 时,遇到了两个问题。当我第一次打开它时,它告诉我尚未安装 Snap,如果要使用 Snap 软件包,则必须安装它。我知道我已经安装了 Snap,因为我在终端中运行了 `snap list`,并且可以正常工作。我重新启动系统,Snap 才工作正常。 + +我遇到的另一个问题是我的一个 AUR 软件包无法更新。我可以用 `yay` 更新软件包,而没有任何问题。可能是我的 Manjaro 有问题,我已经使用了它 3 到 4 年。 + +总体而言,bauh 可以工作。它做到了宣称的功能。我不能要求更多。 + +你有没有用过 hauh?如果有的话,你最喜欢的用于管理不同打包格式的工具是什么?在下面的评论中让我们知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bauh-package-manager/ + +作者:[John Paul][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/john/ +[b]: https://github.com/lujun9972 +[1]: https://snapcraft.io/ +[2]: https://flatpak.org/ +[3]: https://appimage.org/ +[4]: https://github.com/vinifmor/bauh +[5]: https://itsfoss.com/use-appimage-linux/ +[6]: https://itsfoss.com/best-aur-helpers/ +[7]: https://github.com/vinifmor +[8]: https://forum.manjaro.org/t/bauh-formerly-known-as-fpakman-a-gui-for-flatpak-and-snap-management/96180 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-about.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh.jpg?ssl=1 +[11]: https://manjaro.org/ +[12]: https://aur.archlinux.org/packages/bauh +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-package-info.jpg?ssl=1 +[14]: https://itsfoss.com/install-pip-ubuntu/ +[15]: https://github.com/vinifmor/bauh#manual-installation +[16]: https://github.com/vinifmor/bauh/releases +[17]: https://itsfoss.com/unzip-linux/ +[18]: https://linuxhandbook.com/unzip-command/ +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-updating.jpg?ssl=1 +[20]: https://github.com/vinifmor/bauh#general-settings +[21]: https://github.com/vinifmor/bauh#roadmap +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/bauh-search.png?resize=800%2C319&ssl=1 +[23]: https://reddit.com/r/linuxusersgroup From aa23f493ae945447c07baa3f2926beb794ec330b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 Nov 2019 00:06:04 +0800 Subject: [PATCH 635/800] APL --- ...26 Google to Add Mainline Linux Kernel Support to Android.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md index cf6b39cbf9..702a755cd2 100644 --- a/sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md +++ b/sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0b89fd132d42e5b585727e3f284eb670a73608d2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 Nov 2019 00:26:36 +0800 Subject: [PATCH 636/800] TSL --- ...ainline Linux Kernel Support to Android.md | 84 ------------------- ...ainline Linux Kernel Support to Android.md | 82 ++++++++++++++++++ 2 files changed, 82 insertions(+), 84 deletions(-) delete mode 100644 sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md create mode 100644 translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md diff --git a/sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md deleted file mode 100644 index 702a755cd2..0000000000 --- a/sources/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md +++ /dev/null @@ -1,84 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Google to Add Mainline Linux Kernel Support to Android) -[#]: via: (https://itsfoss.com/mainline-linux-kernel-android/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Google to Add Mainline Linux Kernel Support to Android -====== - -The current Android ecosystem is polluted with hundreds of different versions of Android, each running a different variant of the Linux kernel. Each version is designed for a different phone and it’s different configurations. Google has been working to fix the problem by adding the mainline Linux kernel to Android. - -### How the Linux kernel is currently handled in Android - -Before it reaches you, the Linux kernel on your cellphone goes through [three major steps][1]. - -First, Google takes the LTS (Long Term Support) version of the Linux kernel and adds all of the Android-specific code. This becomes the “Android Common kernel”. - -Google then sends this code to the company that creates the System on a Chip (SoC) that runs your phone. This is usually Qualcomm. - -Once the SoC maker finishes add code to support the CPU and other chips, the kernel is then passed on to the actual device maker, such as Samsung or Motorola. The device maker then adds code to support the rest of the phone, such as the display and camera. - -Each of these steps takes a while to complete and results in a kernel that won’t work with any other device. It also means that the kernel is very old, usually about two years old. For example, the Google Pixel 4, which shipped last month, has a kernel from November 2017, which will never get updated. - -Google has pledged to create security patches for older devices, which means they’re stuck keeping an eye on a huge hodge-podge of old code. - -### The Future - -![][2] - -Last year, Google announced [plans][3] to fix this mess. This year they revealed what progress they made at the 2019 Linux Plumbers Conference. - -> “We know what it takes to run Android but not necessarily on any given hardware. So our goal is to basically find all of that out, then upstream it and try to be as close to mainline as possible.” -> -> Sandeep Patil, [Android Kernel Team Lead][1] - -They did show off a Xiaomi Poco F1 running Android with a proper Linux kernel. However, it some things did not [appear to be working][4], such as the battery percentage which was stuck at 0%. - -So, how does Google plan to make this work? By taking a page from their [Project Treble][5] playbook. Before Project Treble, the low-level code that interacted with the device and Android itself was one big mess of code. Project Treble separated the two and made them modular so that Android updates could be shipped quicker and the low-level code could remain unchanged between updates. - -Google wants to bring the same modularity to the kernel. Their [plan][1] “involves stabilizing Linux’s in-kernel ABI and having a stable interface for the Linux kernel and hardware vendors to write to. Google wants to decouple the Linux kernel from its hardware support.” - -So this means that Google would ship a kernel and hardware drivers would be loaded as kernel modules. Currently, this is just a proposal. There are still quite a few technical problems that have to be solved. so, this won’t happen any time soon. - -### Opposition from Open Source - -The Open Source community will not be happy with the idea of putting proprietary code in the kernel. The [Linux kernel guidelines][6] state that drivers have to have a GPL license to be included in the kernel. They also point out that if a change in the driver causes an error, it will be resolved by the person who created the error. This means less work for device makers in the long run. - -### Final Thoughts on including mainline kernel to Andorid - -So far, this is just a proposal. There is a good chance that Google will start working on the project only to abandon it once they realize how much work this will take. Just take a look at how many projects Google has [already abandoned][7]. - -[Android Police][4] made a good point by mentioned that Google is working on its [Fuchsia operating system][8], which seems to have the goal of replacing Android one day. - -So, the question is which monumental task will Google try to complete, getting Android running with a mainline Linux kernel or complete work on their unified Android replacement? Only time can answer that. - -What are your thoughts on this topic? 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][9]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/mainline-linux-kernel-android/ - -作者:[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://arstechnica.com/gadgets/2019/11/google-outlines-plans-for-mainline-linux-kernel-support-in-android/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/mainline_linux_kernel_android.png?ssl=1 -[3]: https://lwn.net/Articles/771974/ -[4]: https://www.androidpolice.com/2019/11/19/google-wants-android-to-use-regular-linux-kernel-potentially-improving-updates-and-security/ -[5]: https://www.computerworld.com/article/3306443/what-is-project-treble-android-upgrade-fix-explained.html -[6]: https://www.kernel.org/doc/Documentation/process/stable-api-nonsense.rst -[7]: https://killedbygoogle.com/ -[8]: https://itsfoss.com/fuchsia-os-what-you-need-to-know/ -[9]: https://reddit.com/r/linuxusersgroup diff --git a/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md new file mode 100644 index 0000000000..f5e9f8a57a --- /dev/null +++ b/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Google to Add Mainline Linux Kernel Support to Android) +[#]: via: (https://itsfoss.com/mainline-linux-kernel-android/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +谷歌为安卓添加主线 Linux 内核支持 +====== + +当前的安卓生态系统被数百种不同版本的安卓所污染,每种版本都运行 Linux 内核的不同变体。每个版本均针对不同的手机和不同的配置而设计。 谷歌一直在通过将主线 Linux 内核添加到安卓来解决该问题。 + +### 当前在安卓中是如何处理 Linux 内核的 + +在到达你的手机之前,你手机上的 Linux 内核经历了[三个主要步骤][1]。 + +首先,谷歌采用了 Linux 内核的 LTS(长期支持)版本,并添加了所有安卓专用代码。这成为“安卓通用内核”。 + +然后,谷歌将此代码发送给创建可运行手机的片上系统(SoC)的公司。这通常是高通公司。 + +SoC 制造商添加了支持 CPU 和其他芯片的代码后,便会将该内核传递给实际的设备制造商,例如三星和摩托罗拉。然后,设备制造商添加代码以支持手机的其余部分,例如显示屏和摄像头。 + +每个步骤都需要一段时间才能完成,并且会导致内核无法与其他任何设备一起使用。这也意味着该内核会非常旧,通常是大约两年前的。例如,上个月交付的谷歌 Pixel 4 带有来自 2017 年 11 月的内核,而且它将永远不会更新。 + +谷歌承诺会为较旧的设备创建安全补丁,这意味着它们会一直盯着大量的旧代码。 + +### 将来 + +![][2] + +去年,谷歌宣布[计划][3]解决此问题。今年,他们在 2019 Linux Plumbers Conference 上展示了他们取得的进展。 + +> “我们知道运行安卓需要什么,但不一定要在任何给定的硬件上运行。因此,我们的目标是从根本上找出所有这些问题,然后将其交给上游,并尝试尽可能接近主线。” +> +> Sandeep Patil,[安卓内核团队负责人][1] + +他们确实炫耀了运行带有适当的 Linux 内核的站的小米 Poco F1。但是,有些事情[似乎没有起作用][4],例如电池电量百分比保持在 0%。 + +那么,谷歌计划如何使其工作呢?从他们的 [Treble 项目][5]剧本中摘录。在 Treble 项目之前,与设备和安卓本身交互的底层代码是一大堆代码。Treble 项目将两者分开,并使它们模块化,以便可以更快地交付安卓更新,并且在两次更新之间,低级代码可以保持不变。 + +谷歌希望为内核带来相同的模块化。他们的[计划][1]“涉及稳定 Linux 的内核 ABI,并为 Linux 内核和硬件供应商提供稳定的接口来进行写入。谷歌希望将 Linux 内核与其硬件支持脱钩。” + +因此,这意味着谷歌将交付一个内核,而硬件驱动程序将作为内核模块加载。目前,这只是一个草案。仍然有很多技术问题需要解决。因此,这不会很快发生。 + +### 来自开源的反对意见 + +开源社区不会对将专有代码放入内核的想法感到满意。[Linux 内核准则][6]指出,驱动程序必须具有 GPL 许可证才能包含在内核中。他们还指出,如果驱动程序的更改导致错误,则由创建错误的人来解决。从长远来看,这意味着设备制造商的工作量将减少。 + +### 关于将主线内核包含到安卓中的最终想法 + +到目前为止,这只是一个建议。谷歌有很大的可能会开始做该项目,除非他们意识到这将需要多少工作后才会放弃。看看谷歌[已经放弃][7]了多少个项目。 + +[Android Police][4] 有个很好的观点,提到了谷歌正在开发其 [Fuchsia 操作系统][8],这似乎是有一天要取代谷歌的目标。 + +那么,问题是谷歌会尝试完成哪些艰巨的任务,使安卓以主线 Linux 内核运行,或者完成他们统一的安卓替代产品的工作?只有时间可以回答。 + +你对此主题有何看法?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mainline-linux-kernel-android/ + +作者:[John Paul][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/john/ +[b]: https://github.com/lujun9972 +[1]: https://arstechnica.com/gadgets/2019/11/google-outlines-plans-for-mainline-linux-kernel-support-in-android/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/mainline_linux_kernel_android.png?ssl=1 +[3]: https://lwn.net/Articles/771974/ +[4]: https://www.androidpolice.com/2019/11/19/google-wants-android-to-use-regular-linux-kernel-potentially-improving-updates-and-security/ +[5]: https://www.computerworld.com/article/3306443/what-is-project-treble-android-upgrade-fix-explained.html +[6]: https://www.kernel.org/doc/Documentation/process/stable-api-nonsense.rst +[7]: https://killedbygoogle.com/ +[8]: https://itsfoss.com/fuchsia-os-what-you-need-to-know/ +[9]: https://reddit.com/r/linuxusersgroup From 8c6aab88e9885264ce033d209c2394673f85e3f4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 Nov 2019 00:55:40 +0800 Subject: [PATCH 637/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191127=20Zorin?= =?UTF-8?q?=20OS=20Responds=20to=20the=20Privacy=20Concerns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191127 Zorin OS Responds to the Privacy Concerns.md --- ...rin OS Responds to the Privacy Concerns.md | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 sources/tech/20191127 Zorin OS Responds to the Privacy Concerns.md diff --git a/sources/tech/20191127 Zorin OS Responds to the Privacy Concerns.md b/sources/tech/20191127 Zorin OS Responds to the Privacy Concerns.md new file mode 100644 index 0000000000..51151d2e87 --- /dev/null +++ b/sources/tech/20191127 Zorin OS Responds to the Privacy Concerns.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Zorin OS Responds to the Privacy Concerns) +[#]: via: (https://itsfoss.com/zorin-os-privacy-concerns/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Zorin OS Responds to the Privacy Concerns +====== + +_**There were some privacy concerns around ‘data collection’ in Zorin OS. It’s FOSS spoke to Zorin OS CEO and here is his response to the controversy.**_ + +After a few days of [Zorin OS 15 Lite][1] release, a Reddit thread surfaced which flagged a privacy concern regarding the Linux distribution. + +The [Reddit thread][2] focuses on the [privacy policy][3] of Zorin OS and warns users that Zorin OS is sending anonymous pings every 60 minutes without users’ consent, which is potentially a privacy issue. + +![][4] + +The policy in question can be quoted here as: + +> _**Anonymous pings**: When using Zorin OS, your computer may occasionally send us a ping which includes an anonymous unique identifier for your computer. We use this information to count the number of active users of Zorin OS. The unique identifier does not identify you unless you (or someone acting on your behalf) discloses it separately. You may choose to disable these pings by uninstalling the “Zorin-os-census” package from your computer_ + +Now, there’s a lot of [discussions][5] surrounding the concern. There’s also a [YouTube video][6] talking about it. + +In a nutshell, it’s a mess. Some insist that they collect our IP addresses and some users complain that they should ask about it while installing Zorin OS. + +While I agree that they could add an opt-out option in the installation process – so I reached out to **Artyom Zorin** (_CEO, Zorin Group_) to clarify the situation. + +### Zorin’s Clarification On What They Collect With Every Anonymous Ping + +When I asked for an elaborate explanation of what the “**anonymous unique identifier**” includes, Artyom mentioned – “_It appears that there are some inaccuracies and misconceptions about the census in the comments sections_“. + +To continue the explanation about the unique identifier, he assured that **their servers do not log IP addresses** when a ping arrives. + +The zorin-os-census script **simply counts the number of unique computers using Zorin OS** and no personal data is being collected along with it. + +Artyom explained in detail: + +> The anonymous identifier is a series of letters and numbers which is randomly generated (not based on any external data) and only used for the Zorin OS Census. Its single purpose is to make sure that the computer isn’t double-counted when a ping is sent from a computer to the server. On a fully-installed Zorin OS system, the anonymous identifier can be found in /var/lib/zorin-os-census/uuid and should look like this:_68f2d95b-f51f-4a5d-9b48-a99c28691b89_ +> * +> *We would like to clarify that no personal or personally-identifiable data is being collected by us and the server does not log IP addresses when pings arrive. The zorin-os-census script is only used to count the number of computers and users running Zorin OS after installation. Even I wouldn’t be able to tell which computer is my own from looking at the server-side database. I have attached a screenshot of a snippet of the database table displaying the information we store. + +He also stressed his ‘commitment on privacy’: + +> Privacy is an essential human right. It’s a core tenet of our mission to give you back control of your technology, and not the other way around. We make privacy a priority with every decision we make, and we’re committed to protecting it in every level of the software we build. + +As you can observe in the response above, he shared a screenshot of how their database of unique identifiers looks like: + +![][7] + +If you’re still curious, you can also check out the [source code][8] for the zorin-os-census script. + +### Can We Opt-Out Of It? + +While the data collected may be ‘harmless’, it is important to give the option to the user whether or not they want Zorin OS to collect the data, right? + +So, when I inquired about the same, he mentioned that i**t was already something planned for Zorin OS 15 Lite release**. + +However, they did not want to rush to add it before properly testing it. Hence, they decided to keep it for the upcoming release (**Zorin OS 15.1**) which is planned to arrive in **early-to-mid December this year.** + +> We have in fact been working on implementing an opt-out option for this into the Zorin OS installer (Ubiquity). To ensure the stability and accessibility of this new functionality we’re adding to Ubiquity, we have scheduled a period of time to translate the text strings and rigorously test the software (in order to avoid regressions), as the installer is a critical component of the operating system. Unfortunately, the testing period for the opt-out option didn’t complete before our planned release of Zorin OS 15 Lite, and we, therefore, decided not to risk adding it before we could guarantee its stability. However, we are on track to include the opt-out option in the upcoming Zorin OS 15.1 release, which we plan to release in early-to-mid December. + +### Will It Be Something Similar To What Ubuntu Does? + +Ubuntu does let you opt-out from collecting information about your computer. + +So, when I asked if Zorin OS will add something similar to that, he responded with some details about how Ubuntu collects data and how Zorin OS is different from that. + +He mentioned the fact that Ubuntu comes pre-installed with a **popularity-contest** package that **occasionally sends data of what packages the user has installed** to the Ubuntu Developers. + +And, further clarified that **Zorin OS does not include that**. + +> While Ubuntu’s telemetry tool gives users the option to not send extensive information about the computers to the Ubuntu developers, selecting the “No” option still sends a ping to Ubuntu’s servers . +> +> From our research, it is not clear whether Ubuntu’s servers store logs of users’ IP addresses when they receive telemetry data. In addition, Zorin OS does not include the “popularity-contest” package that is pre-installed in Ubuntu. This package is designed to occasionally send a list of all packages a user has installed on their computer to the Ubuntu developers. + +**In the end…** + +While the concern regarding the anonymous pings may not seem to a privacy threat, an opt-out option should be presented to the user while installing Zorin OS. Let’s wait and watch if it should arrive in the upcoming Zorin OS 15.1 release. + +What do you think about the privacy concern mentioned above? Let us know your thoughts in the comments down below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zorin-os-privacy-concerns/ + +作者:[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/zorin-os-lite/ +[2]: https://www.reddit.com/r/FreeAsInFreedom/comments/e0yhw4/beware_zorin_os_sends_anonymous_pings_every_60/ +[3]: https://zorinos.com/legal/privacy/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-os-privacy-reddit.jpg?ssl=1 +[5]: https://www.reddit.com/r/linux/comments/e0zd5n/beware_zorin_os_sends_anonymous_pings_every_60/ +[6]: https://www.youtube.com/watch?v=bcgk9LvC36Y&feature=youtu.be&t=860 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-census-database.png?ssl=1 +[8]: https://launchpad.net/~zorinos/+archive/ubuntu/stable/+sourcepub/10183568/+listing-archive-extra From 8acf133fb1c7cfe8f18a60cc3af88fc77770115b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 Nov 2019 00:56:43 +0800 Subject: [PATCH 638/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191126=20Make?= =?UTF-8?q?=20Lua=20development=20easy=20with=20Luarocks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191126 Make Lua development easy with Luarocks.md --- ...Make Lua development easy with Luarocks.md | 233 ++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 sources/tech/20191126 Make Lua development easy with Luarocks.md diff --git a/sources/tech/20191126 Make Lua development easy with Luarocks.md b/sources/tech/20191126 Make Lua development easy with Luarocks.md new file mode 100644 index 0000000000..23a636b826 --- /dev/null +++ b/sources/tech/20191126 Make Lua development easy with Luarocks.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make Lua development easy with Luarocks) +[#]: via: (https://opensource.com/article/19/11/getting-started-luarocks) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Make Lua development easy with Luarocks +====== +Luarocks makes it easy to get started with Lua, a lightweight, +efficient, and embeddable scripting language. +![Coding on a computer][1] + +Bash too basic? Too much whitespace in Python? Go too corporate? + +You should try Lua, a lightweight, efficient, and embeddable scripting language supporting procedural programming, object-oriented programming, functional programming, data-driven programming, and data description. And best of all, it uses explicit syntax for scoping! + +Lua is also small. Lua's source code is just 24,000 lines of C, the Lua interpreter (on 64-bit Linux) built with all standard Lua libraries is 247K, and the Lua library is 421K. + +You might think that such a small language must be too simplistic to do any real work, but in fact Lua has a vast collection of third-party libraries (including GUI toolkits), it's used extensively in video game and film production for 3D shaders, and is a common scripting language for video game engines. To make it easy to get started with Lua, there's even a package manager called [Luarocks][2]. + +### What is Luarocks? + +Python has PIP, Ruby has Gems, Java has Maven, Node has npm, and Lua has Luarocks. Luarocks is a website and a command. The website is home to open source libraries available for programmers to add to their Lua projects. The command searches the site and installs libraries (defined as "rocks") upon demand. + +### What is a programming library? + +If you're new to programming, you might think of a "library" as just a place where books are stored. Programming libraries ("lib" or "libs" for short) are a little like a book library in the sense that both of these things contain information that someone else has already worked to discover, and which you can borrow so you have to do less work. + +For example, if you were writing code that measures how much stress a special polymer can withstand before breaking, you might think you'd have to be pretty clever with math. But if there was already an open source library specifically designed for exactly that sort of calculation, then you could include that library in your code and let it solve that problem for you (provided you give the library's internal functions the numbers it needs in order to perform an accurate calculation). + +In open source programming, you can install libraries freely and use other people's work at will. Luarocks is the mechanism for Lua that makes it quick and easy to find and use a Lua library. + +### Installing Luarocks + +The **luarocks** command isn't actually _required_ to use packages from the Luarocks website, but it does keep you from having to leave your text editor and venture onto the worldwide web [of potential distractions]. To install Luarocks, you first need to install Lua. + +Lua is available from [lua.org][3] or, on Linux, from your distribution's software repository. For example, on Fedora, CentOS, or RHEL: + + +``` +`$ sudo dnf install lua` +``` + +On Debian and Ubuntu: + + +``` +`$ sudo apt install lua` +``` + +On Windows and Mac, you can download and install Lua from the website. + +Once Lua is installed, install Luarocks. If you're on Linux, the **luarocks** command is available in your distribution's repository. + +On Mac, you can install it with [Brew][4] or compile from source: + + +``` +$ wget +$ tar zxpf luarocks-X.Y.Z.tar.gz +$ cd luarocks-X.Y.Z +$ ./configure; sudo make bootstrap +``` + +On Windows, follow the [install instructions][5] on the Luarocks wiki. + +### Search for a library with Luarocks + +The typical usage of the **luarocks** command, from the perspective of a user rather than a developer, involves searching for a library required by some Lua application you want to run and installing that library. + +To search for the Lua package **luasec** (a library providing HTTPS support for **luarocks**), try this command: + + +``` +$ luarocks search luasec +Warning: falling back to curl - +install luasec to get native HTTPS support + +Search results: +=============== + +Rockspecs and source rocks: +\--------------------------- + +luasec +   0.9-1 (rockspec) - +   0.9-1 (src) - +   0.8.2-1 (rockspec) - +[...] +``` + +### Install a library with Luarocks + +To install the **luasec** library: + + +``` +$ luarocks install --local luasec +[...] +gcc -shared -o ssl.so -L/usr/lib64 +src/config.o src/ec.o src/x509.o [...] +-L/usr/lib -Wl,-rpath,/usr/lib: -lssl -lcrypto + +luasec 0.9-1 is now installed in +/home/seth/.luarocks (license: MIT) +``` + +You can install Lua libraries locally or on a systemwide basis. A _local_ install indicates that the Lua library you install is available to you, but no other user of the computer. If you share your computer with someone else, and you each have your own [login account][6], then you probably want to install a library systemwide. However, if you're the only user of your computer, it's a good habit to install libraries locally, if only because that's the appropriate method when you develop with Lua. + +If you're _developing_ a Lua application, then you probably want to install a library to a project directory instead. In Luarocks terminology, this is a _tree_. Your default tree when installing libraries locally is **$HOME/.luarocks**, but you can redefine it arbitrarily. + + +``` +$ mkdir local +$ luarocks --tree=./local install cmark +Installing +gcc -O2 -fPIC -I/usr/include -c cmark_wrap.c [..] +gcc -O2 -fPIC -I/usr/include -c ext/blocks.c -o ext/blocks.o [..] +[...] +No existing manifest. Attempting to rebuild... +cmark 0.29.0-1 is now installed in +/home/seth/downloads/osdc/example-lua/./local +(license: BSD2) +``` + +The library (in this example, the **cmark** library) is installed to the path specified by the **\--tree** option. You can verify it by listing the contents of the destination: + + +``` +$ find ./local/ -type d -name "cmark" +./local/share/lua/5.1/cmark +./local/lib/luarocks/rocks/cmark +``` + +You can use the library in your Lua code by defining the **package.path** variable to point to your local rocks directory: + + +``` +package.path = package.path .. ';local/share/lua/5.3/?.lua' + +require("cmark") +``` + +### Getting information about an installed rock + +You can see information about an installed rock with the **show** option: + + +``` +$ luarocks show luasec +LuaSec 0.9-1 - A binding for OpenSSL library +to provide TLS/SSL communication over LuaSocket. + +This version delegates to LuaSocket the TCP +connection establishment between +the client and server. Then LuaSec uses this +connection to start a secure TLS/SSL session. + +License:        MIT +Homepage:       +Installed in:   /home/seth/.luarocks +[...] +``` + +This provides you with a summary of what a library provides from a user's perspective, displays the project homepage in case you want to investigate further, and shows you where the library is installed. In this example, it's installed in my home directory in a **.luarocks** folder. This assures me that it's installed locally, which means that if I migrate my home directory to a different computer, I'll retain my Luarocks configuration and installs. + +### Get a list of installed rocks + +You can list all installed rocks on your system with the **list** option: + + +``` +$ luarocks list + +Installed rocks: +\---------------- + +luasec +   0.9-1 (installed) - /home/seth/.luarocks/lib/luarocks/rocks + +luasocket +   3.0rc1-2 (installed) - /home/seth/.luarocks/lib/luarocks/rocks + +luce +   scm-0 (installed) - /home/seth/.luarocks/lib/luarocks/rocks + +tekui +   1.07-1 (installed) - /home/seth/.luarocks/lib/luarocks/rocks +``` + +This displays the rocks you have installed in the default install location. Developers can override this by using the **\--tree** option to redefine the active tree. + +### Remove a rock + +If you want to remove a rock, you can do that with Luarocks using the **remove** option: + + +``` +`$ luarocks remove --local cmark` +``` + +This removes a library (in this example, the **cmark** library) from your local tree. Developers can override this by using the **\--tree** option to redefine the active tree. + +If you want to remove _all_ the rocks you have installed, use the **purge** option instead. + +### Luarocks rocks + +Whether you're a user exploring exciting new Lua applications and need to install some dependencies or you're a developer using Lua to create exciting new applications, Luarocks makes your job easy. Lua is a beautiful and simple language, and Luarocks is perfectly suited to be its package manager. Give both a try today! + +Discussing Tarantool this year at the Percona Live Data Performance Conference. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/getting-started-luarocks + +作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: http://luarocks.org +[3]: http://lua.org +[4]: http://brew.sh +[5]: https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Windows +[6]: https://opensource.com/article/19/11/add-user-gui-linux From 27da1ad8fda32ca2bf944101ef9597200d1544fd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 Nov 2019 00:57:04 +0800 Subject: [PATCH 639/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191126=20Calcul?= =?UTF-8?q?ator=20N+=20is=20an=20open=20source=20scientific=20calculator?= =?UTF-8?q?=20for=20your=20smartphone?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md --- ...ientific calculator for your smartphone.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md diff --git a/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md b/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md new file mode 100644 index 0000000000..32d467465a --- /dev/null +++ b/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Calculator N+ is an open source scientific calculator for your smartphone) +[#]: via: (https://opensource.com/article/19/11/calculator-n-mobile) +[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-es) + +Calculator N+ is an open source scientific calculator for your smartphone +====== +The Android app does a wide range of advanced mathematical functions in +the palm of your hand. +![scientific calculator][1] + +Mobile phones are becoming more powerful every day, so it is no surprise that they can beat most computers from the not-so-distant past. This also means the tools available on them are getting more powerful every day. + +Previously, I wrote about [scientific calculators for the Linux desktop][2], and I'm following that up here with information about [Calculator N+][3], an awesome GPL v3.0-licensed computer algebra system (CAS) app for Android devices. + +Calculator N+ is presented as a "powerful calculator for Android," but that's a humble statement; the app not only works with arbitrary precision, displaying results with roots and fractions in all their glory, it does a _lot_ more. + +Finding polynomial roots? Check. Factorization? Check. Symbolic derivatives, integrals, and limits? Check. Number theory (modular arithmetic, combinatorics, prime factorization)? Check. + +You can also solve systems of equations, simplify expressions (including trigonometric ones), convert units… you name it! + +![Calculator N+ graphical interface][4] + +Results are output in LaTeX. The menu in the top-left provides many powerful functions ready to use with a simple touch. Also in that menu, you'll find Help files for all of the app's functions. At the top-right of the screen, you can toggle between exact and decimal representation. Finally, tapping the blue bar at the bottom of the screen gives you access to the whole library of functions available in the app. But be careful! If you are not a mathematician, physicist, or engineer, such a long list may seem overwhelming. + +All of this power comes from the [Symja library][5], another great GPL 3 project. + +Both projects are under active development, and they are getting better with each version. In particular, version 3.4.6 of Calculator N+ gets a major leap in user interface (UI) quality. And yes, there are still some rough corners here and there, but taming this much power in the tiny UI of a smartphone is a difficult task, and I think the app developers are solving its remaining issues quite well. Kudos to them! + +If you are a teacher, a student, or work on a STEM field, check out Calculator N+. It's free, no ads, open source, and covers all your math needs. (Except, of course, during math exams, where smartphones should never be allowed to prevent cheating.) + +Calculator N+ is available in the [Google Play Store][6], or you can [build it from source code][7] using the instructions on the GitHub page. + +If you know any other useful open source apps for science or engineering, let us know in the comments. + +The app makes use of the sensors on your phone and offers a digital science notebook to record your... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/calculator-n-mobile + +作者:[Ricardo Berlasso][a] +选题:[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/rgb-es +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) +[2]: https://opensource.com/article/18/1/scientific-calculators-linux +[3]: https://github.com/tranleduy2000/ncalc +[4]: https://opensource.com/sites/default/files/uploads/calculatornplus_sqrt-frac.png (Calculator N+ graphical interface) +[5]: https://github.com/axkr/symja_android_library +[6]: https://play.google.com/store/apps/details?id=com.duy.calculator.free +[7]: https://github.com/tranleduy2000/ncalc/blob/master/README.md From 5d3ecc28d56d7984f7789eb3b8924a11bab92b34 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 Nov 2019 00:57:19 +0800 Subject: [PATCH 640/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191126=20A=20fr?= =?UTF-8?q?amework=20for=20building=20products=20from=20open=20source=20pr?= =?UTF-8?q?ojects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191126 A framework for building products from open source projects.md --- ...ding products from open source projects.md | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 sources/tech/20191126 A framework for building products from open source projects.md diff --git a/sources/tech/20191126 A framework for building products from open source projects.md b/sources/tech/20191126 A framework for building products from open source projects.md new file mode 100644 index 0000000000..2a8a109e07 --- /dev/null +++ b/sources/tech/20191126 A framework for building products from open source projects.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A framework for building products from open source projects) +[#]: via: (https://opensource.com/article/19/11/products-open-source-projects) +[#]: author: (Kevin Xu https://opensource.com/users/kevin-xu) + +A framework for building products from open source projects +====== +Here is a roadmap for turning a project into a commercial open source +product. +![An airplane.][1] + +My first memory of playing with a computer was through an [MS-DOS][2] terminal on the x86 PC in my grandfather's pharmaceutical research lab in the early '90s—playing games stored on 3.5" floppy disks and doing touch-typing exercises. As technology improved, I spent an obscene amount of time taking my computer apart to add more RAM, a new graphics card, or a new fan, mostly so I could play cooler games. It was a fun, ongoing project, and I bonded with my father over it. It was also way cheaper than buying a new computer. + +What's the point of this in the context of open source? + +Well, even though I had no idea what "open source" was at the time, I was behaving like a typical developer does with open source projects today—spending my free time to piece together and build things I wanted, sometimes for a specific goal, sometimes to learn new things, sometimes as a way to connect with others. + +But, over time, I stopped tinkering. For whatever reason, I decided that my time was becoming too "valuable" to retrofit my older computers. I started using a MacBook, and when my older MacBook wasn't functioning well, I paid a pretty penny for a new one with a better configuration instead of unscrewing the bottom to see if I could jam in a new RAM card. + +My behavior became more like that of an enterprise buyer—saving time and trouble by spending money. + +### An open source software project is not a product you sell + +If your experience with technology resembles mine in any way, you know intuitively that the _projects_ we [DIY][3] are not the same as the _products_ we spend money buying. + +This isn't a new observation in the open source community. + +[Stephen Walli][4], an IT industry veteran and part of the [Open Container Initiative][5], has written [numerous detailed blog posts][6] on this topic. [Sarah Novotny][7], who led the Kubernetes community and was heavily involved in the Nginx and MySQL communities, [emphatically articulated][8] at the inaugural [Open Core Summit][9] that the open source project a company shepherds and the product that a company sells are two completely _different_ things. + +Yet, project and product continue to be conflated by maintainers-turned-founders of commercial open source software (COSS) companies, especially (and ironically) when the open source project gets traction. + +This mistake gets repeated, I believe, because it's hard to mentally conceptualize how and why a commercial product should be different when the open source project is already being used widely. + +### What makes a COSS product different? + +Two core elements differentiate a commercial product from its open source root: packaged experience and buyer-specific features. + +#### Packaged experience + +Packaging your project so that it has that out-of-the-box user experience isn't just about a polished user interface (UI) or hosting it on your server as SaaS (although that could be part of it). It's an expressed opinion of how you, the creator or maintainer of the project turned founder of the company, believe the technology should be used to solve your customer's business problem. That "opinion" is essentially the product experience the customer is paying for. + +When you are running an open source community project, it's usually good to be _not_ opinionated and let your community organically flourish. When you are developing a product for customers, it's usually good to _be_ opinionated. + +It's the retrofitted x86 PC versus the MacBook dynamic. + +[Dave McJannet][10], CEO of Hashicorp, and [Peter Reinhardt][11], CEO of Segment, both cited packaging as a crucial step to get right in order to turn an open source project into a scalable commercial product. + +#### Buyer-specific features + +A well-packaged product must also have the features that are necessary for your targeted buyer to justify a purchase. What these features are depends on the profile of your buyer, but the possibilities are finite and manageable. + +An enterprise buyer, say a Global 2000, will have a relatively consistent set of features that it must have to purchase a product. ([EnterpriseReady.io][12] is a great resource about what those features tend to be.) + +A small- or medium-sized business buyer, say your local mom-and-pop bakery, that has less financial resources and people power and is more price-sensitive, will need different things to be convinced to buy. + +A consumer service monetized via ads, where your buyers are the advertisers while your users are everyday people, will be different still. + +One thing is for sure: your buyer is almost _never_ your open source community. + +Know what your buyer requires for a purchase, and package that with your expert opinion on how to solve the buyer's problem; **that's what differentiates a product from a project.** + +Sid Sijbrandij's articulation of GitLab's [buyer-based open core][13] model is a good example for enterprises. + +Certainly, other elements can be added to further the differentiation. But a packaged experience with buyer-specific features is essential. Without one or the other, your prospective customers might as well just tinker on their own for free. + +### One metric that matters: Time-to-value + +A perennially difficult thing in product development is measuring progress and establishing a data-driven framework to determine whether you are on the right path or not. I'm a fan of the One Metric That Matters (OMTM) mentality, elaborated in [_Lean Analytics_][14], where you focus on one single number (above everything else) for your current stage. This approach enforces focus and discipline among a sea of data you can gather and distract yourself with (oftentimes vanity metrics like download numbers or GitHub stars). The single metric can effectively rally your entire company around one tangible goal or mission—especially critical for an early-stage company. And the metric you focus on will be different at different stages. + +So what's the right OMTM in the early days of product development? + +I propose **time-to-value** + +"Time" here is straightforward—the lower, the better. + +"Value" needs a precise, rigorous definition that is technology- and problem-specific. Your distributed database is valuable because it can serve data with no downtime when servers fail. Your continuous integration tool is valuable because it enables application developers to push improvements faster without breaking the application. You get the idea. + +How quickly can a customer see or feel the _one core piece of value_ that you measure and optimize for? Whatever is "a sufficiently short time" depends on the use case, but given the increasing consumerization of enterprise technology, any product's time-to-value that's more than 30 minutes is probably too long. + +Finding and tightly defining that "value" is hard and iterative, but also table stakes if you are looking to build a product company around an open source project. Without a deep understanding of what that value is for your customer, there's probably not much of a company to build. + +At the end of the day, as much fun as it was to "beef up" my x86 PC, I'm pretty satisfied with my MacBook and happy to pay the premium. So don't get too enamored with the joy of tinkering if your goal is actually to sell MacBook. + +(P.S. The mental framework outlined here may not apply if you are building a consultancy or support-oriented company that services open source project users. For more expansive reading on different COSS business models, see _[_COSS business model progressions_][15]_ by Joseph Jacks.) + +_Special thanks to Sarah Novotny for her feedback on this post's draft._ + +* * * + +_This article was [previously published on COSS Media][16] and is edited and republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/products-open-source-projects + +作者:[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/206308main_image_976_946-710.jpg?itok=U6hh3EIO (An airplane.) +[2]: https://en.wikipedia.org/wiki/MS-DOS +[3]: https://en.wikipedia.org/wiki/Do_it_yourself +[4]: https://stephesblog.blogs.com/about.html +[5]: https://www.opencontainers.org/ +[6]: https://medium.com/@stephenrwalli +[7]: https://sarahnovotny.com/about/ +[8]: https://www.linkedin.com/pulse/personal-reflection-open-core-summit-kevin-xu/ +[9]: https://opencoresummit.com/#speakers +[10]: https://founderrealtalk.ggvc.com/2019/04/25/episode-23-hashicorp-ceo-dave-mcjannet-reveals-the-secrets-of-commercializing-open-source-selling-to-enterprises-and-building-successful-relationships-with-founders/ +[11]: https://www.youtube.com/watch?v=Q75V35unztw&feature=youtu.be +[12]: https://www.enterpriseready.io/# +[13]: https://www.youtube.com/watch?v=G6ZupYzr_Zg +[14]: http://leananalyticsbook.com/ +[15]: https://coss.media/coss-business-model-progressions/ +[16]: https://coss.media/deriving-product-from-open-source/ From 67a58ac9f9219d178ac1fd4326bdb803f46418ee Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 Nov 2019 00:57:42 +0800 Subject: [PATCH 641/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=20Fail-f?= =?UTF-8?q?ree=20Kubernetes,=20significant=20events,=20and=20more=20indust?= =?UTF-8?q?ry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191125 Fail-free Kubernetes, significant events, and more industry trends.md --- ...ficant events, and more industry trends.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20191125 Fail-free Kubernetes, significant events, and more industry trends.md diff --git a/sources/tech/20191125 Fail-free Kubernetes, significant events, and more industry trends.md b/sources/tech/20191125 Fail-free Kubernetes, significant events, and more industry trends.md new file mode 100644 index 0000000000..009e30cd40 --- /dev/null +++ b/sources/tech/20191125 Fail-free Kubernetes, significant events, and more industry trends.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fail-free Kubernetes, significant events, and more industry trends) +[#]: via: (https://opensource.com/article/19/11/fail-free-kubernetes-and-more-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Fail-free Kubernetes, significant events, and more industry trends +====== +A weekly look at open source community, market, and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [Why teams fail with Kubernetes—and what to do about it][2] + +> Fail to address the questions "Who is responsible for _x_?" and "Who is affected by _y_?" and you'll put all your efforts at risk. For example, replace "_x_" above with "deciding on namespaces versus clusters for service and environment isolation" or "upgrading all clusters to a new Kubernetes version," and you start to see why you need to clarify the boundaries of responsibility and their impacts. + +**The impact**: Wouldn't it be nice if operators and role-based access control could make the messiness of human interaction go away? Why can't auto-scaling just mean auto-scaling? Tough luck! You're going to have to figure out the people side of it too! + +## [The New Stack Context: The past, present, and future of Kubernetes][3] + +> What have been some of the most significant events in the Kubernetes and cloud native community over the past year? A lot of work has been done in slimming and stabilizing the core. Operators were a growing trend over the past year—operators are mechanisms to expand the number of things you can build on top of Kubernetes. We are seeing Kubernetes expand into new workloads as well. + +**The impact**: In some way, Kubernetes is an ongoing effort in re-building the airplane mid-flight. The good news is that we're getting better at doing that, and the future holds ubiquity, according to this podcast. + +## [Q&A: Fidelity invests in cloud-native, open source projects to step up innovation][4] + +> “We are seeing that Kubernetes, CNCF, and cloud-native technology are the key players for us when we go multicloud and hybrid-cloud model,” said [Amr Abdelhalem][5] (pictured), head of cloud platforms at Fidelity Investments. “That’s why we are here. We are here actually in Kubernetes and KubeCon for that reason. That’s where we see this abstract layer that guarantees you the portability for moving your application from one cloud provider to another.” + +**The impact**: Think about this: Fidelity is a member of the CNCF. What does that mean about the distance between the creator and consumer of open source software? It's exciting because it exemplifies the participatory ideals of open source; its a new challenge for the ecosystem because participants are starting to represent industry verticals that might not have much overlap whose needs need reconciliation. Fun times! + +## [The future of hybrid cloud is bright as 73% of enterprises moving apps back on Prem][6] + +> This year’s report illustrated that creating and executing a cloud strategy has become a multidimensional challenge. At one time, a primary value proposition associated with the public cloud was substantial upfront capex savings. Now, enterprises have discovered that there are other considerations when selecting the best cloud for the business as well, and that one size cloud strategy doesn’t fit all use cases. For example, while applications with unpredictable usage may be best suited to the public clouds offering elastic IT resources, workloads with more predictable characteristics can often run on-premises at a lower cost than public cloud. Savings are also dependent on businesses’ ability to match each application to the appropriate cloud service and pricing tier, and to remain diligent about regularly reviewing service plans and fees, which change frequently. + +**The impact**: The short version is that cost is not the only, or even the most important factor, in choosing where to run a workload. More and more often it is the nature of the workload itself. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/fail-free-kubernetes-and-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://techbeacon.com/enterprise-it/why-teams-fail-kubernetes-what-do-about-it +[3]: https://thenewstack.io/the-new-stack-context-the-past-present-and-future-of-kubernetes/ +[4]: https://siliconangle.com/2019/11/21/qa-fidelity-invests-cloud-native-open-source-projects-step-innovation-kubecon/ +[5]: https://www.linkedin.com/in/amrhalem/ +[6]: https://www.dqindia.com/the-future-of-hybrid-cloud-is-bright-as-73-of-enterprises-moving-apps-back-on-prem/ From d83bafa5ac0150196eb44ddebedc047a283dd69a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 Nov 2019 00:58:21 +0800 Subject: [PATCH 642/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191125=20Challe?= =?UTF-8?q?nge:=20Write=20a=20bouncy=20window=20manager?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191125 Challenge- Write a bouncy window manager.md --- ...hallenge- Write a bouncy window manager.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20191125 Challenge- Write a bouncy window manager.md diff --git a/sources/tech/20191125 Challenge- Write a bouncy window manager.md b/sources/tech/20191125 Challenge- Write a bouncy window manager.md new file mode 100644 index 0000000000..601e231f53 --- /dev/null +++ b/sources/tech/20191125 Challenge- Write a bouncy window manager.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Challenge: Write a bouncy window manager) +[#]: via: (https://jvns.ca/blog/2019/11/25/challenge--make-a-bouncy-window-manager/) +[#]: author: (Julia Evans https://jvns.ca/) + +Challenge: Write a bouncy window manager +====== + +Hello! I’m writing a short series of programming challenges with [Julian][1], and this is the first one! + +### the challenge + +![][2] + +**requirements** + +The goal here is to make a very silly Linux window manager that bounces its windows around the screen, like in the gif above. + +**anti-requirements** + +The window manager doesn’t need to do anything else! It doesn’t need to support: + + * moving or resizing windows + * switching between windows + * minimizing windows + * literally any of the other things you might normally expect a window manager to do + + + +It turns out implementing this kind of toy window manager is surprisingly approachable! + +### the setup: start with tinywm + +All the instructions here only work on Linux (since this is about writing a Linux window manager). + +**starter kit: tinywm** + +Writing a window manager from scratch seems intimidating (at first I didn’t even know how to start!). But then I found **[tinywm][3]**, which is a tiny window manager written in only **50 lines of C**. This is a GREAT starting point and there’s an annotated version of the source code which explains a lot of the details. There’s a Python version of tinywm too, but I wasn’t able to get it to work. + +I did this challenge by modifying [tinywm][3] and it worked really well. + +**tools** + + * **Xephyr** lets you embed an X session in a window in your regular desktop, so that you can develop your toy window manager without breaking your usual desktop. I ran it like this: `Xephyr -ac -screen 1280x1024 -br -reset -terminate 2> /dev/null :1 &` + * You can start an xterm in the Xephyr desktop with `xterm -display :1` + * I compiled my window manager with `gcc bouncewm.c -g -o bouncewm -lX11` and ran it with `env DISPLAY=:1 ./bouncewm` + * **xtrace** lets you trace all requests to the X windows system that your window manager is making. I found it really helpful when debugging. (run it like `xtrace ./bouncewm`) + + + +**documentation** + +Some useful references: + + * the [dwm source code][4] (dwm is a 2000-line-of-C window manager) + * the [Xlib programming manual][5] + + + +If you’re not comfortable writing C, there are also libraries that let you work with X in other languages. I personally found C easier to use because a lot of the window manager documentation and examples I found were for the Xlib C library. + +### my experience: 5 hours, 50 lines of code + +To give you a very rough idea of the difficulty of this exercise: I did this in 4 or 5 hours this morning and last night, producing the window manager you see in the gif at the top of the blog post (which is 50 lines of code). I’d never looked at the source code for a window manager before yesterday. + +As usual when working with a new library I spent most of that time being confused about various basic things about how X works. (and as a result I learned several new things about X!) + +For me this challenge was a fun way to: + + * learn some basics about the X window system protocol (I’ve been using window managers for 15 years, today I got to write one!) + * research an unfamiliar library (“ooh, what does this function do?”) + * use a C library, since I don’t usually write C + + + +### send me your solution if you do this! + +I’ll post the solution I came up in a week. If you think this window manager challenge sounds fun and end up doing it, I’d love it if you sent me your solution (to [[email protected]][6])! + +I’d be delighted to post any solutions you send me in the solutions blog post. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/11/25/challenge--make-a-bouncy-window-manager/ + +作者:[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://www.cipht.net/2017/10/03/are-jump-tables-always-fastest.html +[2]: https://jvns.ca/images/bouncewm.gif +[3]: http://incise.org/tinywm.html +[4]: https://git.suckless.org/dwm/file/dwm.c.html +[5]: https://tronche.com/gui/x/xlib/ +[6]: https://jvns.ca/cdn-cgi/l/email-protection From 9fc51d94e14e7b7d7e004fcbcc61b48315e50186 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 Nov 2019 00:59:07 +0800 Subject: [PATCH 643/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191126=20How=20?= =?UTF-8?q?cloud=20providers'=20performance=20differs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191126 How cloud providers- performance differs.md --- ...ow cloud providers- performance differs.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/talk/20191126 How cloud providers- performance differs.md diff --git a/sources/talk/20191126 How cloud providers- performance differs.md b/sources/talk/20191126 How cloud providers- performance differs.md new file mode 100644 index 0000000000..0abb0f11b7 --- /dev/null +++ b/sources/talk/20191126 How cloud providers- performance differs.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How cloud providers' performance differs) +[#]: via: (https://www.networkworld.com/article/3455197/how-cloud-providers-performance-differs.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +How cloud providers' performance differs +====== +The 2019 ThousandEyes Benchmark report shows that not all cloud providers are created equal across all regions +Denis Isakov / Getty Images + +Not all public cloud service providers are the same when it comes to network performance. + +Each one’s connectivity approach varies, which causes geographical discrepancies in network performance and predictability. As businesses consider moving to the cloud, especially software-defined wide-area networks ([SD-WAN][1]) and [multi-cloud][2], it’s important to understand what each public cloud service provider brings to the table and how they compare. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +In 2018, ThousandEyes first conducted [a benchmark study assessing three major public cloud providers][4]: Amazon Web Services (AWS), Microsoft Azure (Azure), and Google Cloud Platform (GCP). The study gathered data on network performance and connectivity architecture to guide businesses in the planning stage. + +[][5] + +BrandPost Sponsored by HPE + +[HPE Synergy For Dummies][5] + +Here’s how IT can provide an anytime, anywhere, any workload infrastructure. + +[This year’s study][6] offers a more comprehensive view of the competition, with two more providers added to the list: Alibaba Cloud and IBM Cloud. It compares 2018 and 2019 data to show changes that took place year-over-year and what triggered them. + +ThousandEyes periodically collected bi-directional network performance metrics—such as latency, packet loss and jitter—from 98 user vantage points in global [data centers][7] across all five public cloud providers over a four-week period. Additionally, it looked at network performance from leading U.S. broadband internet service providers (ISPs), including AT&T, Verizon, Comcast, CenturyLink, Cox, and Charter. + +The network management company then analyzed more than 320 million data points to create the benchmark. Here are the results. + +### Inconsistencies among providers + +In its initial study, ThousandEyes revealed that some cloud providers rely heavily on the public internet to carry user traffic while others don’t. In this year’s study, the cloud providers generally showed similar performance in bi-directional network latency. + +However, ThousandEyes found architectural and connectivity differences have a big impact on how traffic travels between users and certain cloud hosting regions. AWS and Alibaba mostly rely on the internet to transport user traffic. Azure and GCP use their private backbone networks. IBM is different from the rest and takes a hybrid approach. + +ThousandEyes tested the theory of whether AWS Global Accelerator out-performs the internet. AWS Global Accelerator launched in November 2018, offering users the option to utilize the AWS private backbone network for a fee instead of the default public internet. Although performance did improve in some regions around the world, there where other instances where the internet was faster and more reliable than AWS Global Accelerator. + +Broadband ISPs that businesses use to connect to each cloud also showed inconsistencies, even in the mature U.S. market. After evaluating network performance from the six U.S. ISPs, sub-optimal routing results were recorded, with up to 10 times the expected network latency in some cases. + +**Location, location, location** + +Cloud providers commonly experience packet loss when crossing through China’s content-filtering firewall, even those from the region like Alibaba. The 2019 study closely examined the performance toll cloud providers pay in China, which has a notoriously challenging geography for online businesses. For those with customers in China, ThousandEyes recommends Hong Kong as a hosting region since Alibaba Cloud traffic experienced the least packet loss there, followed by Azure and IBM. + +In other parts of the world, Latin America and Asia showed the highest performance variations for all cloud providers. For example, network latency was six times higher from Rio de Janeiro to GCP’s São Paulo hosting region because of a suboptimal reverse path, compared to other providers. But across North America and Western Europe, all five cloud providers demonstrated comparable, robust network performance. + +The study’s results confirm that location is a major factor, therefore, user-to-hosting-region performance data should be considered when selecting a public cloud provider. + +**Multi-cloud connectivity** + +In 2018, ThousandEyes discovered extensive connectivity between the backbone networks of AWS, GCP, and Azure. An interesting finding in this year’s study shows multi-cloud connectivity was erratic when IBM and Alibaba Cloud were added to the list. + +ThousandEyes found IBM and Alibaba Cloud don’t have fully established, direct connectivity with other providers. That’s because they typically use ISPs to connect their clouds to other providers. AWS, Azure, and GCP, on the other hand, peer directly with each other and don’t require third-party ISPs for multi-cloud communication. + +With multi-cloud initiatives on the rise, network performance should be included as a metric in evaluating multi-cloud connectivity since it appears to be inconsistent across providers and geographical boundaries. + +ThousandEyes’ comprehensive performance benchmark can serve as a guide for businesses deciding which public cloud provider best meets their needs. But to err on the side of caution, businesses selecting public cloud connectivity should consider the unpredictable nature of the internet, how it affects performance, creates risk, and increases operational complexity. Businesses should address those challenges by gathering their own network intelligence on a case-by-case basis. Only then they will benefit fully from what cloud providers have to offer. + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3455197/how-cloud-providers-performance-differs.html + +作者:[Zeus Kerravala][a] +选题:[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/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[2]: https://www.networkworld.com/article/3429258/real-world-tools-for-multi-cloud-management.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3319776/the-network-matters-for-public-cloud-performance.html +[5]: https://www.networkworld.com/article/3399618/hpe-synergy-for-dummies.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE19718&utm_content=sidebar (HPE Synergy For Dummies) +[6]: https://www.thousandeyes.com/press-releases/second-annual-cloud-performance-benchmark-research +[7]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world From 1b7e69877a08706230b8a20675079e88529efbc5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 27 Nov 2019 00:59:30 +0800 Subject: [PATCH 644/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191126=20SASE:?= =?UTF-8?q?=20Redefining=20the=20network=20and=20security=20architecture?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191126 SASE- Redefining the network and security architecture.md --- ...g the network and security architecture.md | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 sources/talk/20191126 SASE- Redefining the network and security architecture.md diff --git a/sources/talk/20191126 SASE- Redefining the network and security architecture.md b/sources/talk/20191126 SASE- Redefining the network and security architecture.md new file mode 100644 index 0000000000..c92cb9eeda --- /dev/null +++ b/sources/talk/20191126 SASE- Redefining the network and security architecture.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SASE: Redefining the network and security architecture) +[#]: via: (https://www.networkworld.com/article/3481519/sase-redefining-the-network-and-security-architecture.html) +[#]: author: (Matt Conran https://www.networkworld.com/author/Matt-Conran/) + +SASE: Redefining the network and security architecture +====== +Adoption of SASE reduces complexity and overhead, improves security and boosts application performance. +Getty Images + +In a cloud-centric world, users and devices require access to services everywhere. The focal point has changed. Now it is the identity of the user and device as opposed to the traditional model that focused solely on the data center. As a result, these environmental changes have created a new landscape that we need to protect and connect. + +This new landscape is challenged by many common problems. The enterprises are loaded with complexity and overhead due to deployed appliances for different technology stacks. The legacy network and security designs increase latency. In addition, the world is encrypted; this dimension needs to be inspected carefully, without degrading the application performance. + +These are some of the reasons that surface the need for a cloud-delivered secure access service edge (SASE). SASE consists of a tailored network fabric optimization where it makes the most sense for the user, device and application - at geographically dispersed PoPs. To deliver optimum network experience everywhere you should avoid the unpredictability of the Internet core. In the requirements for SASE, Gartner recommends that this backbone should not be based on AWS or Azure. Their PoP density is insufficient. It is not sufficient to offer a SASE service built solely on a hyper-scale. + +[][1] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][1] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +There are clear benefits that can be achieved by redefining the network and security architecture. Yes, the adoption of SASE reduces complexity and overhead, improves security. It increases the application performance, but practically, what does that mean? + +[Linda Musthaler had a great example in her conversation with Andrew Thomson, Director of IT at BioIVT,][2] a provider of biological materials and scientific services to research and development organizations, who adopted Cato Networks’ SASE platform nearly two years ago: + +_“We positioned it as a platform for everything that we wanted to be able to do over the next three years with the business,” he told Linda, “The big goal, the business strategy, is growth and acquisition. We presented this as a platform, as a base service that we just had to have in place in order to leverage things like voice over IP, Office 365, Azure, cloud-based computing services, hosting servers in the cloud. Without a common core solid foundation, we wouldn't have been able to do any of those things reliably without adding staff to do monitoring or maintenance or administrative overhead.”_ + +It’s that last line – “without adding staff to do monitoring or maintenance or administrative overhead” – that I found particularly striking. So, let’s understand why SASE can be so impactful from an architectural perspective. + +**[ Now read [20 hot jobs ambitious IT pros should shoot for][3]. ]** + +### Complexity and overhead + +Traditional mechanisms are limited by the hardware capacity of the physical appliances located at the customer's site. Such mechanisms create a lag in the hardware refresh rates that are needed to add new functionality. + +Hardware-based network and security solutions build into the hardware the differentiator of the offering. Primarily, with different hardware, you can accelerate the services and add new features. There are some features that are available only on the specific hardware, not the hardware you already have onsite. In this case, heavy lifting by the customer will be required. + +As the environment evolves, we should not depend on the new network and security features coming from the new generation of an appliance. Typically, this model is inefficient and complex. It creates high operational overhead and management complexity. + +Device upgrades for new features require a lot of management. From past experience, to change out a line card would involve multiple teams. The line card might run out of ports or you may simply need additional features from a new generation. Largely, this would involve project planning, on-site engineers, design guides, hopefully, line card testing and hours of work. For critical sites to ensure a successful refresh, team members may need to be backed up. Therefore, there are many touches that need to be managed. + +### SASE – Easing management + +The cloud-based SASE enables the updates for new features and functionality without the need for new deployments of appliances (physical or virtual) and software versions on the customer side. This has an immediate effect on the ease of management. + +Now the network and security deployment can occur without ever touching the enterprise network. This allows enterprises to adopt new capabilities quickly. Once the tight coupling between the features and the customer appliance is removed, this increases the agility and simplicity for the deployment of network and security services. + +With a SASE platform, when we create an object, such as a policy in the networking domain, it is then available in other domains as well. So any policies assigned to users are tied to that user, regardless of the network location. This significantly removes the complexity of managing both; network and security policies across multiple locations, users and types of devices. Supremely, all of this can be done from one platform. + +Also, when we examine the security solution, many buy individual appliances that focus just on one job. To troubleshoot, you need to gather information, such as the logs from each device. This is what a SIEM is useful for but it can only be used in some organizations as it’s resource-heavy. For the ones who don’t have ample resources, the process is backbreaking and there will be false positives. + +In addition, SASE enables easier troubleshooting because all the data is in one common repository. You no longer have normalized data from different appliances/solution and then import the data into a database for a common view. + +### Consolidation of vendors and technology stacks + +I recall an experience from a previous consultancy, wherein we were planning the next year's security budget. The network was packed with numerous security solutions. All these point solutions are expensive and there is never a fixed price. So how do you actually plan for this? + +Some new solutions we were considering charge on the usage models which at that time we didn’t have the quantity. SASE removes these types of headaches. By consolidating services into a single provider, there will be a reduction in the number of vendors and agents/clients on the end-user device. + +Overall, there will be high complexity saving from the consolidation of vendors and technology stacks. The complexity is pushed to the cloud away from the on-premise enterprise network. The SASE fabric abstracts the complexity and reduces costs. + +From a hardware point of view: for scale and additional capacity, the cloud-based SASE can add more PoPs of the same instance. This is known as vertical scaling. This scaling can also be carried in new locations, known as horizontal scaling. + +Additionally, the SASE-based cloud takes care of intensive processing. For example, since a large proportion of internet traffic is now encrypted, malware can use encryption to evade and hide from detection. Here, each of the PoPs can perform DPI on TLS-encrypted traffic. + +Traditional firewalls are not capable of inspecting encrypted traffic. Performing DPI on TLS-encrypted traffic would require extra modules or a new appliance. A SASE solution ensures that the decryption and inspection are done at the PoP. Consequently, there is no performance-hit or the need for new appliances on the customer sites. + +### Ways to improve performance + +Network congestion resulting in dropped and out of order packets is bad for applications. Latency-sensitive applications, such as collaboration, video, VoIP and web conferencing are hit hardest because of packet drops. Luckily, there are options to minimize latency and the effects of packet loss. + +SD-WAN solutions have WAN optimization features that can be applied on an application-by-application or site-by-site basis. Along with WAN optimization features, there are protocol and application acceleration techniques that can be employed. + +On top of the existing techniques to reduce the packet loss and latency, we can privatize the WAN as much as possible. You can control the adverse and varying effects that the last mile and middle mile have on the applications by privatizing with a global backbone consisting of a fabric of PoPs. + +Once privatized, we can have more control over traffic paths, packet loss and latency. A private network fabric is a key benefit gained from SASE as it drives the application performance. + +### SASE PoP optimizations + +Each PoP in the SASE cloud-based solution optimizes where it makes the most sense, not just at the WAN edge. Within the backbone, we have global route optimizations to determine which path is the best at the current time and it can also be changed for all traffic or certain applications. + +These routing algorithms factor in the performance metrics, such as latency, packet loss and jitter. These algorithms can help in selecting the optimal route for every network packet. The WAN backbone constantly analyzes and tries to improve the performance. This is unlike internet routing that favors cost over performance. + +As everything is privatized, we have all the information to create the largest packet size and use rate-based algorithms over traditional loss-based algorithms. As a result, you don't need to learn anything, and the end-to-end throughput can be maintained. + +As each PoP acts as a TCP proxy server, certain techniques are employed so that the TCP client and server think that they are closer. Therefore, a larger TCP window is set, allowing more data to be passed before waiting for an acknowledgment. + +### Preferred egress points + +We can also define preferred egress points to exit the cloud application traffic. These could be the points closest to the customer's application instance. The optimal global routing algorithms determine the best path to the customer's cloud application instance from anywhere in the world. + +The PoPs can be collocated in the data centers directly connected to the IXP that connects to all major Infrastructures as service providers. This provides a good on-ramp to access the services from Amazon AWS, Microsoft Azure and Google cloud. + +Therefore, you can keep the traffic on the private cloud for the majority of the time. Within a SASE design, the internet is used only to provide a short hop to the SASE fabric. + +### Security – Identity-centric perimeter + +SASE converges the networking and security pillars into a single platform. This allows multiple security solutions into a cloud service that enforces a unified policy across all the corporate locations, users and data. + +SASE recommends you employ the zero-trust principles. The initial path to zero trust starts with identifying that network access is based on the identity of user, device and application. It is not based on the IP address or physical location of the device. And this is for a good reason as there is no contextual information. + +The identity of the user/device must reflect the business context as opposed to being associated with binary constructs that are completely disjointed from the upper layers. This binds the identity to the world of networking and is the best way forward for policy enforcement. This way, the dependency on IP or applications as identifiers is removed. Now, the policy can be applied consistently, regardless of where the user/device is located. At the same time, the identity of the user/device/service can be factored into the applied policy. + +The SASE stack is dynamically applied based on the identity and context while serving zero trust at strategic points in the cloud. This is what enforces an identity-centric perimeter. + +_You can learn more about SASE and how it relates to [SD-WAN architectures][4] in a recent course I’ve rolled out. The course shines the torch on various SD-WAN solutions from Silver Peak, VMware, Cisco and Cato._ + +**This article is published as part of the IDG Contributor Network. [Want to Join?][5]** + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3481519/sase-redefining-the-network-and-security-architecture.html + +作者:[Matt Conran][a] +选题:[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/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.networkworld.com/article/3453030/sase-is-more-than-a-buzzword-for-bioivt.html +[3]: https://www.networkworld.com/article/3276025/careers/20-hot-jobs-ambitious-it-pros-should-shoot-for.html +[4]: https://www.pluralsight.com/courses/sd-wan-architectures-big-picture +[5]: https://www.networkworld.com/contributor-network/signup.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From a46237a6e7f92d9dd50e7cb42336aa03accf93df Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 Nov 2019 08:53:02 +0800 Subject: [PATCH 645/800] PRF --- ...ainline Linux Kernel Support to Android.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md index f5e9f8a57a..817ad74077 100644 --- a/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md +++ b/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Google to Add Mainline Linux Kernel Support to Android) @@ -10,21 +10,21 @@ 谷歌为安卓添加主线 Linux 内核支持 ====== -当前的安卓生态系统被数百种不同版本的安卓所污染,每种版本都运行 Linux 内核的不同变体。每个版本均针对不同的手机和不同的配置而设计。 谷歌一直在通过将主线 Linux 内核添加到安卓来解决该问题。 +当前的安卓生态系统被数百种不同版本的安卓所污染,每种版本都运行着 Linux 内核的不同变体。每个版本均针对不同的手机和不同的配置而设计。谷歌试图通过将主线 Linux 内核添加到安卓来解决该问题。 ### 当前在安卓中是如何处理 Linux 内核的 在到达你的手机之前,你手机上的 Linux 内核经历了[三个主要步骤][1]。 -首先,谷歌采用了 Linux 内核的 LTS(长期支持)版本,并添加了所有安卓专用代码。这成为“安卓通用内核”。 +首先,谷歌采用了 Linux 内核的 LTS(长期支持)版本,并添加了所有的安卓专用代码。这将成为“安卓通用内核”。 -然后,谷歌将此代码发送给创建可运行手机的片上系统(SoC)的公司。这通常是高通公司。 +然后,谷歌将此代码发送给创建可运行在手机的片上系统(SoC)的公司。这通常是高通公司。 SoC 制造商添加了支持 CPU 和其他芯片的代码后,便会将该内核传递给实际的设备制造商,例如三星和摩托罗拉。然后,设备制造商添加代码以支持手机的其余部分,例如显示屏和摄像头。 -每个步骤都需要一段时间才能完成,并且会导致内核无法与其他任何设备一起使用。这也意味着该内核会非常旧,通常是大约两年前的。例如,上个月交付的谷歌 Pixel 4 带有来自 2017 年 11 月的内核,而且它将永远不会更新。 +每个步骤都需要一段时间才能完成,并且会导致该内核无法与其他任何设备一起使用。这也意味着内核会非常旧,通常是大约两年前的内核。例如,上个月交付的谷歌 Pixel 4 带有来自 2017 年 11 月的内核,而且它将永远不会得到更新。 -谷歌承诺会为较旧的设备创建安全补丁,这意味着它们会一直盯着大量的旧代码。 +谷歌承诺会为较旧的设备创建安全补丁,这意味着他们会一直盯着大量的旧代码。 ### 将来 @@ -32,31 +32,31 @@ SoC 制造商添加了支持 CPU 和其他芯片的代码后,便会将该内 去年,谷歌宣布[计划][3]解决此问题。今年,他们在 2019 Linux Plumbers Conference 上展示了他们取得的进展。 -> “我们知道运行安卓需要什么,但不一定要在任何给定的硬件上运行。因此,我们的目标是从根本上找出所有这些问题,然后将其交给上游,并尝试尽可能接近主线。” +> “我们知道运行安卓需要什么,但不一定是在任何给定的硬件上。因此,我们的目标是从根本上找出所有这些,然后将其交给上游,并尝试尽可能接近主线。” > > Sandeep Patil,[安卓内核团队负责人][1] -他们确实炫耀了运行带有适当的 Linux 内核的站的小米 Poco F1。但是,有些事情[似乎没有起作用][4],例如电池电量百分比保持在 0%。 +他们确实炫耀了运行带有合适的 Linux 内核的小米 Poco F1。但是,有些东西[似乎没有工作][4],例如电池电量百分比一直留在 0%。 -那么,谷歌计划如何使其工作呢?从他们的 [Treble 项目][5]剧本中摘录。在 Treble 项目之前,与设备和安卓本身交互的底层代码是一大堆代码。Treble 项目将两者分开,并使它们模块化,以便可以更快地交付安卓更新,并且在两次更新之间,低级代码可以保持不变。 +那么,谷歌计划如何使其工作呢?从他们的 [Treble 项目][5]计划中摘录。在 Treble 项目之前,与设备和安卓本身交互的底层代码是一大堆代码。Treble 项目将两者分开,并使它们模块化,以便可以更快地交付安卓更新,并且在更新时,这些低级代码可以保持不变。 -谷歌希望为内核带来相同的模块化。他们的[计划][1]“涉及稳定 Linux 的内核 ABI,并为 Linux 内核和硬件供应商提供稳定的接口来进行写入。谷歌希望将 Linux 内核与其硬件支持脱钩。” +谷歌希望为内核带来同样的模块化。他们的[计划][1]“涉及稳定 Linux 的内核 ABI,并为 Linux 内核和硬件供应商提供稳定的接口来进行写入。谷歌希望将 Linux 内核与其硬件支持脱钩。” -因此,这意味着谷歌将交付一个内核,而硬件驱动程序将作为内核模块加载。目前,这只是一个草案。仍然有很多技术问题需要解决。因此,这不会很快发生。 +因此,这意味着谷歌将交付一个内核,而硬件驱动程序将作为内核模块加载。目前,这只是一个草案。仍然有很多技术问题有待解决。因此,这不会很快有结果。 ### 来自开源的反对意见 -开源社区不会对将专有代码放入内核的想法感到满意。[Linux 内核准则][6]指出,驱动程序必须具有 GPL 许可证才能包含在内核中。他们还指出,如果驱动程序的更改导致错误,则由创建错误的人来解决。从长远来看,这意味着设备制造商的工作量将减少。 +开源社区不会对将专有代码放入内核的想法感到满意。[Linux 内核准则][6]指出,驱动程序必须具有 GPL 许可证才能包含在内核中。他们还指出,如果驱动程序的更改导致错误,应由导致该错误的人来解决。从长远来看,这意味着设备制造商的工作量将减少。 ### 关于将主线内核包含到安卓中的最终想法 -到目前为止,这只是一个建议。谷歌有很大的可能会开始做该项目,除非他们意识到这将需要多少工作后才会放弃。看看谷歌[已经放弃][7]了多少个项目。 +到目前为止,这只是一个草案。谷歌有很大的可能会开始进行该项目,除非他们意识到这将需要多少工作后才会放弃。看看谷歌[已经放弃][7]了多少个项目! -[Android Police][4] 有个很好的观点,提到了谷歌正在开发其 [Fuchsia 操作系统][8],这似乎是有一天要取代谷歌的目标。 +[Android Police][4] 指出谷歌正在开发其 [Fuchsia 操作系统][8],这似乎是为了有一天取代谷歌。 -那么,问题是谷歌会尝试完成哪些艰巨的任务,使安卓以主线 Linux 内核运行,或者完成他们统一的安卓替代产品的工作?只有时间可以回答。 +那么,问题是谷歌会尝试完成那些艰巨的任务,使安卓以主线 Linux 内核运行,还是完成他们统一的安卓替代产品的工作?只有时间可以回答。 -你对此主题有何看法?请在下面的评论中告诉我们。 +你对此话题有何看法?请在下面的评论中告诉我们。 -------------------------------------------------------------------------------- @@ -65,7 +65,7 @@ via: https://itsfoss.com/mainline-linux-kernel-android/ 作者:[John Paul][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 e54414e59e68b04c5d712590cc7c26c1e0947469 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 27 Nov 2019 08:54:37 +0800 Subject: [PATCH 646/800] Rename sources/tech/20191127 Zorin OS Responds to the Privacy Concerns.md to sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md --- .../20191127 Zorin OS Responds to the Privacy Concerns.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191127 Zorin OS Responds to the Privacy Concerns.md (100%) diff --git a/sources/tech/20191127 Zorin OS Responds to the Privacy Concerns.md b/sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md similarity index 100% rename from sources/tech/20191127 Zorin OS Responds to the Privacy Concerns.md rename to sources/news/20191127 Zorin OS Responds to the Privacy Concerns.md From 8bce6d2bb05d817e9d0f7a35c5436c03009d70cc Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 Nov 2019 08:57:42 +0800 Subject: [PATCH 647/800] PUB @wxy https://linux.cn/article-11616-1.html --- ... Google to Add Mainline Linux Kernel Support to Android.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20191126 Google to Add Mainline Linux Kernel Support to Android.md (98%) diff --git a/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/published/20191126 Google to Add Mainline Linux Kernel Support to Android.md similarity index 98% rename from translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md rename to published/20191126 Google to Add Mainline Linux Kernel Support to Android.md index 817ad74077..0a1ab43779 100644 --- a/translated/talk/20191126 Google to Add Mainline Linux Kernel Support to Android.md +++ b/published/20191126 Google to Add Mainline Linux Kernel Support to Android.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11616-1.html) [#]: subject: (Google to Add Mainline Linux Kernel Support to Android) [#]: via: (https://itsfoss.com/mainline-linux-kernel-android/) [#]: author: (John Paul https://itsfoss.com/author/john/) From b7b59d781d6624092ccd63e2051196ac304b6ed9 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 27 Nov 2019 08:59:29 +0800 Subject: [PATCH 648/800] translating --- ...How to document Python code with Sphinx.md | 180 ----------------- ...How to document Python code with Sphinx.md | 181 ++++++++++++++++++ 2 files changed, 181 insertions(+), 180 deletions(-) delete mode 100644 sources/tech/20191121 How to document Python code with Sphinx.md create mode 100644 translated/tech/20191121 How to document Python code with Sphinx.md diff --git a/sources/tech/20191121 How to document Python code with Sphinx.md b/sources/tech/20191121 How to document Python code with Sphinx.md deleted file mode 100644 index 0394d17dd9..0000000000 --- a/sources/tech/20191121 How to document Python code with Sphinx.md +++ /dev/null @@ -1,180 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to document Python code with Sphinx) -[#]: via: (https://opensource.com/article/19/11/document-python-sphinx) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -How to document Python code with Sphinx -====== -Documentation is best as part of the development process. Sphinx, along -with Tox, makes it easy to write and beautiful to look at. -![Python in a coffee cup.][1] - -Python code can include documentation right inside its source code. The default way of doing so relies on **docstrings**, which are defined in a triple quote format. While the value of documentation is well... documented, it seems all too common to not document code sufficiently. Let's walk through a scenario on the power of great documentation. - -After one too many whiteboard tech interviews that ask you to implement the Fibonacci sequence, you have had enough. You go home and write a reusable Fibonacci calculator in Python that uses floating-point tricks to get to O(1). - -The code is pretty simple: - - -``` -# fib.py -import math - -_SQRT_5 = math.sqrt(5) -_PHI = (1 + _SQRT_5) / 2 - -def approx_fib(n): -    return round(_PHI**(n+1) / _SQRT_5) -``` - -(That the Fibonacci sequence is a geometric sequence rounded to the nearest whole number is one of my favorite little-known math facts.) - -Being a decent person, you make the code open source and put it on [PyPI][2]. The **setup.py** file is simple enough: - - -``` -import setuptools - -setuptools.setup( -    name='fib', -    version='2019.1.0', -    description='Fibonacci', -    py_modules=["fib"], -) -``` - -However, code without documentation is useless. So you add a docstring to the function. One of my favorite docstring styles is the ["Google" style][3]. It is light on markup, which is nice when it is inside the source code. - - -``` -def approx_fib(n): -    """ -    Approximate Fibonacci sequence - -    Args: -        n (int): The place in Fibonacci sequence to approximate - -    Returns: -        float: The approximate value in Fibonacci sequence -    """ -    # ... -``` - -But the function's documentation is only half the battle. Prose documentation is important for contextualizing code usage. In this case, the context is annoying tech interviews.  - -There is an option to add more documentation, and the Pythonic pattern is to use an **rst** file (short for [reStructuredText][4]) commonly added under a **docs/** directory. So the **docs/index.rst** file ends up looking like this: - - -``` -Fibonacci -========= - -Are you annoyed at tech interviewers asking you to implement -the Fibonacci sequence? -Do you want to have some fun with them? -A simple -:code:`pip install fib` -is all it takes to tell them to, -um, -fib off. - -.. automodule:: fib -   :members: -``` - -And we're done, right? We have the text in a file. Someone should look at it. - -### Making Python documentation beautiful - -To make your documentation look beautiful, you can take advantage of [Sphinx][5], which is designed to make pretty Python documents. In particular, these three Sphinx extensions are helpful: - - * **sphinx.ext.autodoc**: Grabs documentation from inside modules - * **sphinx.ext.napoleon**: Supports Google-style docstrings - * **sphinx.ext.viewcode**: Packages the ReStructured Text sources with the generated docs - - - -In order to tell Sphinx what and how to generate, we configure a helper file at **docs/conf.py**: - - -``` -extensions = [ -    'sphinx.ext.autodoc', -    'sphinx.ext.napoleon', -    'sphinx.ext.viewcode', -] -# The name of the entry point, without the ".rst" extension. -# By convention this will be "index" -master_doc = "index" -# This values are all used in the generated documentation. -# Usually, the release and version are the same, -# but sometimes we want to have the release have an "rc" tag. -project = "Fib" -copyright = "2019, Moshe Zadka" -author = "Moshe Zadka" -version = release = "2019.1.0" -``` - -This file allows us to release our code with all the metadata we want and note our extensions (the comments above explain how). Finally, to document exactly how we want the documentation generated, use [Tox][6] to manage the virtual environment to make sure we generate the documentation smoothly: - - -``` -[tox] -# By default, .tox is the directory. -# Putting it in a non-dot file allows opening the generated -# documentation from file managers or browser open dialogs -# that will sometimes hide dot files. -toxworkdir = {toxinidir}/build/tox - -[testenv:docs] -# Running sphinx from inside the "docs" directory -# ensures it will not pick up any stray files that might -# get into a virtual environment under the top-level directory -# or other artifacts under build/ -changedir = docs -# The only dependency is sphinx -# If we were using extensions packaged separately, -# we would specify them here. -# A better practice is to specify a specific version of sphinx. -deps = -    sphinx -# This is the sphinx command to generate HTML. -# In other circumstances, we might want to generate a PDF or an ebook -commands = -    sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html -# We use Python 3.7. Tox sometimes tries to autodetect it based on the name of -# the testenv, but "docs" does not give useful clues so we have to be explicit. -basepython = python3.7 -``` - -Now, whenever you run Tox, it will generate beautiful documentation for your Python code. - -### Documentation in Python is excellent - -As a Python developer, the toolchain available to us is fantastic. We can start with **docstrings**, add **.rst** files, then add Sphinx and Tox to beautify the results for users.  - -What do you appreciate about good documentation? Do you have other favorite tactics? Share them in the comments! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/document-python-sphinx - -作者:[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/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) -[2]: https://pypi.org/ -[3]: http://google.github.io/styleguide/pyguide.html#381-docstrings -[4]: http://docutils.sourceforge.net/rst.html -[5]: http://www.sphinx-doc.org/en/master/ -[6]: https://tox.readthedocs.io/en/latest/ diff --git a/translated/tech/20191121 How to document Python code with Sphinx.md b/translated/tech/20191121 How to document Python code with Sphinx.md new file mode 100644 index 0000000000..8c7cc395ad --- /dev/null +++ b/translated/tech/20191121 How to document Python code with Sphinx.md @@ -0,0 +1,181 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to document Python code with Sphinx) +[#]: via: (https://opensource.com/article/19/11/document-python-sphinx) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +如何使用 Sphinx 给 Python 代码写文档 +====== +最好将文档作为开发过程的一部分。Sphinx 加上 Tox,让文档可以轻松书写,并且外观漂亮。 +![Python in a coffee cup.][1] + +Python 代码可以在源码中包含文档。这种方式默认依靠 **docstring**,它以三引号格式定义。虽然文档的价值是很大的,但是代码没有充足的文档还是很常见。让我们演练一个场景,了解出色的文档的强大功能。 + +经历了太多白板技术面试,要求你实现斐波那契数列,你已经受够了。你回家用 Python 写了一个可重用的斐波那契计算器,使用浮点技巧来实现 O(1) 复杂度。 + + +代码很简单: + + +``` +# fib.py +import math + +_SQRT_5 = math.sqrt(5) +_PHI = (1 + _SQRT_5) / 2 + +def approx_fib(n): + return round(_PHI**(n+1) / _SQRT_5) +``` + +(该斐波那契数列是四舍五入到最接近的整数的几何序列,这是我最喜欢的鲜为人知的数学事实之一。) + +作为一个好人,你可以将代码开源,并将它放在 [PyPI][2] 上。setup.py 文件很简单: + + +``` +import setuptools + +setuptools.setup( + name='fib', + version='2019.1.0', + description='Fibonacci', + py_modules=["fib"], +) +``` + +但是,没有文档的代码是没有用的。因此,你可以向函数添加 docstring。我最喜欢的 docstring 样式之一是 [“Google” 样式][3]。标记很轻量,这在它位于源代码中时很好。 + + +``` +def approx_fib(n): + """ + Approximate Fibonacci sequence + + Args: + n (int): The place in Fibonacci sequence to approximate + + Returns: + float: The approximate value in Fibonacci sequence + """ + # ... +``` + +但是函数的文档只是成功的一半。普通文档对于情境化代码用法很重要。在这种情况下,上下文是恼人的技术面试。 + +有一种添加更多文档的方式,Pythonic 模式通常是在 **docs/** 添加 **rst** 文件 ( [reStructuredText][4] 的缩写)。因此**docs/index.rst** 文件最终看起来像这样: + + +``` +Fibonacci +========= + +Are you annoyed at tech interviewers asking you to implement +the Fibonacci sequence? +Do you want to have some fun with them? +A simple +:code:`pip install fib` +is all it takes to tell them to, +um, +fib off. + +.. automodule:: fib + :members: +``` + +我们完成了,对吧?我们已经将文本放在了文件中。人们应该看看。 + +### 使 Python 文档更漂亮 + +为了使你的文档看起来更漂亮,你可以利用 [Sphinx][5],它旨在制作漂亮的 Python 文档。这三个 Sphinx 扩展特别有用: + +* **sphinx.ext.autodoc**:从模块内部获取文档 + * **sphinx.ext.napoleon**:支持 Google 样式的 docstring + * **sphinx.ext.viewcode**:将 ReStructured Text 源码与生成的文档打包在一起 + + + + +为了告诉 Sphinx 该生成什么以及如何生成,我们在 **docs/conf.py** 中配置一个辅助文件: + + +``` +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode', +] +# The name of the entry point, without the ".rst" extension. +# By convention this will be "index" +master_doc = "index" +# This values are all used in the generated documentation. +# Usually, the release and version are the same, +# but sometimes we want to have the release have an "rc" tag. +project = "Fib" +copyright = "2019, Moshe Zadka" +author = "Moshe Zadka" +version = release = "2019.1.0" +``` + +此文件使我们可以使用所需的所有元数据来发布代码,并注意扩展名(上面的注释说明了方式)。最后,要确保生成我们想要的文档,请使用 [Tox][6] 管理虚拟环境以确保我们顺利生成文档: + + +``` +[tox] +# By default, .tox is the directory. +# Putting it in a non-dot file allows opening the generated +# documentation from file managers or browser open dialogs +# that will sometimes hide dot files. +toxworkdir = {toxinidir}/build/tox + +[testenv:docs] +# Running sphinx from inside the "docs" directory +# ensures it will not pick up any stray files that might +# get into a virtual environment under the top-level directory +# or other artifacts under build/ +changedir = docs +# The only dependency is sphinx +# If we were using extensions packaged separately, +# we would specify them here. +# A better practice is to specify a specific version of sphinx. +deps = + sphinx +# This is the sphinx command to generate HTML. +# In other circumstances, we might want to generate a PDF or an ebook +commands = + sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html +# We use Python 3.7. Tox sometimes tries to autodetect it based on the name of +# the testenv, but "docs" does not give useful clues so we have to be explicit. +basepython = python3.7 +``` + +现在,无论何时运行T ox,它都会为你的 Python 代码生成漂亮的文档。 + +### 在 Python 中写文档很好 + +作为 Python 开发人员,我们可以使用的工具链很棒。 我们可以从 **docstring** 开始,添加 **.rst** 文件,然后添加 Sphinx 和 Tox 来为用户美化结果。 + +你对好的文档有何评价? 你还有其他喜欢的方式么? 请在评论中分享它们! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/document-python-sphinx + +作者:[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/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) +[2]: https://pypi.org/ +[3]: http://google.github.io/styleguide/pyguide.html#381-docstrings +[4]: http://docutils.sourceforge.net/rst.html +[5]: http://www.sphinx-doc.org/en/master/ +[6]: https://tox.readthedocs.io/en/latest/ \ No newline at end of file From 0d10842fef7b87048da9acde8415a486d226c5ab Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 27 Nov 2019 09:03:11 +0800 Subject: [PATCH 649/800] translating --- ...w to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md index d23a8aaf52..973fff72c6 100644 --- a/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md +++ b/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 12904beaa52f54ccb213cf7f47a56118da5339c6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 Nov 2019 09:30:38 +0800 Subject: [PATCH 650/800] PUB @wxy https://linux.cn/article-11617-1.html --- ...latpaks and AppImages from One Interface.md | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) rename {translated/tech => published}/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md (83%) diff --git a/translated/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md b/published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md similarity index 83% rename from translated/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md rename to published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md index 0a499a49b2..5d7f65bedd 100644 --- a/translated/tech/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md +++ b/published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11617-1.html) [#]: subject: (Bauh – Manage Snaps, Flatpaks and AppImages from One Interface) [#]: via: (https://itsfoss.com/bauh-package-manager/) [#]: author: (John Paul https://itsfoss.com/author/john/) @@ -10,21 +10,23 @@ bauh:在一个界面中管理 Snap、Flatpak 和 AppImage ====== -[Snap][1]、[Flatpak][2] 和 [AppImage][3] 等通用软件包的最大问题之一就是管理它们。大多数内置的软件包管理器不能全部支持这些新格式。 +![](https://img.linux.net.cn/data/attachment/album/201911/27/092926pzzdtytda80yaany.jpg) -幸运的是,我偶然发现了一个支持几种通用包格式的应用程序。 +[Snap][1]、[Flatpak][2] 和 [AppImage][3] 等通用软件包的最大问题之一就是管理它们。大多数内置的软件包管理器都不能全部支持这些新格式。 -### Bauh:多包装需求的管理器 +幸运的是,我偶然发现了一个支持这几种通用包格式的应用程序。 -[bauh][4](LCTT:给该软件建议一个中文名:“包豪”)最初名为 fpakman,旨在处理 Flatpak、Snap、[AppImage][5] 和 [AUR][6] 软件包。创建者 [vinifmor][7] 在 2019 年 6 月启动了该项目,[意图][8]“为 Manjaro 用户提供管理 Flatpak 的图形界面”。此后,他扩展了该应用程序,以添加对基于 Debian 的系统的支持。 +### bauh:多包装需求的管理器 + +[bauh][4](LCTT:我给该软件建议一个中文名:“包豪”)最初名为 fpakman,旨在处理 Flatpak、Snap、[AppImage][5] 和 [AUR][6] 软件包。创建者 [vinifmor][7] 在 2019 年 6 月启动了该项目,[意图][8]“为 Manjaro 用户提供管理 Flatpak 的图形界面”。此后,他扩展了该应用程序,以添加对基于 Debian 的系统的支持。 ![Bauh About][9] -首次打开 bauh 时,它将扫描已安装的应用程序并检查更新。如果有任何需要更新的内容,它们将列在前面并居中。更新所有软件包后,你将看到已安装的软件包列表。你可以取消选择需要更新的软件包,以防止其被更新。你也可以选择安装该应用程序的早期版本。 +首次打开 bauh 时,它将扫描已安装的应用程序并检查更新。如果有任何需要更新的内容,它们将列在前面并居中。更新所有软件包后,你将看到已安装的软件包列表。你可以取消选择不需要更新的软件包,以防止其被更新。你也可以选择安装该应用程序的早期版本。 ![With Bauh you can manage various types of packages from one application][10] -你也可以搜索应用程序。bauh 提供了有关已安装和已搜索软件包的详细信息。如果你对一种(或多种)打包类型不感兴趣,则可以在设置中取消选择它们。 +你也可以搜索应用程序。bauh 提供了有关已安装和已搜索软件包的详细信息。如果你对一种(或多种)软件包类型不感兴趣,则可以在设置中取消选择它们。 ### 在你的 Linux 发行版上安装 bauh From a70fcf8f4d03bf135321803049256933c6787db2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 Nov 2019 09:39:35 +0800 Subject: [PATCH 651/800] PRF --- ...aps, Flatpaks and AppImages from One Interface.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md b/published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md index 5d7f65bedd..cc418f1713 100644 --- a/published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md +++ b/published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md @@ -28,6 +28,12 @@ bauh:在一个界面中管理 Snap、Flatpak 和 AppImage 你也可以搜索应用程序。bauh 提供了有关已安装和已搜索软件包的详细信息。如果你对一种(或多种)软件包类型不感兴趣,则可以在设置中取消选择它们。 +![Bauh Search][22] + +![Bauh Package Info][13] + +![Bauh Updating][19] + ### 在你的 Linux 发行版上安装 bauh 让我们看看如何安装 bauh。 @@ -40,8 +46,6 @@ bauh:在一个界面中管理 Snap、Flatpak 和 AppImage sudo pacman -S bauh ``` -![Bauh Package Info][13] - #### 基于 Debian/Ubuntu 的发行版 如果你拥有基于 Debian 或 Ubuntu 的 Linux 发行版,则可以使用 `pip` 安装 bauh。首先,请确保[在 Ubuntu 上安装了 pip][14]。 @@ -78,8 +82,6 @@ env/bin/pip install . env/bin/bauh ``` -![Bauh Updating][19] - 一旦完成了 bauh 的安装,就可以通过更改环境设置和参数来对其进行[微调][20]。 ### bauh 的未来之路 @@ -90,8 +92,6 @@ bauh 在短短的几个月中增长了很多。它有计划继续增长。当前 * 每种打包技术一个单独模块 * 内存和性能改进 * 改善用户体验 -   -![Bauh Search][22] ### 结语 From f3719aec5c1b5624f2b307af81c6e42c7a93e700 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 27 Nov 2019 22:03:05 +0800 Subject: [PATCH 652/800] PRF --- ...26 Google to Add Mainline Linux Kernel Support to Android.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/published/20191126 Google to Add Mainline Linux Kernel Support to Android.md index 0a1ab43779..479ef5cdde 100644 --- a/published/20191126 Google to Add Mainline Linux Kernel Support to Android.md +++ b/published/20191126 Google to Add Mainline Linux Kernel Support to Android.md @@ -52,7 +52,7 @@ SoC 制造商添加了支持 CPU 和其他芯片的代码后,便会将该内 到目前为止,这只是一个草案。谷歌有很大的可能会开始进行该项目,除非他们意识到这将需要多少工作后才会放弃。看看谷歌[已经放弃][7]了多少个项目! -[Android Police][4] 指出谷歌正在开发其 [Fuchsia 操作系统][8],这似乎是为了有一天取代谷歌。 +[Android Police][4] 指出谷歌正在开发其 [Fuchsia 操作系统][8],这似乎是为了有一天取代安卓。 那么,问题是谷歌会尝试完成那些艰巨的任务,使安卓以主线 Linux 内核运行,还是完成他们统一的安卓替代产品的工作?只有时间可以回答。 From f259e54f1c9bfc5afa79fe344a248d6da26727d3 Mon Sep 17 00:00:00 2001 From: Morisun029 <54652937+Morisun029@users.noreply.github.com> Date: Wed, 27 Nov 2019 22:04:28 +0800 Subject: [PATCH 653/800] translated --- .../tech/20191107 Demystifying Kubernetes.md | 236 ------------------ .../tech/20191107 Demdystifying Kubernetes.md | 231 +++++++++++++++++ 2 files changed, 231 insertions(+), 236 deletions(-) delete mode 100644 sources/tech/20191107 Demystifying Kubernetes.md create mode 100644 translated/tech/20191107 Demdystifying Kubernetes.md diff --git a/sources/tech/20191107 Demystifying Kubernetes.md b/sources/tech/20191107 Demystifying Kubernetes.md deleted file mode 100644 index ad3260b0b3..0000000000 --- a/sources/tech/20191107 Demystifying Kubernetes.md +++ /dev/null @@ -1,236 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Demystifying Kubernetes) -[#]: via: (https://opensourceforu.com/2019/11/demystifying-kubernetes/) -[#]: author: (Abhinav Nath Gupta https://opensourceforu.com/author/abhinav-gupta/) - -Demystifying Kubernetes -====== - -[![][1]][2] - -_Kubernetes is a production grade open source system for automating deployment, scaling, and the management of containerised applications. This article is about managing containers with Kubernetes._ - -‘Containers’ has become one of the latest buzz words. But what does the term imply? Often associated with Docker, a container is defined as a standardised unit of software. Containers encapsulate the software and the environment required to run the software into a single unit that is easily shippable. -A container is a standard unit of software that packages the code and all its dependencies so that the application runs quickly and reliably from one computing environment to another. The container does this by creating something called an image, which is akin to an ISO image. A container image is a lightweight, standalone, executable package of software that includes everything needed to run an application — code, runtime, system tools, system libraries and settings. - -Container images become containers at runtime and, in the case of Docker containers, images become containers when they run on a Docker engine. Containers isolate software from the environment and ensure that it works uniformly despite differences in instances across environments. - -**What is container management?** -Container management is the process of organising, adding or replacing large numbers of software containers. Container management uses software to automate the process of creating, deploying and scaling containers. This gives rise to the need for container orchestration—a tool that automates the deployment, management, scaling, networking and availability of container based applications. - -**Kubernetes** -Kubernetes is a portable, extensible, open source platform for managing containerised workloads and services, and it facilitates both configuration and automation. It was originally developed by Google. It has a large, rapidly growing ecosystem. Kubernetes services, support, and tools are widely available. - -Google open sourced the Kubernetes project in 2014. Kubernetes builds upon a decade and a half of experience that Google had with running production workloads at scale, combined with best-of-breed ideas and practices from the community, as well as the usage of declarative syntax. - -Some of the common terminologies associated with the Kubernetes ecosystem are listed below. -_**Pods:**_ A pod is the basic execution unit of a Kubernetes application – the smallest and simplest unit in the Kubernetes object model that you create or deploy. A pod represents processes running on a Kubernetes cluster. - -A pod encapsulates the running container, storage, network IP (unique) and commands that govern how the container should run. It represents the single unit of deployment within the Kubernetes ecosystem, a single instance of an application which might consist of one or many containers running with tight coupling and shared resources. - -Pods in a Kubernetes cluster can be used in two main ways. The first is pods that run a single container. The ‘one-container-per-pod’ model is the most common Kubernetes use case. The second method involves pods that run multiple containers that need to work together. - -A pod might encapsulate an application composed of multiple co-located containers that are tightly coupled and need to share resources. - -_**ReplicaSet:**_ The purpose of a ReplicaSet is to maintain a stable set of replica pods running at any given time. A ReplicaSet contains information about how many copies of a particular pod should be running. To create multiple pods to match the ReplicaSet criteria, Kubernetes uses the pod template. The link a ReplicaSet has to its pods is via the latter’s metadata.ownerReferences field, which specifies which resource owns the current object. - -_**Services:**_ Services are an abstraction to expose the functionality of a set of pods. With Kubernetes, you don’t need to modify your application to use an unfamiliar service discovery mechanism. Kubernetes gives pods their own IP addresses and a single DNS name for a set of pods, and can load-balance across them. - -One major problem that services solve is the integration of the front-end and back-end of a Web application. Since Kubernetes provides IP addresses behind the scenes to pods, when the latter are killed and resurrected, the IP addresses are changed. This creates a big problem on the front-end side to connect a given back-end IP address to the corresponding front-end IP address. Services solve this problem by providing an abstraction over the pods — something akin to a load balancer. - -_**Volumes:**_ A Kubernetes volume has an explicit lifetime — the same as the pod that encloses it. Consequently, a volume outlives any container that runs within the pod and the data is preserved across container restarts. Of course, when a pod ceases to exist, the volume will cease to exist, too. Perhaps more important than this is that Kubernetes supports many types of volumes, and a pod can use any number of them simultaneously. - -At its core, a volume is just a directory, possibly with some data in it, which is accessible to the containers in a pod. How that directory comes to be, the medium that backs it and its contents are determined by the particular volume type used. - -**Why Kubernetes?** -Containers are a good way to bundle and run applications. In a production environment, you need to manage the containers that run the applications and ensure that there is no downtime. For example, if one container goes down, another needs to start. Wouldn’t it be nice if this could be automated by a system? -That’s where Kubernetes comes to the rescue! It provides a framework to run distributed systems resiliently. It takes care of scaling requirements, failover, deployment patterns, and more. For example, Kubernetes can easily manage a canary deployment for your system. - -Kubernetes provides users with: -1\. Service discovery and load balancing -2\. Storage orchestration -3\. Automated roll-outs and roll-backs -4\. Automatic bin packing -5\. Self-healing -6\. Secret and configuration management - -**What can Kubernetes do?** -In this section we will look at some code examples of how to use Kubernetes when building a Web application from scratch. We will create a simple back-end server using Flask in Python. -There are a few prerequisites for those who want to build a Web app from scratch. These are: -1\. Basic understanding of Docker, Docker containers and Docker images. A quick refresher can be found at __. -2\. Docker should be installed in the system. -3\. Kubernetes should be installed in the system. Instructions on how to do so on a local machine can be found at __. -Now, create a simple directory, as shown in the code snippet below: - -``` -mkdir flask-kubernetes/app && cd flask-kubernetes/app -``` - -Next, inside the _flask-kubernetes/app_ directory, create a file called main.py, as shown in the code snippet below: - -``` -touch main.py -``` - -In the newly created _main.py,_ paste the following code: - -``` -from flask import Flask -app = Flask(__name__) - -@app.route("/") -def hello(): -return "Hello from Kubernetes!" - -if __name__ == "__main__": -app.run(host='0.0.0.0') -``` - -Install Flask in your local using the command below: - -``` -pip install Flask==0.10.1 -``` - -After installing Flask, run the following command: - -``` -python app.py -``` - -This should run the Flask server locally on port 5000, which is the default port for the Flask app, and you can see the output ‘Hello from Kubernetes!’ on *. -Once the server is running locally, we will create a Docker image to be used by Kubernetes. -Create a file with the name Dockerfile and paste the following code snippet in it: - -``` -FROM python:3.7 - -RUN mkdir /app -WORKDIR /app -ADD . /app/ -RUN pip install -r requirements.txt - -EXPOSE 5000 -CMD ["python", "/app/main.py"] -``` - -The instructions in _Dockerfile_ are explained below: - -1\. Docker will fetch the Python 3.7 image from the Docker hub. -2\. It will create an app directory in the image. -3\. It will set an app as the working directory. -4\. Copy the contents from the app directory in the host to the image app directory. -5\. Expose Port 5000. -6\. Finally, it will run the command to start the Flask server. -In the next step, we will create the Docker image, using the command given below: - -``` -docker build -f Dockerfile -t flask-kubernetes:latest . -``` - -After creating the Docker image, we can test it by running it locally using the following command: - -``` -docker run -p 5001:5000 flask-kubernetes -``` - -Once we are done testing it locally by running a container, we need to deploy this in Kubernetes. -We will first verify that Kubernetes is running using the _kubectl_ command. If there are no errors, then it is working. If there are errors, do refer to __. - -Next, let’s create a deployment file. This is a yaml file containing the instruction for Kubernetes about how to create pods and services in a very declarative fashion. Since we have a Flask Web application, we will create a _deployment.yaml_ file with both the pods and services declarations inside it. - -Create a file named deployment.yaml and add the following contents to it, before saving it: - -``` -apiVersion: v1 -kind: Service -metadata: -name: flask-kubernetes -service -spec: -selector: -app: flask-kubernetes -ports: -- protocol: "TCP" -port: 6000 -targetPort: 5000 -type: LoadBalancer - - ---- -apiVersion: apps/v1 -kind: Deployment -metadata: -name: flask-kubernetes -spec: -replicas: 4 -template: -metadata: -labels: -app: flask-kubernetes -spec: -containers: -- name: flask-kubernetes -image: flask-kubernetes:latest -imagePullPolicy: Never -ports: -- containerPort: 5000 -``` - -Use _kubectl_ to send the _yaml_ file to Kubernetes by running the following command: - -``` -kubectl apply -f deployment.yaml -``` - -You can see the pods are running if you execute the following command: - -``` -kubectl get pods -``` - -Now navigate to __, and you should see the ‘Hello from Kubernetes!’ message. -That’s it! The application is now running in Kubernetes! - -**What Kubernetes cannot do** -Kubernetes is not a traditional, all-inclusive PaaS (Platform as a Service) system. Since Kubernetes operates at the container level rather than at the hardware level, it provides some generally applicable features common to PaaS offerings, such as deployment, scaling, load balancing, logging, and monitoring. Kubernetes provides the building blocks for developer platforms, but preserves user choice and flexibility where it is important. - - * Kubernetes does not limit the types of applications supported. If an application can run in a container, it should run great on Kubernetes. - * It does not deploy and build source code. - * It does not dictate logging, monitoring, or alerting solutions. - * It does not provide or mandate a configuration language/system. It provides a declarative API for everyone’s use. - * It does not provide or adopt any comprehensive machine configuration, maintenance, management, or self-healing systems. - - - -![Avatar][3] - -[Abhinav Nath Gupta][4] - -The author is a software development engineer at Cleo Software India Pvt Ltd, Bengaluru. He is interested in cryptography, data security, cryptocurrency and cloud computing. He can be reached at [abhi.aec89@gmail.com][5]. - -[![][6]][7] - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/11/demystifying-kubernetes/ - -作者:[Abhinav Nath Gupta][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensourceforu.com/author/abhinav-gupta/ -[b]: https://github.com/lujun9972 -[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?resize=696%2C457&ssl=1 (Gear kubernetes) -[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?fit=800%2C525&ssl=1 -[3]: https://secure.gravatar.com/avatar/f65917facf5f28936663731fedf545c4?s=100&r=g -[4]: https://opensourceforu.com/author/abhinav-gupta/ -[5]: mailto:abhi.aec89@gmail.com -[6]: http://opensourceforu.com/wp-content/uploads/2013/10/assoc.png -[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US diff --git a/translated/tech/20191107 Demdystifying Kubernetes.md b/translated/tech/20191107 Demdystifying Kubernetes.md new file mode 100644 index 0000000000..396fac1f8e --- /dev/null +++ b/translated/tech/20191107 Demdystifying Kubernetes.md @@ -0,0 +1,231 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Demystifying Kubernetes) +[#]: via: (https://opensourceforu.com/2019/11/demystifying-kubernetes/) +[#]: author: (Abhinav Nath Gupta https://opensourceforu.com/author/abhinav-gupta/) + +揭开 Kubernetes 的神秘面纱 +====== + +[![][1]][2] + +_Kubernetes 是一款生产级的开源系统,用于容器化应用程序的自动部署,扩展和管理。本文关于使用 Kubernetes 来管理容器。_ + + + “容器”已成为最新的流行语之一。 但是,这个词到底意味着什么呢? 说起“容器”,人们通常会把它和 Docker 联系起来,Docker 是一个被定义为软件的标准化单元容器。 该容器将软件和运行软件所需的环境封装到一个易于交付的单元中。 容器是一个软件的标准单元,用它来打包代码及其所有依赖项,这样应用程序就可以从一个计算环境快速可靠地运行到另一个计算环境。 容器通过创建类似于ISO 映像的方式来实现此目的。 容器镜像是一个轻量级的,独立的,可执行的软件包,其中包含运行应用程序所需的所有信息,包括代码,运行时,系统工具,系统库和设置。 + +容器镜像在运行时变成容器,对于Docker 容器,映像在 Docker 引擎上运行时变成容器。 容器将软件与环境隔离开来,确保不同环境下的实例,都可以正常运行。 + +**什么是容器管理?** +容器管理是组织,添加或替换大量软件容器的过程。 容器管理使用软件来自动化创建,部署和扩展容器。 这一过程就需要容器编排。容器编排是一个基于应用程序进行自动部署,管理,扩展,联网的可用容器。 + +**Kubernetes** +Kubernetes 是一个可移植的,可扩展的开源平台,用于管理容器化的工作负载和服务,它有助于配置和自动化。 它最初由 Google 开发, 拥有一个庞大且快速增长的生态系统。 Kubernetes 的服务,技术支持和工具得到广泛应用。 + +Google 在2014年将 Kubernetes 项目开源化。Kubernetes 建立在 Google 十五年大规模运行生产工作负载的经验基础上并结合了社区中最好的想法和实践以及声明式句法的使用。 +下面列出了与Kubernetes生态系统相关的一些常用术语。 + +_**Pods:**_ pod 是 Kubernetes 应用程序的基本执行单元,是你创建或部署的 Kubernetes 对象模型中的最小和最简单的单元。pod 代表在 Kubernetes 集群上运行的进程。 +Pod 将运行中的容器,存储,网络IP(唯一)和控制容器应如何运行的命令封装起来。它代表 Kubernetes 生态系统内的单个部署单元,代表一个应用程序的单个实例,该程序可能包含一个或多个紧密耦合并共享资源的容器。 + +Kubernetes 集群中的Pod有两种主要的使用方式。 第一种是运行单个容器。 即“一个容器一个pod”,这种方式是最常见的。 第二种是运行多个需要一起工作的容器。 +Pod 可能封装一个应用程序,该应用程序由紧密关联且需要共享资源的多个同位容器组成。 + +_**ReplicaSet:**_ ReplicaSet 的目的是维护在任何给定时间运行的一组稳定的副本容器集。 ReplicaSet 包含有关一个特定 Pod 应该运行多少个副本的信息。 为了创建多个Pod 以匹配 ReplicaSet 条件,Kubernetes 使用 Pod 模板。 ReplicaSet 与其 pod 的链接是通过后者的 metas.ownerReferences 字段实现,该字段指定哪个资源拥有当前对象。 + +_**Services:**_ 服务是公开一组 Pod 功能的抽象。 使用 Kubernetes,你无需修改应用程序即可使用陌生的服务发现机制。 Kubernetes 为 Pod 提供了自己的IP地址和一组Pod 的单个DNS 名称,并且可以在它们之间负载平衡。 + +服务解决的一个主要问题是Web应用程序前端和后端的集成。 由于 Kubernetes 将幕后 IP 地址提供给 Pod,因此当 Pod 被杀死并复活时,IP 地址会更改。 这给给定的后端 IP 地址连接到相应的前端 IP 地址带来一个大问题。 服务通过在 Pod 上提供抽象来解决此问题,类似于负载均衡器。 + +_**Volumes:**_ Kubernetes Volumes 具有明确的生命周期-与包围它的 Pod 相同。 因此,Volumes 超过了pod 中运行的任何容器的寿命,并且在容器重新启动后保留了数据。 当然,当 pod 不存在时,该体积也将不再存在。 也许比这更重要的是 Kubernetes 支持多种类型的 Volumes,并且 Pod 可以同时使用任意数量的 Volumes。 + +Volumes 的核心只是一个目录,其中可能包含一些数据,pod 中的容器可以访问该目录。 该目录是如何产生的, 它后端基于什么存储介质,其中的数据内容是什么,这些都由使用的特定 volumes 类型来决定的。 + +**为什么选择 Kubernetes?** +容器是捆绑和运行应用程序的好方法。 在生产环境中,你需要管理运行应用程序的容器,并确保没有停机时间。 例如,如果一个容器发生故障,则需要启动另一个容器。 如果由系统自动实现这一操作,岂不是更好? Kubernetes 就是来解决这个问题的! Kubernetes 提供了一个框架来弹性运行分布式系统。 该框架负责扩展需求,故障转移,部署模式等。 例如,Kubernetes 可以轻松管理系统的 Canary 部署。 + +Kubernetes 为用户提供了: +1\. 服务发现和负载平衡 +2\. 存储编排 +3\. 自动退出和回退 +4\. 自动打包 +5\. 自我修复 +6\. 秘密配置管理 + +**Kubernetes 可以做什么?** + +在本文中,我们将会看到一些从头构建 Web 应用程序时如何使用 Kubernetes 的代码示例。我们将在 Python 中使用 Flask 创建一个简单的后端服务器。 +对于那些想从头开始构建 Web 应用程序的人,有一些前提条件,即: + +1\. 对 Docker,Docker 容器和 Docker 映像的基本了解。可以访问该网站 + __快速了解。 +2\. 系统中应该安装Docker。 +3\. 系统中应该安装Kubernetes,有关如何在本地计算机上安装的说明,请访问网站 __. + +现在,创建一个目录,如下代码片段所示: +``` +mkdir flask-kubernetes/app && cd flask-kubernetes/app +``` + +接下来,在 _flask-kubernetes/app_ 目录中,创建一个名为 main.py 的文件,如下面的代码片段所示: +``` +touch main.py +``` + +在新创建的 _main.py,_ 文件中,粘贴下面代码: + +``` +from flask import Flask +app = Flask(__name__) + +@app.route("/") +def hello(): +return "Hello from Kubernetes!" + +if __name__ == "__main__": +app.run(host='0.0.0.0') +``` + +使用下面命令在本地安装 Flask: + +``` +pip install Flask==0.10.1 +``` + +Flask 安装后,执行下面的命令: +``` +python app.py +``` + + +应该在本地运行Flask服务器,Flask应用程序的默认端口是5000,并且你可以在 * 上看到输出‘Hello from Kubernetes!’。 一旦服务器在本地运行,我们就创建一个供 Kubernetes 使用的 Docker 映像。 创建一个名为 Dockerfile 的文件,并将以下代码片段粘贴到其中: + + +``` +FROM python:3.7 + +RUN mkdir /app +WORKDIR /app +ADD . /app/ +RUN pip install -r requirements.txt + +EXPOSE 5000 +CMD ["python", "/app/main.py"] +``` + +_Dockerfile_文件的说明如下: + +1\. Docker 将从 Docker 集线器获取 Python 3.7 映像。 +2\. 将在映像中创建一个应用程序目录。 +3\. 它将一个应用程序设置为工作目录。 +4\. 将内容从主机中的应用程序目录复制到映像应用程序目录。 +5\. 暴露端口5000。 +6\. 最后,它运行命令,启动 Flask 服务器。 +接下来,我们将使用以下命令创建 Docker 映像: + +``` +docker build -f Dockerfile -t flask-kubernetes:latest . +``` + +创建Docker映像后,我们可以使用以下命令在本地运行该映像进行测试: + +``` +docker run -p 5001:5000 flask-kubernetes +``` + +通过运行容器在本地完成测试之后,我们需要在 Kubernetes 中部署它。 我们将首先使用 kubectl 命令验证 Kubernetes 是否正在运行。 如果没有报错,则说明它正在工作。 如果有报错,请参考该网站信息: __. + +接下来, 我们创建一个部署文件。 这是一个Yaml文件,其中包含有关 Kubernetes 的说明,该说明涉及如何以声明性的方式创建 pod 和服务。 因为我们有 Flask Web 应用程序,我们将在其中包含 pod 和 services 声明的情况下创建一个deployment.yaml文件。 +创建一个名为 deployment.yaml 的文件并向其中添加以下内容,然后保存: + +``` +apiVersion: v1 +kind: Service +metadata: +name: flask-kubernetes -service +spec: +selector: +app: flask-kubernetes +ports: +- protocol: "TCP" +port: 6000 +targetPort: 5000 +type: LoadBalancer + + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: +name: flask-kubernetes +spec: +replicas: 4 +template: +metadata: +labels: +app: flask-kubernetes +spec: +containers: +- name: flask-kubernetes +image: flask-kubernetes:latest +imagePullPolicy: Never +ports: +- containerPort: 5000 +``` + +使用以下命令将 yaml 文件发送到 Kubernete: + +``` +kubectl apply -f deployment.yaml +``` + +如果执行以下命令,你会看到 pods 正在运行: + +``` +kubectl get pods +``` + + +现在,导航至__,你应该会看到‘Hello from Kubernetes!’消息。 成功了! 该应用程序现在正在 Kubernetes 中运行! + +**Kubernetes 做不了什么 ** +Kubernetes 不是一个传统的,包罗万象的 PaaS(平台即服务)系统。 由于 Kubernetes 运行在容器级别而非硬件级别,因此它提供了 PaaS 产品共有的一些普遍适用功能,如部署,扩展,负载平衡,日志记录和监控。 Kubernetes 为开发人员平台提供了构建块,但在重要的地方保留了用户的选择和灵活性。 + + * Kubernetes 不限制所支持的应用程序的类型。 如果应用程序可以在容器中运行,那么它应该可以在 Kubernetes 上更好地运行。 + * 它不部署和构建源代码。 + * 它不决定日志记录,监视或警报解决方案。 + * 它不提供或不要求配置语言/系统。 它提供了一个声明的API供所有人使用。 + * 它不提供或不采用任何全面的机器配置,维护,管理或自我修复系统。 + + +![Avatar][3] + +[Abhinav Nath Gupta][4] + +本文作者 Abhinav 是班加罗尔 Cleo 软件公司的一名软件开发工程师。他对密码学、数据安全、虚拟货币及云计算方面很感兴趣,可以通过 [abhi.aec89@gmail.com][5] 与他联系。. + +[![][6]][7] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/demystifying-kubernetes/ + +作者:[Abhinav Nath Gupta][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/abhinav-gupta/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?resize=696%2C457&ssl=1 (Gear kubernetes) +[2]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gear-kubernetes.jpg?fit=800%2C525&ssl=1 +[3]: https://secure.gravatar.com/avatar/f65917facf5f28936663731fedf545c4?s=100&r=g +[4]: https://opensourceforu.com/author/abhinav-gupta/ +[5]: mailto:abhi.aec89@gmail.com +[6]: http://opensourceforu.com/wp-content/uploads/2013/10/assoc.png +[7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From bf56ba652da8222bb89b8a0060d6655c588cfc4d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 27 Nov 2019 22:17:37 +0800 Subject: [PATCH 654/800] Rename 20191107 Demdystifying Kubernetes.md to 20191107 Demystifying Kubernetes.md --- ...stifying Kubernetes.md => 20191107 Demystifying Kubernetes.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename translated/tech/{20191107 Demdystifying Kubernetes.md => 20191107 Demystifying Kubernetes.md} (100%) diff --git a/translated/tech/20191107 Demdystifying Kubernetes.md b/translated/tech/20191107 Demystifying Kubernetes.md similarity index 100% rename from translated/tech/20191107 Demdystifying Kubernetes.md rename to translated/tech/20191107 Demystifying Kubernetes.md From 531edcf36a4fcb42c9438c95e4456de38290f5a6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 27 Nov 2019 22:31:25 +0800 Subject: [PATCH 655/800] Rename sources/tech/20191125 Fail-free Kubernetes, significant events, and more industry trends.md to sources/news/20191125 Fail-free Kubernetes, significant events, and more industry trends.md --- ...ee Kubernetes, significant events, and more industry trends.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191125 Fail-free Kubernetes, significant events, and more industry trends.md (100%) diff --git a/sources/tech/20191125 Fail-free Kubernetes, significant events, and more industry trends.md b/sources/news/20191125 Fail-free Kubernetes, significant events, and more industry trends.md similarity index 100% rename from sources/tech/20191125 Fail-free Kubernetes, significant events, and more industry trends.md rename to sources/news/20191125 Fail-free Kubernetes, significant events, and more industry trends.md From 4b5bfa5fcf3b54478cc4933b3fa3ccabd5477216 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 27 Nov 2019 22:32:49 +0800 Subject: [PATCH 656/800] translated --- ...20191007 7 Java tips for new developers.md | 222 ------------------ ...20191007 7 Java tips for new developers.md | 221 +++++++++++++++++ 2 files changed, 221 insertions(+), 222 deletions(-) delete mode 100644 sources/tech/20191007 7 Java tips for new developers.md create mode 100644 translated/tech/20191007 7 Java tips for new developers.md diff --git a/sources/tech/20191007 7 Java tips for new developers.md b/sources/tech/20191007 7 Java tips for new developers.md deleted file mode 100644 index 8ad9a70f8a..0000000000 --- a/sources/tech/20191007 7 Java tips for new developers.md +++ /dev/null @@ -1,222 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (7 Java tips for new developers) -[#]: via: (https://opensource.com/article/19/10/java-basics) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -7 Java tips for new developers -====== -If you're just getting started with Java programming, here are seven -basics you need to know. -![Coffee and laptop][1] - -Java is a versatile programming language used, in some way, in nearly every industry that touches a computer. Java's greatest power is that it runs in a Java Virtual Machine (JVM), a layer that translates Java code into bytecode compatible with your operating system. As long as a JVM exists for your operating system, whether that OS is on a server (or [serverless][2], for that matter), desktop, laptop, mobile device, or embedded device, then a Java application can run on it. - -This makes Java a popular language for both programmers and users. Programmers know that they only have to write one version of their software to end up with an application that runs on any platform, and users know that an application will run on their computer regardless of what operating system they use. - -Many languages and frameworks are cross-platform, but none deliver the same level of abstraction. With Java, you target the JVM, not the OS. For programmers, that's the path of least resistance when faced with several programming challenges, but it's only useful if you know how to program Java. If you're just getting started with Java programming, here are seven basic tips you need to know. - -But first, if you're not sure whether you have Java installed, you can find out in a terminal (such as [Bash][3] or [PowerShell][4]) by running: - - -``` -$ java --version -openjdk 12.0.2 2019-07-16 -OpenJDK Runtime Environment 19.3 (build 12.0.2+9) -OpenJDK 64-Bit Server VM 19.3 (build 12.0.2+9, mixed mode, sharing) -``` - -If you get an error or nothing in return, then you should install the [Java Development Kit][5] (JDK) to get started with Java development. Or install a Java Runtime Environment ****(JRE) if you just need to run Java applications. - -### 1\. Java packages - -In Java, related classes are grouped into a _package_. The basic Java libraries you get when you download the JDK are grouped into packages starting with **java** or **javax**. Packages serve a similar function as folders on your computer: they provide structure and definition for related elements (in programming terminology, a _namespace_). Additional packages can be obtained from independent coders, open source projects, and commercial vendors, just as libraries can be obtained for any programming language. - -When you write a Java program, you should declare a package name at the top of your code. If you're just writing a simple application to get started with Java, your package name can be as simple as the name of your project. If you're using a Java integrated development environment (IDE), like [Eclipse][6], it generates a sane package name for you when you start a new project. - - -``` -package helloworld; - -/** - * @author seth - * An application written in Java. - */ -``` - -Otherwise, you can determine the name of your package by looking at its path in relation to the broad definition of your project. For instance, if you're writing a set of classes to assist in game development and the collection is called **jgamer**, then you might have several unique classes within it. - - -``` -package jgamer.avatar; - -/** - * @author seth - * An imaginary game library. - */ -``` - -The top level of your package is **jgamer**, and each package inside it is a descendant, such as **jgamer.avatar** and **jgamer.score** and so on. In your filesystem, the structure reflects this, with **jgamer** being the top directory containing the files **avatar.java** and **score.java**. - -### 2\. Java imports - -The most fun you'll ever have as a polyglot programmer is trying to keep track of whether you **include**, **import**, **use**, **require**, or **some other term** a library in whatever programming language you're writing in. Java, for the record, uses the **import** keyword when importing libraries needed for your code. - - -``` -package helloworld; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; - -/** - * @author seth - * A GUI hello world. - */ -``` - -Imports work based on an environment's Java path. If Java doesn't know where Java libraries are stored on a system, then an import cannot be successful. As long as a library is stored in a system's Java path, then an import can succeed, and a library can be used to build and run a Java application. - -If a library is not expected to be in the Java path (because, for instance, you are writing the library yourself), then the library can be bundled with your application (license permitting) so that the import works as expected. - -### 3\. Java classes - -A Java class is declared with the keywords **public class** along with a unique class name mirroring its file name. For example, in a file **Hello.java** in project **helloworld**: - - -``` -package helloworld; - -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; - -/** - * @author seth - * A GUI hello world. - */ - -public class Hello { -        // this is an empty class -} -``` - -You can declare variables and functions inside a class. In Java, variables within a class are called _fields_. - -### 4\. Java methods - -Java methods are, essentially, functions within an object. They are defined as being **public** (meaning they can be accessed by any other class) or **private** (limiting their use) based on the expected type of returned data, such as **void**, **int**, **float**, and so on. - - -``` -    public void helloPrompt([ActionEvent][7] event) { -        [String][8] salutation = "Hello %s"; -  -        string helloMessage = "World"; -        message = [String][8].format(salutation, helloMessage); -        [JOptionPane][9].showMessageDialog(this, message); -    } -  -    private int someNumber (x) { -        return x*2; -    } -``` - -When calling a method directly, it is referenced by its class and method name. For instance, **Hello.someNumber** refers to the **someNumber** method in the **Hello** class. - -### 5\. Static - -The **static** keyword in Java makes a member in your code accessible independently of the object that contains it. - -In object-oriented programming, you write code that serves as a template for "objects" that get spawned as the application runs. You don't code a specific window, for instance, but an _instance_ of a window based upon a window class in Java (and modified by your code). Since nothing you are coding "exists" until the application generates an instance of it, most methods and variables (and even nested classes) cannot be used until the object they depend upon has been created. - -However, sometimes you need to access or use data in an object before it is created by the application (for example, an application can't generate a red ball without first knowing that the ball is meant to be red). For those cases, there's the **static** keyword. - -### 6\. Try and catch - -Java is excellent at catching errors, but it can only recover gracefully if you tell it what to do. The cascading hierarchy of attempting to perform an action in Java starts with **try**, falls back to **catch**, and ends with **finally**. Should the **try** clause fail, then **catch** is invoked, and in the end, there's always **finally** to perform some sensible action regardless of the results. Here's an example: - - -``` -try { -        cmd = parser.parse(opt, args);  -        -        if(cmd.hasOption("help")) { -                HelpFormatter helper = new HelpFormatter(); -                helper.printHelp("Hello <options>", opt); -                [System][10].exit(0); -                } -        else { -                if(cmd.hasOption("shell") || cmd.hasOption("s")) { -                [String][8] target = cmd.getOptionValue("tgt"); -                } // else -        } // fi -} catch ([ParseException][11] err) { -        [System][10].out.println(err); -        [System][10].exit(1); -        } //catch -        finally { -                new Hello().helloWorld(opt); -        } //finally -} //try -``` - -It's a robust system that attempts to avoid irrecoverable errors or, at least, to provide you with the option to give useful feedback to the user. Use it often, and your users will thank you! - -### 7\. Running a Java application - -Java files, usually ending in **.java**, theoretically can be run with the **java** command. If an application is complex, however, whether running a single file results in anything meaningful is another question. - -To run a **.java** file directly: - - -``` -`$ java ./Hello.java` -``` - -Usually, Java applications are distributed as Java Archives (JAR) files, ending in **.jar**. A JAR file contains a manifest file specifying the main class, some metadata about the project structure, and all the parts of your code required to run the application. - -To run a JAR file, you may be able to double-click its icon (depending on how you have your OS set up), or you can launch it from a terminal: - - -``` -`$ java -jar ./Hello.jar` -``` - -### Java for everyone - -Java is a powerful language, and thanks to the [OpenJDK][12] project and other initiatives, it's an open specification that allows projects like [IcedTea][13], [Dalvik][14], and [Kotlin][15] to thrive. Learning Java is a great way to prepare to work in a wide variety of industries, and what's more, there are plenty of [great reasons to use it][16]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/java-basics - -作者:[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]: https://www.redhat.com/en/resources/building-microservices-eap-7-reference-architecture -[3]: https://www.gnu.org/software/bash/ -[4]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6 -[5]: http://openjdk.java.net/ -[6]: http://www.eclipse.org/ -[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent -[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+joptionpane -[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system -[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+parseexception -[12]: https://openjdk.java.net/ -[13]: https://icedtea.classpath.org/wiki/Main_Page -[14]: https://source.android.com/devices/tech/dalvik/ -[15]: https://kotlinlang.org/ -[16]: https://opensource.com/article/19/9/why-i-use-java diff --git a/translated/tech/20191007 7 Java tips for new developers.md b/translated/tech/20191007 7 Java tips for new developers.md new file mode 100644 index 0000000000..50240fae8d --- /dev/null +++ b/translated/tech/20191007 7 Java tips for new developers.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 Java tips for new developers) +[#]: via: (https://opensource.com/article/19/10/java-basics) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +给新 Java 开发者的 7 点提示 +====== +如果你只是刚刚开始 Java 编程,这里有七个你需要知道的基础知识。 +![Coffee and laptop][1] + +Java 是一个多功能的编程语言,在某种程度上,是一种通用的编程语言,在某种程度上,在几乎所有可能涉及计算机的行业。 Java 的最大优势是,它运行在一个 Java 虚拟机(JVM)中,一个翻译 Java 代码为操作系统兼容的字节码的层。只要有一个 JVM 存在于你的操作系统上,不管这个操作系统是在一个服务器 (或 [无服务器][2], 也是同样的), 桌面电脑,笔记本电脑,移动设备,或嵌入式设备,那么,一个 Java 应用程序可以运行在它上面。 + +这使得 Java 成为程序员和用户中间的一种流行语言。程序员知道,他们只需要写一个软件版本就能最终得到一个在任何平台上运行是应用程序,用户知道,一个应用程序将运行在他们的计算机上运行,而不用管他们使用什么样的操作系统。 + +很多语言和框架是跨平台的,但是没有实现同样的抽象层。使用 Java ,你的目标是 JVM ,而不是操作系统。对于程序员,当面对一些编程难题时,这些是阻力最小的线路,但是它仅在当你知道如何编程 Java 时有用。如果你刚开始 Java 编程,这里有你需要知道是七个基础的提示。 + +但是,首先,如果你不确定是否你安装了 Java ,你可以在一个终端(例如 [Bash][3] 或 [PowerShell][4]) 中找出来,通过运行: + + +``` +$ java --version +openjdk 12.0.2 2019-07-16 +OpenJDK Runtime Environment 19.3 (build 12.0.2+9) +OpenJDK 64-Bit Server VM 19.3 (build 12.0.2+9, mixed mode, sharing) +``` + +如果你获得一个错误,或未返回任何东西,那么你应该安装 [Java Development Kit][5] (JDK) 来开始 Java 开发。或者,安装一个 Java 运行时环境 ****(JRE) ,如果你只需要来运行 Java 应用程序。 + +### 1\. Java 软件包 + +在 Java 语言中,相关的类被分组到一个 _软件包_ 中。当你下载 JDK 时所获得的基本的 Java 库将被分组到以 **java** 或 **javax** 开头的软件包中。软件包提供一种类似于计算机上的文件夹的功能:它们为相关的元素提供结构和定义 (在编程术语中, _命名空间_)。额外的软件包可以从独立的代码,开源项目和商业供应商获得,就想可以为任何编程语言获得库一样。 + +当你写一个 Java 程序时,你应该在你的代码是顶部声明一个软件包。 如果你只是编写一个简单的应用程序来开始 Java ,你的软件包名称可以和你的项目的名称一样简单。如果你正在使用一个 Java 集成开发环境,像 [Eclipse][6] ,当你启动一个新的项目时,它为你生成一个合乎情理的软件包名称。 + + +``` +package helloworld; + +/** + * @author seth + * An application written in Java. + */ +``` + +除此之外,你可以通过查找它的关系到你的项目的广泛定义的路径来查明你的软件包的名称。例如,如果你正在写一组类来帮助游戏开发,并且集合被称为 **jgamer** ,那么你可能在其中有一些唯一的类。 + + +``` +package jgamer.avatar; + +/** + * @author seth + * An imaginary game library. + */ +``` + +你的软件包的顶层是 **jgamer** ,并且在其内部中每个软件包都是一个独立的派生物,例如 **jgamer.avatar** 和 **jgamer.score** 等等。在你的文件系统找那个,该结构反映这一点,**jgamer** 是包含文件 **avatar.java** 和 **score.java** 的顶级目录。 + +### 2\. Java 导入 + +作为一名通晓多种语言的程序员,最大的乐趣是尝试是否跟踪 **include** , **import** , **use** , **require** ,或 **一些其它术语** 。无论你正在使用何种编程语言编写一个库。在 Java 中,对于记录,当导入你的代码的需要的库时,使用 **import** 关键字。 + + +``` +package helloworld; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * @author seth + * A GUI hello world. + */ +``` + +导入工作基于一个环境的 Java 路径。如果 Java 不知道Java 库存储在系统上的何处,那么,导入可能不成功。只要一个库被存储在系统的 Java 路径中,那么导入能够成功,并且库能够被用于构建和运行一个 Java 应用程序。 + +如果不希望一个库在 Java 路径中(因为,例如,你正在写你自己的库),那么库可以与你的应用程序绑定在一起(协议许可),以便导入工作按预期工作。 + +### 3\. Java 类 + +一个 Java 类被使用关键字 **public class** 声明,以及一个唯一的反应它的文件名称的类名称。例如,在项目 **helloworld** 中的一个文件**Hello.java** 中: + + +``` +package helloworld; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.*; + +/** + * @author seth + * A GUI hello world. + */ + +public class Hello { +        // this is an empty class +} +``` + +你可以在一个类内部声明变量和函数。在 Java 中,在一个类中的变量被称为 _终端_ 。 + +### 4\. Java 方法 + +Java 方法本质上是在一个对象中的函数。 基于预期返回的数据类型,它们被定义为 **public** (意味着它们可以被任何其它类访问) 或 **private** (限制它们使用),例入 **void** , **int** , **float** 等等。 + + +``` +    public void helloPrompt([ActionEvent][7] event) { +        [String][8] salutation = "Hello %s"; +  +        string helloMessage = "World"; +        message = [String][8].format(salutation, helloMessage); +        [JOptionPane][9].showMessageDialog(this, message); +    } +  +    private int someNumber (x) { +        return x*2; +    } +``` + +当直接调用一个方法时,它被它的类和方法名称引用。例如, **Hello.someNumber** 指向在 **Hello** 类中的 **someNumber** 方法。 + +### 5\. 静态的 + +在 Java 中的 **static** 关键字使在你的代码中的一个成员独立地访问包含它的对象。 + +在面向对象编程中,在应用程序运行时,你所编写代码将作为所生成“对象”的一个模板。你不需要编写一个明确的窗口,例如,在 Java(和你所修改的代码)中,基于一个窗口类的一个窗口的一个 _实例_ 。因为,你所编码的东西将不“存在”,直到应用程序生成它的一个实例为止,大多数的方法和变量(和甚至嵌套类)将不能被使用,直到它们依赖的对象在被创建为止。 + +然而,有时,在它被通过应用程序创建前,你需要访问或使用在一个对象中的数据。(例如,没有事先知道球是红色时,一个应用程序不能生成一个红色的球)。对于这些情况,这里有 **static** 关键字。 + +### 6\. Try 和 catch + +Java 擅长捕捉错误,但是,你告诉它做什么,它才能优雅地恢复。在 Java 中,以 **try** 开头来尝试级联层次结构执行一个动作,略微退回到 **catch** ,并以 **finally** 结尾。可能 **try** 分句会不执行,那么 **catch** 被引用,在结尾,不管结果如何,总是由 **finally** 来执行一些合理的动作。这里是一个示例: + + +``` +try { +        cmd = parser.parse(opt, args);  +        +        if(cmd.hasOption("help")) { +                HelpFormatter helper = new HelpFormatter(); +                helper.printHelp("Hello <options>", opt); +                [System][10].exit(0); +                } +        else { +                if(cmd.hasOption("shell") || cmd.hasOption("s")) { +                [String][8] target = cmd.getOptionValue("tgt"); +                } // else +        } // fi +} catch ([ParseException][11] err) { +        [System][10].out.println(err); +        [System][10].exit(1); +        } //catch +        finally { +                new Hello().helloWorld(opt); +        } //finally +} //try +``` + +它是一个健壮的系统,它试图避免无法挽回的错误,或者,至少,向你提供给予用户有用的反馈的选项。经常使用它,你的用户将会感谢你! + +### 7\. 运行一个 Java 应用程序 + +Java 文件,通常以 **.java** 结尾,理论上说,可以使用 **java** 命令运行。然而,如果一个应用程序是复杂的,运行一个单个文件是否会造成有意义的事将是另外一个问题。 + +来直接运行一个 **.java** 文件: + + +``` +`$ java ./Hello.java` +``` + +通常,Java 应用程序以 Java 存档 (JAR) 文件的形式分发,以 **.jar** 结尾。一个 JAR 文件包含一个 manifest 文件,指定主类,项目结构的一些元数据,以及运行应用程序所需的你的代码的所有部分。 + +为运行一个 JAR 文件,你可以双击它的图标(取决于你的操作系统设置), 或者,你可以从一个终端中启动它: + + +``` +`$ java -jar ./Hello.jar` +``` + +### 面向所有人的 Java + +Java 是一种强大的的原因,归因于 [OpenJDK][12] 项目和其它的新方案,它是一种开放式规范,允许像 [IcedTea][13], [Dalvik][14],和 [Kotlin][15] 项目的茁壮成长。学习 Java 是一种准备在各种行业中工作的极好的方法,另外,这里有很多[极好的原因来使用它][16]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/java-basics + +作者:[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/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: https://www.redhat.com/en/resources/building-microservices-eap-7-reference-architecture +[3]: https://www.gnu.org/software/bash/ +[4]: https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell?view=powershell-6 +[5]: http://openjdk.java.net/ +[6]: http://www.eclipse.org/ +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+actionevent +[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+joptionpane +[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+parseexception +[12]: https://openjdk.java.net/ +[13]: https://icedtea.classpath.org/wiki/Main_Page +[14]: https://source.android.com/devices/tech/dalvik/ +[15]: https://kotlinlang.org/ +[16]: https://opensource.com/article/19/9/why-i-use-java From 38bb997ab412d6fb90fabe70969916b5a19e0e48 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 27 Nov 2019 22:33:02 +0800 Subject: [PATCH 657/800] Rename sources/tech/20191126 A framework for building products from open source projects.md to sources/talk/20191126 A framework for building products from open source projects.md --- ...A framework for building products from open source projects.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191126 A framework for building products from open source projects.md (100%) diff --git a/sources/tech/20191126 A framework for building products from open source projects.md b/sources/talk/20191126 A framework for building products from open source projects.md similarity index 100% rename from sources/tech/20191126 A framework for building products from open source projects.md rename to sources/talk/20191126 A framework for building products from open source projects.md From 3ee8a215e6c51f35a81727c03a2f2645d993690c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Wed, 27 Nov 2019 22:47:17 +0800 Subject: [PATCH 658/800] translating --- ...all LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md index e3a533b3b2..cc749f3877 100644 --- a/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md +++ b/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f6d5e470efb58f7daee6616d189e4a093b84abd6 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 28 Nov 2019 00:14:32 +0800 Subject: [PATCH 659/800] PRF --- ...hift to Backup and Restore Ubuntu Linux.md | 95 ++++++++++--------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md index cd234c7277..ce852129ea 100644 --- a/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md +++ b/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Use TimeShift to Backup and Restore Ubuntu Linux) @@ -10,11 +10,11 @@ 如何使用 TimeShift 备份和还原 Ubuntu Linux ====== -你是否曾经想过如何备份和还原 **Ubuntu** 或 **Debian** 系统? **Timeshift**是一款免费的开源工具,可让你创建文件系统的增量快照。你也可以使用 **RSYNC** 或 **BTRFS** 创建快照。 +你是否曾经想过如何备份和还原 Ubuntu 或 Debian 系统?Timeshift 是一款自由开源工具,可让你创建文件系统的增量快照。你可以使用 RSYNC 或 BTRFS 两种方式创建快照。 -[![TimeShift-Backup-Restore-Tool-Ubuntu][1]][2] +![](https://img.linux.net.cn/data/attachment/album/201911/27/235959fejmb080e7z0jnu0.jpg) -让我们深入研究并安装 Timeshift。对于本教程,我们将安装在 Ubuntu 18.04 LTS 系统上。 +让我们深入研究并安装 Timeshift。在本教程,我们将安装在 Ubuntu 18.04 LTS 系统上。 ### 在 Ubuntu / Debian Linux 上安装 TimeShift @@ -24,7 +24,7 @@ TimeShift 尚未正式托管在 Ubuntu 和 Debian 仓库中。考虑到这一点 # add-apt-repository -y ppa:teejee2008/ppa ``` -![Add-timeshift-repository][1] +![Add timeshift repository][3] 接下来,使用以下命令更新系统软件包: @@ -32,23 +32,23 @@ TimeShift 尚未正式托管在 Ubuntu 和 Debian 仓库中。考虑到这一点 # apt update ``` -成功更新系统后,使用以下 apt 命令安装 Timeshift: +成功更新系统后,使用以下 `apt` 命令安装 Timeshift: ``` # apt install timeshift ``` -![apt-install-timeshift][1] +![apt install timeshift][4] ### 准备备份存储设备 -最佳实践要求我们将系统快照保存在系统硬盘之外的单独的存储卷上。对于本指南,我们将使用 16GB 闪存作为辅助存储,并在该辅助存储上保存快照。 +最佳实践要求我们将系统快照保存在系统硬盘之外的单独的存储卷上。对于本指南,我们将使用 16GB 闪存作为第二个驱动器,并在该驱动器上保存快照。 ``` # lsblk | grep sdb ``` -![lsblk-sdb-ubuntu][1] +![lsblk sdb ubuntu][5] 为了将闪存用作快照的备份位置,我们需要在设备上创建一个分区表。运行以下命令: @@ -58,77 +58,70 @@ TimeShift 尚未正式托管在 Ubuntu 和 Debian 仓库中。考虑到这一点 # mkfs.ext4 /dev/sdb1 ``` -![create-partition-table-on-drive-ubuntu][1] +![create partition table on drive ubuntu][6] 在 USB 闪存上创建分区表后,我们可以开始创建文件系统的快照! ### 使用 Timeshift 创建快照 -要启动 Timeshift,使用应用程序菜单搜索 Timeshift。 +要启动 Timeshift,使用应用程序菜单搜索 “Timeshift”。 -![Access-Timeshift-Ubuntu][1] +![Access timeshift][7] -单击 Timeshift 图标,系统将提示你输入管理员密码。提供密码,然后单击验证 +单击 Timeshift 图标,系统将提示你输入管理员密码。提供密码,然后单击验证。 -![Authentication-required-ubuntu][1] +![Authentication required][8] 接下来,选择你喜欢的快照类型。 -![Select-Rsync-option-timeshift][1] +![Select rsync option][9] -点击 “**Next**”。选择快照的目标驱动器。在这里,我的位置是标记为 **/dev/sdb** 的外部 USB 驱动器 +点击 “Next”。选择快照的目标驱动器。在这里,我的位置是标记为 `/dev/sdb` 的外部 USB 驱动器。 -![Select-snapshot location][1] +![Select snapshot location][10] 接下来,定义快照级别。级别是指创建快照的时间间隔。你可以选择每月、每周、每天或每小时的快照级别。 -![Select-snapshot-levels-Timeshift][1] +![Select snapshot levels][11] -点击 “Finish” +点击 “Finish”。 -在下一个窗口中,单击 “**Create**” 按钮开始创建快照。此后,系统将开始创建快照。 +在下一个窗口中,单击 “Create” 按钮开始创建快照。此后,系统将开始创建快照。 -![Create-snapshot-timeshift][1] +![Create snapshot][12] 最后,你的快照将显示如下: -![Snapshot-created-TimeShift][1] +![Snapshot created][13] ### 从快照还原 Ubuntu / Debian -创建系统快照后,现在让我们看看如何从同一快照还原系统。在同一个 Timeshift 中,单击快照,然后单击 “**Restore**” 按钮,如图所示。 +创建系统快照后,现在让我们看看如何从同一快照还原系统。在同一个 Timeshift 中,单击快照,然后单击 “Restore” 按钮,如图所示。 -![Restore-snapshot-timeshift][1] +![Restore snapshot][14] -接下来,将提示你选择目标设备。保留默认选择,然后点击 “**Next**”。 +接下来,将提示你选择目标设备。保留默认选择,然后点击 “Next”。 -![Select-target-device-timeshift][1] +![Select target device][15] -恢复过程开始之前,Timeshift 将试运行。 +恢复过程开始之前,Timeshift 将会试运行。 -![Comparing-files-Dry-Run-timeshift][1] +![Comparing files dry run][16] -在下一个窗口中,点击 “**Next**” 按钮确认显示的操作。 +在下一个窗口中,点击 “Next” 按钮确认显示的操作。 -![Confirm-actions-timeshift][1] +![Confirm actions][17] -如图所示,你会看到警告和免责声明。点击 “**Next**” 初始化恢复过程。 +如图所示,你会看到警告和免责声明。点击 “Next” 初始化恢复过程。 此后,将开始还原过程,最后,系统之后将重新启动到快照定义的早期版本。 -![Restoring-snapshot-timeshift][1] +![Restoring snapshot][18] -**总结** +### 总结 如你所见,使用 TimeShift 从快照还原系统非常容易。在备份系统文件时,它非常方便,并允许你在系统故障时进行恢复。因此,不要害怕修改系统或弄乱系统。TimeShift 使你能够返回到一切运行平稳的时间点。 - * [Facebook][3] - * [Twitter][4] - * [LinkedIn][5] - * [Reddit][6] - - - -------------------------------------------------------------------------------- via: https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/ @@ -136,7 +129,7 @@ via: https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/ 作者:[James Kiarie][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/) 荣誉推出 @@ -144,7 +137,19 @@ via: https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/ [b]: https://github.com/lujun9972 [1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 [2]: https://www.linuxtechi.com/wp-content/uploads/2019/11/TimeShift-Backup-Restore-Tool-Ubuntu.png -[3]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&t=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux -[4]: http://twitter.com/share?text=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&via=Linuxtechi -[5]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux -[6]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Ftimeshift-backup-restore-ubuntu-linux%2F&title=How%20to%20Use%20TimeShift%20to%20Backup%20and%20Restore%20Ubuntu%20Linux +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Add-timeshift-repository.png +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/apt-install-timeshift.png +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/lsblk-sdb-ubuntu.png +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/create-partition-table-on-drive-ubuntu.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Access-Timeshift-Ubuntu.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Authentication-required-ubuntu.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Select-Rsync-option-timeshift.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Select-snapshot-location.png +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Select-snapshot-levels-Timeshift.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Create-snapshot-timeshift.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Snapshot-created-TimeShift.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Restore-snapshot-timeshift.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Select-target-device-timeshift.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Comparing-files-Dry-Run-timeshift.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Confirm-actions-timeshift.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Restoring-snapshot-timeshift.png From 55ccc6a9e71adf1fcfeccc3d1da69d808ed779d0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 28 Nov 2019 00:15:52 +0800 Subject: [PATCH 660/800] PUB @geekpi https://linux.cn/article-11619-1.html --- ...How to Use TimeShift to Backup and Restore Ubuntu Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md (98%) diff --git a/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/published/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md similarity index 98% rename from translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md rename to published/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md index ce852129ea..e40aebfa8d 100644 --- a/translated/tech/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md +++ b/published/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11619-1.html) [#]: subject: (How to Use TimeShift to Backup and Restore Ubuntu Linux) [#]: via: (https://www.linuxtechi.com/timeshift-backup-restore-ubuntu-linux/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) From 2604f9f33e454520a158ff902251d92ae2c608f5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 Nov 2019 00:51:55 +0800 Subject: [PATCH 661/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191127=20Create?= =?UTF-8?q?=20virtual=20machines=20with=20Cockpit=20in=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md --- ...virtual machines with Cockpit in Fedora.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md diff --git a/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md b/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md new file mode 100644 index 0000000000..853ad5c501 --- /dev/null +++ b/sources/tech/20191127 Create virtual machines with Cockpit in Fedora.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create virtual machines with Cockpit in Fedora) +[#]: via: (https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/) +[#]: author: (Karlis KavacisPaul W. Frields https://fedoramagazine.org/author/karlisk/https://fedoramagazine.org/author/pfrields/) + +Create virtual machines with Cockpit in Fedora +====== + +![][1] + +This article shows you how to install the software you need to use Cockpit to create and manage virtual machines on Fedora 31. Cockpit is [an interactive admin interface][2] that lets you access and manage systems from any supported web browser. With [virt-manager being deprecated][3] users are encouraged to use Cockpit instead, which is meant to replace it. + +Cockpit is an actively developed project, with many plugins available that extend how it works. For example, one such plugin is “Machines,” which interacts with libvirtd and lets users create and manage virtual machines. + +### Installing software + +The required software prerequisites are _libvirt_, _cockpit_ and _cockpit-machines_. To install them on Fedora 31, run the following command from a terminal [using sudo][4]: + +``` +$ sudo dnf install libvirt cockpit cockpit-machines +``` + +Cockpit is also included as part of the “Headless Management” package group. This group is useful for a Fedora based server that you only access through a network. In that case, to install it, use this command: + +``` +$ sudo dnf groupinstall "Headless Management" +``` + +### Setting up Cockpit services + +After installing the necessary packages it’s time to enable the services. The _libvirtd_ service runs the virtual machines, while Cockpit has a socket activated service to let you access the Web GUI: + +``` +$ sudo systemctl enable libvirtd --now +$ sudo systemctl enable cockpit.socket --now +``` + +This should be enough to run virtual machines and manage them through Cockpit. Optionally, if you want to access and manage your machine from another device on your network, you need to expose the service to the network. To do this, add a new rule in your firewall configuration: + +``` +$ sudo firewall-cmd --zone=public --add-service=cockpit --permanent +$ sudo firewall-cmd --reload +``` + +To confirm the services are running and no issues occurred, check the status of the services: + +``` +$ sudo systemctl status libvirtd +$ sudo systemctl status cockpit.socket +``` + +At this point everything should be working. The Cockpit web GUI should be available at or . Or, enter the local network IP in a web browser on any other device connected to the same network. (Without SSL certificates setup, you may need to allow a connection from your browser.) + +### Creating and installing a machine + +Log into the interface using the user name and password for that system. You can also choose whether to allow your password to be used for administrative tasks in this session. + +Select _Virtual Machines_ and then select _Create VM_ to build a new box. The console gives you several options: + + * Download an OS using Cockpit’s built in library + * Use install media already downloaded on the system you’re managing + * Point to a URL for an OS installation tree + * Boot media over the network via the [PXE][5] protocol + + + +Enter all the necessary parameters. Then select _Create_ to power up the new virtual machine. + +At this point, a graphical console appears. Most modern web browsers let you use your keyboard and mouse to interact with the VM console. Now you can complete your installation and use your new VM, just as you would [via virt-manager in the past][6]. + +* * * + +_Photo by [Miguel Teixeira][7] on [Flickr][8] (CC BY-SA 2.0)._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/create-virtual-machines-with-cockpit-in-fedora/ + +作者:[Karlis KavacisPaul W. Frields][a] +选题:[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/karlisk/https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/create-vm-cockpit-816x345.jpg +[2]: https://cockpit-project.org/ +[3]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/8.0_release_notes/rhel-8_0_0_release#virtualization_4 +[4]: https://fedoramagazine.org/howto-use-sudo/ +[5]: https://en.wikipedia.org/wiki/Preboot_Execution_Environment +[6]: https://fedoramagazine.org/full-virtualization-system-on-fedora-workstation-30/ +[7]: https://flickr.com/photos/miguelteixeira/ +[8]: https://flickr.com/photos/miguelteixeira/2964851828/ From f9d8e085434a280b296e7af7b0a8ce1674140278 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 Nov 2019 00:56:36 +0800 Subject: [PATCH 662/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191128=20Open?= =?UTF-8?q?=20Source=20Music=20Notations=20Software=20MuseScore=203.3=20Re?= =?UTF-8?q?leased!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md --- ...tations Software MuseScore 3.3 Released.md | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 sources/tech/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md diff --git a/sources/tech/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md b/sources/tech/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md new file mode 100644 index 0000000000..2835a5d06a --- /dev/null +++ b/sources/tech/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source Music Notations Software MuseScore 3.3 Released!) +[#]: via: (https://itsfoss.com/musescore/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Open Source Music Notations Software MuseScore 3.3 Released! +====== + +_**Brief: MuseScore is an open-source software to help you create, play, and print sheet music. They released a major update recently. So, we take a look at what MuseScore has to offer**_ _**overall.**_ + +### MuseScore: A Music Composition and Notation Software + +![][1] + +[MuseScore][2] is open-source software that lets you create, play, and print [sheet music][3]. + +You can even use a MIDI keyboard as input and simply play the tune you want to create the notation of. + +In order to make use of it, you need to know how sheet music notations work. In either case, you can just play something using your MIDI keyboard or any other instrument and learn how the music notations work while using it. + +So, it should come in handy for beginners and experts as well. + +You can download and use MuseScore for free. However, if you want to share your music/composition and reach out to a wider community on the MuseScore platform, you can opt to create a free or premium account on [MuseScore.com][4]. + +### Features of MuseScore + +![Musescore 3 Screenshot][5] + +MuseScore includes a lot of things that can be highlighted. If you are someone who is not involved in making music notations for your compositions – you might have to dig deeper just like me. + +Usually, I just head over to any [DAW available on Linux][6] and start playing something to record/loop it without needing to create the music notations. So, for me, MuseScore definitely presents a learning curve with all the features offered. + +I’ll just list out the features with some brief descriptions – so you can explore them if it sounds interesting to you. + + * Supports Input via MIDI keyboard + * You can transfer to/from other programs via [MusicXML][7], MIDI, and other options. + * A Huge collection of palettes (music symbols) to choose from. + * You also get the ability to re-arrange the palettes and create your own list of most-used palettes or edit them. + * Some plugins supported to extend the functionality + * Import PDFs to read and play notations + * Several instruments supported + * Basic or Advanced layout of palettes to get started + + + +Some of the recent key changes include the palettes redesign, accessibility, and the not input workflow. For reference, you can check out how the new palettes work: + +### Installing MuseScore 3.3.3 on Ubuntu/Linux + +The latest version of MuseScore is 3.3.3 with all the bug fixes and improvements to its recent [MuseScore 3.3 release][8]. + +You may find an older release in your Software Center (or your official repo). So, you can either opt for a Flatpak package, Snap, or maybe an AppImage from its [download page][9] with links for different Linux distributions. + +[Download MuseScore][9] + +**Wrapping Up** + +I was quite fascinated to learn about MuseScore being an open-source and free solution to create, play, and print sheet music. + +It may not be the most easy-to-use software there is – but when considering the work with music notations, it will help you learn more about it and help you with your work as well. + +What do you think about MuseScore? Do share your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/musescore/ + +作者:[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/2019/11/musescore-3.jpg?ssl=1 +[2]: https://musescore.org/en +[3]: https://en.wikipedia.org/wiki/Sheet_music +[4]: https://musescore.com/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/musescore-3-screenshot.jpg?ssl=1 +[6]: https://itsfoss.com/best-audio-editors-linux/ +[7]: https://en.wikipedia.org/wiki/MusicXML +[8]: https://musescore.org/en/3.3 +[9]: https://musescore.org/en/download From 81b1bf8914a2a482cc224065d780c30a34d57c79 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 Nov 2019 00:56:54 +0800 Subject: [PATCH 663/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191127=20How=20?= =?UTF-8?q?to=20Manage=20Remote=20Windows=20Host=20using=20Ansible?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191127 How to Manage Remote Windows Host using Ansible.md --- ...anage Remote Windows Host using Ansible.md | 233 ++++++++++++++++++ 1 file changed, 233 insertions(+) create mode 100644 sources/tech/20191127 How to Manage Remote Windows Host using Ansible.md diff --git a/sources/tech/20191127 How to Manage Remote Windows Host using Ansible.md b/sources/tech/20191127 How to Manage Remote Windows Host using Ansible.md new file mode 100644 index 0000000000..fa82225b79 --- /dev/null +++ b/sources/tech/20191127 How to Manage Remote Windows Host using Ansible.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Manage Remote Windows Host using Ansible) +[#]: via: (https://www.linuxtechi.com/manage-windows-host-using-ansible/) +[#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) + +How to Manage Remote Windows Host using Ansible +====== + +**Ansible** is increasingly becoming the go-to platform for application deployment, and software provisioning among developers owing to its ease of use and flexibility. Furthermore, it is easy to set up and no agent is required to be installed on remote nodes, instead, Ansible uses password less SSH authentication to manage remote Unix/Linux hosts. In this topic, however, we are going to see how you can manage Windows Host using Ansible. + +[![Manage-Windows-Hosts-using-Ansible][1]][2] + +**Lab setup** + +We shall use the setup below to accomplish our objective + + * Ansible Control node   –    CentOS 8          –     IP: 192.168.43.13 + * Windows 10 node         –    Windows 10     –     IP: 192.168.43.147 + + + +### Part 1: Installing Ansible on the Control node (CentOS 8) + +Before anything else, we need to get Ansible installed on the Control node which is the CentOS 8 system. + +#### Step 1: Verify that Python3 is installed on Ansible control node + +Firstly, we need to confirm if Python3 is installed. CentOS 8 ships with Python3 but if it’s missing for any reason, install using the command: + +``` +# sudo dnf install python3 +``` + +Next, make Python3 the default Python version by running: + +``` +# sudo alternatives --set python /usr/bin/python3 +``` + +To verify if python3 is installed, run the command: + +``` +# python --version +``` + +**![check-python-version][1] ** + +**Read Also :** **[How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8][3]** + +#### Step 2: Install a virtual environment for running Ansible + +For this exercise, an isolated environment for running and testing Ansible is preferred. This will keep at bay issues such as dependency problems and package conflicts. The isolated environment we are going to create is called a virtual environment. + +Firstly, let’s begin with the installation of the virtual environment on CentOS 8. + +``` +# sudo dnf install python3-virtualenv +``` + +![install-python3-virtualenv][1] + +After the installation of the virtual environment, create a virtual workspace by running: + +``` +# virtualenv env +``` + +![virtualenv-env-ansible][1] + +``` +# source env/bin/activate +``` + +![source-env-bin-activate-ansible][1] + +Great! Observer that the prompt has now changed to (env). + +#### Step 3: Install Ansible + +After the creation of the virtual environment, proceed and install Ansible automation tool using pip as shown: + +``` +# pip install ansible +``` + +![pip-install-Ansible][1] + +You can later confirm the installation of Ansible using the command: + +``` +# ansible --version +``` + +![check-ansible-version][1] + +To test Ansible and see if it’s working on our Ansible Control server run: + +``` +# ansible localhost -m ping +``` + +![Test-ansible-for-connectivity][1] + +Great! Next, we need to define the Windows host or system on a host file on the Ansible control node. Therefore, open the default hosts file + +``` +# vim /etc/ansible/hosts +``` + +Define the Windows hosts as shown below. + +![Ansible-hosts-file][1] + +**Note:** The username and password point to the user on the Windows host system. + +Next, save and exit the configuration file. + +#### Step 4: Install Pywinrm + +Unlike in Unix systems where Ansible uses SSH to communicate with remote hosts, with Windows it’s a different story altogether. To communicate with Windows hosts, you need to install Winrm. + +To install winrm, once again, use pip tool as shown: + +``` +# pip install pywinrm +``` + +![install-pywinrm][1] + +### Part 2: Configuring Windows Host + +In this section, we are going to configure our Windows 10 remote host system to connect with the Ansible Control node. We are going to install the **WinRM listener-** short for **Windows Remote** – which will allow the connection between the Windows host system and the Ansible server. + +But before we do so, your Windows host system needs to fulfill a few requirements for the installation to succeed: + + * Your Windows host system should be **Windows 7 or later**. For Servers, ensure that you are using **Windows Server 2008** and later versions. + * Ensure your system is running **.NET Framework 4.0** and later. + * Windows **PowerShell** should be Version 3.0 & later + + + +With all the requirements met, now follow the steps stipulated below: + +#### Step 1: Download the WinRM script on Windows 10 host + +WinRM can be installed using a script that you can download from this [link][4]. Copy the entire script and paste it onto the notepad editor. Thereafter, ensure you save the WinRM script at the most convenient location. In our case, we have saved the file on the Desktop under the name  ConfigureRemotingForAnsible.ps1 + +#### Step 2: Run the WinRM script on Windows 10 host + +Next, run PowerShell as the Administrator + +![Run-PowerShell-as-Administrator][1] + +Navigate to the script location and run it. In this case, we have navigated to the Desktop location where we saved the script. Next, proceed and execute the WinRM script on the WIndows host: + +``` +.\ConfigureRemotingForAnsible.ps1 +``` + +This takes about a minute and you should get the output shown below. The output shows that WinRM has successfully been installed. + +![set-up-WinRM-on-Windows10][1] + +### Part 3: Connecting to Windows Host from Ansible Control Node + +To test connectivity to the Windows 10 host, run the command: + +``` +# ansible winhost -m win_ping +``` + +![Ansible-ping-windows-host-machine][1] + +The output shows that we have indeed established a connection to the remote Windows 10 host from the Ansible Control node. This implies that we can now manage the remote Windows host using Ansible Playbooks. Let’s create a sample playbook for the Windows host system. + +### Part 4: Creating and running a playbook for Windows 10 host + +In this final section, we shall create a playbook and create a task that will install Chocolatey on the remote host. Chocolatey is a package manager for Windows system. The play is defined as shown: + +``` +# vim chocolatey.yml +--- +- host: winhost + gather_facts: no + tasks: + - name: Install Chocolatey on Windows10 + win_chocolatey: name=procexp status=present +``` + +![Ansible-Playbook-install-chocolatey][1] + +Save and close the yml file. Next, execute the playbook as shown + +``` +# ansible-playbook chocolatey.yml +``` + +![Ansible-playBook-succeeded][1] + +The output is a pointer that all went well. And this concludes this topic on how you can manage Windows host using Ansible. + + * [Facebook][5] + * [Twitter][6] + * [LinkedIn][7] + * [Reddit][8] + + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/manage-windows-host-using-ansible/ + +作者:[James Kiarie][a] +选题:[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/james/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: http://www.linuxtechi.com/wp-content/uploads/2019/11/Manage-Windows-Hosts-using-Ansible.jpg +[3]: http://www.linuxtechi.com/install-ansible-centos-8-rhel-8/ +[4]: https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 +[5]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Fmanage-windows-host-using-ansible%2F&t=How%20to%20Manage%20Remote%20Windows%20Host%20using%20Ansible +[6]: http://twitter.com/share?text=How%20to%20Manage%20Remote%20Windows%20Host%20using%20Ansible&url=https%3A%2F%2Fwww.linuxtechi.com%2Fmanage-windows-host-using-ansible%2F&via=Linuxtechi +[7]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Fmanage-windows-host-using-ansible%2F&title=How%20to%20Manage%20Remote%20Windows%20Host%20using%20Ansible +[8]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Fmanage-windows-host-using-ansible%2F&title=How%20to%20Manage%20Remote%20Windows%20Host%20using%20Ansible From 5f1569cde85870e4255e050ed1b698c9bc09f54b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 Nov 2019 00:57:22 +0800 Subject: [PATCH 664/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191127=20How=20?= =?UTF-8?q?to=20write=20a=20Python=20web=20API=20with=20Flask?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191127 How to write a Python web API with Flask.md --- ...ow to write a Python web API with Flask.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 sources/tech/20191127 How to write a Python web API with Flask.md diff --git a/sources/tech/20191127 How to write a Python web API with Flask.md b/sources/tech/20191127 How to write a Python web API with Flask.md new file mode 100644 index 0000000000..e3d7a7790e --- /dev/null +++ b/sources/tech/20191127 How to write a Python web API with Flask.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a Python web API with Flask) +[#]: via: (https://opensource.com/article/19/11/python-web-api-flask) +[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) + +How to write a Python web API with Flask +====== +Use Flask, one of the fastest-growing Python frameworks, to fetch data +from a server, in this quick tutorial. +![spiderweb diagram][1] + +[Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs. + +[Flask][3] is a customizable Python framework that gives developers complete control over how users access data. Flask is a "micro-framework" based on Werkzeug's [WSGI][4] toolkit and Jinja 2's templating engine. It is designed as a web framework for RESTful API development. + +Flask is one of the fastest-growing Python frameworks, and popular websites, including Netflix, Pinterest, and LinkedIn, have incorporated Flask into their development stacks. Here's an example of how Flask can permit users to fetch data from a server using the HTTP GET method. + +### Set up a Flask application + +First, create a structure for your Flask application. You can do this at any location on your system. + + +``` +$ mkdir tutorial +$ cd tutorial +$ touch main.py +$ python3 -m venv env +$ source env/bin/activate +(env) $ pip3 install flask-restful +Collecting flask-restful +Downloading +Collecting Flask>=0.8 (from flask-restful) +[...] +``` + +### Import the Flask modules + +Next, import the **flask** module and its **flask_restful** library into your **main.py** code: + + +``` +from flask import Flask +from flask_restful import Resource, Api + +app = Flask(__name__) +api = Api(app) + +class Quotes(Resource): +    def get(self): +        return { +            'William Shakespeare': { +                'quote': ['Love all,trust a few,do wrong to none', +                'Some are born great, some achieve greatness, and some greatness thrust upon them.'] +        }, +        'Linus': { +            'quote': ['Talk is cheap. Show me the code.'] +            } +        } + +api.add_resource(Quotes, '/') + +if __name__ == '__main__': +    app.run(debug=True) +``` + +### Run the app + +Flask includes a built-in HTTP server for testing. Test the simple API you built: + + +``` +(env) $ python main.py + * Serving Flask app "main" (lazy loading) + * Environment: production +   WARNING: This is a development server. Do not use it in a production deployment. +   Use a production WSGI server instead. + * Debug mode: on + * Running on (Press CTRL+C to quit) +``` + +Starting the development server starts your Flask application, which contains a method named **get** to respond to a simple HTTP GET request. You can test it using **wget** or **curl** or any web browser. The URL to use is provided in Flask's output after you start the server. + + +``` +$ curl +{ +    "William Shakespeare": { +        "quote": [ +            "Love all,trust a few,do wrong to none", +            "Some are born great, some achieve greatness, and some greatness thrust upon them." +        ] +    }, +    "Linus": { +        "quote": [ +            "Talk is cheap. Show me the code." +        ] +    } +} +``` + +To see a more complex version of a similar web API using Python and Flask, navigate to the Library of Congress' [Chronicling America][5] website, which provides access to information about historic newspapers and digitized newspaper pages. + +### Why use Flask? + +Flask has several major benefits: + + 1. Python is popular and widely used, so anyone who knows Python can develop for Flask. + 2. It's lightweight and minimalistic. + 3. Built with security in mind. + 4. Great documentation with plenty of clear, working example code. + + + +There are also some potential drawbacks: + + 1. It's lightweight and minimalistic. If you're looking for a framework with lots of bundled libraries and prefabricated components, this may not be your best option. + 2. If you have to build your own framework around Flask, you might find that the cost of maintaining your customization negates the benefit of using Flask. + + + +If you're looking to build a web app or API, Flask is a good option to consider. It's powerful and robust, and the project documentation makes it easy to get started. Try it out, evaluate it, and see if it's right for your project. + +Learn more in this lesson in Python exception handling and how to do it in a secure manner. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/python-web-api-flask + +作者:[Rachel Waston][a] +选题:[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/rachelwaston +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-cms-build-howto-tutorial.png?itok=bRbCJt1U (spiderweb diagram) +[2]: https://www.python.org/ +[3]: https://palletsprojects.com/p/flask/ +[4]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface +[5]: https://chroniclingamerica.loc.gov/about/api From e180b2bd143e69c5425f336785357aa174e23ca1 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 Nov 2019 00:57:43 +0800 Subject: [PATCH 665/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191127=20Is=20y?= =?UTF-8?q?our=20code=20inclusive=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191127 Is your code inclusive.md --- .../tech/20191127 Is your code inclusive.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/tech/20191127 Is your code inclusive.md diff --git a/sources/tech/20191127 Is your code inclusive.md b/sources/tech/20191127 Is your code inclusive.md new file mode 100644 index 0000000000..5cb264032b --- /dev/null +++ b/sources/tech/20191127 Is your code inclusive.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Is your code inclusive?) +[#]: via: (https://opensource.com/article/19/11/inclusive-design-code) +[#]: author: (Peter Cheer https://opensource.com/users/petercheer) + +Is your code inclusive? +====== +Learn how developers can support assistive technology projects and +inclusivity. +![plastic game pieces on a board][1] + +I have been involved with assistive technology for about ten years now, beginning with a stint as an assistive technology tutor with the [Kenya Society for the Blind][2]. + +Assistive technology helps improve the lives of people with cognitive, physical or sensory challenges. It comprises a wide range of hardware, specialist software such as screen readers, as well as accessibility features in general software. + +Over the ten years that I have worked with assistive technology, it has vastly improved. This is due in part to the advent of more powerful technologies, as well as better education and stronger disability rights legislation across much of the world. However, progress has been uneven and much of the legislation, well-meaning as it is, is poorly enforced, so there is still work to be done. + +[The Association for the Advancement of Assistive Technology in Europe (AAATE)][3] is an interdisciplinary pan-European association devoted to all aspects of assistive technology, such as use, research, development, manufacture, supply, provision, and policy. Following the AAATE 2019 Conference in Bologna, the association published ["The Bologna Declaration."][4] + +The declaration is a call to action "to improve access to quality assistive technology for realizing fundamental human rights and achieving the sustainable development goals in a fully inclusive manner." + +It includes a list of ten important steps in an agenda for action. These points are not specifically aimed at the open source community; they are intended for policymakers and the whole assistive technology sector. This agenda for action is well thought out and deserves to be widely read across the technology sector. + +### Examples of open source assistive technology + +A look at the projects listed at [Open Assistive][5] offers an idea of the range of open source assistive technology projects that are already out there. A good example of mainstream open source software embracing accessibility is the Mozilla Firefox web browser "reader view" feature, which removes ads, background images, and other clutter for distraction-free viewing. The spoken text option in "reader view" also aids accessibility. This feature has certainly improved my user experience and has the great advantage of being a standard option rather than an add-on. + +Some of the open source assistive tools that I have used with my clients include: + + * [Vinux][6] — a Linux distro that is optimized for users with visual impairments + * [NVDA][7] — a capable screen reader for MS Windows + * [Autohotkey][8] — automates almost anything in MS Windows by sending keystrokes and mouse clicks + * [Mulberry symbol set][9] — Mulberry symbols, or pictograms, are a set of scalable SVG graphic images designed for communications use. They are ideal for software, devices, or any online accessibility use. + + + +There is a huge range of open source assistive technology projects; one large subset that I am interested to explore is the growing list of open source assistive technology hardware projects. If you have a favorite project that you use or contribute to, share it with us in the comments! + +You can support assistive technology by encouraging users to try it, by contributing coding work to assistive technology projects, or by working on documentation and user guides. Even if they’re not working specifically on assistive technology, all developers should keep in mind the need for inclusive design in their projects. If you would like to endorse the Bologna Declaration "to raise awareness so people take action and do everything in their power to actively implementing the points on the agenda," please visit .  + +Assistive technology such as Augmented/Assisted Communication (AAC), Text-to-Speech and Speech-to-... + +Assistive technology software is any program or operating system feature designed to let a user... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/inclusive-design-code + +作者:[Peter Cheer][a] +选题:[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/petercheer +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-game-play-inclusive-diversity-collaboration.png?itok=8sUXV7W1 (plastic game pieces on a board) +[2]: http://www.ksblind.org/ +[3]: https://opensource.com/article/19/11/www.aaate.net +[4]: https://aaate.net/the-bologna-declaration/ +[5]: https://openassistive.org +[6]: https://wiki.vinuxproject.org/ +[7]: https://www.nvaccess.org/ +[8]: https://www.autohotkey.com/ +[9]: https://mulberrysymbols.org/ From e6dccda35465f2d49ac8e8b315f04655eb05f18f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 Nov 2019 00:58:06 +0800 Subject: [PATCH 666/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191127=20Why=20?= =?UTF-8?q?do=20we=20contribute=20to=20open=20source=20software=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191127 Why do we contribute to open source software.md --- ...o we contribute to open source software.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20191127 Why do we contribute to open source software.md diff --git a/sources/tech/20191127 Why do we contribute to open source software.md b/sources/tech/20191127 Why do we contribute to open source software.md new file mode 100644 index 0000000000..3277dcf6f8 --- /dev/null +++ b/sources/tech/20191127 Why do we contribute to open source software.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why do we contribute to open source software?) +[#]: via: (https://opensource.com/article/19/11/why-contribute-open-source-software) +[#]: author: (Gordon Haff https://opensource.com/users/ghaff) + +Why do we contribute to open source software? +====== +Dive into the research supporting the open source ecosystem and +developers’ motivations for participating. +![question mark in chalk][1] + +Organizations as a whole contribute to open source software projects for a variety of reasons. + +One of the most important is that the open source development model is such an effective way to collaborate with other companies on projects of mutual interest. But they also want to better understand the technologies they use. They also want to influence direction. + +The specific rationale will vary by organization but it usually boils down to the simple fact that working in open source benefits their business. + +But why do individuals contribute to open source? They mostly see some kind of personal benefit too, but what specifically motivates them? + +### The types of motivation + +When we talk about motivations, one common way to do so is in terms of incentive theory. This theory began to emerge during the 1940s and 1950s, building on the earlier drive-reduction theories established by psychologists such as Clark Hull and Kenneth Spence. Incentive theory was originally based on the idea that motivation is largely fueled by the prospect of an external reward or incentive. + +Money is a classic extrinsic motivator. So is winning an award, getting a grade, or obtaining a certification that is likely to lead to a better job. + +However, in the 1970s, researchers began to also consider intrinsic motivations, which do not require an apparent reward other than the activity itself. Self-determination theory, developed by Edward Deci and Richard Ryan, would later evolve from studies comparing intrinsic and extrinsic motives, and from a growing understanding of the dominant role intrinsic motivations can play in behavior. + +While intrinsic motivations can come from a number of different sources, the most straightforward one is the simple enjoyment of a particular activity. You play in a softball league after work because you like playing softball. You enjoy the exercise, the camaraderie, the game itself. + +Researchers have also proposed a further distinction between this enjoyment-based intrinsic motivation and obligation/community-based intrinsic motivation, which is more about adherence to social or community norms. Maybe you don’t really like having the relatives over for Thanksgiving but you do it anyway because you know you should. + +Today’s psychology literature also includes the idea of internalized extrinsic motivations. These are extrinsic motivations such as gaining skills to enhance career opportunities—but they’ve been internalized so that the motivation comes from within rather than the desire for whatever carrot is being dangled by someone else. + +### What motivates open source developers? + +In 2012, four researchers at [ETH Zurich][2] surveyed the prior ten years of study into open source software contribution. Among their results, they were able to group study findings into the following three categories: extrinsic motivation, intrinsic motivation, and internalized extrinsic motivation—as well as some common sub-groupings within those broader categories. + +No surprise that money showed up as an extrinsic motivator. During the period studied, there were fewer large projects associated with successful commercially-supported products than is the case today. Even so, most of the open source projects the researchers examined had a significant number of contributors whose companies had paid them to work on open source. + +Career obviously goes hand in hand with pay, but is open source software any different from proprietary software development in this regard? There’s some evidence that it is. + +Lerner and Tirole [first suggested in 2002][3] that "individual developers would be motivated by career concerns when developing open source software. By publishing software that was free for all to inspect, they could signal their talent to potential employers and thus increase their value in the labor market." + +More recently, there’s been significant empirical evidence that there are career advantages to developing code and making it available for others to see and work with. It has become almost an expectation in some industry segments for job applicants to have public GitHub code repositories, which are effectively part of their resume. + +It’s reasonable to ask whether this trend has gone too far. After all, many highly qualified developers work on proprietary code. But it’s clear that, fair or not, at least some career prospects can come specifically from being an open source developer. + +Among intrinsic motivators, ideology and altruism often seem closely related. + +Free software was primarily an ideological statement at first, even if user control also had an important practical side; several researchers have found support for ideological motives in developer surveys. + +Altruism can also be a developer motive, though research on this is mixed. One paper identified the “desire to give a present to the programmer community” as a crucial pattern in open source software. But other studies have qualified the importance of altruism as a motive, especially among programmers getting a paycheck. Other work found that altruism could be a motivator but only among developers who were otherwise satisfied. + +There’s also the motivational power of fun and enjoyment, a classic intrinsic motivator. This should come as no surprise to anyone who hangs around open source developers. Almost all of them like working on open source projects. One large 2007 study determined that fun accounted for 28 percent of the effort (in terms of number of hours) dedicated to projects. One implication of this research is that activities developers typically enjoy less–tech support often tops this list–may require alternative forms of motivation. + +Much of the research into reputation as an internalized extrinsic motivator has focused specifically on peer recognition. Your reputation among your peers can be a source of your own pride, but it also signals your talent to community insiders and potential employers. The suggestion that reputation could be an important motivator in contributing to open source goes back at least as far as 1998, in Eric Raymond’s essay ["Homesteading the Noosphere."][4] However, since then, a variety of surveys have supported the idea that peer reputation is a driver for participation. + +Another motivator in this category is what researchers call "own-use value" but is more recognizably described as something like "scratch your own itch"–develop something that you want for yourself and in the process, create something valuable to others. The initial motivation essentially comes from a selfish need but that can evolve into more of an internalized desire to contribute. + +Its unsurprising research would identify own-use value as a good motivator. Certainly, the folk wisdom is that many developers get into open source by developing something they themselves need—such as when Linus Torvalds wrote Git because Linux needed an appropriate distributed version control system. + +As we’ve seen, contributors to open source software have a variety of different motivations but there are a few general threads worth highlighting in closing. + +Motivators can actually be counterproductive when a single motivator is relied upon too heavily. One study reported that developers scratching their own itch worked "eclectically," fixing bugs that annoyed them and then quitting until the next time. + +In particular, don’t expect non-extrinsic motivators to carry too much of the load. Fun isn’t a good motivator if the task is not actually fun. Altruism motivates some but it also doesn’t pay their bills. + +That said, developers do contribute for reasons that aren’t purely about money or other extrinsic reasons. Learning, peer reputation, and recognition are important to many (and not just in open source development.) Organizations should not neglect the role these can play in motivating developers and should implement incentive programs around them, such as peer reward systems. + +* * * + +This post is based on material from _[How Open Source Ate Software][5]_ (Apress, 2018) by the author. + +There are lots of non-code ways to contribute to open source: Here are three alternatives. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/why-contribute-open-source-software + +作者:[Gordon Haff][a] +选题:[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/ghaff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/question-mark_chalkboard.jpg?itok=DaG4tje9 (question mark in chalk) +[2]: https://pdfs.semanticscholar.org/7712/3726f65f8fd88126357c12cad230cc832f41.pdf +[3]: https://onlinelibrary.wiley.com/doi/abs/10.1111/1467-6451.00174 +[4]: https://pdfs.semanticscholar.org/98a6/c566a7e28a48facb664c8689607a52c57a5d.pdf +[5]: https://www.apress.com/gp/book/9781484238936 From 090f9068c6b3c22b0a733dcd6e16a7b55fac3afe Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 Nov 2019 00:59:38 +0800 Subject: [PATCH 667/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191127=20Nvidia?= =?UTF-8?q?=20quietly=20unveils=20faster,=20lower=20power=20Tesla=20GPU=20?= =?UTF-8?q?accelerator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md --- ...ster, lower power Tesla GPU accelerator.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/talk/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md diff --git a/sources/talk/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/sources/talk/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md new file mode 100644 index 0000000000..5ac59b5cac --- /dev/null +++ b/sources/talk/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Nvidia quietly unveils faster, lower power Tesla GPU accelerator) +[#]: via: (https://www.networkworld.com/article/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Nvidia quietly unveils faster, lower power Tesla GPU accelerator +====== +Nvidia has upgraded its Volta line of Tesla GPU-accelerator cards to work faster using the same power as its old model. +client + +Nvidia was all over Supercomputing 19 last week, not surprisingly, and made a lot of news which we will get into later. But overlooked was perhaps the most interesting news of all: a new generation graphics-acceleration card that is faster and way more power efficient. + +Multiple attendees and news sites spotted it at the show, and Nvidia confirmed to me that this is indeed a new card. Nvidia’s “Volta” generation of Tesla GPU-accelerator cards has been out since 2017, so an upgrade was well overdue. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +The V100S comes only in PCI Express 3 form factor for now but is expected to eventually support Nvidia’s SXM2 interface. SXM is a dual-slot card design by Nvidia that requires no connection to the power supply, unlike the PCIe cards. SXM2 allows the GPU to communicate either with each other or to the CPU through Nvidia’s NVLink, a high-bandwidth, energy-efficient interconnect that can transfer data up to ten times faster than PCIe. + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +With this card, Nvidia is claiming 16.4 single-precision TFLOPS, 8.2 double-precision TFLOPS, and Tensor Core performance of up to 130 TFLOPS. That is only a 4-to-5 percent improvement over the V100 SXM2 design, but 16-to-17 percent faster than the PCIe V100 variant. + +Memory capacity remains at 32GB but Nvidia added High Bandwidth Memory 2 (HBM2) to increase memory performance to 1,134GB/s, a 26 percent improvement over both PCIe and SXM2. + +Now normally a performance boost would see a concurrent increase in power demand, but in this case, the power envelope for the PCIe card is 250 watts, same as the prior generation PCIe card. So this card delivers 16-to-17 percent more compute performance and 26 percent more memory bandwidth at the same power draw. + +**Other News** + +Nvidia made some other news at the conference: + + * A new reference design and ecosystem support for its GPU-accelerated Arm-based reference servers for high-performance computing. The company says it has support from HPE/Cray, Marvell, Fujitsu, and Ampere, the startup led by former Intel executive Renee James looking to build Arm-based server processors. + * These companies will use Nvidia's reference design, which consists of hardware and software components, to build their own GPU-accelerated servers for everything from hyperscale cloud providers to high-performance storage and exascale supercomputing. The design also comes with CUDA-X, a special version of Nvidia’s CUDA GPU development language for Arm processors. + * Launch of Nvidia Magnum IO suite of software designed to help data scientists and AI and high-performance-computing researchers process massive amounts of data in minutes rather than hours. It is optimized to eliminate storage and I/O bottlenecks to deliver up to 20x faster data processing for multi-server, multi-GPU computing nodes. + * Nvidia and DDN, developer of AI and multicloud data management, announced a bundling of DDN’s A3ITM data management system with Nvidia’s DGX SuperPOD systems with so customers can deploy HPC infrastructure with minimal complexity and reduced timelines. The SuperPODs would also come with the new NVIDIA Magnum IO software stack. + * DDN said that SuperPOD was able to be deployed within hours and a single appliance could scale all to 80 nodes.  Benchmarks over a variety of different deep-learning models showed that the DDN system could keep a DGXSuperPOD system fully saturated with data. + + + +**Now see** [**10 of the world's fastest supercomputers**][3] + +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/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.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/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From d87edb8ec017ee3906300a31823e21aceecb6aa3 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 28 Nov 2019 01:00:39 +0800 Subject: [PATCH 668/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191127=20Displa?= =?UTF-8?q?ying=20dates=20and=20times=20your=20way?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191127 Displaying dates and times your way.md --- ...127 Displaying dates and times your way.md | 180 ++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 sources/tech/20191127 Displaying dates and times your way.md diff --git a/sources/tech/20191127 Displaying dates and times your way.md b/sources/tech/20191127 Displaying dates and times your way.md new file mode 100644 index 0000000000..725e94cb0c --- /dev/null +++ b/sources/tech/20191127 Displaying dates and times your way.md @@ -0,0 +1,180 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Displaying dates and times your way) +[#]: via: (https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Displaying dates and times your way +====== +The Linux date command provides more options for displaying dates and times than you can shake a stick at (without hurting your wrist anyway). Here are some of the more useful choices. +Thinkstock / Tomislav Jakupec + +The date command on Linux systems is very straightforward. You type “date” and the date and time are displayed in a useful way. It includes the day-of-the-week, calendar date, time and time zone: + +``` +$ date +Tue 26 Nov 2019 11:45:11 AM EST +``` + +As long as your system is configured properly, you’ll see the date and current time along with your time zone. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +The command, however, also offers a lot of options to display date and time information differently. For example, if you want to display dates in the most useful format for sorting, you might want to use a command like this: + +[][2] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][2] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +``` +$ date "+%Y-%m-%d" +2019-11-26 +``` + +In this case, the year, month and day are arranged in that order. Note that we use a capital Y to get a four-digit year. If we use a lowercase y, we’d see only a two-digit year (e.g., 19). Don’t let this induce you into thinking that if %m gives you a numeric month, **%**M might give you the name of the month. No, **%**M will report on minutes. To get the month in abbreviated name format, you would use **%**b and for a fully spelled out month, you would use **%**B. + +``` +$ date "+%b %B" +Nov November +``` + +Alternately, you might want to display the date in this commonly used format: + +``` +$ date +%D +11/26/19 +``` + +If you need a four-digit year, you can do this: + +``` +$ date "+%x" +11/26/2019 +``` + +Here’s an example that might be useful. Say that you need to create a daily report and have the file name include the date, you could use a command like this to create the file – probably in a script: + +``` +touch Report-`date "+%Y-%m-%d"` +``` + +When you list your reports, they’ll list in date order or reverse date order if you add -r. + +``` +$ ls -r Report* +Report-2019-11-26 +Report-2019-11-25 +Report-2019-11-22 +Report-2019-11-21 +Report-2019-11-20 +``` + +You can add other details to your date strings as well. The variety of options available is surprising. You could show which quarter of the year you’re in by using **date "+%q"** or display the date it was two months ago with a command like this: + +``` +$ date --date="2 months ago" +Thu 26 Sep 2019 09:02:43 AM EDT +``` + +Want to see what next Thursday’s date will be? You can use a command like **date --date="next thu"**, but understand that, for Linux, next Thursday means whatever Thursday follows today. That’s tomorrow if today is Wednesday – not Thursday of next week. However, you can specify Thursday of next week as in the second command below. + +``` +$ date --date="next thu" +Thu 28 Nov 2019 12:00:00 AM EST +$ date --date="next week thu" +Thu 05 Dec 2019 12:00:00 AM EST +``` + +The man page for the date command lists all of its options. The list is fairly mind boggling, but you’ll probably find some date/time display options that work really well for you. Here are some that you might find interesting. + +The date in universal time (UTC): + +``` +$ date -u +Tue 26 Nov 2019 01:13:59 PM UTC +``` + +The number of seconds since Jan 1, 1970 (related to how dates are stored on Linux systems): + +``` +$ date +%s +1574774137 +``` + +Here's a full listing of the date command's options. As I said, it's a lot more extensive than most of us likely imagine. + +``` +%% a literal % +%a locale's abbreviated weekday name (e.g., Sun) +%A locale's full weekday name (e.g., Sunday) +%b locale's abbreviated month name (e.g., Jan) +%B locale's full month name (e.g., January) +%c locale's date and time (e.g., Thu Mar 3 23:05:25 2005) +%C century; like %Y, except omit last two digits (e.g., 20) +%d day of month (e.g., 01) +%D date; same as %m/%d/%y +%e day of month, space padded; same as %_d +%F full date; same as %Y-%m-%d +%g last two digits of year of ISO week number (see %G) +%G year of ISO week number (see %V); normally useful only with %V +%h same as %b +%H hour (00..23) +%I hour (01..12) +%j day of year (001..366) +%k hour, space padded ( 0..23); same as %_H +%l hour, space padded ( 1..12); same as %_I +%m month (01..12) +%M minute (00..59) +%n a newline +%N nanoseconds (000000000..999999999) +%p locale's equivalent of either AM or PM; blank if not known +%P like %p, but lower case +%q quarter of year (1..4) +%r locale's 12-hour clock time (e.g., 11:11:04 PM) +%R 24-hour hour and minute; same as %H:%M +%s seconds since 1970-01-01 00:00:00 UTC +%S second (00..60) +%t a tab +%T time; same as %H:%M:%S +%u day of week (1..7); 1 is Monday +%U week number of year, with Sunday as first day of week (00..53) +%V ISO week number, with Monday as first day of week (01..53) +%w day of week (0..6); 0 is Sunday +%W week number of year, with Monday as first day of week (00..53) +%x locale's date representation (e.g., 12/31/99) +%X locale's time representation (e.g., 23:13:48) +%y last two digits of year (00..99) +%Y year +%z +hhmm numeric time zone (e.g., -0400) +%:z +hh:mm numeric time zone (e.g., -04:00) +%::z +hh:mm:ss numeric time zone (e.g., -04:00:00) +%:::z numeric time zone with : to necessary precision (e.g., -04, +05:30) +%Z alphabetic time zone abbreviation (e.g., EDT) +``` + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-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://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 729ed348caf0bb5421807b576803ff4dd12213b7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 28 Nov 2019 08:55:55 +0800 Subject: [PATCH 669/800] translated --- ...le (Automation Tool) on CentOS 8-RHEL 8.md | 56 ++++++++------- ...all VirtualBox 6.0 on CentOS 8 - RHEL 8.md | 72 +++++++++---------- 2 files changed, 64 insertions(+), 64 deletions(-) rename {sources => translated}/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md (51%) diff --git a/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md index 973fff72c6..44def2d57b 100644 --- a/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md +++ b/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md @@ -7,41 +7,42 @@ [#]: via: (https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) -How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8 +如何在 CentOS 8/RHEL 8 上安装 Ansible(自动化工具) ====== -**Ansible** is an awesome automation tool for Linux sysadmins. It is an open source configuration tool which allows sysadmins to manage hundreds of servers from one centralize node i.e **Ansible Server**. Ansible is the preferred configuration tool when it is compared with similar tools like **Puppet**, **Chef** and **Salt** because it doesn’t need any agent and it works on SSH and python. +**Ansible** 是给 Linux 系统管理员使用的出色自动化工具。它是一种开源配置工具,能让系统管理员可以从一个中心节点(即 **Ansible 服务器**)管理数百台服务器。将 Ansible 与 **Puppet**、**Chef** 和 **Salt**等类似工具进行比较时,它是首选的配置工具,因为它不需要任何代理,并且可以工作在 SSH 和 python 上。 [![Install-Ansible-CentOS8-RHEL8][1]][2] -In this tutorial we will learn how to install and use Ansible on CentOS 8 and RHEL 8 system +在本教程中,我们将学习如何在 CentOS 8 和 RHEL 8 系统上安装和使用 Ansble -Ansible Lab Details: +Ansible 实验环境信息: - * Minimal CentOS 8 / RHEL 8 Server (192.168.1.10) with Internet Connectivity - * Two Ansible Nodes – Ubuntu 18.04 LTS (192.168.1.20) & CentOS 7 (192.168.1.30) + * Minimal CentOS 8 / RHEL 8 服务器(192.168.1.10),且有互联网连接 + * 两个 Ansible 节点 - Ubuntu 18.04 LTS (192.168.1.20) 和 CentOS 7 (192.168.1.30) -### Ansible Installation steps on CentOS 8  +### CentOS 8 上的 Ansible 安装步骤 -Ansible package is not available in default CentOS 8 package repository. so we need to enable [EPEL Repository][3] by executing the following command, + +Ansible 包不在 CentOS 8 默认的软件包仓库中。因此,我们需要执行以下命令启用 [EPEL 仓库][3], ``` [root@linuxtechi ~]$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y ``` -Once the epel repository is enabled, execute the following dnf command to install Ansible +启用 epel 仓库后,执行以下 dnf 命令安装 Ansble。 ``` [root@linuxtechi ~]$ sudo dnf install ansible ``` -Output of above command : +上面命令的输出: ![dnf-install-ansible-centos8][1] -Once the ansible is installed successfully, verify its version by running the following command +成功安装 ansible 后,运行以下命令验证它的版本。 ``` [root@linuxtechi ~]$ sudo ansible --version @@ -49,39 +50,39 @@ Once the ansible is installed successfully, verify its version by running the fo ![Ansible-version-CentOS8][1] -Above output confirms that Installation is completed successfully on CentOS 8. +上面的输出确认在 CentOS 8 上安装完成。 -Let’s move to RHEL 8 system +让我们看下 RHEL 8 系统。 -### Ansible Installation steps on RHEL 8 +### RHEL 8 上的 Ansible 安装步骤 -If you have a valid RHEL 8 subscription then use following subscription-manager command to enable Ansible Repo, +如果你有有效的 RHEL 8 订阅,请使用以下订阅管理器命令启用 Ansble 仓库, ``` [root@linuxtechi ~]$ sudo subscription-manager repos --enable ansible-2.8-for-rhel-8-x86_64-rpms ``` -Once the repo is enabled then execute the following dnf command to install Ansible, +启用仓库后,执行以下 dnf 命令安装 Ansible, ``` [root@linuxtechi ~]$ sudo dnf install ansible -y ``` -Once the ansible and its dependent packages are installed then verify ansible version by executing the following command, +安装 ansible 及其依赖包后,执行以下命令来验证它的版本, ``` [root@linuxtechi ~]$ sudo ansible --version ``` -### Alternate Way to Install Ansible via pip3 on CentOS 8 / RHEL 8 +### 在 CentOS 8 / RHEL 8 上通过 pip3 安装 Ansible 的可选方法 -If you wish to install Ansible using **pip** (**python’s package manager**) then first install pyhton3 and python3-pip packages using following command, +如果你希望使用 **pip**(python 的包管理器)安装 Ansible,请首先使用以下命令安装 pyhton3 和 python3-pip 包, ``` [root@linuxtechi ~]$ sudo dnf install python3 python3-pip -y ``` -After pyhthon3 installation, verify its version by running +安装 python3 后,运行以下命令来验证它的版本。 ``` [root@linuxtechi ~]$ python3 -V @@ -89,23 +90,23 @@ Python 3.6.8 [root@linuxtechi ~]$ ``` -Now run below pip3 command to install Ansible, +命令下面的 pip3 命令安装 Ansible, ``` [root@linuxtechi ~]$ pip3 install ansible --user ``` -Output, +输出, ![Ansible-Install-pip3-centos8][1] -Above output confirms that Ansible has been installed successfully using pip3. Let’s see how we can use Ansible +上面的输出确认 Ansible 已成功使用 pip3 安装。让我们看下如何使用 Ansible。 -### How to Use Ansible Automation Tool? +### 如何使用 Ansible 自动化工具? -When we install Ansible using yum or dnf command then its configuration file, inventory file and roles directory created automatically under /etc/ansible folder. +当我们使用 yum 或 dnf 命令安装 Ansible 时,它的配置文件、清单文件和角色目录会自动在 /etc/ansible 文件夹下创建。 -So, let’s add a group with name “**labservers**” and under this group add ubuntu 18.04 and CentOS 7 System’s ip address in **/etc/ansible/hosts** file +让我们添加一个名称为 “**labservers**” 的组,并在 **/etc/ansible/hosts** 文件中给该组添加 Ubuntu 18.04 和 CentOS 7 的系统 IP 地址。 ``` [root@linuxtechi ~]$ sudo vi /etc/ansible/hosts @@ -116,9 +117,10 @@ So, let’s add a group with name “**labservers**” and under this group add … ``` -Save & exit file. +保存并退出文件。 Once the inventory file (/etc/ansible/hosts) is updated then exchange your user’s ssh public keys with remote systems which are part of “labservers” group. +更新清单文件(/etc/ansible/hosts)后,将用户的 ssh 公钥与作为 “”组一部分的远程系统交换。 Let’s first generate your local user’s public and private key using ssh-keygen command, diff --git a/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md b/translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md similarity index 51% rename from sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md rename to translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md index ffbf7103ee..e1b325f4d4 100644 --- a/sources/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md +++ b/translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md @@ -7,48 +7,48 @@ [#]: via: (https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) -How to Install VirtualBox 6.0 on CentOS 8 / RHEL 8 +如何在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 ====== -**VirtualBox** is a free and open source **virtualization tool** which allows techies to run multiple virtual machines of different flavor at the same time. It is generally used at desktop level (Linux and Windows), it becomes very handy when someone try to explore the features of new Linux distribution or want to install software like **OpenStack**, **Ansible** and **Puppet** in one VM, so in such scenarios one can launch a VM using VirtualBox. +**VirtualBox** 是一款免费的开源**虚拟化工具**,它允许技术人员同时运行多个不同风格的虚拟机。它通常用于运行桌面(Linux 和 Windows),当人们尝试探索新的 Linux 发行版的功能或希望在 VM 中安装 **OpenStack**、**Ansible** 和 **Puppet** 等软件时,它会非常方便,在这种情况下,我们可以使用 VirtualBox 启动 VM。 -VirtualBox is categorized as **type 2 hypervisor** which means it requires an existing operating system, on top of which VirtualBox software will be installed. VirtualBox provides features to create our own custom host only network and NAT network. In this article we will demonstrate how to install latest version of VirtualBox 6.0 on CentOS 8 and RHEL 8 System and will also demonstrate on how to install VirtualBox Extensions. +VirtualBox 被分类为**2 类虚拟机管理程序**,这意味着它需要一个现有的操作系统,在上面安装 VirtualBox 软件。VirtualBox 提供功能来创建本机网络或 NAT 网络。在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 系统上安装最新版本的 VirtualBox 6.0,并演示如何安装 VirtualBox 扩展。 -### Installation steps of VirtualBox 6.0 on CentOS 8 / RHEL 8 +### 在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 的安装步骤 -#### Step:1) Enable VirtualBox and EPEL Repository +#### 步骤 1: 启用 VirtualBox 和 EPEL 仓库 -Login to your CentOS 8 or RHEL 8 system and open terminal and execute the following commands to enable VirtualBox and EPEL package repository. +登录到你的 CentOS 8 或 RHEL 8 系统并打开终端,执行以下命令并启用 VirtualBox 和 EPEL 包仓库。 ``` [root@linuxtechi ~]# dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo ``` -Use below rpm command to import Oracle VirtualBox Public Key +使用以下 rpm 命令导入 Oracle VirtualBox 公钥 ``` [root@linuxtechi ~]# rpm --import https://www.virtualbox.org/download/oracle_vbox.asc ``` -Enable EPEL repo using following dnf command, +使用以下 dnf 命令启用 EPEL 仓库, ``` [root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y ``` -#### Step:2) Install VirtualBox Build tools and dependencies +#### 步骤 2: 安装 VirtualBox 构建工具和依赖项 -Run the following command to install all VirtualBox build tools and dependencies, +运行以下命令来安装所有 VirtualBox 构建工具和依赖项, ``` [root@linuxtechi ~]# dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms -y ``` -Once above dependencies and build tools are installed successfully then proceed with VirtualBox installation using dnf command, +成功安装上面的依赖项和构建工具后,使用 dnf 命令继续安装 VirtualBox, -#### Step:3) Install VirtualBox 6.0 on CentOS 8 / RHEL 8 +#### 步骤 3: 在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 -If wish to list available versions of VirtualBox before installing it , then execute the following [dnf command][1], +如果希望在安装之前列出 VirtualBox 的可用版本,请执行以下 [dnf 命令][1], ``` [root@linuxtechi ~]# dnf search virtualbox @@ -59,72 +59,71 @@ VirtualBox-6.0.x86_64 : Oracle VM VirtualBox [root@linuxtechi ~]# ``` -Let’s install latest version of VirtualBox 6.0 using following dnf command, +让我们使用以下 dnf 命令安装最新版本的 VirtualBox 6.0, ``` [root@linuxtechi ~]# dnf install VirtualBox-6.0 -y ``` -If any local user want to attach usb device to VirtualBox VMs then he/she should be part “**vboxuser**s ” group, use the beneath usermod command to add local user to “vboxusers” group. +如果有本地用户希望将 usb 设备连接到 VirtualBox VM,那么他/她应该是 “**vboxusers**” 组的一员,请使用下面的 usermod 命令将本地用户添加到 “vboxusers” 组。 + ``` [root@linuxtechi ~]# usermod -aG vboxusers pkumar ``` -#### Step:4) Access VirtualBox on CentOS 8 / RHEL 8 +#### 步骤 4: 访问 CentOS 8 / RHEL 8 上的 VirtualBox -There are two ways to access VirtualBox, from the command line type “**virtualbox**” then hit enter +有两种方法可以访问 VirtualBox,在命令行输入 “**virtualbox**” 然后回车: ``` [root@linuxtechi ~]# virtualbox ``` -From Desktop environment, Search “VirtualBox” from Search Dash. +在桌面环境中,在搜索框中搜索 “VirtualBox”。 [![Access-VirtualBox-CentOS8][2]][3] -Click on VirtualBox icon, +单击 VirtualBox 图标, [![VirtualBox-CentOS8][2]][4] -This confirms that VirtualBox 6.0 has been installed successfully, let’s install its extension pack. +这确认 VirtualBox 6.0 已成功安装,让我们安装它的扩展包。 -#### Step:5) Install VirtualBox 6.0 Extension Pack +#### 步骤 5: 安装 VirtualBox 6.0 扩展包 -As the name suggests, VirtualBox extension pack is used to extend the functionality of VirtualBox. It adds the following features: +顾名思义,VirtualBox 扩展包用于扩展 VirtualBox 的功能。它添加了以下功能: - * USB 2.0 & USB 3.0 support - * Virtual RDP (VRDP) - * Disk Image Encryption - * Intel PXE Boot - * Host WebCam + * USB 2.0 和 USB 3.0 支持 + * 虚拟 RDP(VRDP) + * 磁盘镜像加密 + * Intel PXE 启动 + * 主机网络摄像头 -Use below wget command to download virtualbox extension pack under download folder, +使用下面的 wget 命令下载 Virtualbox 扩展包到下载文件夹中, ``` [root@linuxtechi ~]$ cd Downloads/ [root@linuxtechi Downloads]$ wget https://download.virtualbox.org/virtualbox/6.0.14/Oracle_VM_VirtualBox_Extension_Pack-6.0.14.vbox-extpack ``` -Once it is downloaded, access VirtualBox and navigate **File** –>**Preferences** –> **Extension** then click on + icon to add downloaded extension pack, +下载后,打开 VirtualBox 并依次点击 **File** –>**Preferences** –> **Extension**,然后点击 “+” 号图标添加下载的扩展包, [![Install-VirtualBox-Extension-Pack-CentOS8][2]][5] -Click on “Install” to start the installation of extension pack. +单击 “Install” 开始安装扩展包。 [![Accept-VirtualBox-Extension-Pack-License-CentOS8][2]][6] -Click on “I Agree” to accept VirtualBox Extension Pack License. +单击 "I Agree" 接受 VirtualBox 扩展包许可证。 -After successful installation of VirtualBox extension pack, we will get following screen, Click on Ok and start using VirtualBox. +成功安装 VirtualBox 扩展包后,我们将看到下面的页面,单击 OK 并开始使用 VirtualBox。 [![VirtualBox-Extension-Pack-Install-Message-CentOS8][2]][7] -That’s all from this article, I hope these steps help you install VirtualBox 6.0 on your CentOS 8 and RHEL 8 system. Please do share your valuable feedback and comments. - -**Also Read**: **[How to Manage Oracle VirtualBox Virtual Machines from Command Line][8]** +本文就是这些了,我希望这些步骤可以帮助你在 CentOS 8 和 RHEL 8 系统上安装 VirtualBox 6.0。请分享你的宝贵反馈和意见。 * [Facebook][9] * [Twitter][10] @@ -139,7 +138,7 @@ via: https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/ 作者:[Pradeep Kumar][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/) 荣誉推出 @@ -153,7 +152,6 @@ via: https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/ [5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Install-VirtualBox-Extension-Pack-CentOS8.jpg [6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Accept-VirtualBox-Extension-Pack-License-CentOS8.jpg [7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/VirtualBox-Extension-Pack-Install-Message-CentOS8.jpg -[8]: https://www.linuxtechi.com/manage-virtualbox-virtual-machines-command-line/ [9]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&t=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 [10]: http://twitter.com/share?text=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&via=Linuxtechi [11]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-virtualbox-6-centos-8-rhel-8%2F&title=How%20to%20Install%20VirtualBox%206.0%20on%20CentOS%208%20%2F%20RHEL%208 From b741482fe98ab9e553b5985566e3ca562dbb38c3 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 28 Nov 2019 09:26:36 +0800 Subject: [PATCH 670/800] translating --- ... to Find the IP Address of a Domain in the Linux Terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md index e26dd79244..866d5df482 100644 --- a/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md +++ b/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6c0d5f88b869094a892782348e6ac554864bab6c Mon Sep 17 00:00:00 2001 From: lnrCoder Date: Thu, 28 Nov 2019 10:06:07 +0800 Subject: [PATCH 671/800] translating --- .../tech/20191111 A guide to intermediate awk scripting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191111 A guide to intermediate awk scripting.md b/sources/tech/20191111 A guide to intermediate awk scripting.md index 7c1000736c..7e788b2adc 100644 --- a/sources/tech/20191111 A guide to intermediate awk scripting.md +++ b/sources/tech/20191111 A guide to intermediate awk scripting.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lnrCoder) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -129,7 +129,7 @@ via: https://opensource.com/article/19/11/intermediate-awk-scripting 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/lnrCoder) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 49f050c9edbaccb93532ca810fd0c88dc8702abe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Nov 2019 10:20:56 +0800 Subject: [PATCH 672/800] Rename sources/talk/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md to sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md --- ...a quietly unveils faster, lower power Tesla GPU accelerator.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{talk => news}/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md (100%) diff --git a/sources/talk/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md similarity index 100% rename from sources/talk/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md rename to sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md From cac81a6cebe944cd35fa860857806d5f702e1c3a Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 28 Nov 2019 12:04:41 +0800 Subject: [PATCH 673/800] PRF @robsean --- ...20191007 7 Java tips for new developers.md | 156 +++++++++--------- 1 file changed, 75 insertions(+), 81 deletions(-) diff --git a/translated/tech/20191007 7 Java tips for new developers.md b/translated/tech/20191007 7 Java tips for new developers.md index 50240fae8d..8bb1eba7a6 100644 --- a/translated/tech/20191007 7 Java tips for new developers.md +++ b/translated/tech/20191007 7 Java tips for new developers.md @@ -1,25 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (7 Java tips for new developers) [#]: via: (https://opensource.com/article/19/10/java-basics) [#]: author: (Seth Kenlon https://opensource.com/users/seth) -给新 Java 开发者的 7 点提示 +给新手 Java 开发者的 7 点提示 ====== -如果你只是刚刚开始 Java 编程,这里有七个你需要知道的基础知识。 -![Coffee and laptop][1] -Java 是一个多功能的编程语言,在某种程度上,是一种通用的编程语言,在某种程度上,在几乎所有可能涉及计算机的行业。 Java 的最大优势是,它运行在一个 Java 虚拟机(JVM)中,一个翻译 Java 代码为操作系统兼容的字节码的层。只要有一个 JVM 存在于你的操作系统上,不管这个操作系统是在一个服务器 (或 [无服务器][2], 也是同样的), 桌面电脑,笔记本电脑,移动设备,或嵌入式设备,那么,一个 Java 应用程序可以运行在它上面。 +> 如果你才刚开始学习 Java 编程,这里有七个你需要知道的基础知识。 -这使得 Java 成为程序员和用户中间的一种流行语言。程序员知道,他们只需要写一个软件版本就能最终得到一个在任何平台上运行是应用程序,用户知道,一个应用程序将运行在他们的计算机上运行,而不用管他们使用什么样的操作系统。 +![](https://img.linux.net.cn/data/attachment/album/201911/28/120421di3744urqnyyr6xi.jpg) -很多语言和框架是跨平台的,但是没有实现同样的抽象层。使用 Java ,你的目标是 JVM ,而不是操作系统。对于程序员,当面对一些编程难题时,这些是阻力最小的线路,但是它仅在当你知道如何编程 Java 时有用。如果你刚开始 Java 编程,这里有你需要知道是七个基础的提示。 +Java 是一个多功能的编程语言,在某种程度上,它用在几乎所有可能涉及计算机的行业了里。Java 的最大优势是,它运行在一个 Java 虚拟机(JVM)中,这是一个翻译 Java 代码为与操作系统兼容的字节码的层。只要有 JVM 存在于你的操作系统上 —— 不管这个操作系统是在一个服务器(或“[无服务器][2]”,也是同样的)、桌面电脑、笔记本电脑、移动设备,或嵌入式设备 —— 那么,Java 应用程序就可以运行在它上面。 -但是,首先,如果你不确定是否你安装了 Java ,你可以在一个终端(例如 [Bash][3] 或 [PowerShell][4]) 中找出来,通过运行: +这使得 Java 成为程序员和用户的一种流行语言。程序员知道,他们只需要写一个软件版本就能最终得到一个可以运行在任何平台上的应用程序;用户知道,应用程序可以运行在他们的计算机上,而不用管他们使用的是什么样的操作系统。 +很多语言和框架是跨平台的,但是没有实现同样的抽象层。使用 Java,你针对的是 JVM,而不是操作系统。对于程序员,当面对一些编程难题时,这是阻力最小的线路,但是它仅在当你知道如何编程 Java 时有用。如果你刚开始学习 Java 编程,这里有你需要知道的七个基础的提示。 + +但是,首先,如果你不确定是否你安装了 Java ,你可以在一个终端(例如 [Bash][3] 或 [PowerShell][4])中找出来,通过运行: ``` $ java --version @@ -28,14 +29,13 @@ OpenJDK Runtime Environment 19.3 (build 12.0.2+9) OpenJDK 64-Bit Server VM 19.3 (build 12.0.2+9, mixed mode, sharing) ``` -如果你获得一个错误,或未返回任何东西,那么你应该安装 [Java Development Kit][5] (JDK) 来开始 Java 开发。或者,安装一个 Java 运行时环境 ****(JRE) ,如果你只需要来运行 Java 应用程序。 +如果你得到一个错误,或未返回任何东西,那么你应该安装 [Java 开发套件][5](JDK)来开始 Java 开发。或者,安装一个 Java 运行时环境(JRE),如果你只是需要来运行 Java 应用程序。 -### 1\. Java 软件包 +### 1、Java 软件包 -在 Java 语言中,相关的类被分组到一个 _软件包_ 中。当你下载 JDK 时所获得的基本的 Java 库将被分组到以 **java** 或 **javax** 开头的软件包中。软件包提供一种类似于计算机上的文件夹的功能:它们为相关的元素提供结构和定义 (在编程术语中, _命名空间_)。额外的软件包可以从独立的代码,开源项目和商业供应商获得,就想可以为任何编程语言获得库一样。 - -当你写一个 Java 程序时,你应该在你的代码是顶部声明一个软件包。 如果你只是编写一个简单的应用程序来开始 Java ,你的软件包名称可以和你的项目的名称一样简单。如果你正在使用一个 Java 集成开发环境,像 [Eclipse][6] ,当你启动一个新的项目时,它为你生成一个合乎情理的软件包名称。 +在 Java 语言中,相关的类被分组到一个*软件包*中。当你下载 JDK 时所获得的 Java 基础库将被分组到以 `java` 或 `javax` 开头的软件包中。软件包提供一种类似于计算机上的文件夹的功能:它们为相关的元素提供结构和定义(以编程术语说,*命名空间*)。额外的软件包可以从独立开发者、开源项目和商业供应商获得,就像可以为任何编程语言获得库一样。 +当你写一个 Java 程序时,你应该在你的代码是顶部声明一个软件包名称。如果你只是编写一个简单的应用程序来入门 Java,你的软件包名称可以简单地用你的项目名称。如果你正在使用一个 Java 集成开发环境,如 [Eclipse][6],当你启动一个新的项目时,它为你生成一个合乎情理的软件包名称。 ``` package helloworld; @@ -46,8 +46,7 @@ package helloworld;  */ ``` -除此之外,你可以通过查找它的关系到你的项目的广泛定义的路径来查明你的软件包的名称。例如,如果你正在写一组类来帮助游戏开发,并且集合被称为 **jgamer** ,那么你可能在其中有一些唯一的类。 - +除此之外,你可以通过查找它相对于你的项目整体的路径来确定你的软件包名称。例如,如果你正在写一组类来帮助游戏开发,并且该集合被称为 `jgamer`,那么你可能在其中有一些唯一的类。 ``` package jgamer.avatar; @@ -58,12 +57,11 @@ package jgamer.avatar;  */ ``` -你的软件包的顶层是 **jgamer** ,并且在其内部中每个软件包都是一个独立的派生物,例如 **jgamer.avatar** 和 **jgamer.score** 等等。在你的文件系统找那个,该结构反映这一点,**jgamer** 是包含文件 **avatar.java** 和 **score.java** 的顶级目录。 +你的软件包的顶层是 `jgamer`,并且在其内部中每个软件包都是一个独立的派生物,例如 `jgamer.avatar` 和 `jgamer.score` 等等。在你的文件系统里,其目录结构反映了这一点,`jgamer` 是包含文件 `avatar.java` 和 `score.java` 的顶级目录。 -### 2\. Java 导入 - -作为一名通晓多种语言的程序员,最大的乐趣是尝试是否跟踪 **include** , **import** , **use** , **require** ,或 **一些其它术语** 。无论你正在使用何种编程语言编写一个库。在 Java 中,对于记录,当导入你的代码的需要的库时,使用 **import** 关键字。 +### 2、Java 导入 +作为一名通晓多种语言的程序员,最大的乐趣是找出是否用 `include`、`import`、`use`、`require`,或一些其它术语来引入你不管使用何种编程语言编写的库。在 Java 中,顺便说一句,当导入你的代码的需要的库时,使用 `import` 关键字。 ``` package helloworld; @@ -73,19 +71,18 @@ import java.awt.*; import java.awt.event.*; /** - * @author seth - * A GUI hello world. - */ + * @author seth + * A GUI hello world. + */ ``` -导入工作基于一个环境的 Java 路径。如果 Java 不知道Java 库存储在系统上的何处,那么,导入可能不成功。只要一个库被存储在系统的 Java 路径中,那么导入能够成功,并且库能够被用于构建和运行一个 Java 应用程序。 +导入是基于该环境的 Java 路径。如果 Java 不知道 Java 库存储在系统上的何处,那么,就不能成功导入。只要一个库被存储在系统的 Java 路径中,那么导入能够成功,并且库能够被用于构建和运行一个 Java 应用程序。 -如果不希望一个库在 Java 路径中(因为,例如,你正在写你自己的库),那么库可以与你的应用程序绑定在一起(协议许可),以便导入工作按预期工作。 +如果一个库并不在 Java 路径中(因为,例如,你正在写你自己的库),那么该库可以与你的应用程序绑定在一起(协议许可),以便导入可以按预期地工作。 -### 3\. Java 类 - -一个 Java 类被使用关键字 **public class** 声明,以及一个唯一的反应它的文件名称的类名称。例如,在项目 **helloworld** 中的一个文件**Hello.java** 中: +### 3、Java 类 +Java 类使用关键字 `public class` 声明,以及一个唯一的对应于它的文件名的类名。例如,在项目 `helloworld` 中的一个文件 `Hello.java` 中: ``` package helloworld; @@ -104,91 +101,88 @@ public class Hello { } ``` -你可以在一个类内部声明变量和函数。在 Java 中,在一个类中的变量被称为 _终端_ 。 +你可以在一个类内部声明变量和函数。在 Java 中,在一个类中的变量被称为*字段*。 -### 4\. Java 方法 +### 4、Java 方法 -Java 方法本质上是在一个对象中的函数。 基于预期返回的数据类型,它们被定义为 **public** (意味着它们可以被任何其它类访问) 或 **private** (限制它们使用),例入 **void** , **int** , **float** 等等。 +Java 的方法本质上是对象中的函数。基于预期返回的数据类型(例如 `void`、`int`、`float` 等等),它们被定义为 `public`(意味着它们可以被任何其它类访问)或 `private`(限制它们的使用)。 ``` -    public void helloPrompt([ActionEvent][7] event) { -        [String][8] salutation = "Hello %s"; -  -        string helloMessage = "World"; -        message = [String][8].format(salutation, helloMessage); -        [JOptionPane][9].showMessageDialog(this, message); -    } -  -    private int someNumber (x) { -        return x*2; -    } + public void helloPrompt(ActionEvent event) { + String salutation = "Hello %s"; + + string helloMessage = "World"; + message = String.format(salutation, helloMessage); + JOptionPane.showMessageDialog(this, message); + } + + private int someNumber (x) { + return x*2; + } ``` -当直接调用一个方法时,它被它的类和方法名称引用。例如, **Hello.someNumber** 指向在 **Hello** 类中的 **someNumber** 方法。 +当直接调用一个方法时,以其类和方法名称来引用。例如,`Hello.someNumber` 指向在 `Hello` 类中的 `someNumber` 方法。 -### 5\. 静态的 +### 5、static -在 Java 中的 **static** 关键字使在你的代码中的一个成员独立地访问包含它的对象。 +Java 中的 `static` 关键字使代码中的成员可以独立于包含其的对象而被访问。 -在面向对象编程中,在应用程序运行时,你所编写代码将作为所生成“对象”的一个模板。你不需要编写一个明确的窗口,例如,在 Java(和你所修改的代码)中,基于一个窗口类的一个窗口的一个 _实例_ 。因为,你所编码的东西将不“存在”,直到应用程序生成它的一个实例为止,大多数的方法和变量(和甚至嵌套类)将不能被使用,直到它们依赖的对象在被创建为止。 +在面向对象编程中,你编写的代码用作“对象”的模板,这些对象在应用程序运行时产生。例如,你不需要编写一个具体的窗口,而是编写基于 Java 中的窗口类的窗口实例(并由你的代码修改)。由于在应用程序生成它的实例之前,你编写的所有代码都不会“存在”,因此在创建它们所依赖的对象之前,大多数方法和变量(甚至是嵌套类)都无法使用。 -然而,有时,在它被通过应用程序创建前,你需要访问或使用在一个对象中的数据。(例如,没有事先知道球是红色时,一个应用程序不能生成一个红色的球)。对于这些情况,这里有 **static** 关键字。 +然而,有时,在对象被通过应用程序创建前,你需要访问或使用其中的数据。(例如,除非事先知道球是红色时,应用程序无法生成一个红色的球)。对于这些情况,请使用 `static` 关键字。 -### 6\. Try 和 catch - -Java 擅长捕捉错误,但是,你告诉它做什么,它才能优雅地恢复。在 Java 中,以 **try** 开头来尝试级联层次结构执行一个动作,略微退回到 **catch** ,并以 **finally** 结尾。可能 **try** 分句会不执行,那么 **catch** 被引用,在结尾,不管结果如何,总是由 **finally** 来执行一些合理的动作。这里是一个示例: +### 6、try 和 catch +Java 擅长捕捉错误,但是,只有你告诉它遇到错误时该做什么,它才能优雅地恢复。在 Java 中,尝试执行一个动作的级联层次结构以 `try` 开头,出现错误时回落到 `catch`,并以 `finally` 结束。如果 `try` 子句失败,则将调用 `catch`,最后,不管结果如何,总是由 `finally` 来执行一些合理的动作。这里是一个示例: ``` try { -        cmd = parser.parse(opt, args);  -        -        if(cmd.hasOption("help")) { -                HelpFormatter helper = new HelpFormatter(); -                helper.printHelp("Hello <options>", opt); -                [System][10].exit(0); -                } -        else { -                if(cmd.hasOption("shell") || cmd.hasOption("s")) { -                [String][8] target = cmd.getOptionValue("tgt"); -                } // else -        } // fi -} catch ([ParseException][11] err) { -        [System][10].out.println(err); -        [System][10].exit(1); -        } //catch -        finally { -                new Hello().helloWorld(opt); -        } //finally + cmd = parser.parse(opt, args); + + if(cmd.hasOption("help")) { + HelpFormatter helper = new HelpFormatter(); + helper.printHelp("Hello ", opt); + System.exit(0); + } + else { + if(cmd.hasOption("shell") || cmd.hasOption("s")) { + String target = cmd.getOptionValue("tgt"); + } // else + } // fi +} catch (ParseException err) { + System.out.println(err); + System.exit(1); + } //catch + finally { + new Hello().helloWorld(opt); + } //finally } //try ``` -它是一个健壮的系统,它试图避免无法挽回的错误,或者,至少,向你提供给予用户有用的反馈的选项。经常使用它,你的用户将会感谢你! +这是一个健壮的系统,它试图避免无法挽回的错误,或者,至少,为你提供让用户提交有用的反馈的选项。经常使用它,你的用户将会感谢你! -### 7\. 运行一个 Java 应用程序 +### 7、运行 Java 应用程序 -Java 文件,通常以 **.java** 结尾,理论上说,可以使用 **java** 命令运行。然而,如果一个应用程序是复杂的,运行一个单个文件是否会造成有意义的事将是另外一个问题。 - -来直接运行一个 **.java** 文件: +Java 文件,通常以 `.java` 结尾,理论上说,可以使用 `java` 命令运行。然而,如果一个应用程序很复杂,运行一个单个文件是否会产生有意义的结果是另外一个问题。 +来直接运行一个 `.java` 文件: ``` -`$ java ./Hello.java` +$ java ./Hello.java ``` -通常,Java 应用程序以 Java 存档 (JAR) 文件的形式分发,以 **.jar** 结尾。一个 JAR 文件包含一个 manifest 文件,指定主类,项目结构的一些元数据,以及运行应用程序所需的你的代码的所有部分。 - -为运行一个 JAR 文件,你可以双击它的图标(取决于你的操作系统设置), 或者,你可以从一个终端中启动它: +通常,Java 应用程序以 Java 存档(JAR)文件的形式分发,以 `.jar` 结尾。一个 JAR 文件包含一个清单文件(可以指定主类、项目结构的一些元数据),以及运行应用程序所需的所有代码部分。 +要运行一个 JAR 文件,你可以双击它的图标(取决于你的操作系统设置),你也可以从终端中启动它: ``` -`$ java -jar ./Hello.jar` +$ java -jar ./Hello.jar ``` -### 面向所有人的 Java +### 适合所有人的 Java -Java 是一种强大的的原因,归因于 [OpenJDK][12] 项目和其它的新方案,它是一种开放式规范,允许像 [IcedTea][13], [Dalvik][14],和 [Kotlin][15] 项目的茁壮成长。学习 Java 是一种准备在各种行业中工作的极好的方法,另外,这里有很多[极好的原因来使用它][16]。 +Java 是一种强大的语言,由于有了 [OpenJDK][12] 项目及其它的努力,它是一种开放式规范,允许像 [IcedTea][13]、[Dalvik][14] 和 [Kotlin][15] 项目的茁壮成长。学习 Java 是一种准备在各种行业中工作的好方法,而且,[使用 Java 的理由很多][16]。 -------------------------------------------------------------------------------- @@ -197,7 +191,7 @@ via: https://opensource.com/article/19/10/java-basics 作者:[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 abbdb448b808a14647d4c6ddf5977151e4d1e768 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 28 Nov 2019 12:05:31 +0800 Subject: [PATCH 674/800] PUB @robsean https://linux.cn/article-11620-1.html --- .../20191007 7 Java tips for new developers.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191007 7 Java tips for new developers.md (99%) diff --git a/translated/tech/20191007 7 Java tips for new developers.md b/published/20191007 7 Java tips for new developers.md similarity index 99% rename from translated/tech/20191007 7 Java tips for new developers.md rename to published/20191007 7 Java tips for new developers.md index 8bb1eba7a6..c2c90f8679 100644 --- a/translated/tech/20191007 7 Java tips for new developers.md +++ b/published/20191007 7 Java tips for new developers.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11620-1.html) [#]: subject: (7 Java tips for new developers) [#]: via: (https://opensource.com/article/19/10/java-basics) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From acfaccb0e439f774efb31138e9f72977cdb664d8 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Nov 2019 12:20:15 +0800 Subject: [PATCH 675/800] Rename sources/tech/20191127 Why do we contribute to open source software.md to sources/talk/20191127 Why do we contribute to open source software.md --- .../20191127 Why do we contribute to open source software.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191127 Why do we contribute to open source software.md (100%) diff --git a/sources/tech/20191127 Why do we contribute to open source software.md b/sources/talk/20191127 Why do we contribute to open source software.md similarity index 100% rename from sources/tech/20191127 Why do we contribute to open source software.md rename to sources/talk/20191127 Why do we contribute to open source software.md From ac81ac194eaf1f3d55f59055f1c1bf6a707729cc Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Nov 2019 12:41:08 +0800 Subject: [PATCH 676/800] Rename sources/tech/20191127 Is your code inclusive.md to sources/talk/20191127 Is your code inclusive.md --- sources/{tech => talk}/20191127 Is your code inclusive.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191127 Is your code inclusive.md (100%) diff --git a/sources/tech/20191127 Is your code inclusive.md b/sources/talk/20191127 Is your code inclusive.md similarity index 100% rename from sources/tech/20191127 Is your code inclusive.md rename to sources/talk/20191127 Is your code inclusive.md From 78cca8218dc330e9882a0839994689bf17ff3c9f Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 28 Nov 2019 12:44:14 +0800 Subject: [PATCH 677/800] Rename sources/tech/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md to sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md --- ...Open Source Music Notations Software MuseScore 3.3 Released.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => news}/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md (100%) diff --git a/sources/tech/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md b/sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md similarity index 100% rename from sources/tech/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md rename to sources/news/20191128 Open Source Music Notations Software MuseScore 3.3 Released.md From afef7e62cd5fc6851502011535f7237b0806919a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 28 Nov 2019 19:19:50 +0800 Subject: [PATCH 678/800] Translated --- ...ginx, MariaDB, PHP) on Fedora 30 Server.md | 200 ------------------ ...ginx, MariaDB, PHP) on Fedora 30 Server.md | 200 ++++++++++++++++++ 2 files changed, 200 insertions(+), 200 deletions(-) delete mode 100644 sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md create mode 100644 translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md diff --git a/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md deleted file mode 100644 index cc749f3877..0000000000 --- a/sources/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md +++ /dev/null @@ -1,200 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server) -[#]: via: (https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/) -[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) - -How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server -====== - -In this article, we’ll be looking at how to install **LEMP** stack on Fedora 30 Server. LEMP Stands for: - - * L -> Linux - * E -> Nginx - * M -> Maria DB - * P -> PHP - - - -I am assuming **[Fedora 30][1]** is already installed on your system. - -![LEMP-Stack-Fedora30][2] - -LEMP is a collection of powerful software setup that is installed on a Linux server to help in developing popular development platforms to build websites, LEMP is a variation of LAMP wherein instead of **Apache** , **EngineX (Nginx)** is used as well as **MariaDB** used in place of **MySQL**. This how-to guide is a collection of separate guides to install Nginx, Maria DB and PHP. - -### Install Nginx, PHP 7.3 and PHP-FPM on Fedora 30 Server - -Let’s take a look at how to install Nginx and PHP along with PHP FPM on Fedora 30 Server. - -### Step 1) Switch to root user - -First step in installing Nginx in your system is to switch to root user. Use the following command : - -``` -root@linuxtechi ~]$ sudo -i -[sudo] password for pkumar: -[root@linuxtechi ~]# -``` - -### Step 2) Install Nginx, PHP 7.3 and PHP FPM using dnf command - -Install Nginx using the following dnf command: - -``` -[root@linuxtechi ~]# dnf install nginx php php-fpm php-common -y -``` - -### Step 3) Install Additional PHP modules - -The default installation of PHP only comes with the basic and the most needed modules installed. If you need additional modules like GD, XML support for PHP, command line interface Zend OPCache features etc, you can always choose your packages and install everything in one go. See the sample command below: - -``` -[root@linuxtechi ~]# sudo dnf install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y -``` - -### Step 4) Start & Enable Nginx and PHP-fpm Service - -Start and enable Nginx service using the following command - -``` -[root@linuxtechi ~]# systemctl start nginx && systemctl enable nginx -Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service. -[root@linuxtechi ~]# -``` - -Use the following command to start and enable PHP-FPM service - -``` -[root@linuxtechi ~]# systemctl start php-fpm && systemctl enable php-fpm -Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service. -[root@linuxtechi ~]# -``` - -**Verify Nginx (Web Server) and PHP installation,** - -**Note:** In case OS firewall is enabled and running on your Fedora 30 system, then allow 80 and 443 ports using beneath commands, - -``` -[root@linuxtechi ~]# firewall-cmd --permanent --add-service=http -success -[root@linuxtechi ~]# -[root@linuxtechi ~]# firewall-cmd --permanent --add-service=https -success -[root@linuxtechi ~]# firewall-cmd --reload -success -[root@linuxtechi ~]# -``` - -Open the web browser, type the following URL: http:// - -[![Test-Page-HTTP-Server-Fedora-30][3]][4] - -Above screen confirms that NGINX is installed successfully. - -Now let’s verify PHP installation, create a test php page(info.php) using the beneath command, - -``` -[root@linuxtechi ~]# echo "" > /usr/share/nginx/html/info.php -[root@linuxtechi ~]# -``` - -Type the following URL in the web browser, - -http:///info.php - -[![Php-info-page-fedora30][5]][6] - -Above page confirms that PHP 7.3.5 has been installed successfully. Now let’s install MariaDB database server. - -### Install MariaDB on Fedora 30 - -MariaDB is a great replacement for MySQL DB as it is works much similar to MySQL and also compatible with MySQL steps too. Let’s look at the steps to install MariaDB on Fedora 30 Server - -### Step 1) Switch to Root User - -First step in installing MariaDB in your system is to switch to root user or you can use a local user who has root privilege. Use the following command below: - -``` -[root@linuxtechi ~]# sudo -i -[root@linuxtechi ~]# -``` - -### Step 2) Install latest version of MariaDB (10.3) using dnf command - -Use the following command to install MariaDB on Fedora 30 Server - -``` -[root@linuxtechi ~]# dnf install mariadb-server -y -``` - -### Step 3) Start and enable MariaDB Service - -Once the mariadb is installed successfully in step 2), next step is to start the MariaDB service. Use the following command: - -``` -[root@linuxtechi ~]# systemctl start mariadb.service ; systemctl enable mariadb.service -``` - -### Step 4) Secure MariaDB Installation - -When we install MariaDB server, so by default there is no root password, also anonymous users are created in database. So, to secure MariaDB installation, run the beneath “mysql_secure_installation” command - -``` -[root@linuxtechi ~]# mysql_secure_installation -``` - -Next you will be prompted with some question, just answer the questions as shown below: - -![Secure-MariaDB-Installation-Part1][7] - -![Secure-MariaDB-Installation-Part2][8] - -### Step 5) Test MariaDB Installation - -Once you have installed, you can always test if MariaDB is successfully installed on the server. Use the following command: - -``` -[root@linuxtechi ~]# mysql -u root -p -Enter password: -``` - -Next you will be prompted for a password. Enter the password same password that you have set during MariaDB secure installation, then you can see the MariaDB welcome screen. - -``` -Welcome to the MariaDB monitor. Commands end with ; or \g. -Your MariaDB connection id is 17 -Server version: 10.3.12-MariaDB MariaDB Server - -Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. - -Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. - -MariaDB [(none)]> -``` - -And finally, we’ve completed everything to install LEMP (Linux, Nginx, MariaDB and PHP) on your server successfully. Please post all your comments and suggestions in the feedback section below and we’ll respond back at the earliest. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/ - -作者:[Pradeep Kumar][a] -选题:[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/pradeep/ -[b]: https://github.com/lujun9972 -[1]: https://www.linuxtechi.com/fedora-30-workstation-installation-guide/ -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/06/LEMP-Stack-Fedora30.jpg -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Test-Page-HTTP-Server-Fedora-30-1024x732.jpg -[4]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Test-Page-HTTP-Server-Fedora-30.jpg -[5]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Php-info-page-fedora30-1024x732.jpg -[6]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Php-info-page-fedora30.jpg -[7]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Secure-MariaDB-Installation-Part1.jpg -[8]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Secure-MariaDB-Installation-Part2.jpg diff --git a/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md new file mode 100644 index 0000000000..37a5ad1488 --- /dev/null +++ b/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server) +[#]: via: (https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 Fedora 30 Server 上安装 LEMP (Linux, Nginx, MariaDB, PHP) +====== + +在这篇文章中,我们将看看如何在 Fedora 30 Server 上安装 **LEMP** 。LEMP 代表: + + * L -> Linux + * E -> Nginx + * M -> Maria DB + * P -> PHP + + + +我假设 **[Fedora 30][1]** 已经安装在你的电脑系统上。 + +![LEMP-Stack-Fedora30][2] + +LEMP 是一组强大的软件设置集合,它安装在一个 Linux 服务器上以帮助使用流行的开发平台来构建网站,LEMP 是 LAMP 的一个变种,在其中不是 **Apache** ,而是使用 **EngineX (Nginx)** , 此外,使用 **MariaDB** 代替 **MySQL** 。这篇入门指南是一个安装 Nginx, Maria DB 和 PHP 的独立指南的作品集合。 + +### 在 Fedora 30 Server 上安装 Nginx ,PHP 7.3 和 PHP-FPM + +让我们看看如何在 Fedora 30 Server 上安装 Nginx 和 PHP 以及 PHP FPM 。 + +### 步骤 1) 切换到 root 用户 + +在系统上安装 Nginx 的第一步是切换到 root 用户。使用下面的命令: + +``` +root@linuxtechi ~]$ sudo -i +[sudo] password for pkumar: +[root@linuxtechi ~]# +``` + +### 步骤 2) 使用 dnf 命令安装 Nginx ,PHP 7.3 和 PHP FPM + +使用下面的 dnf 命令安装 Nginx : + +``` +[root@linuxtechi ~]# dnf install nginx php php-fpm php-common -y +``` + +### 步骤 3) 安装额外的 PHP 模块 + +PHP 的默认安装仅自带基本模块和最需要的模块,如果你需要额外的模块,像 PHP 支持的 GD ,XML ,命令行接口 Zend OPCache 功能等等,你总是能够选择你的软件包,并一次性安装所有的东西。查看下面的示例命令: + +``` +[root@linuxtechi ~]# sudo dnf install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y +``` + +### 步骤 4) 开始 & 启用 Nginx 和 PHP-fpm 服务 + +使用下面的命令来开始并启用 Nginx 服务 + +``` +[root@linuxtechi ~]# systemctl start nginx && systemctl enable nginx +Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /usr/lib/systemd/system/nginx.service. +[root@linuxtechi ~]# +``` + +使用下面的命令来开始并启用 PHP-FPM 服务 + +``` +[root@linuxtechi ~]# systemctl start php-fpm && systemctl enable php-fpm +Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /usr/lib/systemd/system/php-fpm.service. +[root@linuxtechi ~]# +``` + +**核实 Nginx (Web 服务) 和 PHP 安装,** + +**注意:** 假使操作系统防火墙是启用的,并运行在你的 Fedora 30 系统上,那么使用下面的命令来准许 80 和 443 端口, + +``` +[root@linuxtechi ~]# firewall-cmd --permanent --add-service=http +success +[root@linuxtechi ~]# +[root@linuxtechi ~]# firewall-cmd --permanent --add-service=https +success +[root@linuxtechi ~]# firewall-cmd --reload +success +[root@linuxtechi ~]# +``` + +打开网页浏览器,输入下面的 URL: http:// + +[![Test-Page-HTTP-Server-Fedora-30][3]][4] + +上面的屏幕证实 NGINX 已经成功地安装。 + +现在,让我们核实 PHP 安装,使用下面的命令创建一个测试 php 页(info.php), + +``` +[root@linuxtechi ~]# echo "" > /usr/share/nginx/html/info.php +[root@linuxtechi ~]# +``` + +在网页浏览器中输入下面的 URL , + +http:///info.php + +[![Php-info-page-fedora30][5]][6] + +上面的页面验证 PHP 7.3.5 已经被成功地安装。现在,让我们安装 MariaDB 数据库服务器。 + +### 在 Fedora 30 上安装 MariaDB + +MariaDB 是 MySQL 数据库的一个极好的替代品,因为它的工作方式与 MySQL 非常类似,并且兼容性也与 MySQL 一致。让我们看看在 Fedora 30 Server 上安装 MariaDB 的步骤。 + +### 步骤 1) 切换到 root 用户 + +在系统上安装 MariaDB 的第一步是切换到 root 用户,或者你可以使用有 root 权限的本地用户。使用下面的命令: + +``` +[root@linuxtechi ~]# sudo -i +[root@linuxtechi ~]# +``` + +### 步骤 2) 使用 dnf 命令安装 MariaDB (10.3) 的最新版本 + +在 Fedora 30 Server 上使用下面的命令来安装 MariaDB + +``` +[root@linuxtechi ~]# dnf install mariadb-server -y +``` + +### 步骤 3) 开启并启用 MariaDB 服务 + +在步骤2中成功地安装 mariadb 后,接下来的步骤是开启 MariaDB 服务。使用下面的命令: + +``` +[root@linuxtechi ~]# systemctl start mariadb.service ; systemctl enable mariadb.service +``` + +### 步骤 4) 保护 MariaDB 安装 + +当我们安装 MariaDB 服务器时,因为默认情况下没有 root密码,在数据库中也创建匿名用户。因此,来保护 MariaDB 安装,运行下面的 “mysql_secure_installation” 命令 + +``` +[root@linuxtechi ~]# mysql_secure_installation +``` + +接下来你将被提示一些问题,仅回答下面展示的问题: + +![Secure-MariaDB-Installation-Part1][7] + +![Secure-MariaDB-Installation-Part2][8] + +### 步骤 5) 测试 MariaDB 安装 + +在你安装后,你总是能够测试是否 MariaDB 被成功地安装在 Fedora 30 Server 上。使用下面的命令: + +``` +[root@linuxtechi ~]# mysql -u root -p +Enter password: +``` + +接下来,你将被提示一个密码。输入在 MariaDB 保护安装期间你设置的密码,接下来你可以看到 MariaDB 欢迎屏幕。 + +``` +Welcome to the MariaDB monitor. Commands end with ; or \g. +Your MariaDB connection id is 17 +Server version: 10.3.12-MariaDB MariaDB Server + +Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +MariaDB [(none)]> +``` + +最后,我们已经在你的 Fedora 30 Server 上成功地完成安装 LEMP (Linux, Nginx, MariaDB and PHP) 的所有工作。请在下面的反馈部分发布你的评论和建议,我们将尽快在后面回应。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/ + +作者:[Pradeep Kumar][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://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/fedora-30-workstation-installation-guide/ +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/06/LEMP-Stack-Fedora30.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Test-Page-HTTP-Server-Fedora-30-1024x732.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Test-Page-HTTP-Server-Fedora-30.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Php-info-page-fedora30-1024x732.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Php-info-page-fedora30.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Secure-MariaDB-Installation-Part1.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/06/Secure-MariaDB-Installation-Part2.jpg From 08e3366887db03b0ff60870e55540d6389272ee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Thu, 28 Nov 2019 19:28:10 +0800 Subject: [PATCH 679/800] translating --- sources/tech/20191113 Edit images on Fedora easily with GIMP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191113 Edit images on Fedora easily with GIMP.md b/sources/tech/20191113 Edit images on Fedora easily with GIMP.md index c45813d7cb..f77cbc693b 100644 --- a/sources/tech/20191113 Edit images on Fedora easily with GIMP.md +++ b/sources/tech/20191113 Edit images on Fedora easily with GIMP.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From ea467621f365f5089326732b83a77b6649854ec5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 28 Nov 2019 21:40:28 +0800 Subject: [PATCH 680/800] APL --- sources/tech/20191127 Displaying dates and times your way.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191127 Displaying dates and times your way.md b/sources/tech/20191127 Displaying dates and times your way.md index 725e94cb0c..52c930d68e 100644 --- a/sources/tech/20191127 Displaying dates and times your way.md +++ b/sources/tech/20191127 Displaying dates and times your way.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 83643e017f9cbc1573992b0437f4b754aa11aa06 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 28 Nov 2019 22:51:49 +0800 Subject: [PATCH 681/800] TSL --- ...127 Displaying dates and times your way.md | 180 ------------------ ...127 Displaying dates and times your way.md | 166 ++++++++++++++++ 2 files changed, 166 insertions(+), 180 deletions(-) delete mode 100644 sources/tech/20191127 Displaying dates and times your way.md create mode 100644 translated/tech/20191127 Displaying dates and times your way.md diff --git a/sources/tech/20191127 Displaying dates and times your way.md b/sources/tech/20191127 Displaying dates and times your way.md deleted file mode 100644 index 52c930d68e..0000000000 --- a/sources/tech/20191127 Displaying dates and times your way.md +++ /dev/null @@ -1,180 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Displaying dates and times your way) -[#]: via: (https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Displaying dates and times your way -====== -The Linux date command provides more options for displaying dates and times than you can shake a stick at (without hurting your wrist anyway). Here are some of the more useful choices. -Thinkstock / Tomislav Jakupec - -The date command on Linux systems is very straightforward. You type “date” and the date and time are displayed in a useful way. It includes the day-of-the-week, calendar date, time and time zone: - -``` -$ date -Tue 26 Nov 2019 11:45:11 AM EST -``` - -As long as your system is configured properly, you’ll see the date and current time along with your time zone. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - -The command, however, also offers a lot of options to display date and time information differently. For example, if you want to display dates in the most useful format for sorting, you might want to use a command like this: - -[][2] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][2] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -``` -$ date "+%Y-%m-%d" -2019-11-26 -``` - -In this case, the year, month and day are arranged in that order. Note that we use a capital Y to get a four-digit year. If we use a lowercase y, we’d see only a two-digit year (e.g., 19). Don’t let this induce you into thinking that if %m gives you a numeric month, **%**M might give you the name of the month. No, **%**M will report on minutes. To get the month in abbreviated name format, you would use **%**b and for a fully spelled out month, you would use **%**B. - -``` -$ date "+%b %B" -Nov November -``` - -Alternately, you might want to display the date in this commonly used format: - -``` -$ date +%D -11/26/19 -``` - -If you need a four-digit year, you can do this: - -``` -$ date "+%x" -11/26/2019 -``` - -Here’s an example that might be useful. Say that you need to create a daily report and have the file name include the date, you could use a command like this to create the file – probably in a script: - -``` -touch Report-`date "+%Y-%m-%d"` -``` - -When you list your reports, they’ll list in date order or reverse date order if you add -r. - -``` -$ ls -r Report* -Report-2019-11-26 -Report-2019-11-25 -Report-2019-11-22 -Report-2019-11-21 -Report-2019-11-20 -``` - -You can add other details to your date strings as well. The variety of options available is surprising. You could show which quarter of the year you’re in by using **date "+%q"** or display the date it was two months ago with a command like this: - -``` -$ date --date="2 months ago" -Thu 26 Sep 2019 09:02:43 AM EDT -``` - -Want to see what next Thursday’s date will be? You can use a command like **date --date="next thu"**, but understand that, for Linux, next Thursday means whatever Thursday follows today. That’s tomorrow if today is Wednesday – not Thursday of next week. However, you can specify Thursday of next week as in the second command below. - -``` -$ date --date="next thu" -Thu 28 Nov 2019 12:00:00 AM EST -$ date --date="next week thu" -Thu 05 Dec 2019 12:00:00 AM EST -``` - -The man page for the date command lists all of its options. The list is fairly mind boggling, but you’ll probably find some date/time display options that work really well for you. Here are some that you might find interesting. - -The date in universal time (UTC): - -``` -$ date -u -Tue 26 Nov 2019 01:13:59 PM UTC -``` - -The number of seconds since Jan 1, 1970 (related to how dates are stored on Linux systems): - -``` -$ date +%s -1574774137 -``` - -Here's a full listing of the date command's options. As I said, it's a lot more extensive than most of us likely imagine. - -``` -%% a literal % -%a locale's abbreviated weekday name (e.g., Sun) -%A locale's full weekday name (e.g., Sunday) -%b locale's abbreviated month name (e.g., Jan) -%B locale's full month name (e.g., January) -%c locale's date and time (e.g., Thu Mar 3 23:05:25 2005) -%C century; like %Y, except omit last two digits (e.g., 20) -%d day of month (e.g., 01) -%D date; same as %m/%d/%y -%e day of month, space padded; same as %_d -%F full date; same as %Y-%m-%d -%g last two digits of year of ISO week number (see %G) -%G year of ISO week number (see %V); normally useful only with %V -%h same as %b -%H hour (00..23) -%I hour (01..12) -%j day of year (001..366) -%k hour, space padded ( 0..23); same as %_H -%l hour, space padded ( 1..12); same as %_I -%m month (01..12) -%M minute (00..59) -%n a newline -%N nanoseconds (000000000..999999999) -%p locale's equivalent of either AM or PM; blank if not known -%P like %p, but lower case -%q quarter of year (1..4) -%r locale's 12-hour clock time (e.g., 11:11:04 PM) -%R 24-hour hour and minute; same as %H:%M -%s seconds since 1970-01-01 00:00:00 UTC -%S second (00..60) -%t a tab -%T time; same as %H:%M:%S -%u day of week (1..7); 1 is Monday -%U week number of year, with Sunday as first day of week (00..53) -%V ISO week number, with Monday as first day of week (01..53) -%w day of week (0..6); 0 is Sunday -%W week number of year, with Monday as first day of week (00..53) -%x locale's date representation (e.g., 12/31/99) -%X locale's time representation (e.g., 23:13:48) -%y last two digits of year (00..99) -%Y year -%z +hhmm numeric time zone (e.g., -0400) -%:z +hh:mm numeric time zone (e.g., -04:00) -%::z +hh:mm:ss numeric time zone (e.g., -04:00:00) -%:::z numeric time zone with : to necessary precision (e.g., -04, +05:30) -%Z alphabetic time zone abbreviation (e.g., EDT) -``` - -Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-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://www.networkworld.com/newsletters/signup.html -[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[3]: https://www.facebook.com/NetworkWorld/ -[4]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20191127 Displaying dates and times your way.md b/translated/tech/20191127 Displaying dates and times your way.md new file mode 100644 index 0000000000..e0ccbb3142 --- /dev/null +++ b/translated/tech/20191127 Displaying dates and times your way.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Displaying dates and times your way) +[#]: via: (https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +按你的方式显示日期和时间 +====== + +> Linux date 命令提供了很多显示日期和时间的选项,要比你想的还要多。这是一些更有用的选择。 + +在 Linux 系统上,`date` 命令非常简单。你键入 `date`,日期和时间将以一种有用的方式显示。它包括星期几、日期、时间和时区: + +``` +$ date +Tue 26 Nov 2019 11:45:11 AM EST +``` + +只要你的系统配置正确,你就会看到日期和当前时间以及时区。 + +但是,该命令还提供了许多选项来以不同方式显示日期和时间信息。例如,如果要显示日期以进行排序,则可能需要使用如下命令: + +``` +$ date "+%Y-%m-%d" +2019-11-26 +``` + +在这种情况下,年、月和日按该顺序排列。请注意,我们使用大写字母 `Y` 来获得四位数的年份。如果我们使用小写的 `y`,则只会看到两位数字的年份(例如 19)。不要让这种想法使你联想到,如果 `%m` 给你一个数字月份,`%M` 可能会给你月份的名称。不,`%M` 将给你分钟数。要以缩写名称格式获得月份,你要使用 `%b`,而对于完全拼写的月份,则要使用 `%B`。 + +``` +$ date "+%b %B" +Nov November +``` + +或者,你可能希望以这种常用格式显示日期: + +``` +$ date +%D +11/26/19 +``` + +如果你需要四位数的年份,则可以执行以下操作: + +``` +$ date "+%x" +11/26/2019 +``` + +下面是一个可能有用的示例。假设你需要创建一个每日报告并在文件名中包含日期,则可以使用以下命令来创建文件(可能用在脚本中): + +``` +$ touch Report-`date "+%Y-%m-%d"` +``` + +当你列出你的报告时,它们将按日期顺序或反向日期顺序(如果你添加 `-r`)列出。 + +``` +$ ls -r Report* +Report-2019-11-26 +Report-2019-11-25 +Report-2019-11-22 +Report-2019-11-21 +Report-2019-11-20 +``` + +你还可以在日期字符串中添加其他详细信息。可用的各种选项令人惊讶。你可以使用 `date "+%q"` 来显示你所在的一年中的哪个季度,或使用类似以下命令来显示两个月前的日期: + +``` +$ date --date="2 months ago" +Thu 26 Sep 2019 09:02:43 AM EDT +``` + +是否想知道下周四的日期?你可以使用类似 `date --date="next thu"` 的命令,但是要理解,对于Linux,下个周四意味着今天之后的周四。如果今天是星期三,那就是明天,而不是下周的星期四。但是,你可以像下面的第二个命令一样指定下周的星期四。 + +``` +$ date --date="next thu" +Thu 28 Nov 2019 12:00:00 AM EST +$ date --date="next week thu" +Thu 05 Dec 2019 12:00:00 AM EST +``` + +`date` 命令的手册页列出了其所有选项。该列表令人难以置信,但是你可能会发现一些日期/时间显示选项非常适合您。以下是一些你可能会发现有趣的东西。 + +世界标准时间(UTC): + +``` +$ date -u +Tue 26 Nov 2019 01:13:59 PM UTC +``` + +自 1970 年 1 月 1 日以来的秒数(与 Linux 系统上日期的存储方式有关): + +``` +$ date +%s +1574774137 +``` + +这是 `date` 命令选项的完整列表。正如我所说,它比我们大多数人想象的要广泛得多。 + +- `%%` 字母 % +- `%a` 语言环境的缩写星期名称(例如,日 / Sun) +- `%A` 语言环境的完整星期名称(例如,星期日 / Sunday) +- `%b` 语言环境的缩写月份名称(例如 一 / Jan) +- `%B` 语言环境的完整月份名称(例如,一月 / January) +- `%c` 语言环境的日期和时间(例如 2005年3月3日 星期四 23:05:25 / Thu Mar 3 23:05:25 2005) +- `%C` 世纪;类似于 `%Y`,但省略了后两位数字(例如,20) +- `%d` 月份的天(例如,01) +- `%D` 日期;与 `%m/%d/%y` 相同 +- `%e` 月份的天,填充前缀空格;与 `%_d` 相同 +- `%F` 完整日期;与 `%Y-%m-%d` 相同 +- `%g` ISO 周号的年份的后两位数字(请参见 `%G`) +- `%G` ISO 周号的年份(请参阅 `%V`);通常仅配合 `%V`有用 +- `%h` 与 `%b` 相同 +- `%H` 小时(00..23) +- `%I` 小时(01..12) +- `%j` 一年的天(001..366) +- `%k` 小时,填充前缀空格( 0..23);与 `%_H` 相同 +- `%l` 小时,填充前缀空格( 1..12);与 `%_I` 相同 +- `%m` 月份(01..12) +- `%M` 分钟(00..59) +- `%n` 换行符 +- `%N` 纳秒(000000000..999999999) +- `%p` 语言环境中等同于 AM 或 PM 的字符串;如果未知,则为空白 +- `%P` 像 `%p`,但使用小写 +- `%q` 季度(1..4) +- `%r` 语言环境的 12 小时制时间(例如,晚上 11:11:04 / 11:11:04 PM) +- `%R` 24 小时制的小时和分钟;与 `%H:%M` 相同 +- `%s` 自 1970-01-01 00:00:00 UTC 以来的秒数 +- `%S` 秒(00..60) +- `%t` 制表符 +- `%T` 时间;与 `%H:%M:%S` 相同 +- `%u` 星期(1..7);1 是星期一 +- `%U` 年的周数,以星期日为一周的第一天(00..53) +- `%V` ISO 周号,以星期一为一周的第一天(01..53) +- `%w` 星期(0..6);0 是星期日 +- `%W` 年的周数,星期一为一周的第一天(00..53) +- `%x` 语言环境的日期表示形式(例如,1999年12月31日 / 12/31/99) +- `%X` 语言环境的时间表示形式(例如,23:13:48) +- `%y` 年的最后两位数字(00..99) +- `%Y` 年 +- `%z` +hhmm 格式的数字时区(例如,-0400) +- `%:z` +hh:mm 格式的数字时区(例如,-04:00) +- `%::z` +hh:mm:ss 格式的时区(例如 -04:00:00) +- `%:::z` 数字时区,带有 `:` 达到必要的精度(例如 -04,+05:30) +- `%Z` 字母时区缩写(例如,EDT) + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-linux.html + +作者:[Sandra Henry-Stocker][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/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world From 6152d72edbdc8cf9f2e75e25db924dd34a52b2e5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 28 Nov 2019 23:01:10 +0800 Subject: [PATCH 682/800] APL --- sources/talk/20191028 6 signs you might be a Linux user.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191028 6 signs you might be a Linux user.md b/sources/talk/20191028 6 signs you might be a Linux user.md index d66d08cf35..977c586516 100644 --- a/sources/talk/20191028 6 signs you might be a Linux user.md +++ b/sources/talk/20191028 6 signs you might be a Linux user.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 0dc55d356815505c8bd1f2be5402a53e9c6d3243 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 29 Nov 2019 00:56:57 +0800 Subject: [PATCH 683/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191128=20Monito?= =?UTF-8?q?ring=20Linux=20and=20Windows=20hosts=20with=20Glances?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191128 Monitoring Linux and Windows hosts with Glances.md --- ...ng Linux and Windows hosts with Glances.md | 231 ++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 sources/tech/20191128 Monitoring Linux and Windows hosts with Glances.md diff --git a/sources/tech/20191128 Monitoring Linux and Windows hosts with Glances.md b/sources/tech/20191128 Monitoring Linux and Windows hosts with Glances.md new file mode 100644 index 0000000000..0c480bc6ea --- /dev/null +++ b/sources/tech/20191128 Monitoring Linux and Windows hosts with Glances.md @@ -0,0 +1,231 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Monitoring Linux and Windows hosts with Glances) +[#]: via: (https://opensource.com/article/19/11/monitoring-linux-glances) +[#]: author: (David Both https://opensource.com/users/dboth) + +Monitoring Linux and Windows hosts with Glances +====== +The Glances tool offers more information about system performance than +other sysadmin monitoring tools. +![Code going into a computer.][1] + +Sysadmins have many tools to view and manage running processes. For me, these primarily used to be **top**, **atop**, and **htop**. A few years ago, I found [Glances][2], a tool that displays information that none of my other favorites do. All of these tools monitor CPU and memory usage, and most of them list information about running processes (at the very least). However, Glances also monitors filesystem I/O, network I/O, and sensor readouts that can display CPU and other hardware temperatures as well as fan speeds and disk usage by hardware device and logical volume. + +### Glances + +I mentioned Glances in my article [_4 open source tools for Linux system monitoring_][3], but I will delve into it more deeply in this article. If you read my previous article, some of this information may be familiar, but you should also find some new things here. + +Glances is cross-platform because it is written in Python. It can be installed on Windows and other hosts with current versions of Python installed. Most Linux distributions (Fedora in my case) have Glances in their repositories. If not, or if you are using a different operating system (such as Windows), or you just want to get it right from the source, you can find instructions for downloading and installing it in [Glances' GitHub repo][4]. + +I suggest running Glances on a test machine while you try the commands in this article. If you don't have a physical host available for testing, you can explore Glances on a virtual machine (VM), but you won't see the hardware sensors section; after all, a VM has no real hardware. + +To start Glances on a Linux host, open a terminal session and enter the command **glances**. + +Glances has three main sections—Summary, Process, and Alerts—as well as a sidebar. I'll explore them and other details for using Glances now. + +### Summary section + +In its top few lines, Glances' Summary section contains much of the same information as you'll find in other monitors' summary sections. If you have enough horizontal space in your terminal, Glances can show CPU usage with both a bar graph and a numeric indicator; otherwise it will show only the number. + +I like Glances' Summary section better than the ones in other monitors (like **top**); I think it provides the right information in an easily understandable format. + +![Glances display][5] + +The Glances display on a busy Linux host. In the interest of clarity, not all possible displays are shown in the left sidebar. + +The Summary section above provides an overview of the system's status. The first line shows the hostname, the Linux distribution, the kernel version, and the system uptime. + +The next four lines display CPU, memory usage, swap, and load statistics. The left column displays the percentages of CPU, memory, and swap space that are in use. It also shows the combined statistics for all CPUs present in the system. + +Press the **1** key to toggle between the consolidated CPU usage display and the display of the individual CPUs. The following image shows the Glances display with individual CPU statistics. + +![Glances display][6] + +Glances showing the individual CPU statistics. + +This view includes some additional CPU statistics. In either display mode, the descriptions of the CPU usage fields can help you interpret the data displayed in the CPU section. Notice that CPUs are numbered starting at 0 (Zero). + +**CPU** | This is the current CPU usage as a percentage of the total available. +---|--- +**user** | These are the applications and other programs running in user space, i.e., not in the kernel. +**system** | These are kernel-level functions. It does not include CPU time taken by the kernel itself, just the kernel system calls. +**idle** | This is the idle time, i.e., time not used by any running process. +**nice** | This is the time used by processes that are running at a positive, nice level. +**irq** | These are the interrupt requests that take CPU time. +**iowait** | These are CPU cycles that are spent waiting for I/O to occur—this is wasted CPU time. +**steal** | The percentage of CPU cycles that a virtual CPU waits for a real CPU while the hypervisor is servicing another virtual processor. +**ctx-sw** | These are the number of context switches per second; it represents the number of times per second that the CPU switches from running one process to another. +**inter** | This is the number of hardware interrupts per second. A hardware interrupt occurs when a hardware device, such as a hard drive, tells a CPU that it has completed a data transfer or that a network interface card is ready to accept more data. +**sw_int** | Software interrupts tell the CPU that some requested task has completed or that the software is ready for something. These tend to be more common in kernel-level software. + +#### About nice numbers + +Nice numbers are the mechanism used by administrators to affect the priority of a process. It is not possible to change the priority of a process directly, but changing the nice number can modify the results of the kernel scheduler’s priority setting algorithm. Nice numbers run from -20 to +19 where higher numbers are nicer. The default nice number is 0 and the default priority is 20. Setting the nice number higher than zero increases the priority number somewhat, thus making the process nicer and therefore less greedy of CPU cycles. Setting the nice number to a more negative number results in a lower priority number making the process less nice. Nice numbers can be changed using the renice command or from within top, atop, and htop. + +#### Memory + +The Memory portion of the Summary section contains statistics about memory usage. + +**MEM** | This shows the memory usage as a percent of the total amount available. +---|--- +**total** | This is the total amount of RAM memory installed in the host, less any amount assigned to the display adapter. +**used** | This is the total amount of memory in use by the system and application programs but not including cache or buffers. +**free** | This is the amount of free memory. +**active** | This is the amount of actively used memory—inactive memory is subject to swapping to disk should the need arise. +**inactive** | This is memory that is in use but that has not been accessed for some time. +**buffers** | This is memory that is used for buffer space; it is usually used by communications and I/O such as networking. The data is received and stored until the software can retrieve it for use or it can be sent to a storage device or transmitted out to the network. +**cached** | This is the memory used to store data for disk transfer until it can be used by a program or stored to disk. + +The Swap section is self-explanatory if you understand a bit about swap space and how it works. This shows how much total swap space is available, how much is used, and how much is left. + +The Load part of the Summary section displays the one-, five-, and 15-minute load averages. + +You can use the numeric keys **1**, **3**, **4**, and **5** to alter your view of the data in this section. The **2** key toggles the left sidebar on and off. + +#### More about load averages + +Load averages are commonly misunderstood, even though they are a key criterion for measuring CPU usage. But what does it really mean when I say that the one- (or five- or 10-) minute load average is 4.04, for example? Load average can be considered a measure of demand for the CPU; it is a number that represents the average number of instructions waiting for CPU time, so it is a true measure of CPU performance. + +For example, a fully utilized single-processor system CPU would have a load average of 1. This means that the CPU is keeping up exactly with demand; in other words, it has perfect utilization. A load average of less than 1 means the CPU is underutilized, and a load average greater than 1 means the CPU is overutilized and that there is pent-up, unsatisfied demand. For example, a load average of 1.5 in a single-CPU system indicates that one-third of the CPU instructions must wait to be executed until the preceding one has completed. + +This is also true for multiple processors. If a four-CPU system has a load average of 4, then it has perfect utilization. If it has a load average of 3.24, for example, then three of its processors are fully utilized, and one is utilized at about 24%. In the example above, a four-CPU system has a one-minute load average of 4.04, meaning there is no remaining capacity among the four CPUs, and a few instructions are forced to wait. A perfectly utilized four-CPU system would show a load average of 4.00, meaning that the system is fully loaded but not overloaded. + +The optimum load average condition is for the load average to equal the total number of CPUs in a system. That would mean that every CPU is fully utilized, and no instruction must be forced to wait. But reality is messy, and optimum conditions are seldom met. If a host were running at 100% utilization, this would not allow for spikes in CPU load requirements. + +The longer-term load averages indicate overall utilization trends. + +_Linux Journal_ published an excellent article [about load averages][7], the theory, the math behind them, and how to interpret them, in its December 1, 2006, issue. Unfortunately, _Linux Journal_ has ceased publication, and its archives are no longer available directly, so the link is to a third-party archive. + +#### Finding CPU hogs + +One of the reasons for using a tool like Glances is to find processes that are taking up too much CPU time. Open a new terminal session (different from the one running Glances), and enter and start the following CPU-hogging Bash program. + + +``` +`X=0;while [ 1 ];do echo $X;X=$((X+1));done` +``` + +This program is a CPU hog and will use up every available CPU cycle. Allow it to run while you finish this article and experiment with Glances. It will provide you with an idea of what a program that hogs CPU cycles looks like. Be sure to observe the effects on the load averages over time, as well as the cumulative time in the **TIME+** column for this process. + +### Process section + +The Process section displays standard information about each process that is running. Depending upon the viewing mode and the size of the terminal screen, different columns of information will be displayed for the running processes. The default mode with a wide-enough terminal displays the columns listed below. The columns that are displayed change automatically if the terminal screen is resized. The following columns are typically displayed for each process from left to right. + +**CPU%** | This is the amount of CPU time as a percentage of a single core. For example, 98% represents 98% of the available CPU cycles for a single core. Multiple processes can show up to 100% CPU usage. +---|--- +**MEM%** | This is the amount of RAM memory used by the process as a percentage of the total virtual memory in the host. +**VIRT** | This is the amount of virtual memory used by the process in human-readable format, such as 12M for 12 megabytes. +**RES** | This refers to the amount of physical (resident) memory used by the process. Again, this is in human-readable format, with an indicator of **K**, **M**, or **G**, to specify kilobytes, megabytes, or gigabytes. +**PID** | Every process has an identification number, called the PID. This number can be used in commands, such as **renice** and **kill**, to manage the process. Remember that the **kill** utility can send signals to another process besides the “kill” signal. +**USER** | This is the name of the user that owns the process. +**TIME+** | This indicates the cumulative amount of CPU time accrued by the process since it started. +**THR** | This is the total number of threads currently running for this process. +**NI** | This is the nice number of the process. +**S** | This is the current status; it can be (**R**)unning, (**S**)leeping, (**I**)dle, **T** or **t** when the process is stopped during a debugging trace, or (**Z**)ombie. A zombie is a process that has been killed but has not completely died, so it continues to consume some system resources, such as RAM. +**R/s and W/s** | These are the disk reads and writes per second. +**Command** | This is the command used to start the process. + +Glances usually determines the default sort column automatically. Processes can be sorted automatically (**a**), or by CPU (**c**), memory (**m**), name (**p**), user (**u**), I/O rate (**i**), or time (**t**). Processes are automatically sorted by the most-used resource. In the images above, the **TIME+** column is highlighted. + +### Alerts section + +Glances also shows warnings and critical alerts, including the time and duration of the event, at the bottom of the screen. This can be helpful when you're attempting to diagnose problems and cannot stare at the screen for hours at a time. These alert logs can be toggled on or off with the **l** (lower-case L) key, warnings can be cleared with the **w** key, while alerts and warnings can all be cleared with **x**. + +### Sidebar + +Glances has a very nice sidebar on the left that displays information that is not available in **top** or **htop**. While **atop** displays some of this data, Glances is the only monitor that displays data about sensors. After all, sometimes it is nice to see the temperatures inside your computer. + +The individual modules, disk, filesystem, network, and sensors can be toggled on and off using the **d**, **f**, **n**, and **s** keys, respectively. The entire sidebar can be toggled using **2**. Docker stats can be displayed in the sidebar with **D**. + +Note that hardware sensors are not displayed when Glances is running on a virtual machine. + +### Getting help + +You can get help by pressing the **h** key; dismiss the help page by pressing **h** again. The Help page is rather terse, but it does show the available interactive options and how to turn them on and off. The [man page][8] has terse explanations of the options that can be used when launching Glances. + +You can press **q** or **Esc** to exit Glances. + +### Configuration + +Glances does not require a configuration file to work properly. If you choose to have one, the system-wide instance of the configuration file will be located in **/etc/glances/glances.conf**. Individual users can have a local instance at **~/.config/glances/glances.conf**, which will override the global configuration. The primary purpose of these configuration files is to set thresholds for warnings and critical alerts. You can also specify whether certain modules are displayed by default or not. + +The file **/usr/local/share/doc/glances/README.rst** contains additional useful information, including optional Python modules you can install to support some optional Glances features. + +### Command-line options + +Glances provides command-line options that allow it to start up in specific viewing modes. For example, the command **glances -2** starts the program with the left sidebar disabled. + +### Remote and more + +By starting it in server mode, you can use Glances to monitor remote hosts: + + +``` +`[root@testvm1 ~]# glances -s` +``` + +You can then connect to the server from the client with: + + +``` +`[root@testvm2 ~]# glances -c @testvm1` +``` + +Glances can show a list of Glances servers along with a summary of their activity. It also has a web interface so you can monitor remote Glances servers from a browser. Recent versions of Glances can also display Docker statistics. + +There are also pluggable modules for Glances that provide measurement data not available in the base program. + +### Limitations + +Although Glances can monitor many aspects of a host, it cannot manage processes. It cannot change the nice number of a process nor kill one, as **top** and **htop** can. Glances is not an interactive tool. It is used strictly for monitoring. External tools like **kill** and **renice** can be used to manage processes. + +Glances can only show the processes that are taking the majority of the resource specified, such as CPU time, in the available space. If there is room to list just 10 processes, that is all you will be able to see. Glances does not provide scrolling or reverse-sort options that would enable you to see any other than the top X processes. + +### The impact of measurement + +The [observer effect][9] is a physics theory that states, "simply observing a situation or phenomenon necessarily changes that phenomenon." This is also true when measuring Linux system performance. + +Merely using a monitoring tool alters the system's use of resources, including memory and CPU time. The **top** utility and most other monitors use perhaps 2% tor 3% of a system's CPU time. The Glances utility has much more impact than the others; it usually uses between 10% and 20% of CPU time, and I have seen it use as much as 40% of one CPU in a very large and active system with 32 CPUs. That is a lot, so consider its impact when you think about using Glances as your monitor. + +My personal opinion is that this is a small price to pay when you need the capabilities of Glances. + +### Summary + +Despite its lack of interactive capabilities, such as the ability to **renice** or **kill** processes, and its high CPU load, I find Glances to be a very useful tool. The complete [Glances documentation][10] is available on the internet, and the Glances man page has startup options and interactive command information. + +* * * + +_Parts of this article are based on David Both's new book, _[Using and Administering Linux: Volume 2 – Zero to SysAdmin: Advanced Topics][11].__ + +David Both shares his favorite system monitoring tools for understanding what is going on in any... + +David Both explains the importance of keeping hardware cool and shares some Linux tools that can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/monitoring-linux-glances + +作者:[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/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.) +[2]: https://nicolargo.github.io/glances/ +[3]: https://opensource.com/life/16/2/open-source-tools-system-monitoring +[4]: https://github.com/nicolargo/glances/blob/master/README.rst#installation +[5]: https://opensource.com/sites/default/files/uploads/glances-figure-1.png (Glances display) +[6]: https://opensource.com/sites/default/files/uploads/glances-figure-2.png (Glances display) +[7]: https://archive.org/details/Linux-Journal-2006-12/page/n81 +[8]: https://linux.die.net/man/1/glances +[9]: https://en.m.wikipedia.org/wiki/Observer_effect_(physics) +[10]: https://glances.readthedocs.io/en/stable/ +[11]: https://www.apress.com/us/book/9781484250488 From ff078e4191a5a381cd2b574314779fc6fff1e5e4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Fri, 29 Nov 2019 01:00:44 +0800 Subject: [PATCH 684/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191128=20?= =?UTF-8?q?=E2=80=9CWe=20follow=20a=20holistic=20approach=20to=20drive=20o?= =?UTF-8?q?pen=20source=20adoption=20across=20the=20client=20base=20at=20I?= =?UTF-8?q?nfosys=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191128 -We follow a holistic approach to drive open source adoption across the client base at Infosys.md --- ...ption across the client base at Infosys.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/talk/20191128 -We follow a holistic approach to drive open source adoption across the client base at Infosys.md diff --git a/sources/talk/20191128 -We follow a holistic approach to drive open source adoption across the client base at Infosys.md b/sources/talk/20191128 -We follow a holistic approach to drive open source adoption across the client base at Infosys.md new file mode 100644 index 0000000000..23353b3a40 --- /dev/null +++ b/sources/talk/20191128 -We follow a holistic approach to drive open source adoption across the client base at Infosys.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (“We follow a holistic approach to drive open source adoption across the client base at Infosys”) +[#]: via: (https://opensourceforu.com/2019/11/we-follow-a-holistic-approach-to-drive-open-source-adoption-across-the-client-base-at-infosys/) +[#]: author: (Rahul Chopra https://opensourceforu.com/author/rahul-chopra/) + +“We follow a holistic approach to drive open source adoption across the client base at Infosys” +====== + +[![][1]][2] + +_As a global services company operating in fiercely competitive environments, Infosys has set up a well-established open source practice. **Gautam Khanna, VP & head – modernization practice, Infosys**, shares with **Rahul Chopra, editorial director, EFY Group**, how the company keeps its employees up-to-date with open source, motivates and helps them to contribute to the open source ecosystem, and more._ + +**Q. What are your thoughts about the pace at which open source software (OSS) is being adopted amongst global enterprises (Top 2000 or 5000)? Is it accelerating?** +**A.** Open source adoption in enterprises is growing more rapidly than ever. A recent global survey of IT leaders revealed that nearly 90 per cent see open source as necessary to their enterprises. Open source usage is increasingly seen in categories like cloud management, security, analytics and storage, which have historically been more associated with proprietary products. Over two-thirds of the participants in the survey have increased their open source adoption in the last 12 months, and nearly 60 per cent expect to improve adoption levels over the next year as well. + +These numbers reinforce what we have observed among our clients across industry verticals – they are using open source more than ever in their modernization journeys. This is driven by the trifecta of unmatched innovation, quality, and value that open source delivers. However, what we have also observed is that there are differing levels of adoption across verticals. The retail and communication verticals are strategically and consistently adopting open source while financial institutions are a bit more cautious in doing so. + +**Q. Are there any specific countries or geographic regions that are leading this trend?** +**A.** We see the growth as pervasive across geographies. India, for example, has some amazing stories of open source adoption in government, in initiatives like Aadhaar. + +**Q. Are you seeing an increase in the number of deals that require systems integrators (SIs) like Infosys to have expertise on various open source stacks?** +**A.** As clients look to reduce their dependence on proprietary software, manage costs, and introduce increased agility and innovation, most application modernization deals today have open source as an integral component. We see this trend only getting stronger, so building open source competencies at scale is a must for every global SI. + +**Q. In the earlier days, there were a lot of myths about open source. Some proprietary brands were deliberately spreading FUD (fear, uncertainty and doubt) too. Today, what are the common myths or other inhibiting factors that prevent firms from adopting open source?** +**A.** While the awareness and acceptability of open source has certainly increased a lot over the years, we still notice the prevalence of some myths. Most of them are related to open source support, security, enterprise scalability and reliability. + +Clients also face challenges in adopting open source at the enterprise scale – including identifying the best-fit solutions from a plethora of technologies, navigating a complex vendor ecosystem and making their open source journeys cost-neutral. In all our client conversations, we focus on debunking any myths and helping our clients make informed and optimal decisions in their open source journeys. + +**Q. How is Infosys gearing up to become a leading SI in the open source space? What new initiatives has the company taken in the last few years?** +**A.** Open source is a strong focus area for Infosys. We have established an open source practice that works with all our services lines to execute client engagements, drive internal innovation, open source contribution and talent enablement. We have a comprehensive set of service offerings – spanning open source advisory services, architecture consulting, implementation, migration and support – to help our clients accelerate open source adoption. + +Our architects bring both depth and breadth across the stack to deliver end-to-end solutions. We have built a suite of in-house tools and accelerators to further speed up open source based modernization and migration initiatives. + +We have a strong ecosystem of more than 25 partners, which helps us offer end-to-end services and a single commercial interface to our clients by bundling product subscription and support along with our application services. + +We have a razor-sharp focus on talent enablement at scale – we have over 330 open source courses, which our employees can access via our ‘learn anywhere’ platforms, and to date, over 65,000 people have been trained on open source. + +**Q. Are there any major open source case studies that you’d like to share with our audience, particularly a case study from India?** +**A.** There are several exciting case studies, none more impressive than from our own backyard – the GSTN project and the platform behind the most extensive indirect tax reforms in Indian history. This is also one of the largest and most complex in the world. + +Infosys had the privilege of designing and building this ‘population-scale’ platform using an entirely open source stack, based on fundamental principles like openness, no vendor lock-in, security, reliability, availability and scalability. The system is capable of handling some astonishing volumes – around 50,000 invoices per second and 1.2 billion invoices on the last day of filing, with extremely high availability and performance. The system has been tested to handle up to 135,000 concurrent user filings and 2,000,000 tax returns on a single day. It also collects US$ 3.7 billion of tax revenues on the peak day across 800,000 transactions. + +Case studies like GSTN showcase the power of open source in every aspect and should convince any sceptics about its suitability at the enterprise scale. + +**Q. How does your team empower or enable other teams at Infosys, when it comes to open source?** +**A.** Enablement of architects and developers across the company is one of the key responsibilities of our open source practice. There are three pillars of enablement – internal learning systems, partners and hackathons. We have dedicated open source technology trainers within the education, training and assessment team to enable employees at scale. Our partner and open source practice SMEs offer webinars on the latest topics related to their products, every week. Partner training courses and certifications are integrated with our anytime, anywhere, learning system LEX. We have a well-structured refactoring program for employees who may have adjacent skills to follow a defined learning path by getting themselves trained in at least one open source technology followed by certification. It is only after this that we deploy employees on an open source project, and post gaining hands-on experience, we tag them as open source professionals. We also run open source hackathons at the organization level. In these hackathons, that we run for multiple weeks, we do a mass enablement of our employees, post which they work on solving various industry problems using open source technologies. + +**Q. How do you ensure that your team keeps pace with the rapid changes in the open source space, and is ready to offer solutions based on the latest technology stacks?** +**A.** We have a strong team of SMEs and full-stack architects in our open source practice. A portion of our architects’ time is dedicated to learning and certifying themselves on new technologies. They are also encouraged to contribute to open source community projects. Open source SMEs participate in various forums and partner summits to share our experiences as well as learn from others experiences. They also monitor the latest trends in the industry. + +We have a strong ecosystem of partners that we work closely with in order to understand the latest enhancements in their products and how to take these forward with clients. In the hackathons that we conduct, we encourage hackers to unleash their imagination, innovate and build new solutions leveraging latest features. + +We believe in building joint solutions with our partners and in solving our clients’ business problems. We have a dedicated engineering team to explore and develop new tools and accelerators to solve client problems by embracing the latest open source technologies. For example, we have built a solution using the offline capability of Couchbase in collaboration with the Couchbase team. + +**Q. Do members of your team contribute back to the open source ecosystem too? Can you share some details?** +**A.** Yes, we do. Infosys has a structured contribution process and has created an OS Contribution Portal internally. A contributor builds a contribution and submits it for review and IP checking. Post the IP check, the contribution can be published. Infosys has contributed homegrown products like the Infosys DevOps Platform and tools like Infosys Data Rapid, NIADataRConnector, High Availability Hadoop, HBase to Hive, etc. to the open source ecosystem. + +Infosys has executed a Corporate Contributor License Agreement (CCLA) with the Cloud Native Computing Foundation (CNCF) and is actively participating in the Kubernetes project. We have made over 50 contributions in Kubernetes in the form of bug fixes, blogs and query responses. Apart from Kubernetes, Infosys has also contributed to PostgreSQL, Elastic, Couchbase, Apache Beam and Neo4J communities. Infosys has also collaborated with the Microsoft product engineering team to enable PostgreSQL and MariaDB in Azure Data Services. This is one focus area of our open source practice. There are many more contributions in the pipeline. + +**Q. Does Infosys motivate its employees to contribute back to the open source ecosystem or is it their individual decision?** +**A.** It’s both. Infosys motivates employees to contribute to the open source ecosystem. We conduct internal and external events. Kubernetes Day was organized at Infosys Bengaluru this March, where thousands of people participated. We invited some industry-level open source contributors to share their open source journey and experiences. These talks were webcast to all Infoscions across locations. We have a reward and recognition process to acknowledge and appreciate open source contributors. + +**Q. Is there a shortage of skilled professionals? Are there any specific skillsets that are badly needed, even in countries like India?** +**A.** The average age of an S&P 500 company is under 20 years, down from 60 years in the 1950s, according to Credit Suisse. This trend is accelerating and the leading reason for this is the disruptive nature of new technologies. + +As per a 2018 Gartner survey, talent shortage ranks third among the Top 5 business risks. Digital transformation initiatives have increased this pressure and companies are finding that retaining and hiring talent with niche skills is a key challenge. + +Today, just 20 per cent of the current workforce has the skills required for 60 per cent of the future jobs – those that will be available in the next five to ten years. The unprecedented scale at which new technologies are getting adopted into the mainstream due to the competitive edge they provide makes it almost impossible to find talent at scale on these technologies. + +Catering to the skills diversity needed in an organization and hiring/retaining people are key challenges. In this new harsh reality, hiring talent that is passionate about learning becomes more important than finding talent with the right skills. +At Infosys, we are trying to address this challenge through a combination of hiring and reskilling. + +**Q. What would be your advice to tech professionals who want to benefit from these opportunities but don’t know where to start?** +**A.** My advice to tech professionals is straightforward; we are living in exciting times with limitless opportunities. Never before in the history of humanity have we seen such democratization of knowledge and technology, as today. There is no defined starting line, but what is most important is to learn and apply the knowledge in real business problems continuously. Knowledge begets knowledge, if shared with a broader community. So we should also look at sharing knowledge through contributions, participation at various forums and collaboration. At Infosys, we have always believed and invested heavily in learning, and we have enabled our employees to learn anytime, anywhere, through our mobile learning platform, LEX, which has over 40K resources and 600+ courses. Employees are also encouraged to and recognised for sharing their knowledge, both externally and internally. We are collaborating with our strategic partners to contribute to open source communities jointly. As we speak, we are working with one of our partners to launch an open source academy. + +**Q. Has there been an increase in the number of open source related professionals being hired at Infosys?** +**A.** We are seeing a huge demand for open source technologies and most of our Top 200 clients are increasingly moving their legacy systems to open source technologies. We use a combination of refactoring our existing talent pool and hiring to meet the demand. + +![Avatar][3] + +[Rahul Chopra][4] + +The author is the Editor-in-Chief of Open Source For You magazine. + +[![][5]][6] + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/we-follow-a-holistic-approach-to-drive-open-source-adoption-across-the-client-base-at-infosys/ + +作者:[Rahul Chopra][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/rahul-chopra/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gautam-Khanna-VP-head-modernization-practice-Infosys.jpg?resize=500%2C627&ssl=1 (Gautam Khanna, VP & head - modernization practice, Infosys) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Gautam-Khanna-VP-head-modernization-practice-Infosys.jpg?fit=500%2C627&ssl=1 +[3]: https://secure.gravatar.com/avatar/372bbe65753ca17bcceb2b0e9692af8f?s=100&r=g +[4]: https://opensourceforu.com/author/rahul-chopra/ +[5]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[6]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US From 1ef8ae2c7b04f4c0ded6f62bd130927df14f9667 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Fri, 29 Nov 2019 08:38:59 +0800 Subject: [PATCH 685/800] Translated --- ... Edit images on Fedora easily with GIMP.md | 84 ------------------ ... Edit images on Fedora easily with GIMP.md | 85 +++++++++++++++++++ 2 files changed, 85 insertions(+), 84 deletions(-) delete mode 100644 sources/tech/20191113 Edit images on Fedora easily with GIMP.md create mode 100644 translated/tech/20191113 Edit images on Fedora easily with GIMP.md diff --git a/sources/tech/20191113 Edit images on Fedora easily with GIMP.md b/sources/tech/20191113 Edit images on Fedora easily with GIMP.md deleted file mode 100644 index f77cbc693b..0000000000 --- a/sources/tech/20191113 Edit images on Fedora easily with GIMP.md +++ /dev/null @@ -1,84 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (robsean) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Edit images on Fedora easily with GIMP) -[#]: via: (https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/) -[#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) - -Edit images on Fedora easily with GIMP -====== - -![][1] - -GIMP (short for GNU Image Manipulation Program) is free and open-source image manipulation software. With many capabilities ranging from simple image editing to complex filters, scripting and even animation, it is a good alternative to popular commercial options. - -Read on to learn how to install and use GIMP on Fedora. This article covers basic daily image editing. - -### Installing GIMP - -GIMP is available in the official Fedora repository. To install it run: - -``` -sudo dnf install gimp -``` - -### Single window mode - -Once you open the application, it shows you the dark theme window with toolbox and the main editing area. Note that it has two window modes that you can switch between by selecting _Windows_ -> _Single Window Mode_. By checking this option all components of the UI are displayed in a single window. Otherwise, they will be separate. - -### Loading an image - -![][2] - -To load an image, go to _File_ -> _Open_ and choose your file and choose your image file. - -### Resizing an image - -To resize the image, you have the option to resize based on a couple of parameters, including pixel and percentage — the two parameters which are often handy in editing images. - -Let’s say we need to scale down the Fedora 30 background image to 75% of its current size. To do that, select _Image_ -> _Scale_ and then on the scale dialog, select percentage in the unit drop down. Next, enter _75_ as width or height and press the **Tab** key. By default, the other dimension will automatically resize in correspondence with the changed dimension to preserve aspect ratio. For now, leave other options unchanged and press Scale. - -![][3] - -The image scales to 0.75 percent of its original size. - -### Rotating images - -Rotating is a transform operation, so you find it under _Image_ -> _Transform_ from the main menu, where there are options to rotate the image by 90 or 180 degrees. There are also options for flipping the image vertically or horizontally under the mentioned option. - -Let’s say we need to rotate the image 90 degrees. After applying a 90-degree clockwise rotation and horizontal flip, our image will look like this: - -![Transforming an image with GIMP][4] - -### Adding text - -Adding text is very easy. Just select the A icon from the toolbox, and click on a point on your image where you want to add the text. If the toolbox is not visible, open it from Windows->New Toolbox. - -As you edit the text, you might notice that the text dialog has font customization options including font family, font size, etc. - -![Adding text to image in GIMP][5] - -### Saving and exporting - -You can save your edit as as a GIMP project with the _xcf_ extension from _File_ -> _Save_ or by pressing **Ctrl+S**. Or you can export your image in formats such as PNG or JPEG. To export, go to _File_ -> _Export As_ or hit **Ctrl+Shift+E** and you will be presented with a dialog where you can select the output image and name. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/ - -作者:[Mehdi Haghgoo][a] -选题:[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/powergame/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/gimp-magazine-816x346.jpg -[2]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-00-44-300x165.png -[3]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-17-33-300x262.png -[4]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-41-28-300x243.png -[5]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-47-54-300x237.png diff --git a/translated/tech/20191113 Edit images on Fedora easily with GIMP.md b/translated/tech/20191113 Edit images on Fedora easily with GIMP.md new file mode 100644 index 0000000000..97470082ae --- /dev/null +++ b/translated/tech/20191113 Edit images on Fedora easily with GIMP.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Edit images on Fedora easily with GIMP) +[#]: via: (https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/) +[#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) + +在 Fedora 上使用 GIMP 简单地编辑图像 +====== + +![][1] + +GIMP ( GNU Image Manipulation Program 的缩写) 是自由和开源图像处理软件。有很多的功能,从简单地编辑图像,到复杂的滤镜,脚本,甚至是动画,它是一款很好的流行的商业选项的替代品。 + +继续阅读来学习如何在 Fedora 上安装和使用 GIMP 。这篇文章涉及基本的日常图像编辑。 + +### 安装 GIMP + +GIMP 在官方 Fedora 存储库中可获得。为安装它,运行: + +``` +sudo dnf install gimp +``` + +### 单个窗口模式 + +在你打开应用程序后,它显示带有工具箱和主编辑区的暗色主题窗口。注意,它有两种窗口模式,你可以通过选择 _窗口_ -> _单个窗口模式_ 在其中切换。通过选中这个选项,用户界面的所有组件将显示在单个窗口中。否则,它们将是分开的。 + +### 加载一个图像 + +![][2] + +为加载一个图像,转到 _文件_ -> _打开_ ,然后选择你的文件并选择你的图像文件。 + +### 重新调整一个图像的大小 + +为重新调整图像大小,你有以一对参数为基础的重新调整大小的选项,包括像素和百分比 — 在编辑图像时,这两个参数很方便。 + +让我们假使我们需要缩小 Fedora 30 背景图像到它当前大小的75%。为此,选择 _图像_ -> _比例_ ,然后在比例对话框上,选择在单位下拉列表中的百分比。接下来,输入 _75_ 作为宽度或高度,然后按 **Tab** 键。默认情况下,为保持纵横比,其它尺寸将自动地与更改的尺寸对应来重新调整大小。现在,保存其它选项不变,并按比例。 + +![][3] + +该图像缩小到其原始尺寸的75%。 + +### 旋转图像 + +旋转是一种变换操作,因此,你可以从主菜单下的 _图像_ -> _变换_ 的下面找到它,其中有图像旋转90°或180°的选项。在上述选项下也有垂直或水平翻转图像的选项。 + +让我们假使我们需要旋转图像90°。在应用一次90°顺时针旋转和水平翻转后,我们的图像将看起来像这样: + +![Transforming an image with GIMP][4] + +### 添加文本 + +添加文本非常简单。只需要从工具箱中选择 A 图标,然后,在你的图像上,单击你想要添加文本的位置上一点。如果工具箱不可见,从 窗口->新建工具箱 打开它。 + +当你编辑文本时,你可能注意到,文本对话框有字体自定义选项,包括字体系列,字体大小等等。 + +![Adding text to image in GIMP][5] + +### 保存和导出 + +你可以从 _文件_ -> _保存_ 或通过按 **Ctrl+S** 来保存你的编辑为一个带有 _xcf_ 扩展名的 GIMP 工程。或者,你可以导出你的图像,例如,以 PNG 或 JPEG 格式。为导出,转到 _文件_ -> _导出为_ 或按 **Ctrl+Shift+E** ,接下来,在你面前将产生一个你可以选择输出图像和名称的对话框。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/ + +作者:[Mehdi Haghgoo][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://fedoramagazine.org/author/powergame/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/10/gimp-magazine-816x346.jpg +[2]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-00-44-300x165.png +[3]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-17-33-300x262.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-41-28-300x243.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/10/Screenshot-from-2019-10-25-11-47-54-300x237.png + From c24d5663f543d8416dde5577a48a184e6c947a6f Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 29 Nov 2019 08:43:53 +0800 Subject: [PATCH 686/800] translated --- ...le (Automation Tool) on CentOS 8-RHEL 8.md | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) rename {sources => translated}/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md (83%) diff --git a/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md similarity index 83% rename from sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md rename to translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md index 44def2d57b..8cd9c01c5f 100644 --- a/sources/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md +++ b/translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md @@ -119,35 +119,34 @@ Python 3.6.8 保存并退出文件。 -Once the inventory file (/etc/ansible/hosts) is updated then exchange your user’s ssh public keys with remote systems which are part of “labservers” group. -更新清单文件(/etc/ansible/hosts)后,将用户的 ssh 公钥与作为 “”组一部分的远程系统交换。 +更新清单文件(/etc/ansible/hosts)后,将用户的 ssh 公钥与作为 “labservers” 组一部分的远程系统交换。 -Let’s first generate your local user’s public and private key using ssh-keygen command, +让我们首先使用 ssh-keygen 命令生成本地用户的公钥和私钥, ``` [root@linuxtechi ~]$ ssh-keygen ``` -Now exchange public key between the ansible server and its clients using the following command, +现在使用以下命令在 ansible 服务器及其客户端之间交换公钥, ``` [root@linuxtechi ~]$ ssh-copy-id root@linuxtechi [root@linuxtechi ~]$ ssh-copy-id root@linuxtechi ``` -Now let’s try couple of Ansible commands, first verify the connectivity from Ansible server to its clients using ping module, +现在,让我们尝试几个 Ansible 命令,首先使用 ping 模块验证 Ansible 服务器与客户端的连接, ``` [root@linuxtechi ~]$ ansible -m ping "labservers" ``` -**Note:** If we don’t specify the inventory file in above command then it will refer the default hosts file (i.e /etc/ansible/hosts) +**注意:** 如果我们没有在上面的命令中指定清单文件,那么它将引用默认主机文件(即 /etc/ansible/hosts) -Output, +输出: ![ansible-ping-module-centos8][1] -Let’s check kernel version of each client using Ansible shell command, +让我们使用 Ansible shell 命令检查每个客户端的内核版本, ``` [root@linuxtechi ~]$ ansible -m command -a "uname -r" "labservers" @@ -158,7 +157,7 @@ Let’s check kernel version of each client using Ansible shell command, [root@linuxtechi ~]$ ``` -Use the following ansible command to list all hosts from the inventory file, +使用以下命令列出清单文件中的所有主机, ``` [root@linuxtechi ~]$ ansible all -i /etc/ansible/hosts --list-hosts @@ -170,7 +169,7 @@ Use the following ansible command to list all hosts from the inventory file, [root@linuxtechi ~]$ ``` -Use the following ansible command to list only hosts from “labservers” group +使用以下 ansible 命令仅列出 “labservers” 组中的主机。 ``` root@linuxtechi ~]$ ansible labservers -i /etc/ansible/hosts --list-hosts @@ -180,7 +179,7 @@ root@linuxtechi ~]$ ansible labservers -i /etc/ansible/hosts --list-hosts [root@linuxtechi ~]$ ``` -That’s all from this article, we have successfully demonstrated on how to install and use Ansible on CentOS 8 and RHEL 8 System. Please do you share your feedback and comments. +本文就是这些了,我们成功演示了如何在 CentOS 8 和 RHEL 8 系统中安装和使用 Ansible。请分享你的反馈和意见。 * [Facebook][4] * [Twitter][5] @@ -195,7 +194,7 @@ via: https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/ 作者:[Pradeep Kumar][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 985a533a86033c5b0052801e6a8e46614be628e7 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 29 Nov 2019 08:51:33 +0800 Subject: [PATCH 687/800] translating --- ...quietly unveils faster, lower power Tesla GPU accelerator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md index 5ac59b5cac..cc2a666e32 100644 --- a/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md +++ b/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6778fad5df875d5d883caef639ec3ae62ad727a3 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 29 Nov 2019 14:39:40 +0800 Subject: [PATCH 688/800] PRF --- ...127 Displaying dates and times your way.md | 64 ++++++++++--------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/translated/tech/20191127 Displaying dates and times your way.md b/translated/tech/20191127 Displaying dates and times your way.md index e0ccbb3142..dc59e710c8 100644 --- a/translated/tech/20191127 Displaying dates and times your way.md +++ b/translated/tech/20191127 Displaying dates and times your way.md @@ -1,16 +1,18 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Displaying dates and times your way) [#]: via: (https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-linux.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) -按你的方式显示日期和时间 +在终端里按你的方式显示日期和时间 ====== -> Linux date 命令提供了很多显示日期和时间的选项,要比你想的还要多。这是一些更有用的选择。 +> Linux 的 date 命令提供了很多显示日期和时间的选项,要比你想的还要多。这是一些有用的选择。 + +![](https://img.linux.net.cn/data/attachment/album/201911/29/143832hnn6gr2fdfb2qw2g.jpg) 在 Linux 系统上,`date` 命令非常简单。你键入 `date`,日期和时间将以一种有用的方式显示。它包括星期几、日期、时间和时区: @@ -21,14 +23,14 @@ Tue 26 Nov 2019 11:45:11 AM EST 只要你的系统配置正确,你就会看到日期和当前时间以及时区。 -但是,该命令还提供了许多选项来以不同方式显示日期和时间信息。例如,如果要显示日期以进行排序,则可能需要使用如下命令: +但是,该命令还提供了许多选项来以不同方式显示日期和时间信息。例如,如果要显示日期以便进行排序,则可能需要使用如下命令: ``` $ date "+%Y-%m-%d" 2019-11-26 ``` -在这种情况下,年、月和日按该顺序排列。请注意,我们使用大写字母 `Y` 来获得四位数的年份。如果我们使用小写的 `y`,则只会看到两位数字的年份(例如 19)。不要让这种想法使你联想到,如果 `%m` 给你一个数字月份,`%M` 可能会给你月份的名称。不,`%M` 将给你分钟数。要以缩写名称格式获得月份,你要使用 `%b`,而对于完全拼写的月份,则要使用 `%B`。 +在这种情况下,年、月和日按该顺序排列。请注意,我们使用大写字母 `Y` 来获得四位数的年份。如果我们使用小写的 `y`,则只会看到两位数字的年份(例如 19)。不要让这种做法使你错误地联想到如果 `%m` 给你一个数字月份,`%M` 可能会给你月份的名称。不,`%M` 将给你分钟数。要以缩写名称格式获得月份,你要使用 `%b`,而对于完全拼写的月份,则要使用 `%B`。 ``` $ date "+%b %B" @@ -38,7 +40,7 @@ Nov November 或者,你可能希望以这种常用格式显示日期: ``` -$ date +%D +$ date "+%D" 11/26/19 ``` @@ -66,7 +68,7 @@ Report-2019-11-21 Report-2019-11-20 ``` -你还可以在日期字符串中添加其他详细信息。可用的各种选项令人惊讶。你可以使用 `date "+%q"` 来显示你所在的一年中的哪个季度,或使用类似以下命令来显示两个月前的日期: +你还可以在日期字符串中添加其他详细信息。可用的各种选项多得令人惊讶。你可以使用 `date "+%q"` 来显示你所在的一年中的哪个季度,或使用类似以下命令来显示两个月前的日期: ``` $ date --date="2 months ago" @@ -82,7 +84,7 @@ $ date --date="next week thu" Thu 05 Dec 2019 12:00:00 AM EST ``` -`date` 命令的手册页列出了其所有选项。该列表令人难以置信,但是你可能会发现一些日期/时间显示选项非常适合您。以下是一些你可能会发现有趣的东西。 +`date` 命令的手册页列出了其所有选项。该列表多得令人难以置信,但是你可能会发现一些日期/时间显示选项非常适合你。以下是一些你可能会发现有趣的东西。 世界标准时间(UTC): @@ -98,53 +100,53 @@ $ date +%s 1574774137 ``` -这是 `date` 命令选项的完整列表。正如我所说,它比我们大多数人想象的要广泛得多。 +以下是 `date` 命令选项的完整列表。正如我所说,它比我们大多数人想象的要广泛得多。 -- `%%` 字母 % -- `%a` 语言环境的缩写星期名称(例如,日 / Sun) -- `%A` 语言环境的完整星期名称(例如,星期日 / Sunday) -- `%b` 语言环境的缩写月份名称(例如 一 / Jan) -- `%B` 语言环境的完整月份名称(例如,一月 / January) -- `%c` 语言环境的日期和时间(例如 2005年3月3日 星期四 23:05:25 / Thu Mar 3 23:05:25 2005) +- `%%` 显示字母 % +- `%a` 本地语言环境的缩写星期名称(例如,日 / Sun) +- `%A` 本地语言环境的完整星期名称(例如,星期日 / Sunday) +- `%b` 本地语言环境的缩写月份名称(例如 一 / Jan) +- `%B` 本地语言环境的完整月份名称(例如,一月 / January) +- `%c` 本地语言环境的日期和时间(例如 2005年3月3日 星期四 23:05:25 / Thu Mar 3 23:05:25 2005) - `%C` 世纪;类似于 `%Y`,但省略了后两位数字(例如,20) - `%d` 月份的天(例如,01) - `%D` 日期;与 `%m/%d/%y` 相同 - `%e` 月份的天,填充前缀空格;与 `%_d` 相同 - `%F` 完整日期;与 `%Y-%m-%d` 相同 - `%g` ISO 周号的年份的后两位数字(请参见 `%G`) -- `%G` ISO 周号的年份(请参阅 `%V`);通常仅配合 `%V`有用 +- `%G` ISO 周号的年份(请参阅 `%V`);通常仅配合 `%V` 使用 - `%h` 与 `%b` 相同 -- `%H` 小时(00..23) -- `%I` 小时(01..12) +- `%H` 24 小时制的小时(00..23) +- `%I` 12 小时制的小时(01..12) - `%j` 一年的天(001..366) -- `%k` 小时,填充前缀空格( 0..23);与 `%_H` 相同 -- `%l` 小时,填充前缀空格( 1..12);与 `%_I` 相同 +- `%k` 24 小时制的小时,填充前缀空格( 0..23);与 `%_H` 相同 +- `%l` 12 小时制的小时,填充前缀空格( 1..12);与 `%_I` 相同 - `%m` 月份(01..12) - `%M` 分钟(00..59) - `%n` 换行符 - `%N` 纳秒(000000000..999999999) -- `%p` 语言环境中等同于 AM 或 PM 的字符串;如果未知,则为空白 +- `%p` 本地语言环境中等同于 AM 或 PM 的字符串;如果未知,则为空白 - `%P` 像 `%p`,但使用小写 - `%q` 季度(1..4) -- `%r` 语言环境的 12 小时制时间(例如,晚上 11:11:04 / 11:11:04 PM) +- `%r` 本地语言环境的 12 小时制时间(例如,晚上 11:11:04 / 11:11:04 PM) - `%R` 24 小时制的小时和分钟;与 `%H:%M` 相同 - `%s` 自 1970-01-01 00:00:00 UTC 以来的秒数 - `%S` 秒(00..60) - `%t` 制表符 - `%T` 时间;与 `%H:%M:%S` 相同 - `%u` 星期(1..7);1 是星期一 -- `%U` 年的周数,以星期日为一周的第一天(00..53) -- `%V` ISO 周号,以星期一为一周的第一天(01..53) +- `%U` 年的周号,以星期日为一周的第一天,从 00 开始(00..53) +- `%V` ISO 周号,以星期一为一周的第一天,从 01 开始(01..53) - `%w` 星期(0..6);0 是星期日 -- `%W` 年的周数,星期一为一周的第一天(00..53) -- `%x` 语言环境的日期表示形式(例如,1999年12月31日 / 12/31/99) -- `%X` 语言环境的时间表示形式(例如,23:13:48) +- `%W` 年的周号,星期一为一周的第一天,从 00 开始(00..53) +- `%x` 本地语言环境的日期表示形式(例如,1999年12月31日 / 12/31/99) +- `%X` 本地语言环境的时间表示形式(例如,23:13:48) - `%y` 年的最后两位数字(00..99) -- `%Y` 年 +- `%Y` 年份 - `%z` +hhmm 格式的数字时区(例如,-0400) - `%:z` +hh:mm 格式的数字时区(例如,-04:00) -- `%::z` +hh:mm:ss 格式的时区(例如 -04:00:00) -- `%:::z` 数字时区,带有 `:` 达到必要的精度(例如 -04,+05:30) +- `%::z` +hh:mm:ss 格式的数字时区(例如,-04:00:00) +- `%:::z` 数字时区,`:` 指明精度(例如,-04, +05:30) - `%Z` 字母时区缩写(例如,EDT) -------------------------------------------------------------------------------- @@ -154,7 +156,7 @@ via: https://www.networkworld.com/article/3481602/displaying-dates-and-times-you 作者:[Sandra Henry-Stocker][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 0bea91ebe1d0b5725bc840f5456752f2807a9a76 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 29 Nov 2019 14:41:39 +0800 Subject: [PATCH 689/800] PUB @wxy https://linux.cn/article-11623-1.html --- .../20191127 Displaying dates and times your way.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191127 Displaying dates and times your way.md (99%) diff --git a/translated/tech/20191127 Displaying dates and times your way.md b/published/20191127 Displaying dates and times your way.md similarity index 99% rename from translated/tech/20191127 Displaying dates and times your way.md rename to published/20191127 Displaying dates and times your way.md index dc59e710c8..8325a752e0 100644 --- a/translated/tech/20191127 Displaying dates and times your way.md +++ b/published/20191127 Displaying dates and times your way.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11623-1.html) [#]: subject: (Displaying dates and times your way) [#]: via: (https://www.networkworld.com/article/3481602/displaying-dates-and-times-your-way-with-linux.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From 0813b46e856542f57f2b26a29abdd51f8e1f630f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 29 Nov 2019 14:46:16 +0800 Subject: [PATCH 690/800] PRF --- published/20191127 Displaying dates and times your way.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/published/20191127 Displaying dates and times your way.md b/published/20191127 Displaying dates and times your way.md index 8325a752e0..4366136a80 100644 --- a/published/20191127 Displaying dates and times your way.md +++ b/published/20191127 Displaying dates and times your way.md @@ -12,7 +12,7 @@ > Linux 的 date 命令提供了很多显示日期和时间的选项,要比你想的还要多。这是一些有用的选择。 -![](https://img.linux.net.cn/data/attachment/album/201911/29/143832hnn6gr2fdfb2qw2g.jpg) +![](https://img.linux.net.cn/data/attachment/album/201911/29/144555a8mq82mcc9cfttt9.jpg) 在 Linux 系统上,`date` 命令非常简单。你键入 `date`,日期和时间将以一种有用的方式显示。它包括星期几、日期、时间和时区: From e9aa47a488447c8f481a65012df961952843c06e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 29 Nov 2019 16:37:58 +0800 Subject: [PATCH 691/800] PRF @geekpi --- ...How to document Python code with Sphinx.md | 90 +++++++++---------- 1 file changed, 42 insertions(+), 48 deletions(-) diff --git a/translated/tech/20191121 How to document Python code with Sphinx.md b/translated/tech/20191121 How to document Python code with Sphinx.md index 8c7cc395ad..7a92838f74 100644 --- a/translated/tech/20191121 How to document Python code with Sphinx.md +++ b/translated/tech/20191121 How to document Python code with Sphinx.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to document Python code with Sphinx) @@ -9,17 +9,17 @@ 如何使用 Sphinx 给 Python 代码写文档 ====== -最好将文档作为开发过程的一部分。Sphinx 加上 Tox,让文档可以轻松书写,并且外观漂亮。 + +> 最好将文档作为开发过程的一部分。Sphinx 加上 Tox,让文档可以轻松书写,并且外观漂亮。 + ![Python in a coffee cup.][1] -Python 代码可以在源码中包含文档。这种方式默认依靠 **docstring**,它以三引号格式定义。虽然文档的价值是很大的,但是代码没有充足的文档还是很常见。让我们演练一个场景,了解出色的文档的强大功能。 - -经历了太多白板技术面试,要求你实现斐波那契数列,你已经受够了。你回家用 Python 写了一个可重用的斐波那契计算器,使用浮点技巧来实现 O(1) 复杂度。 +Python 代码可以在源码中包含文档。这种方式默认依靠 **docstring**,它以三引号格式定义。虽然文档的价值是很大的,但是没有充足的文档的代码还是很常见。让我们演练一个场景,了解出色的文档的强大功能。 +经历了太多在白板技术面试上要求你实现斐波那契数列,你已经受够了。你回家用 Python 写了一个可重用的斐波那契计算器,使用浮点技巧来实现 `O(1)` 复杂度。 代码很简单: - ``` # fib.py import math @@ -33,8 +33,7 @@ def approx_fib(n): (该斐波那契数列是四舍五入到最接近的整数的几何序列,这是我最喜欢的鲜为人知的数学事实之一。) -作为一个好人,你可以将代码开源,并将它放在 [PyPI][2] 上。setup.py 文件很简单: - +作为一个好人,你可以将代码开源,并将它放在 [PyPI][2] 上。`setup.py` 文件很简单: ``` import setuptools @@ -47,7 +46,7 @@ setuptools.setup( ) ``` -但是,没有文档的代码是没有用的。因此,你可以向函数添加 docstring。我最喜欢的 docstring 样式之一是 [“Google” 样式][3]。标记很轻量,这在它位于源代码中时很好。 +但是,没有文档的代码是没有用的。因此,你可以向函数添加 docstring。我最喜欢的 docstring 样式之一是 [“Google” 样式][3]。标记很轻量,当它放在源代码中时很好。 ``` @@ -64,10 +63,9 @@ def approx_fib(n): # ... ``` -但是函数的文档只是成功的一半。普通文档对于情境化代码用法很重要。在这种情况下,上下文是恼人的技术面试。 - -有一种添加更多文档的方式,Pythonic 模式通常是在 **docs/** 添加 **rst** 文件 ( [reStructuredText][4] 的缩写)。因此**docs/index.rst** 文件最终看起来像这样: +但是函数的文档只是成功的一半。普通文档对于情境化代码用法很重要。在这种情况下,情景是恼人的技术面试。 +有一种添加更多文档的方式,专业 Python 人的方式通常是在 `docs/` 添加 rst 文件( [reStructuredText][4] 的缩写)。因此 `docs/index.rst` 文件最终看起来像这样: ``` Fibonacci @@ -86,21 +84,17 @@ fib off. :members: ``` -我们完成了,对吧?我们已经将文本放在了文件中。人们应该看看。 +我们完成了,对吧?我们已经将文本放在了文件中。人们应该会看的。 ### 使 Python 文档更漂亮 为了使你的文档看起来更漂亮,你可以利用 [Sphinx][5],它旨在制作漂亮的 Python 文档。这三个 Sphinx 扩展特别有用: -* **sphinx.ext.autodoc**:从模块内部获取文档 - * **sphinx.ext.napoleon**:支持 Google 样式的 docstring - * **sphinx.ext.viewcode**:将 ReStructured Text 源码与生成的文档打包在一起 - - - - -为了告诉 Sphinx 该生成什么以及如何生成,我们在 **docs/conf.py** 中配置一个辅助文件: +* `sphinx.ext.autodoc`:从模块内部获取文档 +* `sphinx.ext.napoleon`:支持 Google 样式的 docstring +* `sphinx.ext.viewcode`:将 ReStructured Text 源码与生成的文档打包在一起 +为了告诉 Sphinx 该生成什么以及如何生成,我们在 `docs/conf.py` 中配置一个辅助文件: ``` extensions = [ @@ -108,12 +102,12 @@ extensions = [ 'sphinx.ext.napoleon', 'sphinx.ext.viewcode', ] -# The name of the entry point, without the ".rst" extension. -# By convention this will be "index" +# 该入口点的名称,没有 .rst 扩展名。 +# 惯例该名称是 index master_doc = "index" -# This values are all used in the generated documentation. -# Usually, the release and version are the same, -# but sometimes we want to have the release have an "rc" tag. +# 这些值全部用在生成的文档当中。 +# 通常,发布(release)与版本(version)是一样的, +# 但是有时候我们会有带有 rc 标签的发布。 project = "Fib" copyright = "2019, Moshe Zadka" author = "Moshe Zadka" @@ -122,43 +116,43 @@ version = release = "2019.1.0" 此文件使我们可以使用所需的所有元数据来发布代码,并注意扩展名(上面的注释说明了方式)。最后,要确保生成我们想要的文档,请使用 [Tox][6] 管理虚拟环境以确保我们顺利生成文档: - ``` [tox] -# By default, .tox is the directory. -# Putting it in a non-dot file allows opening the generated -# documentation from file managers or browser open dialogs -# that will sometimes hide dot files. +# 默认情况下,`.tox` 是该目录。 +# 将其放在非点文件中可以从 +# 文件管理器或浏览器的 +# 打开对话框中打开生成的文档, +# 这些对话框有时会隐藏点文件。 toxworkdir = {toxinidir}/build/tox [testenv:docs] -# Running sphinx from inside the "docs" directory -# ensures it will not pick up any stray files that might -# get into a virtual environment under the top-level directory -# or other artifacts under build/ +# 从 `docs` 目录内运行 `sphinx`, +# 以确保它不会拾取任何可能进入顶层目录下的 +# 虚拟环境或 `build/` 目录下的其他工件的杂散文件。 changedir = docs -# The only dependency is sphinx -# If we were using extensions packaged separately, -# we would specify them here. -# A better practice is to specify a specific version of sphinx. +# 唯一的依赖关系是 `sphinx`。 +# 如果我们使用的是单独打包的扩展程序, +# 我们将在此处指定它们。 +# 更好的做法是指定特定版本的 sphinx。 deps = sphinx -# This is the sphinx command to generate HTML. -# In other circumstances, we might want to generate a PDF or an ebook +# 这是用于生成 HTML 的 `sphinx` 命令。 +# 在其他情况下,我们可能想生成 PDF 或电子书。 commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html -# We use Python 3.7. Tox sometimes tries to autodetect it based on the name of -# the testenv, but "docs" does not give useful clues so we have to be explicit. +# 我们使用 Python 3.7。 +# Tox 有时会根据 testenv 的名称尝试自动检测它, +# 但是 `docs` 没有给出有用的线索,因此我们必须明确它。 basepython = python3.7 ``` -现在,无论何时运行T ox,它都会为你的 Python 代码生成漂亮的文档。 +现在,无论何时运行 Tox,它都会为你的 Python 代码生成漂亮的文档。 ### 在 Python 中写文档很好 -作为 Python 开发人员,我们可以使用的工具链很棒。 我们可以从 **docstring** 开始,添加 **.rst** 文件,然后添加 Sphinx 和 Tox 来为用户美化结果。 +作为 Python 开发人员,我们可以使用的工具链很棒。我们可以从 **docstring** 开始,添加 .rst 文件,然后添加 Sphinx 和 Tox 来为用户美化结果。 -你对好的文档有何评价? 你还有其他喜欢的方式么? 请在评论中分享它们! +你对好的文档有何评价?你还有其他喜欢的方式么?请在评论中分享它们! -------------------------------------------------------------------------------- @@ -167,7 +161,7 @@ via: https://opensource.com/article/19/11/document-python-sphinx 作者:[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/) 荣誉推出 @@ -178,4 +172,4 @@ via: https://opensource.com/article/19/11/document-python-sphinx [3]: http://google.github.io/styleguide/pyguide.html#381-docstrings [4]: http://docutils.sourceforge.net/rst.html [5]: http://www.sphinx-doc.org/en/master/ -[6]: https://tox.readthedocs.io/en/latest/ \ No newline at end of file +[6]: https://tox.readthedocs.io/en/latest/ From d20002746abb747789b290d819533e9241f2aba8 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 29 Nov 2019 16:38:38 +0800 Subject: [PATCH 692/800] PUB @geekpi https://linux.cn/article-11624-1.html --- .../20191121 How to document Python code with Sphinx.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191121 How to document Python code with Sphinx.md (98%) diff --git a/translated/tech/20191121 How to document Python code with Sphinx.md b/published/20191121 How to document Python code with Sphinx.md similarity index 98% rename from translated/tech/20191121 How to document Python code with Sphinx.md rename to published/20191121 How to document Python code with Sphinx.md index 7a92838f74..3b14624f5d 100644 --- a/translated/tech/20191121 How to document Python code with Sphinx.md +++ b/published/20191121 How to document Python code with Sphinx.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11624-1.html) [#]: subject: (How to document Python code with Sphinx) [#]: via: (https://opensource.com/article/19/11/document-python-sphinx) [#]: author: (Moshe Zadka https://opensource.com/users/moshez) From 978bd485b5d9f5b8a12f50e441e5072a57de3e9c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sat, 30 Nov 2019 00:53:56 +0800 Subject: [PATCH 693/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191129=20A=20qu?= =?UTF-8?q?ick=20introduction=20to=20Toolbox=20on=20Fedora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191129 A quick introduction to Toolbox on Fedora.md --- ...quick introduction to Toolbox on Fedora.md | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 sources/tech/20191129 A quick introduction to Toolbox on Fedora.md diff --git a/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md b/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md new file mode 100644 index 0000000000..788d7e646d --- /dev/null +++ b/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A quick introduction to Toolbox on Fedora) +[#]: via: (https://fedoramagazine.org/a-quick-introduction-to-toolbox-on-fedora/) +[#]: author: (Ryan Walter https://fedoramagazine.org/author/rwaltr/) + +A quick introduction to Toolbox on Fedora +====== + +![][1] + +Toolbox allows you to [sort and manage your development environments in containers][2] without requiring root privileges or manually attaching volumes. It creates a container where you can install your own CLI tools, without installing them on the base system itself. You can also utilize it when you do not have root access or cannot install programs directly. This article gives you an introduction to toolbox and what it does. + +### Installing Toolbox + +[Silverblue][3] includes Toolbox by default. For the Workstation and Server editions, you can grab it from the default repositories using _dnf install toolbox_. + +### Creating Toolboxes + +Open your terminal and run _toolbox enter_. The utility will automatically request permission to download the latest image, create your first container, and place your shell inside this container. + +``` +$ toolbox enter +No toolbox containers found. Create now? [y/N] y +Image required to create toolbox container. +Download registry.fedoraproject.org/f30/fedora-toolbox:30 (500MB)? [y/N]: y +``` + +Currently there is no difference between the toolbox and your base system. Your filesystems and packages appear unchanged. Here is an example using a repository that contains documentation source for a resume under a _~/src/resume_ folder. The resume is built using the _pandoc_ tool. + +``` +$ pwd +/home/rwaltr +$ cd src/resume/ +$ head -n 5 Makefile +all: pdf html rtf text docx + +pdf: init + pandoc -s -o BUILDS/resume.pdf markdown/* + +$ make pdf +bash: make: command not found +$ pandoc -v +bash: pandoc: command not found +``` + +This toolbox does not have the programs required to build the resume. You can remedy this by installing the tools with _dnf_. You will not be prompted for the root password, because you are running in a container. + +``` +$ sudo dnf groupinstall "Authoring and Publishing" -y && sudo dnf install pandoc make -y +... +$ make all #Successful builds +mkdir -p BUILDS +pandoc -s -o BUILDS/resume.pdf markdown/* +pandoc -s -o BUILDS/resume.html markdown/* +pandoc -s -o BUILDS/resume.rtf markdown/* +pandoc -s -o BUILDS/resume.txt markdown/* +pandoc -s -o BUILDS/resume.docx markdown/* +$ ls BUILDS/ +resume.docx resume.html resume.pdf resume.rtf resume.txt +``` + +Run _exit_ at any time to exit the toolbox. + +``` +$ cd BUILDS/ +$ pandoc --version || ls +pandoc 2.2.1 +Compiled with pandoc-types 1.17.5.4, texmath 0.11.1.2, skylighting 0.7.5 +... +for a particular purpose. +resume.docx resume.html resume.pdf resume.rtf resume.txt +$ exit +logout +$ pandoc --version || ls +bash: pandoc: command not found... +resume.docx resume.html resume.pdf resume.rtf resume.txt +``` + +You retain the files created by your toolbox in your home directory. None of the programs installed in your toolbox will be available outside of it. + +### Tips and tricks + +This introduction to toolbox only scratches the surface. Here are some additional tips, but you can also check out [the official documentation][2]. + + * _Toolbox –help_ will show you the man page for Toolbox + * You can have multiple toolboxes at once. Use _toolbox create -c Toolboxname_ and _toolbox enter -c Toolboxname_ + * Toolbox uses [Podman][4] to do the heavy lifting. Use _toolbox list_ to find the IDs of the containers Toolbox creates. Podman can use these IDs to perform actions such as _rm_ and _stop_. (You can also read more about Podman [in this Magazine article][5].) + + + +* * * + +_Photo courtesy of [Florian Richter][6] from [Flickr][7]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/a-quick-introduction-to-toolbox-on-fedora/ + +作者:[Ryan Walter][a] +选题:[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/rwaltr/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/toolbox-816x345.jpg +[2]: https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/ +[3]: https://fedoramagazine.org/what-is-silverblue/ +[4]: https://podman.io/ +[5]: https://fedoramagazine.org/running-containers-with-podman/ +[6]: https://flickr.com/photos/florianric/ +[7]: https://flickr.com/photos/florianric/7263382550/ From 1c7daaf6657c0c609c2d5581198c7ec2005e6ffd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 09:51:04 +0800 Subject: [PATCH 694/800] PRF @geekpi --- ...all VirtualBox 6.0 on CentOS 8 - RHEL 8.md | 61 ++++++++----------- 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md b/translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md index e1b325f4d4..dc7966538a 100644 --- a/translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md +++ b/translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install VirtualBox 6.0 on CentOS 8 / RHEL 8) @@ -10,27 +10,29 @@ 如何在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 ====== -**VirtualBox** 是一款免费的开源**虚拟化工具**,它允许技术人员同时运行多个不同风格的虚拟机。它通常用于运行桌面(Linux 和 Windows),当人们尝试探索新的 Linux 发行版的功能或希望在 VM 中安装 **OpenStack**、**Ansible** 和 **Puppet** 等软件时,它会非常方便,在这种情况下,我们可以使用 VirtualBox 启动 VM。 +![](https://img.linux.net.cn/data/attachment/album/201911/30/095031gbnm59ux0dw979wb.jpg) -VirtualBox 被分类为**2 类虚拟机管理程序**,这意味着它需要一个现有的操作系统,在上面安装 VirtualBox 软件。VirtualBox 提供功能来创建本机网络或 NAT 网络。在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 系统上安装最新版本的 VirtualBox 6.0,并演示如何安装 VirtualBox 扩展。 +VirtualBox 是一款自由开源的虚拟化工具,它允许技术人员同时运行多个不同风格的虚拟机(VM)。它通常用于运行桌面(Linux 和 Windows),当人们尝试探索新的 Linux 发行版的功能或希望在 VM 中安装 OpenStack、Ansible 和 Puppet 等软件时,它会非常方便,在这种情况下,我们可以使用 VirtualBox 启动 VM。 + +VirtualBox 被分类为 2 类虚拟机管理程序,这意味着它需要一个现有的操作系统,在上面安装 VirtualBox 软件。VirtualBox 提供功能来创建本机网络或 NAT 网络。在本文中,我们将演示如何在 CentOS 8 和 RHEL 8 系统上安装最新版本的 VirtualBox 6.0,并演示如何安装 VirtualBox 扩展。 ### 在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 的安装步骤 #### 步骤 1: 启用 VirtualBox 和 EPEL 仓库 -登录到你的 CentOS 8 或 RHEL 8 系统并打开终端,执行以下命令并启用 VirtualBox 和 EPEL 包仓库。 +登录到你的 CentOS 8 或 RHEL 8 系统并打开终端,执行以下命令并启用 VirtualBox 和 EPEL 包仓库: ``` [root@linuxtechi ~]# dnf config-manager --add-repo=https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo ``` -使用以下 rpm 命令导入 Oracle VirtualBox 公钥 +使用以下 `rpm` 命令导入 Oracle VirtualBox 公钥: ``` [root@linuxtechi ~]# rpm --import https://www.virtualbox.org/download/oracle_vbox.asc ``` -使用以下 dnf 命令启用 EPEL 仓库, +使用以下 `dnf` 命令启用 EPEL 仓库: ``` [root@linuxtechi ~]# dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y @@ -38,17 +40,17 @@ VirtualBox 被分类为**2 类虚拟机管理程序**,这意味着它需要一 #### 步骤 2: 安装 VirtualBox 构建工具和依赖项 -运行以下命令来安装所有 VirtualBox 构建工具和依赖项, +运行以下命令来安装所有 VirtualBox 构建工具和依赖项: ``` [root@linuxtechi ~]# dnf install binutils kernel-devel kernel-headers libgomp make patch gcc glibc-headers glibc-devel dkms -y ``` -成功安装上面的依赖项和构建工具后,使用 dnf 命令继续安装 VirtualBox, +成功安装上面的依赖项和构建工具后,使用 `dnf` 命令继续安装 VirtualBox。 #### 步骤 3: 在 CentOS 8 / RHEL 8 上安装 VirtualBox 6.0 -如果希望在安装之前列出 VirtualBox 的可用版本,请执行以下 [dnf 命令][1], +如果希望在安装之前列出 VirtualBox 的可用版本,请执行以下 dnf 命令: ``` [root@linuxtechi ~]# dnf search virtualbox @@ -59,13 +61,13 @@ VirtualBox-6.0.x86_64 : Oracle VM VirtualBox [root@linuxtechi ~]# ``` -让我们使用以下 dnf 命令安装最新版本的 VirtualBox 6.0, +让我们使用以下 `dnf` 命令安装最新版本的 VirtualBox 6.0: ``` [root@linuxtechi ~]# dnf install VirtualBox-6.0 -y ``` -如果有本地用户希望将 usb 设备连接到 VirtualBox VM,那么他/她应该是 “**vboxusers**” 组的一员,请使用下面的 usermod 命令将本地用户添加到 “vboxusers” 组。 +如果有本地用户希望将 usb 设备连接到 VirtualBox VM,那么他/她应该是 `vboxusers` 组的一员,请使用下面的 `usermod` 命令将本地用户添加到 `vboxusers` 组。 ``` @@ -74,7 +76,7 @@ VirtualBox-6.0.x86_64 : Oracle VM VirtualBox #### 步骤 4: 访问 CentOS 8 / RHEL 8 上的 VirtualBox -有两种方法可以访问 VirtualBox,在命令行输入 “**virtualbox**” 然后回车: +有两种方法可以访问 VirtualBox,在命令行输入 `virtualbox` 然后回车: ``` [root@linuxtechi ~]# virtualbox @@ -82,11 +84,11 @@ VirtualBox-6.0.x86_64 : Oracle VM VirtualBox 在桌面环境中,在搜索框中搜索 “VirtualBox”。 -[![Access-VirtualBox-CentOS8][2]][3] +![Access-VirtualBox-CentOS8][3] -单击 VirtualBox 图标, +单击 VirtualBox 图标: -[![VirtualBox-CentOS8][2]][4] +![VirtualBox-CentOS8][4] 这确认 VirtualBox 6.0 已成功安装,让我们安装它的扩展包。 @@ -100,37 +102,28 @@ VirtualBox-6.0.x86_64 : Oracle VM VirtualBox * Intel PXE 启动 * 主机网络摄像头 - - -使用下面的 wget 命令下载 Virtualbox 扩展包到下载文件夹中, +使用下面的 `wget` 命令下载 Virtualbox 扩展包到下载文件夹中: ``` [root@linuxtechi ~]$ cd Downloads/ [root@linuxtechi Downloads]$ wget https://download.virtualbox.org/virtualbox/6.0.14/Oracle_VM_VirtualBox_Extension_Pack-6.0.14.vbox-extpack ``` -下载后,打开 VirtualBox 并依次点击 **File** –>**Preferences** –> **Extension**,然后点击 “+” 号图标添加下载的扩展包, +下载后,打开 VirtualBox 并依次点击 “File -> Preferences -> Extension”,然后点击 “+” 号图标添加下载的扩展包: -[![Install-VirtualBox-Extension-Pack-CentOS8][2]][5] +![Install-VirtualBox-Extension-Pack-CentOS8][5] -单击 “Install” 开始安装扩展包。 +单击 “Install” 开始安装扩展包: -[![Accept-VirtualBox-Extension-Pack-License-CentOS8][2]][6] +![Accept-VirtualBox-Extension-Pack-License-CentOS8][6] -单击 "I Agree" 接受 VirtualBox 扩展包许可证。 +单击 “I Agree” 接受 VirtualBox 扩展包许可证。 -成功安装 VirtualBox 扩展包后,我们将看到下面的页面,单击 OK 并开始使用 VirtualBox。 - -[![VirtualBox-Extension-Pack-Install-Message-CentOS8][2]][7] - -本文就是这些了,我希望这些步骤可以帮助你在 CentOS 8 和 RHEL 8 系统上安装 VirtualBox 6.0。请分享你的宝贵反馈和意见。 - - * [Facebook][9] - * [Twitter][10] - * [LinkedIn][11] - * [Reddit][12] +成功安装 VirtualBox 扩展包后,我们将看到下面的页面,单击 “OK” 并开始使用 VirtualBox。 +![VirtualBox-Extension-Pack-Install-Message-CentOS8][7] +本文就是这些了,我希望这些步骤可以帮助你在 CentOS 8 和 RHEL 8 系统上安装 VirtualBox 6.0。请分享你的宝贵的反馈和意见。 -------------------------------------------------------------------------------- @@ -139,7 +132,7 @@ via: https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/ 作者:[Pradeep Kumar][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 13a980a72aa9a0086f5fed8d7562ea2fb5c3c693 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 09:53:21 +0800 Subject: [PATCH 695/800] PUB @geekpi https://linux.cn/article-11627-1.html --- ...1117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md (98%) diff --git a/translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md b/published/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md similarity index 98% rename from translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md rename to published/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md index dc7966538a..be7b3f9d4f 100644 --- a/translated/tech/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md +++ b/published/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11627-1.html) [#]: subject: (How to Install VirtualBox 6.0 on CentOS 8 / RHEL 8) [#]: via: (https://www.linuxtechi.com/install-virtualbox-6-centos-8-rhel-8/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) From 612dce1c770de896eb584c896d1e77828cac2eae Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 12:13:28 +0800 Subject: [PATCH 696/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @Morisun029 应选择自己熟悉的主题来翻译,如果不太熟悉,请做些研究工作才能专业。 --- .../tech/20191107 Demystifying Kubernetes.md | 199 +++++++++--------- 1 file changed, 101 insertions(+), 98 deletions(-) diff --git a/translated/tech/20191107 Demystifying Kubernetes.md b/translated/tech/20191107 Demystifying Kubernetes.md index 396fac1f8e..43f35e59d8 100644 --- a/translated/tech/20191107 Demystifying Kubernetes.md +++ b/translated/tech/20191107 Demystifying Kubernetes.md @@ -10,204 +10,205 @@ 揭开 Kubernetes 的神秘面纱 ====== -[![][1]][2] +![][2] -_Kubernetes 是一款生产级的开源系统,用于容器化应用程序的自动部署,扩展和管理。本文关于使用 Kubernetes 来管理容器。_ +> Kubernetes 是一款生产级的开源系统,用于容器化应用程序的自动部署、扩展和管理。本文关于使用 Kubernetes 来管理容器。 + “容器”已成为最新的流行语之一。但是,这个词到底意味着什么呢?说起“容器”,人们通常会把它和 Docker 联系起来,Docker 是一个被定义为软件的标准化单元容器。该容器将软件和运行软件所需的环境封装到一个易于交付的单元中。 + +容器是一个软件的标准单元,用它来打包代码及其所有依赖项,这样应用程序就可以从一个计算环境到另一个计算环境快速可靠地运行。容器通过创建类似于 ISO 镜像的方式来实现此目的。容器镜像是一个轻量级的、独立的、可执行的软件包,其中包含运行应用程序所需的所有信息,包括代码、运行时、系统工具、系统库和设置。 - “容器”已成为最新的流行语之一。 但是,这个词到底意味着什么呢? 说起“容器”,人们通常会把它和 Docker 联系起来,Docker 是一个被定义为软件的标准化单元容器。 该容器将软件和运行软件所需的环境封装到一个易于交付的单元中。 容器是一个软件的标准单元,用它来打包代码及其所有依赖项,这样应用程序就可以从一个计算环境快速可靠地运行到另一个计算环境。 容器通过创建类似于ISO 映像的方式来实现此目的。 容器镜像是一个轻量级的,独立的,可执行的软件包,其中包含运行应用程序所需的所有信息,包括代码,运行时,系统工具,系统库和设置。 +容器镜像在运行时变成容器,对于 Docker 容器,镜像在 Docker 引擎上运行时变成容器。容器将软件与环境隔离开来,确保不同环境下的实例,都可以正常运行。 -容器镜像在运行时变成容器,对于Docker 容器,映像在 Docker 引擎上运行时变成容器。 容器将软件与环境隔离开来,确保不同环境下的实例,都可以正常运行。 +###什么是容器管理? -**什么是容器管理?** -容器管理是组织,添加或替换大量软件容器的过程。 容器管理使用软件来自动化创建,部署和扩展容器。 这一过程就需要容器编排。容器编排是一个基于应用程序进行自动部署,管理,扩展,联网的可用容器。 +容器管理是组织、添加或替换大量软件容器的过程。容器管理使用软件来自动化创建、部署和扩展容器。这一过程就需要容器编排,容器编排是一个自动对基于容器的应用程序进行部署、管理、扩展、联网和提供可用性的工具。 -**Kubernetes** -Kubernetes 是一个可移植的,可扩展的开源平台,用于管理容器化的工作负载和服务,它有助于配置和自动化。 它最初由 Google 开发, 拥有一个庞大且快速增长的生态系统。 Kubernetes 的服务,技术支持和工具得到广泛应用。 +### Kubernetes + +Kubernetes 是一个可移植的、可扩展的开源平台,用于管理容器化的工作负载和服务,它有助于配置和自动化。它最初由 Google 开发,拥有一个庞大且快速增长的生态系统。Kubernetes 的服务、技术支持和工具得到广泛应用。 + +Google 在 2014 年开源了 Kubernetes 项目。Kubernetes 建立在 Google 十五年大规模运行生产工作负载的经验基础上,并结合了社区中最好的想法和实践以及声明式句法的使用。 -Google 在2014年将 Kubernetes 项目开源化。Kubernetes 建立在 Google 十五年大规模运行生产工作负载的经验基础上并结合了社区中最好的想法和实践以及声明式句法的使用。 下面列出了与Kubernetes生态系统相关的一些常用术语。 -_**Pods:**_ pod 是 Kubernetes 应用程序的基本执行单元,是你创建或部署的 Kubernetes 对象模型中的最小和最简单的单元。pod 代表在 Kubernetes 集群上运行的进程。 -Pod 将运行中的容器,存储,网络IP(唯一)和控制容器应如何运行的命令封装起来。它代表 Kubernetes 生态系统内的单个部署单元,代表一个应用程序的单个实例,该程序可能包含一个或多个紧密耦合并共享资源的容器。 +**Pod**:Pod 是 Kubernetes 应用程序的基本执行单元,是你创建或部署的 Kubernetes 对象模型中的最小和最简单的单元。Pod 代表在 Kubernetes 集群上运行的进程。 -Kubernetes 集群中的Pod有两种主要的使用方式。 第一种是运行单个容器。 即“一个容器一个pod”,这种方式是最常见的。 第二种是运行多个需要一起工作的容器。 -Pod 可能封装一个应用程序,该应用程序由紧密关联且需要共享资源的多个同位容器组成。 +Pod 将运行中的容器、存储、网络 IP(唯一)和控制容器应如何运行的命令封装起来。它代表 Kubernetes 生态系统内的单个部署单元,代表一个应用程序的单个实例,该程序可能包含一个或多个紧密耦合并共享资源的容器。 -_**ReplicaSet:**_ ReplicaSet 的目的是维护在任何给定时间运行的一组稳定的副本容器集。 ReplicaSet 包含有关一个特定 Pod 应该运行多少个副本的信息。 为了创建多个Pod 以匹配 ReplicaSet 条件,Kubernetes 使用 Pod 模板。 ReplicaSet 与其 pod 的链接是通过后者的 metas.ownerReferences 字段实现,该字段指定哪个资源拥有当前对象。 +Kubernetes 集群中的 Pod 有两种主要的使用方式。第一种是运行单个容器。即“一个容器一个 Pod”,这种方式是最常见的。第二种是运行多个需要一起工作的容器。 -_**Services:**_ 服务是公开一组 Pod 功能的抽象。 使用 Kubernetes,你无需修改应用程序即可使用陌生的服务发现机制。 Kubernetes 为 Pod 提供了自己的IP地址和一组Pod 的单个DNS 名称,并且可以在它们之间负载平衡。 +Pod 可能封装一个由紧密关联且需要共享资源的多个同位容器组成的应用程序。 -服务解决的一个主要问题是Web应用程序前端和后端的集成。 由于 Kubernetes 将幕后 IP 地址提供给 Pod,因此当 Pod 被杀死并复活时,IP 地址会更改。 这给给定的后端 IP 地址连接到相应的前端 IP 地址带来一个大问题。 服务通过在 Pod 上提供抽象来解决此问题,类似于负载均衡器。 +副本集ReplicaSet:副本集的目的是维护在任何给定时间运行的一组稳定的副本容器集。 副本集包含有关一个特定 Pod 应该运行多少个副本的信息。为了创建多个 Pod 以匹配副本集条件,Kubernetes 使用 Pod 模板。副本集与其 Pod 的链接是通过后者的 `metas.ownerReferences` 字段实现,该字段指定哪个资源拥有当前对象。 -_**Volumes:**_ Kubernetes Volumes 具有明确的生命周期-与包围它的 Pod 相同。 因此,Volumes 超过了pod 中运行的任何容器的寿命,并且在容器重新启动后保留了数据。 当然,当 pod 不存在时,该体积也将不再存在。 也许比这更重要的是 Kubernetes 支持多种类型的 Volumes,并且 Pod 可以同时使用任意数量的 Volumes。 +服务Services:服务是一种抽象,用来公开一组 Pod 功能。使用 Kubernetes,你无需修改应用程序即可使用陌生服务发现机制。Kubernetes 给 Pod 提供了其自己的 IP 地址和一组 Pod 的单个 DNS 名称,并且可以在它们之间负载平衡。 -Volumes 的核心只是一个目录,其中可能包含一些数据,pod 中的容器可以访问该目录。 该目录是如何产生的, 它后端基于什么存储介质,其中的数据内容是什么,这些都由使用的特定 volumes 类型来决定的。 +服务解决的一个主要问题是 Web 应用程序前端和后端的集成。由于 Kubernetes 将幕后的 IP 地址提供给 Pod,因此当 Pod 被杀死并复活时,IP 地址会更改。这给给定的后端 IP 地址连接到相应的前端 IP 地址带来一个大问题。服务通过在 Pod 上提供抽象来解决此问题,类似于负载均衡器。 -**为什么选择 Kubernetes?** -容器是捆绑和运行应用程序的好方法。 在生产环境中,你需要管理运行应用程序的容器,并确保没有停机时间。 例如,如果一个容器发生故障,则需要启动另一个容器。 如果由系统自动实现这一操作,岂不是更好? Kubernetes 就是来解决这个问题的! Kubernetes 提供了一个框架来弹性运行分布式系统。 该框架负责扩展需求,故障转移,部署模式等。 例如,Kubernetes 可以轻松管理系统的 Canary 部署。 +Volumes: Kubernetes 卷具有明确的生命周期,与围绕它的 Pod 相同。 因此,卷超过了 Pod 中运行的任何容器的寿命,并且在容器重新启动后保留了数据。当然,当 Pod 不存在时,该卷也将不再存在。也许比这更重要的是 Kubernetes 支持多种类型的卷,并且 Pod 可以同时使用任意数量的卷。 + +卷的核心只是一个目录,其中可能包含一些数据,Pod 中的容器可以访问该目录。该目录是如何产生的,它后端基于什么存储介质,其中的数据内容是什么,这些都由使用的特定卷类型来决定的。 + +### 为什么选择 Kubernetes? + +容器是捆绑和运行应用程序的好方法。在生产环境中,你需要管理运行应用程序的容器,并确保没有停机时间。例如,如果一个容器发生故障,则需要启动另一个容器。如果由系统自动实现这一操作,岂不是更好? Kubernetes 就是来解决这个问题的!Kubernetes 提供了一个框架来弹性运行分布式系统。该框架负责扩展需求、故障转移、部署模式等。例如,Kubernetes 可以轻松管理系统的金丝雀部署。 Kubernetes 为用户提供了: -1\. 服务发现和负载平衡 -2\. 存储编排 -3\. 自动退出和回退 -4\. 自动打包 -5\. 自我修复 -6\. 秘密配置管理 -**Kubernetes 可以做什么?** +1. 服务发现和负载平衡 +2. 存储编排 +3. 自动退出和回退 +4. 自动打包 +5. 自我修复 +6. 秘密配置管理 + +### Kubernetes 可以做什么? 在本文中,我们将会看到一些从头构建 Web 应用程序时如何使用 Kubernetes 的代码示例。我们将在 Python 中使用 Flask 创建一个简单的后端服务器。 + 对于那些想从头开始构建 Web 应用程序的人,有一些前提条件,即: -1\. 对 Docker,Docker 容器和 Docker 映像的基本了解。可以访问该网站 - __快速了解。 -2\. 系统中应该安装Docker。 -3\. 系统中应该安装Kubernetes,有关如何在本地计算机上安装的说明,请访问网站 __. +1. 对 Docker、Docker 容器和 Docker 镜像的基本了解。可以访问[这里][8]快速了解。 +2. 系统中应该安装 Docker。 +3. 系统中应该安装 Kubernetes,有关如何在本地计算机上安装的说明,请访问[这里][9]。 现在,创建一个目录,如下代码片段所示: + ``` mkdir flask-kubernetes/app && cd flask-kubernetes/app ``` -接下来,在 _flask-kubernetes/app_ 目录中,创建一个名为 main.py 的文件,如下面的代码片段所示: +接下来,在 `flask-kubernetes/app` 目录中,创建一个名为 `main.py` 的文件,如下面的代码片段所示: + ``` touch main.py ``` -在新创建的 _main.py,_ 文件中,粘贴下面代码: +在新创建的 `main.py` 文件中,粘贴下面代码: ``` from flask import Flask app = Flask(__name__) - + @app.route("/") def hello(): -return "Hello from Kubernetes!" - + return "Hello from Kubernetes!" + if __name__ == "__main__": -app.run(host='0.0.0.0') + app.run(host='0.0.0.0') ``` -使用下面命令在本地安装 Flask: +使用下面命令在本地安装 Flask: ``` pip install Flask==0.10.1 ``` Flask 安装后,执行下面的命令: + ``` python app.py ``` - -应该在本地运行Flask服务器,Flask应用程序的默认端口是5000,并且你可以在 * 上看到输出‘Hello from Kubernetes!’。 一旦服务器在本地运行,我们就创建一个供 Kubernetes 使用的 Docker 映像。 创建一个名为 Dockerfile 的文件,并将以下代码片段粘贴到其中: - +应该在本地 5000 端口运行 Flask 服务器,这是 Flask 应用程序的默认端口,并且你可以在 http://localhost:5000 上看到输出 “Hello from Kubernetes!”。服务器在本地运行之后,我们创建一个供 Kubernetes 使用的 Docker 镜像。创建一个名为 `Dockerfile` 的文件,并将以下代码片段粘贴到其中: ``` FROM python:3.7 - + RUN mkdir /app WORKDIR /app ADD . /app/ RUN pip install -r requirements.txt - + EXPOSE 5000 CMD ["python", "/app/main.py"] ``` -_Dockerfile_文件的说明如下: +`Dockerfile` 文件的说明如下: -1\. Docker 将从 Docker 集线器获取 Python 3.7 映像。 -2\. 将在映像中创建一个应用程序目录。 -3\. 它将一个应用程序设置为工作目录。 -4\. 将内容从主机中的应用程序目录复制到映像应用程序目录。 -5\. 暴露端口5000。 -6\. 最后,它运行命令,启动 Flask 服务器。 -接下来,我们将使用以下命令创建 Docker 映像: +1. Docker 将从 DockerHub 获取 Python 3.7 镜像。 +2. 将在镜像中创建一个应用程序目录。 +3. 它将一个 `/app` 目录设置为工作目录。 +4. 将内容从主机中的应用程序目录复制到镜像应用程序目录。 +5. 发布端口 5000。 +6. 最后,它运行命令,启动 Flask 服务器。 + +接下来,我们将使用以下命令创建 Docker 镜像: ``` docker build -f Dockerfile -t flask-kubernetes:latest . ``` -创建Docker映像后,我们可以使用以下命令在本地运行该映像进行测试: +创建 Docker 镜像后,我们可以使用以下命令在本地运行该镜像进行测试: ``` docker run -p 5001:5000 flask-kubernetes ``` -通过运行容器在本地完成测试之后,我们需要在 Kubernetes 中部署它。 我们将首先使用 kubectl 命令验证 Kubernetes 是否正在运行。 如果没有报错,则说明它正在工作。 如果有报错,请参考该网站信息: __. +通过运行容器在本地完成测试之后,我们需要在 Kubernetes 中部署它。我们将首先使用 `kubectl` 命令验证 Kubernetes 是否正在运行。如果没有报错,则说明它正在工作。如果有报错,请参考[该信息][9]。 -接下来, 我们创建一个部署文件。 这是一个Yaml文件,其中包含有关 Kubernetes 的说明,该说明涉及如何以声明性的方式创建 pod 和服务。 因为我们有 Flask Web 应用程序,我们将在其中包含 pod 和 services 声明的情况下创建一个deployment.yaml文件。 -创建一个名为 deployment.yaml 的文件并向其中添加以下内容,然后保存: +接下来,我们创建一个部署文件。这是一个 Yaml 文件,其中包含有关 Kubernetes 的说明,该说明涉及如何以声明性的方式创建 Pod 和服务。因为我们有 Flask Web 应用程序,我们将创建一个 `deployment.yaml` 文件,并在其中包含 Pod 和服务声明。 + +创建一个名为 `deployment.yaml` 的文件并向其中添加以下内容,然后保存: ``` apiVersion: v1 kind: Service metadata: -name: flask-kubernetes -service + name: flask-kubernetes -service spec: -selector: -app: flask-kubernetes -ports: -- protocol: "TCP" -port: 6000 -targetPort: 5000 -type: LoadBalancer - + selector: + app: flask-kubernetes + ports: + - protocol: "TCP" + port: 6000 + targetPort: 5000 + type: LoadBalancer --- apiVersion: apps/v1 kind: Deployment metadata: -name: flask-kubernetes + name: flask-kubernetes spec: -replicas: 4 -template: -metadata: -labels: -app: flask-kubernetes -spec: -containers: -- name: flask-kubernetes -image: flask-kubernetes:latest -imagePullPolicy: Never -ports: -- containerPort: 5000 + replicas: 4 + template: + metadata: + labels: + app: flask-kubernetes + spec: + containers: + - name: flask-kubernetes + image: flask-kubernetes:latest + imagePullPolicy: Never + ports: + - containerPort: 5000 ``` -使用以下命令将 yaml 文件发送到 Kubernete: +使用以下命令将 yaml 文件发送到 Kubernetes: ``` kubectl apply -f deployment.yaml ``` -如果执行以下命令,你会看到 pods 正在运行: +如果执行以下命令,你会看到 Pod 正在运行: ``` kubectl get pods ``` +现在,导航至 http://localhost:6000,你应该会看到 “Hello from Kubernetes!”消息。成功了! 该应用程序现在正在 Kubernetes 中运行! -现在,导航至__,你应该会看到‘Hello from Kubernetes!’消息。 成功了! 该应用程序现在正在 Kubernetes 中运行! +### Kubernetes 做不了什么? -**Kubernetes 做不了什么 ** -Kubernetes 不是一个传统的,包罗万象的 PaaS(平台即服务)系统。 由于 Kubernetes 运行在容器级别而非硬件级别,因此它提供了 PaaS 产品共有的一些普遍适用功能,如部署,扩展,负载平衡,日志记录和监控。 Kubernetes 为开发人员平台提供了构建块,但在重要的地方保留了用户的选择和灵活性。 +Kubernetes 不是一个传统的,包罗万象的 PaaS(平台即服务)系统。 由于 Kubernetes 运行在容器级别而非硬件级别,因此它提供了 PaaS 产品共有的一些普遍适用功能,如部署、扩展、负载平衡、日志记录和监控。Kubernetes 为开发人员平台提供了构建块,但在重要的地方保留了用户的选择和灵活性。 - * Kubernetes 不限制所支持的应用程序的类型。 如果应用程序可以在容器中运行,那么它应该可以在 Kubernetes 上更好地运行。 - * 它不部署和构建源代码。 - * 它不决定日志记录,监视或警报解决方案。 - * 它不提供或不要求配置语言/系统。 它提供了一个声明的API供所有人使用。 - * 它不提供或不采用任何全面的机器配置,维护,管理或自我修复系统。 - - -![Avatar][3] - -[Abhinav Nath Gupta][4] - -本文作者 Abhinav 是班加罗尔 Cleo 软件公司的一名软件开发工程师。他对密码学、数据安全、虚拟货币及云计算方面很感兴趣,可以通过 [abhi.aec89@gmail.com][5] 与他联系。. - -[![][6]][7] +* Kubernetes 不限制所支持的应用程序的类型。如果应用程序可以在容器中运行,那么它应该可以在 Kubernetes 上更好地运行。 +* 它不部署和构建源代码。 +* 它不决定日志记录、监视或警报解决方案。 +* 它不提供或不要求配置语言/系统。它提供了一个声明式的 API 供所有人使用。 +* 它不提供或不采用任何全面的机器配置、维护、管理或自我修复系统。 -------------------------------------------------------------------------------- @@ -215,8 +216,8 @@ via: https://opensourceforu.com/2019/11/demystifying-kubernetes/ 作者:[Abhinav Nath Gupta][a] 选题:[lujun9972][b] -译者:[Morisun029](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -229,3 +230,5 @@ via: https://opensourceforu.com/2019/11/demystifying-kubernetes/ [5]: mailto:abhi.aec89@gmail.com [6]: http://opensourceforu.com/wp-content/uploads/2013/10/assoc.png [7]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US +[8]: https://www.docker.com/sites/default/files/Docker_CheatSheet_08.09.2016_0.pdf +[9]: https://kubernetes.io/docs/setup/learning-environment/minikube/ From eff4b1393e75c1093efeed046f66aa2834d5217b Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 12:14:06 +0800 Subject: [PATCH 697/800] PUB @Morisun029 https://linux.cn/article-11628-1.html --- .../tech => published}/20191107 Demystifying Kubernetes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename {translated/tech => published}/20191107 Demystifying Kubernetes.md (99%) diff --git a/translated/tech/20191107 Demystifying Kubernetes.md b/published/20191107 Demystifying Kubernetes.md similarity index 99% rename from translated/tech/20191107 Demystifying Kubernetes.md rename to published/20191107 Demystifying Kubernetes.md index 43f35e59d8..f98c0d4387 100644 --- a/translated/tech/20191107 Demystifying Kubernetes.md +++ b/published/20191107 Demystifying Kubernetes.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11628-1.html) [#]: subject: (Demystifying Kubernetes) [#]: via: (https://opensourceforu.com/2019/11/demystifying-kubernetes/) [#]: author: (Abhinav Nath Gupta https://opensourceforu.com/author/abhinav-gupta/) From 2703941de569b3ec376a8467e8f4105d55eea22d Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sat, 30 Nov 2019 17:59:36 +0800 Subject: [PATCH 698/800] translating --- sources/tech/20191125 How to use loops in awk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191125 How to use loops in awk.md b/sources/tech/20191125 How to use loops in awk.md index cf7abb6f62..099444b10f 100644 --- a/sources/tech/20191125 How to use loops in awk.md +++ b/sources/tech/20191125 How to use loops in awk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From da6a1940e4d5f0d611ce343eaa7a5b484efdd804 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 22:29:49 +0800 Subject: [PATCH 699/800] TSL&PRF --- ...91028 6 signs you might be a Linux user.md | 161 ------------------ ...91028 6 signs you might be a Linux user.md | 153 +++++++++++++++++ 2 files changed, 153 insertions(+), 161 deletions(-) delete mode 100644 sources/talk/20191028 6 signs you might be a Linux user.md create mode 100644 translated/talk/20191028 6 signs you might be a Linux user.md diff --git a/sources/talk/20191028 6 signs you might be a Linux user.md b/sources/talk/20191028 6 signs you might be a Linux user.md deleted file mode 100644 index 977c586516..0000000000 --- a/sources/talk/20191028 6 signs you might be a Linux user.md +++ /dev/null @@ -1,161 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 signs you might be a Linux user) -[#]: via: (https://opensource.com/article/19/10/signs-linux-user) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -6 signs you might be a Linux user -====== -If you're a heavy Linux user, you'll probably recognize these common -tendencies. -![Tux with binary code background][1] - -Linux users are a diverse bunch, but many of us share a few habits. You might not have any of the telltale signs listed in this article, and if you're a new Linux user, you may not recognize many of them... yet. - -Here are six signs you might be a Linux user. - -### 1\. As far as you know, the world began on January 1, 1970. - -There are many rumors about why a Unix computer clock always sets itself back to 1970-01-01 when it resets. But the mundane truth is that the Unix "epoch" serves as a common and simple reference point for synchronization. For example, Halloween is the 304th day of this year in the Julian calendar, but we commonly refer to the holiday as being "on the 31st". We know which 31st we mean because we have common reference points: We know that Halloween is celebrated in October and that October is the 10th month of the year, and we know how many days each preceding month contains. Without these values, we could use traditional methods of timekeeping, such as phases of the moon, to keep track of special seasonal events, but of course, a computer doesn't have that ability. - -A computer requires firm and clearly defined values, so the value 1970-01-01T00:00:00Z was chosen as the beginning of the Unix epoch. Any time a [POSIX][2] computer loses track of time, a service like the Network Time Protocol (NTP) can provide it the number of seconds since 1970-01-01T00:00:00Z, which the computer can convert to a human-friendly date. - -Date and time are a famously complex thing to track in computing, largely because there are exceptions to nearly standard. A month doesn't always have 30 days, a year doesn't always have 365 days, and even seconds tend to drift a little each year. If you're looking for a fun and frustrating programming exercise, try to program a reliable calendaring application! - -### 2\. You think it's a chore to type anything over two letters to get something done. - -The most common Unix commands are famously short. In addition to commands like **cd** and **ls** and **mv**, there's one command that literally can't get any shorter: **w** (which shows who is currently logged in according to the **/var/run/utmp** file). - -On the one hand, extremely short commands seem unintuitive. A new user probably isn't going to guess that typing **ls** would _list_ directories. Once you learn the commands, though, the shorter they are, the better. If you spend all day in a terminal, the fewer keystrokes you have to type means you can spend more time getting your work done. - -Luckily, single-letter commands are far and few between, which means you can use most letters for aliases. For example, I use Emacs often enough that I consider **emacs** too long to type, so I alias it to **e** by adding this line to my **.bashrc** file: - - -``` -`alias e='emacs'` -``` - -You can also alias commands temporarily. For instance, if you find yourself running [firewall-cmd][3] repeatedly while you troubleshoot a network issue, then you can create an alias just for your current session: - - -``` -$ alias f='firewall-cmd' -$ f -usage: see firewall-cmd man page -No option specified. -``` - -As long as the terminal is open, your alias persists. Once the terminal is closed, it's forgotten. - -### 3\. You think it's a chore to click more than two times to get something done. - -Linux users are fond of efficiency. While not every Linux user is always in a hurry to get things done, there are conventions in Linux desktops that seek to reduce the number of actions required to accomplish any given task. Here are some examples. - - * In the KDE file manager Dolphin, a single click opens a file or directory. It's assumed that if you want to select a file, you can either click and drag or else Ctrl+Click instead. This may confuse users who are used to double-clicking everything, but once you've tried single-click actions, you usually can't go back to laborious double-clicks. - * On most Linux desktops, a middle-click pastes the most recent contents of the clipboard. - * On many Linux desktops, drag actions can be modified by pressing the Alt, Ctrl, or Shift keys. For instance, Alt+Drag moves a window in KDE, and Ctrl+Drag in GNOME causes a file to be copied instead of moved. - - - -### 4\. You've never performed any action on a computer more than three times because you've already automated it by the third time. - -Pardon the hyperbole, but many Linux users expect their computer to work harder than they do. While it takes time to learn how to automate common tasks, it tends to be easier on Linux than on other platforms because the Linux terminal and the Linux operating system are so tightly integrated. The easy things to automate are the actions you already do in a terminal because commands are just strings that you type into an interpreter, and that interpreter (the terminal) doesn't care whether you typed the strings out manually or whether you're just pointing it to a script. - -For instance, if you find yourself frequently moving a set of files from one place to another, then you can probably use the same sequence of instructions as a script, which you can trigger with a single command. Imagine you are doing this manually each morning: - - -``` -$ cd Documents -$ trash reports-latest.txt -$ wget myserver.local/reports/daily/report-latest.txt -$ cp report-latest.txt reports_daily/2019-31-10.log -``` - -It's a simple sequence, but repeating it daily isn't the most efficient way of spending your time. With a little bit of abstraction, you could automate it with a simple script: - - -``` -#!/bin/sh - -trash $HOME/Documents/reports-latest.txt - -wget myserver.local/reports/daily/report-latest.txt \ --P $HOME/Documents/udpates_daily/`date --iso-8601`.log - -cp $HOME/Documents/udpates_daily/`date --iso-8601`.log \ -$HOME/Documents/reports-latest.txt -``` - -You could call your script **get-reports.sh** and launch it manually each morning, or you could even enter it into your crontab so that your computer performs the task without requiring any intervention from you. - -This can be confusing for a new user because it's not always obvious what's integrated with what. For instance, if you regularly find yourself opening images and scaling them down by 50%, then you're probably used to doing something like this: - - 1. Opening up your photo viewer or editor - 2. Scaling the image - 3. Exporting the image as a modified file - 4. Closing the application - - - -If you did this several times a day, you would probably get tired of the repetition. However, because you perform those actions in the graphical user interface (GUI), you would need to know how to script the GUI to automate it. Some applications, like [GIMP][4], have a rich scripting interface, but the process is obviously different than just adapting a bunch of commands and dumping those into a file. - -Then again, sometimes there are command-line equivalents to things you do in a GUI. Converting documents from one text format to another can be done with [Pandoc][5], images can be manipulated with [Image Magick][6], music and video can be edited and converted, and so on. It's a matter of knowing what to look for, and usually learning a new (and sometimes complex) command. Scaling images down, however, is notably simpler in the terminal than in a GUI: - - -``` -#!/bin/sh - -convert "${1}" -scale 50% `basename "${1}" .jpg`_50.jpg -``` - -It's worth investigating those bothersome, repetitious tasks. You never know how simple and fast your work is for a computer to do! - -### 5\. You distro hop - -I'm an ardent Slackware user at home and a RHEL user at work. Actually, that's not true; I'm a Fedora user at work now. Except when I use CentOS. And there was that time I ran [Mageia][7] for a while. - -![Debian on a PowerPC64 box, image CC BY SA Claudio Miranda][8] - -Debian on a PowerPC64 box - -It doesn't matter how great a distribution is; part of the guilty pleasure of being a Linux user is the freedom to be indecisive about which distro you run. At a glance, they're all basically the same, and that's refreshing. But depending on your mood, you might prefer the stability of CentOS to the constant updates of Fedora, or you might truly enjoy the centralized control center of Mageia one day and then frolic in the modularity of raw [Debian][9] configuration files another. And sometimes you turn to an alternate OS altogether. - -![OpenBSD, image CC BY SA Claudio Miranda][10] - -OpenBSD, not a Linux distro - -The point is, Linux distributions are passion projects, and it's fun to be a part of other people's open source passions. - -### 6\. You have a passion for open source. - -Regardless of your experience, if you're a Linux user, you undoubtedly have a passion for open source. Whether you express that on a daily basis through [Creative Commons artwork][11] or code or you sublimate it and just get your work done in a liberating (and liberated) environment, you're living in and building upon open source. It's because of you that there's an open source community, and the community is richer for having you as a member. - -There are lots of things I haven't mentioned. What else betrays you as a Linux user? Let us know in the comments! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/signs-linux-user - -作者:[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/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY (Tux with binary code background) -[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains -[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls -[4]: https://www.gimp.org/ -[5]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc -[6]: https://opensource.com/article/17/8/imagemagick -[7]: http://mageia.org -[8]: https://opensource.com/sites/default/files/uploads/debian.png (Debian on a PowerPC64 box) -[9]: http://debian.org -[10]: https://opensource.com/sites/default/files/uploads/openbsd.jpg (OpenBSD) -[11]: http://freesvg.org diff --git a/translated/talk/20191028 6 signs you might be a Linux user.md b/translated/talk/20191028 6 signs you might be a Linux user.md new file mode 100644 index 0000000000..ef6b782ce1 --- /dev/null +++ b/translated/talk/20191028 6 signs you might be a Linux user.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 signs you might be a Linux user) +[#]: via: (https://opensource.com/article/19/10/signs-linux-user) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 资深用户的 6 大特征 +====== + +> 如果你是 Linux 资深用户,则可能会有这些共同倾向。 + +![Tux with binary code background][1] + +Linux 用户千差万别,但是我们许多人都有一些相同的习惯。你可能没有本文列出的任何特征,而且如果你是个 Linux 新用户,你可能还不能理解这些特征…… + +下面是你可能是 Linux 用户的六个特征。 + +### 1、理所当然,纪元始于 1970 年 1 月 1 日 + +关于 Unix 计算机时钟为何在重置时总是将其设置回 1970-01-01 的传闻有很多。但有点令人感到乏味的事实是,Unix “纪元”是用于同步的通用且简单的参考点。例如,万圣节在儒略历中是今年的 304 日,但我们通常将该节日称为 “31 日”。我们知道指的是哪个月 31 日,因为我们有个共同的参考点:我们知道万圣节在 10 月庆祝,而 10 月是一年中的第十个月,并且我们知道前面每一个月包含多少天。没有这些值,虽然我们可以使用传统的计时方法(如月相)来跟踪特殊的季节性事件,但是计算机显然不具备这种能力。 + +计算机需要确定且明确定义的值,因此将值 `1970-01-01T00:00:00Z` 选择为 Unix 纪元的开始。每当 [POSIX][2] 计算机的时间不准确时,诸如网络时间协议(NTP)之类的服务就可以向其提供自 `1970-01-01T00:00:00Z` 以来的秒数,计算机可以将其转换为人类易于识别的日期。 + +日期和时间是在计算中要追踪的著名的复杂事物,主要是因为几乎所有标准都有例外。一个月并不总是有 30 天,一年也不总是有 365 天,甚至每年有多少秒钟也往往会有所不同。如果你正在寻找一个有趣而令人沮丧的编程练习,请尝试编程一个可靠的日历应用程序! + +### 2、输入超过两个字母你就会觉得麻烦 + +众所周知,最常见的 Unix 命令都超简短。除了 `cd`、`ls` 和 `mv` 之类的命令外,还有一个命令简直不能再短了:`w`(它根据 `/var/run/utmp` 文件显示谁当前登录了)。 + +一方面,极短的命令似乎很不直观。新用户可能不会猜测到键入 `ls` 会列出list目录。但是,一旦学习命令,它们肯定是越短越好。如果你整天都在终端上度过,那么你键入的击键次数越少就意味着你可以花更多的时间来完成工作。 + +幸运的是,单字母命令并不太多,因此你可以使用大多数字母作为别名。例如,我经常使用 Emacs,以至于我觉得 `emacs` 的输入时间太长,因此通过将下面这行添加到 `.bashrc` 文件中,将其别名为 `e`: + +``` +alias e='emacs' +``` + +你也可以临时为命令添加别名。例如,如果你在解决网络问题时发现自己反复运行 [firewall-cmd][3],则可以为当前会话创建别名: + +``` +$ alias f='firewall-cmd' +$ f +usage: see firewall-cmd man page +No option specified. +``` + +只要你打开着终端,你的别名就会一直存在。当终端一旦关闭,它便会被遗忘。 + +### 3、做任何事都不应该单击两次以上 + +Linux 用户喜欢效率。尽管并非每个 Linux 用户都总是急于完成工作,但 Linux 桌面中有一些旨在减少完成任务所需的操作数量的惯例。这里有些例子。 + +* 在 KDE 文件管理器 Dolphin 中,单击即可打开文件或目录。假定如果要选择一个文件,则可以单击并拖动,也可以 `Ctrl + 点击`。这可能会使习惯于双击所有内容的用户感到困惑,但是一旦你尝试了单击操作,通常就无法返回费力的双击操作。 +* 在大多数 Linux 桌面上,单击鼠标中键可粘贴剪贴板的最新内容。 +* 在许多 Linux 桌面上,可以通过按 `Alt`、`Ctrl` 或 `Shift` 键来修改拖动动作。例如,`Alt + 拖动` 在 KDE 中移动窗口,而 GNOME 中的 `Ctrl + 拖动` 会复制文件而不是移动。 + +### 4、任何操作你都不会执行三次以上,因为第三次时你已经将它自动化了 + +请原谅我有点夸张,但是许多 Linux 用户期望他们的计算机比他们更努力地工作。虽然学习如何自动执行常见任务需要花费时间,但在 Linux 上它往往比在其它平台上更容易,因为 Linux 终端和 Linux 操作系统是如此紧密地集成在一起。最容易自动化的是你在终端中已经执行的操作,因为命令只是你在解释器中键入的字符串,而该解释器(终端)不会在乎你是手动键入字符串还是将其指向一个脚本。 + +例如,如果你发现自己经常将一组文件从一个位置移动到另一个位置,则或许可以将相同的指令序列用作一个脚本,你可以使用单个命令来触发该脚本。假设你每天早上手动执行此操作: + +``` +$ cd Documents +$ trash reports-latest.txt +$ wget myserver.local/reports/daily/report-latest.txt +$ cp report-latest.txt reports_daily/2019-31-10.log +``` + +这是一个简单的序列,但是每天重复一次并不是消磨时间的最有效方法。做一点点抽象,你可以使用一个简单的脚本将其自动化: + +``` +#!/bin/sh + +trash $HOME/Documents/reports-latest.txt + +wget myserver.local/reports/daily/report-latest.txt \ +-P $HOME/Documents/udpates_daily/`date --iso-8601`.log + +cp $HOME/Documents/udpates_daily/`date --iso-8601`.log \ +$HOME/Documents/reports-latest.txt +``` + +你可以把你的脚本叫做 `get-reports.sh` 并在每天早晨手动启动它,或者甚至可以将其输入到 crontab 中,以便计算机可以执行此任务而无需你进行任何干预。 + +对于新用户来说,这可能会有点困扰,因为什么和什么是一体的并不总是很明显。例如,如果你经常发现自己打开图像并将其按比例缩小 50%,那么你可能习惯于执行以下操作: + +1. 打开你的照片查看器或编辑器 +2. 缩放图像 +3. 将图像导出为修改后的文件 +4. 关闭应用程序 + +如果你一天要做几次,你可能会对这种重复感到厌倦。但是,由于你是在图形用户界面(GUI)中执行这些操作的,因此你需要知道如何编写 GUI 脚本以使其自动化。某些应用程序,例如 [GIMP][4],具有丰富的脚本接口,但是其过程显然不同于仅修改一堆命令并将其存储到文件中那么简单。 + +再说一次,有时在命令行中有与你在 GUI 中所做的等效的操作。将文档从一种文本格式转换为另一种格式可以使用 [Pandoc][5],处理图像可以使用 [Image Magick][6],音乐和视频也可以通过命令行进行编辑和转换,等等。最大的问题是你需要知道要查找什么,通常是学习新的(有时是复杂的)命令。但是,在终端中按比例缩小图像比在 GUI 中显然更简单: + +``` +#!/bin/sh + +convert "${1}" -scale 50% `basename "${1}" .jpg`_50.jpg +``` + +这些麻烦、重复的任务值得研究。你永远不知道你的工作让计算机做起来是有多么的简单和快捷! + +### 5、发行版之间跳来跳去 + +我在家里是一个热情的 Slackware 用户,而在工作时是一个 RHEL 用户。实际上,这不是事实,我现在在工作时是 Fedora 用户。除了有时候我使用 CentOS,有时候我还会运行 [Mageia][7]。 + +![Debian on a PowerPC64 box, image CC BY SA Claudio Miranda][8] + +*运行在 PowerPC64 机器上的 Debian* + +发行版好不好无关紧要,成为 Linux 用户的极致乐趣之一是可以自由决定运行哪个发行版。乍一看,它们基本相同,令人耳目一新。但是根据你的心情,你可能更喜欢 CentOS 的稳定性而不是 Fedora 的不断更新,或者你可能有一天会真正享受 Mageia 的集中控制中心,然后又对原始的 [Debian][9] 配置文件进行模块化乐在其中,而有时你又会完全转向其他操作系统。 + +![OpenBSD, image CC BY SA Claudio Miranda][10] + +*OpenBSD,不是 Linux 发行版* + +关键是,Linux 发行版是激情项目,成为其他人的开源激情的一部分很有趣。 + +### 6、你对开源充满热情 + +无论你的经验如何,如果你是 Linux 用户,那么你无疑会对开源充满热情。无论你是每天通过[共创艺术品] [11]还是代码来表达你的热情,还是将其升华到只在自由而自在环境中完成工作,你都生活并构筑于开源之上。因为有了千千万万个你,所以有了开源社区,社区因你而变得更加丰富。 + +有太多的东西我没有提到。作为 Linux 用户,还有什么可以出卖你的身份?让我们在评论中知道! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/signs-linux-user + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY (Tux with binary code background) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[4]: https://www.gimp.org/ +[5]: https://opensource.com/article/19/5/convert-markdown-to-word-pandoc +[6]: https://opensource.com/article/17/8/imagemagick +[7]: http://mageia.org +[8]: https://opensource.com/sites/default/files/uploads/debian.png (Debian on a PowerPC64 box) +[9]: http://debian.org +[10]: https://opensource.com/sites/default/files/uploads/openbsd.jpg (OpenBSD) +[11]: http://freesvg.org From 875796e02de86471b1680f7fb9f8f290a1740b43 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 22:45:21 +0800 Subject: [PATCH 700/800] =?UTF-8?q?=E5=BD=92=E6=A1=A3=20201911?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ple Monitors Without Creating Multiple Docks With autoplank.md | 0 .../20181109 Must-Have Tools for Writers on the Linux Platform.md | 0 .../20190328 Can Better Task Stealing Make Linux Faster.md | 0 ...ckchain (might be) coming to an IoT implementation near you.md | 0 ...rs and Kubernetes have the potential to run almost anything.md | 0 .../20190718 What you need to know to be a sysadmin.md | 0 published/{ => 201911}/20190801 Linux permissions 101.md | 0 ...Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md | 0 .../20190826 How RPM packages are made- the source RPM.md | 0 ... Forked GIMP into Glimpse Because Gimp is an Offensive Word.md | 0 .../20190902 How RPM packages are made- the spec file.md | 0 .../20190905 Building CI-CD pipelines with Jenkins.md | 0 .../20190906 6 Open Source Paint Applications for Linux Users.md | 0 ... to fix common pitfalls with the Python ORM tool SQLAlchemy.md | 0 published/{ => 201911}/20191007 7 Java tips for new developers.md | 0 .../20191008 5 Best Password Managers For Linux Desktop.md | 0 ...How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md | 0 .../20191018 How to use Protobuf for data interchange.md | 0 .../20191021 How to program with Bash- Syntax and tools.md | 0 published/{ => 201911}/20191022 Initializing arrays in Java.md | 0 .../20191023 How to dual boot Windows 10 and Debian 10.md | 0 ...rce CMS Ghost 3.0 Released with New features for Publishers.md | 0 ...0191025 4 cool new projects to try in COPR for October 2019.md | 0 ...25 How I used the wget Linux command to recover lost images.md | 0 .../20191025 Understanding system calls on Linux with strace.md | 0 .../20191025 Why I made the switch from Mac to Linux.md | 0 ...w to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md | 0 .../{ => 201911}/20191028 SQLite is really easy to compile.md | 0 ...029 Collapse OS - An OS Created to Run After the World Ends.md | 0 .../{ => 201911}/20191029 Upgrading Fedora 30 to Fedora 31.md | 0 .../20191029 What you probably didn-t know about sudo.md | 0 ...1030 Getting started with awk, a powerful text-parsing tool.md | 0 ...030 How to Find Out Top Memory Consuming Processes in Linux.md | 0 .../20191030 Viewing network bandwidth usage with bmon.md | 0 .../20191031 Why you don-t have to be afraid of Kubernetes.md | 0 .../20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md | 0 .../20191104 Cloning a MAC address to bypass a captive portal.md | 0 .../20191104 Fields, records, and variables in awk.md | 0 ...04 How To Update a Fedora Linux System -Beginner-s Tutorial.md | 0 ... Generate Patching Compliance Report on CentOS-RHEL Systems.md | 0 ...How to Schedule and Automate tasks in Linux using Cron Jobs.md | 0 published/{ => 201911}/20191107 Demystifying Kubernetes.md | 0 .../20191107 How to add a user to your Linux desktop.md | 0 ...your bash or zsh shell on Fedora Workstation and Silverblue.md | 0 ...08 7 Best Open Source Tools that will help in AI Technology.md | 0 ...artphone PinePhone Will be Available to Pre-order Next Week.md | 0 .../20191108 How to manage music tags using metaflac.md | 0 ...191111 Confirmed- Microsoft Edge Will be Available on Linux.md | 0 .../{ => 201911}/20191112 Getting started with PostgreSQL.md | 0 ...0191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md | 0 ...ow to install and Configure Postfix Mail Server on CentOS 8.md | 0 published/{ => 201911}/20191114 Cleaning up with apt-get.md | 0 ...icrosoft Defender ATP is Coming to Linux- What Does it Mean.md | 0 .../{ => 201911}/20191114 Red Hat Responds to Zombieload v2.md | 0 .../20191115 Developing a Simple Web Application Using Flutter.md | 0 ...20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md | 0 published/{ => 201911}/20191118 How containers work- overlayfs.md | 0 published/{ => 201911}/20191119 How to use pkgsrc on Linux.md | 0 ...120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md | 0 published/{ => 201911}/20191120 How to install Java on Linux.md | 0 .../20191121 How to document Python code with Sphinx.md | 0 ...22 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md | 0 ...h - Manage Snaps, Flatpaks and AppImages from One Interface.md | 0 ...1126 Google to Add Mainline Linux Kernel Support to Android.md | 0 .../{ => 201911}/20191127 Displaying dates and times your way.md | 0 65 files changed, 0 insertions(+), 0 deletions(-) rename published/{ => 201911}/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md (100%) rename published/{ => 201911}/20181109 Must-Have Tools for Writers on the Linux Platform.md (100%) rename published/{ => 201911}/20190328 Can Better Task Stealing Make Linux Faster.md (100%) rename published/{ => 201911}/20190404 Why blockchain (might be) coming to an IoT implementation near you.md (100%) rename published/{ => 201911}/20190610 Why containers and Kubernetes have the potential to run almost anything.md (100%) rename published/{ => 201911}/20190718 What you need to know to be a sysadmin.md (100%) rename published/{ => 201911}/20190801 Linux permissions 101.md (100%) rename published/{ => 201911}/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md (100%) rename published/{ => 201911}/20190826 How RPM packages are made- the source RPM.md (100%) rename published/{ => 201911}/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md (100%) rename published/{ => 201911}/20190902 How RPM packages are made- the spec file.md (100%) rename published/{ => 201911}/20190905 Building CI-CD pipelines with Jenkins.md (100%) rename published/{ => 201911}/20190906 6 Open Source Paint Applications for Linux Users.md (100%) rename published/{ => 201911}/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md (100%) rename published/{ => 201911}/20191007 7 Java tips for new developers.md (100%) rename published/{ => 201911}/20191008 5 Best Password Managers For Linux Desktop.md (100%) rename published/{ => 201911}/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md (100%) rename published/{ => 201911}/20191018 How to use Protobuf for data interchange.md (100%) rename published/{ => 201911}/20191021 How to program with Bash- Syntax and tools.md (100%) rename published/{ => 201911}/20191022 Initializing arrays in Java.md (100%) rename published/{ => 201911}/20191023 How to dual boot Windows 10 and Debian 10.md (100%) rename published/{ => 201911}/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md (100%) rename published/{ => 201911}/20191025 4 cool new projects to try in COPR for October 2019.md (100%) rename published/{ => 201911}/20191025 How I used the wget Linux command to recover lost images.md (100%) rename published/{ => 201911}/20191025 Understanding system calls on Linux with strace.md (100%) rename published/{ => 201911}/20191025 Why I made the switch from Mac to Linux.md (100%) rename published/{ => 201911}/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md (100%) rename published/{ => 201911}/20191028 SQLite is really easy to compile.md (100%) rename published/{ => 201911}/20191029 Collapse OS - An OS Created to Run After the World Ends.md (100%) rename published/{ => 201911}/20191029 Upgrading Fedora 30 to Fedora 31.md (100%) rename published/{ => 201911}/20191029 What you probably didn-t know about sudo.md (100%) rename published/{ => 201911}/20191030 Getting started with awk, a powerful text-parsing tool.md (100%) rename published/{ => 201911}/20191030 How to Find Out Top Memory Consuming Processes in Linux.md (100%) rename published/{ => 201911}/20191030 Viewing network bandwidth usage with bmon.md (100%) rename published/{ => 201911}/20191031 Why you don-t have to be afraid of Kubernetes.md (100%) rename published/{ => 201911}/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md (100%) rename published/{ => 201911}/20191104 Cloning a MAC address to bypass a captive portal.md (100%) rename published/{ => 201911}/20191104 Fields, records, and variables in awk.md (100%) rename published/{ => 201911}/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md (100%) rename published/{ => 201911}/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md (100%) rename published/{ => 201911}/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md (100%) rename published/{ => 201911}/20191107 Demystifying Kubernetes.md (100%) rename published/{ => 201911}/20191107 How to add a user to your Linux desktop.md (100%) rename published/{ => 201911}/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md (100%) rename published/{ => 201911}/20191108 7 Best Open Source Tools that will help in AI Technology.md (100%) rename published/{ => 201911}/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md (100%) rename published/{ => 201911}/20191108 How to manage music tags using metaflac.md (100%) rename published/{ => 201911}/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md (100%) rename published/{ => 201911}/20191112 Getting started with PostgreSQL.md (100%) rename published/{ => 201911}/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md (100%) rename published/{ => 201911}/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md (100%) rename published/{ => 201911}/20191114 Cleaning up with apt-get.md (100%) rename published/{ => 201911}/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md (100%) rename published/{ => 201911}/20191114 Red Hat Responds to Zombieload v2.md (100%) rename published/{ => 201911}/20191115 Developing a Simple Web Application Using Flutter.md (100%) rename published/{ => 201911}/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md (100%) rename published/{ => 201911}/20191118 How containers work- overlayfs.md (100%) rename published/{ => 201911}/20191119 How to use pkgsrc on Linux.md (100%) rename published/{ => 201911}/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md (100%) rename published/{ => 201911}/20191120 How to install Java on Linux.md (100%) rename published/{ => 201911}/20191121 How to document Python code with Sphinx.md (100%) rename published/{ => 201911}/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md (100%) rename published/{ => 201911}/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md (100%) rename published/{ => 201911}/20191126 Google to Add Mainline Linux Kernel Support to Android.md (100%) rename published/{ => 201911}/20191127 Displaying dates and times your way.md (100%) diff --git a/published/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md b/published/201911/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md similarity index 100% rename from published/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md rename to published/201911/20180810 Use Plank On Multiple Monitors Without Creating Multiple Docks With autoplank.md diff --git a/published/20181109 Must-Have Tools for Writers on the Linux Platform.md b/published/201911/20181109 Must-Have Tools for Writers on the Linux Platform.md similarity index 100% rename from published/20181109 Must-Have Tools for Writers on the Linux Platform.md rename to published/201911/20181109 Must-Have Tools for Writers on the Linux Platform.md diff --git a/published/20190328 Can Better Task Stealing Make Linux Faster.md b/published/201911/20190328 Can Better Task Stealing Make Linux Faster.md similarity index 100% rename from published/20190328 Can Better Task Stealing Make Linux Faster.md rename to published/201911/20190328 Can Better Task Stealing Make Linux Faster.md diff --git a/published/20190404 Why blockchain (might be) coming to an IoT implementation near you.md b/published/201911/20190404 Why blockchain (might be) coming to an IoT implementation near you.md similarity index 100% rename from published/20190404 Why blockchain (might be) coming to an IoT implementation near you.md rename to published/201911/20190404 Why blockchain (might be) coming to an IoT implementation near you.md diff --git a/published/20190610 Why containers and Kubernetes have the potential to run almost anything.md b/published/201911/20190610 Why containers and Kubernetes have the potential to run almost anything.md similarity index 100% rename from published/20190610 Why containers and Kubernetes have the potential to run almost anything.md rename to published/201911/20190610 Why containers and Kubernetes have the potential to run almost anything.md diff --git a/published/20190718 What you need to know to be a sysadmin.md b/published/201911/20190718 What you need to know to be a sysadmin.md similarity index 100% rename from published/20190718 What you need to know to be a sysadmin.md rename to published/201911/20190718 What you need to know to be a sysadmin.md diff --git a/published/20190801 Linux permissions 101.md b/published/201911/20190801 Linux permissions 101.md similarity index 100% rename from published/20190801 Linux permissions 101.md rename to published/201911/20190801 Linux permissions 101.md diff --git a/published/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md b/published/201911/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md similarity index 100% rename from published/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md rename to published/201911/20190822 11 Essential Keyboard Shortcuts Google Chrome-Chromium Users Should Know.md diff --git a/published/20190826 How RPM packages are made- the source RPM.md b/published/201911/20190826 How RPM packages are made- the source RPM.md similarity index 100% rename from published/20190826 How RPM packages are made- the source RPM.md rename to published/201911/20190826 How RPM packages are made- the source RPM.md diff --git a/published/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md b/published/201911/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md similarity index 100% rename from published/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md rename to published/201911/20190828 Someone Forked GIMP into Glimpse Because Gimp is an Offensive Word.md diff --git a/published/20190902 How RPM packages are made- the spec file.md b/published/201911/20190902 How RPM packages are made- the spec file.md similarity index 100% rename from published/20190902 How RPM packages are made- the spec file.md rename to published/201911/20190902 How RPM packages are made- the spec file.md diff --git a/published/20190905 Building CI-CD pipelines with Jenkins.md b/published/201911/20190905 Building CI-CD pipelines with Jenkins.md similarity index 100% rename from published/20190905 Building CI-CD pipelines with Jenkins.md rename to published/201911/20190905 Building CI-CD pipelines with Jenkins.md diff --git a/published/20190906 6 Open Source Paint Applications for Linux Users.md b/published/201911/20190906 6 Open Source Paint Applications for Linux Users.md similarity index 100% rename from published/20190906 6 Open Source Paint Applications for Linux Users.md rename to published/201911/20190906 6 Open Source Paint Applications for Linux Users.md diff --git a/published/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md b/published/201911/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md similarity index 100% rename from published/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md rename to published/201911/20190912 How to fix common pitfalls with the Python ORM tool SQLAlchemy.md diff --git a/published/20191007 7 Java tips for new developers.md b/published/201911/20191007 7 Java tips for new developers.md similarity index 100% rename from published/20191007 7 Java tips for new developers.md rename to published/201911/20191007 7 Java tips for new developers.md diff --git a/published/20191008 5 Best Password Managers For Linux Desktop.md b/published/201911/20191008 5 Best Password Managers For Linux Desktop.md similarity index 100% rename from published/20191008 5 Best Password Managers For Linux Desktop.md rename to published/201911/20191008 5 Best Password Managers For Linux Desktop.md diff --git a/published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md b/published/201911/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md similarity index 100% rename from published/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md rename to published/201911/20191013 How to Enable EPEL Repository on CentOS 8 and RHEL 8 Server.md diff --git a/published/20191018 How to use Protobuf for data interchange.md b/published/201911/20191018 How to use Protobuf for data interchange.md similarity index 100% rename from published/20191018 How to use Protobuf for data interchange.md rename to published/201911/20191018 How to use Protobuf for data interchange.md diff --git a/published/20191021 How to program with Bash- Syntax and tools.md b/published/201911/20191021 How to program with Bash- Syntax and tools.md similarity index 100% rename from published/20191021 How to program with Bash- Syntax and tools.md rename to published/201911/20191021 How to program with Bash- Syntax and tools.md diff --git a/published/20191022 Initializing arrays in Java.md b/published/201911/20191022 Initializing arrays in Java.md similarity index 100% rename from published/20191022 Initializing arrays in Java.md rename to published/201911/20191022 Initializing arrays in Java.md diff --git a/published/20191023 How to dual boot Windows 10 and Debian 10.md b/published/201911/20191023 How to dual boot Windows 10 and Debian 10.md similarity index 100% rename from published/20191023 How to dual boot Windows 10 and Debian 10.md rename to published/201911/20191023 How to dual boot Windows 10 and Debian 10.md diff --git a/published/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md b/published/201911/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md similarity index 100% rename from published/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md rename to published/201911/20191024 Open Source CMS Ghost 3.0 Released with New features for Publishers.md diff --git a/published/20191025 4 cool new projects to try in COPR for October 2019.md b/published/201911/20191025 4 cool new projects to try in COPR for October 2019.md similarity index 100% rename from published/20191025 4 cool new projects to try in COPR for October 2019.md rename to published/201911/20191025 4 cool new projects to try in COPR for October 2019.md diff --git a/published/20191025 How I used the wget Linux command to recover lost images.md b/published/201911/20191025 How I used the wget Linux command to recover lost images.md similarity index 100% rename from published/20191025 How I used the wget Linux command to recover lost images.md rename to published/201911/20191025 How I used the wget Linux command to recover lost images.md diff --git a/published/20191025 Understanding system calls on Linux with strace.md b/published/201911/20191025 Understanding system calls on Linux with strace.md similarity index 100% rename from published/20191025 Understanding system calls on Linux with strace.md rename to published/201911/20191025 Understanding system calls on Linux with strace.md diff --git a/published/20191025 Why I made the switch from Mac to Linux.md b/published/201911/20191025 Why I made the switch from Mac to Linux.md similarity index 100% rename from published/20191025 Why I made the switch from Mac to Linux.md rename to published/201911/20191025 Why I made the switch from Mac to Linux.md diff --git a/published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/published/201911/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md similarity index 100% rename from published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md rename to published/201911/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md diff --git a/published/20191028 SQLite is really easy to compile.md b/published/201911/20191028 SQLite is really easy to compile.md similarity index 100% rename from published/20191028 SQLite is really easy to compile.md rename to published/201911/20191028 SQLite is really easy to compile.md diff --git a/published/20191029 Collapse OS - An OS Created to Run After the World Ends.md b/published/201911/20191029 Collapse OS - An OS Created to Run After the World Ends.md similarity index 100% rename from published/20191029 Collapse OS - An OS Created to Run After the World Ends.md rename to published/201911/20191029 Collapse OS - An OS Created to Run After the World Ends.md diff --git a/published/20191029 Upgrading Fedora 30 to Fedora 31.md b/published/201911/20191029 Upgrading Fedora 30 to Fedora 31.md similarity index 100% rename from published/20191029 Upgrading Fedora 30 to Fedora 31.md rename to published/201911/20191029 Upgrading Fedora 30 to Fedora 31.md diff --git a/published/20191029 What you probably didn-t know about sudo.md b/published/201911/20191029 What you probably didn-t know about sudo.md similarity index 100% rename from published/20191029 What you probably didn-t know about sudo.md rename to published/201911/20191029 What you probably didn-t know about sudo.md diff --git a/published/20191030 Getting started with awk, a powerful text-parsing tool.md b/published/201911/20191030 Getting started with awk, a powerful text-parsing tool.md similarity index 100% rename from published/20191030 Getting started with awk, a powerful text-parsing tool.md rename to published/201911/20191030 Getting started with awk, a powerful text-parsing tool.md diff --git a/published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md b/published/201911/20191030 How to Find Out Top Memory Consuming Processes in Linux.md similarity index 100% rename from published/20191030 How to Find Out Top Memory Consuming Processes in Linux.md rename to published/201911/20191030 How to Find Out Top Memory Consuming Processes in Linux.md diff --git a/published/20191030 Viewing network bandwidth usage with bmon.md b/published/201911/20191030 Viewing network bandwidth usage with bmon.md similarity index 100% rename from published/20191030 Viewing network bandwidth usage with bmon.md rename to published/201911/20191030 Viewing network bandwidth usage with bmon.md diff --git a/published/20191031 Why you don-t have to be afraid of Kubernetes.md b/published/201911/20191031 Why you don-t have to be afraid of Kubernetes.md similarity index 100% rename from published/20191031 Why you don-t have to be afraid of Kubernetes.md rename to published/201911/20191031 Why you don-t have to be afraid of Kubernetes.md diff --git a/published/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md b/published/201911/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md similarity index 100% rename from published/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md rename to published/201911/20191101 Keyboard Shortcuts to Speed Up Your Work in Linux.md diff --git a/published/20191104 Cloning a MAC address to bypass a captive portal.md b/published/201911/20191104 Cloning a MAC address to bypass a captive portal.md similarity index 100% rename from published/20191104 Cloning a MAC address to bypass a captive portal.md rename to published/201911/20191104 Cloning a MAC address to bypass a captive portal.md diff --git a/published/20191104 Fields, records, and variables in awk.md b/published/201911/20191104 Fields, records, and variables in awk.md similarity index 100% rename from published/20191104 Fields, records, and variables in awk.md rename to published/201911/20191104 Fields, records, and variables in awk.md diff --git a/published/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md b/published/201911/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md similarity index 100% rename from published/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md rename to published/201911/20191104 How To Update a Fedora Linux System -Beginner-s Tutorial.md diff --git a/published/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md b/published/201911/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md similarity index 100% rename from published/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md rename to published/201911/20191106 Bash Script to Generate Patching Compliance Report on CentOS-RHEL Systems.md diff --git a/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/published/201911/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md similarity index 100% rename from published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md rename to published/201911/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md diff --git a/published/20191107 Demystifying Kubernetes.md b/published/201911/20191107 Demystifying Kubernetes.md similarity index 100% rename from published/20191107 Demystifying Kubernetes.md rename to published/201911/20191107 Demystifying Kubernetes.md diff --git a/published/20191107 How to add a user to your Linux desktop.md b/published/201911/20191107 How to add a user to your Linux desktop.md similarity index 100% rename from published/20191107 How to add a user to your Linux desktop.md rename to published/201911/20191107 How to add a user to your Linux desktop.md diff --git a/published/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md b/published/201911/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md similarity index 100% rename from published/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md rename to published/201911/20191107 Tuning your bash or zsh shell on Fedora Workstation and Silverblue.md diff --git a/published/20191108 7 Best Open Source Tools that will help in AI Technology.md b/published/201911/20191108 7 Best Open Source Tools that will help in AI Technology.md similarity index 100% rename from published/20191108 7 Best Open Source Tools that will help in AI Technology.md rename to published/201911/20191108 7 Best Open Source Tools that will help in AI Technology.md diff --git a/published/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md b/published/201911/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md similarity index 100% rename from published/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md rename to published/201911/20191108 Budget-friendly Linux Smartphone PinePhone Will be Available to Pre-order Next Week.md diff --git a/published/20191108 How to manage music tags using metaflac.md b/published/201911/20191108 How to manage music tags using metaflac.md similarity index 100% rename from published/20191108 How to manage music tags using metaflac.md rename to published/201911/20191108 How to manage music tags using metaflac.md diff --git a/published/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md b/published/201911/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md similarity index 100% rename from published/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md rename to published/201911/20191111 Confirmed- Microsoft Edge Will be Available on Linux.md diff --git a/published/20191112 Getting started with PostgreSQL.md b/published/201911/20191112 Getting started with PostgreSQL.md similarity index 100% rename from published/20191112 Getting started with PostgreSQL.md rename to published/201911/20191112 Getting started with PostgreSQL.md diff --git a/published/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md b/published/201911/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md similarity index 100% rename from published/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md rename to published/201911/20191113 Getting Started With ZFS Filesystem on Ubuntu 19.10.md diff --git a/published/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md b/published/201911/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md similarity index 100% rename from published/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md rename to published/201911/20191113 How to install and Configure Postfix Mail Server on CentOS 8.md diff --git a/published/20191114 Cleaning up with apt-get.md b/published/201911/20191114 Cleaning up with apt-get.md similarity index 100% rename from published/20191114 Cleaning up with apt-get.md rename to published/201911/20191114 Cleaning up with apt-get.md diff --git a/published/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md b/published/201911/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md similarity index 100% rename from published/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md rename to published/201911/20191114 Microsoft Defender ATP is Coming to Linux- What Does it Mean.md diff --git a/published/20191114 Red Hat Responds to Zombieload v2.md b/published/201911/20191114 Red Hat Responds to Zombieload v2.md similarity index 100% rename from published/20191114 Red Hat Responds to Zombieload v2.md rename to published/201911/20191114 Red Hat Responds to Zombieload v2.md diff --git a/published/20191115 Developing a Simple Web Application Using Flutter.md b/published/201911/20191115 Developing a Simple Web Application Using Flutter.md similarity index 100% rename from published/20191115 Developing a Simple Web Application Using Flutter.md rename to published/201911/20191115 Developing a Simple Web Application Using Flutter.md diff --git a/published/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md b/published/201911/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md similarity index 100% rename from published/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md rename to published/201911/20191117 How to Install VirtualBox 6.0 on CentOS 8 - RHEL 8.md diff --git a/published/20191118 How containers work- overlayfs.md b/published/201911/20191118 How containers work- overlayfs.md similarity index 100% rename from published/20191118 How containers work- overlayfs.md rename to published/201911/20191118 How containers work- overlayfs.md diff --git a/published/20191119 How to use pkgsrc on Linux.md b/published/201911/20191119 How to use pkgsrc on Linux.md similarity index 100% rename from published/20191119 How to use pkgsrc on Linux.md rename to published/201911/20191119 How to use pkgsrc on Linux.md diff --git a/published/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md b/published/201911/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md similarity index 100% rename from published/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md rename to published/201911/20191120 How to Use TimeShift to Backup and Restore Ubuntu Linux.md diff --git a/published/20191120 How to install Java on Linux.md b/published/201911/20191120 How to install Java on Linux.md similarity index 100% rename from published/20191120 How to install Java on Linux.md rename to published/201911/20191120 How to install Java on Linux.md diff --git a/published/20191121 How to document Python code with Sphinx.md b/published/201911/20191121 How to document Python code with Sphinx.md similarity index 100% rename from published/20191121 How to document Python code with Sphinx.md rename to published/201911/20191121 How to document Python code with Sphinx.md diff --git a/published/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md b/published/201911/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md similarity index 100% rename from published/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md rename to published/201911/20191122 Zorin OS 15 Lite Release- Good Looking Lightweight Linux.md diff --git a/published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md b/published/201911/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md similarity index 100% rename from published/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md rename to published/201911/20191124 Bauh - Manage Snaps, Flatpaks and AppImages from One Interface.md diff --git a/published/20191126 Google to Add Mainline Linux Kernel Support to Android.md b/published/201911/20191126 Google to Add Mainline Linux Kernel Support to Android.md similarity index 100% rename from published/20191126 Google to Add Mainline Linux Kernel Support to Android.md rename to published/201911/20191126 Google to Add Mainline Linux Kernel Support to Android.md diff --git a/published/20191127 Displaying dates and times your way.md b/published/201911/20191127 Displaying dates and times your way.md similarity index 100% rename from published/20191127 Displaying dates and times your way.md rename to published/201911/20191127 Displaying dates and times your way.md From c4b6b9ab3188e5a199c4d42cdfd0d7967bee72c5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 22:46:29 +0800 Subject: [PATCH 701/800] =?UTF-8?q?=E6=B8=85=E9=99=A4=E8=BF=87=E6=9C=9F?= =?UTF-8?q?=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...SRE struggles, and more industry trends.md | 64 ----------- ...e apocalypse, and more open source news.md | 103 ------------------ ...y warning for IOS XE REST API container.md | 68 ------------ ... microscopic, and more open source news.md | 78 ------------- ...d reads email, and more industry trends.md | 70 ------------ ...EL 8.1 with predictable release cadence.md | 92 ---------------- ... laptops with open source BIOS coreboot.md | 57 ---------- ...rless hotness, and more industry trends.md | 74 ------------- ...Explorer Sourcetrail is Now Open Source.md | 79 -------------- ...ficant events, and more industry trends.md | 61 ----------- 10 files changed, 746 deletions(-) delete mode 100644 sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md delete mode 100644 sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md delete mode 100644 sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md delete mode 100644 sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md delete mode 100644 sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md delete mode 100644 sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md delete mode 100644 sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md delete mode 100644 sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md delete mode 100644 sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md delete mode 100644 sources/news/20191125 Fail-free Kubernetes, significant events, and more industry trends.md diff --git a/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md b/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md deleted file mode 100644 index a3ba0a6a52..0000000000 --- a/sources/news/20191008 Kubernetes communication, SRE struggles, and more industry trends.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Kubernetes communication, SRE struggles, and more industry trends) -[#]: via: (https://opensource.com/article/19/10/kubernetes-sre-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Kubernetes communication, SRE struggles, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Review of pod-to-pod communications in Kubernetes][2] - -> In this article, we dive into pod-to-pod communications by showing you ways in which pods within a Kubernetes network can communicate with one another. -> -> While Kubernetes is opinionated in how containers are deployed and operated, it is very non-prescriptive of how the network should be designed in which pods are to be run. Kubernetes imposes the following fundamental requirements on any networking implementation (barring any intentional network segmentation policies) - -**The impact**: Networking is one of the most complicated parts of making computers work together to solve our problems. Kubernetes turns that complexity up to 11, and this article dials it back down to 10.75. - -## [One SRE's struggle and success to improve Infrastructure as Code][3] - -> Convergence is our goal because we expect our infrastructure to reach a desired state over time expressed in the code. Software idempotence means software can run as many times as it wants and unintended changes don’t happen. As a result, we built an in-house service that runs as specified to apply configurations in source control. Traditionally, we’ve aimed for a masterless configuration design so our configuration agent looks for information on the host. - -**The impact**: I've heard it said that the [human element][4] is the most important element of any digital transformation. While I don't know that the author would use that term to describe the outcome he was after, he does a great job of showing that it is not automation for automation's sake we want but rather automation that makes a meaningful impact on the lives of the people it supports. - -## [Why GitHub is the gold standard for developer-focused companies][5] - -> Now, with last year’s purchase by Microsoft supporting them, it is clear that GitHub has a real opportunity to continue building out a robust ecosystem, with billion dollar companies built upon what could turn into a powerful platform. Is GitHub the next ecosystem success story? In a word, yes. At my company, we bet on GitHub as a successful platform to build upon from the very start. We felt it was the place to build our solution if we wanted to streamline project management and keep software teams close to the code. - -**The impact**: It is one of the great ironies of open source that the most popular tool for open source development is not itself open source. The only way this works is if that tool is so good that open source developers are willing to overlook that inconsistency. - -## [KubeVirt joins Cloud Native Computing Foundation][6] - -> This month the Cloud Native Computing Foundation (CNCF) formally adopted [KubeVirt][7] into the CNCF Sandbox. KubeVirt allows you to provision, manage and run virtual machines from and within Kubernetes. In joining the CNCF Sandbox, KubeVirt now has a more substantial platform to grow as well as educate the CNCF community on the use cases for placing virtual machines within Kubernetes. The CNCF onboards projects into the CNCF Sandbox when they warrant experimentation on neutral ground to promote and foster collaborative development. - -**The impact**: The convergence of containers and virtual machines is clearly a direction vendors think is valuable. Moving this project to the CNCF gives a way to see whether this idea is going to be as popular with users and customers as vendors hope it will be. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/kubernetes-sre-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://superuser.openstack.org/articles/review-of-pod-to-pod-communications-in-kubernetes/ -[3]: https://thenewstack.io/one-sres-struggle-and-success-to-improve-infrastructure-as-code/ -[4]: https://devops.com/the-secret-to-digital-transformation-is-human-connection/ -[5]: https://thenextweb.com/podium/2019/10/02/why-github-is-the-gold-standard-for-developer-focused-companies/ -[6]: https://blog.openshift.com/kubevirt-joins-cloud-native-computing-foundation/ -[7]: https://kubevirt.io/ diff --git a/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md b/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md deleted file mode 100644 index eab1e9bd0e..0000000000 --- a/sources/news/20191013 System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news.md +++ /dev/null @@ -1,103 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news) -[#]: via: (https://opensource.com/article/19/10/news-october-13) -[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) - -System76 will ship Coreboot-powered firmware, a new OS for the apocalypse, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we cover System76 shipping Coreboot-powered firmware, a new OS for the apocalypse, and more open source news! - -### System76 will ship 2 Linux laptops with Coreboot-powered open source firmware - -The Denver-based Linux PC manufacturer announced plans to start shipping two laptop models with its Coreboot-powered open source firmware later this month. Jason Evangelho, Senior Contributor at _Forbes_, cited this move as a march towards offering open source software and hardware from the ground up.  - -System76, which also develops [Pop OS][2], is now taking pre-orders for its Galago Pro and Darter Pro laptops. It claims that Coreboot will let users boot from power off to the desktop 29% faster. - -Coreboot is a lightweight firmware designed to simplify the boot cycle of systems using it. It requires the minimum number of tasks needed to load and run a modern 32-bit or 64-bit operating system. Coreboot can offer a replacement for proprietary firmware, though it omits features like execution environments. Our own [Don Watkins][3] asked if Coreboot will ship on other System76 machines. Their response, [as reported by _Forbes_][4]: - -> _"Yes. Long term, System76 is working to open source all aspects of the computer. Thelio Io, the controller board in the Thelio desktop, is both open hardware and open firmware. This is a long journey but we're picking up speed. It's been less than a year since the our open hardware Thelio desktop was released and we're now producing two laptops with System76 Open Firmware."_ - -### Collapse OS is an operating system for the post-apocalypse - -Virgil Dupras, a software developer based in Quebec, is convinced the world's global supply chain will collapse before 2030. And he's worried that most [electronics will get caught in the crosshairs][5] due to "a very complex supply chain that we won't be able to achieve again for decades (ever?)."  - -To prepare for the worst, Dupras built Collapse OS. It's [designed to run][6] on "minimal or improvised machines" and perform simple tasks that are helpful in a post-apocalyptic society. These include editing text files, collecting sources files for MCUs and CPUs, and reading/writing from several storage devices. - -Dupras says it's intended for worst-case scenarios, and that a "weak collapse" might not be enough to justify its use. If you err on the side of caution, the Collapse OS project is accepting new contributors [on GitHub][7].  - -Per the project website, Dupras says his goal is for Collapse OS to be as self-contained as possible with the ability for users to install the OS without Internet access or other resources. Ideally, the goal is for Collapse OS to not be used at all. - -### ExpressionEngine will stay open source post-acquisition - -The team behind open source CMS ExpressEngine was acquired by Packet Tide - EEHarbor's parent company - in early October. [This announcement ][8]comes one year after Digital Locations acquired EllisLab, which develops EE core.  - -[In an announcement][9] on ExpressionEngine's website, EllisLab founder Rick Ellis said Digital Locations wasn't a good fit for ExpressionEngine. Citing Digital Location's goals to build an AI business, Ellis realized several months ago that ExpressionEngine needed a new home: - -> _"We decided that what was best for ExpressionEngine was to seek a new owner, one that could devote all the resources necessary for ExpressionEngine to flourish. Our top candidate was Packet Tide due to their development capability, extensive catalog of add-ons, and deep roots in the ExpressionEngine community._ -> -> _We are thrilled that they immediately expressed enthusiastic interest in becoming the caretakers of ExpressionEngine."_ - -Ellis says Packet Tide's first goal is to finish building ExpressionEngine 6.0, which will have a new control panel with a dark theme (who doesn't love dark mode?). ExpressionEngine adopted the Apache License Version 2.0 in November 2018, after 16 years as a proprietary tool. - -The tool is still marketed as an open source CMS, and EE Harbor developer Tom Jaeger said [in the EE Slack][10] that their plan is to keep ExpressionEngine open source now. But he also left the door open to possible changes.  - -### McAfee and IBM Security to lead the Open Source Cybersecurity Alliance - -The two tech giants will contribute the initiative's first open source code and content, under guidance from the OASIS consortium. The Alliance aims to share best practices, tech stacks, and security solutions in an open source platform.  - -Carol Geyer, chief development officer of OASIS, said the lack of standard language makes it hard for businesses to share data between tools and products. Despite efforts to collaborate, the lack of a standardized format yields more integration costs that are expensive and time-consuming. - -In lieu of building connections and integrations, [the Alliance wants members][11] to "develop protocols and standards which enable tools to work together and share information across vendors."  - -According to _Tech Republic_, IBM Security will contribute [STIX-Shifter][12], an open source library that offer a universal security system. Meanwhile, McAfee added its [OpenDXL Standard Ontology][13], a cybersecurity messaging format. Other members of the Alliance include CrowdStrike, CyberArk, and SafeBreach. - -#### In other news - - * [Paris uses open source to get closer to the citizen][14] - * [SD Times open source project of the week: ABAP SDK for IBM Watson][15] - * [Google's keeping Knative development under its thumb 'for the foreseeable future'][16] - * [Devs engage in soul-searching on future of open source][17] - * [Why leading Formula 1 teams back 'copycat' open source design idea][18] - - - -_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/news-october-13 - -作者:[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/lead-images/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://system76.com/pop -[3]: https://opensource.com/users/don-watkins -[4]: https://www.forbes.com/sites/jasonevangelho/2019/10/10/system76-will-begin-shipping-2-linux-laptops-with-coreboot-based-open-source-firmware/#15a4da174e64 -[5]: https://collapseos.org/why.html -[6]: https://www.digitaltrends.com/cool-tech/collapse-os-after-societys-collapse/ -[7]: https://github.com/hsoft/collapseos -[8]: https://wptavern.com/expressionengine-under-new-ownership-will-remain-open-source-for-now -[9]: https://expressionengine.com/blog/expressionengine-has-a-new-owner -[10]: https://eecms.slack.com/?redir=%2Farchives%2FC04CUNNR9%2Fp1570576465005500 -[11]: https://www.techrepublic.com/article/mcafee-ibm-join-forces-for-global-open-source-cybersecurity-initiative/ -[12]: https://github.com/opencybersecurityalliance/stix-shifter -[13]: https://www.opendxl.com/ -[14]: https://www.smartcitiesworld.net/special-reports/special-reports/paris-uses-open-source-to-get-closer-to-the-citizen -[15]: https://sdtimes.com/os/sd-times-open-source-project-of-the-week-abap-sdk-for-ibm-watson/ -[16]: https://www.datacenterknowledge.com/google-alphabet/googles-keeping-knative-development-under-its-thumb-foreseeable-future -[17]: https://www.linuxinsider.com/story/86282.html -[18]: https://www.autosport.com/f1/news/146407/why-leading-f1-teams-back-copycat-design-proposal diff --git a/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md b/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md deleted file mode 100644 index 13bc238c2c..0000000000 --- a/sources/news/20191023 Cisco issues critical security warning for IOS XE REST API container.md +++ /dev/null @@ -1,68 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cisco issues critical security warning for IOS XE REST API container) -[#]: via: (https://www.networkworld.com/article/3447558/cisco-issues-critical-security-warning-for-ios-xe-rest-api-container.html) -[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) - -Cisco issues critical security warning for IOS XE REST API container -====== -This Cisco IOS XE REST API vulnerability could lead to attackers obtaining the token-id of an authenticated user. -D3Damon / Getty Images - -Cisco this week said it issued a software update to address a vulnerability in its [Cisco REST API virtual service container for Cisco IOS XE][1] software that scored a critical 10 out of 10 on the Common Vulnerability Scoring System (CVSS) system. - -With the vulnerability an attacker could submit malicious HTTP requests to the targeted device and if successful, obtain the _token-id_ of an authenticated user. This _token-id_ could be used to bypass authentication and execute privileged actions through the interface of the REST API virtual service container on the affected Cisco IOS XE device, the company said. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] - -According to Cisco the REST API is an application that runs in a virtual services container. A virtual services container is a virtualized environment on a device and is delivered as an open virtual application (OVA).  The OVA package has to be installed and enabled on a device through the device virtualization manager (VMAN) CLI. - -**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][3] ]** - -The Cisco REST API provides a set of RESTful APIs as an alternative method to the Cisco IOS XE CLI to provision selected functions on Cisco devices. - -Cisco said the vulnerability can be exploited under the  following conditions: - - * The device runs an affected Cisco IOS XE Software release. - * The device has installed and enabled an affected version of the Cisco REST API virtual service container. - * An authorized user with administrator credentials (level 15) is authenticated to the REST API interface. - - - -The REST API interface is not enabled by default. To be vulnerable, the virtual services container must be installed and activated. Deleting the OVA package from the device storage memory removes the attack vector. If the Cisco REST API virtual service container is not enabled, this operation will not impact the device's normal operating conditions, Cisco stated.    - -This vulnerability affects Cisco devices that are configured to use a vulnerable version of Cisco REST API virtual service container. This vulnerability affected the following products: - - * Cisco 4000 Series Integrated Services Routers - * Cisco ASR 1000 Series Aggregation Services Routers - * Cisco Cloud Services Router 1000V Series - * Cisco Integrated Services Virtual Router - - - -Cisco said it has [released a fixed version of the REST API][4] virtual service container and   a hardened IOS XE release that prevents installation or activation of a vulnerable container on a device. If the device was already configured with an active vulnerable container, the IOS XE software upgrade will deactivate the container, making the device not vulnerable. In that case, to restore the REST API functionality, customers should upgrade the Cisco REST API virtual service container to a fixed software release, the company said. - -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/3447558/cisco-issues-critical-security-warning-for-ios-xe-rest-api-container.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://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20190828-iosxe-rest-auth-bypass -[2]: https://www.networkworld.com/newsletters/signup.html -[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr -[4]: https://www.cisco.com/c/en/us/about/legal/cloud-and-software/end_user_license_agreement.html -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md b/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md deleted file mode 100644 index b50a93d8c1..0000000000 --- a/sources/news/20191026 Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news.md +++ /dev/null @@ -1,78 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news) -[#]: via: (https://opensource.com/article/19/10/news-october-26) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -Netflix builds a Jupyter Lab alternative, a bug bounty to fight election hacking, Raspberry Pi goes microscopic, and more open source news -====== -Catch up on the biggest open source headlines from the past two weeks. -![Weekly news roundup with TV][1] - -In this edition of our open source news roundup, we take a look at a machine learning tool from Netflix, Microsoft's election software bug bounty, a cost-effective microscope built with Raspberry Pi, and more! - -### Netflix release Polynote machine learning tool - -While there have been numerous advances in machine learning over the last decade, it's still a difficult, laborious, and sometimes frustrating task. To help make that task easier, Netflix has [released a machine learning notebook environment][2] called Polynote as open source. - -Polynote enables "data scientists and AI researchers to integrate Netflix’s JVM-based machine learning framework with Python machine learning and visualization libraries". What make Polynote unique is its reproducibility feature, which "takes cells’ positions in the notebook into account before executing them, helping prevent bad practices that make notebooks difficult to rerun from the top." It's also quite flexible—Polynote works with Apache Spark and supports languages like Python, Scala, and SQL. - -You can grab Polynote [off GitHub][3] or learn more about it at the Polynote website. - -### Microsoft announces bug bounty program for its election software - -Hoping that more eyeballs on its code will make bugs shallow, Microsoft announced a [a bug bounty][4] for its open source ElectionGuard software development kit for voting machines. The goal of the program is to "uncover vulnerabilities and help bolster election security." - -The bounty is open to "security professionals, part-time hobbyists, and students." Successful submissions, which must include proofs of concept demonstrating how bugs could compromise the security of voters, are worth up to $15,000 (USD). - -If you're interested in participating, you can find ElectionGuard's code on [GitHub][5], and read more about the [bug bounty][6]. - -### microscoPI: a microscope built on Raspberry Pi - -It's not a stretch to say that the Raspberry Pi is one of the most flexible platforms for hardware and software hackers. Micropalaeontologist Martin Tetard saw the potential of the tiny computers in his field of study and [create the microscoPI][7]. - -The microscoPI is a Raspberry Pi-assisted microscope that can "capture, process, and store images and image analysis results." Using an old adjustable microscope with a movable stage as a base, Tetard added a Raspberry Pi B, a Raspberry Pi camera module, and a small touchscreen to the device. The result is a compact rig that's "completely portable and measuring less than 30 cm (12 inches) in height." The entire setup cost him €159 (about $177 USD). - -Tetard has set up [a website][8] for the microscoPI, where you can learn more about it. - -#### In other news - - * [Happy 15th birthday, Ubuntu][9] - * [Open-Source Arm Puts Robotics Within Reach][10] - * [Apache Rya matures open source triple store database][11] - * [UNICEF Launches Cryptocurrency Fund to Back Open Source Technology][12] - * [Open-source Delta Lake project moves to the Linux Foundation][13] - - - -_Thanks, as always, to Opensource.com staff members and moderators for their help this week._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/news-october-26 - -作者:[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/weekly_news_roundup_tv.png?itok=B6PM4S1i (Weekly news roundup with TV) -[2]: https://venturebeat.com/2019/10/23/netflix-open-sources-polynote-to-simplify-data-science-and-machine-learning-workflows/ -[3]: https://github.com/polynote/polynote -[4]: https://thenextweb.com/security/2019/10/21/microsofts-open-source-election-software-now-has-a-bug-bounty-program/ -[5]: https://github.com/microsoft/ElectionGuard-SDK -[6]: https://www.microsoft.com/en-us/msrc/bounty -[7]: https://www.geeky-gadgets.com/raspberry-pi-microscope-07-10-2019/ -[8]: https://microscopiproject.wordpress.com/ -[9]: https://www.omgubuntu.co.uk/2019/10/happy-birthday-ubuntu-2019 -[10]: https://hackaday.com/2019/10/17/open-source-arm-puts-robotics-within-reach/ -[11]: https://searchdatamanagement.techtarget.com/news/252472464/Apache-Rya-matures-open-source-triple-store-database -[12]: https://www.coindesk.com/unicef-launches-cryptocurrency-fund-to-back-open-source-technology -[13]: https://siliconangle.com/2019/10/16/open-source-delta-lake-project-moves-linux-foundation/ diff --git a/sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md b/sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md deleted file mode 100644 index b8a6aafc80..0000000000 --- a/sources/news/20191104 Hypervisor comeback, Linus says no and reads email, and more industry trends.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Hypervisor comeback, Linus says no and reads email, and more industry trends) -[#]: via: (https://opensource.com/article/19/11/hypervisor-stable-kernel-and-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Hypervisor comeback, Linus says no and reads email, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Containers in 2019: They're calling it a [hypervisor] comeback][2] - -> So what does all this mean as we continue with rapid adoption and hyper-ecosystem growth around Kubernetes and containers? Let’s try and break that down into a few key areas and see what all the excitement is about. - -**The impact**: I'm pretty sure that the title of the article is an LL Cool J reference, which I wholeheartedly approve of. Even more important though is a robust unpacking of developments in the hypervisor space over the last year and how they square up against the trend towards cloud-native and container-based development. - -## [Linux kernel is getting more reliable, says Linus Torvalds. Plus: What do you need to do to be him?][3] - -> "In the end my job is to say no. Somebody has to be able to say no, because other developers know that if they do something bad I will say no. They hopefully in turn are more careful. But in order to be able to say no, I have to know the background, because otherwise I can't do my job. I spend all my time basically reading email about what people are working on. - -**The impact**: The rehabilitation of Linus as a much chiller guy continues; this one has some good advice for people leading distributed teams. - -## [Automated infrastructure in the on-premise datacenter—OpenShift 4.2 on OpenStack 15 (Stein)][4] - -> Up until now IPI (Installer Provision Infrastructure) has only supported public clouds: AWS, Azure, and Google. Now with OpenShift 4.2 it is supporting OpenStack. For the first time we can bring IPI into the on-premise datacenter where it is IMHO most needed. This single feature has the potential to revolutionize on-premise environments and bring them into the cloud-age with a single click and that promise is truly something to get excited about! - -**The impact**: So much tech press has started with the assumption that every company should run their infrastructure like a hyperscaler. The technology is catching up to make the user experience of that feasible. - -## [Kubernetes autoscaling 101: Cluster autoscaler, horizontal autoscaler, and vertical pod autoscaler][5] - -> I’m providing in this post a high-level overview of different scalability mechanisms inside Kubernetes and best ways to make them serve your needs. Remember, to truly master Kubernetes, you need to master different ways to manage the scale of cluster resources, that’s [the core of promise of Kubernetes][6]. -> -> _Configuring Kubernetes clusters to balance resources and performance can be challenging, and requires expert knowledge of the inner workings of Kubernetes. Just because your app or services’ workload isn’t constant, it rather fluctuates throughout the day if not the hour. Think of it as a journey and ongoing process._ - -**The impact**: You can tell whether someone knows what they're talking about if they can represent it in a simple diagram. Thanks to the excellent diagrams in this post, I know more day 2 concerns of Kubernetes operators than I ever wanted to. - -## [GitHub: All open source developers anywhere are welcome][7] - -> Eighty percent of all open-source contributions today, come from outside of the US. The top two markets for open source development outside of the US are China and India. These markets, although we have millions of developers in them, are continuing to grow faster than any others at about 30% year-over-year average. - -**The impact**: One of my open source friends likes to muse on the changing culture within the open source community. He posits that the old guard gatekeepers are already becoming irrelevant. I don't know if I completely agree, but I think you can look at the exponentially increasing contributions from places that haven't been on the open source map before and safely speculate that the open source culture of tomorrow will be radically different than that of today. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/hypervisor-stable-kernel-and-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.infoq.com/articles/containers-hypervisors-2019/ -[3]: https://www.theregister.co.uk/2019/10/30/linux_kernel_is_getting_more_reliable_says_linus_torvalds/ -[4]: https://keithtenzer.com/2019/10/29/automated-infrastructure-in-the-on-premise-datacenter-openshift-4-2-on-openstack-15-stein/ -[5]: https://www.cncf.io/blog/2019/10/29/kubernetes-autoscaling-101-cluster-autoscaler-horizontal-autoscaler-and-vertical-pod-autoscaler/ -[6]: https://speakerdeck.com/thockin/everything-you-ever-wanted-to-know-about-resource-scheduling-dot-dot-dot-almost -[7]: https://www.zdnet.com/article/github-all-open-source-developers-anywhere-are-welcome/#ftag=RSSbaffb68 diff --git a/sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md b/sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md deleted file mode 100644 index 9addd4102c..0000000000 --- a/sources/news/20191105 Red Hat announces RHEL 8.1 with predictable release cadence.md +++ /dev/null @@ -1,92 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Red Hat announces RHEL 8.1 with predictable release cadence) -[#]: via: (https://www.networkworld.com/article/3451367/red-hat-announces-rhel-8-1-with-predictable-release-cadence.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Red Hat announces RHEL 8.1 with predictable release cadence -====== - -[Clkr / Pixabay][1] [(CC0)][2] - -[Red Hat][3] has just today announced the availability of Red Hat Enterprise Linux (RHEL) 8.1, promising improvements in manageability, security and performance. - -RHEL 8.1 will enhance the company’s open [hybrid-cloud][4] portfolio and continue to provide a consistent user experience between on-premises and public-cloud deployments. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][5] - -RHEL 8.1 is also the first release that will follow what Red Hat is calling its "predictable release cadence". Announced at Red Hat Summit 2019, this means that minor releases will be available every six months. The expectation is that this rhythmic release cycle will make it easier both for customer organizations and other software providers to plan their upgrades. - -[][6] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][6] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -Red Hat Enterprise Linux 8.1 provides product enhancements in many areas. - -### Enhanced automation - -All supported RHEL subscriptions now include access to Red Hat's proactive analytics, **Red Hat Insights**. With more than 1,000 rules for operating RHEL systems whether on-premises or cloud deployments, Red Hat Insights help IT administrators flag potential configuration, security, performance, availability and stability issues before they impact production. - -### New system roles - -RHEL 8.1 streamlines the process for setting up subsystems to handle specific functions such as storage, networking, time synchronization, kdump and SELinux. This expands on the variety of Ansible system roles. - -### Live kernel patching - -RHEL 8.1 adds full support for live kernel patching. This critically important feature allows IT operations teams to deal with ongoing threats without incurring excessive system downtime. Kernel updates can be applied to remediate common vulnerabilities and exposures (CVE) while reducing the need for a system reboot. Additional security enhancements include enhanced CVE remediation, kernel-level memory protection and application whitelisting. - -### Container-centric SELinux profiles - -These profiles allow the creation of more tailored security policies to control how containerized services access host-system resources, making it easier to harden systems against security threats. - -### Enhanced hybrid-cloud application development - -A reliably consistent set of supported development tools is included, among them the latest stable versions of popular open-source tools and languages like golang and .NET Core as well as the ability to power modern data-processing workloads such as Microsoft SQL Server and SAP solutions. - -Red Hat Linux 8.1 is available now for RHEL subscribers via the [Red Hat Customer Portal][7]. Red Hat Developer program members may obtain the latest releases at no cost at the [Red Hat Developer][8] site. - -#### Additional resources - -Here are some links to  additional information: - - * More about [Red Hat Enterprise Linux][9] - * Get a [RHEL developer subscription][10] - * More about the latest features at [Red Hat Insights][11] - - - -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/3451367/red-hat-announces-rhel-8-1-with-predictable-release-cadence.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://pixabay.com/vectors/red-hat-fedora-fashion-style-26734/ -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.networkworld.com/article/3316960/ibm-closes-34b-red-hat-deal-vaults-into-multi-cloud.html -[4]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html -[5]: https://www.networkworld.com/newsletters/signup.html -[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[7]: https://access.redhat.com/ -[8]: https://developer.redhat.com -[9]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux -[10]: https://developers.redhat.com/ -[11]: https://www.redhat.com/en/blog/whats-new-red-hat-insights-november-2019 -[12]: https://www.facebook.com/NetworkWorld/ -[13]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md b/sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md deleted file mode 100644 index 4d9c336304..0000000000 --- a/sources/news/20191105 System76 introduces laptops with open source BIOS coreboot.md +++ /dev/null @@ -1,57 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (System76 introduces laptops with open source BIOS coreboot) -[#]: via: (https://opensource.com/article/19/11/coreboot-system76-laptops) -[#]: author: (Don Watkins https://opensource.com/users/don-watkins) - -System76 introduces laptops with open source BIOS coreboot -====== -The company answers open hardware fans by revealing two laptops powered -with open source firmware coreboot. -![Guy on a laptop on a building][1] - -In mid-October, [System76][2] made an exciting announcement for open source hardware fans: It would soon begin shipping two of its laptop models, [Galago Pro][3] and [Darter Pro][4], with the open source BIOS [coreboot][5]. - -The coreboot project [says][6] its open source firmware "is a replacement for your BIOS / UEFI with a strong focus on boot speed, security, and flexibility. It is designed to boot your operating system as fast as possible without any compromise to security, with no back doors, and without any cruft from the '80s." Coreboot was previously known as LinuxBIOS, and the engineers who work on coreboot have also contributed to the Linux kernel. - -Most firmware on computers sold today is proprietary, which means even if you are running an open source operating system, you have no access to your machine's BIOS. This is not so with coreboot. Its developers share the improvements they make, rather than keeping them secret from other vendors. Coreboot's source code can be inspected, learned from, and modified, just like any other open source code. - -[Joshua Woolery][7], marketing director at System76, says coreboot differs from a proprietary BIOS in several important ways. "Traditional firmware is closed source and impossible to review and inspect. It's bloated with unnecessary features and unnecessarily complex [ACPI][8] implementations that lead to PCs operating in unpredictable ways. System76 Open Firmware, on the other hand, is lightweight, fast, and cleanly written." This means your computer boots faster and is more secure, he says. - -I asked Joshua about the impact of coreboot on open hardware overall. "The combination of open hardware and open firmware empowers users beyond what's possible when one or the other is proprietary," he says. "Imagine an open hardware controller like [System76's] [Thelio Io][9] without open source firmware. One could read the schematic and write software to control it, but why? With open firmware, the user starts from functioning hardware and software and can expand from there. Open hardware and firmware enable the community to learn from, adapt, and expand on our work, thus moving technology forward as a whole rather than requiring individuals to constantly re-implement what's already been accomplished." - -Joshua says System76 is working to open source all aspects of the computer, and we will see coreboot on other System76 machines. The hardware and firmware in Thelio Io, the controller board in the company's Thelio desktops, are both open. Less than a year after System76 introduced Thelio, the company is now marketing two laptops with open firmware. - -If you would like to see System76's firmware contributions to the coreboot project, visit the code repository on [GitHub][10]. You can also see the schematics for any supported System76 model by sending an [email][11] with the subject line: _Schematics for <MODEL>_. (Bear in mind that the only currently supported models are darp6 and galp4.) Using the coreboot firmware on other devices is not supported and may render them inoperable, - -Coreboot is licensed under the GNU Public License. You can view the [documentation][12] on the project's website and find out how to [contribute][13] to the project on GitHub. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/coreboot-system76-laptops - -作者:[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_code_programming_laptop.jpg?itok=ormv35tV (Guy on a laptop on a building) -[2]: https://opensource.com/article/19/5/system76-secret-sauce -[3]: https://system76.com/laptops/galago -[4]: https://system76.com/laptops/darter -[5]: https://www.coreboot.org/ -[6]: https://www.coreboot.org/users.html -[7]: https://www.linkedin.com/in/joshuawoolery -[8]: https://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface -[9]: https://opensource.com/article/18/11/system76-thelio-desktop-computer -[10]: https://github.com/system76/firmware-open -[11]: mailto:productdev@system76.com -[12]: https://doc.coreboot.org/index.html -[13]: https://github.com/coreboot/coreboot diff --git a/sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md b/sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md deleted file mode 100644 index df2db0d6f8..0000000000 --- a/sources/news/20191112 GitHub report surprises, serverless hotness, and more industry trends.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (GitHub report surprises, serverless hotness, and more industry trends) -[#]: via: (https://opensource.com/article/19/11/github-report-serverless-hotness-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -GitHub report surprises, serverless hotness, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [GitHub tops 40 million developers as Python, data science, machine learning popularity surges][2] - -> In its annual Octoverse report, GitHub, owned by Microsoft, said it had more than 10 million new users, 44 million repositories created and 87 million pull requests in the last 12 months. The report is a good view of open source software and where the community is headed. - -**The impact:** The finding that hit home hardest for me is that "nearly 80% of GitHub users are outside of the US." While an important part of open source history comes from the east and west coasts of America, there is a good chance that the future of the movement will happen elsewhere. - -## [Serverless: Is it the Kubernetes killer?][3] - -> Serverless isn't here to destroy Kubernetes. The cloud infrastructure space race isn't a zero-sum game. Kubernetes is an obvious evolution following OpenStack and can be run successfully inside of it. There will be OpenStack users for a long time to come, and there are also reasons many companies have moved on from there. Serverless is another tool in the belt of forward-thinking development teams. And increasingly, it can be [run on top of Kubernetes][4] (see Knative), enabling you to get the benefits of the simplicity of serverless and the complexity of Kubernetes where it makes sense for both in your stack. - -**The impact:** The moral of the story is that legacy doesn't really go away, it just gets built in and around. - -## [When Quarkus meets Knative serverless workloads][5] - -> Now, let's discuss how developers can use Quarkus to bring Java into serverless, a place where previously, it was unable to go. Quarkus introduces a comprehensive and seamless approach to generating an operating system specific (aka native) executable from your Java code, as you do with languages like Go and C/C++. Environments such as event-driven and serverless, where you need to start a service to react to an event, require a low time-to-first-response, and traditional Java stacks simply cannot provide this. Knative enables developers to run cloud-native applications as serverless containers in seconds and the containers will go down to zero on demand. -> -> In addition to compiling Java to Knative, Quarkus aims to improve developer productivity. Quarkus works out of the box with popular Java standards, frameworks and libraries like Eclipse MicroProfile, Apache Kafka, RESTEasy, Hibernate, Spring, and many more. Developers familiar with these will feel at home with Quarkus, which should streamline code for the majority of common use cases while providing the flexibility to cover others that come up. - -**The impact:** It's good to start getting specific with how and where the new hotness can be used. The answer, in this case, is "with the other new hotness." - -## [Why you should join the CNCF Meetup Program][6] - -> With the recent changes to Meetup’s [policies][7], we wanted to share a reminder of the benefits of joining the [CNCF Meetup Program][8] and encourage Meetups in the CNCF ecosystem to apply.  -> -> As part of our Meetup Pro membership, CNCF is able to organize a network with an unlimited number of groups on a single account. - -**The impact:** The long term response to this unfortunate fallout from the WeWork debacle is to build a distributed open source Meetup alternative. Thankfully in the meantime, the CNCF has a more pragmatic response. - -## [Introducing your friends to automation (and overcoming their fear)][9] - -> My team and I were in a meeting a little while back with a third party vendor when they asked us what our stance was on automation. My reply was, "We want to automate everything." On top of my reply, my teammates added, "Well, we don’t want to automate ourselves out of a job." - -**The impact:** I've always thought it was a bit cavalier when someone would say, "I think it's my job to automate myself out of a job." There is plenty of circumstances where that is the last measure of success someone would want to be measured by. I'm happy to see this addressed head-on. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/github-report-serverless-hotness-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.zdnet.com/article/github-tops-40-million-developers-as-python-data-science-machine-learning-popularity-surges/#ftag=RSSbaffb68 -[3]: https://www.forbes.com/sites/forbestechcouncil/2019/11/04/serverless-is-it-the-kubernetes-killer/#7e6740711f77 -[4]: https://github.com/knative -[5]: https://vmblog.com/archive/2019/10/29/when-quarkus-meets-knative-serverless-workloads.aspx#.XbiN1JNKiuN -[6]: https://www.cncf.io/blog/2019/11/01/why-you-should-join-the-cncf-meetup-program/ -[7]: https://www.meetup.com/lp/paymentchanges?mpId=9038 -[8]: https://www.meetup.com/pro/cncf -[9]: https://www.redhat.com/sysadmin/introducing-automation diff --git a/sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md b/sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md deleted file mode 100644 index c4f25f1419..0000000000 --- a/sources/news/20191121 The Cross-Platform Source Explorer Sourcetrail is Now Open Source.md +++ /dev/null @@ -1,79 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Cross-Platform Source Explorer Sourcetrail is Now Open Source) -[#]: via: (https://itsfoss.com/sourcetrail/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -The Cross-Platform Source Explorer Sourcetrail is Now Open Source -====== - -[Sourcetrail][1] is a cross-platform source explorer that lets you visualize the unfamiliar source code by using graph visualization. - -![][2] - -In other words, it makes it easy to understand the structure of source code and how it works (technically) by visually representing them using a graph. - -This is particularly helpful when you join a project and you have to work on existing code written in the past by several developers. - -You can use it with your favorite IDE like Eclipse, IntelliJ IDEA, PyCharm or code editors like Atom, Visual Studio Code, Sublime Text etc. It supports C, C++, Java and Python. - -This old video gives you the introduction to Sourcetrail: - -Even though it was free for non-commercial use, they charged for a commercial license. However, they recently decided to make the whole thing free and open source. - -So, yes, you can find their source code listed on [GitHub][3] now. - -### What Has Changed for Sourcetrail? - -The reason they switched as an open-source solution is that they wanted their tool to be accessible to more developers. - -Their commercial licensing plan was supposed to help them make money – however, it limited the reach of their project. - -In their [announcement post][4], they mentioned their idea of this decision as follows: - -> We have been going back and forth, discussing and testing potential solutions to many of those issues for a long time now. Many of our thoughts revolved around how to make more money and use it to solve those issues. Looking at other companies in the field, it seemed that to make more money, our only option was making our licenses more and more expensive, which in turn would limit our audience to fewer developers. We always dismissed the idea because **we started to make Sourcetrail to benefit as many developers as possible** and not to be a premium product for a few people in a handful of companies. - -Also, they found it tough to provide cross-platform support while trying to reproduce the issues and apply a fix to them, especially for Linux distros. So, making their project open source was an ideal choice. - -To further clarify the situation they also explained why their commercial licensing plan wasn’t working out: - -> Initially we received a couple of public grants that allowed us to launch Sourcetrail publicly. We decided to go down the traditional road of selling software licenses to sustain further development. Of course that meant to keep the code private if we wanted to protect our business…In retrospect, this decision really narrowed down our user base, making it hard for developers to start using Sourcetrail for multiple reasons - -You can find all the details for what they plan for the future in their [announcement post][4]. - -### How to get Sourcetrail on Linux? - -You can find and download the latest release of Sourcetrail on its release page on GitHub: - -[Download Sourcetrail][5] - -Extract the downloaded file and you’ll see a Sourcetrail.sh shell script. Run this script with sudo to install Sourcerail. - -You should [read the documentation][6] for the project setup. They also have some [useful tutorial videos on their YouTube channel][7]. - -Sourcetrail was free before but now it’s free in the true sense. It’s good to see that the developers have made it open source and now more programmers can use this tool to understand large, shared code base. You may also checkout a slightly similar open source tool [Sourcegraph][8]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/sourcetrail/ - -作者:[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.sourcetrail.com/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/sourcetrail-ui.png?ssl=1 -[3]: https://github.com/CoatiSoftware/Sourcetrail -[4]: https://www.sourcetrail.com/blog/open_source/ -[5]: https://github.com/CoatiSoftware/Sourcetrail/releases -[6]: https://www.sourcetrail.com/documentation/#PROJECTSETUP -[7]: https://www.youtube.com/channel/UCuKthdG-V4n2RZ1HDJhGVpQ/videos -[8]: https://itsfoss.com/sourcegraph/ diff --git a/sources/news/20191125 Fail-free Kubernetes, significant events, and more industry trends.md b/sources/news/20191125 Fail-free Kubernetes, significant events, and more industry trends.md deleted file mode 100644 index 009e30cd40..0000000000 --- a/sources/news/20191125 Fail-free Kubernetes, significant events, and more industry trends.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Fail-free Kubernetes, significant events, and more industry trends) -[#]: via: (https://opensource.com/article/19/11/fail-free-kubernetes-and-more-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -Fail-free Kubernetes, significant events, and more industry trends -====== -A weekly look at open source community, market, and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Why teams fail with Kubernetes—and what to do about it][2] - -> Fail to address the questions "Who is responsible for _x_?" and "Who is affected by _y_?" and you'll put all your efforts at risk. For example, replace "_x_" above with "deciding on namespaces versus clusters for service and environment isolation" or "upgrading all clusters to a new Kubernetes version," and you start to see why you need to clarify the boundaries of responsibility and their impacts. - -**The impact**: Wouldn't it be nice if operators and role-based access control could make the messiness of human interaction go away? Why can't auto-scaling just mean auto-scaling? Tough luck! You're going to have to figure out the people side of it too! - -## [The New Stack Context: The past, present, and future of Kubernetes][3] - -> What have been some of the most significant events in the Kubernetes and cloud native community over the past year? A lot of work has been done in slimming and stabilizing the core. Operators were a growing trend over the past year—operators are mechanisms to expand the number of things you can build on top of Kubernetes. We are seeing Kubernetes expand into new workloads as well. - -**The impact**: In some way, Kubernetes is an ongoing effort in re-building the airplane mid-flight. The good news is that we're getting better at doing that, and the future holds ubiquity, according to this podcast. - -## [Q&A: Fidelity invests in cloud-native, open source projects to step up innovation][4] - -> “We are seeing that Kubernetes, CNCF, and cloud-native technology are the key players for us when we go multicloud and hybrid-cloud model,” said [Amr Abdelhalem][5] (pictured), head of cloud platforms at Fidelity Investments. “That’s why we are here. We are here actually in Kubernetes and KubeCon for that reason. That’s where we see this abstract layer that guarantees you the portability for moving your application from one cloud provider to another.” - -**The impact**: Think about this: Fidelity is a member of the CNCF. What does that mean about the distance between the creator and consumer of open source software? It's exciting because it exemplifies the participatory ideals of open source; its a new challenge for the ecosystem because participants are starting to represent industry verticals that might not have much overlap whose needs need reconciliation. Fun times! - -## [The future of hybrid cloud is bright as 73% of enterprises moving apps back on Prem][6] - -> This year’s report illustrated that creating and executing a cloud strategy has become a multidimensional challenge. At one time, a primary value proposition associated with the public cloud was substantial upfront capex savings. Now, enterprises have discovered that there are other considerations when selecting the best cloud for the business as well, and that one size cloud strategy doesn’t fit all use cases. For example, while applications with unpredictable usage may be best suited to the public clouds offering elastic IT resources, workloads with more predictable characteristics can often run on-premises at a lower cost than public cloud. Savings are also dependent on businesses’ ability to match each application to the appropriate cloud service and pricing tier, and to remain diligent about regularly reviewing service plans and fees, which change frequently. - -**The impact**: The short version is that cost is not the only, or even the most important factor, in choosing where to run a workload. More and more often it is the nature of the workload itself. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/fail-free-kubernetes-and-more-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://techbeacon.com/enterprise-it/why-teams-fail-kubernetes-what-do-about-it -[3]: https://thenewstack.io/the-new-stack-context-the-past-present-and-future-of-kubernetes/ -[4]: https://siliconangle.com/2019/11/21/qa-fidelity-invests-cloud-native-open-source-projects-step-innovation-kubecon/ -[5]: https://www.linkedin.com/in/amrhalem/ -[6]: https://www.dqindia.com/the-future-of-hybrid-cloud-is-bright-as-73-of-enterprises-moving-apps-back-on-prem/ From 572eba40026f090dabc0545bde3b07206c9acce7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 22:56:03 +0800 Subject: [PATCH 702/800] =?UTF-8?q?=E8=B6=85=E6=9C=9F=E5=9B=9E=E6=94=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @LuuMing @heguangzhi @wenwensnow @warmfrog --- .../20180207 23 open source audio-visual production tools.md | 1 - sources/tech/20191007 Understanding Joins in Hadoop.md | 2 +- sources/tech/20191017 Using multitail on Linux.md | 2 +- ...ans, infrastructure predictions, and more industry trends.md | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sources/tech/20180207 23 open source audio-visual production tools.md b/sources/tech/20180207 23 open source audio-visual production tools.md index b6b748ec39..fd196200ce 100644 --- a/sources/tech/20180207 23 open source audio-visual production tools.md +++ b/sources/tech/20180207 23 open source audio-visual production tools.md @@ -1,4 +1,3 @@ -luming translating 23 open source audio-visual production tools ====== diff --git a/sources/tech/20191007 Understanding Joins in Hadoop.md b/sources/tech/20191007 Understanding Joins in Hadoop.md index ea0025a9d2..4c34ed896c 100644 --- a/sources/tech/20191007 Understanding Joins in Hadoop.md +++ b/sources/tech/20191007 Understanding Joins in Hadoop.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (heguangzhi) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191017 Using multitail on Linux.md b/sources/tech/20191017 Using multitail on Linux.md index 3b6fc7ca78..b89ef375d2 100644 --- a/sources/tech/20191017 Using multitail on Linux.md +++ b/sources/tech/20191017 Using multitail on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (wenwensnow) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md index f1d2b48d0d..e915fe74d9 100644 --- a/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md +++ b/sources/tech/20191028 Enterprise JavaBeans, infrastructure predictions, and more industry trends.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (warmfrog) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From a76099269341889a93dc0259ca26fe56ea689a64 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sat, 30 Nov 2019 23:14:04 +0800 Subject: [PATCH 703/800] APL --- ...witching from Python 2 to Python 3- What you need to know.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md index fe5115256e..6382a6fbc8 100644 --- a/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md +++ b/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 2ec0c15d90c01846df5923646a8496fe8b48e9f7 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 00:00:02 +0800 Subject: [PATCH 704/800] TSL --- ...on 2 to Python 3- What you need to know.md | 104 ----------------- ...on 2 to Python 3- What you need to know.md | 105 ++++++++++++++++++ 2 files changed, 105 insertions(+), 104 deletions(-) delete mode 100644 sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md create mode 100644 translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md diff --git a/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md deleted file mode 100644 index 6382a6fbc8..0000000000 --- a/sources/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Switching from Python 2 to Python 3: What you need to know) -[#]: via: (https://opensource.com/article/19/11/end-of-life-python-2) -[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) - -Switching from Python 2 to Python 3: What you need to know -====== -Python 2 will reach its end of life in mere weeks. Here's what to know -before you migrate to Python 3. -![A sunrise][1] - -Python 2.7 will officially become unsupported beginning January 1, 2020. There is one [final bugfix][2] planned after this date, but then that's it. - -What does this end of life (EOL) mean for you? If you run Python 2, you need to migrate. - -### Who decided to EOL Python 2? - -In [2012][3], the team maintaining the Python programming language reviewed its options. There were two increasingly different codebases, Python 2 and Python 3. Both were popular, but the newer version was not as widely adopted. - -In addition to Python 3's disruption of changing the underlying way data is handled by completely reworking Unicode support, a major version change allowed non-backward-compatible changes to happen all at once. This decision was documented [in 2006][4]. To ease the disruption, Python 2 continued to be maintained, with some features backported. To further help the community transition, the EOL date was extended [from 2015 to 2020][5], another five years. - -Maintaining divergent codebases was a hassle the team knew it had to resolve. Ultimately, a decision was [announced][6]: - -> "We are volunteers who make and take care of the Python programming language. We have decided that January 1, 2020, will be the day that we sunset Python 2. That means that we will not improve it anymore after that day, even if someone finds a security problem in it. You should upgrade to Python 3 as soon as you can." - -[Nick Coghlan][7], a core CPython developer and current member of the Python steering council, [adds more information in his blog][8]. And [PEP 404][9], written by [Barry Warsaw][10] (also a member of the Python steering council), details why Python 2.8 will never be a thing. - -### Is anyone still supporting Python 2? - -Support for Python 2 from providers and vendors will vary. [Google Cloud has announced][11] how it plans to support Python 2 going forward. Red Hat has also [announced plans for Red Hat Enterprise Linux (RHEL)][12], and AWS has announced [minor version update requirements][13] for the AWS command-line interface and [SDK][14]. - -You can also read the Stack Overflow blog post "[Why is the Migration to Python 3 Taking So Long?][15]" by [Vicki Boykis][16], in which she identifies three reasons why Python 3 adoption is slow.  - -### Reasons to use Python 3 - -Regardless of ongoing support, it's a really good idea to migrate to Python 3 as soon as you can. Python 3 will continue to be supported, and it has some really neat things that Python 2 just doesn't have. - -The recently released [Python 3.8][17] includes such [features][18] as the [walrus operator][19], [positional-only parameters][20], and [self-documenting f-strings][21]. Earlier releases of Python 3 introduced [features][22] such as [asyncio][23], [f-strings][24], [type hints][25], and [pathlib][26], just to name a few. - -The top 360 most-downloaded packages [have already migrated to Python 3][27]. You can check your requirements.txt file using the [caniusepython3][28] package to see if any packages you depend on haven't yet been migrated. - -### Resources for porting Python 2 to Python 3 - -There are many resources available to ease your migration to Python 3. For example, the [Porting Python 2 to Python 3 guide][29] lists a bunch of tools and tricks to help you achieve single-source Python 2/3 compatibility. There are also some useful tips on [Python3statement.org][30]. - -[Dustin Ingram][31] and [Chris Wilcox][32] gave a [presentation at Cloud Next '19][33] detailing some of the motivations and migration patterns for the transition into Python 3. [Trey Hunner][34] gave a [presentation at PyCon 2018][35] about Python 3's most useful features to encourage you to migrate so you can take advantage of them. - -### Join us! - -January 1, 2020, is now just weeks away. If you need daily reminders of just how soon that is (and you use Twitter), follow the [Countdown to Python 2 sunset][36] Twitter bot. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/end-of-life-python-2 - -作者:[Katie McLaughlin][a] -选题:[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/glasnt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/govt_a%20new%20dawn.png?itok=b4zU-VAY (A sunrise) -[2]: https://www.python.org/dev/peps/pep-0373/#maintenance-releases -[3]: https://github.com/python/peps/commit/a733bc927acbca16bfa3de486fb2c7d3f767a748 -[4]: https://www.python.org/dev/peps/pep-3000/#compatibility-and-transition -[5]: https://github.com/python/peps/commit/f82462002b86feff36215b4230be28967039b0cc -[6]: https://www.python.org/doc/sunset-python-2/ -[7]: https://twitter.com/ncoghlan_dev -[8]: http://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html -[9]: https://www.python.org/dev/peps/pep-0404/ -[10]: https://twitter.com/pumpichank -[11]: https://cloud.google.com/python/docs/python2-sunset/?utm_source=osdc&utm_medium=blog&utm_campaign=pysunset -[12]: https://access.redhat.com/solutions/4455511 -[13]: https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/ -[14]: https://aws.amazon.com/sdk-for-python/ -[15]: https://stackoverflow.blog/2019/11/14/why-is-the-migration-to-python-3-taking-so-long/ -[16]: https://twitter.com/vboykis -[17]: https://www.python.org/downloads/ -[18]: https://docs.python.org/3.8/whatsnew/3.8.html -[19]: https://docs.python.org/3.8/whatsnew/3.8.html#assignment-expressions -[20]: https://docs.python.org/3.8/whatsnew/3.8.html#positional-only-parameters -[21]: https://docs.python.org/3.8/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging -[22]: https://docs.python.org/3.8/whatsnew/index.html -[23]: https://docs.python.org/3.8/library/asyncio.html#module-asyncio -[24]: https://docs.python.org/3.7/whatsnew/3.6.html#pep-498-formatted-string-literals -[25]: https://docs.python.org/3.7/whatsnew/3.5.html#pep-484-type-hints -[26]: https://docs.python.org/3.8/library/pathlib.html#module-pathlib -[27]: http://py3readiness.org/ -[28]: https://pypi.org/project/caniusepython3/ -[29]: https://docs.python.org/3/howto/pyporting.html -[30]: https://python3statement.org/practicalities/ -[31]: https://twitter.com/di_codes -[32]: https://twitter.com/chriswilcox47 -[33]: https://www.youtube.com/watch?v=Bye7Rms0Vgw&utm_source=osdc&utm_medium=blog&utm_campaign=pysunset -[34]: https://twitter.com/treyhunner -[35]: https://www.youtube.com/watch?v=klaGx9Q_SOA -[36]: https://twitter.com/python2sunset diff --git a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md new file mode 100644 index 0000000000..32a5164480 --- /dev/null +++ b/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Switching from Python 2 to Python 3: What you need to know) +[#]: via: (https://opensource.com/article/19/11/end-of-life-python-2) +[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) + +从 Python 2 切换到 Python 3 你所需要了解的 +====== + +> Python 2 将在几周内到达生命终点,这篇文章是你迁移到 Python 3 之前应该知道的。 + +![A sunrise][1] + +从 2020 年 1 月 1 日开始,Python 2.7 将不再得到正式支持。在此日期之后,将会发布一个[最终错误修复][2]计划,但是仅此而已。 + +Python 2 的生命终端(EOL)对你意味着什么?如果正在运行这 Python 2,则需要迁移。 + +### 是谁决定 Python 2 的生命终点? + +在 [2012][3] 年,维护 Python 编程语言的团队审查了其选项。有两个越来越不同的代码库,Python 2 和 Python 3。这两者都很流行,但是较新的版本并未得到广泛采用。 + +除了 Python 3 中处理数据的底层方式由完全重写的 Unicode 支持的变化造成了断层,这个主要版本的变化还一次性出现了一些非向后兼容的更改。这种断层的决定成文于 [2006 年][4]。为了减轻该断层的影响,Python 2 继续保持维护,并向后移植了一些 Python 3 的功能。为了进一步帮助社区过渡,EOL 日期[从 2015 年延长至 2020 年][5]又延长了五年。 + +维护不同的代码库是该团队知道必须解决的麻烦。最终,他们[宣布了][6]一项决定: + +>“我们是制作和照料 Python 编程语言的志愿者。我们已决定 2020 年 1 月 1 日将是我们停止使用 Python 2 的日子。这意味着在这一天之后,即使有人发现其中存在安全问题,我们将不再对其进行改进。你应尽快升级到 Python 3。” + +[Nick Coghlan][7] 是 CPython 的核心开发人员,也是 Python 指导委员会的现任成员,[在他的博客中添加了更多信息][8]。由 [Barry Warsaw][10](也是 Python 指导委员会的成员)撰写的 [PEP 404][9] 详细说明了 Python 2.8 永远不会面世的原因。 + +### 有人还在支持 Python 2 吗? + +提供者和供应商对 Python 2 的支持会有所不同。[Google Cloud 宣布了][11]它计划未来如何支持 Python 2。红帽还[宣布了红帽企业 Linux(RHEL)的计划][12],而 AWS 宣布了 AWS 命令行界面和 [SDK][14] 的[次要版本更新要求][13]。 + +你还可以阅读 [Vicki Boykis][16] 在 Stack Overflow 撰写的博客文章“[为什么迁移到 Python 3 需要这么长时间?][15]”,其中她指出了采用 Python 3 缓慢的三个原因。 + +### 使用 Python 3 的原因 + +不管是否有持续的支持,尽快迁移到 Python 3 是一个好主意。Python 3 将继续受到支持,它具有 Python 2 所没有的一些非常整洁的东西。 + +最近发布的 [Python 3.8][17] 包含 [海象运算符][19]、[位置参数][20]和[自描述的格式化字符串][21]等[功能][18]。Python 3 的早期版本引入的[功能][22],例如 [异步 IO][23],[格式化字符串][24],[类型提示][25] 和 [pathlib][26],这里只提及了一点点。 + +下载最多的前 360 个软件包[已迁移到 Python 3][27]。你可以使用 [caniusepython3][28] 软件包检查你的 `requirements.txt` 文件,以查看你依赖的任何软件包是否尚未迁移。 + +### 将Python 2移植到Python 3的参考资源 + +有许多参考资源可简化你向 Python 3 的迁移。例如,“[将 Python 2 移植到 Python 3 指南][29]”列出了许多工具和技巧,可帮助你实现与 Python 2/3 单一源代码的兼容性。在 [Python3statement.org][30] 上也有一些有用的技巧。 + +[Dustin Ingram][31] 和 [Chris Wilcox][32] 在 [Cloud Next '19][33]上作了一个演讲,详细介绍了向 Python 3 过渡的一些动机和迁移模式。[Trey Hunner][34] 在 [PyCon 2018 演讲][35]上介绍了 Python 3 最有用的功能,鼓励你进行迁移,以便你可以利用它们。 + +### 加入我们! + +距 2020 年 1 月 1 日仅有几周了。如果你需要每天提醒一下它即将到来的时间(并你使用 Twitter 的话),请关注 [Python 2 日落倒计时][36] Twitter 机器人。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/end-of-life-python-2 + +作者:[Katie McLaughlin][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/glasnt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/govt_a%20new%20dawn.png?itok=b4zU-VAY (A sunrise) +[2]: https://www.python.org/dev/peps/pep-0373/#maintenance-releases +[3]: https://github.com/python/peps/commit/a733bc927acbca16bfa3de486fb2c7d3f767a748 +[4]: https://www.python.org/dev/peps/pep-3000/#compatibility-and-transition +[5]: https://github.com/python/peps/commit/f82462002b86feff36215b4230be28967039b0cc +[6]: https://www.python.org/doc/sunset-python-2/ +[7]: https://twitter.com/ncoghlan_dev +[8]: http://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html +[9]: https://www.python.org/dev/peps/pep-0404/ +[10]: https://twitter.com/pumpichank +[11]: https://cloud.google.com/python/docs/python2-sunset/?utm_source=osdc&utm_medium=blog&utm_campaign=pysunset +[12]: https://access.redhat.com/solutions/4455511 +[13]: https://aws.amazon.com/blogs/developer/deprecation-of-python-2-6-and-python-3-3-in-botocore-boto3-and-the-aws-cli/ +[14]: https://aws.amazon.com/sdk-for-python/ +[15]: https://stackoverflow.blog/2019/11/14/why-is-the-migration-to-python-3-taking-so-long/ +[16]: https://twitter.com/vboykis +[17]: https://www.python.org/downloads/ +[18]: https://docs.python.org/3.8/whatsnew/3.8.html +[19]: https://docs.python.org/3.8/whatsnew/3.8.html#assignment-expressions +[20]: https://docs.python.org/3.8/whatsnew/3.8.html#positional-only-parameters +[21]: https://docs.python.org/3.8/whatsnew/3.8.html#f-strings-support-for-self-documenting-expressions-and-debugging +[22]: https://docs.python.org/3.8/whatsnew/index.html +[23]: https://docs.python.org/3.8/library/asyncio.html#module-asyncio +[24]: https://docs.python.org/3.7/whatsnew/3.6.html#pep-498-formatted-string-literals +[25]: https://docs.python.org/3.7/whatsnew/3.5.html#pep-484-type-hints +[26]: https://docs.python.org/3.8/library/pathlib.html#module-pathlib +[27]: http://py3readiness.org/ +[28]: https://pypi.org/project/caniusepython3/ +[29]: https://docs.python.org/3/howto/pyporting.html +[30]: https://python3statement.org/practicalities/ +[31]: https://twitter.com/di_codes +[32]: https://twitter.com/chriswilcox47 +[33]: https://www.youtube.com/watch?v=Bye7Rms0Vgw&utm_source=osdc&utm_medium=blog&utm_campaign=pysunset +[34]: https://twitter.com/treyhunner +[35]: https://www.youtube.com/watch?v=klaGx9Q_SOA +[36]: https://twitter.com/python2sunset From 72e0bf05af9aa9302e8a59f8c3f61d483c5cfaaf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 1 Dec 2019 00:52:16 +0800 Subject: [PATCH 705/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191130=207=20ma?= =?UTF-8?q?ker=20gifts=20for=20kids=20and=20teens?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191130 7 maker gifts for kids and teens.md --- ...191130 7 maker gifts for kids and teens.md | 185 ++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 sources/tech/20191130 7 maker gifts for kids and teens.md diff --git a/sources/tech/20191130 7 maker gifts for kids and teens.md b/sources/tech/20191130 7 maker gifts for kids and teens.md new file mode 100644 index 0000000000..a821b221e3 --- /dev/null +++ b/sources/tech/20191130 7 maker gifts for kids and teens.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (7 maker gifts for kids and teens) +[#]: via: (https://opensource.com/article/19/11/maker-gifts-kids) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +7 maker gifts for kids and teens +====== +Make your holiday gift shopping easy with this guide to gifts sure to +spark creativity and innovation in babies, kids, tweens, teens, and +beyond. +![Gift box opens with colors coming out][1] + +Struggling with what gifts to give the young person in your life this holiday season? Here are my top picks for open source presents that will spark creativity and inspire for years to come. + +### Hummingbird Robotics Kit + +![Hummingbird Robotics Kit][2] + +**Ages**: 8 to adult + +**What it is:** The [Hummingbird Robotics Kit][3] is a complete robotics kit with a microcontroller, motors, LEDs, and sensors. The robot brain has special ports that little hands can easily attach robot components to. The Hummingbird kits don't come with a body, empowering users to create their own. + +**Why I love it:** The Hummingbird works with multiple programming languages—from visual (BirdBlox, MakeCode, Snap) to text (Python and Java)— making it scalable as users' coding skills increase. All the components are exactly as you'd find them at an electronics store, not obscured by plastic like other robot kits. This demystifies the inner workings of robots and makes it easy to source more parts if needed. + +Because there is no set project, the Hummingbird is the perfect robot for creativity. + +The Hummingbird Bit has open source software and firmware. It works on Linux, Windows, Mac, Chromebook, Android, and iOS. + +**Cost:** Starts at US$ 99. + +### Makey Makey Classic + +![Makey Makey Classic][4] + +**Ages:** 6 to adult + +**What it is:** [Makey Makey Classic][5] turns any conductive object, from marshmallows to a friend, into a computer key. + +You use alligator clips to connect the Makey Makey to the conductive object of your choice. Then, you close the circuit between the ground connection and any trigger key by touching both conductive objects at the same time. The Makey Makey is a good way to safely explore electricity at home while creating interesting ways to interact with your computer. + +**Why I love it:** Makey Makey can be paired with video games made in Scratch to create unique controllers that further immerse users in the game. The possibilities are endless, from instruments made of toilet rolls and foil to interactive art and stories. It works on Linux, Windows, and Mac computers with a USB port. + +**Cost:** US$ 49.95 + +### Arduino Uno + +![Arduino Uno][6] + +**Ages**: 10 to adult + +**What it is:** Arduinos are microcontrollers that can be purchased with or without an electronics kit, and they come in many different flavors, though I like the [Arduino Uno][7] the best. Additional components, such as LEDs, motors, and sensors can be purchased as needed from any electronics shop. + +**Why I love it:** The Arduino Uno is well-documented, so it's easy for makers to find tutorials online. The Arduino can bring a wide variety of electronic projects to life, from simple to complex. The Arduino features open source firmware and hardware. It works on Linux, Mac, and Windows. + +**Cost:** Starts at US$ 22.00 for the board. The overall cost varies depending on projects and skill level. + +### DIY maker kit + +![A maker kit assembled in a quick trip to the hardware store][8] + +**Ages**: 8 to adult + +**What it is:** Many of today's makers, creators, and programmers started out tinkering with objects that happened to be lying around. You can create an awesome maker kit for the young person in your life with a quick trip to the nearest electronics store. Here's what's in my maker kit: + + * Eye goggles + * Hammer + * Nails and screws + * Scraps of wood + * Screwdrivers + * Wire + * LEDs + * Piezo buzzer + * Motors + * AA battery pack with leads + * Wire cutters + * Cardboard + * Masking tape + * Scrap fabric + * Buttons + * Thread + * Needles + * Zippers + * Hooks + * A cool tackle box to store everything in + + + +**Why I love it: **Remember when you were a kid and your parents brought home an empty cardboard box that you turned into a spaceship or a house or a supercomputer? That's what a DIY maker kit can be for older kids. + +Raw components empower kids to experiment and use their imaginations. A DIY maker kit can be completely customized for the recipient. Be sure to throw in some components the giftee may have never thought to create with, like giving an avid sewer some LEDs or a woodworker fabric. + +**Cost:** Variable + +### Heuristic play basket + +![Heuristic play kit][9] + +**Ages:** 8 months to 5 years + +**What it is:** Heuristic play baskets are filled with interesting objects made from natural, non-toxic materials for infants and toddlers to explore using their five senses. It's open-ended, self-directed play at its best. The idea is that an adult will supervise (but not direct) a child's use of the basket and its items for a half-hour, then put the basket away until the next time. + +It's easy to create a lovely play basket with common household objects. Try to include items with varying textures, sounds, smells, shapes, and weights. Here are some ideas to get you started. + + * Colander or ridged wicker basket to hold everything + * Wooden spoon + * Metal whisks and spoons + * Scrubbing brush + * Sponge + * Small egg carton + * Cardboard tubes + * Small rolling pin + * Textured washcloth + * Rocks + * Handbells + * Crochet doily + * Small tin with a lid + + + +Play baskets should not include anything easily breakable or small enough to fit inside a paper towel roll, as these are choking hazards, and all objects should be cleaned thoroughly before being given to a child. + +**Why I love it:** Play baskets are fantastic for sensory development and helping young children ask questions and explore the world around them. This is an important part of developing a maker mindset! + +It's easy to obtain suitable items for a play basket; you probably already have many interesting objects in your home or at your nearest second-hand store. Toddlers will use their play baskets differently than infants. These objects will grow with children as they begin to mimic adult life and tell stories through their play. + +**Cost:** Variable + +### Hello Ruby + +![Hello Ruby book cover][10] + +**Ages**: 5–8 + +**What it is:** _[Hello Ruby][11]: Adventures in Coding_ is an illustrated book by Linda Liukas that introduces children to programming concepts through a fun narrative about a girl who encounters problems and friends, each of which represents code. Liukas' other _Hello Ruby_ books are subtitled _Expedition to the Internet_ and _Journey Inside the Computer_, and _Adventures in Coding_ has been published in more than 20 languages. + +**Why I love it:** The author accompanies the book with a number of free, fun, and unplugged activities that can be downloaded and printed out from the Hello Ruby website. These activities teach coding concepts and also touch on artistic expression, communication, and even time management. + +**Cost:** List price for the hardcover book is US$ 17.99, but you may find it at a lower price through local or online booksellers. + +### Girls Who Code: Learn to Code and Change the World + +![Girls Who Code book cover][12] + +**Ages**: 10 to adult + +**What it is:** Written by Reshma Saujani, the founder of Girls Who Code, _[Girls Who Code: Learn to Code and Change the World][13]_ gives practical information about the tech world for young girls (and boys). It covers a wide variety of topics, including coding languages, use-cases, terminology and vocabulary, career options, and profiles and interviews with people in the tech industry. + +**Why I love it:** This book tells the story of tech in ways even most websites meant for adults miss out on. Technology encompasses so many disciplines, and it's important for young people to understand they can use it to solve real-world problems and make a difference. + +**Cost:** List price for the hardcover book is US$ 17.99 and US$ 10.99 for the paperback, but you may find it at a lower price through local or online booksellers. + +I can see the brightness of curiosity in my six year old niece Shuchi's eyes when she explores a... + +Scratch is a free educational programming language for kids, available in 50 different languages... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/maker-gifts-kids + +作者:[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/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://opensource.com/sites/default/files/uploads/hummingbird.png (Hummingbird Robotics Kit) +[3]: https://www.birdbraintechnologies.com/hummingbirdbit/ +[4]: https://opensource.com/sites/default/files/uploads/makeymakey2.jpg (Makey Makey Classic) +[5]: https://makeymakey.com/ +[6]: https://opensource.com/sites/default/files/uploads/arduinouno.jpg (Arduino Uno) +[7]: https://www.arduino.cc/ +[8]: https://opensource.com/sites/default/files/makerbox-makerkit.jpg (A maker kit assembled in a quick trip to the hardware store) +[9]: https://opensource.com/sites/default/files/makerbox-sensorykit.jpg (Heuristic play kit) +[10]: https://opensource.com/sites/default/files/uploads/helloruby2.jpg (Hello Ruby book cover) +[11]: https://www.helloruby.com/ +[12]: https://opensource.com/sites/default/files/uploads/girlswhocodebook.jpg (Girls Who Code book cover) +[13]: https://girlswhocode.com/book/girls-code-learn-code-change-world/ From 71f84648d9262c6399d5e015e6ec350549d492a4 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 1 Dec 2019 00:52:44 +0800 Subject: [PATCH 706/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191129=20How=20?= =?UTF-8?q?to=20write=20a=20Python=20web=20API=20with=20Django?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191129 How to write a Python web API with Django.md --- ...w to write a Python web API with Django.md | 247 ++++++++++++++++++ 1 file changed, 247 insertions(+) create mode 100644 sources/tech/20191129 How to write a Python web API with Django.md diff --git a/sources/tech/20191129 How to write a Python web API with Django.md b/sources/tech/20191129 How to write a Python web API with Django.md new file mode 100644 index 0000000000..ed16fc40f8 --- /dev/null +++ b/sources/tech/20191129 How to write a Python web API with Django.md @@ -0,0 +1,247 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a Python web API with Django) +[#]: via: (https://opensource.com/article/19/11/python-web-api-django) +[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston) + +How to write a Python web API with Django +====== +Django is one of the most popular frameworks for Python API development. +Learn how to use it in this quick tutorial. +![Hands on a keyboard with a Python book ][1] + +[Django][2] is the comprehensive web framework by which all other frameworks are measured. One of the most popular names in Python API development, Django has surged in popularity since its start in 2005. + +Django is maintained by the Django Software Foundation and has experienced great community support, with over 11,600 members worldwide. On Stack Overflow, Django has around 191,000 tagged questions. Websites like Spotify, YouTube, and Instagram rely on Django for application and data management. + +This article demonstrates a simple API to fetch data from a server using the GET method of the HTTP protocol. + +### Set up a project + +First, create a structure for your Django application; you can do this at any location on your system: + + +``` +$ mkdir myproject +$ cd myproject +``` + +Then, create a virtual environment to isolate package dependencies locally within the project directory: + + +``` +$ python3 -m venv env +$ source env/bin/activate +``` + +On Windows, use the command **env\Scripts\activate** to activate your Python virtual environment. + +### Install Django and the Django REST framework + +Next, install the Python modules for Django and Django REST: + + +``` +$ pip3 install django +$ pip3 install djangorestframework +``` + +### Instantiate a new Django project + +Now that you have a work environment for your app, you must instantiate a new Django project. Unlike a minimal framework like [Flask][3], Django includes dedicated commands for this process (note the trailing **.** character in the first command): + + +``` +$ django-admin startproject tutorial . +$ cd tutorial +$ django-admin startapp quickstart +``` + +Django uses a database as its backend, so you should sync your database before beginning development. The database can be managed with the **manage.py** script that was created when you ran the **django-admin** command. Because you're currently in the **tutorial** directory, use the **../** notation to run the script, located one directory up: + + +``` +$ python3 ../manage.py makemigrations +No changes detected +$ python4 ../manage.py migrate +Operations to perform: +  Apply all migrations: admin, auth, contenttypes, sessions +Running migrations: +  Applying contenttypes.0001_initial... OK +  Applying auth.0001_initial... OK +  Applying admin.0001_initial... OK +  Applying admin.0002_logentry_remove_auto_add... OK +  Applying admin.0003_logentry_add_action_flag_choices... OK +  Applying contenttypes.0002_remove_content_type_name... OK +  Applying auth.0002_alter_permission_name_max_length... OK +  Applying auth.0003_alter_user_email_max_length... OK +  Applying auth.0004_alter_user_username_opts... OK +  Applying auth.0005_alter_user_last_login_null... OK +  Applying auth.0006_require_contenttypes_0002... OK +  Applying auth.0007_alter_validators_add_error_messages... OK +  Applying auth.0008_alter_user_username_max_length... OK +  Applying auth.0009_alter_user_last_name_max_length... OK +  Applying auth.0010_alter_group_name_max_length... OK +  Applying auth.0011_update_proxy_permissions... OK +  Applying sessions.0001_initial... OK +``` + +### Create users in Django + +Create an initial user named **admin** with the example password of **password123**: + + +``` +$ python3 ../manage.py createsuperuser \ +  --email [admin@example.com][4] \ +  --username admin +``` + +Create a password when you're prompted. + +### Implement serializers and views in Django + +For Django to be able to pass information over to an HTTP GET request, the information object must be translated into valid response data. Django implements **serializers** for this. + +In your project, define some serializers by creating a new module named **quickstart/serializers.py**, which you'll use for data representations: + + +``` +from django.contrib.auth.models import User, Group +from rest_framework import serializers + +class UserSerializer(serializers.HyperlinkedModelSerializer): +    class Meta: +        model = User +        fields = ['url', 'username', 'email', 'groups'] + +class GroupSerializer(serializers.HyperlinkedModelSerializer): +    class Meta: +        model = Group +        fields = ['url', 'name'] +``` + +A [view][5] in Django is a function that takes a web request and returns a web response. The response can be HTML, or an HTTP redirect, or an HTTP error, a JSON or XML document, an image or TAR file, or anything else you can get over the internet. To create a view, open **quickstart/views.py** and enter the following code. This file already exists and has some boilerplate text in it, so keep that and append this text to the file: + + +``` +from django.contrib.auth.models import User, Group +from rest_framework import viewsets +from tutorial.quickstart.serializers import UserSerializer, GroupSerializer + +class UserViewSet(viewsets.ModelViewSet): +    """ +    API endpoint  allows users to be viewed or edited. +    """ +    queryset = User.objects.all().order_by('-date_joined') +    serializer_class = UserSerializer + +class GroupViewSet(viewsets.ModelViewSet): +    """ +    API endpoint  allows groups to be viewed or edited. +    """ +    queryset = Group.objects.all() +    serializer_class = GroupSerializer +``` + +### Generate URLs with Django + +Now you can generate URLs so people can access your fledgling API. Open **urls.py** in a text editor and replace the default sample code with this code: + + +``` +from django.urls import include, path +from rest_framework import routers +from tutorial.quickstart import views + +router = routers.DefaultRouter() +router.register(r'users', views.UserViewSet) +router.register(r'groups', views.GroupViewSet) + +# Use automatic URL routing +# Can also include login URLs for the browsable API +urlpatterns = [ +    path('', include(router.urls)), +    path('api-auth/', include('rest_framework.urls', namespace='rest_framework')) +] +``` + +### Adjust your Django project settings + +The settings module for this example project is stored in **tutorial/settings.py**, so open that in a text editor and add **rest_framework** to the end of the **INSTALLED_APPS** list: + + +``` +INSTALLED_APPS = [ +    ... +    'rest_framework', +] +``` + +### Test your Django API + +You're now ready to test the API you've built. First, start up the built-in server from the command line: + + +``` +`$ python3 manage.py runserver` +``` + +You can access your API by navigating to the URL **** using **curl**: + + +``` +$ curl --get +[{"url":" +``` + +Or use Firefox or the [open source web browser][6] of your choice: + +![A simple Django API][7] + +For more in-depth knowledge about RESTful APIs using Django and Python, see the excellent [Django documentation][8]. + +### Why should I use Django? + +The major benefits of Django: + + 1. The size of the Django community is ever-growing, so you have lots of resources for guidance, even on a complicated project. + 2. Features like templating, routing, forms, authentication, and management tools are included by default. You don't have to hunt for external tools or worry about third-party tools introducing compatibility issues. + 3. Simple constructs for users, loops, and conditions allow you to focus on writing code. + 4. It's a mature and optimized framework that is extremely fast and reliable. + + + +The major drawbacks of Django are: + + 1. Django is complex! From a developer's point of view, Django can be trickier to learn than a simpler framework. + 2. There's a big ecosystem around Django. This is great once you're comfortable with Django, but it can be overwhelming when you're still learning. + + + +Django is a great option for your application or API. Download it, get familiar with it, and start developing an amazing project! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/python-web-api-django + +作者:[Rachel Waston][a] +选题:[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/rachelwaston +[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://www.djangoproject.com/ +[3]: https://opensource.com/article/19/11/python-web-api-flask +[4]: mailto:admin@example.com +[5]: https://docs.djangoproject.com/en/2.2/topics/http/views/ +[6]: https://opensource.com/article/19/7/open-source-browsers +[7]: https://opensource.com/sites/default/files/uploads/django-api.png (A simple Django API) +[8]: https://docs.djangoproject.com/en/2.2 From d7bc9a7caa5e8c0650f874c5d4620e80203c12cf Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 1 Dec 2019 00:53:45 +0800 Subject: [PATCH 707/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191129=20Holida?= =?UTF-8?q?y=20gift=20guide:=20Books=20for=20the=20learner,=20explorer,=20?= =?UTF-8?q?or=20tinkerer=20on=20your=20list?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191129 Holiday gift guide- Books for the learner, explorer, or tinkerer on your list.md --- ...ner, explorer, or tinkerer on your list.md | 130 ++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 sources/tech/20191129 Holiday gift guide- Books for the learner, explorer, or tinkerer on your list.md diff --git a/sources/tech/20191129 Holiday gift guide- Books for the learner, explorer, or tinkerer on your list.md b/sources/tech/20191129 Holiday gift guide- Books for the learner, explorer, or tinkerer on your list.md new file mode 100644 index 0000000000..dd3c603bc4 --- /dev/null +++ b/sources/tech/20191129 Holiday gift guide- Books for the learner, explorer, or tinkerer on your list.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Holiday gift guide: Books for the learner, explorer, or tinkerer on your list) +[#]: via: (https://opensource.com/article/19/11/books-wishlist-2019) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +Holiday gift guide: Books for the learner, explorer, or tinkerer on your list +====== +Get our list of books to give as gifts or add to your own wishlist this +holiday season. +![4 books that spell out open][1] + +It is my pleasure to introduce Opensource.com's selection of books that would make excellent holiday gift ideas. We hope you find them interesting items to give as gifts this holiday season or to add to your own holiday wishlist. Each book exhibits qualities that make them excellent gifts for open source enthusiasts, as they all encourage learning, exploring, and tinkering. + +### The Big Book of Maker Camp Projects + +![The Big Book of Maker Camp Projects][2] + +**by Sandy Roberts** + +[_The Big Book of Maker Camp Projects_][3] contains dozens of projects that are perfect for maker camps or individuals looking to tinker. Projects cover a wide range of topics ranging from making faux campfires using LEDs and Circuit Playground Express (CPX) boards to tie-dye t-shirts and other wearable crafts. There are plenty of projects to keep maker camp participants engaged and entertained. + +### How Open Source Ate Software + +* * * + +* * * + +* * * + +**![How Open Source Ate Software ][4]** + +**by Gordon Haff** + +Learn more about the history of open source with [_How Open Source Ate Software_][5]. This brief, 180-page book explores how open source became the phenomenon that it is today. This book is an excellent read for anyone interested in where open source came from and how it changed the way software is developed. + +### The Rust Programming Language + +* * * + +* * * + +* * * + +**![The Rust Programming Language ][6]** + +**by Steve Klabnik and Carol Nichols** + +Learn one of the hot, new programming languages with [_The Rust Programming Language_][7]. Yes, this is a print edition of the exact same book that is installed with Rust and can be read in your browser by running **rustup doc --book**, but a physical book offers some benefits by giving the material inside a little more structure than the free HTML version. It is easier to digest material covered over a two-page spread instead of having to scroll through a long web page. Just be sure to get the edition with "Covers Rust 2018" on the cover, so you get a print copy that covers the latest Rust edition. + +### Secret Coders: The Complete Box Set + +* * * + +* * * + +* * * + +**![Secret Coders][8]** + +**by Gene Luen Yang & Mike Holmes** + +[_Secret Coders: The Complete Box Set_][9] collects all six volumes in the Secret Coder series. This series of graphic novels introduces readers to the world of coding by following the exploits of the three protagonists, Hopper, Eni, and Josh, as they explore coding and fight against the schemes of Dr. One-Zero. Each book in the series builds upon the volumes that precede it, and by the time readers have finished the series, they should have an excellent understanding of basic programming concepts. + +### Thing Explainer + +* * * + +* * * + +* * * + +**![Thing Explainer][10]** + +**by Randall Munroe** + +[_Thing Explainer_][11], by the creator of the [xkcd webcomic][12], is a book in the same vein as David Macaulay's [_The Way Things Work_][13] and similar titles. This book, as one would expect from the title, explains things. Using only the 1,000 most common words in the English language and illustrations, Munroe explains airplanes, tectonic plates, and more. + +### Open role-playing games and dice tower + +![Pathfinder][14] | ![Starfinder][15] +---|--- +![Fate Core][16] | ![Fate Accelerated][17] + +If you would like to spend time with your friends and family having exciting adventures, consider one of several pen-and-paper role-playing games with rules books that are released under an open license. + +For example, Paizo's [_Pathfinder_][18] and [_Starfinder_][19] are released under the [Open Game License][20], and [_Fate Core_][21] and [_Fate Accelerated_][22] from Evil Hat are released under the Open Game License and a Creative Commons Attribution license. + +But these are just a few examples, there are plenty of role-playing games that are [released under an open license][23], so there are games out there for a variety of tastes. You can also pair the rule books with a homemade dice tower using these Creative Commons Attribution-NonCommercial licensed [dice tower plans][24]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/books-wishlist-2019 + +作者:[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/EDU_OSDC_BYU_520x292_FINAL.png?itok=NVY7vR8o (4 books that spell out open) +[2]: https://opensource.com/sites/default/files/uploads/the_big_book_of_maker_camp_projects.jpg (The Big Book of Maker Camp Projects) +[3]: http://www.kaleidoscopeenrichment.com/home/the-big-book-of-maker-camp-projects/ +[4]: https://opensource.com/sites/default/files/uploads/how_open_source_ate_software.jpg (How Open Source Ate Software ) +[5]: https://www.apress.com/us/book/9781484238936 +[6]: https://opensource.com/sites/default/files/uploads/the_rust_programming_language.jpg (The Rust Programming Language ) +[7]: https://nostarch.com/Rust2018 +[8]: https://opensource.com/sites/default/files/uploads/secret_coders_the_complete_boxed_set.jpeg (Secret Coders) +[9]: https://us.macmillan.com/secretcodersthecompleteboxedset/geneluenyang/9781250294685/ +[10]: https://opensource.com/sites/default/files/uploads/thing_explainer.png (Thing Explainer) +[11]: https://xkcd.com/thing-explainer/ +[12]: https://xkcd.com/ +[13]: https://en.wikipedia.org/wiki/The_Way_Things_Work +[14]: https://opensource.com/sites/default/files/uploads/pathfinder_100px.jpg (Pathfinder) +[15]: https://opensource.com/sites/default/files/uploads/starfinder_100px.jpg (Starfinder) +[16]: https://opensource.com/sites/default/files/uploads/fate_core_100px.jpg (Fate Core) +[17]: https://opensource.com/sites/default/files/uploads/fate_accelerated_100px.jpg (Fate Accelerated) +[18]: https://paizo.com/pathfinder +[19]: https://paizo.com/starfinder +[20]: https://en.wikipedia.org/wiki/Open_Game_License +[21]: https://www.evilhat.com/home/fate-core/ +[22]: https://www.evilhat.com/home/fae/ +[23]: https://opensource.com/article/19/5/free-rpg-day +[24]: https://msraynsford.blogspot.com/2016/05/working-dice-tower-with-plans.html From 116fd2984b888bcc79a2f20df9aea5d3cdcb73cd Mon Sep 17 00:00:00 2001 From: DarkSun Date: Sun, 1 Dec 2019 00:54:07 +0800 Subject: [PATCH 708/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191129=20My=20L?= =?UTF-8?q?inux=20story:=20Covering=20open=20source=20in=20Spanish?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191129 My Linux story- Covering open source in Spanish.md --- ... story- Covering open source in Spanish.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20191129 My Linux story- Covering open source in Spanish.md diff --git a/sources/tech/20191129 My Linux story- Covering open source in Spanish.md b/sources/tech/20191129 My Linux story- Covering open source in Spanish.md new file mode 100644 index 0000000000..df6edf8ecd --- /dev/null +++ b/sources/tech/20191129 My Linux story- Covering open source in Spanish.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My Linux story: Covering open source in Spanish) +[#]: via: (https://opensource.com/article/19/11/linux-open-source-spanish) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +My Linux story: Covering open source in Spanish +====== +Meet Lorenzo Carbonell, who brings GNU/Linux and open source to the +Spanish-speaking community through his blog site, El Atareao, and +applications. +![Guy on a laptop on a building][1] + +From time to time, when I'm looking for some help on how to do something on my GNU/Linux desktop or server, I'll come across an article or conversation in a language other than English. If that language happens to be French or Spanish, that's fine for me. If it's in Portuguese or Italian, I can stumble through it. And, for other languages, occasionally, I'll give one of those online AI translators a go in the hopes of gleaning something useful. + +But for folks who are comfortable only in English, I suspect that many potentially useful (and sometimes very entertaining) sources are unknown and ignored. And what are the options for people who aren't comfortable in English, when so much that is written about open source (and many other topics) is in English? + +Last year, while researching [open source music players][2], I had the good fortune to stumble on [El Atareao – Linux para legos][3], a well-written, gorgeously illustrated Castilian Spanish blog that focuses on GNU/Linux and open source topics. El Atareao contains tutorials, discussions about applications, and podcasts. Its author, Lorenzo Carbonell, writes beautifully clear and entertaining text and generously shares his accumulating wisdom in a very practical form. He also develops open source applications, including LPlayer, which is how I found his blog. + +I had a discussion with Lorenzo about what it takes to create a great non-English, open source-oriented blog. Here is our conversation, translated from Spanish and edited for clarity. + +**Q: Lorenzo, I've been a fan of your blog since May 2018. I like everything about it—very interesting articles, solid content, beautiful images, great design overall. What motivated you to start this fine project? And what motivates you today?** + +**A:** I got to know GNU/Linux at university about 25 years ago; it attracted my attention, and I used it for several months. For whatever reason—maybe I wasn't sufficiently prepared, maybe the distribution, Slackware, was too much for me—I decided to abandon it when I started working. However, it stuck in my memory. + +About 10 years ago, I was tired of bringing office work home, and I decided to come up with a solution. At that moment, some recollection of that GNU/Linux operating system came back to me, and I thought using a different operating system might be the solution. The incompatibility between the two would make it hard to bring work home, I thought. + +I chose Ubuntu as my platform, and this distribution has stayed with me until today, a distribution that showed me my mistake: With Ubuntu, or really any other distro, I can still do office work at home! + +Yes, in the beginning, I had some difficulties. And these difficulties were what led to the birth of Atareao.es, because that was where I posted the lessons I learned from this incredible operating system. + +Using an open source operating system, which provides the opportunity to get into the guts of the system and adapt its functions to my needs, stole my heart. Implementing applications like [LPlayer][4], [Touchpad-Indicator][5], or [My Weather Indicator][6] and seeing other people finding them useful filled me with satisfaction. Not only the satisfaction of implementing applications and bringing them to the attention of other users through Atareao.es, but also the satisfaction of being able (or at least trying) to show the potential of this operating system. The potential of this operating system is that it allows you to do almost anything you can imagine, for the simple reason that the code is there and available so that you can study it and adapt it to your needs. + +What motivates me? To have an operating system with so much potential; that is the great unknown. This is what motivates me: having successes to shout to the four winds to let everyone know. And once everyone knows, each one can decide. This is one of the reasons for free applications that can make life simpler or at least help the newly arrived. + +**Q: Please explain the name "El Atareao"… is it local slang? I understand "el atareado" (the busy person).** + +**A:** "El Atareao" was something that arose from work 10 years ago. At that time, I was always busy with work. A close friend mentioned that phrase to me, and it branded itself in my mind. Now it's "el atareao" that will support the company. And to honor and respect this, I used the name for this site. + +So with respect to "atareao" in place of "atareado," effectively it's local slang. + +**Q: So when you aren't "atareao," what do you do? Are you a software developer? Do you work in open source by day?** + +**A:** Currently, I'm working as a developer and in part as a system administrator. And I must say that this came about thanks to Atareao.es. Before, I was working in something completely and totally different, but software development has been my passion. And so, relatively recently, a visionary (or a crazy person) rescued me from my old job and brought me to this incredible world of development, where you can convert anything you can imagine to reality. I say "visionary" because he knew how to see what I could not, and "crazy" because he has to be really bold to make that bet. Today I'm like a kid in a candy store. + +**Q: Your articles provide a solid amount of useful detail. For example, this [article about Rsync][7]. How do you decide on a topic? How do you determine your readers' level of ability so you can write in a way they can understand?** + +**A:** Normally, the articles arise from my need to solve a problem or a situation that I'm facing or that someone has contacted me to ask for help. Though the latter is less common because interactivity in the world 2.0 is not always what I, and I suppose others, would like. + +The objective of any article is to be sufficiently detailed so that any person reading it can reproduce it and can succeed at putting the material to work. It's very frustrating to read an article about some technology that is apparently really simple and not be able to make it work—because the person who wrote the article did not try it out, or because it's vaguely documented, or because it's explained in a technically excessive manner. + +My objective is to try to acquaint as many people as possible to the greatest extent possible with this operating system. How can I tell you about something if you can't make it work because I didn't explain it sufficiently or with enough detail? When someone writes to me and tells me they were unable to follow something or that it wasn't well explained or that there is some error, it makes me very uneasy and motivates me to write better, to strengthen myself, to study more, to learn. + +With respect to the readers' level of ability, this is probably my biggest worry. I know that the majority who read Atareao.es are beginners or "legos" (in the sense of not being professionals), and I try to orient myself to these people. Nevertheless, some of the readers are professionals and are quite challenging to satisfy. In whatever way, I always try for the most straightforward and simple result. Or, at least to be sufficiently clear, so that I can understand it without problems. + +**Q: Do you have other hobbies apart from this blog?** + +**A:** Currently, the blog, the podcast, and developing applications absorb nearly all of my free time. An article or a podcast takes a couple of hours. Creating an application never ends and sucks up all my available time. + +But one hobby that I am dedicated to is running; this is something I do every day or nearly so. And so, as I mention in the "[Who am I?][8]" section of the blog, if one day you visit Silla, the town in Valencia where I live, early in the morning, you can find me on my running circuits. When we travel, which is the other hobby that I have and share with my wife, my running shoes and my laptop always come with me. You can always find me traveling or running or sitting in a coffee shop writing an article. + +**Q: As someone who is not a native speaker of (Castilian) Spanish, I nevertheless enjoy your use of the language; I feel that how one expresses oneself is as important as what is written. Can you elaborate on this?** + +**A:** It seems to me very important that an article, whether it's technical or not, should have the best possible wording. And not only to be correct, syntactically and semantically, but to be able to tell a story, a story that engages. + +For this reason, whenever I can, I try to write the technical article within an experience, a situation, or a circumstance that has happened to me. From my perspective, writing about real, daily successes that frame a technical article works better for readers and makes them feel much more involved. + +**Q: There are a lot of people who prefer information in their mother tongue. As someone who writes in Spanish, what do you think about this issue? Do you have any idea of the level of demand for information about open source software in Spanish?** + +**A:** I think that Spanish speakers, and especially those born in Spain, prefer (Castilian) Spanish as their working language. In Spain, they don't teach us English; rather, they teach us how to pass the English course, which is a real shame. I would enjoy speaking, writing, and expressing myself in English as well as you, but there isn't a means, despite the fact that every day, I consume more video and audio in English, and every day I push myself more with it. I need English more and more; I need to develop myself better in this language. + +With respect to the demand for open source software in Spanish, as far as I understand, it's very low, too low for my liking. In general, open source software is the unknown. Few know Linux, and few understand that it's what is behind open source software. A significant number come at first for the simple fact that it's free. This is a great advantage because it's a way to first approach open source. Nevertheless, it's necessary to go deeper, to take a radical turn, because to the Spanish speaker, or at least to the Spaniard, when something is free or very cheap, it seems that it is of low quality. And "free" software is not synonymous with "no cost"; it must be defined based on its high quality. + +**Q: Where is** **El Atareao** **going in the future? More podcasts? YouTube channels? Adding other authors? Syndicated content?** + +**A:** Where is Atareao.es going? I know where I'd like it to go. I'd like to dedicate myself to it full time. I'd like to live on [income from] the site, although I know that's really difficult. One approach that I'm exploring is to convert it to a membership site, although providing the content for free. This is something that I need to keep working on. + +As a part of this, I'm trying to participate in related events and give talks at conferences. I started down this road last year at [Ubucon][9] Europe 2018, I continued this year, and next year I'd like to deepen this involvement. "De-virtualization" is important, putting faces to names, seeing that open source software isn't something far away, distant, or cold; quite the contrary. + +In the short term, I'd like to work on my [YouTube channel][10] while working on talks and attending conferences. I'm planning to start a series on YouTube, although I don't have it completed, and only my wife and now you (all) know about it. + +### Conclusion + +Thanks very much, Lorenzo, for taking the time to share your thoughts with us, and best wishes for the continued success of El Atareao. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/linux-open-source-spanish + +作者:[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/computer_code_programming_laptop.jpg?itok=ormv35tV (Guy on a laptop on a building) +[2]: https://opensource.com/article/18/6/open-source-music-players +[3]: https://www.atareao.es/ +[4]: https://github.com/atareao/lplayer +[5]: https://github.com/atareao/Touchpad-Indicator +[6]: https://github.com/atareao/my-weather-indicator +[7]: https://www.atareao.es/podcast/sincronizacion-en-red-y-vpn/ +[8]: https://www.atareao.es/quien-soy/ +[9]: https://wiki.ubuntu.com/Ubucon +[10]: https://www.youtube.com/c/atareao From 90f652d6e970aa1140c55ce73a1999ccbc425ebe Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 09:54:08 +0800 Subject: [PATCH 709/800] PRF --- ...on 2 to Python 3- What you need to know.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md index 32a5164480..1a835e0975 100644 --- a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md +++ b/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Switching from Python 2 to Python 3: What you need to know) @@ -10,23 +10,23 @@ 从 Python 2 切换到 Python 3 你所需要了解的 ====== -> Python 2 将在几周内到达生命终点,这篇文章是你迁移到 Python 3 之前应该知道的。 +> Python 2 将在几周内走到生命终点,这篇文章是你迁移到 Python 3 之前应该知道的。 -![A sunrise][1] +![](https://img.linux.net.cn/data/attachment/album/201912/01/095336lbppn8qp1nnnwqqp.jpg) 从 2020 年 1 月 1 日开始,Python 2.7 将不再得到正式支持。在此日期之后,将会发布一个[最终错误修复][2]计划,但是仅此而已。 -Python 2 的生命终端(EOL)对你意味着什么?如果正在运行这 Python 2,则需要迁移。 +Python 2 的生命终点(EOL)对你意味着什么?如果正在运行着 Python 2,你需要迁移。 ### 是谁决定 Python 2 的生命终点? 在 [2012][3] 年,维护 Python 编程语言的团队审查了其选项。有两个越来越不同的代码库,Python 2 和 Python 3。这两者都很流行,但是较新的版本并未得到广泛采用。 -除了 Python 3 中处理数据的底层方式由完全重写的 Unicode 支持的变化造成了断层,这个主要版本的变化还一次性出现了一些非向后兼容的更改。这种断层的决定成文于 [2006 年][4]。为了减轻该断层的影响,Python 2 继续保持维护,并向后移植了一些 Python 3 的功能。为了进一步帮助社区过渡,EOL 日期[从 2015 年延长至 2020 年][5]又延长了五年。 +除了 Python 3 中完全重写的 Unicode 支持改变了处理数据的底层方式造成的断层,这个主要版本的变化还一次性出现了一些非向后兼容的更改。这种断层的决定成文于 [2006 年][4]。为了减轻该断层的影响,Python 2 继续保持了维护,并向后移植了一些 Python 3 的功能。为了进一步帮助社区过渡,EOL 日期[从 2015 年延长至 2020 年][5],又延长了五年。 -维护不同的代码库是该团队知道必须解决的麻烦。最终,他们[宣布了][6]一项决定: +该团队知道,维护不同的代码库是必须解决的麻烦。最终,他们[宣布了][6]一项决定: ->“我们是制作和照料 Python 编程语言的志愿者。我们已决定 2020 年 1 月 1 日将是我们停止使用 Python 2 的日子。这意味着在这一天之后,即使有人发现其中存在安全问题,我们将不再对其进行改进。你应尽快升级到 Python 3。” +>“我们是制作和照料 Python 编程语言的志愿者。我们已决定 2020 年 1 月 1 日将是我们停止使用 Python 2 的日子。这意味着在这一天之后,即使有人发现其中存在安全问题,我们也将不再对其进行改进。你应尽快升级到 Python 3。” [Nick Coghlan][7] 是 CPython 的核心开发人员,也是 Python 指导委员会的现任成员,[在他的博客中添加了更多信息][8]。由 [Barry Warsaw][10](也是 Python 指导委员会的成员)撰写的 [PEP 404][9] 详细说明了 Python 2.8 永远不会面世的原因。 @@ -38,13 +38,13 @@ Python 2 的生命终端(EOL)对你意味着什么?如果正在运行这 P ### 使用 Python 3 的原因 -不管是否有持续的支持,尽快迁移到 Python 3 是一个好主意。Python 3 将继续受到支持,它具有 Python 2 所没有的一些非常整洁的东西。 +不管是否有持续的支持,尽快迁移到 Python 3 是一个好主意。Python 3 将继续受到支持,它具有 Python 2 所没有的一些非常优雅的东西。 -最近发布的 [Python 3.8][17] 包含 [海象运算符][19]、[位置参数][20]和[自描述的格式化字符串][21]等[功能][18]。Python 3 的早期版本引入的[功能][22],例如 [异步 IO][23],[格式化字符串][24],[类型提示][25] 和 [pathlib][26],这里只提及了一点点。 +最近发布的 [Python 3.8][17] 包含 [海象运算符][19]、[位置参数][20]和[自描述的格式化字符串][21]等[功能][18]。Python 3 的早期版本引入的[功能][22],例如 [异步 IO][23]、[格式化字符串][24]、[类型提示][25] 和 [pathlib][26],这里只提及了一点点。 下载最多的前 360 个软件包[已迁移到 Python 3][27]。你可以使用 [caniusepython3][28] 软件包检查你的 `requirements.txt` 文件,以查看你依赖的任何软件包是否尚未迁移。 -### 将Python 2移植到Python 3的参考资源 +### 将 Python 2 移植到 Python 3 的参考资源 有许多参考资源可简化你向 Python 3 的迁移。例如,“[将 Python 2 移植到 Python 3 指南][29]”列出了许多工具和技巧,可帮助你实现与 Python 2/3 单一源代码的兼容性。在 [Python3statement.org][30] 上也有一些有用的技巧。 @@ -52,7 +52,7 @@ Python 2 的生命终端(EOL)对你意味着什么?如果正在运行这 P ### 加入我们! -距 2020 年 1 月 1 日仅有几周了。如果你需要每天提醒一下它即将到来的时间(并你使用 Twitter 的话),请关注 [Python 2 日落倒计时][36] Twitter 机器人。 +距 2020 年 1 月 1 日仅有几周了。如果你需要每天提醒一下它即将到来的时间(并且你使用 Twitter 的话),请关注 [Python 2 日落倒计时][36] Twitter 机器人。 -------------------------------------------------------------------------------- @@ -61,7 +61,7 @@ via: https://opensource.com/article/19/11/end-of-life-python-2 作者:[Katie McLaughlin][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 abf56523c916a6d24491dbfb488fe7f1b9d03f04 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 09:54:47 +0800 Subject: [PATCH 710/800] PUB @wxy https://linux.cn/article-11629-1.html --- ...tching from Python 2 to Python 3- What you need to know.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191120 Switching from Python 2 to Python 3- What you need to know.md (99%) diff --git a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md b/published/20191120 Switching from Python 2 to Python 3- What you need to know.md similarity index 99% rename from translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md rename to published/20191120 Switching from Python 2 to Python 3- What you need to know.md index 1a835e0975..f89984a90c 100644 --- a/translated/tech/20191120 Switching from Python 2 to Python 3- What you need to know.md +++ b/published/20191120 Switching from Python 2 to Python 3- What you need to know.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11629-1.html) [#]: subject: (Switching from Python 2 to Python 3: What you need to know) [#]: via: (https://opensource.com/article/19/11/end-of-life-python-2) [#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) From b9e36ee08cac203ae03be91718d9308c1f975924 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 10:35:49 +0800 Subject: [PATCH 711/800] PRF @robsean --- ...ginx, MariaDB, PHP) on Fedora 30 Server.md | 72 +++++++++---------- 1 file changed, 34 insertions(+), 38 deletions(-) diff --git a/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md index 37a5ad1488..063305a9ed 100644 --- a/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md +++ b/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md @@ -1,13 +1,13 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server) [#]: via: (https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) -如何在 Fedora 30 Server 上安装 LEMP (Linux, Nginx, MariaDB, PHP) +如何在 Fedora 30 Server 上安装 LEMP(Linux、Nginx、MariaDB、PHP) ====== 在这篇文章中,我们将看看如何在 Fedora 30 Server 上安装 **LEMP** 。LEMP 代表: @@ -17,19 +17,17 @@ * M -> Maria DB * P -> PHP +我假设 [Fedora 30][1] 已经安装在你的电脑系统上。 +![](https://img.linux.net.cn/data/attachment/album/201912/01/103537wil7hd36dhcxdh03.jpg) -我假设 **[Fedora 30][1]** 已经安装在你的电脑系统上。 +LEMP 是一组强大的软件设置集合,它安装在一个 Linux 服务器上以帮助使用流行的开发平台来构建网站,LEMP 是 LAMP 的一个变种,在其中不是 Apache ,而是使用 EngineX(Nginx),此外,使用 MariaDB 代替 MySQL。这篇入门指南是一个安装 Nginx、Maria DB 和 PHP 的独立指南的作品集合。 -![LEMP-Stack-Fedora30][2] +### 在 Fedora 30 Server 上安装 Nginx、PHP 7.3 和 PHP-FPM -LEMP 是一组强大的软件设置集合,它安装在一个 Linux 服务器上以帮助使用流行的开发平台来构建网站,LEMP 是 LAMP 的一个变种,在其中不是 **Apache** ,而是使用 **EngineX (Nginx)** , 此外,使用 **MariaDB** 代替 **MySQL** 。这篇入门指南是一个安装 Nginx, Maria DB 和 PHP 的独立指南的作品集合。 +让我们看看如何在 Fedora 30 Server 上安装 Nginx 和 PHP 以及 PHP FPM。 -### 在 Fedora 30 Server 上安装 Nginx ,PHP 7.3 和 PHP-FPM - -让我们看看如何在 Fedora 30 Server 上安装 Nginx 和 PHP 以及 PHP FPM 。 - -### 步骤 1) 切换到 root 用户 +#### 步骤 1) 切换到 root 用户 在系统上安装 Nginx 的第一步是切换到 root 用户。使用下面的命令: @@ -39,25 +37,25 @@ root@linuxtechi ~]$ sudo -i [root@linuxtechi ~]# ``` -### 步骤 2) 使用 dnf 命令安装 Nginx ,PHP 7.3 和 PHP FPM +#### 步骤 2) 使用 dnf 命令安装 Nginx、PHP 7.3 和 PHP FPM -使用下面的 dnf 命令安装 Nginx : +使用下面的 `dnf` 命令安装 Nginx: ``` [root@linuxtechi ~]# dnf install nginx php php-fpm php-common -y ``` -### 步骤 3) 安装额外的 PHP 模块 +#### 步骤 3) 安装额外的 PHP 模块 -PHP 的默认安装仅自带基本模块和最需要的模块,如果你需要额外的模块,像 PHP 支持的 GD ,XML ,命令行接口 Zend OPCache 功能等等,你总是能够选择你的软件包,并一次性安装所有的东西。查看下面的示例命令: +PHP 的默认安装仅自带基本模块和最需要的模块,如果你需要额外的模块,像 PHP 支持的 GD、XML、命令行接口、Zend OPCache 功能等等,你总是能够选择你的软件包,并一次性安装所有的东西。查看下面的示例命令: ``` [root@linuxtechi ~]# sudo dnf install php-opcache php-pecl-apcu php-cli php-pear php-pdo php-pecl-mongodb php-pecl-redis php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml -y ``` -### 步骤 4) 开始 & 启用 Nginx 和 PHP-fpm 服务 +#### 步骤 4) 开始 & 启用 Nginx 和 PHP-fpm 服务 -使用下面的命令来开始并启用 Nginx 服务 +使用下面的命令来开始并启用 Nginx 服务: ``` [root@linuxtechi ~]# systemctl start nginx && systemctl enable nginx @@ -65,7 +63,7 @@ Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /u [root@linuxtechi ~]# ``` -使用下面的命令来开始并启用 PHP-FPM 服务 +使用下面的命令来开始并启用 PHP-FPM 服务: ``` [root@linuxtechi ~]# systemctl start php-fpm && systemctl enable php-fpm @@ -73,9 +71,9 @@ Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → [root@linuxtechi ~]# ``` -**核实 Nginx (Web 服务) 和 PHP 安装,** +#### 步骤 5) 核实 Nginx (Web 服务) 和 PHP 安装 -**注意:** 假使操作系统防火墙是启用的,并运行在你的 Fedora 30 系统上,那么使用下面的命令来准许 80 和 443 端口, +注意:假使操作系统防火墙是启用的,并运行在你的 Fedora 30 系统上,那么使用下面的命令来准许 80 和 443 端口: ``` [root@linuxtechi ~]# firewall-cmd --permanent --add-service=http @@ -88,24 +86,22 @@ success [root@linuxtechi ~]# ``` -打开网页浏览器,输入下面的 URL: http:// +打开网页浏览器,输入下面的 URL: http:// 。 -[![Test-Page-HTTP-Server-Fedora-30][3]][4] +![Test-Page-HTTP-Server-Fedora-30][4] -上面的屏幕证实 NGINX 已经成功地安装。 +上面的屏幕证实 Nginx 已经成功地安装。 -现在,让我们核实 PHP 安装,使用下面的命令创建一个测试 php 页(info.php), +现在,让我们核实 PHP 安装,使用下面的命令创建一个测试 php 页(`info.php`): ``` [root@linuxtechi ~]# echo "" > /usr/share/nginx/html/info.php [root@linuxtechi ~]# ``` -在网页浏览器中输入下面的 URL , +在网页浏览器中输入下面的 URL, http:///info.php -http:///info.php - -[![Php-info-page-fedora30][5]][6] +![Php-info-page-fedora30][6] 上面的页面验证 PHP 7.3.5 已经被成功地安装。现在,让我们安装 MariaDB 数据库服务器。 @@ -113,7 +109,7 @@ http:///info.php MariaDB 是 MySQL 数据库的一个极好的替代品,因为它的工作方式与 MySQL 非常类似,并且兼容性也与 MySQL 一致。让我们看看在 Fedora 30 Server 上安装 MariaDB 的步骤。 -### 步骤 1) 切换到 root 用户 +#### 步骤 1) 切换到 root 用户 在系统上安装 MariaDB 的第一步是切换到 root 用户,或者你可以使用有 root 权限的本地用户。使用下面的命令: @@ -122,25 +118,25 @@ MariaDB 是 MySQL 数据库的一个极好的替代品,因为它的工作方 [root@linuxtechi ~]# ``` -### 步骤 2) 使用 dnf 命令安装 MariaDB (10.3) 的最新版本 +#### 步骤 2) 使用 dnf 命令安装 MariaDB(10.3)的最新版本 -在 Fedora 30 Server 上使用下面的命令来安装 MariaDB +在 Fedora 30 Server 上使用下面的命令来安装 MariaDB: ``` [root@linuxtechi ~]# dnf install mariadb-server -y ``` -### 步骤 3) 开启并启用 MariaDB 服务 +#### 步骤 3) 开启并启用 MariaDB 服务 -在步骤2中成功地安装 mariadb 后,接下来的步骤是开启 MariaDB 服务。使用下面的命令: +在步骤 2 中成功地安装 MariaDB 后,接下来的步骤是开启 MariaDB 服务。使用下面的命令: ``` [root@linuxtechi ~]# systemctl start mariadb.service ; systemctl enable mariadb.service ``` -### 步骤 4) 保护 MariaDB 安装 +#### 步骤 4) 保护安装好的 MariaDB -当我们安装 MariaDB 服务器时,因为默认情况下没有 root密码,在数据库中也创建匿名用户。因此,来保护 MariaDB 安装,运行下面的 “mysql_secure_installation” 命令 +当我们安装 MariaDB 服务器时,因为默认情况下没有 root 密码,在数据库中也会创建匿名用户。因此,要保护安装好的 MariaDB,运行下面的 `mysql_secure_installation` 命令: ``` [root@linuxtechi ~]# mysql_secure_installation @@ -152,7 +148,7 @@ MariaDB 是 MySQL 数据库的一个极好的替代品,因为它的工作方 ![Secure-MariaDB-Installation-Part2][8] -### 步骤 5) 测试 MariaDB 安装 +#### 步骤 5) 测试 MariaDB 安装 在你安装后,你总是能够测试是否 MariaDB 被成功地安装在 Fedora 30 Server 上。使用下面的命令: @@ -161,7 +157,7 @@ MariaDB 是 MySQL 数据库的一个极好的替代品,因为它的工作方 Enter password: ``` -接下来,你将被提示一个密码。输入在 MariaDB 保护安装期间你设置的密码,接下来你可以看到 MariaDB 欢迎屏幕。 +接下来,你将被提示一个密码。输入在保护安装好的 MariaDB 期间你设置的密码,接下来你可以看到 MariaDB 欢迎屏幕。 ``` Welcome to the MariaDB monitor. Commands end with ; or \g. @@ -175,7 +171,7 @@ Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> ``` -最后,我们已经在你的 Fedora 30 Server 上成功地完成安装 LEMP (Linux, Nginx, MariaDB and PHP) 的所有工作。请在下面的反馈部分发布你的评论和建议,我们将尽快在后面回应。 +最后,我们已经在你的 Fedora 30 Server 上成功地完成安装 LEMP(Linux、Nginx、MariaDB 和 PHP)的所有工作。请在下面的反馈部分发布你的评论和建议,我们将尽快在后面回应。 -------------------------------------------------------------------------------- @@ -184,7 +180,7 @@ via: https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/ 作者:[Pradeep Kumar][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 9b8a1596f204104e5a6ac04a6c13338385f23043 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 10:36:26 +0800 Subject: [PATCH 712/800] PUB @robsean https://linux.cn/article-11631-1.html --- ...l LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md (99%) diff --git a/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md b/published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md similarity index 99% rename from translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md rename to published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md index 063305a9ed..c3c7d5d3bf 100644 --- a/translated/tech/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md +++ b/published/20190602 How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11631-1.html) [#]: subject: (How to Install LEMP (Linux, Nginx, MariaDB, PHP) on Fedora 30 Server) [#]: via: (https://www.linuxtechi.com/install-lemp-stack-fedora-30-server/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) From c42cc7027ad59bb6dd7b6c3a0afdf9c8f2f1fef3 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Sun, 1 Dec 2019 10:46:36 +0800 Subject: [PATCH 713/800] Rename sources/tech/20191129 My Linux story- Covering open source in Spanish.md to sources/talk/20191129 My Linux story- Covering open source in Spanish.md --- .../20191129 My Linux story- Covering open source in Spanish.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191129 My Linux story- Covering open source in Spanish.md (100%) diff --git a/sources/tech/20191129 My Linux story- Covering open source in Spanish.md b/sources/talk/20191129 My Linux story- Covering open source in Spanish.md similarity index 100% rename from sources/tech/20191129 My Linux story- Covering open source in Spanish.md rename to sources/talk/20191129 My Linux story- Covering open source in Spanish.md From b2b373daecc7e797aa43bb71bdcfcc94c894c369 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Sun, 1 Dec 2019 15:43:59 +0800 Subject: [PATCH 714/800] Translated 20191125 How to use loops in awk.md --- .../tech/20191125 How to use loops in awk.md | 162 ----------------- .../tech/20191125 How to use loops in awk.md | 163 ++++++++++++++++++ 2 files changed, 163 insertions(+), 162 deletions(-) delete mode 100644 sources/tech/20191125 How to use loops in awk.md create mode 100644 translated/tech/20191125 How to use loops in awk.md diff --git a/sources/tech/20191125 How to use loops in awk.md b/sources/tech/20191125 How to use loops in awk.md deleted file mode 100644 index 099444b10f..0000000000 --- a/sources/tech/20191125 How to use loops in awk.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use loops in awk) -[#]: via: (https://opensource.com/article/19/11/loops-awk) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -How to use loops in awk -====== -Learn how to use different types of loops to run commands on a record -multiple times. -![arrows cycle symbol for failing faster][1] - -Awk scripts have three main sections: the optional BEGIN and END functions and the functions you write that are executed on each record. In a way, the main body of an awk script is a loop, because the commands in the functions run for each record. However, sometimes you want to run commands on a record more than once, and for that to happen, you must write a loop. - -There are several kinds of loops, each serving a unique purpose. - -### While loop - -A **while** loop tests a condition and performs commands _while_ the test returns _true_. Once a test returns _false_, the loop is broken. - - -``` -#!/bin/awk -f - -BEGIN { -        # Print the squares from 1 to 10 - -    i=1; -    while (i <= 10) { -        print "The square of ", i, " is ", i*i; -        i = i+1; -    } -exit; -} -``` - -In this simple example, awk prints the square of whatever integer is contained in the variable _i_. The **while (i <= 10)** phrase tells awk to perform the loop only as long as the value of _i_ is less than or equal to 10. After the final iteration (while _i_ is 10), the loop ends. - -### Do while loop - -The **do while** loop performs commands after the keyword **do**. It performs a test afterward to determine whether the stop condition has been met. The commands are repeated only _while_ the test returns true (that is, the end condition has _not_ been met). If a test fails, the loop is broken because the end condition has been met. - - -``` -#!/usr/bin/awk -f -BEGIN { - -        i=2; -        do { -                print "The square of ", i, " is ", i*i; -                i = i + 1 -        } -        while (i < 10) - -exit; -} -``` - -### For loops - -There are two kinds of **for** loops in awk. - -One kind of **for** loop initializes a variable, performs a test, and increments the variable together, performing commands while the test is true. - - -``` -#!/bin/awk -f - -BEGIN { -    for (i=1; i <= 10; i++) { -        print "The square of ", i, " is ", i*i; -    } -exit; -} -``` - -Another kind of **for** loop sets a variable to successive indices of an array, performing a collection of commands for each index. In other words, it uses an array to "collect" data from a record. - -This example implements a simplified version of the Unix command **uniq**. By adding a list of strings into an array called **a** as a key and incrementing the value each time the same key occurs, you get a count of the number of times a string appears (like the **\--count** option of **uniq**). If you print the keys of the array, you get every string that appears one or more times. - -For example, using the demo file **colours.txt** (from the previous articles): - - -``` -name       color  amount -apple      red    4 -banana     yellow 6 -raspberry  red    99 -strawberry red    3 -grape      purple 10 -apple      green  8 -plum       purple 2 -kiwi       brown  4 -potato     brown  9 -pineapple  yellow 5 -``` - -Here is a simple version of **uniq -c** in awk form: - - -``` -#! /usr/bin/awk -f - -NR != 1 { -    a[$2]++ -} -END { -    for (key in a) { -                print a[key] " " key -    } -} -``` - -The third column of the sample data file contains the number of items listed in the first column. You can use an array and a **for** loop to tally the items in the third column by color: - - -``` -#! /usr/bin/awk -f - -BEGIN { -    FS=" "; -    OFS="\t"; -    print("color\tsum"); -} -NR != 1 { -    a[$2]+=$3; -} -END { -    for (b in a) { -        print b, a[b] -    } -} -``` - -As you can see, you are also printing a header column in the BEFORE function (which always happens only once) prior to processing the file. - -### Loops - -Loops are a vital part of any programming language, and awk is no exception. Using loops can help you control how your awk script runs, what information it's able to gather, and how it processes your data. Our next article will cover switch statements, **continue**, and **next**. - -* * * - -Would you rather listen to this article? It was adapted from an episode of [Hacker Public Radio][2], a community technology podcast by hackers, for hackers. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/loops-awk - -作者:[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/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh (arrows cycle symbol for failing faster) -[2]: http://hackerpublicradio.org/eps.php?id=2330 diff --git a/translated/tech/20191125 How to use loops in awk.md b/translated/tech/20191125 How to use loops in awk.md new file mode 100644 index 0000000000..a200611ba2 --- /dev/null +++ b/translated/tech/20191125 How to use loops in awk.md @@ -0,0 +1,163 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "How to use loops in awk" +[#]: via: "https://opensource.com/article/19/11/loops-awk" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +在 awk 中怎么使用循环 +====== +来学习一下多次执行同一条命令的不同类型的循环。 +![arrows cycle symbol for failing faster][1] + +awk 脚本有三个主要部分:BEGIN 和 END 函数(都可选),用户自己写的每次要执行的函数。某种程度上,awk 的主体部分就是一个循环,因为函数中的命令对每一条记录都会执行一次。然而,有时你希望对于一条记录执行多次命令,那么你就需要用到循环。 + +有多种类型的循环,分别适合不同的场景。 + +### while 循环 + +一个 while 循环检测一个表达式,如果表达式为 *true* 就执行命令。当表达式变为 *false* 时,循环中断。 + + +``` +#!/bin/awk -f + +BEGIN { +        # Print the squares from 1 to 10 + +    i=1; +    while (i <= 10) { +        print "The square of ", i, " is ", i*i; +        i = i+1; +    } +exit; +} +``` + +在这个简单实例中, awk 打印了变量 *i* 中的整数值的平方。**while (i <= 10)** 语句告诉 awk 仅在 *i* 的值小于或等于 10 时才执行循环。在循环最后一次执行时(*i* 的值是 10),循环终止。 + +### Do while 循环 + +do-while 循环在关键字 **do** 之后执行命令。在每次循环结束时检测一个表达式来决定是否终止循环。仅在表达式返回 true 时才会重复执行命令(即还没有到终止循环的条件)。如果表达式返回 false,因为到了终止循环的条件所以循环被终止。 + + +``` +#!/usr/bin/awk -f +BEGIN { + +        i=2; +        do { +                print "The square of ", i, " is ", i*i; +                i = i + 1 +        } +        while (i < 10) + +exit; +} +``` + +### for 循环 + +awk 中有两种 **for**循环。 + +一种 **for** 循环初始化一个变量,检测一个表达式,执行变量递增,当表达式的结果为 true 时循环就会一直执行。 + + +``` +#!/bin/awk -f + +BEGIN { +    for (i=1; i <= 10; i++) { +        print "The square of ", i, " is ", i*i; +    } +exit; +} +``` + +另一种 **for** 循环设置一个有连续 index 的数组变量,对每一个索引执行一个命令集。换句话说,它用一个数组「收集」每一条命令执行后的结果。 + +本例实现了一个简易版的 Unix 命令 **uniq** 。通过把一系列字符串作为 key 加到数组 a 中,当相同的 key 再次出现时就增加 value 的值,可以得到某个字符串出现的次数(就像 **uniq** 的 **--count** 选项)。如果你打印该数组的所有 key,将会得到出现过的所有字符串。 + +用 demo 文件 **colours.txt** (前一篇文章中的文件)来举例: + + +``` +name       color  amount +apple      red    4 +banana     yellow 6 +raspberry  red    99 +strawberry red    3 +grape      purple 10 +apple      green  8 +plum       purple 2 +kiwi       brown  4 +potato     brown  9 +pineapple  yellow 5 +``` + + + +这是 awk 版的简易 **uniq -c**: + + +``` +#! /usr/bin/awk -f + +NR != 1 { +    a[$2]++ +} +END { +    for (key in a) { +                print a[key] " " key +    } +} +``` + +示例数据文件的第三列是第一列列出的条目的计数。你可以用一个数组和 **for** 循环来从 color 维度统计第三列的条目。 + + +``` +#! /usr/bin/awk -f + +BEGIN { +    FS=" "; +    OFS="\t"; +    print("color\tsum"); +} +NR != 1 { +    a[$2]+=$3; +} +END { +    for (b in a) { +        print b, a[b] +    } +} +``` + +你可以看到,在处理文件之前也需要在 **前置** 函数(仅仅执行一次)中打印一列表头。 + +### 循环 + +在任何编程语言中循环都是很重要的一部分,awk 也不例外。使用循环你可以控制 awk 脚本怎样去运行,它可以统计什么信息,还有它怎么去处理你的数据。我们下一篇文章会讨论 switch 语句,**continue** 和 **next**。 + +* * * + +你是否更想听这篇文章?本文已被收录进 [Hacker Public Radio](http://hackerpublicradio.org/eps.php?id=2330),一个来自黑客,面向黑客的社区技术博客。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/loops-awk + +作者:[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/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh "arrows cycle symbol for failing faster" +[2]: http://hackerpublicradio.org/eps.php?id=2330 From c3d1e54a0fb7009d047f4dbf8577827957016958 Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Sun, 1 Dec 2019 16:35:06 +0800 Subject: [PATCH 715/800] transtaled --- ...en source audio-visual production tools.md | 261 ------------------ ...en source audio-visual production tools.md | 255 +++++++++++++++++ 2 files changed, 255 insertions(+), 261 deletions(-) delete mode 100644 sources/tech/20180207 23 open source audio-visual production tools.md create mode 100644 translated/tech/20180207 23 open source audio-visual production tools.md diff --git a/sources/tech/20180207 23 open source audio-visual production tools.md b/sources/tech/20180207 23 open source audio-visual production tools.md deleted file mode 100644 index fd196200ce..0000000000 --- a/sources/tech/20180207 23 open source audio-visual production tools.md +++ /dev/null @@ -1,261 +0,0 @@ -23 open source audio-visual production tools -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-photo-camera-blue.png?itok=AsIMZ9ga) - -Open source is well established in cloud infrastructure, web hosting, embedded devices, and many other areas. Fewer people know that open source is a great option for producing professional-level audio-visual materials. - -As a product owner and sometimes marketing support person, I produce a lot of content for end users: documentation, web articles, video tutorials, event booth materials, white papers, interviews, and more. I have found plenty of great open source software that helps me do my job producing audio, video, print, and screen graphics. There are a lot of [reasons][1] that people choose open source over proprietary options, and I've compiled this list of open source audio and video tools for people who: - - * want to switch to GNU/Linux, but need to start slowly with cross-platform software on their regular operating system; - * are already open source enthusiasts, but are new to open source A/V software and want to know which options to trust; - * want to discover new tools to fuel their creativity and don't want to use the same approaches or software everyone else uses; or - * have some other reason to use open source A/V solutions (if this is you, share your reason in the comments). - - - -Fortunately, there is a lot of open source software available for A/V creators, as well as hardware that supports those applications. All of the software on this list meets the following criteria: - - * cross-platform - * open source (for software and drivers) - * stable - * actively maintained - * well documented and supported - - - -I've divided this list into graphics, audio, video, and animation solutions. Note that the software applications in this article are not exact equivalents of well-known proprietary software, they'll require you to learn new applications, and you may need to modify your workflow, but learning new tools enables you to create differently. - -### Graphics - -I create a lot of graphics for print and web, including logos, banners, video titles, and mockups. Here are some of the open source applications I use, as well as the hardware I use with them. - -#### Software - -**1.[Inkscape][2]** (vector graphics) -Inkscape is a good vector graphics editor for creating SVG and PDF files in the RGB color space. (It can create CMYK images, but that's not the main aim.) It's a lifesaver for manipulating SVG maps and charts for web applications; not only can you open files with the integrated XML editor, you can also see all of an object's parameters. One drawback: it is not well optimized on Mac. For examples, see [Inkscape's gallery][3]. - -**2.[GIMP][4]** (picture editor) -GIMP is my favorite application to edit images, including manipulating color, cropping and resizing, and (especially) optimizing file size for the web (many of my Photoshop-using colleagues ask me to do that last step for them). You can also create and draw images from scratch, but GIMP is not my favorite tool for that. See [GIMP Artists on DeviantArt][5] for examples. - -**3.[Krita][6]** (digital painting) -So you have this beautiful Wacom drawing tablet on your desk, and you want to try a true digital painting application? Krita is what you need to create beautiful drawings and paintings. See [Krita's Gallery][7] to see what I mean. - -**4.[Scribus][8]** (desktop publishing) -You can use Scribus to create a complete document, or just to convert a PDF from Inkscape or Libre Office from RGB to CMYK. One feature I really like: You can simulate and check what people with visual disabilities will experience with a Scribus document. I count on Scribus when I send PDF files to a commercial printer. While printing companies may be used to files created with proprietary solutions like InDesign, if your Scribus file is done correctly, your printer won't have any issues. Free trick: The first time you send a file, don't tell the printer the name of the software you used to create it. See [Made with Scribus][9] for examples of documents created with this software. - -**5.[RawTherapee][10]** (RAW image photo development) -RawTherapee is the only completely cross-platform alternative to Lightroom I know of. You can use your camera in RAW mode, and then use RawTherapee to "develop" your picture. It provides a very powerful engine and a non-destructive editor. For examples, see [RawTherapee screenshots][11]. - -**6.[LibreOffice Draw][12]** (desktop publishing) -Although you may not think of LibreOffice Draw as a professional desktop publishing solution, it can save you in many situations; for example, if you are creating whitepapers, diagrams, or posters that other people (even those who don't know graphics software) can update later. Not only is it easy to use, it's also a great alternative to Impress or PowerPoint for creating interesting documents. - -#### Graphics hardware - -**Graphics tablets** -[Wacom][13] tablets (and compatibles) are usually well supported on all operating systems. - -**Color calibration** -Color calibration products are available on all operating systems, including GNU/Linux. The [Spyder][14] products by Datacolor are well supported with applications for all platforms. - -**Scanners and printers** -Graphic artists need the colors they output (whether print or electronic) to be accurate. But devices that are truly cross-platform, with easy-to-install drivers for all platform, are not as common as you'd think. Your best choices are scanners that are compatible with TWAIN and printers that are compatible with Postscript. In my experience, professional-range printers and scanners from Epson and Xerox are less likely to have driver issues, and they always work out of the box, with beautiful and accurate colors. - -### Audio - -There are plenty of open source audio software options for musicians, video makers, game makers, music publishers, and others. Here are the ones that I've used for content creation and audio recording. - -#### Software - -**7. [Ardour][15] **(digital audio recording) -For recording and editing audio, the best alternative to the professional Pro Tools music-creation software is, hands down, Ardour. It sounds great, the mixer section is complete and flexible, it supports your favorite plugins, and it makes it very easy to edit, listen, and compare your modifications. I use it a lot for audio recording or mixing sound on videos. It's not easy to find music recorded with Ardour, because musicians rarely credit the software they use. However, you can get an idea of its capabilities by looking at its [features and screenshots][16]. - -(If you are looking for an "analog feeling" in term of sound and workflow, you can try [Harrison Mixbus][17], which is not an open source project, but is heavily based on Ardour, with Harrison's analog console emulator. I really like to work with it and my customers like the sound. Mixbus is cross platform.) - -**8.[Audacity][18]** (audio editing) -Audacity is the "Swiss Army knife" of audio software. It's not perfect, but you can do almost everything with it. Plus it's very easy to use, and anyone can learn it in a few minutes. Like Ardour, it's hard to find work credited to Audacity, but you can find ways to use it on these [screenshots][19]. - -**9.[LMMS][20]** (music production) -LMMS, designed as an alternative to FL Studio, might not be as popular, but it is very complete and easy to use. You can use your favorite plugins, edit instruments using "piano roll" sequencing, play drum samples with a step sequencer, mix your tracks ... almost anything is possible. I use it to create audio loops for videos when I don't have the time to record musicians. See [The Best of LMMS][21] playlists for examples. - -**10.[Mixxx][22]** (DJ, music mixing) -If you need powerful software to mix music and play DJ, Mixx is the one to use. It's compatible with most MIDI controllers, timecoded discs, and dedicated sound cards. You can manage your music library, add effects, and have fun. Take a look at the [features][23] to see how it works. - -#### Audio interface hardware - -While you can record audio with any computer's sound card, to record well, you need an audio interface—a specialized type of external sound card that records high-quality audio input. For cross-platform compatibility, most "USB Class Compliant" or "compatible with iOS" audio interface devices should work for MIDI or other audio. Below is a list of cross-platform devices I use and know well. - -**[Behringer U-PHORIA UMC22][24]** -The UMC22 is the cheapest option you should consider. With less expensive options, the preamps are too noisy and the quality of the box is very low. - -**[Presonus AudioBox USB][25]** -The AudioBox USB is one of the first USB Class Compliant (and thereby cross-platform) recording systems out there. It is very robust and available on the second-hand market. - -**[Focusrite Scarlett][26]** -The Scarlett range is, in my opinion, the highest quality cross-platform sound card available. The various options range from devices with two to 18 input/outputs. You can find first-version models on the second-hand market, and the new second version offers better preamps and specs. I've worked a lot with the [2i2][27] model. - -**[Arturia AudioFuse][28]** -The AudioFuse allows you to plug in nearly anything, from a microphone to a vinyl disc player to various digital inputs. It provides both great sound and great design, and it's what I'm using the most now. It is cross-platform, but the configuration software is not yet available for GNU/Linux. It remembers my configuration even after I unplug it from my Windows PC, but really, Arturia, please be serious and make the software available for GNU/Linux. - -#### MIDI controllers - -A MIDI controller is a musical instrument—e.g., keyboards, drum pads, etc.—that allow you to control music software and hardware. Most of the recent USB MIDI controllers are cross-platform and compatible with the main software used to record and edit audio. Web-based tutorials will help you configure them for different software; although it may be harder to find info on GNU/Linux configurations, they will work. I've used many Akai and M-Audio devices without any issues. It's best to try a musical instrument before you buy, at least to listen to the sound quality or to touch the buttons. - -#### Audio codecs - -Audio codecs compress and decompress digital audio to deliver the best-quality audio at the smallest possible file size. Fortunately, the best codec for listening and streaming happens to be open source: [FLAC][29]. [Ogg Vorbis][30] is another open source audio codec worth checking out; it's far better than MP3 at the same bitrate. If you need to export audio in different file formats, I recommend always exporting and archiving audio at the best possible quality, then compressing a specific version if it's needed. - -### Video - -The impact of video in brand communications is significant. Even if you are not a video specialist, it's smart to learn the basics. - -#### Software - -**11.[VLC][31]** (video player and converter) -Originally developed for media streaming, VLC is now known for its ability to read all video formats on all devices. It's very useful; for example, you can also use it to convert a video into another codec or container or to recover a broken video. - -**12.[OpenShot][32]** (video editor) -OpenShot is simple software that produces great results, especially for short videos. (It is a bit limited in terms of editing or improving the sound of a video, but it will do the job.) I especially like the tool to move, resize, or crop a clip; it's perfect to create intros and outros that you can export, then use in a more complex editor. You can see [examples][33] (and get more information) on OpenShot's website. - -**13.[Shotcut][34]** (video editor) -I think Shotcut is a bit more complete than OpenShot—it's a very good competitor to the basic editors in your operating system, and it supports 4K and professional codecs. Give it a try, I think you will love it. You can see examples in these [video tutorials][35]. - -**14.[Blender Velvets][36]** (vdeo editing, compositing, effects) -While the learning curve is not the lightest on this list, Blender Velvets is one of the most powerful solutions you will find. It is a collection of extensions and scripts, created by movie makers, that transform the Blender 3D creation software into a 2D video editor. While it's complexity means it's not my top choice for video editing, you can find plenty of tutorials on YouTube and other sites, and once you learn it, you can do everything with this software. Watch this [tutorial video][37] to see its functions and how it works. - -**15.[Natron][38]** (compositing) -I don't use Natron, but I've gotten great feedback from people who do. It's an alternative to Adobe's After Effects, but works differently. To learn more, watch a few video tutorials, like these on [Natron's YouTube][39] channel. - -**16.[OBS][40]** (live editing, recording, and streaming) -Open Broadcaster Software (OBS) is the leading solution for recording or [livestreaming][41] e-sports and video games on YouTube or Twitch. I use it a lot to record users' screens, conferences, meetups, etc. For more information, see the tutorial I wrote for Opensource.com about recording live presentations, [Part 1: Choosing your equipment][42] and [Part 2: Software setup][43]. - -#### Video hardware - -First things first: You will need a powerful workstation with a fast hard drive and updated software and drivers. - -**Graphics processing unit (GPU)** -Some software on this list, including Blender and Shotcut, use OpenGL and hardware acceleration, which have high GPU demands. I recommend the most powerful GPU you can afford. I've had good experience with AMD and Nvidia, depending on the platform. Don't forget to install the latest drivers. - -**Hard drives** -In general, the faster and bigger the hard drive, the better it is for video. Don't forget to configure your software to use the right path. - -**Video capture hardware** - - * [Blackmagic Design][44]: Blackmagic provides very good, professional-grade video capture and playback hardware. Drivers are available for Mac, Windows, and GNU/Linux (but not all distributions). - * [Epiphan][45]: Among Epiphan's professional USB video capture devices is a new USB Class Compliant model for HDMI and high screen resolutions. However, you can find the older VGA devices on the secondhand market, for which they continue to provide dedicated drivers for GNU/Linux and Windows. - - - -#### Video codecs - -Unfortunately, it is still difficult to work with open source codecs. For example, many cameras use proprietary codecs to record videos in H.264 and sound in AC3, in a format called AVCHD. Therefore, we have to be pragmatic and use what is available. - -The good news is that the content industry is moving to open source codecs to avoid fees and to use open standards. For distribution and streaming, [Google'][46][s WebM][46] is a good open source codec, and most video editors can export in that format. Also, [GoPro's][47][Cineform][47] codec for very high resolution and 360° video is now open source. Hopefully more devices and vendors will use it soon. - -### 2D and 3D animation - -Animation is not my field of expertise, so I've asked my friends who are working on animated content, including movies and series for kids, for their recommendations to compile this list. - -#### Software - -**17. [Blender][48] **(3D modeling and rendering) -Blender is the top open source and cross-platform software for 3D modeling and rendering. You can do your entire project directly in Blender, or use it to create 3D effects for a movie or video. You will find a lot of video tutorials on the web, so even though it isn't simple software, it's very easy to get started. Blender is a very active project and regularly produces short movies to showcase the technology. You can see some of them on [Blender Open Movies][49]. - -**18.[Synfig Studio][50]** (2D animation) -The first time I used Synfig, it reminded me of the good, old Macromedia Flash editor. Since then, it has grown into a full-featured 2D animation studio. You can use it to produce promotional stories, commercials, presentations, or original intros, outros, and transitions for your videos, or even to work on full animated movies. See [Synfig's portfolio][51] for some examples. - -**19.[TupiTube][52]** (stop-motion, 2D animation) -TupiTube is an excellent way to learn the basics of 2D animation. You can transform a set of drawings or other pictures into a video or create an animated GIF or small loops. It's quite simple software, but very complete. Check out [TupiTube's YouTube][53] channel for some tutorials and examples. - -#### Hardware - -Animation uses the same hardware as graphic design, so look at the hardware list in the first section of this article for recommendations. - -One additional note: You will need a powerful GPU for 3D modeling and rendering. The choices can be limited, depending on your platform or PC maker, but don't forget to install the latest drivers. Carefully choose your graphics card: they are expensive and critical for big 3D projects, particularly in the rendering step. - -### Linux options - -If you are a GNU/Linux user, I have some more good options for you. They aren't fully cross-platform, but some of them have a Windows installer, and some can be installed on Mac with Macports. - -**20.[Kdenlive][54]** (video editor) -With its last release (a few months ago), Kdenlive became my favorite video editor, especially when I work on a long video on my Linux machine. If you are a regular user of popular non-linear video editors, Kdenlive (which stands for KDE Non-Linear Video Editor) will be easy for you to use. It has good video and audio effects, is great when you need to work on details, and works on BSD and MacOS (although it's aimed at GNU/Linux) and is being ported to Windows. - -**21.[Darktable][55]** (RAW development) -Darktable is a very complete alternative to DxO that is made by photographers for photographers. Some research projects are using it as a platform for development and testing of new image processing algorithms. It is a very active project, and I can't wait until it becomes truly cross-platform. - -**22.[MyPaint][56]** (digital painting) -MyPaint is like a light table for digital painting. It works well with Wacom devices, and its brush engine is particularly appreciated, so GIMP developers are looking closely at it. - -**23.[Shutter][57]** (desktop screenshots) -When I create tutorials, I use a lot of screenshots to illustrate them. My favorite screenshot tool for GNU/Linux is Shutter; actually, I can't find an equivalent in terms of features for Windows or Mac. One missing piece: I would like to see Shutter add a feature to create animated GIF screenshots over a few seconds. - -I hope this has convinced you that open source software is an excellent, viable solution for A/V content producers. If you are using other open source software—or have advice about using cross-platform software and hardware—for audio and video projects, please share your ideas in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/2/open-source-audio-visual-production-tools - -作者:[Antoine Thomas][a] -译者:[译者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/ttoine -[1]:https://opensource.com/resources/what-open-source -[2]:https://inkscape.org/ -[3]:https://inkscape.org/en/gallery/ -[4]:https://www.gimp.org/ -[5]:https://gimp-artists.deviantart.com/gallery/ -[6]:https://krita.org/ -[7]:https://krita.org/en/features/gallery/ -[8]:https://www.scribus.net/ -[9]:https://www.scribus.net/category/made-with-scribus/ -[10]:http://rawtherapee.com/ -[11]:http://rawtherapee.com/blog/screenshots -[12]:https://www.libreoffice.org/discover/draw/ -[13]:http://www.wacom.com/en-us -[14]:http://www.datacolor.com/photography-design/product-overview/#workflow_2 -[15]:https://www.ardour.org/ -[16]:http://ardour.org/features.html -[17]:http://harrisonconsoles.com/site/mixbus.html -[18]:http://www.audacityteam.org/ -[19]:http://www.audacityteam.org/about/screenshots/ -[20]:https://lmms.io/ -[21]:https://lmms.io/showcase/ -[22]:https://www.mixxx.org/ -[23]:https://www.mixxx.org/features/ -[24]:http://www.musictri.be/Categories/Behringer/Computer-Audio/Interfaces/UMC22/p/P0AUX -[25]:https://www.presonus.com/products/audiobox-usb -[26]:https://us.focusrite.com/scarlett-range -[27]:https://us.focusrite.com/usb-audio-interfaces/scarlett-2i2 -[28]:https://www.arturia.com/products/audio/audiofuse/overview -[29]:https://en.wikipedia.org/wiki/FLAC -[30]:https://xiph.org/vorbis/ -[31]:https://www.videolan.org/ -[32]:https://www.openshot.org/ -[33]:https://www.openshot.org/videos/ -[34]:https://shotcut.com/ -[35]:https://shotcut.org/tutorials/ -[36]:http://blendervelvets.org/ -[37]:http://blendervelvets.org/video-tutorial-new-functions-for-the-blender-velvets/ -[38]:https://natron.fr/ -[39]:https://www.youtube.com/playlist?list=PL2n8LbT_b5IeMwi3AIzqG4Rbg8y7d6Amk -[40]:https://obsproject.com/ -[41]:https://opensource.com/article/17/7/obs-studio-pro-level-streaming -[42]:https://opensource.com/article/17/9/equipment-recording-presentations -[43]:https://opensource.com/article/17/9/equipment-setup-live-presentations -[44]:https://www.blackmagicdesign.com/ -[45]:https://www.epiphan.com/ -[46]:https://www.webmproject.org/ -[47]:https://fr.gopro.com/news/gopro-open-sources-the-cineform-codec -[48]:https://www.blender.org/ -[49]:https://www.blender.org/about/projects/ -[50]:https://www.synfig.org/ -[51]:https://www.synfig.org/#portfolio -[52]:https://maefloresta.com/ -[53]:https://www.youtube.com/channel/UCBavSfmoZDnqZalr52QZRDw -[54]:https://kdenlive.org/ -[55]:https://www.darktable.org/ -[56]:http://mypaint.org/ -[57]:http://shutter-project.org/ diff --git a/translated/tech/20180207 23 open source audio-visual production tools.md b/translated/tech/20180207 23 open source audio-visual production tools.md new file mode 100644 index 0000000000..ac414cf5f1 --- /dev/null +++ b/translated/tech/20180207 23 open source audio-visual production tools.md @@ -0,0 +1,255 @@ +23 款开源的声音视觉生产工具 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-photo-camera-blue.png?itok=AsIMZ9ga) + +“开源”在云基础设施、网站托管、嵌入式设备和其他领域已经建立的相当完善。很少数人知道开源在生产专业级的声音视觉素材上也是一个不错的选择。 + +作为一名产品经理(有时候也是市场支持),我为终端用户提供很多内容:文档,文章,视频教学,甚至是展台物料,白纸,采访等等。我找到了很多可以帮我制作音频、视频,排版,截屏的开源软件。人们选择开源软件而不是专有软件的[原因][1]有很多,而我也为以下人群编制了一份开源音视频工具清单: + + * 想要入坑 GNU/Linux,但需要在原来的操作系统上慢慢开始使用跨平台软件 + * 热爱开源,但对音视频开源软件所知甚少,不知道该如何选择 + * 想要为创造力充电而探索新的工具,并且不想使用其他人使用过的方法工具 + * 存在某些其他的原因使用开源音视频解决方案(如果是你,不妨在评论里分享一下) + +幸运的是,存在着很多开源音视频软件的创造者,也存在着很多硬件来支持这些应用。本文清单里的所有软件都符合以下标准: + + * 跨平台 + * 开源(软件和驱动) + * 稳定 + * 积极维护 + * 良好的文档与技术支持 + +我将清单中的解决方案划分为图形,音频,视频和动画。注意,本文中提到的应用程序并不完全等同于一些有名的私有软件,它们需要花时间来学习,并且可能需要改变你的工作流程,但是学习新的工具能够让体验全新的创造方式。 + +### 图形 + +我制作过很多出版和网站使用的图形,包括 logo,横幅,视频标题,模型。这里是一些我用过的开源应用,也包括一起使用的硬件。 + +#### 软件 + +**1.[Inkscape][2]** (矢量图) +Inkscape 是一款不错的矢量图编辑器,用来制作 RGB 颜色空间下的 SVG 和 PDF 文件。(它可以制作 CMYK 图像,但不是主要用途)它是为 web 应用制作 SVG 格式的地图和图表的人的救命稻草。你不仅可以使用集成的 XML 编辑器打开文件,也可以用它查看对象的所有参数。但有一个缺点:它在 Mac 上的优化不是很好。有很多样例,可以看[Inkscape 画廊][3]。 + +**2.[GIMP][4]** (图片编辑器) +GIMP 是我最喜欢的图片编辑程序,它包括了色彩调整,裁剪和拉伸,并且(尤其是)对于网页使用的文件大小进行了优化(很多使用 Photoshop 的同事让我帮他们做这最后一步)。你也可以从头制作并绘制一张图片,但 GIMP 并不是我最喜欢用来做这件事的工具。在 [GIMP Artists on DevianArt][5] 上查看众多的样例。 + +**3.[Krita][6]** (数字绘画) +当你桌子上摆着一个漂亮的 Wacom 数位板,你肯定想试试真正的数字绘画应用。Krita 就是你创作漂亮插画所需要的工具。在 [Krita 画廊][7] 里看看我说的东西吧。 + +**4.[Scribus][8]** (桌面印刷系统) +你可以使用 Scribus 来创建一个完整的文档,或者通过 Inkscape 或 Libre Office 将 PDF 从 RGB 转换到 CMYK 。有一个功能我非常喜欢:你可以试着模拟视觉障碍人士使用 Scribus 时的体验。当我发送 PDF 文件给商用打印机时全指望 Scribus。尽管出版社可能使用像 InDesign 这样的私有软件创建文档,但如果你用 Scribus 正确的完成一份文档,那么打印时就不会出现任何问题。免费建议:第一次发送文件给打印机时,不要告诉打印机创建该文档所使用的软件。你可以在 [Scribus 教程][9]中寻找创建文档的例子。 + +**5.[RawTherapee][10]** (RAW 图像开发工具) +RawTherapee 是我所知道唯一跨平台可替代 Lightroom 的软件。你可以将相机调整到 RAW 模式,然后使用 RawTherapee 来修图。它提供了非常强大的引擎和对图片没有破坏的编辑器。例如,可以见 [Raw Therapee 截图][11]。 + +**6.[LibreOffice Draw][12]** (桌面印刷系统) +尽管你可能认为 LibraOffice Draw 不是一款专业的桌面印刷解决方案,但它仍然能够在很多情况下帮助你。例如,制作白皮书,图表,或其他人(尽管是那些不懂图形软件的人)以后可以修改的海报。它不仅方便使用,而且当创建有趣的文档时也是 Impress 或 PowerPoint 的绝佳替代软件。 + +#### 图形硬件 + +**绘图板** +[Wacom][13] 数位板(和配件)通常支持所有的操作系统。 + +**颜色校正** +颜色校正产品通常可用于所有操作系统,也包括了 GNU/Linux。Datacolor 生产的 [Spyder][14] 在所有平台上都有应用程序的支持。 + +**扫描仪和打印机** +图形艺术家需要输出(无论是打印还是数字存储)精确的颜色。但是真正跨平台的设备,以及所有平台都易于安装的驱动,并不像你想的那样普遍。你的最佳选择是兼容 TWAIN 的扫描仪和兼容 Postscript 的打印机。以我的经验,Epson 和 Xerox 的专业级扫描仪和打印机更不容易出现驱动问题,并且它们通常也是开箱即用,拥有漂亮精确的颜色。 + +### 音频 + +有许多可供音乐家,视频制作者,游戏制作者,音乐出版商等等人群选择的开源音频软件。这里有一些我曾经用来进行内容创作与声音录制时所使用的软件。 + +#### 软件 + +**7. [Ardour][15] **(数字音频录制) +对录音与编辑来说,最专业级的工具选择当然是唾手可得的 Ardour。听起来很棒,它的混音部分非常的完整灵活,能够提供给你喜欢的插件,并且易于回放、编辑、对比修改。我经常用它进行声音录制和视频混音。要找出一些使用 Ardour 录制好的音乐并不容易,因为音乐家们很少相信它们使用的软件。然而,你可以查看它的[截图][16]和一些特性来了解它的功能。 + +(如果你在寻求一种声音制作方面的“模拟感觉”,你可以试试 [Harrison Mixbus][17],它并不是一个开源项目,但是高度基于 Ardour,拥有模拟显示的终端。我非常喜欢用它进行工作,我的客户也喜欢用它制作的声音。Mixbus 也是跨平台的) + +**8.[Audacity][18]** (声音编辑) +Audacity 属于“瑞士军刀”级的声音制作软件。它并不完美,但你几乎可以用它做所有的事情。加上非常易于使用,任何人都能在几分钟之内上手。像 Ardour 一样,很难找到一份归功于 Audacity 的作品,但你可以从这些[截图][19]中了解如何使用它。 + +**9.[LMMS][20]** (音乐制作) +LMMS,设计的就像 FL Studio 的替代品,也许并不那么广泛,但它非常完整并易于使用。你可以使用自己最喜欢的插件,使用“钢琴键”编辑乐器,使用步定序器step sequencer播放鼓点,混合音轨...几乎能做任何事情。在我没有时间给音乐家录音的时候我就使用它为视频创建声音片段。查看[最好的 LMMS][21] 榜单来看看一些例子。 + +**10.[Mixxx][22]** (DJ,音乐混音) +如果你需要强大的混音和播放 DJ 软件,Mixx 就可以满足你的需求。它与大多数 MIDI 控制器,唱片,专用声卡所兼容。你可以用它管理音乐库,添加音效,做一些有趣的事情。查看它的[功能][23]来了解它是如何工作的。 + +#### 音频接口硬件 + +尽管你可以使用任何一个计算机的声卡录制音频,但要录制的很好,就需要一个音频接口——一个录制高质量音频输入的专用的外部声卡。对于跨平台兼容性来说,大多数“兼容 USB”和“兼容 IOS”的音频接口设备应该都能录制 MIDI 或其他音频。下面是一些我用过的一些有名气的跨平台设备。 + +**[Behringer U-PHORIA UMC22][24]** +UMC22 是你可以考虑的最便宜的选择。但它的前置放大器噪音太大,音腔box质量也比较低。 + +**[Presonus AudioBox USB][25]** +AudioBox USB 是第一个兼容 USB(因此也跨平台) 的录音系统。它非常的耐用,经常在二手市场也能见到。 + +**[Focusrite Scarlett][26]** +Scarlett 在我看来是目前最高质量的跨平台声卡。不同种类的设备可以涵盖 2-18 个输入/输出端口。你可以在二手市场找到它的最初版本,而最新的第二代具有更好的前置放大器与规格。[2i2][27] 型号是我经常使用的那一款。 + +**[Arturia AudioFuse][28]** +AudioFuse 几乎可以让你接入任何设备,从麦克风到黑胶唱片机再到各种数字输入设备。它具有优质的声音与良好的设计,也是我目前用的最多的一款设备。它是跨平台的,但目前配置软件还不能在 GUN/Linux 上使用。即使我把它从 Windows 电脑上断开,它仍然保留着我的配置。但是讲真,Arturia,劳烦认真考虑做一个 Linux 的软件。 + +#### MIDI 控制器 + +MIDI 控制器是一种乐器——例如电子琴,鼓垫等等。可以让你控制音乐软件或者硬件。现有的大多数 USB MIDI 控制器都跨平台并兼容主流的录音编辑软件。基于网页的教程可以帮你对不同的软件进行配置。尽管找到有关 GNU/Linux 的配置信息可能比较困难,但它们仍然是可以使用的。我用过许多 Akai 和 M-Audio 设备,没有任何问题。在买乐器之前最好先试一下,至少去听一下它们的音质或体验一下按键触感。 + +#### 音频编解码器 + +音频编解码器压缩或解压数字音频,用尽可能小的文件大小获得最佳质量的声音。幸运的是,用于收听或流媒体播放的编解码器恰好是开源的:[FLAC][29]。[Ogg Vorbis][30] 是另一个值得了解的开源音频编解码器;在相同的比特率下比 MP3 好的多。如果你需要输出不同的音频格式,我建议通常存档最好质量的音频,然后再压缩成特定的版本。 + +### 视频 + +视频对于品牌的传播是影响巨大的。即使你不是一个视频专家,学习一些基础的东西也是非常明智的。 + +#### 软件 + +**11.[VLC][31]** (视频播放器与转换器) +最初是为流媒体而开发的,VLC 现在因能够在所有设备上读取所有的视频格式被人们熟知。它非常的实用,例如,你可以使用它将视频转换成其他编解码格式或容器,也可以用来恢复破损的视频。 + +**12.[OpenShot][32]** (视频编辑) +OpenShot 是一个简单的软件,但它却可以制作出很好的效果,尤其是在短视频上。(在编辑或改善音质方面有一定的限制,但它也能够完成)我非常喜欢它的移动,拉伸,裁剪工具;用它创建视频的开头或结尾,导出之后使用更复杂的编辑器进行编辑,非常的完美。你可以在 OpenShot 的网站上看这些[例子][33](并获取更多信息)。 + +**13.[Shotcut][34]** (视频编辑) +我认为 Shotcut 是比 OpenShot 更完整一些的工具——它在你的操作系统上比起其他较为基础的编辑器更具有竞争力,并且它支持 4K 分辨率,具有专业的解码器。尝试一下,我相信你会爱上它的。你可以在这些[视频教程][35]里看一些范例。 + +**14.[Blender Velvets][36]** (视频编辑,合成,特效) +尽管这一章节不是本文的学习重点,但 Blender Velvets 是你能找到的最强大的解决方案之一。它是由一些视频创作者所制作的一系列扩展工具和脚本的合集,是通过 Blender 3D 制作软件转换成的 2D 视频编辑器。 尽管它的复杂度意味着不是我的首选视频编辑器,但你仍可以在 YouTube 和其他网站上找到它的教程,并且一旦你学习了它,你就能通过它做任何事情。观看这个[视频教程][37]来了解它的功能与运作方式。 + +**15.[Natron][38]** (合成) +我不使用 Natron,但我听说它广受好评。它是 Adobe After Effects 的替代品,但运作方式并不同。想了解更多可以观看一些视频教程,比如这些 Natron 的 [YouTube 频道][39]。 + +**16.[OBS][40]** (实时编辑,录制,流媒体) +Open Broadcaster Software (OBS)是一个领先的在 YouTube 或 Twitch 上进行现场录制或现场直播电子竞技,电视游戏的解决方案。我经常使用它记录用户的屏幕,会议和聚会。获取更多信息,查看我曾经在 Opensource.com 上写的关于录制现场汇报的教程,[第一部分:选择你的设备][42]和[第二部分:软件安装][43]。 + +#### 视频硬件 + +结论先行:你需要一个强大的工作站以及快速的硬盘和更新后的软件和驱动。 + +**图形处理单元(GPU)** +一部分包含在清单里的软件比如 Blender 和 Shotcut 使用 OpenGL 和硬件加速,这些都高度依赖 GPU。我建议你使用可以负担起的最强大的 GPU。我所使用过的 AMD 和 Nvidia 都有着良好的体验,这取决于使用的平台。不要忘记安装最新的驱动。 + +**硬件驱动** +大体上来说,驱动做的越快越大,对视频越好。不要忘记在软件里配置好正确的路径。 + +**视频录制硬件** + + * [Blackmagic Design][44]: Blackmagic 提供了非常好,专业级的视频录制和回放硬件。驱动支持 Mac,Windows,和 GNU/Linux(但不是所有的发行版) + * [Epiphan][45]: 在 Epiphan 的专业级 USB 视频录制设备中有一款新型产品,它适用于 HDMI 和高分辨率的屏幕。然而,你也可以在二手市场找到旧的 VGA 设备,因为他们还在继续为 GNU/Linux 和 Windows 上提供专用的驱动程序。 + +#### 视频编解码 + +不幸的是,使用开源的编解码器仍然很困难。例如,许多相机使用专有的编解码器录制 H.264 的视频和 AC3 的音频,组成称为 AVCHD 的格式。因此,我们必须务实,尽可能利用现有资源。 + +好消息是内容产业正在步向开源的编解码器来避免一些费用,并使用开源标准。对于出版和流媒体,[谷歌][46]的 [WebM][46] 便是一款优秀的开源编解码器,并且大多数视频编辑器可以导入这种格式。同样地, [GoPro][47]的超高分辨率和 360° 视频编解码器 [Cineform][47] 现在也进行了开源。希望更多的设备和供应商将会在不久之后使用它。 + +### 2D 和 3D 动画 + +动画不是我的专业领域,因此我问了从事于动画内容生产的朋友一些建议并加入到清单中,他的工作包含儿童电影和连续剧。 + +#### 软件 + +**17. [Blender][48] ** (3D 模型和渲染) +Blender 是顶级的开源跨平台 3D 建模和渲染软件。你可以直接在 Blender 中完成整个项目的工作,或者使用它为电影或视频创建 3D 效果。你能够在网上找到许多视频教程,因此即使它不是一个简单的软件,但非常容易上手。Blender 是一个非常活跃的项目,经常还会制作一些微电影来展示他们的技术。你可以在 [Blender Open Movies][49] 上观看。 + +**18.[Synfig Studio][50]** (2D 动画) +第一次用 Synfig 时,它让我想起了那个不错的 Macromedia 老式 Flash 编辑器。在那之后,它已经发展成一个全功能的 2D 动画工作室。你可以使用它制作畅销故事,商业广告,演示,开场或结尾动画以及视频中的转场,或者甚至用它制作全动画的电影。见[ Synfig 作品集][51]。 + +**19.[TupiTube][52]** (定格 2D 动画) +使用 TupiTube 是一个学习基本 2D 动画的极好方法。你可以将一系列绘画或其他图片转换成一个视频或者创建一个 GIF 循环动画。它是一个相当简单的软件,但非常完整。查看 [TupiTude 的 YouTube][53] 频道获取一些教程和范例。 + +#### 硬件 + +动画制作使用与图形设计相同的硬件,因此查看第一小结中的硬件清单获取一些建议。 + +有一点需要注意:你要用一个强大的 GPU 来进行 3D 建模和渲染。选择可能有些限制,因为这取决于你使用的平台或电脑制造商,但是不要忘记安装最新的驱动。谨慎选择你的显卡:它们非常昂贵,并且在大型的 3D 项目中至关重要,尤其是在渲染步骤中。 + +### Linux 上的选择 + +如果你是 GUN/Linux 用户,那么我为您提供了更多不错的选择。它们并不是完全跨平台的,但部分拥有 Windows 版本,还有一些可以在 Mac 上使用 Macports 安装。 + +**20.[Kdenlive][54]** (视频编辑) +伴随着最新版本的发布(几个月之前),Kdenlive 成为了我最喜欢的视频编辑器,尤其是当我在 Linux 机器上处理一些长视频的时候。如果你经常使用流行的非线性视频编辑器,Kdenlive(全称是 KDE 非线性视频编辑器KDE Non-Linear Video Editor)对你来说将非常简单。他拥有很棒的视频和音频特效,强大的细节处理能力。并且在 BSD 和 MacOS(尽管它对准的是 GNU/Linux)都能使用,还有望移植到 Windows 上。 + +**21.[Darktable][55]** (RAW 图像开发) +Darktable 是一款由摄影师制作的非常完整的 DxO PhotoLab 替代品。一些研究型项目使用它当做开发平台并测试一些图像处理算法。它是一个非常活跃的项目,我已经等不及的见到它的跨平台版本了。 + +**22.[MyPaint][56]** (digital painting数字绘画) +MyPaint 就像数字绘画领域的 light table。(译注:集成开发环境)它在 Wacom 设备上表现良好,并且它的笔刷引擎尤其值得赞赏,因此 GIMP 开发人员正在密切的关注它。 + +**23.[Shutter][57]** (桌面截图) +当我写这篇教程的时候,我使用了许多截图来进行展示。我最喜欢的 GNU/Linux 截图工具就是 Shutter。事实上,我都找不到在 Windows 或 Mac 上能与之抗衡的一些功能。有一点小遗憾:我很期待 Shutter 在将来能够增加新的功能来创建几秒动态的 GIF 截图。 + +我希望这些足以说服你开源软件是一种非常卓越且可行的音视频内容生产解决方案。如果你正在使用其他开源软件,或者对于使用跨平台软件和硬件进行音视频项目有好的建议,请在评论中分享你的观点。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/2/open-source-audio-visual-production-tools + +作者:[Antoine Thomas][a] +译者:[LuuMing](https://github.com/LuuMing) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/ttoine +[1]:https://opensource.com/resources/what-open-source +[2]:https://inkscape.org/ +[3]:https://inkscape.org/en/gallery/ +[4]:https://www.gimp.org/ +[5]:https://gimp-artists.deviantart.com/gallery/ +[6]:https://krita.org/ +[7]:https://krita.org/en/features/gallery/ +[8]:https://www.scribus.net/ +[9]:https://www.scribus.net/category/made-with-scribus/ +[10]:http://rawtherapee.com/ +[11]:http://rawtherapee.com/blog/screenshots +[12]:https://www.libreoffice.org/discover/draw/ +[13]:http://www.wacom.com/en-us +[14]:http://www.datacolor.com/photography-design/product-overview/#workflow_2 +[15]:https://www.ardour.org/ +[16]:http://ardour.org/features.html +[17]:http://harrisonconsoles.com/site/mixbus.html +[18]:http://www.audacityteam.org/ +[19]:http://www.audacityteam.org/about/screenshots/ +[20]:https://lmms.io/ +[21]:https://lmms.io/showcase/ +[22]:https://www.mixxx.org/ +[23]:https://www.mixxx.org/features/ +[24]:http://www.musictri.be/Categories/Behringer/Computer-Audio/Interfaces/UMC22/p/P0AUX +[25]:https://www.presonus.com/products/audiobox-usb +[26]:https://us.focusrite.com/scarlett-range +[27]:https://us.focusrite.com/usb-audio-interfaces/scarlett-2i2 +[28]:https://www.arturia.com/products/audio/audiofuse/overview +[29]:https://en.wikipedia.org/wiki/FLAC +[30]:https://xiph.org/vorbis/ +[31]:https://www.videolan.org/ +[32]:https://www.openshot.org/ +[33]:https://www.openshot.org/videos/ +[34]:https://shotcut.com/ +[35]:https://shotcut.org/tutorials/ +[36]:http://blendervelvets.org/ +[37]:http://blendervelvets.org/video-tutorial-new-functions-for-the-blender-velvets/ +[38]:https://natron.fr/ +[39]:https://www.youtube.com/playlist?list=PL2n8LbT_b5IeMwi3AIzqG4Rbg8y7d6Amk +[40]:https://obsproject.com/ +[41]:https://opensource.com/article/17/7/obs-studio-pro-level-streaming +[42]:https://opensource.com/article/17/9/equipment-recording-presentations +[43]:https://opensource.com/article/17/9/equipment-setup-live-presentations +[44]:https://www.blackmagicdesign.com/ +[45]:https://www.epiphan.com/ +[46]:https://www.webmproject.org/ +[47]:https://fr.gopro.com/news/gopro-open-sources-the-cineform-codec +[48]:https://www.blender.org/ +[49]:https://www.blender.org/about/projects/ +[50]:https://www.synfig.org/ +[51]:https://www.synfig.org/#portfolio +[52]:https://maefloresta.com/ +[53]:https://www.youtube.com/channel/UCBavSfmoZDnqZalr52QZRDw +[54]:https://kdenlive.org/ +[55]:https://www.darktable.org/ +[56]:http://mypaint.org/ +[57]:http://shutter-project.org/ From f86efd8062a2863544369360e2bd2f4f3d519033 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 21:44:51 +0800 Subject: [PATCH 716/800] PRF @robsean --- ... Edit images on Fedora easily with GIMP.md | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/translated/tech/20191113 Edit images on Fedora easily with GIMP.md b/translated/tech/20191113 Edit images on Fedora easily with GIMP.md index 97470082ae..6faa337724 100644 --- a/translated/tech/20191113 Edit images on Fedora easily with GIMP.md +++ b/translated/tech/20191113 Edit images on Fedora easily with GIMP.md @@ -1,20 +1,20 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Edit images on Fedora easily with GIMP) [#]: via: (https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/) [#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) -在 Fedora 上使用 GIMP 简单地编辑图像 +在 Fedora 上使用 GIMP 轻松编辑图像 ====== ![][1] -GIMP ( GNU Image Manipulation Program 的缩写) 是自由和开源图像处理软件。有很多的功能,从简单地编辑图像,到复杂的滤镜,脚本,甚至是动画,它是一款很好的流行的商业选项的替代品。 +GIMP(GNU Image Manipulation Program 的缩写)是自由开源的图像处理软件。它有很多的功能,从简单的图像编辑,到复杂的滤镜、脚本,甚至是动画,它是流行的商业同类软件的一款很好的替代品。 -继续阅读来学习如何在 Fedora 上安装和使用 GIMP 。这篇文章涉及基本的日常图像编辑。 +继续阅读来学习如何在 Fedora 上安装和使用 GIMP。这篇文章涉及基本的日常图像编辑工作。 ### 安装 GIMP @@ -24,45 +24,45 @@ GIMP 在官方 Fedora 存储库中可获得。为安装它,运行: sudo dnf install gimp ``` -### 单个窗口模式 +### 单窗口模式 -在你打开应用程序后,它显示带有工具箱和主编辑区的暗色主题窗口。注意,它有两种窗口模式,你可以通过选择 _窗口_ -> _单个窗口模式_ 在其中切换。通过选中这个选项,用户界面的所有组件将显示在单个窗口中。否则,它们将是分开的。 +在你打开应用程序后,它显示带有工具箱和主编辑区的暗色主题窗口。注意,它有两种窗口模式,你可以通过选择“窗口Windows -> 单窗口模式Single Window Mode”在其中切换。通过选中这个选项,用户界面的所有组件将显示在单个窗口中。否则,它们将是分离的。 -### 加载一个图像 +### 加载图像 ![][2] -为加载一个图像,转到 _文件_ -> _打开_ ,然后选择你的文件并选择你的图像文件。 +为加载图像,转到“文件File -> 打开Open”,然后选择你的文件并选择你的图像文件。 ### 重新调整一个图像的大小 -为重新调整图像大小,你有以一对参数为基础的重新调整大小的选项,包括像素和百分比 — 在编辑图像时,这两个参数很方便。 +为重新调整图像大小,你可以基于一对参数重新调整大小,包括像素和百分比 —— 在编辑图像时,这两个参数很方便。 -让我们假使我们需要缩小 Fedora 30 背景图像到它当前大小的75%。为此,选择 _图像_ -> _比例_ ,然后在比例对话框上,选择在单位下拉列表中的百分比。接下来,输入 _75_ 作为宽度或高度,然后按 **Tab** 键。默认情况下,为保持纵横比,其它尺寸将自动地与更改的尺寸对应来重新调整大小。现在,保存其它选项不变,并按比例。 +让我们假使我们需要缩小 Fedora 30 背景图像到它当前大小的 75%。为此,选择“图像 Image -> 比例Scale”,然后在比例对话框上,在单位下拉列表中选择“百分比percentage”。接下来,输入 “75” 作为宽度或高度,然后按 Tab 键。默认情况下,其它尺寸将自动地调整大小,以相应地与更改的尺寸保持纵横比。现在,保存其它选项不变,并按比例。 ![][3] -该图像缩小到其原始尺寸的75%。 +该图像缩小到其原始尺寸的 75%。 ### 旋转图像 -旋转是一种变换操作,因此,你可以从主菜单下的 _图像_ -> _变换_ 的下面找到它,其中有图像旋转90°或180°的选项。在上述选项下也有垂直或水平翻转图像的选项。 +旋转是一种变换操作,因此,你可以从主菜单下的“图像Image -> 变换Transform”下找到它,其中有图像旋转 90° 或 180° 的选项。在上述选项下也有垂直或水平翻转图像的选项。 -让我们假使我们需要旋转图像90°。在应用一次90°顺时针旋转和水平翻转后,我们的图像将看起来像这样: +让我们假使我们需要旋转图像 90°。在应用一次 90° 顺时针旋转和水平翻转后,我们的图像将看起来像这样: ![Transforming an image with GIMP][4] ### 添加文本 -添加文本非常简单。只需要从工具箱中选择 A 图标,然后,在你的图像上,单击你想要添加文本的位置上一点。如果工具箱不可见,从 窗口->新建工具箱 打开它。 +添加文本非常简单。只需要从工具箱中选择 “A” 图标,然后,在你的图像上,单击你想要添加文本的位置。如果工具箱不可见,从“窗口Windows -> 新建工具箱New Toolbox”打开它。 -当你编辑文本时,你可能注意到,文本对话框有字体自定义选项,包括字体系列,字体大小等等。 +当你编辑文本时,你可能注意到,文本对话框有字体自定义选项,包括字体系列、字体大小等等。 ![Adding text to image in GIMP][5] ### 保存和导出 -你可以从 _文件_ -> _保存_ 或通过按 **Ctrl+S** 来保存你的编辑为一个带有 _xcf_ 扩展名的 GIMP 工程。或者,你可以导出你的图像,例如,以 PNG 或 JPEG 格式。为导出,转到 _文件_ -> _导出为_ 或按 **Ctrl+Shift+E** ,接下来,在你面前将产生一个你可以选择输出图像和名称的对话框。 +你可以从“文件File -> 保存Save”或通过按 `Ctrl+S` 来将你的编辑保存为一个带有 `.xcf` 扩展名的 GIMP 工程。或者,你可以导出你的图像,例如,以 PNG 或 JPEG 格式。为导出图像,转到“文件File -> 导出为Export As”或按 `Ctrl+Shift+E`,接下来,在你面前将产生一个你可以选择输出图像和名称的对话框。 -------------------------------------------------------------------------------- @@ -71,7 +71,7 @@ via: https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/ 作者:[Mehdi Haghgoo][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 d05ebfb929797bfdc4460208c945e5e54f183003 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 21:45:33 +0800 Subject: [PATCH 717/800] PUB @robsean https://linux.cn/article-11632-1.html --- .../20191113 Edit images on Fedora easily with GIMP.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191113 Edit images on Fedora easily with GIMP.md (98%) diff --git a/translated/tech/20191113 Edit images on Fedora easily with GIMP.md b/published/20191113 Edit images on Fedora easily with GIMP.md similarity index 98% rename from translated/tech/20191113 Edit images on Fedora easily with GIMP.md rename to published/20191113 Edit images on Fedora easily with GIMP.md index 6faa337724..c4fa6c8b67 100644 --- a/translated/tech/20191113 Edit images on Fedora easily with GIMP.md +++ b/published/20191113 Edit images on Fedora easily with GIMP.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (robsean) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11632-1.html) [#]: subject: (Edit images on Fedora easily with GIMP) [#]: via: (https://fedoramagazine.org/edit-images-on-fedora-easily-with-gimp/) [#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) From 76994645e3277bda7126bf646c5987baa224a011 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 22:33:23 +0800 Subject: [PATCH 718/800] PRF @geekpi --- ...le (Automation Tool) on CentOS 8-RHEL 8.md | 82 ++++++++----------- 1 file changed, 36 insertions(+), 46 deletions(-) diff --git a/translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md index 8cd9c01c5f..fbfcc3a245 100644 --- a/translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md +++ b/translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8) @@ -10,29 +10,26 @@ 如何在 CentOS 8/RHEL 8 上安装 Ansible(自动化工具) ====== -**Ansible** 是给 Linux 系统管理员使用的出色自动化工具。它是一种开源配置工具,能让系统管理员可以从一个中心节点(即 **Ansible 服务器**)管理数百台服务器。将 Ansible 与 **Puppet**、**Chef** 和 **Salt**等类似工具进行比较时,它是首选的配置工具,因为它不需要任何代理,并且可以工作在 SSH 和 python 上。 +Ansible 是给 Linux 系统管理员使用的出色自动化工具。它是一种开源配置工具,能让系统管理员可以从一个中心节点(即 Ansible 服务器)管理数百台服务器。将 Ansible 与 Puppet、Chef 和 Salt 等类似工具进行比较时,它是首选的配置工具,因为它不需要任何代理,并且可以工作在 SSH 和 python 上。 -[![Install-Ansible-CentOS8-RHEL8][1]][2] +![](https://img.linux.net.cn/data/attachment/album/201912/01/223012czkxt6dhku6snhxn.jpg) -在本教程中,我们将学习如何在 CentOS 8 和 RHEL 8 系统上安装和使用 Ansble +在本教程中,我们将学习如何在 CentOS 8 和 RHEL 8 系统上安装和使用 Ansble。 Ansible 实验环境信息: - * Minimal CentOS 8 / RHEL 8 服务器(192.168.1.10),且有互联网连接 - * 两个 Ansible 节点 - Ubuntu 18.04 LTS (192.168.1.20) 和 CentOS 7 (192.168.1.30) - - +* 最小化安装的 CentOS 8 / RHEL 8 服务器(192.168.1.10),且有互联网连接 +* 两个 Ansible 节点 - Ubuntu 18.04 LTS (192.168.1.20) 和 CentOS 7 (192.168.1.30) ### CentOS 8 上的 Ansible 安装步骤 - -Ansible 包不在 CentOS 8 默认的软件包仓库中。因此,我们需要执行以下命令启用 [EPEL 仓库][3], +Ansible 包不在 CentOS 8 默认的软件包仓库中。因此,我们需要执行以下命令启用 [EPEL 仓库][3]: ``` [root@linuxtechi ~]$ sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm -y ``` -启用 epel 仓库后,执行以下 dnf 命令安装 Ansble。 +启用 epel 仓库后,执行以下 `dnf` 命令安装 Ansible: ``` [root@linuxtechi ~]$ sudo dnf install ansible @@ -40,15 +37,15 @@ Ansible 包不在 CentOS 8 默认的软件包仓库中。因此,我们需要 上面命令的输出: -![dnf-install-ansible-centos8][1] +![dnf-install-ansible-centos8][4] -成功安装 ansible 后,运行以下命令验证它的版本。 +成功安装 Ansible 后,运行以下命令验证它的版本: ``` [root@linuxtechi ~]$ sudo ansible --version ``` -![Ansible-version-CentOS8][1] +![Ansible-version-CentOS8][5] 上面的输出确认在 CentOS 8 上安装完成。 @@ -56,19 +53,19 @@ Ansible 包不在 CentOS 8 默认的软件包仓库中。因此,我们需要 ### RHEL 8 上的 Ansible 安装步骤 -如果你有有效的 RHEL 8 订阅,请使用以下订阅管理器命令启用 Ansble 仓库, +如果你有有效的 RHEL 8 订阅,请使用以下订阅管理器命令启用 Ansble 仓库: ``` [root@linuxtechi ~]$ sudo subscription-manager repos --enable ansible-2.8-for-rhel-8-x86_64-rpms ``` -启用仓库后,执行以下 dnf 命令安装 Ansible, +启用仓库后,执行以下 `dnf` 命令安装 Ansible: ``` [root@linuxtechi ~]$ sudo dnf install ansible -y ``` -安装 ansible 及其依赖包后,执行以下命令来验证它的版本, +安装 Ansible 及其依赖包后,执行以下命令来验证它的版本: ``` [root@linuxtechi ~]$ sudo ansible --version @@ -76,13 +73,13 @@ Ansible 包不在 CentOS 8 默认的软件包仓库中。因此,我们需要 ### 在 CentOS 8 / RHEL 8 上通过 pip3 安装 Ansible 的可选方法 -如果你希望使用 **pip**(python 的包管理器)安装 Ansible,请首先使用以下命令安装 pyhton3 和 python3-pip 包, +如果你希望使用 `pip`(Python 的包管理器)安装 Ansible,请首先使用以下命令安装 pyhton3 和 python3-pip 包: ``` [root@linuxtechi ~]$ sudo dnf install python3 python3-pip -y ``` -安装 python3 后,运行以下命令来验证它的版本。 +安装 python3 后,运行以下命令来验证它的版本: ``` [root@linuxtechi ~]$ python3 -V @@ -90,23 +87,23 @@ Python 3.6.8 [root@linuxtechi ~]$ ``` -命令下面的 pip3 命令安装 Ansible, +用下面的 `pip3` 命令安装 Ansible: ``` [root@linuxtechi ~]$ pip3 install ansible --user ``` -输出, +输出: -![Ansible-Install-pip3-centos8][1] +![Ansible-Install-pip3-centos8][6] -上面的输出确认 Ansible 已成功使用 pip3 安装。让我们看下如何使用 Ansible。 +上面的输出确认 Ansible 已成功使用 `pip3` 安装。让我们看下如何使用 Ansible。 ### 如何使用 Ansible 自动化工具? -当我们使用 yum 或 dnf 命令安装 Ansible 时,它的配置文件、清单文件和角色目录会自动在 /etc/ansible 文件夹下创建。 +当我们使用 `yum` 或 `dnf` 命令安装 Ansible 时,它的配置文件、清单文件和角色目录会自动在 `/etc/ansible` 文件夹下创建。 -让我们添加一个名称为 “**labservers**” 的组,并在 **/etc/ansible/hosts** 文件中给该组添加 Ubuntu 18.04 和 CentOS 7 的系统 IP 地址。 +让我们添加一个名称为 `labservers` 的组,并在 `/etc/ansible/hosts` 文件中给该组添加上述的 Ubuntu 18.04 和 CentOS 7 系统的 IP 地址: ``` [root@linuxtechi ~]$ sudo vi /etc/ansible/hosts @@ -119,34 +116,34 @@ Python 3.6.8 保存并退出文件。 -更新清单文件(/etc/ansible/hosts)后,将用户的 ssh 公钥与作为 “labservers” 组一部分的远程系统交换。 +更新清单文件(`/etc/ansible/hosts`)后,将用户的 ssh 公钥放到属于 `labservers` 组的远程系统。 -让我们首先使用 ssh-keygen 命令生成本地用户的公钥和私钥, +让我们首先使用 `ssh-keygen` 命令生成本地用户的公钥和私钥: ``` [root@linuxtechi ~]$ ssh-keygen ``` -现在使用以下命令在 ansible 服务器及其客户端之间交换公钥, +现在使用以下命令在 Ansible 服务器及其客户端之间交换公钥: ``` [root@linuxtechi ~]$ ssh-copy-id root@linuxtechi [root@linuxtechi ~]$ ssh-copy-id root@linuxtechi ``` -现在,让我们尝试几个 Ansible 命令,首先使用 ping 模块验证 Ansible 服务器与客户端的连接, +现在,让我们尝试几个 Ansible 命令,首先使用 `ping` 模块验证 Ansible 服务器与客户端的连接: ``` [root@linuxtechi ~]$ ansible -m ping "labservers" ``` -**注意:** 如果我们没有在上面的命令中指定清单文件,那么它将引用默认主机文件(即 /etc/ansible/hosts) +注意: 如果我们没有在上面的命令中指定清单文件,那么它将引用默认主机文件(即 `/etc/ansible/hosts`)。 输出: -![ansible-ping-module-centos8][1] +![ansible-ping-module-centos8][7] -让我们使用 Ansible shell 命令检查每个客户端的内核版本, +让我们使用 Ansible shell 命令检查每个客户端的内核版本: ``` [root@linuxtechi ~]$ ansible -m command -a "uname -r" "labservers" @@ -157,7 +154,7 @@ Python 3.6.8 [root@linuxtechi ~]$ ``` -使用以下命令列出清单文件中的所有主机, +使用以下命令列出清单文件中的所有主机: ``` [root@linuxtechi ~]$ ansible all -i /etc/ansible/hosts --list-hosts @@ -169,7 +166,7 @@ Python 3.6.8 [root@linuxtechi ~]$ ``` -使用以下 ansible 命令仅列出 “labservers” 组中的主机。 +使用以下 Ansible 命令仅列出 `labservers` 组中的主机: ``` root@linuxtechi ~]$ ansible labservers -i /etc/ansible/hosts --list-hosts @@ -181,13 +178,6 @@ root@linuxtechi ~]$ ansible labservers -i /etc/ansible/hosts --list-hosts 本文就是这些了,我们成功演示了如何在 CentOS 8 和 RHEL 8 系统中安装和使用 Ansible。请分享你的反馈和意见。 - * [Facebook][4] - * [Twitter][5] - * [LinkedIn][6] - * [Reddit][7] - - - -------------------------------------------------------------------------------- via: https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/ @@ -195,7 +185,7 @@ via: https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/ 作者:[Pradeep Kumar][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/) 荣誉推出 @@ -204,7 +194,7 @@ via: https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/ [1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 [2]: http://www.linuxtechi.com/wp-content/uploads/2019/11/Install-Ansible-CentOS8-RHEL8.png [3]: http://www.linuxtechi.com/enable-epel-repo-centos8-rhel8-server/ -[4]: http://www.facebook.com/sharer.php?u=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-ansible-centos-8-rhel-8%2F&t=How%20to%20Install%20Ansible%20%28Automation%20Tool%29%20on%20CentOS%208%2FRHEL%208 -[5]: http://twitter.com/share?text=How%20to%20Install%20Ansible%20%28Automation%20Tool%29%20on%20CentOS%208%2FRHEL%208&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-ansible-centos-8-rhel-8%2F&via=Linuxtechi -[6]: http://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-ansible-centos-8-rhel-8%2F&title=How%20to%20Install%20Ansible%20%28Automation%20Tool%29%20on%20CentOS%208%2FRHEL%208 -[7]: http://www.reddit.com/submit?url=https%3A%2F%2Fwww.linuxtechi.com%2Finstall-ansible-centos-8-rhel-8%2F&title=How%20to%20Install%20Ansible%20%28Automation%20Tool%29%20on%20CentOS%208%2FRHEL%208 +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/11/dnf-install-ansible-centos8-1536x652.png +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Ansible-version-CentOS8.png +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/11/Ansible-Install-pip3-centos8-1536x545.png +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/11/ansible-ping-module-centos8.png From c9e331a0193ea8dc97ef37d025446e3f7266a0cd Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 22:33:47 +0800 Subject: [PATCH 719/800] PUB @geekpi https://linux.cn/article-11633-1.html --- ...to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md (98%) diff --git a/translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md b/published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md similarity index 98% rename from translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md rename to published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md index fbfcc3a245..9128c142b5 100644 --- a/translated/tech/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md +++ b/published/20191125 How to Install Ansible (Automation Tool) on CentOS 8-RHEL 8.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11633-1.html) [#]: subject: (How to Install Ansible (Automation Tool) on CentOS 8/RHEL 8) [#]: via: (https://www.linuxtechi.com/install-ansible-centos-8-rhel-8/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) From 2e76a83fd6202a62de890d96059bb0066ec6f935 Mon Sep 17 00:00:00 2001 From: WWWN Date: Sun, 1 Dec 2019 23:00:37 +0800 Subject: [PATCH 720/800] translated --- ...s for programming in multiple languages.md | 138 ----------------- ...s for programming in multiple languages.md | 139 ++++++++++++++++++ 2 files changed, 139 insertions(+), 138 deletions(-) delete mode 100644 sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md create mode 100644 translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md diff --git a/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md b/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md deleted file mode 100644 index 26a719c8fd..0000000000 --- a/sources/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md +++ /dev/null @@ -1,138 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hello-wn) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top 10 Vim plugins for programming in multiple languages) -[#]: via: (https://opensource.com/article/19/11/vim-plugins) -[#]: author: (Maxim Burgerhout https://opensource.com/users/wzzrd) - -Top 10 Vim plugins for programming in multiple languages -====== -Make your life as a programmer or sysadmin a little better with these 10 -plugins for Vim. -![OpenStack source code \(Python\) in VIM][1] - -I've been a user of the [Vim][2] text editor for about two decades. For a little while, I have been customizing my Vim configuration, only using plugins for the last couple of years. - -Recently, when I was redoing my setup (as I do every so often), I decided it was a good opportunity to identify the best Vim plugins for programming in multiple languages and a way to combine those plugins for each language I program in. - -I do use certain plugins for specific languages and profiles (e.g., I only install Rocannon in my Ansible profile), and I won't go into those here—that would be a _long_ list. But the 10 Vim plugins described below are my favorites, the ones I use in virtually every profile I have, no matter what programming language I'm using. - -### 1\. Volt - -My number one pick isn't even a plugin; rather, it replaces plugins like [Vundle][3], so I'm listing it here. - -[Volt][4] is a Vim plugin manager that lives outside Vim. You can use it to install plugins and create combinations of plugins called "profiles." You can enable a new profile with a single command: **volt profile set myprofile**. That way, I can do things like enable the [indentpython][5] plugin for just my Python profile. Volt also offers a simple way to do per-plugin configurations. The configuration is shared between profiles, so you can install plugins once and use them in multiple profiles. - -Volt is still relatively new and not perfect (e.g., you can have just one configuration file per plugin, no matter how many profiles you are using), but apart from that, I find it extremely handy, extremely fast, and extremely simple. - -![Volt plugin][6] - -### 2\. Vim-Rainbow - -Except for Python, virtually all major programming languages use brackets. Round ones, square ones, and curly ones. Often, they use multiple pairs of brackets, with one pair embedded in another. Figuring out which closing bracket belongs to what opening bracket can become difficult and annoying. I often find myself counting round brackets—especially in complicated Bash scripts—to make sure I got everything right. - -Here's the [vim-rainbow][7] plugin to the rescue! It gives every pair of brackets a unique color, so it's easy to identify which brackets belong to each other. It's very useful and very colorful, too. - -![vim-rainbow plugin][8] - -### 3\. lightline - -There are a lot of plugins for Vim, such as [Powerline][9], that put a bar at the bottom of the screen to show you what file you are working on, where you are in the file, what type of file it is, etc. Each of these plugins has advantages and disadvantages, and after briefly weighing them, I chose [lightline][10]. It's relatively small, easy to set up, quite extensible if you are into that kind of thing, and doesn't require any other tooling or plugins. - -![Lightline plugin][11] - -### 4\. NERDTree - -[NERDTree][12] is a classic. In large projects, it can be hard to find the exact name and location of the one file that includes the one line you need to edit. With a quick keystroke (**F7**, in my case, as I bound NERDTree to F7 in my .vimrc configuration file), an explorer window opens in a vertical split, and I can easily browse to the file I want and open it. It's a must for large bodies of code. Or for people that tend to forget filenames, like me. - -![NERDTree vim plugin][13] - -### 5\. NERD Commenter - -All programmers, at some time, write code that introduces a hard-to-debug problem that leads them to decide to comment out or undo the code. This is where [NERD Commenter][14] comes in. Select the code, hit **Leader+cc**, and your code is commented. (The standard Vim Leader key is the **/** character.) Hit **Leader+cn,** and your code is uncommented. NERD Commenter should automatically use the right commenting character for most file types. For example, if you are editing a [BIND zone file][15] and set the file type to bind zone, Vim will correctly use the **;** (semicolon) character to comment lines out. - -![NERD Commenter][16] - -### 6\. Solarized - -I love my Vim colors. Really, I love terminal colors in general. I've been using the [Solarized][17] color scheme for Vim for a long time, and I set up my terminal, dir_colors, and Vim to be consistent. - -Every now and then, though, I toggle between light and dark modes, depending on what kind of environment I'm in, the amount of light falling on my screen, and whether I need to put something on a big screen for others to read. - -Obviously, you can grab any ol' color scheme you like, but I like the fact that Solarized has light and dark modes, an easy way to switch between the two, and it's not too intrusive. My second choice is [Monokai][18]. The Volt plugin manager makes it easy for me to switch between the two, so I can use Monokai for Python programming and Solarized for Bash. - -I'm not including an image for Solarized, because all the other images in this article use Solarized light or dark, so check them out. - -### 7\. fzf - -When you're looking for a file, sometimes you want a file explorer, and sometimes you just want to ram something on your keyboard that vaguely resembles the filename you are looking for, amirite? - -The [fzf][19] (or "fuzzy finder") plugin gives you just that. Hit **:FZF** and start typing. An ever-shortening list will show you files that more or less match what you are looking for. I use this a lot, probably even more than NERDTree these days. A slight downside is that this plugin has an external dependency in the fzf binary, so you'll have to install that, too. It's available for Fedora, Debian and, Arch, but I don't think it exists for EPEL. - -![fzf Vim plugin][20] - -### 8\. ack - -Every once in a while, you want to search for a file that contains a certain line or a certain word. I really like the [ack][21] plugin for this, preferably in combination with **ag**, a command known as "the [silver searcher][22]." This combination is phenomenally fast and covers the vast majority of things I would use **grep** or **vimgrep** for. The downside is you'll need to install either ack or ag for it to work. The good news is that both ag and ack are available for Fedora and EPEL7. - -![ack vim plugin][23] - -### 9\. gitgutter - -The majority of IT folks have worked with [Git][24] and files in Git repositories. The [gitgutter][25] plugin adds a column near your line numbers that shows symbols for changed (**~**), added (**+**), and removed (**-**) lines. This is quite useful for keeping track of what you have changed, and it keeps you focused on the task at hand, like writing a patch to fix one key bug. This plugin has a slight performance gap, and it sometimes takes a quick second for the plugin to catch up with your changes, but it's still quite useful. - -![gitgutter vim plugin][26] - -### 10\. Tag List - -If you are programming in a file of any significant size, it's easy to lose track of where you are, and you might find yourself scrolling up and down looking for a certain function. With the [Tag List][27] plugin, you can just type **:Tlist** and get a vertical split with variables, types, classes, and functions that you can easily jump to. This works for a host of languages, like Java, Python, and any other file type the **ctags** utility works with … which is a lot. - -![Tag List vim plugin][28] - -So there you are: the 10 plugins for Vim that have made my life as a sysadmin and part-time programmer a little easier and a little better. What Vim plugins you are using? Please share your favorites in the comments. - -Vim offers great benefits to writers, regardless of whether they are technically minded or not. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/vim-plugins - -作者:[Maxim Burgerhout][a] -选题:[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/wzzrd -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm (OpenStack source code (Python) in VIM) -[2]: https://www.vim.org/ -[3]: https://github.com/VundleVim/Vundle.vim -[4]: https://github.com/vim-volt/volt -[5]: https://github.com/vim-scripts/indentpython.vim -[6]: https://opensource.com/sites/default/files/uploads/vim-volt.gif (Volt plugin) -[7]: http://github.com/frazrepo/vim-rainbow -[8]: https://opensource.com/sites/default/files/uploads/vim-rainbox.png (vim-rainbow plugin) -[9]: https://github.com/powerline/powerline -[10]: http://github.com/itchyny/lightline.vim -[11]: https://opensource.com/sites/default/files/uploads/lightline.png (Lightline plugin) -[12]: http://github.com/scrooloose/nerdtree -[13]: https://opensource.com/sites/default/files/uploads/nerdtree.gif (NERDTree vim plugin) -[14]: http://github.com/scrooloose/nerdcommenter -[15]: https://en.wikipedia.org/wiki/Zone_file#File_format -[16]: https://opensource.com/sites/default/files/uploads/nerdcommenter.gif (NERD Commenter) -[17]: https://github.com/altercation/vim-colors-solarized -[18]: https://github.com/sickill/vim-monokai -[19]: https://github.com/junegunn/fzf.vim -[20]: https://opensource.com/sites/default/files/uploads/fzf.gif (fzf Vim plugin) -[21]: https://github.com/mileszs/ack.vim -[22]: https://github.com/ggreer/the_silver_searcher -[23]: https://opensource.com/sites/default/files/uploads/ack.gif (ack vim plugin) -[24]: https://opensource.com/resources/what-is-git -[25]: https://github.com/airblade/vim-gitgutter -[26]: https://opensource.com/sites/default/files/uploads/gitgutter.png (gitgutter vim plugin) -[27]: https://github.com/vim-scripts/taglist.vim -[28]: https://opensource.com/sites/default/files/uploads/taglist.gif (Tag List vim plugin) diff --git a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md b/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md new file mode 100644 index 0000000000..9c2b7e083b --- /dev/null +++ b/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md @@ -0,0 +1,139 @@ +[#]: collector: "lujun9972" +[#]: translator: "hello-wn" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Top 10 Vim plugins for programming in multiple languages" +[#]: via: "https://opensource.com/article/19/11/vim-plugins" +[#]: author: "Maxim Burgerhout https://opensource.com/users/wzzrd" + +多语言编程必备的十大Vim插件 +====== +使用这 10 个 Vim 插件,可以让你在写代码或运维时,感觉更棒。 + +![OpenStack source code \(Python\) in VIM][1] + +我使用 [Vim][2] 文本编辑器大约20年了。有一段时间,我一直在定制我的Vim配置,但在过去几年我会使用插件。 + +最近,当我重新安装 Vim 时(就像我经常做的那样),我决定把这次安装作为一次尝试,找到多种编程语言环境下的最佳 Vim 插件,以及如何将这些插件和每种语言结合起来。 + +有时,我会为特定的语言和配置使用特定的插件(例如,我只在 Ansible 配置中安装 Rocannon ),在此不细讲了。但是下面介绍的 10 个 Vim 插件是我的最爱,无论使用哪种编程语言,我几乎都会使用它们。 + +### 1\. Volt + +我的首选并不是一个插件, 但是它可以替换类似于 [Vundle][3] 的插件,所以在此介绍。 + +[Volt][4] 是一个不依存于 Vim 的 Vim 插件管理器。 你可以用它安装插件,通过 `profiles` 组合使用不同的插件。你可以使用一个简单的命令 ```volt profile set myprofile``` 使得新 `profiles` 生效。 这样可以 因制宜地使用插件,比如,我在 Python 配置中单独使用 [indentpython][5] 插件。 Volt 还可以更方便地配置每个插件,这些配置会在 `profiles` 之间共享,因此只需要安装一次插件,就可以在多个 `profiles` 之间使用。 + +Volt 还是相对较新且不完美的(比如,无论使用多少 `profiles` ,每个插件只能有一个配置文件),但除此之外,我发现它非常方便、快速和简单。 + +![Volt plugin][6] + +### 2\. Vim-Rainbow + +除了 Python,几乎所有的主流编程语言都使用括号( 小括号,方括号和大括号)。 通常,它们会嵌套使用多对括号,因此很难搞清楚某个括号的开闭区间。我发现自己经常要数小括号,尤其是在复杂的 Bash 脚本中,以确保无误。 + +这时候就需要 [vim-rainbow][7] 插件! 它为每对括号设置不同的颜色,因此很容易识别出哪些括号是一对括号。 它非常有用而且五彩斑斓。 + +![vim-rainbow plugin][8] + +### 3\. lightline + +Vim 有很多插件,例如 [Powerline][9] ,它会在底部栏显示你正在处理的文件,光标所在的文件位置以及文件类型等信息。 这些插件各有利弊,在简单比较后,我选择了 [lightline][10]。 它相对较小,便于安装和扩展,并且不依赖于其他工具或插件。 + +![Lightline plugin][11] + +### 4\. NERDTree + +[NERDTree][12] 是一个很经典的插件。在大型项目中,你可能很难找到想要编辑的内容所在文件的确切名称和路径。使用快捷键(我使用的是 **F7** ,因为我在 `.vimrc` 中配置了这个快捷键),搜索窗会以垂直分屏的方式打开,就可以轻松找到所需文件并打开它。 对于大型项目,这是必备插件。 对于那些经常忘记文件名的人也很有用,比如我。 + +![NERDTree vim plugin][13] + +### 5\. NERD Commenter + +程序员们在写代码时,有时会遇到一些难以调试的问题,导致他们想要注释或不执行某段代码。 这时候就需要 [NERD Commenter][14] 出场了。选择代码段,按 **Leader键 + cc**,代码就会被注释掉。 (标准的 Vim Leader 键 是 **/** 字符。)按 **Leader键 + cn**,取消注释。 对于大多数文件类型,NERD Commenter 会自动使用正确的注释符。 例如,如果你正在编辑 [BIND区域文件][15],并将文件类型设置为绑定区域,Vim 会正确地使用 **;** (分号)字符进行注释。 + +![NERD Commenter][16] + +### 6\. Solarized + +我喜欢我的 Vim 主题配色。我也喜欢终端的主题色。我一直在 Vim 上使用 [Solarized][17] 配色,并且将我的终端、文件夹配色和 Vim 设为一致。 + +但是,有时我会根据周边环境,屏幕亮度以及是否需要分享投屏,切换明暗模式。 + +显然,你可以选择自己喜欢的任何配色方案,但我喜欢 `Solarized`,因为它有明暗模式功能,他可以简单快捷地切换两种模式。我的第二个选择是 [Monokai][18]。 Volt 插件管理器让我可以轻松地在两者之间切换,因此我在Python编程时,使用 Monokai ;Bash 编程时,使用 Solarized。 + +我没有给 Solarized 找相应的图片,因为本文中的所有其他图片都使用了 Solarized 中的浅色或深色效果,可以确认一下这些图片。 + +### 7\. fzf + +当寻找一个文件时,有时你想要一个文件浏览器,有时你只想在键盘上敲打出与文件名类似的内容,对吗? + +[fzf][19](全称 “模糊查找器”)插件提供了这一功能。打出 **:FZF** 并输入文件名内容。 不断缩短的列表将显示出与你输入的文件名内容相匹配的一些文件。我经常使用它,最近使用它的频率估计比使用 NERDTree 还多。缺点是这个插件依赖于 `fzf binary` ,因此也必须安装这个依赖包。它适用于 Fedora,Debian 和 Arch,据我所知并不适用于 EPEL。 + +![fzf Vim plugin][20] + +### 8\. ack + +有时,你需要搜索包含特定行或特定单词的文件。我真的很喜欢使用 [ack][21] 插件,最好与 **ag** 结合使用,他俩的组合又被称为 “[silver searcher][22]”。 这一组合的速度非常快,覆盖了 **grep** 或 **vimgrep** 的绝大多数使用场景。 缺点是您需要安装 ack 或 ag 才能正常运行。 好消息是 Fedora 和 EPEL7 都可以使用 ag 和 ack 。 + +![ack vim plugin][23] + +### 9\. gitgutter +大多数 IT 人员都使用 [Git][24] 和 Git 仓库中的文件进行工作。[gitgutter][25] 插件在行号附近添加了一列,通过符号显示该行的状态为,已更改(**~**),已添加(**+**)或者已删除(**-**)。这有利于跟踪你所做的更改,并且可以使你专注于手头的任务,例如编写补丁来修复一个关键 bug。 + +![gitgutter vim plugin][26] + +### 10\. Tag List + +如果你在一个很大的文件中编写代码,会很容易忘记当前所在的位置,你可能需要上下滚动来查找某个功能。使用 [Tag List][27] 插件,只需要输入 **:Tlist** ,就能垂直分屏显示出 包含变量、类型、类和函数的代码,你可以轻松跳转到这些变量、类型、类和函数。这个功能对于多语言同样适用,例如 Java 、Python 以及任何能够使用 **ctags** 功能的文件类型。 + +![Tag List vim插件] [28] + + +以上介绍的 10 个 Vim 插件使我作为系统管理员和兼职程序员的生活变得更轻松。你正在使用哪些Vim插件?请在评论中分享你最爱的插件。 + +Vim 为写作者提供了很多便利,无论他们是否了解技术。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/vim-plugins + +作者:[Maxim Burgerhout][a] +选题:[lujun9972][b] +译者:[hello-wn][c] +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/wzzrd +[b]: https://github.com/lujun9972 +[c]: https://github.com/hello-wn +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm "OpenStack source code (Python) in VIM" +[2]: https://www.vim.org/ +[3]: https://github.com/VundleVim/Vundle.vim +[4]: https://github.com/vim-volt/volt +[5]: https://github.com/vim-scripts/indentpython.vim +[6]: https://opensource.com/sites/default/files/uploads/vim-volt.gif "Volt plugin" +[7]: http://github.com/frazrepo/vim-rainbow +[8]: https://opensource.com/sites/default/files/uploads/vim-rainbox.png "vim-rainbow plugin" +[9]: https://github.com/powerline/powerline +[10]: http://github.com/itchyny/lightline.vim +[11]: https://opensource.com/sites/default/files/uploads/lightline.png "Lightline plugin" +[12]: http://github.com/scrooloose/nerdtree +[13]: https://opensource.com/sites/default/files/uploads/nerdtree.gif "NERDTree vim plugin" +[14]: http://github.com/scrooloose/nerdcommenter +[15]: https://en.wikipedia.org/wiki/Zone_file#File_format +[16]: https://opensource.com/sites/default/files/uploads/nerdcommenter.gif "NERD Commenter" +[17]: https://github.com/altercation/vim-colors-solarized +[18]: https://github.com/sickill/vim-monokai +[19]: https://github.com/junegunn/fzf.vim +[20]: https://opensource.com/sites/default/files/uploads/fzf.gif "fzf Vim plugin" +[21]: https://github.com/mileszs/ack.vim +[22]: https://github.com/ggreer/the_silver_searcher +[23]: https://opensource.com/sites/default/files/uploads/ack.gif "ack vim plugin" +[24]: https://opensource.com/resources/what-is-git +[25]: https://github.com/airblade/vim-gitgutter +[26]: https://opensource.com/sites/default/files/uploads/gitgutter.png "gitgutter vim plugin" +[27]: https://github.com/vim-scripts/taglist.vim +[28]: https://opensource.com/sites/default/files/uploads/taglist.gif "Tag List vim plugin) ) ) " From 57b1482d89ee6ac982532b66011ee9b55277c73f Mon Sep 17 00:00:00 2001 From: WWWN Date: Sun, 1 Dec 2019 23:03:45 +0800 Subject: [PATCH 721/800] remove space --- ... Top 10 Vim plugins for programming in multiple languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md b/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md index 9c2b7e083b..4489b6c4ce 100644 --- a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md +++ b/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md @@ -88,7 +88,7 @@ Vim 有很多插件,例如 [Powerline][9] ,它会在底部栏显示你正在 如果你在一个很大的文件中编写代码,会很容易忘记当前所在的位置,你可能需要上下滚动来查找某个功能。使用 [Tag List][27] 插件,只需要输入 **:Tlist** ,就能垂直分屏显示出 包含变量、类型、类和函数的代码,你可以轻松跳转到这些变量、类型、类和函数。这个功能对于多语言同样适用,例如 Java 、Python 以及任何能够使用 **ctags** 功能的文件类型。 -![Tag List vim插件] [28] +![Tag List vim plugin][28] 以上介绍的 10 个 Vim 插件使我作为系统管理员和兼职程序员的生活变得更轻松。你正在使用哪些Vim插件?请在评论中分享你最爱的插件。 From 7ee36f1bb4ba4c5a2204e806b41c78a6f5297e34 Mon Sep 17 00:00:00 2001 From: WWWN Date: Sun, 1 Dec 2019 23:04:48 +0800 Subject: [PATCH 722/800] remove chinese char --- ... Top 10 Vim plugins for programming in multiple languages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md b/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md index 4489b6c4ce..6375a1b126 100644 --- a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md +++ b/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md @@ -88,7 +88,7 @@ Vim 有很多插件,例如 [Powerline][9] ,它会在底部栏显示你正在 如果你在一个很大的文件中编写代码,会很容易忘记当前所在的位置,你可能需要上下滚动来查找某个功能。使用 [Tag List][27] 插件,只需要输入 **:Tlist** ,就能垂直分屏显示出 包含变量、类型、类和函数的代码,你可以轻松跳转到这些变量、类型、类和函数。这个功能对于多语言同样适用,例如 Java 、Python 以及任何能够使用 **ctags** 功能的文件类型。 -![Tag List vim plugin][28] +![Tag List vim plugin][28] 以上介绍的 10 个 Vim 插件使我作为系统管理员和兼职程序员的生活变得更轻松。你正在使用哪些Vim插件?请在评论中分享你最爱的插件。 From 7ef6324bd4761073b943e09bcb979aeb74c3962c Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Sun, 1 Dec 2019 23:11:36 +0800 Subject: [PATCH 723/800] APL --- sources/tech/20190927 5 tips for GNU Debugger.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190927 5 tips for GNU Debugger.md b/sources/tech/20190927 5 tips for GNU Debugger.md index faedf4240d..04fd89291c 100644 --- a/sources/tech/20190927 5 tips for GNU Debugger.md +++ b/sources/tech/20190927 5 tips for GNU Debugger.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 11b3f796ede2c153de20f4959e7077d86f5d327f Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Dec 2019 00:20:12 +0800 Subject: [PATCH 724/800] TSL --- .../tech/20190927 5 tips for GNU Debugger.md | 230 ------------------ .../tech/20190927 5 tips for GNU Debugger.md | 220 +++++++++++++++++ 2 files changed, 220 insertions(+), 230 deletions(-) delete mode 100644 sources/tech/20190927 5 tips for GNU Debugger.md create mode 100644 translated/tech/20190927 5 tips for GNU Debugger.md diff --git a/sources/tech/20190927 5 tips for GNU Debugger.md b/sources/tech/20190927 5 tips for GNU Debugger.md deleted file mode 100644 index 04fd89291c..0000000000 --- a/sources/tech/20190927 5 tips for GNU Debugger.md +++ /dev/null @@ -1,230 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 tips for GNU Debugger) -[#]: via: (https://opensource.com/article/19/9/tips-gnu-debugger) -[#]: author: (Tim Waugh https://opensource.com/users/twaugh) - -5 tips for GNU Debugger -====== -Learn how to use some of the lesser-known features of gdb to inspect and -fix your code. -![Bug tracking magnifying glass on computer screen][1] - -The [GNU Debugger][2] (gdb) is an invaluable tool for inspecting running processes and fixing problems while you're developing programs. - -You can set breakpoints at specific locations (by function name, line number, and so on), enable and disable those breakpoints, display and alter variable values, and do all the standard things you would expect any debugger to do. But it has many other features you might not have experimented with. Here are five for you to try. - -### Conditional breakpoints - -Setting a breakpoint is one of the first things you'll learn to do with the GNU Debugger. The program stops when it reaches a breakpoint, and you can run gdb commands to inspect it or change variables before allowing the program to continue. - -For example, you might know that an often-called function crashes sometimes, but only when it gets a certain parameter value. You could set a breakpoint at the start of that function and run the program. The function parameters are shown each time it hits the breakpoint, and if the parameter value that triggers the crash is not supplied, you can continue until the function is called again. When the troublesome parameter triggers a crash, you can step through the code to see what's wrong. - - -``` -(gdb) break sometimes_crashes -Breakpoint 1 at 0x40110e: file prog.c, line 5. -(gdb) run -[...] -Breakpoint 1, sometimes_crashes (f=0x7fffffffd1bc) at prog.c:5 -5      fprintf(stderr, -(gdb) continue -Breakpoint 1, sometimes_crashes (f=0x7fffffffd1bc) at prog.c:5 -5      fprintf(stderr, -(gdb) continue -``` - -To make this more repeatable, you could count how many times the function is called before the specific call you are interested in, and set a counter on that breakpoint (for example, "continue 30" to make it ignore the next 29 times it reaches the breakpoint). - -But where breakpoints get really powerful is in their ability to evaluate expressions at runtime, which allows you to automate this kind of testing. Enter: conditional breakpoints. - - -``` -break [LOCATION] if CONDITION - -(gdb) break sometimes_crashes if !f -Breakpoint 1 at 0x401132: file prog.c, line 5. -(gdb) run -[...] -Breakpoint 1, sometimes_crashes (f=0x0) at prog.c:5 -5      fprintf(stderr, -(gdb) -``` - -Instead of having gdb ask what to do every time the function is called, a conditional breakpoint allows you to make gdb stop at that location only when a particular expression evaluates as true. If the execution reaches the conditional breakpoint location, but the expression evaluates as false, the - -debugger automatically lets the program continue without asking the user what to do. - -### Breakpoint commands - -An even more sophisticated feature of breakpoints in the GNU Debugger is the ability to script a response to reaching a breakpoint. Breakpoint commands allow you to write a list of GNU Debugger commands to run whenever it reaches a breakpoint. - -We can use this to work around the bug we already know about in the **sometimes_crashes** function and make it return from that function harmlessly when it provides a null pointer. - -We can use **silent** as the first line to get more control over the output. Without this, the stack frame will be displayed each time the breakpoint is hit, even before our breakpoint commands run. - - -``` -(gdb) break sometimes_crashes -Breakpoint 1 at 0x401132: file prog.c, line 5. -(gdb) commands 1 -Type commands for breakpoint(s) 1, one per line. -End with a line saying just "end". ->silent ->if !f - >frame - >printf "Skipping call\n" - >return 0 - >continue - >end ->printf "Continuing\n" ->continue ->end -(gdb) run -Starting program: /home/twaugh/Documents/GDB/prog -warning: Loadable section ".note.gnu.property" outside of ELF segments -Continuing -Continuing -Continuing -#0  sometimes_crashes (f=0x0) at prog.c:5 -5      fprintf(stderr, -Skipping call -[Inferior 1 (process 9373) exited normally] -(gdb) -``` - -### Dump binary memory - -GNU Debugger has built-in support for examining memory using the **x** command in various formats, including octal, hexadecimal, and so on. But I like to see two formats side by side: hexadecimal bytes on the left, and ASCII characters represented by those same bytes on the right. - -When I want to view the contents of a file byte-by-byte, I often use **hexdump -C** (hexdump comes from the [util-linux][3] package). Here is gdb's **x** command displaying hexadecimal bytes: - - -``` -(gdb) x/33xb mydata -0x404040 <mydata>:    0x02    0x01    0x00    0x02    0x00    0x00    0x00    0x01 -0x404048 <mydata+8>:    0x01    0x47    0x00    0x12    0x61    0x74    0x74    0x72 -0x404050 <mydata+16>:    0x69    0x62    0x75    0x74    0x65    0x73    0x2d    0x63 -0x404058 <mydata+24>:    0x68    0x61    0x72    0x73    0x65    0x75    0x00    0x05 -0x404060 <mydata+32>:    0x00 -``` - -What if you could teach gdb to display memory just like hexdump does? You can, and in fact, you can use this method for any format you prefer. - -By combining the **dump** command to store the bytes in a file, the **shell** command to run hexdump on the file, and the **define** command, we can make our own new **hexdump** command to use hexdump to display the contents of memory. - - -``` -(gdb) define hexdump -Type commands for definition of "hexdump". -End with a line saying just "end". ->dump binary memory /tmp/dump.bin $arg0 $arg0+$arg1 ->shell hexdump -C /tmp/dump.bin ->end -``` - -Those commands can even go in the **~/.gdbinit** file to define the hexdump command permanently. Here it is in action: - - -``` -(gdb) hexdump mydata sizeof(mydata) -00000000  02 01 00 02 00 00 00 01  01 47 00 12 61 74 74 72  |.........G..attr| -00000010  69 62 75 74 65 73 2d 63  68 61 72 73 65 75 00 05  |ibutes-charseu..| -00000020  00                                                |.| -00000021 -``` - -### Inline disassembly - -Sometimes you want to understand more about what happened leading up to a crash, and the source code is not enough. You want to see what's going on at the CPU instruction level. - -The **disassemble** command lets you see the CPU instructions that implement a function. But sometimes the output can be hard to follow. Usually, I want to see what instructions correspond to a certain section of source code in the function. To achieve this, use the **/s** modifier to include source code lines with the disassembly. - - -``` -(gdb) disassemble/s main -Dump of assembler code for function main: -prog.c: -11    { -   0x0000000000401158 <+0>:    push   %rbp -   0x0000000000401159 <+1>:    mov      %rsp,%rbp -   0x000000000040115c <+4>:    sub      $0x10,%rsp - -12      int n = 0; -   0x0000000000401160 <+8>:    movl   $0x0,-0x4(%rbp) - -13      sometimes_crashes(&n); -   0x0000000000401167 <+15>:    lea     -0x4(%rbp),%rax -   0x000000000040116b <+19>:    mov     %rax,%rdi -   0x000000000040116e <+22>:    callq  0x401126 <sometimes_crashes> -[...snipped...] -``` - -This, along with **info registers** to see the current values of all the CPU registers and commands like **stepi** to step one instruction at a time, allow you to have a much more detailed understanding of the program. - -### Reverse debug - -Sometimes you wish you could turn back time. Imagine you've hit a watchpoint on a variable. A watchpoint is like a breakpoint, but instead of being set at a location in the program, it is set on an expression (using the **watch** command). Whenever the value of the expression changes, execution stops, and the debugger takes control. - -So imagine you've hit this watchpoint, and the memory used by a variable has changed value. This can turn out to be caused by something that occurred much earlier; for example, the memory was freed and is now being re-used. But when and why was it freed? - -The GNU Debugger can solve even this problem because you can run your program in reverse! - -It achieves this by carefully recording the state of the program at each step so that it can restore previously recorded states, giving the illusion of time flowing backward. - -To enable this state recording, use the **target record-full** command. Then you can use impossible-sounding commands, such as: - - * **reverse-step**, which rewinds to the previous source line - * **reverse-next**, which rewinds to the previous source line, stepping backward over function calls - * **reverse-finish**, which rewinds to the point when the current function was about to be called - * **reverse-continue**, which rewinds to the previous state in the program that would (now) trigger a breakpoint (or anything else that causes it to stop) - - - -Here is an example of reverse debugging in action: - - -``` -(gdb) b main -Breakpoint 1 at 0x401160: file prog.c, line 12. -(gdb) r -Starting program: /home/twaugh/Documents/GDB/prog -[...] - -Breakpoint 1, main () at prog.c:12 -12      int n = 0; -(gdb) target record-full -(gdb) c -Continuing. - -Program received signal SIGSEGV, Segmentation fault. -0x0000000000401154 in sometimes_crashes (f=0x0) at prog.c:7 -7      return *f; -(gdb) reverse-finish -Run back to call of #0  0x0000000000401154 in sometimes_crashes (f=0x0) -        at prog.c:7 -0x0000000000401190 in main () at prog.c:16 -16      sometimes_crashes(0); -``` - -These are just a handful of useful things the GNU Debugger can do. There are many more to discover. Which hidden, little-known, or just plain amazing feature of gdb is your favorite? Please share it in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/9/tips-gnu-debugger - -作者:[Tim Waugh][a] -选题:[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/twaugh -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y (Bug tracking magnifying glass on computer screen) -[2]: https://www.gnu.org/software/gdb/ -[3]: https://en.wikipedia.org/wiki/Util-linux diff --git a/translated/tech/20190927 5 tips for GNU Debugger.md b/translated/tech/20190927 5 tips for GNU Debugger.md new file mode 100644 index 0000000000..8c3b2be12c --- /dev/null +++ b/translated/tech/20190927 5 tips for GNU Debugger.md @@ -0,0 +1,220 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 tips for GNU Debugger) +[#]: via: (https://opensource.com/article/19/9/tips-gnu-debugger) +[#]: author: (Tim Waugh https://opensource.com/users/twaugh) + +5 个鲜为人知 GNU 调试器(GDB)技巧 +====== + +> 了解如何使用 gdb 的一些鲜为人知的功能来检查和修复代码。 + +![Bug tracking magnifying glass on computer screen][1] + +[GNU 调试器][2](`gdb`)是一种宝贵的工具,可用于在开发程序时检查正在运行的进程并解决问题。 + +你可以在特定位置(按函数名称、行号等)设置断点、启用和禁用这些断点、显示和更改变量值,并执行所有调试器希望执行的所有标准操作。但是它还有许多其它你可能没有尝试过的功能。这里有五个你可以尝试一下。 + +### 条件断点 + +设置断点是学习使用 GNU 调试器的第一步。程序在达到断点时停止,你可以运行 `gdb` 的命令对其进行检查或更改变量,然后再允许该程序继续运行。 + +例如,你可能知道一个经常调用的函数有时会崩溃,但仅当它获得某个参数值时才会崩溃。你可以在该函数的开始处设置一个断点并运行程序。每次碰到该断点时都会显示函数参数,并且如果未提供触发崩溃的参数值,则可以继续操作,直到再次调用该函数为止。当这个惹了麻烦的参数触发崩溃时,你可以单步执行代码以查看问题所在。 + + +``` +(gdb) break sometimes_crashes +Breakpoint 1 at 0x40110e: file prog.c, line 5. +(gdb) run +[...] +Breakpoint 1, sometimes_crashes (f=0x7fffffffd1bc) at prog.c:5 +5 fprintf(stderr, +(gdb) continue +Breakpoint 1, sometimes_crashes (f=0x7fffffffd1bc) at prog.c:5 +5 fprintf(stderr, +(gdb) continue +``` + +为了使此方法更具可重复性,你可以在你感兴趣的特定调用之前计算该函数被调用的次数,并在该断点处设置一个计数器(例如,`continue 30` 以使其在接下来的 29 次到达该断点时忽略它)。 + +但是断点真正强大的地方在于它们在运行时评估表达式的能力,这使你可以自动化这种测试。 + +``` +break [LOCATION] if CONDITION + +(gdb) break sometimes_crashes if !f +Breakpoint 1 at 0x401132: file prog.c, line 5. +(gdb) run +[...] +Breakpoint 1, sometimes_crashes (f=0x0) at prog.c:5 +5 fprintf(stderr, +(gdb) +``` + +条件断点使你不必让 `gdb` 每次调用该函数时都去问你要做什么,而是让条件断点仅在特定表达式的值为 `true` 时才使 `gdb` 停止在该位置。如果执行到达条件断点的位置,但表达式的计算结果为 `false` ,调试器会自动使程序继续运行,而无需询问用户该怎么做。 + +### 断点命令 + +GNU 调试器中断点的一个甚至更复杂的功能是能够编写对到达断点的响应的脚本。断点命令使你可以编写一系列 GNU 调试器命令,以在到达该断点时运行。 + +我们可以使用它来规避在 `sometimes_crashes` 函数中我们已知的错误,并在它提供空指针时使其无害地从该函数返回。 + +我们可以使用 `silent` 作为第一行,以更好地控制输出。否则,每次命中断点时,即使在运行断点命令之前,也会显示堆栈帧。 + +``` +(gdb) break sometimes_crashes +Breakpoint 1 at 0x401132: file prog.c, line 5. +(gdb) commands 1 +Type commands for breakpoint(s) 1, one per line. +End with a line saying just "end". +>silent +>if !f + >frame + >printf "Skipping call\n" + >return 0 + >continue + >end +>printf "Continuing\n" +>continue +>end +(gdb) run +Starting program: /home/twaugh/Documents/GDB/prog +warning: Loadable section ".note.gnu.property" outside of ELF segments +Continuing +Continuing +Continuing +#0 sometimes_crashes (f=0x0) at prog.c:5 +5 fprintf(stderr, +Skipping call +[Inferior 1 (process 9373) exited normally] +(gdb) +``` + +### 转储二进制内存 + +GNU 调试器内置支持使用 `x` 命令以各种格式检查内存,包括八进制、十六进制等。但是我喜欢并排看到两种格式:左侧为十六进制字节,右侧为相同字节表示的 ASCII 字符。 + +当我想逐字节查看文件的内容时,经常使用 `hexdump -C`(`hexdump` 来自 [util-linux][3] 软件包)。这是 `gdb` 的 `x` 命令显示的十六进制字节: + +``` +(gdb) x/33xb mydata +0x404040 : 0x02 0x01 0x00 0x02 0x00 0x00 0x00 0x01 +0x404048 : 0x01 0x47 0x00 0x12 0x61 0x74 0x74 0x72 +0x404050 : 0x69 0x62 0x75 0x74 0x65 0x73 0x2d 0x63 +0x404058 : 0x68 0x61 0x72 0x73 0x65 0x75 0x00 0x05 +0x404060 : 0x00 +``` + +如果你想让 `gdb` 像 `hexdump` 一样显示内存怎么办?这是可以的, 实际上,你可以将这种方法用于你喜欢的任何格式。 + +通过使用 `dump` 命令以将字节存储在文件中,结合 `shell` 命令以在文件上运行 `hexdump` 以及`define` 命令,我们可以创建自己的新的 `hexdump` 命令来使用 `hexdump` 显示内存内容。 + +``` +(gdb) define hexdump +Type commands for definition of "hexdump". +End with a line saying just "end". +>dump binary memory /tmp/dump.bin $arg0 $arg0+$arg1 +>shell hexdump -C /tmp/dump.bin +>end +``` + +这些命令甚至可以放在 `~/.gdbinit` 文件中,以永久定义 `hexdump` 命令。以下是它运行的例子: + +``` +(gdb) hexdump mydata sizeof(mydata) +00000000 02 01 00 02 00 00 00 01 01 47 00 12 61 74 74 72 |.........G..attr| +00000010 69 62 75 74 65 73 2d 63 68 61 72 73 65 75 00 05 |ibutes-charseu..| +00000020 00 |.| +00000021 +``` + +### 行内反汇编 + +有时你想更多地了解导致崩溃的原因,而源代码还不够。你想查看在 CPU 指令级别发生了什么。 + +`disassemble` 命令可让你查看实现函数的 CPU 指令。但是有时输出可能很难跟踪。通常,我想查看与该函数源代码的特定部分相对应的指令。为此,请使用 `/s` 修饰符在反汇编中包括源代码行。 + +``` +(gdb) disassemble/s main +Dump of assembler code for function main: +prog.c: +11 { + 0x0000000000401158 <+0>: push %rbp + 0x0000000000401159 <+1>: mov %rsp,%rbp + 0x000000000040115c <+4>: sub $0x10,%rsp + +12 int n = 0; + 0x0000000000401160 <+8>: movl $0x0,-0x4(%rbp) + +13 sometimes_crashes(&n); + 0x0000000000401167 <+15>: lea -0x4(%rbp),%rax + 0x000000000040116b <+19>: mov %rax,%rdi + 0x000000000040116e <+22>: callq 0x401126 +[...snipped...] +``` + +这里,用 `info` 寄存器查看所有 CPU 寄存器的当前值,以及用如 `stepi` 这样命令一次执行一条指令,可以使你对程序有了更详细的了解。 + +### 反向调试 + +有时,你希望自己可以逆转时间。想象一下,你已经达到了变量的监视点。监视点像是一个断点,但不是在程序中的某个位置设置,而是在表达式上设置(使用 `watch` 命令)。每当表达式的值更改时,执行就会停止,并且调试器将获得控制权。 + +想象一下你已经达到了这个监视点,并且由该变量使用的内存已更改了值。事实证明,这可能是由更早发生的事情引起的。例如,内存已释放,现在正在重新使用。但是是何时何地被释放的呢? + +GNU 调试器甚至可以解决此问题,因为你可以反向运行程序! + +它通过在每个步骤中仔细记录程序的状态来实现此目的,以便可以恢复以前记录的状态,从而产生时间倒流的错觉。 + +要启用此状态记录,请使用 `target record-full` 命令。然后,你可以使用一些听起来不太可行的命令,例如: + +* `reverse-step`,倒退到上一个源代码行 +* `*reverse-next`,它倒退到上一个源代码行,向后跳过函数调用 +* `reverse-finish`,倒退到当前函数即将被调用的时刻 +* `reverse-continue`,它返回到程序中的先前状态,该状态将(现在)触发断点(或其他导致断点停止的状态) + +这是运行中的反向调试的示例: + +``` +(gdb) b main +Breakpoint 1 at 0x401160: file prog.c, line 12. +(gdb) r +Starting program: /home/twaugh/Documents/GDB/prog +[...] + +Breakpoint 1, main () at prog.c:12 +12 int n = 0; +(gdb) target record-full +(gdb) c +Continuing. + +Program received signal SIGSEGV, Segmentation fault. +0x0000000000401154 in sometimes_crashes (f=0x0) at prog.c:7 +7 return *f; +(gdb) reverse-finish +Run back to call of #0 0x0000000000401154 in sometimes_crashes (f=0x0) + at prog.c:7 +0x0000000000401190 in main () at prog.c:16 +16 sometimes_crashes(0); +``` + +这些只是 GNU 调试器可以做的一些有用的事情。还有更多有待发现。你最喜欢 `gdb` 的哪个隐藏的、鲜为人知或令人吃惊的功能?请在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/9/tips-gnu-debugger + +作者:[Tim Waugh][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/twaugh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y (Bug tracking magnifying glass on computer screen) +[2]: https://www.gnu.org/software/gdb/ +[3]: https://en.wikipedia.org/wiki/Util-linux From 2ec18043ad8a87562a1d83547c9d4a6155961ee9 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Mon, 2 Dec 2019 00:53:57 +0800 Subject: [PATCH 725/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191201=20Modern?= =?UTF-8?q?ize=20your=20Linux=20desktop=20with=20Enlightenment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191201 Modernize your Linux desktop with Enlightenment.md --- ...e your Linux desktop with Enlightenment.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20191201 Modernize your Linux desktop with Enlightenment.md diff --git a/sources/tech/20191201 Modernize your Linux desktop with Enlightenment.md b/sources/tech/20191201 Modernize your Linux desktop with Enlightenment.md new file mode 100644 index 0000000000..b975ca18e7 --- /dev/null +++ b/sources/tech/20191201 Modernize your Linux desktop with Enlightenment.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Modernize your Linux desktop with Enlightenment) +[#]: via: (https://opensource.com/article/19/12/linux-enlightenment-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Modernize your Linux desktop with Enlightenment +====== +This article is part of a special series of 24 days of Linux desktops. +Enlightenment offers a smooth, appealing, and modern Linux desktop +experience, even on older hardware. +![Light at the end of the tunnel][1] + +One of Linux's many advantages is its ability to install and run on old computers. What Linux can't _technically_ do is make an old computer's hardware magically perform better. After all, the hardware is the same hardware as ever, and sometimes old hardware feels notably slow when processing modern software that tries to take advantage of new hardware features. This means that an old computer running Linux must run a rather basic desktop, because too many effects or animations might use up precious memory and graphics processing, resulting in sluggish performance. + +The [Enlightenment][2] desktop wasn't designed to solve this exact problem, but in practice, that's exactly what it does. With its finely crafted foundation and custom libraries, Enlightenment provides an attractive and dynamic environment that runs smoothly on old computers and low-powered systems like the [Raspberry Pi][3]. You never have to feel like you're compromising your user experience (UX) just because you're running modest hardware. True to its name, it delivers on the promise of eco-friendly computing and is the first line of defense (or second, if Linux itself is the first) against planned obsolescence. + +Of course, you don't have to run Enlightenment on an old computer. It works just as well on new computers. + +Install Enlightenment from your distribution's software repository. Past versions of Enlightenment are still popular today (and some are still maintained as separate projects), and all of them are good, but the latest versions are the ones above 20. After installing it, log out of your current desktop session so you can log into your new Enlightenment desktop. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your default desktop, so you must override the default when logging in. + +Here's how to override the default and switch to Enlightenment on GNOME Desktop Manager: + +![Selecting the Enlightenment desktop in GDM][4] + +And on KDM: + +![Selecting the Enlightenment desktop in KDM][5] + +The first time you log into Enlightenment, it asks for some basic preferences, such as your desired language setting, size of window title bars, and so on. It's OK to accept the defaults when you're unsure, and it's safe to ignore the warning about ConnMan not being available. Most distributions use [NetworkManager][6] instead of Enlightenment's own network manager, ConnMan. + +### Enlightenment desktop + +By default, the Enlightenment desktop provides desktop icons for common places, such as your home directory, the root directory, and a temporary directory. There's also a "shelf," a docking area at the bottom of the screen where major applications can go when minimized, where launchers can be created for quick access to common applications, and where applets (such as volume control, a clock, keyboard layout, and so on) run. + +Anything configurable in Enlightenment is configurable with a right-click. + +Here's what Enlightenment looks like on Fedora: + +![Enlightenment running on Fedora][7] + +### Features + +To access an application menu, click anywhere on the desktop. Enlightenment is a desktop environment, but it's disguised as a window manager. Its primary task is to help you arrange and manage windows, but it also ships with a file manager (called Fileman) and has options to use a network manager called ConnMan and its own terminal called Terminology. It also has a global settings panel to help manage themes, keyboard shortcuts, screen resolution, and so on. + +Because Enlightenment ships with just a few applications, your default application set can stay the same as what you were using before trying Enlightenment. All of your K apps or GNOME applications and third-party applications like Firefox or Blender or LibreOffice will function as usual. + +Enlightenment is a smooth, appealing, and modern desktop experience. Settle in and become enlightened! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-enlightenment-desktop + +作者:[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/light_tunnel_death.jpg?itok=ERLZDTfl (Light at the end of the tunnel) +[2]: https://www.enlightenment.org/ +[3]: https://opensource.com/resources/raspberry-pi +[4]: https://opensource.com/sites/default/files/uploads/advent-enlightenment-gdm.jpg (Selecting the Enlightenment desktop in GDM) +[5]: https://opensource.com/sites/default/files/uploads/advent-enlightenment-kdm.jpg (Selecting the Enlightenment desktop in KDM) +[6]: https://en.wikipedia.org/wiki/NetworkManager +[7]: https://opensource.com/sites/default/files/uploads/advent-enlightenment.jpg (Enlightenment running on Fedora) From 4038c036caa423404dee1f852859d26423ffbb68 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 2 Dec 2019 08:43:41 +0800 Subject: [PATCH 726/800] translated --- ...dress of a Domain in the Linux Terminal.md | 275 ------------------ ...dress of a Domain in the Linux Terminal.md | 275 ++++++++++++++++++ 2 files changed, 275 insertions(+), 275 deletions(-) delete mode 100644 sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md create mode 100644 translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md diff --git a/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md deleted file mode 100644 index 866d5df482..0000000000 --- a/sources/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md +++ /dev/null @@ -1,275 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (5 Commands to Find the IP Address of a Domain in the Linux Terminal) -[#]: via: (https://www.2daygeek.com/linux-command-find-check-domain-ip-address/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) - -5 Commands to Find the IP Address of a Domain in the Linux Terminal -====== - -This tutorial shows you how to verify a domain name’s or computer name IP address from a Linux terminal. - -This tutorial will allow you to check multiple domains at once. - -You may have already used these commands to verify information. - -However, we will teach you how to use these commands effectively to identify multiple domain IP address information from the Linux terminal. - -This can be done using the following 5 commands. - - * **dig Command:** dig is a flexible cli tool for interrogating DNS name servers. - * **host Command:** host is a simple utility for performing DNS lookups. - * **nslookup Command:** Nslookup command is used to query Internet domain name servers. - * **fping Command:** fping command is used to send ICMP ECHO_REQUEST packets to network hosts. - * **ping Command:** ping command is used to send ICMP ECHO_REQUEST packets to network hosts. - - - -To test this, we created a file called “domains-list.txt” and added the below domains. - -``` -# vi /opt/scripts/domains-list.txt - -2daygeek.com -magesh.co.in -linuxtechnews.com -``` - -### Method-1: How to Find a IP Address of the Domain Using the dig Command - -**[dig command][1]** stands for “domain information groper”‘ is a powerful and flexible command-line tool for querying DNS name servers. - -It performs DNS lookups and displays the answers that are returned from the name server(s) that were queried. - -Most DNS administrators use dig command to troubleshoot DNS problems because of its flexibility, ease of use and clarity of output. - -It also has a batch mode functionality to read search requests from a file. - -``` -# dig 2daygeek.com | awk '{print $1,$5}' - -2daygeek.com. 104.27.157.177 -2daygeek.com. 104.27.156.177 -``` - -Use the following bash script to find the multiple domain’s IP address. - -``` -# vi /opt/scripts/dig-command.sh - -#!/bin/bash -for server in `cat /opt/scripts/domains-list.txt` -do echo $server "-" -dig $server +short -done | paste -d " " - - - -``` - -Once the above script is added to a file. Set the executable permission for the “dig-command.sh” file. - -``` -# chmod +x /opt/scripts/dig-command.sh -``` - -Finally run the bash script to get the output. - -``` -# sh /opt/scripts/dig-command.sh - -2daygeek.com - 104.27.156.177 104.27.157.177 -magesh.co.in - 104.18.35.52 104.18.34.52 -linuxtechnews.com - 104.27.144.3 104.27.145.3 -``` - -If you want to run the above script in one line, use the following script. - -``` -# for server in 2daygeek.com magesh.co.in linuxtechnews.com; do echo $server "-"; dig $server +short; done | paste -d " " - - - -``` - -Alternatively, you can use the following shell script to find the IP address of the multiple domain. - -``` -# for server in 2daygeek.com magesh.co.in linuxtechnews.com; do dig $server | awk '{print $1,$5}'; done - -2daygeek.com. 104.27.157.177 -2daygeek.com. 104.27.156.177 -magesh.co.in. 104.18.34.52 -magesh.co.in. 104.18.35.52 -linuxtechnews.com. 104.27.144.3 -linuxtechnews.com. 104.27.145.3 -``` - -### Method-2: How to Find a Domain’s IP Address Using the host Command - -**[Host Command][2]** is a simple CLI application to perform **[DNS lookup][3]**. - -It is commonly used to convert names to IP addresses and vice versa. - -When no arguments or options are given, host prints a short summary of its command line arguments and options. - -You can view all types of records in the domain by adding a specific option or type of record in the host command. - -``` -# host 2daygeek.com | grep "has address" | sed 's/has address/-/g' - -2daygeek.com - 104.27.157.177 -2daygeek.com - 104.27.156.177 -``` - -Use the following bash script to find the multiple domain’s IP address. - -``` -# vi /opt/scripts/host-command.sh - -for server in `cat /opt/scripts/domains-list.txt` -do host $server | grep "has address" | sed 's/has address/-/g' -done -``` - -Once the above script is added to a file. Set the executable permission for the “host-command.sh” file. - -``` -# chmod +x /opt/scripts/host-command.sh -``` - -Finally run the bash script to get the output. - -``` -# sh /opt/scripts/host-command.sh - -2daygeek.com - 104.27.156.177 -2daygeek.com - 104.27.157.177 -magesh.co.in - 104.18.35.52 -magesh.co.in - 104.18.34.52 -linuxtechnews.com - 104.27.144.3 -linuxtechnews.com - 104.27.145.3 -``` - -### Method-3: How to Find the IP Address of a Domain Using the nslookup Command - -**[nslookup command][4]** is a program for querying Internet **[domain name servers (DNS)][5]**. - -nslookup has two modes, which are interactive and interactive. - -Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. - -Non-interactive mode is used to print just the name and requested information for a host or domain. - -It is a network administration tool that helps diagnose and resolve DNS related issues. - -``` -# nslookup -q=A 2daygeek.com | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 - -104.27.157.177 -104.27.156.177 -``` - -Use the following bash script to find the multiple domain’s IP address. - -``` -# vi /opt/scripts/nslookup-command.sh - -#!/bin/bash -for server in `cat /opt/scripts/domains-list.txt` -do echo $server "-" -nslookup -q=A $server | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 done | paste -d " " - - - -``` - -Once the above script is added to a file. Set the executable permission for the “nslookup-command.sh” file. - -``` -# chmod +x /opt/scripts/nslookup-command.sh -``` - -Finally run the bash script to get the output. - -``` -# sh /opt/scripts/nslookup-command.sh - -2daygeek.com - 104.27.156.177 104.27.157.177 -magesh.co.in - 104.18.35.52 104.18.34.52 -linuxtechnews.com - 104.27.144.3 104.27.145.3 -``` - -### Method-4: How to Find a Domain’s IP Address Using the fping Command - -**[fping command][6]** is a program such as ping, which uses the Internet Control Message Protocol (ICMP) echo request to determine whether a target host is responding. - -fping differs from ping because it allows users to ping any number of host in parallel. Also, hosts can be entered from a text file. - -fping sends an ICMP echo request, moves the next target in a round-robin fashion, and does not wait until the target host responds. - -If a target host replies, it is noted as active and removed from the list of targets to check; if a target does not respond within a certain time limit and/or retry limit it is designated as unreachable. - -``` -# fping -A -d 2daygeek.com magesh.co.in linuxtechnews.com - -104.27.157.177 (104.27.157.177) is alive -104.18.35.52 (104.18.35.52) is alive -104.27.144.3 (104.27.144.3) is alive -``` - -### Method-5: How to Find the IP Address of the Domain Using the ping Command - -**[ping command][6]** stands for (Packet Internet Groper) command is a networking utility that used to test the target of a host availability/connectivity on an Internet Protocol (IP) network. - -It’s verify a host availability by sending Internet Control Message Protocol (ICMP) Echo Request packets to the target host and waiting for an ICMP Echo Reply. - -It summarize statistical results based on the packets transmitted, packets received, packet loss, typically including the min/avg/max times. - -``` -# ping -c 2 2daygeek.com | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' - -104.27.157.177 -``` - -Use the following bash script to find the multiple domain’s IP address. - -``` -# vi /opt/scripts/ping-command.sh - -#!/bin/bash -for server in `cat /opt/scripts/domains-list.txt` -do echo $server "-" -ping -c 2 $server | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' -done | paste -d " " - - -``` - -Once the above script is added to a file. Set the executable permission for the “dig-command.sh” file. - -``` -# chmod +x /opt/scripts/ping-command.sh -``` - -Finally run the bash script to get the output. - -``` -# sh /opt/scripts/ping-command.sh - -2daygeek.com - 104.27.156.177 -magesh.co.in - 104.18.35.52 -linuxtechnews.com - 104.27.144.3 -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/linux-command-find-check-domain-ip-address/ - -作者:[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/dig-command-check-find-dns-records-lookup-linux/ -[2]: https://www.2daygeek.com/linux-host-command-check-find-dns-records-lookup/ -[3]: https://www.2daygeek.com/category/dns-lookup/ -[4]: https://www.2daygeek.com/nslookup-command-check-find-dns-records-lookup-linux/ -[5]: https://www.2daygeek.com/check-find-dns-records-of-domain-in-linux-terminal/ -[6]: https://www.2daygeek.com/how-to-use-ping-fping-gping-in-linux/ diff --git a/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md new file mode 100644 index 0000000000..344d781010 --- /dev/null +++ b/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md @@ -0,0 +1,275 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Commands to Find the IP Address of a Domain in the Linux Terminal) +[#]: via: (https://www.2daygeek.com/linux-command-find-check-domain-ip-address/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +5 个用于在 Linux 终端中查找域 IP 地址的命令 +====== + +本教程介绍了如何在 Linux 终端验证域名或计算机名的 IP 地址。 + +本教程将允许你一次检查多个域。 + +你可能已经使用过这些命令来验证信息。 + +但是,我们将教你如何有效使用这些命令在 Linux 终端中识别多个域的 IP 地址信息。 + +可以使用以下5个命令来完成此操作。 + + * **dig 命令:** dig 是用于查询 DNS名称服务器的灵活命令行工具。 +  * **host 命令:** host 是用于执行 DNS 查询的简单程序。 +  * **nslookup 命令:** nslookup 命令用于查询互联网域名服务器。 +  * **fping 命令:** fping 命令用于将 ICMP ECHO_REQUEST 数据包发送到网络主机。 +  * **ping 命令:** ping 命令用于向网络主机发送 ICMP ECHO_REQUEST 数据包。 + + + +为了测试,我们创建了一个名为 “domains-list.txt” 的文件,并添加了以下域。 + +``` +# vi /opt/scripts/domains-list.txt + +2daygeek.com +magesh.co.in +linuxtechnews.com +``` + +### 方法 1:如何使用 dig 命令查找域的 IP 地址 + +**[dig 命令][1]**代表 “domain information groper”,它是一个功能强大且灵活的命令行工具,用于查询 DNS 名称服务器。 + +它执行 DNS 查询,并显示来自查询的名称服务器的返回信息。 + +大多数 DNS 管理员使用 dig 命令来解决 DNS 问题,因为它灵活、易用且输出清晰。 + +它还有批处理模式,可以从文件读取搜索请求。 + +``` +# dig 2daygeek.com | awk '{print $1,$5}' + +2daygeek.com. 104.27.157.177 +2daygeek.com. 104.27.156.177 +``` + +使用以下 bash 脚本查找多个域的 IP 地址。 + +``` +# vi /opt/scripts/dig-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +dig $server +short +done | paste -d " " - - - +``` + +添加以上脚本后,给 “dig-command.sh” 文件设置可执行权限。 + +``` +# chmod +x /opt/scripts/dig-command.sh +``` + +最后运行 bash 脚本获得输出。 + +``` +# sh /opt/scripts/dig-command.sh + +2daygeek.com - 104.27.156.177 104.27.157.177 +magesh.co.in - 104.18.35.52 104.18.34.52 +linuxtechnews.com - 104.27.144.3 104.27.145.3 +``` + +如果要在一行中运行上面的脚本,请使用以下脚本。 + +``` +# for server in 2daygeek.com magesh.co.in linuxtechnews.com; do echo $server "-"; dig $server +short; done | paste -d " " - - - +``` + +或者,你可以使用以下 Shell 脚本查找多个域的 IP 地址。 + +``` +# for server in 2daygeek.com magesh.co.in linuxtechnews.com; do dig $server | awk '{print $1,$5}'; done + +2daygeek.com. 104.27.157.177 +2daygeek.com. 104.27.156.177 +magesh.co.in. 104.18.34.52 +magesh.co.in. 104.18.35.52 +linuxtechnews.com. 104.27.144.3 +linuxtechnews.com. 104.27.145.3 +``` + +### 方法 2:如何使用 host 命令查找域的 IP 地址 + +**[host 命令][2]**是一个简单的命令行程序,用于执行 **[DNS 查询][3]**。 + +它通常用于将名称转换为 IP 地址,反之亦然。 + +如果未提供任何参数或选项,host 将打印它的命令行参数和选项摘要。 + +你可以在 host 命令中添加特定选项或记录类型来查看域中的所有记录类型。 + +``` +# host 2daygeek.com | grep "has address" | sed 's/has address/-/g' + +2daygeek.com - 104.27.157.177 +2daygeek.com - 104.27.156.177 +``` + +使用以下 bash 脚本查找多个域的 IP 地址。 + +``` +# vi /opt/scripts/host-command.sh + +for server in `cat /opt/scripts/domains-list.txt` +do host $server | grep "has address" | sed 's/has address/-/g' +done +``` + +添加以上脚本后,给 “host-command.sh” 文件设置可执行权限。 + +``` +# chmod +x /opt/scripts/host-command.sh +``` + +最后运行 bash 脚本获得输出。 + +``` +# sh /opt/scripts/host-command.sh + +2daygeek.com - 104.27.156.177 +2daygeek.com - 104.27.157.177 +magesh.co.in - 104.18.35.52 +magesh.co.in - 104.18.34.52 +linuxtechnews.com - 104.27.144.3 +linuxtechnews.com - 104.27.145.3 +``` + +### 方法 3:如何使用 nslookup 命令查找域的 IP 地址 + +**[nslookup 命令][4]**是用于查询互联网**[域名服务器(DNS)] [5]**的程序。 + +nslookup 有两种模式,分别是交互式和非交互式。 + +交互模式允许用户查询名称服务器以获取有关各种主机和域的信息,或打印域中的主机列表。 + +非交互模式用于仅打印主机或域的名称和请求的信息。 + +它是一个网络管理工具,可以帮助诊断和解决 DNS 相关问题。 + +``` +# nslookup -q=A 2daygeek.com | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 + +104.27.157.177 +104.27.156.177 +``` + +使用以下 bash 脚本查找多个域的 IP 地址。 + +``` +# vi /opt/scripts/nslookup-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +nslookup -q=A $server | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 done | paste -d " " - - - +``` + +添加以上脚本后,给 “nslookup-command.sh” 文件设置可执行权限。 + +``` +# chmod +x /opt/scripts/nslookup-command.sh +``` + +最后运行 bash 脚本获得输出。 + +``` +# sh /opt/scripts/nslookup-command.sh + +2daygeek.com - 104.27.156.177 104.27.157.177 +magesh.co.in - 104.18.35.52 104.18.34.52 +linuxtechnews.com - 104.27.144.3 104.27.145.3 +``` + +### 方法 4:如何使用 fping 命令查找域的 IP 地址 + +**[fping 命令][6]**是类似 ping 之类的程序,它使用互联网控制消息协议(ICMP)echo 请求来确定目标主机是否响应。 + +fping 与 ping 不同,因为它允许用户并行 ping 任意数量的主机。另外,它可以从文本文件输入主机。 + +fping 发送 ICMP echo 请求,并以循环方式移到下一个目标,并且不等到目标主机做出响应。 + +如果目标主机答复,那么将其标记为活动主机并从要检查的目标列表中删除;如果目标在特定时间限制和/或重试限制内未响应,那么将其指定为不可访问。 + +``` +# fping -A -d 2daygeek.com magesh.co.in linuxtechnews.com + +104.27.157.177 (104.27.157.177) is alive +104.18.35.52 (104.18.35.52) is alive +104.27.144.3 (104.27.144.3) is alive +``` + +### 方法 5:如何使用 ping 命令查找域的 IP 地址 + +**[ping(Packet Internet Groper)命令][6]**是一个网络程序,用于测试 Internet 协议(IP)网络上主机的可用性/连接性。 + +通过向目标主机发送互联网控制消息协议(ICMP)Echo 请求数据包并等待 ICMP Echo 应答来验证主机的可用性。 + +它基于发送的数据包、接收的数据包、丢失的数据包,通常包含最小/平均/最大时间来汇总统计结果。 + +``` +# ping -c 2 2daygeek.com | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' + +104.27.157.177 +``` + +使用以下 bash 脚本查找多个域的 IP 地址。 + +``` +# vi /opt/scripts/ping-command.sh + +#!/bin/bash +for server in `cat /opt/scripts/domains-list.txt` +do echo $server "-" +ping -c 2 $server | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' +done | paste -d " " - - +``` + +添加以上脚本后,给 “ping-command.sh” 文件设置可执行权限。 + +``` +# chmod +x /opt/scripts/ping-command.sh +``` + +最后运行 bash 脚本获得输出。 + +``` +# sh /opt/scripts/ping-command.sh + +2daygeek.com - 104.27.156.177 +magesh.co.in - 104.18.35.52 +linuxtechnews.com - 104.27.144.3 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-command-find-check-domain-ip-address/ + +作者:[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/dig-command-check-find-dns-records-lookup-linux/ +[2]: https://www.2daygeek.com/linux-host-command-check-find-dns-records-lookup/ +[3]: https://www.2daygeek.com/category/dns-lookup/ +[4]: https://www.2daygeek.com/nslookup-command-check-find-dns-records-lookup-linux/ +[5]: https://www.2daygeek.com/check-find-dns-records-of-domain-in-linux-terminal/ +[6]: https://www.2daygeek.com/how-to-use-ping-fping-gping-in-linux/ From e8ff77bac76c8b3d5135456520170443b02ae101 Mon Sep 17 00:00:00 2001 From: geekpi Date: Mon, 2 Dec 2019 08:48:58 +0800 Subject: [PATCH 727/800] translating --- sources/tech/20191017 Using multitail on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191017 Using multitail on Linux.md b/sources/tech/20191017 Using multitail on Linux.md index b89ef375d2..e2510e54f6 100644 --- a/sources/tech/20191017 Using multitail on Linux.md +++ b/sources/tech/20191017 Using multitail on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 1f5454b60d50b76851a930e3d92292a3b9d119c1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Dec 2019 09:33:59 +0800 Subject: [PATCH 728/800] PRF --- ...91028 6 signs you might be a Linux user.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/translated/talk/20191028 6 signs you might be a Linux user.md b/translated/talk/20191028 6 signs you might be a Linux user.md index ef6b782ce1..1ae3a92e0b 100644 --- a/translated/talk/20191028 6 signs you might be a Linux user.md +++ b/translated/talk/20191028 6 signs you might be a Linux user.md @@ -12,7 +12,7 @@ Linux 资深用户的 6 大特征 > 如果你是 Linux 资深用户,则可能会有这些共同倾向。 -![Tux with binary code background][1] +![](https://img.linux.net.cn/data/attachment/album/201912/02/093348ek4jcyvj4wahytwq.jpg) Linux 用户千差万别,但是我们许多人都有一些相同的习惯。你可能没有本文列出的任何特征,而且如果你是个 Linux 新用户,你可能还不能理解这些特征…… @@ -20,17 +20,17 @@ Linux 用户千差万别,但是我们许多人都有一些相同的习惯。 ### 1、理所当然,纪元始于 1970 年 1 月 1 日 -关于 Unix 计算机时钟为何在重置时总是将其设置回 1970-01-01 的传闻有很多。但有点令人感到乏味的事实是,Unix “纪元”是用于同步的通用且简单的参考点。例如,万圣节在儒略历中是今年的 304 日,但我们通常将该节日称为 “31 日”。我们知道指的是哪个月 31 日,因为我们有个共同的参考点:我们知道万圣节在 10 月庆祝,而 10 月是一年中的第十个月,并且我们知道前面每一个月包含多少天。没有这些值,虽然我们可以使用传统的计时方法(如月相)来跟踪特殊的季节性事件,但是计算机显然不具备这种能力。 +关于 Unix 计算机时钟为何在重置时总是将其设置回 1970-01-01 的传闻有很多。但有点令人感到乏味的事实是,Unix “纪元”是用于同步的通用且简单的参考点。例如,万圣节在儒略历中是今年的 304 日,但我们通常将该节日称为 “31 号”。我们知道指的是哪个月的 31 号,因为我们有个共同的参考点:我们知道万圣节在 10 月庆祝,而 10 月是一年中的第十个月,并且我们知道前面每一个月包含多少天。没有这些值,虽然我们可以使用传统的计时方法(如月相)来跟踪特殊的季节性事件,但是计算机显然不具备这种能力。 计算机需要确定且明确定义的值,因此将值 `1970-01-01T00:00:00Z` 选择为 Unix 纪元的开始。每当 [POSIX][2] 计算机的时间不准确时,诸如网络时间协议(NTP)之类的服务就可以向其提供自 `1970-01-01T00:00:00Z` 以来的秒数,计算机可以将其转换为人类易于识别的日期。 -日期和时间是在计算中要追踪的著名的复杂事物,主要是因为几乎所有标准都有例外。一个月并不总是有 30 天,一年也不总是有 365 天,甚至每年有多少秒钟也往往会有所不同。如果你正在寻找一个有趣而令人沮丧的编程练习,请尝试编程一个可靠的日历应用程序! +日期和时间是在计算中要追踪的著名的复杂事物,主要是因为几乎所有标准都有例外。一个月并不总是有 30 天,一年也不总是有 365 天,甚至每年有多少秒钟也往往会有所不同。如果你正在寻找一个有趣而令人沮丧的编程练习,那么请尝试编程一个可靠的日历应用程序! ### 2、输入超过两个字母你就会觉得麻烦 -众所周知,最常见的 Unix 命令都超简短。除了 `cd`、`ls` 和 `mv` 之类的命令外,还有一个命令简直不能再短了:`w`(它根据 `/var/run/utmp` 文件显示谁当前登录了)。 +众所周知,最常见的 Unix 命令都超简短。除了 `cd`、`ls` 和 `mv` 之类的命令外,还有一个命令简直不能再短了:`w`(它根据 `/var/run/utmp` 文件显示当前谁登录了)。 -一方面,极短的命令似乎很不直观。新用户可能不会猜测到键入 `ls` 会列出list目录。但是,一旦学习命令,它们肯定是越短越好。如果你整天都在终端上度过,那么你键入的击键次数越少就意味着你可以花更多的时间来完成工作。 +一方面,极短的命令似乎很不直观。新用户可能不会猜测到键入 `ls` 会列出list目录。但是,一旦学习命令,它们肯定是越短越好。如果你整天都在终端上度过,那么你键入的击键次数越少就意味着你可以有更多的时间来完成工作。 幸运的是,单字母命令并不太多,因此你可以使用大多数字母作为别名。例如,我经常使用 Emacs,以至于我觉得 `emacs` 的输入时间太长,因此通过将下面这行添加到 `.bashrc` 文件中,将其别名为 `e`: @@ -78,10 +78,10 @@ $ cp report-latest.txt reports_daily/2019-31-10.log trash $HOME/Documents/reports-latest.txt wget myserver.local/reports/daily/report-latest.txt \ --P $HOME/Documents/udpates_daily/`date --iso-8601`.log + -P $HOME/Documents/udpates_daily/`date --iso-8601`.log cp $HOME/Documents/udpates_daily/`date --iso-8601`.log \ -$HOME/Documents/reports-latest.txt + $HOME/Documents/reports-latest.txt ``` 你可以把你的脚本叫做 `get-reports.sh` 并在每天早晨手动启动它,或者甚至可以将其输入到 crontab 中,以便计算机可以执行此任务而无需你进行任何干预。 @@ -93,7 +93,7 @@ $HOME/Documents/reports-latest.txt 3. 将图像导出为修改后的文件 4. 关闭应用程序 -如果你一天要做几次,你可能会对这种重复感到厌倦。但是,由于你是在图形用户界面(GUI)中执行这些操作的,因此你需要知道如何编写 GUI 脚本以使其自动化。某些应用程序,例如 [GIMP][4],具有丰富的脚本接口,但是其过程显然不同于仅修改一堆命令并将其存储到文件中那么简单。 +如果你一天要做几次,你可能会对这种重复感到厌倦。但是,由于你是在图形用户界面(GUI)中执行这些操作的,因此你需要知道如何对 GUI 编写脚本以使其自动化。某些应用程序,例如 [GIMP][4],具有丰富的脚本接口,但是其过程显然不同于仅修改一堆命令并将其存储到文件中那么简单。 再说一次,有时在命令行中有与你在 GUI 中所做的等效的操作。将文档从一种文本格式转换为另一种格式可以使用 [Pandoc][5],处理图像可以使用 [Image Magick][6],音乐和视频也可以通过命令行进行编辑和转换,等等。最大的问题是你需要知道要查找什么,通常是学习新的(有时是复杂的)命令。但是,在终端中按比例缩小图像比在 GUI 中显然更简单: @@ -107,7 +107,7 @@ convert "${1}" -scale 50% `basename "${1}" .jpg`_50.jpg ### 5、发行版之间跳来跳去 -我在家里是一个热情的 Slackware 用户,而在工作时是一个 RHEL 用户。实际上,这不是事实,我现在在工作时是 Fedora 用户。除了有时候我使用 CentOS,有时候我还会运行 [Mageia][7]。 +我在家里是一个热情的 Slackware 用户,而在工作时是一个 RHEL 用户。实际上,这不是事实,我现在在工作时是 Fedora 用户。除了有时候我使用 CentOS,偶尔我还会运行 [Mageia][7]。 ![Debian on a PowerPC64 box, image CC BY SA Claudio Miranda][8] @@ -123,7 +123,7 @@ convert "${1}" -scale 50% `basename "${1}" .jpg`_50.jpg ### 6、你对开源充满热情 -无论你的经验如何,如果你是 Linux 用户,那么你无疑会对开源充满热情。无论你是每天通过[共创艺术品] [11]还是代码来表达你的热情,还是将其升华到只在自由而自在环境中完成工作,你都生活并构筑于开源之上。因为有了千千万万个你,所以有了开源社区,社区因你而变得更加丰富。 +无论你的经验如何,如果你是 Linux 用户,那么你无疑会对开源充满热情。无论你是每天通过[共创艺术品] [11]还是代码来表达你的热情,还是将其升华到只在自由而自在的环境中完成工作,你都生活并构筑于开源之上。因为有了千千万万个你,所以有了开源社区,社区因你而变得更加丰富。 有太多的东西我没有提到。作为 Linux 用户,还有什么可以出卖你的身份?让我们在评论中知道! From 697acf74703b4c0c82f41f9f9f3cc49f47b90da0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Dec 2019 09:34:45 +0800 Subject: [PATCH 729/800] PUB @wxy https://linux.cn/article-11635-1.html --- .../20191028 6 signs you might be a Linux user.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/talk => published}/20191028 6 signs you might be a Linux user.md (99%) diff --git a/translated/talk/20191028 6 signs you might be a Linux user.md b/published/20191028 6 signs you might be a Linux user.md similarity index 99% rename from translated/talk/20191028 6 signs you might be a Linux user.md rename to published/20191028 6 signs you might be a Linux user.md index 1ae3a92e0b..42688e4e2b 100644 --- a/translated/talk/20191028 6 signs you might be a Linux user.md +++ b/published/20191028 6 signs you might be a Linux user.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11635-1.html) [#]: subject: (6 signs you might be a Linux user) [#]: via: (https://opensource.com/article/19/10/signs-linux-user) [#]: author: (Seth Kenlon https://opensource.com/users/seth) From 9576c54fb0ab3b9e6b273037fd150152a1873d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 2 Dec 2019 13:09:17 +0800 Subject: [PATCH 730/800] Translating --- ...217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md b/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md index 88798037c5..f20d24e5cf 100644 --- a/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md +++ b/sources/tech/20190217 Install Android 8.1 Oreo on Linux To Run Apps - Games.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From e906c44d334e690a289f749db364c1ce248a5266 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91?= Date: Mon, 2 Dec 2019 13:11:03 +0800 Subject: [PATCH 731/800] Translating --- sources/tech/20190225 Netboot a Fedora Live CD.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190225 Netboot a Fedora Live CD.md b/sources/tech/20190225 Netboot a Fedora Live CD.md index 2767719b8c..f2ca6bb346 100644 --- a/sources/tech/20190225 Netboot a Fedora Live CD.md +++ b/sources/tech/20190225 Netboot a Fedora Live CD.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (robsean) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 9eef4d3a8f15f6bdd420ad5865d7b08ca7f09917 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Mon, 2 Dec 2019 15:22:06 +0800 Subject: [PATCH 732/800] translating --- ...System Information on Linux Every Time You Log into Shell.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md b/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md index 9efdc87ec1..d89577ba12 100644 --- a/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md +++ b/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From fbf813cc019e7a151888bd80400b9f2406295adb Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Mon, 2 Dec 2019 15:52:46 +0800 Subject: [PATCH 733/800] translated. --- ... on Linux Every Time You Log into Shell.md | 74 +++++++++---------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md b/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md index d89577ba12..46bc1c699b 100644 --- a/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md +++ b/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md @@ -1,43 +1,43 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Bash Script to View System Information on Linux Every Time You Log into Shell) -[#]: via: (https://www.2daygeek.com/bash-shell-script-view-linux-system-information/) -[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Bash Script to View System Information on Linux Every Time You Log into Shell" +[#]: via: "https://www.2daygeek.com/bash-shell-script-view-linux-system-information/" +[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" -Bash Script to View System Information on Linux Every Time You Log into Shell +Bash 脚本实现每次登录到 Shell 时可以查看 Linux 系统信息 ====== -There are several commands in Linux to obtain system information such as processor information, manufacturer name, and serial number, etc,. +Linux 中有很多可以查看系统信息如处理器信息,生产商名字,序列号等的命令。 -You may need to run several commands to collect this information. +你可能需要执行多个命令来收集这些信息。 -Also, it is very difficult to remember all the commands and their options. +同时,记住所有的命令和他们的选项也是有难度。 -Instead you can write a **[shell script][1]** to customize the output based on your needs. +你可以写一个 [shell 脚本](https://www.2daygeek.com/category/shell-script/) 基于你的需求来自定义显示的信息。 -In the past we have written many **[bash scripts][2]** for a variety of purposes. +以前我们出于不同的目的需要写很多个 [bash 脚本](https://www.2daygeek.com/category/bash-script/)。 -Today, we came up with a new shell script, which shows you the required system information every time you log into the shell. +现在我们写一个新的 shell 脚本,在每次登录到 shell 时显示需要的系统信息。 -There are six parts to this script, and more details below. +这个j脚本有 6 部分,细节如下: - * **Part-1:** General System Information - * **Part-2:** CPU/Memory Current Usage - * **Part-3:** Disk Usage >80% - * **Part-4:** List System WWN Details - * **Part-5:** Oracle DB Instances - * **Part-6:** Available Package Updates + * **Part-1:** 通用系统信息 + * **Part-2:** CPU/内存当前使用情况 + * **Part-3:** 硬盘使用率超过 80% + * **Part-4:** 列出系统 WWN 详情 + * **Part-5:** Oracle DB 实例 + * **Part-6:** 可更新的包 -We’ve added potential information to each area based on our needs. You can further customize this script to your needs if you wish. +我们已经基于我们的需求把可能需要到的信息加到了每个部分。之后你可以基于自己的意愿修改这个脚本。 -There are many tools for this, most of which we have already covered. +这个j脚本需要用到很多工具,其中大部分我们之前已经涉及到了。 -To read them, go to the following articles. +你可以参照以前文章,了解工具详情。 * **[inxi – A Great Tool to Check Hardware Information on Linux][3]** * **[Dmidecode – Easy Way To Get Linux System Hardware Information][3]** @@ -55,11 +55,11 @@ To read them, go to the following articles. -If anyone wants to add any other information in the script, please let us know your requirements in the comment section so that we can help you. +如果你想为这个脚本增加其他的信息,请在评论去留下你的需求,以便我们帮助你。 -### Bash Script to View System Information on Linux Every Time You Log into the Shell +### Bash 脚本实现每次登录到 Shell 时可以查看 Linux 系统信息 -This basic script will bring the system information to your terminal whenever you log into the shell. +这个脚本会在你每次登录 shell 时把系统信息打印到 terminal。 ``` #vi /opt/scripts/system-info.sh @@ -120,41 +120,37 @@ echo -e "----------------------------------------------------------------------- fi ``` -Once the above script is added to a file. Set the executable permission for the “system-info.sh” file. +把上面脚本内容保存到一个文件 "system-info.sh",之后添加可执行权限 ``` # chmod +x ~root/system-info.sh ``` -When the script is ready, add the file path at the end of the “.bash_profile” file in RHEL-based systems CentOS, Oracle Linux and Fedora. +当脚本准备好后,把脚本文件的路径加到 ".bash_profile" 文件末尾(红帽系列的系统:CentOS,Oracle Linux 和 Fedora)。 ``` # echo "/root/system-info.sh" >> ~root/.bash_profile ``` -To take this change effect, run the following command. +执行以下命令,来让修改的内容生效。 ``` # source ~root/.bash_profile ``` -For Debian-based systems, you may need to add a file path to the “.profile” file. +对于 Debian 系统的系统,你可能需要把文件路径加到 ".profile" 文件中。 ``` # echo "/root/system-info.sh" >> ~root/.profile ``` -Run the following command to take this change effect. +运行以下命令使修改生效。 ``` # source ~root/.profile ``` -You may have seen an output like the one below when running the above “source” command. - -From next time on-wards, you will get this information every time you log into the shell. - -Alternatively, you can manually run this script at any time if you need to. +你以前运行上面 "source" 命令时可能见过类似下面的输出。从下次开始,你在每次登录 shell 时会看到这些信息。当然,如果有必要你也可以随时手动执行这个脚本。 ``` -------------------------------System Information--------------------------- @@ -206,7 +202,7 @@ via: https://www.2daygeek.com/bash-shell-script-view-linux-system-information/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lxbwolf](https://github.com/lxbwolf) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 65b82459040700c0fd01e0cfd4dde72bb5f8a9ba Mon Sep 17 00:00:00 2001 From: lixin <56751837+lixin555@users.noreply.github.com> Date: Mon, 2 Dec 2019 16:36:46 +0800 Subject: [PATCH 734/800] translation is finished --- ... Compatible Hosting Sites Automatically.md | 113 +++++++----------- 1 file changed, 40 insertions(+), 73 deletions(-) diff --git a/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md b/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md index d307c4f436..55abfd75ff 100644 --- a/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md +++ b/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md @@ -1,14 +1,11 @@ -lixin555 is translating -Share And Upload Files To Compatible Hosting Sites Automatically +自动共享和上传文件到兼容的托管站点 ====== ![](https://www.ostechnix.com/wp-content/uploads/2017/10/Upload-720x340.png) -A while ago, we have written a guide about [**Transfer.sh**][1] which allows you to share files over Internet from command-line. Today, we will see yet another file sharing utility called **Anypaste**. It is a simple script to share and upload files to compatible hosting sites depending upon the type of the files, automatically. You don 't need to manually log in to the hosting sites and upload or share your files. Anypaste will **pick the right hosting sites depends upon the type of the file** you want to upload. To put this simply, photos will get uploaded to image hosting sites, videos to video sites, code to pastebins. Cool, yeah? Anypaste is completely free, open source and light-weight script and you can do everything from command line. You don't need to depend on any heavy, memory-consuming GUI apps to upload and share files. +前阵子我们写了一个关于[**Transfer.sh**][1]的指南,它允许你使用命令行通过互联网来分享文件。今天,我们来看看另一种文件分享实用工具**Anypaste**。这是一个基于文件类型自动共享和上传文件到兼容托管站点的简单脚本。你不需要去手动登录到托管站点来上传或分享你的文件。Anypaste将会根据你想上传的文件的类型来**自动挑选合适的托管站点**。简单地说,照片将被上传到图像托管站点,视频被传到视频站点,代码被传到pastebins。难道不是很酷的吗?Anypaste是一个完全开源、免费、轻量的脚本,你可以通过命令行完成所有操作。因此,你不需要依靠那些臃肿的,需要消耗大量内存的GUI应用来上传和共享文件。 -### Anypaste - Share And Upload Files To Compatible Hosting Sites Automatically - -#### Installation - -Like I already said, it's just a script. So, there won't be any complex installation steps. Just download it somewhere where you can run it, for example /usr/bin/anypaste, make it as executable and start using it in no time. Alternatively, you can run the following two commands to quickly install Anypaste. +### Anypaste-自动共享和上传文件到兼容的托管站点 +#### 安装 +正如我所说,这仅仅是一个脚本。所以不存在任何复杂的安装步骤。只需要将脚本下载后放置在你想要运行的位置(例如/usr/bin/anypaste),并将其设置为可执行文件后就可以直接使用了。此外,你也可以通过下面的这两条命令来快速安装Anypaste。 ``` sudo curl -o /usr/bin/anypaste https://anypaste.xyz/sh ``` @@ -16,15 +13,15 @@ sudo curl -o /usr/bin/anypaste https://anypaste.xyz/sh sudo chmod +x /usr/bin/anypaste ``` -That's it. To update the old Anypaste version, just overwrite the old executable file with new one. +就是这样简单。如果需要更新老的Anypaste版本,只需要用新的可执行文件覆写旧的即可。 -Now, let us see some practical examples. +现在,让我们看看一些实例。 -#### Configuration +#### 配置 +Anypaste开箱即用,并不需要特别的配置。默认的配置文件是 **~/.config/anypaste.conf** ,这个文件在你第一次运行Anypaste时会自动创建。 -Anypaste will work just out of the box. No special configuration is required! The default configuration file is **~/.config/anypaste.conf** and it will be automatically created when you run Anypaste for the first time. +需要配置的选项只有**ap_plugins**。Anypaste使用插件系统去上传文件。每个站点(上传)都由一个特定的插件表示。你可以在anypaste.conf文件中的**ap-plugins directive**位置浏览可用的插件列表。 -The only required configuration option is **ap_plugins**. Anypaste uses plugin system to upload files. Each hosting (upload) site is represented by a specific plugin. You can view the list of enabled plugins under **ap-plugins directive** in anypaste.conf file. ``` # List of plugins # If there are multiple compatible plugins, precedence is determined @@ -45,17 +42,13 @@ ap_plugins=( ) [...] ``` - -If you install a new plugin, add it to this list. If you want to disable a default plugin, just remove it! If multiple plugins are compatible, the first one in the array is selected, so **order matters**. - -#### Usage - -To upload a single file, for example test.png, run: +如果你要安装一个新的插件,将它添加进这个列表中就可以了。如果你想禁用一个默认插件,只需要将它从列表中移除即可。如果多个插件是相互依存的关系,排列中的第一个会被选择,因此**顺序很重要**。 +#### 用法 +上传一个简单的文件,例如test.png,可以运行以下命令: ``` anypaste test.png ``` - -Sample output would be: +**输出示例:** ``` Current file: test.png Attempting to upload with plugin 'tinyimg' @@ -66,10 +59,10 @@ Direct Link: https://tinyimg.io/i/Sa1zsjj.png Upload complete. All files processed. Have a nice day! ``` +正如输出结果中所看到的,Anypaste通过自动匹配图像文件**test.png**发现了兼容的托管站点(https://tinyimg.io),并将文件上传到了该站点。此外,Anypaste也为我们提供了用于直接浏览/下载该文件的链接。 -As you can see in the above output, Anypaste has automatically found the compatible hosting site (https://tinyimg.io) to the given image file **test.png** and uploaded into it. Also, it gave us the direct link to view/download the uploaded file. +不仅png格式文件,你还可以上传任何其他图片格式的文件。例如,下面的命令将会上传gif格式文件: -Not just .png files, you can upload any other image file types. For example, the following command will upload file.gif: ``` $ anypaste file.gif Current file: file.gif @@ -85,19 +78,17 @@ Direct(ish) Link: https://thumbs.gfycat.com/MisguidedQuaintBergerpicard-size_res Upload complete. All files processed. Have a nice day! ``` - -You can share the link to your family, friends and colleagues. Here is the screenshot of an image that I just uploaded it to **gfycat** website. +你可以将链接分享给你的家庭,朋友和同事们。下图是我刚刚将图片上传到**gfycat**网站的截图。 [![][2]][3] -It also possible to multiple files (same file type or different) at once. +也可以一次同时上传多个(相同格式或不同格式)文件。 -Have a look at the following example. In this example, I am uploading two different files, an image and a video file: +下面的例子提供参考,这里我会上传两个不同的文件,包含一个图片文件和一个视频文件: ``` anypaste image.png video.mp4 ``` - -**Sample output:** +**输出示例:** ``` Current file: image.png Attempting to upload with plugin 'tinyimg' @@ -118,15 +109,14 @@ Delete/Edit: http://sendvid.com/wwy7w96h?secret=39c0af2d-d8bf-4d3d-bad3-ad37432a Upload complete. All files processed. Have a nice day! ``` +Anypaste针对两个文件自动发现了与之相兼容的托管站点并成功上传。 -Anypaste has automatically found the compatible hosting sites to both files and uploaded them successfully. - -As you may noticed in above examples in the usage section, Anypaste has picked the "best" plugin automatically. Also, you can upload files with a specific plugin. For instance, to upload files to **gfycat** site, run: +正如你在上述用法介绍部分的例子中注意到的,Anypaste会自动挑选最佳的插件。此外,你可以指定插件进行文件上传,这里提供一个上传**gfycat**类型文件的案例,运行以下命令: ``` anypaste -p gfycat file.gif ``` +**输出示例:** -Sample output: ``` Current file: file.gif Plugin 'streamable' is compatible, but missing config parameters: 'streamable_email' 'streamable_password' @@ -141,18 +131,15 @@ Direct(ish) Link: https://thumbs.gfycat.com/GrayDifferentCollie-size_restricted. Upload complete. All files processed. Have a nice day! ``` - -To upload with a specific plugin, bypassing compatibility checks, run: +如果要使用特定插件进行文件上传,可以通过以下命令绕过兼容性检查: ``` anypaste -fp gfycat file.gif ``` - -If you find a specific plugin is missing in the config file, you still can force Anypaste to use that specific plugin with '-xp' parameter. +如果你发现在配置文件中忽略了特定的插件,你仍然可以强制Anypaste去使用特定的插件,只不过需要加上'-xp'参数。 ``` anypaste -xp gfycat file.gif ``` - -To upload files with interactive mode, run it with "-i" flag: +如果想要以交互模式上传文件,可以在命令后加上'-i'标签: ``` $ anypaste -i file.gif Current file: file.gif @@ -172,73 +159,53 @@ Direct(ish) Link: https://thumbs.gfycat.com/WaryAshamedBlackbear-size_restricted Upload complete. All files processed. Have a nice day! ``` +正如你所见,Anypaste首先询问了我是否需要自动确定插件。因为我不想自动寻找插件,所以我回复了'No'。之后,Anypaste列出了所有可选择的插件,并要求我从列表中选择一个。同样的,你可以上传和共享不同类型的文件,相关文件会被上传到相兼容的站点。 -As you see, Anypaste first asked me to determine plugins automatically. I don't want it to find plugins automatically, so I answered "No". Then, it listed the available plugins and asked me to pick one from the list. Similarly, you can upload and share files of different types. The given files will uploaded to the compatible sites. - -Whenever you try to upload a video file, it will uploaded to the any one of following sites: +无论你何时上传一个视频文件,Anypaste都会将其上传到以下站点中的一个: 1. sendvid 2. streamable 3. gfycat +这里注意列表顺序,Anypaste将首先将文件上传到sendvid站点,如果没有sendvid的插件可供使用,Anypaste将会尝试顺序中的另外两个站点。当然你也可以通过更改配置文件来修改顺序。 - -Here note the order. Anypaste will first try to upload the file to sendvid site. If there is no plugin for sendvid, it will try the other two sites in the given order. Of course, you can change this in the config file. - -Images will be uploaded to: +图像文件上传站点: 1. tinyimg.io 2. vgy.me - - -Audio files will uploaded to: +音频文件上传站点: 1. instaud - - -Text files will uploaded to: +文本文件上传站点: 1. hastebin 2. ix.io 3. sprunge.us - - -Documents will be uploaded to: +文档上传站点: 1. docdroid - - -Any other files will uploaded to: +其他任意类型的文件上传站点: 1. jirafeau 2. file.io +上面列出来的部分站点一段特定的时间后会删除上传的内容,所以在上传和分享内容时应先明确这些站点的条款和条件。 +#### 结论 +在我看来,识别文件并决定将其上传到何处的想法非常棒,而且开发者也以恰当的方式完美地实现了它。毫无疑问,Anypaste对那些在互联网上需要频繁分享文件的人们非常有用,我希望你也能这么觉得。 -Some of the above listed sites will delete the contents after a particular period of time. So, check the those website's terms and conditions before uploading and sharing contents. - -Recommended Read: - -#### Conclusion - -In my opinion, the idea of file identification to determine where to upload the files is really brilliant, and the developer has perfectly used it in the right way. Anypaste will definitely be useful to everyone who share files frequently over Internet. I hope you will find it useful too. - -And, that's all for now. More good stuffs to come. - -Cheers! - - +这就是今天的全部内容,后面会有越来越多的好东西分享给大家。再见啦! -------------------------------------------------------------------------------- via: https://www.ostechnix.com/anypaste-share-upload-files-compatible-hosting-sites-automatically/ 作者:[SK][a] -译者:[译者ID](https://github.com/译者ID) +译者:[lixin555](https://github.com/lixin555) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -246,4 +213,4 @@ via: https://www.ostechnix.com/anypaste-share-upload-files-compatible-hosting-si [a]:https://www.ostechnix.com/author/sk/ [1]:https://www.ostechnix.com/easy-fast-way-share-files-internet-command-line/ [2]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]:http://www.ostechnix.com/wp-content/uploads/2017/10/gfycat.png () +[3]:http://www.ostechnix.com/wp-content/uploads/2017/10/gfycat.png From dc05429ee7c665fd0ee6339029915c58806f8fef Mon Sep 17 00:00:00 2001 From: lixin <56751837+lixin555@users.noreply.github.com> Date: Mon, 2 Dec 2019 16:41:27 +0800 Subject: [PATCH 735/800] translated --- ... And Upload Files To Compatible Hosting Sites Automatically.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md (100%) diff --git a/sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md b/translated/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md similarity index 100% rename from sources/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md rename to translated/tech/20171027 Share And Upload Files To Compatible Hosting Sites Automatically.md From a58cf9e4a849762d64e9b02690f3b90831d3b0f6 Mon Sep 17 00:00:00 2001 From: lixin <56751837+lixin555@users.noreply.github.com> Date: Mon, 2 Dec 2019 16:51:39 +0800 Subject: [PATCH 736/800] translating by lixin555 --- .../tech/20191118 How to use regular expressions in awk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191118 How to use regular expressions in awk.md b/sources/tech/20191118 How to use regular expressions in awk.md index cdf1468369..a0be0df4d7 100644 --- a/sources/tech/20191118 How to use regular expressions in awk.md +++ b/sources/tech/20191118 How to use regular expressions in awk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lixin555) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -265,7 +265,7 @@ via: https://opensource.com/article/19/11/how-regular-expressions-awk 作者:[Seth Kenlon][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lixin555](https://github.com/lixin555) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 81653174069565fd6812590df1fa96221db82d7d Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Mon, 2 Dec 2019 17:10:32 +0800 Subject: [PATCH 737/800] translated --- ...w System Information on Linux Every Time You Log into Shell.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md (100%) diff --git a/sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md b/translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md similarity index 100% rename from sources/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md rename to translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md From 39c7e5c2fc0bd6ab52c2ee5d816a27bf8f0f5a88 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Mon, 2 Dec 2019 21:21:08 +0800 Subject: [PATCH 738/800] translating --- sources/tech/20190827 curl exercises.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20190827 curl exercises.md b/sources/tech/20190827 curl exercises.md index 36eae2743b..db2a99986e 100644 --- a/sources/tech/20190827 curl exercises.md +++ b/sources/tech/20190827 curl exercises.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hanwckf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6f0c80e36f97bb6d5b1c24b8697089fb22a67ec8 Mon Sep 17 00:00:00 2001 From: LuMing <784315443@qq.com> Date: Mon, 2 Dec 2019 21:54:49 +0800 Subject: [PATCH 739/800] translating --- sources/tech/20191125 The many faces of awk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191125 The many faces of awk.md b/sources/tech/20191125 The many faces of awk.md index 0d498605f8..ec0c5b1b09 100644 --- a/sources/tech/20191125 The many faces of awk.md +++ b/sources/tech/20191125 The many faces of awk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (luuming) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From f4c114aff2609cd4a746309b24609f723162fcb3 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Mon, 2 Dec 2019 22:51:45 +0800 Subject: [PATCH 740/800] translating --- .../tech/20191024 Get sorted with sort at the command line.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191024 Get sorted with sort at the command line.md b/sources/tech/20191024 Get sorted with sort at the command line.md index ff291f39bc..8f78ce839e 100644 --- a/sources/tech/20191024 Get sorted with sort at the command line.md +++ b/sources/tech/20191024 Get sorted with sort at the command line.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From bffb9b6a724986bdcd46362454841aef5e192444 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Mon, 2 Dec 2019 23:03:38 +0800 Subject: [PATCH 741/800] translated 20191024 Get sorted with sort at the command line --- ...et sorted with sort at the command line.md | 250 ------------------ ...et sorted with sort at the command line.md | 249 +++++++++++++++++ 2 files changed, 249 insertions(+), 250 deletions(-) delete mode 100644 sources/tech/20191024 Get sorted with sort at the command line.md create mode 100644 translated/tech/20191024 Get sorted with sort at the command line.md diff --git a/sources/tech/20191024 Get sorted with sort at the command line.md b/sources/tech/20191024 Get sorted with sort at the command line.md deleted file mode 100644 index 8f78ce839e..0000000000 --- a/sources/tech/20191024 Get sorted with sort at the command line.md +++ /dev/null @@ -1,250 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Get sorted with sort at the command line) -[#]: via: (https://opensource.com/article/19/10/get-sorted-sort) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Get sorted with sort at the command line -====== -Reorganize your data in a format that makes sense to you—right from the -Linux, BSD, or Mac terminal—with the sort command. -![Coding on a computer][1] - -If you've ever used a spreadsheet application, then you know that rows can be sorted by the contents of a column. For instance, if you have a list of expenses, you might want to sort them by date or by ascending price or by category, and so on. If you're comfortable using a terminal, you may not want to have to use a big office application just to sort text data. And that's exactly what the [**sort**][2] command is for. - -### Installing - -You don't need to install **sort** because it's invariably included on any [POSIX][3] system. On most Linux systems, the **sort** command is bundled in a collection of utilities from the GNU organization. On other POSIX systems, such as BSD and Mac, the default **sort** command is not from GNU, so some options may differ. I'll attempt to account for both GNU and BSD implementations in this article. - -### Sort lines alphabetically - -The **sort** command, by default, looks at the first character of each line of a file and outputs each line in ascending alphabetic order. In the event that two characters on multiple lines are the same, it considers the next character. For example: - - -``` -$ cat distro.list -Slackware -Fedora -Red Hat Enterprise Linux -Ubuntu -Arch -1337 -Mint -Mageia -Debian -$ sort distro.list -1337 -Arch -Debian -Fedora -Mageia -Mint -Red Hat Enterprise Linux -Slackware -Ubuntu -``` - -Using **sort** doesn't change the original file. Sort is a filter, so if you want to preserve your data in its sorted form, you must redirect the output using either **>** or **tee**: - - -``` -$ sort distro.list | tee distro.sorted -1337 -Arch -Debian -[...] -$ cat distro.sorted -1337 -Arch -Debian -[...] -``` - -### Sort by column - -Complex data sets sometimes need to be sorted by something other than the first letter of each line. Imagine, for instance, a list of animals and each one's species and genus, and each "field" (a "cell" in a spreadsheet) is defined by a predictable delimiter character. This is such a common data format for spreadsheet exports that the CSV (comma-separated values) file extension exists to identify such files (although a CSV file doesn't have to be comma-separated, nor does a delimited file have to use the CSV extension to be valid and usable). Consider this example data set: - - -``` -Aptenodytes;forsteri;Miller,JF;1778;Emperor -Pygoscelis;papua;Wagler;1832;Gentoo -Eudyptula;minor;Bonaparte;1867;Little Blue -Spheniscus;demersus;Brisson;1760;African -Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed -Eudyptes;chrysocome;Viellot;1816;Southern Rockhopper -Torvaldis;linux;Ewing,L;1996;Tux -``` - -Given this sample data set, you can use the **\--field-separator** (use **-t** on BSD and Mac—or on GNU to reduce typing) option to set the delimiting character to a semicolon (because this example uses semicolons instead of commas, but it could use any character), and use the **\--key** (**-k** on BSD and Mac or on GNU to reduce typing) option to define which field to sort by. For example, to sort by the second field (starting at 1, not 0) of each line: - - -``` -sort --field-separator=";" --key=2 -Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed -Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper -Spheniscus;demersus;Brisson;1760;African -Aptenodytes;forsteri;Miller,JF;1778;Emperor -Torvaldis;linux;Ewing,L;1996;Tux -Eudyptula;minor;Bonaparte;1867;Little Blue -Pygoscelis;papua;Wagler;1832;Gentoo -``` - -That's somewhat difficult to read, but Unix is famous for its _pipe_ method of constructing commands, so you can use the **column** command to "prettify" the output. Using GNU **column**: - - -``` -$ sort --field-separator=";" \ -\--key=2 penguins.list | \ -column --table --separator ";" -Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed -Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper -Spheniscus   demersus    Brisson        1760  African -Aptenodytes  forsteri    Miller,JF      1778  Emperor -Torvaldis    linux       Ewing,L        1996  Tux -Eudyptula    minor       Bonaparte      1867  Little Blue -Pygoscelis   papua       Wagler         1832  Gentoo -``` - -Slightly more cryptic to the new user (but shorter to type), the command options on BSD and Mac: - - -``` -$ sort -t ";" \ --k2 penguins.list | column -t -s ";" -Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed -Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper -Spheniscus   demersus    Brisson        1760  African -Aptenodytes  forsteri    Miller,JF      1778  Emperor -Torvaldis    linux       Ewing,L        1996  Tux -Eudyptula    minor       Bonaparte      1867  Little Blue -Pygoscelis   papua       Wagler         1832  Gentoo -``` - -The **key** definition doesn't have to be set to **2**, of course. Any existing field may be used as the sorting key. - -### Reverse sort - -You can reverse the order of a sorted list with the **\--reverse** (**-r** on BSD or Mac or GNU for brevity): - - -``` -$ sort --reverse alphabet.list -z -y -x -w -[...] -``` - -You can achieve the same result by piping the output of a normal sort through [tac][4]. - -### Sorting by month (GNU only) - -In a perfect world, everyone would write dates according to the ISO 8601 standard: year, month, day. It's a logical method of specifying a unique date, and it's easy for computers to understand. And yet quite often, humans use other means of identifying dates, including months with pretty arbitrary names. - -Fortunately, the GNU **sort** command accounts for this and is able to sort correctly by month name. Use the **\--month-sort** (**-M**) option: - - -``` -$ cat month.list -November -October -September -April -[...] -$ sort --month-sort month.list -January -February -March -April -May -[...] -November -December -``` - -Months may be identified by their full name or some portion of their names. - -### Human-readable numeric sort (GNU only) - -Another common point of confusion between humans and computers is groups of numbers. For instance, humans often write "1024 kilobytes" as "1KB" because it's easier and quicker for the human brain to parse "1KB" than "1024" (and it gets easier the larger the number becomes). To a computer, though, a string such as 9KB is larger than, for instance, 1MB (even though 9KB is only a fraction of a megabyte). The GNU **sort** command provides the **\--human-numeric-sort** (**-h**) option to help parse these values correctly. - - -``` -$ cat sizes.list -2M -12MB -1k -9k -900 -7000 -$ sort --human-numeric-sort -900 -7000 -1k -9k -2M -12MB -``` - -There are some inconsistencies. For example, 16,000 bytes is greater than 1KB, but **sort** fails to recognize that: - - -``` -$ cat sizes0.list -2M -12MB -16000 -1k -$ sort -h sizes0.list -16000 -1k -2M -12MB -``` - -Logically, 16,000 should be written 16KB in this context, so GNU **sort** is not entirely to blame. As long as you are sure that your numbers are consistent, the **\--human-numeric-sort** can help parse human-readable numbers in a computer-friendly way. - -### Randomized sort (GNU only) - -Sometimes utilities provide the option to do the opposite of what they're meant to do. In a way, it makes no sense for a **sort** command to have the ability to "sort" a file randomly. Then again, the workflow of the command makes it a convenient feature to have. You _could_ use a different command, like [**shuf**][5], or you could just add an option to the command you're using. Whether it's bloat or ingenious UX design, the GNU **sort** command provides the means to sort a file arbitrarily. - -The purest form of arbitrary sorting is the **\--random-sort** or **-R** option (not to be confused with the **-r** option, which is short for **\--reverse**). - - -``` -$ sort --random-sort alphabet.list -d -m -p -a -[...] -``` - -You can run a random sort multiple times on a file for different results each time. - -### Sorted - -There are many more features available with the **sort** GNU and BSD commands, so spend some time getting to know the options. You'll be surprised at how flexible **sort** can be, especially when it's combined with other Unix utilities. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/get-sorted-sort - -作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) -[2]: https://en.wikipedia.org/wiki/Sort_(Unix) -[3]: https://en.wikipedia.org/wiki/POSIX -[4]: https://opensource.com/article/19/9/tac-command -[5]: https://www.gnu.org/software/coreutils/manual/html_node/shuf-invocation.html diff --git a/translated/tech/20191024 Get sorted with sort at the command line.md b/translated/tech/20191024 Get sorted with sort at the command line.md new file mode 100644 index 0000000000..85d1e816e9 --- /dev/null +++ b/translated/tech/20191024 Get sorted with sort at the command line.md @@ -0,0 +1,249 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get sorted with sort at the command line) +[#]: via: (https://opensource.com/article/19/10/get-sorted-sort) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +命令行用 sort 进行排序 +====== +按自己的需求重新整理数据 — 用 Linux,BSD 或 Mac 的 terminal — 使用 sort 命令。 +![Coding on a computer][1] + +如果你曾经用过数据表应用程序,你就会知道可以按列的内容对行进行排序。例如,如果你有一列价格,你可能希望对它们进行按日期或升序抑或按类别进行排序。如果你熟悉 terminal 的使用,你不会仅为了排序文本数据就去使用庞大的办公软件。这正是 [**sort**][2] 命令的用处。 + +### 安装 + +你不必安装 **sort** ,因为它包含在任意 [POSIX][3] 系统里。在大多数 Linux 系统中,**sort** 命令被 GNU 组织捆绑在实用工具集合中。在其他的 POSIX 系统中,像 BSD 和 Mac,默认的 **sort** 命令不是 GNU 提供的,所以有一些选项可能不一样。本文中我尽量对 GNU 和 BSD 两者的实现都进行说明。 + +### 按字母顺序排列行 + +**sort** 命令默认会读取文件每行的第一个字符并对每行按字母升序排序后输出。两行中的第一个字符相同的情况下,对下一个字符进行对比。例如: + + +``` +$ cat distro.list +Slackware +Fedora +Red Hat Enterprise Linux +Ubuntu +Arch +1337 +Mint +Mageia +Debian +$ sort distro.list +1337 +Arch +Debian +Fedora +Mageia +Mint +Red Hat Enterprise Linux +Slackware +Ubuntu +``` + +使用 **sort** 不会改变原文件。sort 仅起到过滤的作用,所以如果你希望按排序后的格式保存数据,你需要用 **>** 或 **tee** 进行重定向。 + + +``` +$ sort distro.list | tee distro.sorted +1337 +Arch +Debian +[...] +$ cat distro.sorted +1337 +Arch +Debian +[...] +``` + +### 按列排序 + +复杂的数据有时候不止需要对每行的第一个字符进行排序。例如,假设有一个动物列表,用可预见的分隔符分隔每一个「字段」(数据表中的「单元格」)。这类由数据表导出的格式很常见,CSV(comma-separated values,以逗号分隔的数据)后缀可以标识这些文件(虽然 CSV 文件不一定用逗号分隔,有分隔符的文件也不一定用 CSV 后缀)。以下数据作为示例: + + +``` +Aptenodytes;forsteri;Miller,JF;1778;Emperor +Pygoscelis;papua;Wagler;1832;Gentoo +Eudyptula;minor;Bonaparte;1867;Little Blue +Spheniscus;demersus;Brisson;1760;African +Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Eudyptes;chrysocome;Viellot;1816;Southern Rockhopper +Torvaldis;linux;Ewing,L;1996;Tux +``` + +对于这组示例数据,你可以用 **--field-separator** (在 BSD 和 Mac 用 **-t**,或 GNU 上可以用简写 **-t** )设置分隔符为分号(以为示例数据中是用分号而不是逗号,理论上分隔符可以是任意字符),用 **--key**( 在 BSD 和 Mac 上用 **-k**,或 GNU 上可以用简写 **-k**)选项指定哪个字段被排序。例如,对每行第二个字段进行排序(以 1 开头而不是 0): + + +``` +sort --field-separator=";" --key=2 +Megadyptes;antipodes;Milne-Edwards;1880;Yellow-eyed +Eudyptes;chrysocome;Viellot;1816;Sothern Rockhopper +Spheniscus;demersus;Brisson;1760;African +Aptenodytes;forsteri;Miller,JF;1778;Emperor +Torvaldis;linux;Ewing,L;1996;Tux +Eudyptula;minor;Bonaparte;1867;Little Blue +Pygoscelis;papua;Wagler;1832;Gentoo +``` + +结果有点不容易读,但是 Unix 以构造命令的 **pipe** 方法而闻名,所以你可以使用 **column** 命令美化输出结果。使用 GNU **column**: + + +``` +$ sort --field-separator=";" \ +\--key=2 penguins.list | \ +column --table --separator ";" +Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed +Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper +Spheniscus   demersus    Brisson        1760  African +Aptenodytes  forsteri    Miller,JF      1778  Emperor +Torvaldis    linux       Ewing,L        1996  Tux +Eudyptula    minor       Bonaparte      1867  Little Blue +Pygoscelis   papua       Wagler         1832  Gentoo +``` + +对于初学者可能有点不好理解(但是写起来简单),BSD 和 Mac 上的命令选项: + + +``` +$ sort -t ";" \ +-k2 penguins.list | column -t -s ";" +Megadyptes   antipodes   Milne-Edwards  1880  Yellow-eyed +Eudyptes     chrysocome  Viellot        1816  Southern Rockhopper +Spheniscus   demersus    Brisson        1760  African +Aptenodytes  forsteri    Miller,JF      1778  Emperor +Torvaldis    linux       Ewing,L        1996  Tux +Eudyptula    minor       Bonaparte      1867  Little Blue +Pygoscelis   papua       Wagler         1832  Gentoo +``` + +当然 **key** 不一定非要设为 **2**。任意存在的字段都可以被设为排序的 key。 + +### 逆序排列 + +你可以用 **--reverse**(BSD/Mac 上用 **-r**, GNU 也可以用简写 **-r**)选项来颠倒已经排好序的列表。 + + +``` +$ sort --reverse alphabet.list +z +y +x +w +[...] +``` + +你也可以把输出结果通过管道传给命令 [tac][4] 来实现相同的效果。 + +### 按月排序 (仅 GNU 支持) + +理想情况下,所有人都按照 ISO 8601 标准来写日期:年,月,日。这是一种合乎逻辑的指定精确日期的方法,也可以很容易地被计算机理解。也有很多情况下,人类用其他的方式标注日期,用很随意的名字表示月份。 + +幸运的是,GNU **sort** 命令能识别这种写法,并可以按月份的名称正确排序。使用 **--month-sort (-M)** 选项: + + +``` +$ cat month.list +November +October +September +April +[...] +$ sort --month-sort month.list +January +February +March +April +May +[...] +November +December +``` + +月份的全称和简写都可以被识别。 + +### 人类可读的数字排序(仅 GNU 支持) + +另一个广泛的人类和计算机的混淆点是数字的组合。例如,人类通常把 ”1024 kilobytes“ 写成 “1KB”,因为人类解析 ”1 KB“ 比 ”1024“ 要容易且更快(数字越大,这种差异越明显)。对于计算机来说,一个 9 KB 的字符串要比诸如 1 MB 的字符串大(尽管 9 KB 是 1 兆的很小一部分)。GNU **sort** 命令提供了**--human-numeric-sort (-h)** 选项来帮助正确解析这些值。 + + +``` +$ cat sizes.list +2M +12MB +1k +9k +900 +7000 +$ sort --human-numeric-sort +900 +7000 +1k +9k +2M +12MB +``` + +有一些情况例外。例如,16000 bytes 比 1 KB 大,但是 **sort** 识别不了。 + + +``` +$ cat sizes0.list +2M +12MB +16000 +1k +$ sort -h sizes0.list +16000 +1k +2M +12MB +``` + +逻辑上来说,这个示例中16000 应该写成 16 KB,所以也不应该全部归咎于GNU **sort** 。只要你确保数字的一致性,**--human-numeric-sort** 可以用一种计算机友好的方式解析成人类可读的数字。 + +### 随机排序(仅 GNU 支持) + +有时候工具也提供了一些与设计初衷相悖的选项。某种程度上说,**sort** 命令提供了对一个文件进行随机排序的能力没有任何意义。这个命令的工作流让这个特性变得很方便。你可以用其他的命令,像 [**shuf**][5] ,或者你可以用现在的命令添加一个选项。不管你认为它是一个臃肿的还是极具创造力的 UX 设计,GNU **sort** 命令提供了对文件进行随机排序的功能。 + +最纯粹的随机排序格式选项是 **--random-sort** 或 **-R**(不要跟 **-r** 混淆,**-r** 是 **--reverse** 的简写)。 + + +``` +$ sort --random-sort alphabet.list +d +m +p +a +[...] +``` + +每次对文件运行随机排序都会有不同的结果。 + +### 结语 + +GNU 和 BSD 命令 **sort** 还有很多功能,所以花点时间去了解这些选项。你会惊异于 **sort** 的灵活性,尤其是当它和其他的 Unix 工具一起使用时。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/get-sorted-sort + +作者:[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/code_computer_laptop_hack_work.png?itok=aSpcWkcl "Coding on a computer" +[2]: https://en.wikipedia.org/wiki/Sort_(Unix) +[3]: https://en.wikipedia.org/wiki/POSIX +[4]: https://opensource.com/article/19/9/tac-command +[5]: https://www.gnu.org/software/coreutils/manual/html_node/shuf-invocation.html From 23dfd71e9b5a87f170b08608875b986dc6065c35 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Dec 2019 23:33:41 +0800 Subject: [PATCH 742/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lxbwolf 恭喜你完成了第一篇贡献! --- .../tech/20191125 How to use loops in awk.md | 80 ++++++++----------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/translated/tech/20191125 How to use loops in awk.md b/translated/tech/20191125 How to use loops in awk.md index a200611ba2..c9fb42dd36 100644 --- a/translated/tech/20191125 How to use loops in awk.md +++ b/translated/tech/20191125 How to use loops in awk.md @@ -1,6 +1,6 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "How to use loops in awk" @@ -9,50 +9,50 @@ 在 awk 中怎么使用循环 ====== -来学习一下多次执行同一条命令的不同类型的循环。 -![arrows cycle symbol for failing faster][1] -awk 脚本有三个主要部分:BEGIN 和 END 函数(都可选),用户自己写的每次要执行的函数。某种程度上,awk 的主体部分就是一个循环,因为函数中的命令对每一条记录都会执行一次。然而,有时你希望对于一条记录执行多次命令,那么你就需要用到循环。 +> 来学习一下多次执行同一条命令的不同类型的循环。 + +![](https://img.linux.net.cn/data/attachment/album/201912/02/232951h3ibohlh77bk77d7.jpg) + +`awk` 脚本有三个主要部分:`BEGIN` 和 `END` 函数(都可选),用户自己写的每次要执行的函数。某种程度上,`awk` 的主体部分就是一个循环,因为函数中的命令对每一条记录都会执行一次。然而,有时你希望对于一条记录执行多次命令,那么你就需要用到循环。 有多种类型的循环,分别适合不同的场景。 ### while 循环 -一个 while 循环检测一个表达式,如果表达式为 *true* 就执行命令。当表达式变为 *false* 时,循环中断。 - +一个 `while` 循环检测一个表达式,如果表达式为 `true` 就执行命令。当表达式变为 `false` 时,循环中断。 ``` #!/bin/awk -f BEGIN { -        # Print the squares from 1 to 10 + # Loop through 1 to 10 -    i=1; -    while (i <= 10) { -        print "The square of ", i, " is ", i*i; -        i = i+1; -    } + i=1; + while (i <= 10) { + print i, " to the second power is ", i*i; + i = i+1; + } exit; } ``` -在这个简单实例中, awk 打印了变量 *i* 中的整数值的平方。**while (i <= 10)** 语句告诉 awk 仅在 *i* 的值小于或等于 10 时才执行循环。在循环最后一次执行时(*i* 的值是 10),循环终止。 +在这个简单实例中,`awk` 打印了放在变量 `i` 中的整数值的平方。`while (i <= 10)` 语句告诉 `awk` 仅在 `i` 的值小于或等于 10 时才执行循环。在循环最后一次执行时(`i` 的值是 10),循环终止。 -### Do while 循环 - -do-while 循环在关键字 **do** 之后执行命令。在每次循环结束时检测一个表达式来决定是否终止循环。仅在表达式返回 true 时才会重复执行命令(即还没有到终止循环的条件)。如果表达式返回 false,因为到了终止循环的条件所以循环被终止。 +### do-while 循环 +do-while 循环执行在关键字 `do` 之后的命令。在每次循环结束时检测一个测试表达式来决定是否终止循环。仅在测试表达式返回 `true` 时才会重复执行命令(即还没有到终止循环的条件)。如果测试表达式返回 `false`,因为到了终止循环的条件所以循环被终止。 ``` #!/usr/bin/awk -f BEGIN { -        i=2; -        do { -                print "The square of ", i, " is ", i*i; -                i = i + 1 -        } -        while (i < 10) + i=2; + do { + print i, " to the second power is ", i*i; + i = i + 1 + } + while (i < 10) exit; } @@ -60,28 +60,26 @@ exit; ### for 循环 -awk 中有两种 **for**循环。 - -一种 **for** 循环初始化一个变量,检测一个表达式,执行变量递增,当表达式的结果为 true 时循环就会一直执行。 +`awk` 中有两种 `for` 循环。 +一种 `for` 循环初始化一个变量,检测一个测试表达式,执行变量递增,当表达式的结果为 `true` 时循环就会一直执行。 ``` #!/bin/awk -f BEGIN { -    for (i=1; i <= 10; i++) { -        print "The square of ", i, " is ", i*i; -    } + for (i=1; i <= 10; i++) { + print i, " to the second power is ", i*i; + } exit; } ``` -另一种 **for** 循环设置一个有连续 index 的数组变量,对每一个索引执行一个命令集。换句话说,它用一个数组「收集」每一条命令执行后的结果。 +另一种 `for` 循环设置一个有连续索引的数组变量,对每一个索引执行一个命令集。换句话说,它用一个数组“收集”每一条命令执行后的结果。 -本例实现了一个简易版的 Unix 命令 **uniq** 。通过把一系列字符串作为 key 加到数组 a 中,当相同的 key 再次出现时就增加 value 的值,可以得到某个字符串出现的次数(就像 **uniq** 的 **--count** 选项)。如果你打印该数组的所有 key,将会得到出现过的所有字符串。 - -用 demo 文件 **colours.txt** (前一篇文章中的文件)来举例: +本例实现了一个简易版的 Unix 命令 `uniq`。通过把一系列字符串作为键加到数组 `a` 中,当相同的键再次出现时就增加键值,可以得到某个字符串出现的次数(就像 `uniq` 的 `--count` 选项)。如果你打印该数组的所有键,将会得到出现过的所有字符串。 +用演示文件 `colours.txt`(前一篇文章中的文件)来举例: ``` name       color  amount @@ -97,10 +95,7 @@ potato     brown  9 pineapple  yellow 5 ``` - - -这是 awk 版的简易 **uniq -c**: - +这是 `awk` 版的简易 `uniq -c`: ``` #! /usr/bin/awk -f @@ -115,8 +110,7 @@ END { } ``` -示例数据文件的第三列是第一列列出的条目的计数。你可以用一个数组和 **for** 循环来从 color 维度统计第三列的条目。 - +示例数据文件的第三列是第一列列出的条目的计数。你可以用一个数组和 `for` 循环来按颜色统计第三列的条目。 ``` #! /usr/bin/awk -f @@ -136,15 +130,11 @@ END { } ``` -你可以看到,在处理文件之前也需要在 **前置** 函数(仅仅执行一次)中打印一列表头。 +你可以看到,在处理文件之前也需要在 `BEFORE` 函数(仅仅执行一次)中打印一列表头。 ### 循环 -在任何编程语言中循环都是很重要的一部分,awk 也不例外。使用循环你可以控制 awk 脚本怎样去运行,它可以统计什么信息,还有它怎么去处理你的数据。我们下一篇文章会讨论 switch 语句,**continue** 和 **next**。 - -* * * - -你是否更想听这篇文章?本文已被收录进 [Hacker Public Radio](http://hackerpublicradio.org/eps.php?id=2330),一个来自黑客,面向黑客的社区技术博客。 +在任何编程语言中循环都是很重要的一部分,`awk` 也不例外。使用循环你可以控制 `awk` 脚本怎样去运行,它可以统计什么信息,还有它怎么去处理你的数据。我们下一篇文章会讨论 `switch`、`continue` 和 `next` 语句。 -------------------------------------------------------------------------------- @@ -153,7 +143,7 @@ via: https://opensource.com/article/19/11/loops-awk 作者:[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 1342f9267221cd137f6b5d4bb1c6b8325fe984d2 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Mon, 2 Dec 2019 23:36:39 +0800 Subject: [PATCH 743/800] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @lxbwolf 本文首发地址: https://linux.cn/article-11636-1.html 您的 LCTT 专页: https://linux.cn/lctt/lxbwolf 请注册领取 LCCN: https://lctt.linux.cn/ --- .../tech => published}/20191125 How to use loops in awk.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191125 How to use loops in awk.md (98%) diff --git a/translated/tech/20191125 How to use loops in awk.md b/published/20191125 How to use loops in awk.md similarity index 98% rename from translated/tech/20191125 How to use loops in awk.md rename to published/20191125 How to use loops in awk.md index c9fb42dd36..35c2b33d7a 100644 --- a/translated/tech/20191125 How to use loops in awk.md +++ b/published/20191125 How to use loops in awk.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11636-1.html" [#]: subject: "How to use loops in awk" [#]: via: "https://opensource.com/article/19/11/loops-awk" [#]: author: "Seth Kenlon https://opensource.com/users/seth" From c6278b6382b1c536a64f711a79c4680c1c0334f3 Mon Sep 17 00:00:00 2001 From: alim0x Date: Mon, 2 Dec 2019 23:52:44 +0800 Subject: [PATCH 744/800] [translating]20191108 My Linux story- Learning Linux in the 90s --- .../talk/20191108 My Linux story- Learning Linux in the 90s.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191108 My Linux story- Learning Linux in the 90s.md b/sources/talk/20191108 My Linux story- Learning Linux in the 90s.md index ae9bb5c230..11ba748cc8 100644 --- a/sources/talk/20191108 My Linux story- Learning Linux in the 90s.md +++ b/sources/talk/20191108 My Linux story- Learning Linux in the 90s.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (alim0x) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From cb482d8dc4e37704c9ac50a7d3c5a6bb6eba1f6b Mon Sep 17 00:00:00 2001 From: hanwckf Date: Tue, 3 Dec 2019 00:03:21 +0800 Subject: [PATCH 745/800] translated.1 --- sources/tech/20190827 curl exercises.md | 84 ---------------------- translated/tech/20190827 curl exercises.md | 81 +++++++++++++++++++++ 2 files changed, 81 insertions(+), 84 deletions(-) delete mode 100644 sources/tech/20190827 curl exercises.md create mode 100644 translated/tech/20190827 curl exercises.md diff --git a/sources/tech/20190827 curl exercises.md b/sources/tech/20190827 curl exercises.md deleted file mode 100644 index db2a99986e..0000000000 --- a/sources/tech/20190827 curl exercises.md +++ /dev/null @@ -1,84 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hanwckf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (curl exercises) -[#]: via: (https://jvns.ca/blog/2019/08/27/curl-exercises/) -[#]: author: (Julia Evans https://jvns.ca/) - -curl exercises -====== - -Recently I’ve been interested in how people learn things. I was reading Kathy Sierra’s great book [Badass: Making Users Awesome][1]. It talks about the idea of _deliberate practice_. - -The idea is that you find a small micro-skill that can be learned in maybe 3 sessions of 45 minutes, and focus on learning that micro-skill. So, as an exercise, I was trying to think of a computer skill that I thought could be learned in 3 45-minute sessions. - -I thought that making HTTP requests with `curl` might be a skill like that, so here are some curl exercises as an experiment! - -### what’s curl? - -curl is a command line tool for making HTTP requests. I like it because it’s an easy way to test that servers or APIs are doing what I think, but it’s a little confusing at first! - -Here’s a drawing explaining curl’s most important command line arguments (which is page 6 of my [Bite Size Networking][2] zine). You can click to make it bigger. - - - -### fluency is valuable - -With any command line tool, I think having fluency is really helpful. It’s really nice to be able to just type in the thing you need. For example recently I was testing out the Gumroad API and I was able to just type in: - -``` -curl https://api.gumroad.com/v2/sales \ - -d "access_token=" \ - -X GET -d "before=2016-09-03" -``` - -and get things working from the command line. - -### 21 curl exercises - -These exercises are about understanding how to make different kinds of HTTP requests with curl. They’re a little repetitive on purpose. They exercise basically everything I do with curl. - -To keep it simple, we’re going to make a lot of our requests to the same website: . httpbin is a service that accepts HTTP requests and then tells you what request you made. - - 1. Request - 2. Request . httpbin.org/anything will look at the request you made, parse it, and echo back to you what you requested. curl’s default is to make a GET request. - 3. Make a POST request to - 4. Make a GET request to , but this time add some query parameters (set `value=panda`). - 5. Request google’s robots.txt file ([www.google.com/robots.txt][3]) - 6. Make a GET request to and set the header `User-Agent: elephant`. - 7. Make a DELETE request to - 8. Request and also get the response headers - 9. Make a POST request to with the JSON body `{"value": "panda"}` - 10. Make the same POST request as the previous exercise, but set the Content-Type header to `application/json` (because POST requests need to have a content type that matches their body). Look at the `json` field in the response to see the difference from the previous one. - 11. Make a GET request to and set the header `Accept-Encoding: gzip` (what happens? why?) - 12. Put a bunch of a JSON in a file and then make a POST request to with the JSON in that file as the body - 13. Make a request to and set the header ‘Accept: image/png’. Save the output to a PNG file and open the file in an image viewer. Try the same thing with with different `Accept:` headers. - 14. Make a PUT request to - 15. Request , save it to a file, and open that file in your image editor. - 16. Request . You’ll get an empty response. Get curl to show you the response headers too, and try to figure out why the response was empty. - 17. Make any request to and just set some nonsense headers (like `panda: elephant`) - 18. Request and . Request them again and get curl to show the response headers. - 19. Request and set a username and password (with `-u username:password`) - 20. Download the Twitter homepage () in Spanish by setting the `Accept-Language: es-ES` header. - 21. Make a request to the Stripe API with curl. (see for how, they give you a test API key). Try making exactly the same request to . - - - --------------------------------------------------------------------------------- - -via: https://jvns.ca/blog/2019/08/27/curl-exercises/ - -作者:[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.amazon.com/Badass-Making-Awesome-Kathy-Sierra/dp/1491919019 -[2]: https://wizardzines.com/zines/bite-size-networking -[3]: http://www.google.com/robots.txt diff --git a/translated/tech/20190827 curl exercises.md b/translated/tech/20190827 curl exercises.md new file mode 100644 index 0000000000..95f071697b --- /dev/null +++ b/translated/tech/20190827 curl exercises.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (hanwckf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (curl exercises) +[#]: via: (https://jvns.ca/blog/2019/08/27/curl-exercises/) +[#]: author: (Julia Evans https://jvns.ca/) + +curl 练习 +====== + +最近,我对人们如何学习新事物感兴趣。我正在读 Kathy Sierra 的好书 [Badass: Making Users Awesome][1],它探讨了有关“刻意练习”的想法。这个想法是,你找到一个可以用三个45分钟课程内能够学会的小技能,并专注于学习这项小技能。因此,作为一项练习,我尝试考虑一项能够在3个45分钟课程内学会的计算机技能。 + +我认为使用 curl 构造 HTTP 请求也许就是这样的一项技能,所以这里有一些curl练习作为实验! + +### 什么是 curl ? + +curl 是用于构造 HTTP 请求的命令行工具。我喜欢使用 curl ,因为它能够很轻松地测试服务器或API的行为是否符合预期,但是刚开始接触它的时候会让你感到一些困惑! + +下面是一幅解释 curl 常用命令行参数的漫画 (在我的 [Bite Size Networking][2] 杂志的第6页)。 + + +### 熟能生巧 + +对于任何命令行工具,我认为熟练使用是很有帮助的,能够做到只输入必要的命令真是太好了。例如,最近我在测试 Gumroad API,我只需要输入: + +``` +curl https://api.gumroad.com/v2/sales \ + -d "access_token=" \ + -X GET -d "before=2016-09-03" +``` + +就能从命令行中得到想要的结果。 + +### 21 个 curl 练习 + +这些练习是用来理解如何使用 curl 构造不同种类的 HTTP 请求的,它们是故意重复的,基本上包含了我需要 curl 做的任何事情。 + +为了简单起见,我们将对 https://httpbin.org 发起一系列 HTTP 请求,httpbin 接受 HTTP 请求,然后在响应中回显你所发起的 HTTP 请求。 + + 1. 请求 + 2. 请求 ,httpbin.org/anything 将会解析你发起的请求,并且在响应中回显。curl 默认发起的是 GET 请求 + 3. 向 发起 GET 请求 + 4. 向 发起 GET 请求,但是这次需要添加一些查询参数(设置 `value=panda` ) + 5. 请求 Google 的 robots.txt 文件 ([www.google.com/robots.txt][3]) + 6. 向 发起 GET 请求,并且设置请求头为 `User-Agent: elephant` + 7. 向 发起 DELETE 请求 + 8. 请求 并获取响应头信息 + 9. 向 发起请求体为 JSON `{"value": "panda"}` 的 POST 请求 + 10. 发起与上一次相同的 POST 请求,但是这次要把请求头中的 `Content-Type` 字段设置成 `application/json`(因为 POST 请求需要一个与请求体相匹配的 `Content-Type` 请求头字段)。查看响应体中的 `json` 字段,对比上一次得到的响应体 + 11. 向 发起 GET 请求,并且在请求头中设置 `Accept-Encoding: gzip`(将会发生什么?为什么会这样?) + 12. 将一些 JSON 放在文件中,然后向 发起请求体为该文件的 POST 请求 + 13. 设置请求头为 `Accept: image/png` 并且向 发起请求,将输出保存为 PNG 文件,然后使用图片浏览器打开。尝试使用不同的 `Accept:` 字段去请求此 URL + 14. 向 发起 PUT 请求 + 15. 请求 并保存为文件,然后使用你的图片编辑器打开这个文件 + 16. 请求 ,你将会得到空的响应。让 curl 显示出响应头信息,并尝试找出响应内容为空的原因 + 17. 向 发起任意的请求,同时设置一些无意义的请求头(例如:`panda: elephant`) + 18. 请求 ,然后再次请求它们并且让 curl 显示响应头信息 + 19. 请求 并且设置用户名和密码(使用 `-u username:password`) + 20. 设置 `Accept-Language: es-ES` 的请求头用以下载 Twitter 的西班牙语主页 () + 21. 使用 curl 向 Stripe API 发起请求(请查看 了解如何使用,他们会给你一个测试用的 API key)。尝试向 发起相同的请求 + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/08/27/curl-exercises/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[hanwckf](https://github.com/hanwckf) +校对:[校对者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.amazon.com/Badass-Making-Awesome-Kathy-Sierra/dp/1491919019 +[2]: https://wizardzines.com/zines/bite-size-networking +[3]: http://www.google.com/robots.txt From 08c740984c88fe0792f444ceb225ba9b15c7d3e5 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Dec 2019 00:04:13 +0800 Subject: [PATCH 746/800] PRF @geekpi --- ...dress of a Domain in the Linux Terminal.md | 68 +++++++------------ 1 file changed, 26 insertions(+), 42 deletions(-) diff --git a/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md index 344d781010..e37a314d4c 100644 --- a/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md +++ b/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md @@ -1,34 +1,28 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 Commands to Find the IP Address of a Domain in the Linux Terminal) [#]: via: (https://www.2daygeek.com/linux-command-find-check-domain-ip-address/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -5 个用于在 Linux 终端中查找域 IP 地址的命令 +5 个用于在 Linux 终端中查找域名 IP 地址的命令 ====== -本教程介绍了如何在 Linux 终端验证域名或计算机名的 IP 地址。 +![](https://img.linux.net.cn/data/attachment/album/201912/03/000402c0ekkgku1f011kzt.jpg) -本教程将允许你一次检查多个域。 +本教程介绍了如何在 Linux 终端验证域名或计算机名的 IP 地址。本教程将允许你一次检查多个域。你可能已经使用过这些命令来验证信息。但是,我们将教你如何有效使用这些命令在 Linux 终端中识别多个域的 IP 地址信息。 -你可能已经使用过这些命令来验证信息。 +可以使用以下 5 个命令来完成此操作。 -但是,我们将教你如何有效使用这些命令在 Linux 终端中识别多个域的 IP 地址信息。 +* `dig` 命令:它是一个用于查询 DNS 名称服务器的灵活命令行工具。 +* `host` 命令:它是用于执行 DNS 查询的简单程序。 +* `nslookup` 命令:它用于查询互联网域名服务器。 +* `fping` 命令:它用于向网络主机发送 ICMP ECHO_REQUEST 数据包。 +* `ping` 命令:它用于向网络主机发送 ICMP ECHO_REQUEST 数据包。 -可以使用以下5个命令来完成此操作。 - - * **dig 命令:** dig 是用于查询 DNS名称服务器的灵活命令行工具。 -  * **host 命令:** host 是用于执行 DNS 查询的简单程序。 -  * **nslookup 命令:** nslookup 命令用于查询互联网域名服务器。 -  * **fping 命令:** fping 命令用于将 ICMP ECHO_REQUEST 数据包发送到网络主机。 -  * **ping 命令:** ping 命令用于向网络主机发送 ICMP ECHO_REQUEST 数据包。 - - - -为了测试,我们创建了一个名为 “domains-list.txt” 的文件,并添加了以下域。 +为了测试,我们创建了一个名为 `domains-list.txt` 的文件,并添加了以下域。 ``` # vi /opt/scripts/domains-list.txt @@ -40,11 +34,9 @@ linuxtechnews.com ### 方法 1:如何使用 dig 命令查找域的 IP 地址 -**[dig 命令][1]**代表 “domain information groper”,它是一个功能强大且灵活的命令行工具,用于查询 DNS 名称服务器。 +[dig 命令][1]代表 “域名信息抓手Domain Information Groper”,它是一个功能强大且灵活的命令行工具,用于查询 DNS 名称服务器。 -它执行 DNS 查询,并显示来自查询的名称服务器的返回信息。 - -大多数 DNS 管理员使用 dig 命令来解决 DNS 问题,因为它灵活、易用且输出清晰。 +它执行 DNS 查询,并显示来自查询的名称服务器的返回信息。大多数 DNS 管理员使用 `dig` 命令来解决 DNS 问题,因为它灵活、易用且输出清晰。 它还有批处理模式,可以从文件读取搜索请求。 @@ -67,7 +59,7 @@ dig $server +short done | paste -d " " - - - ``` -添加以上脚本后,给 “dig-command.sh” 文件设置可执行权限。 +添加以上内容到脚本后,给 `dig-command.sh` 文件设置可执行权限。 ``` # chmod +x /opt/scripts/dig-command.sh @@ -104,13 +96,9 @@ linuxtechnews.com. 104.27.145.3 ### 方法 2:如何使用 host 命令查找域的 IP 地址 -**[host 命令][2]**是一个简单的命令行程序,用于执行 **[DNS 查询][3]**。 +[host 命令][2]是一个简单的命令行程序,用于执行 [DNS 查询][3]。它通常用于将名称转换为 IP 地址,反之亦然。如果未提供任何参数或选项,`host` 将打印它的命令行参数和选项摘要。 -它通常用于将名称转换为 IP 地址,反之亦然。 - -如果未提供任何参数或选项,host 将打印它的命令行参数和选项摘要。 - -你可以在 host 命令中添加特定选项或记录类型来查看域中的所有记录类型。 +你可以在 `host` 命令中添加特定选项或记录类型来查看域中的所有记录类型。 ``` # host 2daygeek.com | grep "has address" | sed 's/has address/-/g' @@ -129,7 +117,7 @@ do host $server | grep "has address" | sed 's/has address/-/g' done ``` -添加以上脚本后,给 “host-command.sh” 文件设置可执行权限。 +添加以上内容到脚本后,给 `host-command.sh` 文件设置可执行权限。 ``` # chmod +x /opt/scripts/host-command.sh @@ -150,13 +138,9 @@ linuxtechnews.com - 104.27.145.3 ### 方法 3:如何使用 nslookup 命令查找域的 IP 地址 -**[nslookup 命令][4]**是用于查询互联网**[域名服务器(DNS)] [5]**的程序。 +[nslookup 命令][4]是用于查询互联网[域名服务器(DNS)] [5]的程序。 -nslookup 有两种模式,分别是交互式和非交互式。 - -交互模式允许用户查询名称服务器以获取有关各种主机和域的信息,或打印域中的主机列表。 - -非交互模式用于仅打印主机或域的名称和请求的信息。 +`nslookup` 有两种模式,分别是交互式和非交互式。交互模式允许用户查询名称服务器以获取有关各种主机和域的信息,或打印域中的主机列表。非交互模式用于仅打印主机或域的名称和请求的信息。 它是一个网络管理工具,可以帮助诊断和解决 DNS 相关问题。 @@ -178,7 +162,7 @@ do echo $server "-" nslookup -q=A $server | tail -n+4 | sed -e '/^$/d' -e 's/Address://g' | grep -v 'Name|answer' | xargs -n1 done | paste -d " " - - - ``` -添加以上脚本后,给 “nslookup-command.sh” 文件设置可执行权限。 +添加以上内容到脚本后,给 `nslookup-command.sh` 文件设置可执行权限。 ``` # chmod +x /opt/scripts/nslookup-command.sh @@ -196,11 +180,11 @@ linuxtechnews.com - 104.27.144.3 104.27.145.3 ### 方法 4:如何使用 fping 命令查找域的 IP 地址 -**[fping 命令][6]**是类似 ping 之类的程序,它使用互联网控制消息协议(ICMP)echo 请求来确定目标主机是否响应。 +[fping 命令][6]是类似 `ping` 之类的程序,它使用互联网控制消息协议(ICMP)echo 请求来确定目标主机是否响应。 -fping 与 ping 不同,因为它允许用户并行 ping 任意数量的主机。另外,它可以从文本文件输入主机。 +`fping` 与 `ping` 不同,因为它允许用户并行 ping 任意数量的主机。另外,它可以从文本文件输入主机。 -fping 发送 ICMP echo 请求,并以循环方式移到下一个目标,并且不等到目标主机做出响应。 +`fping` 发送 ICMP echo 请求,并以循环方式移到下一个目标,并且不等到目标主机做出响应。 如果目标主机答复,那么将其标记为活动主机并从要检查的目标列表中删除;如果目标在特定时间限制和/或重试限制内未响应,那么将其指定为不可访问。 @@ -214,7 +198,7 @@ fping 发送 ICMP echo 请求,并以循环方式移到下一个目标,并且 ### 方法 5:如何使用 ping 命令查找域的 IP 地址 -**[ping(Packet Internet Groper)命令][6]**是一个网络程序,用于测试 Internet 协议(IP)网络上主机的可用性/连接性。 +[ping 命令][6](数据包互联网抓手Packet Internet Groper)是一个网络程序,用于测试 Internet 协议(IP)网络上主机的可用性/连接性。 通过向目标主机发送互联网控制消息协议(ICMP)Echo 请求数据包并等待 ICMP Echo 应答来验证主机的可用性。 @@ -238,7 +222,7 @@ ping -c 2 $server | head -2 | tail -1 | awk '{print $5}' | sed 's/[(:)]//g' done | paste -d " " - - ``` -添加以上脚本后,给 “ping-command.sh” 文件设置可执行权限。 +添加以上内容到脚本后,给 `ping-command.sh` 文件设置可执行权限。 ``` # chmod +x /opt/scripts/ping-command.sh @@ -261,7 +245,7 @@ via: https://www.2daygeek.com/linux-command-find-check-domain-ip-address/ 作者:[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 94061686faa4ba07a7aa1af10114b6a079fc6687 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Dec 2019 00:04:47 +0800 Subject: [PATCH 747/800] PUB @geekpi https://linux.cn/article-11637-1.html --- ...o Find the IP Address of a Domain in the Linux Terminal.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md (99%) diff --git a/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md b/published/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md similarity index 99% rename from translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md rename to published/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md index e37a314d4c..eb23278dc6 100644 --- a/translated/tech/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md +++ b/published/20191126 5 Commands to Find the IP Address of a Domain in the Linux Terminal.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11637-1.html) [#]: subject: (5 Commands to Find the IP Address of a Domain in the Linux Terminal) [#]: via: (https://www.2daygeek.com/linux-command-find-check-domain-ip-address/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) From 177a3c7ee5849de4f8203e951f77babcb363ee8c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Dec 2019 00:51:20 +0800 Subject: [PATCH 748/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20Bash?= =?UTF-8?q?=20Script=20to=20Check=20Successful=20and=20Failed=20User=20Log?= =?UTF-8?q?in=20Attempts=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 Bash Script to Check Successful and Failed User Login Attempts on Linux.md --- ...and Failed User Login Attempts on Linux.md | 182 ++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 sources/tech/20191203 Bash Script to Check Successful and Failed User Login Attempts on Linux.md diff --git a/sources/tech/20191203 Bash Script to Check Successful and Failed User Login Attempts on Linux.md b/sources/tech/20191203 Bash Script to Check Successful and Failed User Login Attempts on Linux.md new file mode 100644 index 0000000000..8ae58c08da --- /dev/null +++ b/sources/tech/20191203 Bash Script to Check Successful and Failed User Login Attempts on Linux.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Bash Script to Check Successful and Failed User Login Attempts on Linux) +[#]: via: (https://www.2daygeek.com/bash-script-to-check-successful-and-failed-user-login-attempts-on-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +Bash Script to Check Successful and Failed User Login Attempts on Linux +====== + +One of the typical tasks of Linux administrators is to check successful and failed login attempts in the Linux system. + +This ensures that there are no illegal attempts at the environment. + +It is very difficult to manually verify them because the output of the **“/var/log/secure”** file looks awkward. + +To make this easier and more effective, we need to write a bash script. + +Yes, you can achieve this using the following **[Bash script][1]**. + +I’ve included two shell scripts in this tutorial. + +These scripts will show the number of users logged into the system for a given date. Also, it shows successful login attempts and failed login attempts. + +The first **[shell script][2]** allows you to verify user access information for any date available in the **“/var/log/secure”** file. + +The second bash script allows you to send a mail with user access information on a daily basis. + +### Method-1 : Shell Script to Check Successful and Failed User Login Attempts on Linux + +This script allows you to verify user access information for a given date from the terminal. + +``` +# vi /opt/scripts/user-access-details.sh + +#!/bin/bash +echo "" +echo -e "Enter the Date, Use Double Space for date from 1 to 9 (Nov 3) and use Single Space for date from 10 to 31 (Nov 30): \c" +read yday +MYPATH=/var/log/secure* +yday=$(date --date='yesterday' | awk '{print $2,$3}') +yday=$(date | awk '{print $2,$3}') +tuser=$(grep "$yday" $MYPATH | grep "Accepted|Failed" | wc -l) +suser=$(grep "$yday" $MYPATH | grep "Accepted password|Accepted publickey|keyboard-interactive" | wc -l) +fuser=$(grep "$yday" $MYPATH | grep "Failed password" | wc -l) +scount=$(grep "$yday" $MYPATH | grep "Accepted" | awk '{print $9;}' | sort | uniq -c) +fcount=$(grep "$yday" $MYPATH | grep "Failed" | awk '{print $9;}' | sort | uniq -c) +echo "--------------------------------------------" +echo " User Access Report on: $yday" +echo "--------------------------------------------" +echo "Number of Users logged on System: $tuser" +echo "Successful logins attempt: $suser" +echo "Failed logins attempt: $fuser" +echo "--------------------------------------------" +echo -e "Success User Details:\n $scount" +echo "--------------------------------------------" +echo -e "Failed User Details:\n $fcount" +echo "--------------------------------------------" +``` + +Set an executable **[Linux file permission][3]** to **“user-access-details-1.sh”** file. + +``` +# chmod +x /opt/scripts/user-access-details-1.sh +``` + +When you run the script you will receive an alert like the one below. + +``` +# sh /opt/scripts/user-access-details.sh + +Enter the Date, Use Double Space for date from 1 to 9 (Nov 3) and use Single Space for date from 10 to 31 (Nov 30): Nov 6 +------------------------------------------ + User Access Report on: Nov 6 +------------------------------------------ +Number of Users logged on System: 1 +Successful logins attempt: 1 +Failed logins attempt: 0 +------------------------------------------ +Success User Details: + 1 root +------------------------------------------ +Failed User Details: +------------------------------------------ +``` + +When you run the script you will receive an alert like the one below. + +``` +# sh /opt/scripts/user-access-details.sh + +Enter the Date, Use Double Space for date from 1 to 9 (Nov 3) and use Single Space for date from 10 to 31 (Nov 30): Nov 30 +------------------------------------------ + User Access Report on: Nov 30 +------------------------------------------ +Number of Users logged on System: 20 +Successful logins attempt: 14 +Failed logins attempt: 6 +------------------------------------------ +Success User Details: + 1 daygeek + 1 root + 3 u1 + 4 u2 + 1 u3 + 2 u4 + 2 u5 +------------------------------------------ +Failed User Details: + 3 u1 + 3 u4 +------------------------------------------ +``` + +### Method-2 : Bash Script to Check Successful and Failed User Login Attempts With eMail Alert. + +This Bash script allows you to send a mail with user access details on a daily basis via email for yesterday’s date. + +``` +# vi /opt/scripts/user-access-details-2.sh + +#!/bin/bash +/tmp/u-access.txt +SUBJECT="User Access Reports on "date"" +MESSAGE="/tmp/u-access.txt" +TO="[email protected]" +MYPATH=/var/log/secure* +yday=$(date --date='yesterday' | awk '{print $2,$3}') +tuser=$(grep "$yday" $MYPATH | grep "Accepted|Failed" | wc -l) +suser=$(grep "$yday" $MYPATH | grep "Accepted password|Accepted publickey|keyboard-interactive" | wc -l) +fuser=$(grep "$yday" $MYPATH | grep "Failed password" | wc -l) +scount=$(grep "$yday" $MYPATH | grep "Accepted" | awk '{print $9;}' | sort | uniq -c) +fcount=$(grep "$yday" $MYPATH | grep "Failed" | awk '{print $9;}' | sort | uniq -c) +echo "--------------------------------------------" >> $MESSAGE +echo " User Access Report on: $yday" >> $MESSAGE +echo "--------------------------------------------" >> $MESSAGE +echo "Number of Users logged on System: $tuser" >> $MESSAGE +echo "Successful logins attempt: $suser" >> $MESSAGE +echo "Failed logins attempt: $fuser" >> $MESSAGE +echo "--------------------------------------------" >> $MESSAGE +echo -e "Success User Details:\n $scount" >> $MESSAGE +echo "--------------------------------------------" >> $MESSAGE +echo -e "Failed User Details:\n $fcount" >> $MESSAGE +echo "--------------------------------------------" >> $MESSAGE +mail -s "$SUBJECT" "$TO" < $MESSAGE +``` + +Set an executable permission to **“user-access-details-2.sh”** file. + +``` +# chmod +x /opt/scripts/user-access-details-2.sh +``` + +Finally add a **[cronjob][4]** to automate this. It will run everyday at 8’o clock. + +``` +# crontab -e + +0 8 * * * /bin/bash /opt/scripts/user-access-details-2.sh +``` + +**Note:** You will be getting an email alert everyday at 8 o’clock, which is for previous day’s user access information. + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/bash-script-to-check-successful-and-failed-user-login-attempts-on-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/category/bash-script/ +[2]: https://www.2daygeek.com/category/shell-script/ +[3]: https://www.2daygeek.com/understanding-linux-file-permissions/ +[4]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ From 1bffb49b4812394b23531290d84bc61b4bbe9fc5 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Dec 2019 00:52:07 +0800 Subject: [PATCH 749/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20App=20?= =?UTF-8?q?Highlight:=20Caligator=20is=20a=20Beautiful=20Calculator=20&=20?= =?UTF-8?q?Converter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 App Highlight- Caligator is a Beautiful Calculator - Converter.md --- ...r is a Beautiful Calculator - Converter.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20191203 App Highlight- Caligator is a Beautiful Calculator - Converter.md diff --git a/sources/tech/20191203 App Highlight- Caligator is a Beautiful Calculator - Converter.md b/sources/tech/20191203 App Highlight- Caligator is a Beautiful Calculator - Converter.md new file mode 100644 index 0000000000..b177be913e --- /dev/null +++ b/sources/tech/20191203 App Highlight- Caligator is a Beautiful Calculator - Converter.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (App Highlight: Caligator is a Beautiful Calculator & Converter) +[#]: via: (https://itsfoss.com/caligator/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +App Highlight: Caligator is a Beautiful Calculator & Converter +====== + +You will find [lots of useful applications for Linux][1], however, not all of them focus primarily on the user experience. + +Sure, the user interface may end up being something nice and simple but not necessarily pleasing to look at. + +For the very same reason, I wanted to have a calculator and converter app on Linux similar to [Numi][2] (which is available only for macOS). I know we already have a superb calculator app like [Qalculate][3] but I am not a fan of its simple looking (read boring) interface. + +Recently, I came across something very similar – ‘[Caligator][4]‘ made by [Team XenoX][5]. + +### It’s Not Your Typical Calculator + +![][6] + +When compared to traditional calculator apps – this is something different. It lets you calculate or convert by simply typing on it (as you can see in the image above). + +Just like you type in to search for something on Google (or on [privacy-oriented Google alternatives][7]), the user has to just type the instruction naturally to get the output. + +Not just limited to the ability to understand instructions for conversions, it also displays the output as you type. So, you do not have to wait and press another button to get the result. + +![How Caligator Works][8] + +### Feature Overview + +![Caligator Screenshot][9] + +For now, you can perform any kind of arithmetic calculations and convert things like Currency, Length, Weight, and more. + +You can choose between a dark or light theme. However, for now, the app might get stuck when you try to change the theme. Atleast, I’m facing this issue right now on Pop!_OS 19.04. + +They would fix the issue in the next update probably. + +In addition to what’s possible, the developers have planned (as per the [official announcement][10]) the following features for the next update: + + * Font size preferences + * Export options + * Click to copy + * More themes + + + +### Getting Caligator on Linux + +You can directly head on to find its [GitHub releases][11] page and download the asset suitable for you. + +For Linux, they have three file formats available: AppImage, Deb files and source code. + +I suggest downloading the [AppImage][12] file. You just have to give it execute permission and then you can run Caligator on any Linux distribution. + +In addition to Linux, you can also try it on your Mac/Windows machine. + +[Caligator][4] + +**Wrapping Up** + +Caligator is still under development so you may encounter bugs. If you do, please open a bug report for the developers on their GitHub repository. + +While this may be in its early stage of development now, it is definitely an impressive project which should incorporate interesting features in the near future. + +I remember that elementary OS also has a [similar application called NaSC][13]. You may want to check it out as well. + +What do you think about ‘Caligator’? Also, if you know about some interesting new open source projects for desktop Linux, let us know in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/caligator/ + +作者:[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/essential-linux-applications/ +[2]: https://numi.app/ +[3]: https://itsfoss.com/qalculate/ +[4]: https://caligator.now.sh/ +[5]: https://dev.to/teamxenox +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/caligator-screenshot.png?ssl=1 +[7]: https://itsfoss.com/privacy-search-engines/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/caligator-works.gif?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/caligator-screenshot-1.jpg?ssl=1 +[10]: https://dev.to/teamxenox/introducing-caligator-a-simple-yet-powerful-open-source-calculator-convertor-5f86 +[11]: https://github.com/sarthology/caligator/releases +[12]: https://itsfoss.com/use-appimage-linux/ +[13]: https://itsfoss.com/math-ubuntu-nasc/ From fc7afc0512886293e97f6dd6aa5818f1c64280b7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Dec 2019 00:52:58 +0800 Subject: [PATCH 750/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191202=20Holida?= =?UTF-8?q?y=20gift=20guide:=20Linux=20and=20open=20source=20tech=20gadget?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191202 Holiday gift guide- Linux and open source tech gadgets.md --- ...ide- Linux and open source tech gadgets.md | 109 ++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 sources/tech/20191202 Holiday gift guide- Linux and open source tech gadgets.md diff --git a/sources/tech/20191202 Holiday gift guide- Linux and open source tech gadgets.md b/sources/tech/20191202 Holiday gift guide- Linux and open source tech gadgets.md new file mode 100644 index 0000000000..abc9c9f3e4 --- /dev/null +++ b/sources/tech/20191202 Holiday gift guide- Linux and open source tech gadgets.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Holiday gift guide: Linux and open source tech gadgets) +[#]: via: (https://opensource.com/article/19/12/gadgets-holiday-wishlist) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +Holiday gift guide: Linux and open source tech gadgets +====== +Each of these gadgets encourages learning, exploring, and tinkering, +qualities that reflect the values and interests of open source +enthusiasts. +![new techie gadgets representing innovation][1] + +Everything on Opensource.com's annual selection of tech gadgets would make an excellent holiday gift for your friends and family—or even something to add to your own holiday wishlist. Each of these gadgets encourages learning, exploring, and tinkering, qualities that reflect the values and interests of open source enthusiasts. + +### Circuit Playground Express + +![Circuit Playground Express][2] + +The [Circuit Playground Express][3] packs a wide array of interesting tech into a tiny, programmable package, which makes it an excellent choice for wearable projects. It features a motion sensor, temperature sensor, light sensor, sound sensor, speaker, 10 lights that can display any color, and much more. It can be programmed using block-based, drag-and-drop coding or JavaScript using [Microsoft MakeCode for Adafruit][4], or it can be programmed in Python using [CircuitPython][5]. Advanced users can use the [Arduino IDE][6] to program the board. + +### FreedomBox + +![FreedomBox][7] + +[FreedomBox][8] is a self-hosted, privacy-focused alternative to a wide variety of online services. With FreedomBox, you can handle your email with a web-based IMAP client, calendar, online chatting, file storage, and [more][9] without being tied to services outside of your control. The FreedomBox software is built around Debian GNU/Linux, and all the services it can provide are open source. If you want a ready-to-go home server, you can purchase the [Pioneer edition FreedomBox Home Server][10]. If you want to be more "hands-on," you can download the [FreedomBox software][11] and install it on the supported hardware of your choice. + +### Hack laptop + +![Hack computer][12] + +The [Hack][13] laptop is an ASUS E406MA laptop preloaded with a version of [Endless OS][14] that adds learning activities designed to teach children how to program. With only 4GB of RAM and a 64GB eMMC drive for storage, the Hack laptop is not a super-powerful computer, but it is a nice laptop for basic tasks like word processing, web browsing, and email. If the pre-installed Endless OS is not right for the user, the hardware is compatible with recent releases of most other Linux distributions. + +### Kano Computer Kit + +![Kano Computer Kit][15] + +The [Kano Computer Kit][16] is a computer kit based around a custom Raspberry Pi 3 and running the open source [Kano OS][17]. Users follow step-by-step instructions to build their own computer. Once the computer is assembled, there are more than 100 programming activities that provide even more learning and entertainment. The Kano Computer Kit comes with everything needed to get started, except a monitor. The more expensive [Computer Kit Touch][18] comes with a touchscreen display. + +### micro:bit + +![micro:bit][19] + +The [micro:bit][20] is a tiny, programmable circuit board that is great for learning and making. The board features an array of lights on one side of the circuit board, and the board can be programmed to respond to button presses, light, motion, and temperature. It can be programmed using drag-and-drop block or JavaScript using the [MakeCode editor][21], or it can be programmed in Python. + +### pi-top [4] + +![pi-top \[4\]][22] + +The [pi-top [4]][23] is a kit designed to work with the Raspberry Pi 4. This kit includes a case, cables, and a selection of programmable sensors, buttons, and LEDs. The pi-top [4] is designed to work with [pi-topOS][24], but the kit can work reasonably well with other Raspberry Pi [operating systems][25]. + +### Raspberry Pi 4 (and other models) + +![Raspberry Pi 4][26] + +Of all the single-board computers on the market, the Raspberry Pi is probably the most well-known. Part of the reason for the Raspberry Pi's fame is the copious amount of ancillary material available for learning about projects that can be made using a Raspberry Pi. The [_MagPi Magazine_][27] is published monthly, contains tons of interesting projects, and is free to download. So if you give or receive the official [Raspberry Pi 4 Desktop Kit][28], another Raspberry Pi kit from a vendor, or a custom project built around a Raspberry Pi, you are sure to have an excellent gift, one that can keep on giving as _MagPi_ publishes more and more tutorials. + +### Bonus: Tux Super Key Sticker + +![Tux Super Key Keyboard Sticker][29] + +Sure, a sticker is not a tech gadget, but this [Tux sticker][30] from Think Penguin can turn the Windows key on any computer keyboard into a Tux key. This inexpensive sticker can provide a little extra Linux-ness to any computer keyboard. The sticker is also a great item to buy in bulk and give out throughout the year as a Linux advocacy item. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/gadgets-holiday-wishlist + +作者:[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/innovation_virtual_gadgets_device_drone.png?itok=JTAgRb-1 (new techie gadgets representing innovation) +[2]: https://opensource.com/sites/default/files/uploads/circuit_playground_express.jpg (Circuit Playground Express) +[3]: https://learn.adafruit.com/adafruit-circuit-playground-express/overview +[4]: https://learn.adafruit.com/makecode +[5]: https://www.adafruit.com/category/956 +[6]: https://www.arduino.cc/en/Main/Software +[7]: https://opensource.com/sites/default/files/uploads/freedombox_pioneer_edition.jpg (FreedomBox) +[8]: https://freedombox.org +[9]: https://wiki.debian.org/FreedomBox/Features +[10]: https://freedombox.org/buy/ +[11]: https://freedombox.org/download/ +[12]: https://opensource.com/sites/default/files/uploads/endless_hack_laptop.jpg (Hack computer) +[13]: https://hack-computer.com/ +[14]: https://endlessos.com/download/ +[15]: https://opensource.com/sites/default/files/uploads/kano_computer_kit.jpeg (Kano Computer Kit) +[16]: https://kano.me/store/us/products/computer-kit +[17]: https://kano.me/downloadable/us +[18]: https://kano.me/us/store/products/computer-kit-touch +[19]: https://opensource.com/sites/default/files/uploads/microbit.png (micro:bit) +[20]: https://www.microbit.org/ +[21]: https://makecode.microbit.org/ +[22]: https://opensource.com/sites/default/files/uploads/pi-top_4.png (pi-top [4]) +[23]: https://www.pi-top.com/products/pi-top-4 +[24]: https://www.pi-top.com/products/os +[25]: https://www.raspberrypi.org/downloads/ +[26]: https://opensource.com/sites/default/files/uploads/raspberry_pi_4_model_b.jpg (Raspberry Pi 4) +[27]: https://magpi.raspberrypi.org/ +[28]: https://www.raspberrypi.org/blog/whats-inside-the-raspberry-pi-4-desktop-kit/ +[29]: https://opensource.com/sites/default/files/uploads/tux_key_sticker.jpg (Tux Super Key Keyboard Sticker) +[30]: https://www.thinkpenguin.com/gnu-linux/tux-super-key-keyboard-sticker From c8e637cf97e5a5877b5d4733982967c536489163 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Tue, 3 Dec 2019 00:53:16 +0800 Subject: [PATCH 751/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191202=20Use=20?= =?UTF-8?q?the=20Window=20Maker=20desktop=20on=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191202 Use the Window Maker desktop on Linux.md --- ...2 Use the Window Maker desktop on Linux.md | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 sources/tech/20191202 Use the Window Maker desktop on Linux.md diff --git a/sources/tech/20191202 Use the Window Maker desktop on Linux.md b/sources/tech/20191202 Use the Window Maker desktop on Linux.md new file mode 100644 index 0000000000..9f8dcc2f2a --- /dev/null +++ b/sources/tech/20191202 Use the Window Maker desktop on Linux.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use the Window Maker desktop on Linux) +[#]: via: (https://opensource.com/article/19/12/linux-window-maker-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Use the Window Maker desktop on Linux +====== +This article is part of a special series of 24 days of Linux desktops. +Take a step back in time with Window Maker, which implements the old +Unix NeXTSTEP environment for today's users. +![Penguin with green background][1] + +Before Mac OS X, there was a quirky closed-source Unix system called [NeXTSTEP][2]. Sun Microsystems later made NeXTSTEP's underpinnings an open specification, which enabled other projects to create free and open source versions of many NeXT libraries and components. GNUStep implemented the bulk of NeXTSTEP's libraries, and [Window Maker][3] implemented its desktop environment. + +Window Maker mimics the NeXTSTEP desktop GUI closely and provides some interesting insight into what Unix was like in the late '80s and early '90s. It also reveals some of the foundational concepts behind window managers like Fluxbox and Openbox. + +You can install Window Maker from your distribution's repository. To try it out, log out of your desktop session after the installation is complete. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your default desktop, so you must override the default when logging in. + +To switch to Window Maker on GDM: + +![Selecting the Window Maker desktop in GDM][4] + +And on KDM: + +![Selecting the Window Maker desktop in KDM][5] + +### Window Maker dock + +By default, the Window Maker desktop is empty but for a few _docks_ in each corner. As in NeXTSTEP, in Window Maker, a dock area is where major applications can go to be minimized as icons, where launchers can be created for quick access to common applications, and where tiny "dockapps" can run. + +You can try out a dockapp by searching for "dockapp" in your software repository. They tend to be network and system monitors, audio-setting panels, clocks, and similar. Here's Window Maker running on Fedora: + +![Window Maker running on Fedora][6] + +### Application menu + +To access the application menu, right-click anywhere on the desktop. To close it again, right-click. Window Maker isn't a desktop environment; rather it's a window manager. It helps you arrange and manage windows. Its only bundled application is called [WPrefs][7] (or more commonly, Window Maker Preferences), a settings application that helps you configure commonly used settings, while the application menu provides access to other options, including themes. + +The applications you run are entirely up to you. Within Window Maker, you can choose to run KDE applications, GNOME applications, and applications that are not considered part of any major desktop. Your work environment is yours to create, and you can manage it with Window Maker. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-window-maker-desktop + +作者:[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/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://en.wikipedia.org/wiki/NeXTSTEP +[3]: https://www.windowmaker.org/ +[4]: https://opensource.com/sites/default/files/uploads/advent-windowmaker-gdm.jpg (Selecting the Window Maker desktop in GDM) +[5]: https://opensource.com/sites/default/files/uploads/advent-windowmaker-kdm.jpg (Selecting the Window Maker desktop in KDM) +[6]: https://opensource.com/sites/default/files/uploads/advent-windowmaker.jpg (Window Maker running on Fedora) +[7]: http://www.windowmaker.org/docs/guidedtour/prefs.html From ba2682545453af5c4c0199c092c01881aa7d5fe0 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Tue, 3 Dec 2019 01:01:24 +0800 Subject: [PATCH 752/800] translating --- .../tech/20191114 Debugging Software Deployments with strace.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191114 Debugging Software Deployments with strace.md b/sources/tech/20191114 Debugging Software Deployments with strace.md index 1754792ab5..ed80c84912 100644 --- a/sources/tech/20191114 Debugging Software Deployments with strace.md +++ b/sources/tech/20191114 Debugging Software Deployments with strace.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hanwckf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From c5871ebcf8a6787fa20455b4aaa9a6695472ad22 Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 3 Dec 2019 08:40:35 +0800 Subject: [PATCH 753/800] translated --- ...ster, lower power Tesla GPU accelerator.md | 70 ------------------- ...ster, lower power Tesla GPU accelerator.md | 56 +++++++++++++++ 2 files changed, 56 insertions(+), 70 deletions(-) delete mode 100644 sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md create mode 100644 translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md diff --git a/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md deleted file mode 100644 index cc2a666e32..0000000000 --- a/sources/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md +++ /dev/null @@ -1,70 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Nvidia quietly unveils faster, lower power Tesla GPU accelerator) -[#]: via: (https://www.networkworld.com/article/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Nvidia quietly unveils faster, lower power Tesla GPU accelerator -====== -Nvidia has upgraded its Volta line of Tesla GPU-accelerator cards to work faster using the same power as its old model. -client - -Nvidia was all over Supercomputing 19 last week, not surprisingly, and made a lot of news which we will get into later. But overlooked was perhaps the most interesting news of all: a new generation graphics-acceleration card that is faster and way more power efficient. - -Multiple attendees and news sites spotted it at the show, and Nvidia confirmed to me that this is indeed a new card. Nvidia’s “Volta” generation of Tesla GPU-accelerator cards has been out since 2017, so an upgrade was well overdue. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - -The V100S comes only in PCI Express 3 form factor for now but is expected to eventually support Nvidia’s SXM2 interface. SXM is a dual-slot card design by Nvidia that requires no connection to the power supply, unlike the PCIe cards. SXM2 allows the GPU to communicate either with each other or to the CPU through Nvidia’s NVLink, a high-bandwidth, energy-efficient interconnect that can transfer data up to ten times faster than PCIe. - -[][2] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][2] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -With this card, Nvidia is claiming 16.4 single-precision TFLOPS, 8.2 double-precision TFLOPS, and Tensor Core performance of up to 130 TFLOPS. That is only a 4-to-5 percent improvement over the V100 SXM2 design, but 16-to-17 percent faster than the PCIe V100 variant. - -Memory capacity remains at 32GB but Nvidia added High Bandwidth Memory 2 (HBM2) to increase memory performance to 1,134GB/s, a 26 percent improvement over both PCIe and SXM2. - -Now normally a performance boost would see a concurrent increase in power demand, but in this case, the power envelope for the PCIe card is 250 watts, same as the prior generation PCIe card. So this card delivers 16-to-17 percent more compute performance and 26 percent more memory bandwidth at the same power draw. - -**Other News** - -Nvidia made some other news at the conference: - - * A new reference design and ecosystem support for its GPU-accelerated Arm-based reference servers for high-performance computing. The company says it has support from HPE/Cray, Marvell, Fujitsu, and Ampere, the startup led by former Intel executive Renee James looking to build Arm-based server processors. - * These companies will use Nvidia's reference design, which consists of hardware and software components, to build their own GPU-accelerated servers for everything from hyperscale cloud providers to high-performance storage and exascale supercomputing. The design also comes with CUDA-X, a special version of Nvidia’s CUDA GPU development language for Arm processors. - * Launch of Nvidia Magnum IO suite of software designed to help data scientists and AI and high-performance-computing researchers process massive amounts of data in minutes rather than hours. It is optimized to eliminate storage and I/O bottlenecks to deliver up to 20x faster data processing for multi-server, multi-GPU computing nodes. - * Nvidia and DDN, developer of AI and multicloud data management, announced a bundling of DDN’s A3ITM data management system with Nvidia’s DGX SuperPOD systems with so customers can deploy HPC infrastructure with minimal complexity and reduced timelines. The SuperPODs would also come with the new NVIDIA Magnum IO software stack. - * DDN said that SuperPOD was able to be deployed within hours and a single appliance could scale all to 80 nodes.  Benchmarks over a variety of different deep-learning models showed that the DDN system could keep a DGXSuperPOD system fully saturated with data. - - - -**Now see** [**10 of the world's fastest supercomputers**][3] - -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/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.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/newsletters/signup.html -[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[3]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html -[4]: https://www.facebook.com/NetworkWorld/ -[5]: https://www.linkedin.com/company/network-world diff --git a/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md new file mode 100644 index 0000000000..0f0b7477e2 --- /dev/null +++ b/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Nvidia quietly unveils faster, lower power Tesla GPU accelerator) +[#]: via: (https://www.networkworld.com/article/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Nvidia 悄悄推出更快、更低功耗的 Tesla GPU 加速器 +====== +Nvidia 升级了其 Volta 系列的 Tesla GPU 加速卡,使其能够以旧型号的相同功率更快地工作。 + +Nvidia 上周举行了 Supercomputing 19 大会,不出意外的是公布了很多新闻,这些我们将稍后提到。但被忽略的一条或许是其中最有趣的:一张更快、功耗更低的新一代图形加速卡。 + +多名与会者与多个新闻站点发现了这点,Nvidia 向我证实这确实是一张新卡。Nvidia 的 “Volta” 这代 Tesla GPU 加速卡在 2017 年就已淘汰,因此升级工作应该早已过期。 + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +V100S 目前仅提供 PCI Express 3 接口,但有望最终支持 Nvidia 的 SXM2 接口。SXM 是 Nvidia 的双插槽卡设计,与 PCIe 卡不同,它不需要连接电源。SXM2 允许 GPU 通过 Nvidia 的 NVLink(一种高带宽,节能互连)相互之间或与 CPU 进行通信,其数据传输速度比 PCIe 快十倍。 + +借助此卡,Nvidia 声称拥有单精度 16.4 TFLOPS,双精度 8.2 TFLOPS 并且 Tensor Core 性能高达 130 TFLOPS。这仅比 V100 SXM2 设计提高了 4% 至 5%,但比 PCIe V100 变体提高了 16% 至 17%。 + +内存容量保持在 32 GB,但 Nvidia 添加了 High Bandwidth Memory 2(HBM2),以将内存性能提高到 1,134 GB/s,这比 PCIe 和 SXM2 都提高了 26%。 + +通常情况下,性能提升将同时导致功率增加,但在这里,PCIe 卡的总体功率为 250 瓦,与上一代 PCIe 卡相同。因此,在相同功耗下,该卡可额外提供 16-17% 的计算性能,并增加 26% 的内存带宽。 + +**其他新闻** + +Nvidia 在会上还发布了其他新闻: + + * 其 GPU 加速的基于 Arm 的高性能计算参考服务器的新参考设计和生态系统支持。该公司表示,它得到了 HPE/Cray、Marvell、富士通和 Ampere 的支持,Ampere 是 Intel 前高管勒尼·詹姆斯(Renee James)领导的一家初创公司,它希望建立基于 Arm 的服务器处理器。 +  * 这些公司将使用 Nvidia 的参考设计(包括硬件和软件组件)来使用 GPU 构建从超大规模云提供商到高性能存储和百亿亿次超级计算等。该设计还带来了 CUDA-X,这是 Nvidia 用于 Arm 处理器的 CUDA GPU 的特殊版本开发语言。 +  * 推出 Nvidia Magnum IO 套件,旨在帮助数据科学家和 AI 以及高性能计算研究人员在几分钟而不是几小时内处理大量数据。它经过优化,消除了存储和 I/O 瓶颈,可为多服务器、多 GPU 计算节点提供高达 20 倍的数据处理速度。 +  * Nvidia 和 DDN (AI 以及多云数据管理开发商)宣布将 DDN 的 A3ITM 数据管理系统与 Nvidia 的 DGX SuperPOD 系统捆绑在一起,以便客户能够以最小的复杂性和更短的时限部署 HPC 基础架构。SuperPOD 还带有新的 NVIDIA Magnum IO 软件栈。 +  * DDN 表示,SuperPOD 能够在数小时内部署,并且单个设备可扩展至 80 个节点。不同的深度学习模型的基准测试表明,DDN 系统可以使 DGXSuperPOD 系统完全保持数据饱和。 + + +在 [Facebook][4] 和 [LinkedIn][5] 加入 Network World 社区评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.html + +作者:[Andy Patrizio][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/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 3967079ccd2ad4fd82d89def9412d79776882f5f Mon Sep 17 00:00:00 2001 From: geekpi Date: Tue, 3 Dec 2019 08:58:10 +0800 Subject: [PATCH 754/800] translating --- .../tech/20191129 A quick introduction to Toolbox on Fedora.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md b/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md index 788d7e646d..e320696435 100644 --- a/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md +++ b/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 07569ce5abdd206aacc8743054c2ee77eabbed00 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Dec 2019 23:35:34 +0800 Subject: [PATCH 755/800] PRF @geekpi --- ...ster, lower power Tesla GPU accelerator.md | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md index 0f0b7477e2..2990bed70a 100644 --- a/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md +++ b/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Nvidia quietly unveils faster, lower power Tesla GPU accelerator) @@ -9,15 +9,16 @@ Nvidia 悄悄推出更快、更低功耗的 Tesla GPU 加速器 ====== -Nvidia 升级了其 Volta 系列的 Tesla GPU 加速卡,使其能够以旧型号的相同功率更快地工作。 + +> Nvidia 升级了其 Volta 系列的 Tesla GPU 加速卡,使其能够以旧型号的相同功率更快地工作。 + +![](https://images.idgesg.net/images/article/2019/01/nvidia_logo-2-100785663-large.jpg) Nvidia 上周举行了 Supercomputing 19 大会,不出意外的是公布了很多新闻,这些我们将稍后提到。但被忽略的一条或许是其中最有趣的:一张更快、功耗更低的新一代图形加速卡。 多名与会者与多个新闻站点发现了这点,Nvidia 向我证实这确实是一张新卡。Nvidia 的 “Volta” 这代 Tesla GPU 加速卡在 2017 年就已淘汰,因此升级工作应该早已过期。 -[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] - -V100S 目前仅提供 PCI Express 3 接口,但有望最终支持 Nvidia 的 SXM2 接口。SXM 是 Nvidia 的双插槽卡设计,与 PCIe 卡不同,它不需要连接电源。SXM2 允许 GPU 通过 Nvidia 的 NVLink(一种高带宽,节能互连)相互之间或与 CPU 进行通信,其数据传输速度比 PCIe 快十倍。 +V100S 目前仅提供 PCI Express 3 接口,但有望最终支持 Nvidia 的 SXM2 接口。SXM 是 Nvidia 的双插槽卡设计,与 PCIe 卡不同,它不需要连接电源。SXM2 允许 GPU 通过 Nvidia 的 NVLink(一种高带宽、节能的互连)相互之间或与 CPU 进行通信,其数据传输速度比 PCIe 快十倍。 借助此卡,Nvidia 声称拥有单精度 16.4 TFLOPS,双精度 8.2 TFLOPS 并且 Tensor Core 性能高达 130 TFLOPS。这仅比 V100 SXM2 设计提高了 4% 至 5%,但比 PCIe V100 变体提高了 16% 至 17%。 @@ -25,18 +26,15 @@ V100S 目前仅提供 PCI Express 3 接口,但有望最终支持 Nvidia 的 SX 通常情况下,性能提升将同时导致功率增加,但在这里,PCIe 卡的总体功率为 250 瓦,与上一代 PCIe 卡相同。因此,在相同功耗下,该卡可额外提供 16-17% 的计算性能,并增加 26% 的内存带宽。 -**其他新闻** +### 其他新闻 Nvidia 在会上还发布了其他新闻: - * 其 GPU 加速的基于 Arm 的高性能计算参考服务器的新参考设计和生态系统支持。该公司表示,它得到了 HPE/Cray、Marvell、富士通和 Ampere 的支持,Ampere 是 Intel 前高管勒尼·詹姆斯(Renee James)领导的一家初创公司,它希望建立基于 Arm 的服务器处理器。 -  * 这些公司将使用 Nvidia 的参考设计(包括硬件和软件组件)来使用 GPU 构建从超大规模云提供商到高性能存储和百亿亿次超级计算等。该设计还带来了 CUDA-X,这是 Nvidia 用于 Arm 处理器的 CUDA GPU 的特殊版本开发语言。 -  * 推出 Nvidia Magnum IO 套件,旨在帮助数据科学家和 AI 以及高性能计算研究人员在几分钟而不是几小时内处理大量数据。它经过优化,消除了存储和 I/O 瓶颈,可为多服务器、多 GPU 计算节点提供高达 20 倍的数据处理速度。 -  * Nvidia 和 DDN (AI 以及多云数据管理开发商)宣布将 DDN 的 A3ITM 数据管理系统与 Nvidia 的 DGX SuperPOD 系统捆绑在一起,以便客户能够以最小的复杂性和更短的时限部署 HPC 基础架构。SuperPOD 还带有新的 NVIDIA Magnum IO 软件栈。 -  * DDN 表示,SuperPOD 能够在数小时内部署,并且单个设备可扩展至 80 个节点。不同的深度学习模型的基准测试表明,DDN 系统可以使 DGXSuperPOD 系统完全保持数据饱和。 - - -在 [Facebook][4] 和 [LinkedIn][5] 加入 Network World 社区评论热门主题。 +* 其 GPU 加速的基于 Arm 的高性能计算参考服务器的新参考设计和生态系统支持。该公司表示,它得到了 HPE/Cray、Marvell、富士通和 Ampere 的支持,Ampere 是 Intel 前高管勒尼·詹姆斯(Renee James)领导的一家初创公司,它希望建立基于 Arm 的服务器处理器。 +* 这些公司将使用 Nvidia 的参考设计(包括硬件和软件组件)来使用 GPU 构建从超大规模云提供商到高性能存储和百亿亿次超级计算等。该设计还带来了 CUDA-X,这是 Nvidia 用于 Arm 处理器的 CUDA GPU 的特殊版本开发语言。 +* 推出 Nvidia Magnum IO 套件,旨在帮助数据科学家和 AI 以及高性能计算研究人员在几分钟而不是几小时内处理大量数据。它经过优化,消除了存储和 I/O 瓶颈,可为多服务器、多 GPU 计算节点提供高达 20 倍的数据处理速度。 +* Nvidia 和 DDN (AI 以及多云数据管理开发商)宣布将 DDN 的 A3ITM 数据管理系统与 Nvidia 的 DGX SuperPOD 系统捆绑在一起,以便客户能够以最小的复杂性和更短的时限部署 HPC 基础架构。SuperPOD 还带有新的 NVIDIA Magnum IO 软件栈。 +* DDN 表示,SuperPOD 能够在数小时内部署,并且单个设备可扩展至 80 个节点。不同的深度学习模型的基准测试表明,DDN 系统可以使 DGXSuperPOD 系统完全保持数据饱和。 -------------------------------------------------------------------------------- @@ -45,7 +43,7 @@ via: https://www.networkworld.com/article/3482097/nvidia-quietly-unveils-faster- 作者:[Andy Patrizio][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 3162fd448400a53ca8526cd93529a1536a4ac8ef Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Tue, 3 Dec 2019 23:36:11 +0800 Subject: [PATCH 756/800] PUB @geekpi https://linux.cn/article-11640-1.html --- ...ietly unveils faster, lower power Tesla GPU accelerator.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/news => published}/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md (98%) diff --git a/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md b/published/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md similarity index 98% rename from translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md rename to published/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md index 2990bed70a..cbb4c747d1 100644 --- a/translated/news/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md +++ b/published/20191127 Nvidia quietly unveils faster, lower power Tesla GPU accelerator.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11640-1.html) [#]: subject: (Nvidia quietly unveils faster, lower power Tesla GPU accelerator) [#]: via: (https://www.networkworld.com/article/3482097/nvidia-quietly-unveils-faster-lower-power-tesla-gpu-accelerator.html) [#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) From 75d94ffdcf6940973875430626eab33ac6f6359d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Dec 2019 00:54:35 +0800 Subject: [PATCH 757/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20Using?= =?UTF-8?q?=20Ansible=20to=20organize=20your=20SSH=20keys=20in=20AWS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md --- ...nsible to organize your SSH keys in AWS.md | 123 ++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md diff --git a/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md b/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md new file mode 100644 index 0000000000..f82603fefb --- /dev/null +++ b/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Ansible to organize your SSH keys in AWS) +[#]: via: (https://fedoramagazine.org/using-ansible-to-organize-your-ssh-keys-in-aws/) +[#]: author: (Daniel Leite de Abreu https://fedoramagazine.org/author/dabreu/) + +Using Ansible to organize your SSH keys in AWS +====== + +![][1] + +If you’ve worked with instances in Amazon Web Services (AWS) for a long time, you may run into this common issue. It’s not technical, but more to do with the human nature of getting too comfortable. When you launch a new instance in a region you haven’t used recently, you may end up creating a new SSH key pair. This leads to having too many keys, which can become complicated and disordered. + +This article shows you a way to have your public key in all regions. A recent [Fedora Magazine article][2] includes one solution. But the solution in this article is automated even further, and in a more concise and scalable way. + +Say you have a Fedora 30 or 31 desktop system where your key is stored, and Ansible is installed as well. These two things together provide the solution to this problem and many more. + +With Ansible’s [ec2_key module][3], you can create a simple playbook that will maintain your SSH key pair in all regions. If you need to add or remove keys, it’s as simple as adding and removing lines from a file. + +### Setting up and running the playbook + +To use the playbook, first install necessary dependencies for the _ec2_key_ module: + +``` +$ sudo dnf install python3-boto python3-boto3 +``` + +The playbook is simple: you need only to change your key and its name as in the example below. After that, run the playbook and it iterates over all the public AWS regions listed. The example also includes the restricted regions in case you have access. To include them, uncomment each line as needed, save the file, and then run the playbook again. + +``` +--- +- name: Maintain an ssh key pair in ec2 + hosts: localhost + connection: local + gather_facts: no + vars: + ansible_python_interpreter: python + tasks: + - name: Make available your ssh public key in ec2 for new instances + ec2_key: + name: "YOUR KEY NAME GOES HERE" + key_material: 'YOUR KEY GOES HERE' + state: present + region: "{{ item }}" + with_items: + - us-east-2 #US East (Ohio) + - us-east-1 #US East (N. Virginia) + - us-west-1 #US West (N. California) + - us-west-2 #US West (Oregon) + - ap-east-1 #Asia Pacific (Hong Kong) + - ap-south-1 #Asia Pacific (Mumbai) + - ap-northeast-2 #Asia Pacific (Seoul) + - ap-southeast-1 #Asia Pacific (Singapore) + - ap-southeast-2 #Asia Pacific (Sydney) + - ap-northeast-1 #Asia Pacific (Tokyo) + - ca-central-1 #Canada (Central) + - eu-central-1 #EU (Frankfurt) + - eu-west-1 #EU (Ireland) + - eu-west-2 #EU (London) + - eu-west-3 #EU (Paris) + - eu-north-1 #EU (Stockholm) + - me-south-1 #Middle East (Bahrain) + - sa-east-1 #South America (Sao Paulo) + # - us-gov-east-1 #AWS GovCloud (US-East) + # - us-gov-west-1 #AWS GovCloud (US-West) + # - ap-northeast-3 #Asia Pacific (Osaka-Local) + # - cn-north-1 #China (Beijing) + # - cn-northwest-1 #China (Ningxia) +``` + +This playbook requires AWS access via API, as well. To do this, use environment variables as follows: + +``` +$ AWS_ACCESS_KEY="aws-access-key-id" AWS_SECRET_KEY="aws-secret-key-id" ansible-playbook ec2-playbook.yml +``` + +Another option is to install the aws cli tools and add the credentials as explained in a [previous Fedora Magazine article][4]. It is **not recommended** to insert these values in the playbook if you store it anywhere online! You can find this playbook code on [GitHub][5]. + +After the playbook finishes, confirm that your key is available on the AWS console. To do that: + + 1. Log into your AWS console + 2. Go to **EC2 > Key Pairs** + 3. You should see your key listed. The only limitation is that you have to check region-by-region with this method. + + + +Another way is to use a quick command in a shell to do this check for you. + +First create a variable with all regions on the playbook: + +``` +AWS_REGION="us-east-1 us-west-1 us-west-2 ap-east-1 ap-south-1 ap-northeast-2 ap-southeast-1 ap-southeast-2 ap-northeast-1 ca-central-1 eu-central-1 eu-west-1 eu-west-2 eu-west-3 eu-north-1 me-south-1 sa-east-1" +``` + +Then do a for loop and you will get the result from aws API: + +``` +for each in ${AWS_REGION} ; do aws ec2 describe-key-pairs --key-name ; done +``` + +Keep in mind that to do the above you need to have the aws cli installed. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-ansible-to-organize-your-ssh-keys-in-aws/ + +作者:[Daniel Leite de Abreu][a] +选题:[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/dabreu/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/12/ansible-aws-keys-816x345.jpg +[2]: https://fedoramagazine.org/ssh-key-aws-regions/ +[3]: https://docs.ansible.com/ansible/latest/modules/ec2_key_module.html +[4]: https://fedoramagazine.org/aws-tools-fedora/ +[5]: https://github.com/dlabreu/aws From 7828ea8c7557a3468f8a4a01b58e4eeeb5cd5bf6 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Dec 2019 01:25:27 +0800 Subject: [PATCH 758/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20An=20i?= =?UTF-8?q?diot's=20guide=20to=20Kubernetes,=20low-code=20developers,=20an?= =?UTF-8?q?d=20other=20industry=20trends?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md --- ...e developers, and other industry trends.md | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md diff --git a/sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md b/sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md new file mode 100644 index 0000000000..3bf4b93917 --- /dev/null +++ b/sources/tech/20191203 An idiot-s guide to Kubernetes, low-code developers, and other industry trends.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (An idiot's guide to Kubernetes, low-code developers, and other industry trends) +[#]: via: (https://opensource.com/article/19/12/technology-advice-and-other-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +An idiot's guide to Kubernetes, low-code developers, and other industry trends +====== +A weekly look at open source community, market, and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [An idiot's guide to Kubernetes][2] + +> Kubernetes has already grown to encompass new features which have made it a better container platform for enterprise software. Elements like security and advanced networking have been pulled into the main body of the upstream Kubernetes code, and are now available for everyone to use. +> +> It is, however, true that there will always be supplementary needs to cover other aspects of an enterprise solution; things like logging and performance monitoring. This is where secondary packages like Istio come into play, bringing extra functionality, but keeping the Kubernetes core to a reasonable size and set of features. + +**The impact**: I've always found that it is easy to take awareness of technology developments for granted. When everyone you interact with is also on the "cutting edge" your perspective gets skewed to the point where you might even think that someone who doesn't know about the latest in (INSERT PREFERRED TECHNOLOGY HERE) just isn't keeping up, when really it just hasn't started to impact their ability to do what they need to. Those people aren't idiots; they're our friends, customers, partners, collaborators, and communities. + +## [Gartner: What to consider before adopting low-code development][3] + +> Despite the focus on business IT teams, Gartner finds an increasingly important developer community is the central IT professional developers needing rapid development of simple applications, or to build minimum viable products or multi-experience capabilities. And when application leaders use low-code within conventional application projects, they might want to use a standard IT DevOps automation approach alongside low-code tooling.  + +**The impact**: A growing range of use cases and user experiences can be addressed and delivered through applications that require less time and skill to create. And low-code developers will also probably coalesce into a distinct group with their own norms and subculture. + +## [Nokia argues cloud-native is essential to 5G core][4] + +> Nokia outlined five key business objectives for 5G that can only be delivered by a cloud-native environment. Those include: better bandwidth, latency, and density; the extension of services via network slicing to new enterprises, industries, and [IoT][5] markets; rapid service deployments defined by agility and efficiency; new services that go beyond traditional broadband, voice, and messaging; and the advent of digital services that harness end-to-end networking to capture more revenue. + +**The impact**: This is most meaningful in the context of the increasing number of things that will be hooked up to the network. 4G was primarily about more and more mobile phones; 5G is only really necessary when you start connecting everything else. Whereas 4G meant richer apps on our phones, 5G has very little to do with phones at all. + +## [APIs: The hidden business accelerator][6] + +> For organisations to have a successful digital transformation, an API strategy is critical. From unlocking valuable data to speeding up development time, APIs are the humble heroes of the digital era. Those already experimenting with APIs are already feeling the benefits. For example, research has shown that 53 percent of businesses that have used APIs cite them as increasing productivity, and 29 percent claim they experienced revenue growth as a direct result of API use. When treated as discoverable and reusable products that live beyond one project, APIs help lay a flexible foundation for continuous change. + +**The impact**: The hidden business accelerator is actually the idea that capability should be packaged in a way that allows it to be repurposed and combined in contexts that its original provider didn't anticipate. + +_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/technology-advice-and-other-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/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.cbronline.com/feature/an-idiots-guide-to-kubernetes +[3]: https://www.computerweekly.com/feature/Gartner-What-to-consider-before-adopting-low-code-development +[4]: https://www.sdxcentral.com/articles/news/nokia-argues-cloud-native-is-essential-to-5g-core/2019/11/ +[5]: https://www.sdxcentral.com/5g/iot/ (IoT) +[6]: https://www.cbronline.com/opinion/digital-transformation-3 From 7fcc8e945707fc66aa5919e98dda03ae287fe57a Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Dec 2019 01:25:51 +0800 Subject: [PATCH 759/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20Why=20?= =?UTF-8?q?use=20the=20Pantheon=20desktop=20for=20Linux=20Elementary=20OS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md --- ...antheon desktop for Linux Elementary OS.md | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md diff --git a/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md new file mode 100644 index 0000000000..f66f0a5bd8 --- /dev/null +++ b/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why use the Pantheon desktop for Linux Elementary OS) +[#]: via: (https://opensource.com/article/19/12/pantheon-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Why use the Pantheon desktop for Linux Elementary OS +====== +This article is part of a special series on Linux desktops. Get a +much-loved Mac OS feature on Linux with the Pantheon desktop for +Elementary OS. +![A person programming][1] + +Would you pay $20 for a Linux desktop? I would, and in fact, I regularly choose to pay more than that when I download free software! The reason I do this is that open source is worth it. For a copy of [Elementary OS][2], US$ 20 happens to be the default asking price (you can download it for $1 or even $0 if you can't afford anything more). What you get in return is an excellent and heavily curated distribution that ships with its own Pantheon desktop design. + +You may find Pantheon included in a software repository, as it is open source, but more likely, you'll have to download and install [Elementary][3] Linux to experience it. If you're not ready to install Elementary on your computer as the main OS, you can install it into a virtual machine, like [GNOME Boxes][4]. + +The Pantheon desktop is clean, attractive, and features many of the little things many users want in a desktop but could never quite get from the usual Linux desktops. + +### Pantheon desktop tour + +At first glance, the Pantheon desktop looks a little like Cinnamon or Budgie or the Classic mode of GNOME 3. However, the most exciting features of Pantheon are the smallest touches. It excels in all the places you notice the very least, until that place is the only thing you're looking at one day, and you realize that the way it works has literally improved your quality of life, to say nothing of making your day a lot nicer. + +The clearest example of this is **file name highlighting**. For decades, Mac OS has had a much-loved feature whereby you can highlight the displayed name of an important file. People use this feature as a quick visual indicator to tell themselves which file is the "best" version of several, or which file should be sent to a friend, or which file still needs work. They're arbitrary colors and can mean whatever the user wants them to mean. Most importantly, it's noticeable visual metadata. + +Users switching from Mac OS tend to miss this feature in GNOME and KDE and every other desktop option Linux has on offer. Pantheon quietly and casually solves that problem. + +![A highlighted file in the Pantheon desktop][5] + +Of course, that's just one example of many. Pantheon is filled with small features that you don't think about until you need them. + +The desktop is refined and attractive, with all the intuitive parts that have disappeared from many other desktops. In many ways, it has taken the best of the good ideas of many different interfaces and refrained from implementing the excesses. + +![Pantheon desktop on Elementary OS][6] + +### Customizing the Pantheon desktop + +The Pantheon desktop represents a pretty clear vision of how a computer ought to be operated. The "problem" with this kind of design (outside of open source, at least) is that one person's preference may not be another person's efficiency. + +But this is open source. Things can be changed, and whatever can't be changed can be discarded for a different option. Pantheon is definitely a desktop for a specific set of users, but even those of us with our own expectations of how a desktop ought to work might find Pantheon refreshingly more flexible than it first appears. There are overrides for many built-in designs, and when you can't adjust something to your liking, you can easily choose an alternative application. The theme engine ensures that your replacement application looks integrated with the rest of your desktop, and the usual Linux system buses ensure that all of your chosen applications communicate with one another as expected. + +![Which one is the guest?][7] + +As compromises go, this one does a lot to meet you halfway. + +### A welcome addition + +Etymology aside, this desktop truly is an answer to the prayers of many Linux users. Whether it's your style or not, the Pantheon desktop is an important and welcome addition to the Linux user experience. Try it for yourself and see if it's the good news you've been waiting for. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/pantheon-linux-desktop + +作者:[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_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://elementary.io/ +[3]: http://elementary.io +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://opensource.com/sites/default/files/uploads/advent-pantheon-highlight.jpg (A highlighted file in the Pantheon desktop) +[6]: https://opensource.com/sites/default/files/uploads/advent-pantheon.jpg (Pantheon desktop on Elementary OS) +[7]: https://opensource.com/sites/default/files/uploads/advent-pantheon-pcmanfm.jpg (Which one is the guest?) From b834d1237cdf7c1e2f4e654791fb241dbb28d07d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Dec 2019 01:26:15 +0800 Subject: [PATCH 760/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20How=20?= =?UTF-8?q?to=20write=20a=20security=20integration=20module=20for=20Ansibl?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 How to write a security integration module for Ansible.md --- ...security integration module for Ansible.md | 189 ++++++++++++++++++ 1 file changed, 189 insertions(+) create mode 100644 sources/tech/20191203 How to write a security integration module for Ansible.md diff --git a/sources/tech/20191203 How to write a security integration module for Ansible.md b/sources/tech/20191203 How to write a security integration module for Ansible.md new file mode 100644 index 0000000000..5cbe10e482 --- /dev/null +++ b/sources/tech/20191203 How to write a security integration module for Ansible.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to write a security integration module for Ansible) +[#]: via: (https://opensource.com/article/19/12/how-write-security-integration-module-ansible) +[#]: author: (Adam Miller https://opensource.com/users/maxamillion) + +How to write a security integration module for Ansible +====== +Ansible automation offers a lot of potential for the information +security industry. Learn how to take advantage of it in this summary of +an AnsibleFest 2019 talk. +![Security monster][1] + +[Ansible][2] is a [radically simple IT automation platform][3] that makes your applications and systems easier to deploy. It allows you to avoid writing scripts or custom code to deploy and update your applications, systems, and various classifications of network-attached devices. Ansible allows you to automate in a language that approaches plain English with no agents to install on remote systems and uses native protocols based on device type—such as SSH for Unix-style operating systems, WinRM for Windows systems, REST APIs (**httpapi**) for REST API appliances, and many more. + +### Background + +At [AnsibleFest 2019][4], my colleague [Sumit Jaiswal][5] and I gave a talk, titled "[Ansible development deep dive: How to write a security integration module and collection for Ansible][6]," about something that we have been working on. This article recaps the finer points of our talk; I hope it will highlight the potential of what Ansible is—and can be capable of—in the realm of information security automation. + +A lot of this started with my colleague [Massimo Ferrari's][7] statement that "Ansible automation can be the _lingua franca_ to integrate and orchestrate the many security platforms spread across different domains." We spent a lot of time mulling this over; it may be obvious to DevOps and automation professionals who've discovered the power of Ansible, but infosec doesn't have similar tools that target the industry's problems in the same way. Therefore, Ferrari's statement offers a lot of potential for the infosec industry. + +In this article, I'll summarize two major points we highlighted in our AnsbileFest 2019 talk: + + * Ansible recommended development practices + * Classify what you're integrating with and how you connect to it (API or CLI?) + + + +### Ansible recommended development practices + +The Ansible engineering team likes to never write the words "best practice," because we can't possibly know what's best for you in your specific situation. You are the expert on topics as they apply to your unique environment and requirements. However, we can provide _recommendations_, which I'll outline from the perspective of an Ansible module developer. + +#### Modules + +Modules are user-focused and self-contained. This mostly means that the code contained in your module should be self-contained within your [module][8] or in a **[module_util][9]**. The latter is what allows us to share code between modules, but everything must be as self-contained as possible, as we don't want to introduce too many external dependencies. We also want each module to perform some sort of state management. Each module should be [idempotent][10], which basically means "inflict change if needed, otherwise, do not." A module should not attempt to contain a workflow (that's what [playbooks][11] are for), and we want to leave that up to the user. Modules shouldn't attempt to "do too much," such that you have one massive module that takes 100 arguments and, based on values provided by the user, performs wildly different actions on the target device. + +An example of what we generally want to avoid could go something like this: + + +``` +\- name: Create a virtual machine +  some_module: +    thing_to_do: "create_virtual_machine" +    name: "bobs_awesome_vm" +    storage_size: 100G +    ram: 24G +    vcpus: 4 + +\- name: Create a virtual storage volume +  some_module: +    thing_to_do: "create_virtual_storage_vol" +    name: "bobs_awesome_storage" +    storage_size: 1000G +    lun_id: 12 +``` + +In this example, the fictitious **some_module** is performing completely disjointed actions based on the value of **thing_to_do**. This is not a discrete, self-contained unit of work from the perspective of an Ansible module. These should be two separate modules that could even share code on the backend through a custom module_util (if that makes the developer's life easier). Either way, they should be separate modules so the user can easily define, read, and understand the task as written. As a developer, you want to make the module's interaction user-focused. + +Another aspect of being user-focused is that the user should not need any knowledge of the destination API in order to use the module effectively. The module should provide useful defaults, documentation, and examples that allow users to pick their own automation path. + +#### Collections + +[Ansible collections][12] are a relatively new concept, but they are generally seen as the future for Ansible content of all shapes and sizes. They allow Ansible content, such as modules, module_utils, plugins of all kinds, roles, docs, tests, playbooks, and whatever the community dreams up next, to exist as a cohesive unit to be tested, verified, and distributed as an entity. What's more (and this is its real advantage for developers) is that it decouples the content from the [Ansible Core runtime][13]. This allows Ansible content to be lifecycle-managed separately from Ansible itself, meaning it can be released as often or as infrequently as the content author or maintainer desires. No longer will new features have to wait six months for the next Ansible release. The collection authors can release as often as they desire. + +Collections are meant to be a simple progression into a brave new world where the Ansible Core execution engine is symbolically similar to [CPython][14]. Ansible collections are symbolically similar to Python modules found on [PyPI][15]. [Ansible Galaxy][16] is symbolically similar to PyPI as the de facto distribution mechanism. + +From a developer standpoint, you simply need to drop your files in the correct location and update any custom module_utils Python import paths. From a user perspective, you just need to add the **collection** namespace and name to the [play][11] or [block][17] that intends to use that content. + +### Classify what you're integrating with and how you connect to it + +In the security realm, appliance devices or software that is meant to be used like an appliance (network devices, embedded systems, and so on) sometimes present the administrator both an [application programming interface][18] (API) and a [command-line interface][19] (CLI). As a module developer, you must make some decisions in service of ease of development, maintainability of code, and, ultimately, consistent user experience. + +#### CLI + +If you are potentially going to wrap a CLI, ask yourself whether that CLI offers a consistent interface with output you can reasonably and consistently parse. Beyond that, does the CLI offer the ability to formulate idempotent transactions? While the majority of CLIs offer **get** and **set** types of transactions (especially on Unix/Linux systems), some of them do not, and this is something module authors need to consider. + +When considering CLI implementations with network or embedded devices that have a standard CLI but don't offer a traditional Unix shell, you should look into implementing a [cliconf plugin][20]. This type of plugin enables your users to interact with appliances or embedded devices in a way that's natural to the seasoned Ansible user and beginner alike. Alternatively, should you find yourself with a device that allows you to execute local Python code (_local_ to the device or system itself; a "managed host" in Ansible terminology), then consider the **[run_command][21]** module_util. The latter situation is effectively just a traditional [module development][22] workflow, as it would be for a traditional GNU/Linux distribution. + +#### API + +If the technology you are attempting to integrate with offers an API, determine whether that API is a local on-system API (local to the remote "managed host" system) or a remote API such as a [REST][23] API? + +In the event you find yourself with a local Python API and it's advantageous to use it instead of the REST API (in the event both are available), this situation is effectively the same as a traditional [module development][22] workflow in a GNU/Linux distribution. + +However, if the only option is a REST API, or if the available REST API is determined to be the best option, then writing an [httpapi connection plugin][24] is best for general ease of implementation, maintenance, and handling things like AuthN, AuthZ, sessions, and so on. It also offers an idiomatic pattern for talking to these types of devices, even though they have a considerably different means of communication than most others that Ansible works with. + +An example to illustrate this point is probably common to anyone who has automated a web service with a module that doesn't provide an httpapi connection plugin. Typically in these scenarios, the play, block, or task must be run against **localhost**, and the various information for the connection to the web service must be passed to each invocation of the module for each task. + + +``` +\--- +\- name: talk to foo device +  hosts: localhost +  tasks: +    - name: do something +      foo_device_do_thing: +        url: foo.example.com +        username: "{{ foo_device_username }}" +        passwd: "{{ foo_device_password }}" +        validate_certs: true +        thing_state: present +        some_param: bar +``` + +If this module had been implemented against an httpapi connection plugin instead, then the various connection-specific parameters would be host variables or group variables and wouldn't have to be carried around at the task level in playbooks. + +Here's an inventory entry to handle the AuthN/AuthZ connection for all Ansible modules, written against the httpapi connection plugin. It also performs session handling for increased performance: + + +``` +[foo_devices] +foo.example.com + +[foo_devices:vars] +ansible_network_os=foo_device +ansible_user=foo_device_username +ansible_httpapi_pass=foo_device_password +ansible_httpapi_validate_certs=true +``` + +This playbook would be considerably more idiomatic. The **foo_devices** are a first-class device type and [host pattern][25] for the playbook. + + +``` +\--- +\- name: talk to foo device +  hosts: foo_devices +  tasks: +    - name: do something +      foo_device_do_thing: +        thing_state: present +        some_param: bar +``` + +A playbook has to define information for every task, so imagine one that has 20 or 100 tasks. The overhead would be considerable. This doesn't feel much like directly automating the hosts defined in the host field. However, the httpapi connection plugin negates the need to define the connection information over and over, and it also talks natively to devices over a REST API, just as you would on a Linux system over SSH in a playbook. + +Something to note about httpapi connection plugins is that, even though the user defines hosts, groups, host vars, and group vars, just in like a traditional Unix/Linux or Windows-managed host, these modules actually execute against the localhost (the "control host" in Ansible nomenclature). This is something to keep in mind when you're developing. + +### What the what? + +If you're new to Ansible module development, this might seem like a lot to take in at once. To be fair, it is. However, as you become more seasoned in the finer points of Ansible module development for a wide array of device types and technology solution classifications, the motivation for different development strategies starts to make sense. Some device classifications have idiosyncrasies, and this model helps Ansible developers and users deal with those in a consistent and predictable way. + +### Wrapping up + +If you have questions about Ansible module development models, feel free to reach out through the vibrant [Ansible Community][26], and more specifically, the [Ansible Security Automation Working Group][27]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/how-write-security-integration-module-ansible + +作者:[Adam 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://opensource.com/users/maxamillion +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_password_chaos_engineer_monster.png?itok=J31aRccu (Security monster) +[2]: https://www.ansible.com +[3]: https://opensource.com/article/19/2/quickstart-guide-ansible +[4]: https://www.ansible.com/ansiblefest +[5]: https://github.com/justjais +[6]: https://www.ansible.com/development-deep-dive-how-to-write-a-security-integration-module-for-ansible +[7]: https://www.linkedin.com/in/massimoferrari/ +[8]: https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html#developing-modules-general +[9]: https://docs.ansible.com/ansible/latest/dev_guide/developing_module_utilities.html +[10]: https://en.wikipedia.org/wiki/Idempotence +[11]: https://docs.ansible.com/ansible/latest/user_guide/playbooks.html +[12]: https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html +[13]: https://github.com/ansible/ansible +[14]: https://en.wikipedia.org/wiki/CPython +[15]: https://pypi.org +[16]: https://galaxy.ansible.com +[17]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_blocks.html +[18]: https://en.wikipedia.org/wiki/Application_programming_interface +[19]: https://en.wikipedia.org/wiki/Command-line_interface +[20]: https://docs.ansible.com/ansible/latest/plugins/cliconf.html +[21]: https://docs.ansible.com/ansible/latest/reference_appendices/module_utils.html#ansible.module_utils.basic.AnsibleModule.run_command +[22]: https://docs.ansible.com/ansible/latest/dev_guide/developing_modules_general.html +[23]: https://en.wikipedia.org/wiki/Representational_state_transfer +[24]: https://docs.ansible.com/ansible/latest/network/dev_guide/developing_plugins_network.html#developing-plugins-httpapi +[25]: https://docs.ansible.com/ansible/latest/user_guide/intro_patterns.html +[26]: https://www.ansible.com/community +[27]: https://github.com/ansible/community/wiki/Security-Automation From 7b10dafaf7ad3287163e2213d98d1063c892ab4f Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Dec 2019 01:27:09 +0800 Subject: [PATCH 761/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20What?= =?UTF-8?q?=20we=20risk=20when=20we=20open=20up=20to=20customers=20(and=20?= =?UTF-8?q?why=20it's=20worth=20it)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 What we risk when we open up to customers (and why it-s worth it).md --- ...up to customers (and why it-s worth it).md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/tech/20191203 What we risk when we open up to customers (and why it-s worth it).md diff --git a/sources/tech/20191203 What we risk when we open up to customers (and why it-s worth it).md b/sources/tech/20191203 What we risk when we open up to customers (and why it-s worth it).md new file mode 100644 index 0000000000..d231839a46 --- /dev/null +++ b/sources/tech/20191203 What we risk when we open up to customers (and why it-s worth it).md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What we risk when we open up to customers (and why it's worth it)) +[#]: via: (https://opensource.com/open-organization/19/12/customer-empowerment-trust) +[#]: author: (Tracy Giuliani https://opensource.com/users/tgiuliani23) + +What we risk when we open up to customers (and why it's worth it) +====== +Empowering your customers means opening up to them—but it won't work if +you don't trust each other. +![Open for business][1] + +Customer empowerment is one consequence of digital transformation. And as we explained in the [first part of this series][2], it's a powerful one. Empowering customers can deepen their relationship with your organization—but it won't work if they don't trust you. + +In this article, we'll explain how acting openly can create that foundation of trust—and why it can lead to business success. + +### A foundation of trust + +At the heart of customer empowerment is trust—sharing and creating opportunities to _use_ information and knowledge. After all, if we don't share information and create opportunities, then customers will have trouble using the information or taking any action. They're limited. + +We can think of the empowered customer as a type of mature "user experience," asking: "What kinds of information and opportunities could customers use to [insert verb here] our products, services, and external processes better?" and "How and where in our products, services, and processes do we provide opportunities to use information and knowledge?" Those questions may not be consecutive; we might need to answer them at the same time. + +Trust is the foundation of customer empowerment. We need to trust that our customers are capable, wise, and so on; we must _assume_ they are trustworthy (difficult when we don't know them, since trust is based on personal relationships and consistent actions). Still, when we create opportunities to empower, we need to build them with trust in mind (and sometimes with ways to remove the opportunity if necessary). + +In open source software communities, for instance, we note that opportunities to contribute are part of the openness and meritocracy of the community. Communities often _extend trust by default_, allowing anyone to join and modify code—and only if behavior doesn't meet community policy and membership agreement is access revoked. The community assumed participants' positive intent, extending trust in the first place. + +Trust is the foundation of customer empowerment. + +The question of customer empowerment isn't a "yes or no" question. It's a question of degree. As we mentioned above, empowered customers exist on a continuum. Enabling a _little_ empowerment still qualifies as customer empowerment. But as such empowerment increases, so does the risk involved for the business (and the more reward if the empowerment benefits the business). We could say that customer empowerment is a function of the relationship between customer and business in terms of the: + + * Amount and quality of information + * Amount and quality of opportunities + * Frequency of interactions and opportunities + * And other characteristics pertaining to the unique situation + + + +Think about a synthesizer—an adjustable knob for each quality that influences customer empowerment. There is no single, perfect way to empower customers. + +### Managing risk + +As we mentioned earlier: Trust is an important aspect in these relationships—trust between a business and its employees, or trust between businesses. Beginning such a relationship by empowering a customer 100% is difficult, and even so you probably don't want to. But you _can_ begin somewhere. + +When you risk something, you can ask for your relational partner to risk something too—that way, there's something at stake for both parties. + +Between businesses, empowering partners and trusted customers is a great way to start and build empowerment. When you risk something, you can ask for your relational partner to risk something too—that way, there's something at stake for both parties. Confidentiality agreements. Sales data. Customer references. System environment details. Multiproduct stacks built with a few competitor products. Reputation for contribution. Whatever it you choose to share, you'll need to view the relationships as a "give and take" of risk. For instance, a business might provide test case data to a trusted partner, with the intention of improving testing within the organization, but it might ask for the partner to share anonymous details in an online forum about product testing. + +Empowerment cannot be a one-way street, or it won't be empowerment. Reach _agreements_ on what can be done (or not done) with the information and activities that are available. + +### What's in it for the business? + +In [employee empowerment][3], open leaders get the benefit of a more agile and nimble organization, ready to respond to many multi-faceted issues at once. + +What do leaders get if they empower customers and partners? In the past, an organization's business model might have been to profit from specific knowledge it possess or by using specific, proprietary processes. But customer empowerment means that those are more "open"? So what's the benefit? + + * Increased customer satisfaction: Just like job satisfaction increases with transparency and meaningful work for associates, customers are more satisfied by themselves being empowered. + * Deeper expertise for the originating business: And as a result, improved knowledge and processes as they mature further. In other words, by opening current knowledge and processes, the business can elevate its knowledge and processes that maintain profitability or make the business more profitable. + * Stronger customer centricity: Through increased collaboration with customers, businesses can enhance their current customer experience by using data capturing and analytics to improve their customer-centric perspectives and marketing programs + + + +None of this comes for free. The cost is trust—the work of developing stronger and more trusting relationships with customers and partners. You'll need to decide what that looks like, and what the benefit is, for your own organization. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/19/12/customer-empowerment-trust + +作者:[Tracy Giuliani][a] +选题:[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/tgiuliani23 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_openseries.png?itok=rCtTDz5G (Open for business) +[2]: https://opensource.com/open-organization/19/11/customer-empowerment-open-communities +[3]: https://opensource.com/open-organization/19/4/managed-enabled-empowered From ff94630c0972956eecf6fa251a74e6aedd41ab52 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Wed, 4 Dec 2019 01:29:02 +0800 Subject: [PATCH 762/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20Ampere?= =?UTF-8?q?=20preps=20an=2080-core=20Arm=20processor=20for=20the=20cloud?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191203 Ampere preps an 80-core Arm processor for the cloud.md --- ... an 80-core Arm processor for the cloud.md | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 sources/talk/20191203 Ampere preps an 80-core Arm processor for the cloud.md diff --git a/sources/talk/20191203 Ampere preps an 80-core Arm processor for the cloud.md b/sources/talk/20191203 Ampere preps an 80-core Arm processor for the cloud.md new file mode 100644 index 0000000000..37cc439790 --- /dev/null +++ b/sources/talk/20191203 Ampere preps an 80-core Arm processor for the cloud.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ampere preps an 80-core Arm processor for the cloud) +[#]: via: (https://www.networkworld.com/article/3482248/ampere-preps-an-80-core-arm-processor-for-the-cloud.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Ampere preps an 80-core Arm processor for the cloud +====== +A new Ampere chip due out next year is single-threaded to avoid the 'noisy neighbor' problem that can impede customer workloads in multi-tenant cloud-provider networks. +Thinkstock + +[Ampere Computing][1], the semiconductor startup led by former Intel president Renee James that designs Arm-based server processors, is preparing to launch its next-generation CPU by mid-2020. + +The upcoming chip will have 80 cores, much more than the 32-core processor the company shipped last year and vastly more than x86 CPUs by Intel and AMD. Ampere’s design is different. Instead of multiple threads per core, each core is single threaded. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Jeff Wittich, Ampere’s senior vice president of products, said that was by design, to avoid some of the CPU vulnerabilities that crept into x86 chips but also to avoid the “noisy neighbor” problem in cloud service-provider networks. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +Because of their many cores and threads, users of AWS and other cloud providers never get a CPU all to themselves unless they pay dearly for it. More often than not your instance is sharing CPU cycles with someone else, and if their app makes a lot of hits on the CPU cache, especially the L1 cache, it can impede your performance. + +“We designed the product to be single-threaded and many cores to provide as much isolation as possible, with no sharing of threads,” he says. “We intentionally made the product single-threaded, so there is no sharing L1 cache or registers between threads.” + +Ampere is specifically targeting cloud providers and hyperscale data-center operators, which includes the usual suspects – Google, Facebook, Amazon – and second-tier cloud providers as well and companies like Twitter and Uber. That may not be a lot of vendors but they buy in the tens if not hundreds of thousands of servers every quarter. + +“We’re taking a different approach to this in that we have a product targeted at the cloud vs a product targeted at general data centers trying to shoehorn that into every workload,” he said. “The services and infrastructure architecture [hyperscalers] are deploying are totally different from what people were doing 15 to 20 years ago when x86 came in to play. Things like multi-tenant, quality of service, isolation, and manageability are what’s important now.” + +He also notes that hyperscalers have spent the last 10 years optimizing their entire software stack, with custom Linux distributions and their own hypervisor. What they haven’t done is optimize or customize the CPU, because they can’t. + +To that end, Ampere is operating like a software provider using Agile development techniques, which means an annual release of new CPUs, faster iterations than seen by Intel, AMD, and Marvell, which owns the Cavium line of Arm server processors. This means extensive simulation testing and less time updating and fixing actual silicon. + +Wittich said each core has considerably more performant than the eMAG generation, but he was waiting for silicon to do actual benchmarks. Wittich declined to go into detail on the new processor, even on the product name, beyond that it would run at a TDW of 45 to 200 watts, come in single- and dual-socket designs, use PCI Express Gen 4 and eight channels of memory. + +The new processor takes the company into workloads that do run in the cloud now, like database, storage, analytics, media, and machine-learning inference. + +It has a few ODM wins so far, China’s Wiwynn and Lenovo and Gigabyte as well. While the company is targeting the public cloud providers it will go after the private cloud to a certain extent if there are opportunities “that make sense,” as he put it. + +Silicon samples will be coming back this month and sent to partners before end of year. Taiwan’s TSMC is making the chips using 7nm designs. Wittich said the company is targeting mid-year 2020 for high-volume production. + +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/3482248/ampere-preps-an-80-core-arm-processor-for-the-cloud.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/3306447/a-new-arm-based-server-processor-challenges-for-the-data-center.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world From 6769a45af6d4b346ae43727d5035aca3deea6a50 Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 4 Dec 2019 08:57:59 +0800 Subject: [PATCH 763/800] translated --- .../tech/20191017 Using multitail on Linux.md | 132 ------------------ .../tech/20191017 Using multitail on Linux.md | 121 ++++++++++++++++ 2 files changed, 121 insertions(+), 132 deletions(-) delete mode 100644 sources/tech/20191017 Using multitail on Linux.md create mode 100644 translated/tech/20191017 Using multitail on Linux.md diff --git a/sources/tech/20191017 Using multitail on Linux.md b/sources/tech/20191017 Using multitail on Linux.md deleted file mode 100644 index e2510e54f6..0000000000 --- a/sources/tech/20191017 Using multitail on Linux.md +++ /dev/null @@ -1,132 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using multitail on Linux) -[#]: via: (https://www.networkworld.com/article/3445228/using-multitail-on-linux.html) -[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) - -Using multitail on Linux -====== - -[Glen Bowman][1] [(CC BY-SA 2.0)][2] - -The **multitail** command can be very helpful whenever you want to watch activity on a number of files at the same time – especially log files. It works like a multi-windowed **tail -f** command. That is, it displays the bottoms of files and new lines as they are being added. While easy to use in general, **multitail** does provide some command-line and interactive options that you should be aware of before you start to use it routinely. - -### Basic multitail-ing - -The simplest use of **multitail** is to list the names of the files that you wish to watch on the command line. This command splits the screen horizontally (i.e., top and bottom), displaying the bottom of each of the files along with updates. - -[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] - -``` -$ multitail /var/log/syslog /var/log/dmesg -``` - -The display will be split like this: - -[][4] - -BrandPost Sponsored by HPE - -[Take the Intelligent Route with Consumption-Based Storage][4] - -Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. - -``` -+-----------------------+ -| | -| | -+-----------------------| -| | -| | -+-----------------------+ -``` - -The lines displayed from each of the files would be followed by a single line per file that includes the assigned file number (starting with 00), the file name, the file size, and the date and time the most recent content was added. Each of the files will be allotted half the space available regardless of its size or activity. For example: - -``` -content lines from my1.log -more content -more lines - -00] my1.log 59KB - 2019/10/14 12:12:09 -content lines from my2.log -more content -more lines - -01] my2.log 120KB - 2019/10/14 14:22:29 -``` - -Note that **multitail** will not complain if you ask it to display non-text files or files that you have no permission to view; you just won't see the contents. - -You can also use wild cards to specify the files that you want to watch: - -``` -$ multitail my*.log -``` - -One thing to keep in mind is that **multitail** is going to split the screen evenly. If you specify too many files, you will see only a few lines from each and you will only see the first seven or so of the requested files if you list too many unless you take extra steps to view the later files (see the scrolling option described below). The exact result depends on the how many lines are available in your terminal window. - -Press **q** to quit **multitail** and return to your normal screen view. - -### Dividing the screen - -**Multitail** will split your terminal window vertically (i.e., left and right) if you prefer. For this, use the **-s** option. If you specify three files, the right side of your screen will be divided horizontally as well. With four, you'll have four equal-sized windows. - -``` -+-----------+-----------+ +-----------+-----------+ +-----------+-----------+ -| | | | | | | | | -| | | | | | | | | -| | | | +-----------+ +-----------+-----------+ -| | | | | | | | | -| | | | | | | | | -+-----------+-----------+ +-----------+-----------+ +-----------+-----------+ - 2 files 3 files 4 files -``` - -Use **multitail -s 3 file1 file2 file3** if you want to split the screen into three columns. - -``` -+-------+-------+-------+ -| | | | -| | | | -| | | | -| | | | -| | | | -+-------+-------+-------+ - 3 files with -s 3 -``` - -### Scrolling - -You can scroll up and down through displayed files, but you need to press **b** to bring up a selection menu and then use the up and arrow buttons to select the file you wish to scroll through. Then press the **enter** key. You can then scroll through the lines in an enlarged area, again using the up and down arrows. Press **q** when you're done to go back to the normal view. - -### Getting Help - -Pressing **h** in **multitail** will open a help menu describing some of the basic operations, though the man page provides quite a bit more information and is worth perusing if you want to learn even more about using this tool. - -**Multitail** will not likely be installed on your system by default, but using **apt-get** or **yum** should get you to an easy install. The tool provides a lot of functionality, but with its character-based display, window borders will just be strings of **q**'s and **x**'s. It's a very handy when you need to keep an eye on file updates. - -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/3445228/using-multitail-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://www.flickr.com/photos/glenbowman/7992498919/in/photolist-dbgDtv-gHfRRz-5uRM4v-gHgFnz-6sPqTZ-5uaP7H-USFPqD-pbtRUe-fiKiYn-nmgWL2-pQNepR-q68p8d-dDsUxw-dbgFKG-nmgE6m-DHyqM-nCKA4L-2d7uFqH-Kbqzk-8EwKg-8Vy72g-2X3NSN-78Bv84-buKWXF-aeM4ok-yhweWf-4vwpyX-9hu8nq-9zCoti-v5nzP5-23fL48r-24y6pGS-JhWDof-6zF75k-24y6nHS-9hr19c-Gueh6G-Guei7u-GuegFy-24y6oX5-26qu5iX-wKrnMW-Gueikf-24y6oYh-27y4wwA-x4z19F-x57yP4-24BY6gc-24y6nPo-QGwbkf -[2]: https://creativecommons.org/licenses/by-sa/2.0/legalcode -[3]: https://www.networkworld.com/newsletters/signup.html -[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) -[5]: https://www.facebook.com/NetworkWorld/ -[6]: https://www.linkedin.com/company/network-world diff --git a/translated/tech/20191017 Using multitail on Linux.md b/translated/tech/20191017 Using multitail on Linux.md new file mode 100644 index 0000000000..c4625e2b03 --- /dev/null +++ b/translated/tech/20191017 Using multitail on Linux.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using multitail on Linux) +[#]: via: (https://www.networkworld.com/article/3445228/using-multitail-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上使用 Multitail +====== + +[Glen Bowman][1] [(CC BY-SA 2.0)][2] + +当你想同时查看多个文件(尤其是日志文件)的活动时,**multitail** 命令会非常有用。它的工作方式类似于多窗口形式的 **tail -f** 命令。也就是说,它显示文件底部和添加的新行。虽然通常使用简单,但是 **multitail** 提供了一些命令行和交互式选项,在开始使用它之前,你应该了解它们。 + + +### 基本 multitail 使用 + +**multitail** 的最简单用法是在命令行中列出你要查看的文件名称。此命令水平分割屏幕(即顶部和底部),并显示每个文件的底部以及更新。 + +``` +$ multitail /var/log/syslog /var/log/dmesg +``` + +显示内容将像这样拆分: + +``` ++-----------------------+ +| | +| | ++-----------------------| +| | +| | ++-----------------------+ +``` + +每个文件都有一行显示该文件的文件编号(从 00 开始)、文件名、文件大小、最新内容的添加日期和时间。每个文件将被分配一半空间,而不论它的大小和活动情况。比如: + +``` +content lines from my1.log +more content +more lines + +00] my1.log 59KB - 2019/10/14 12:12:09 +content lines from my2.log +more content +more lines + +01] my2.log 120KB - 2019/10/14 14:22:29 +``` + +请注意,如果你要求 **multitail** 显示非文本文件或者你无权查看的文件,它不会报错。你只是看不到内容。 + +你还可以使用通配符指定要查看的文件: + +``` +$ multitail my*.log +``` + +要记住的一件事是,**multitail** 将平均分割屏幕。如果指定的文件太多,那么除非你采取额外的步骤查看之后的文件(参考下面的滚动选项),否则你将只会看到前面 7 个文件的前面几行。确切的结果取决于终端窗口中有多少行可用。 + +按 **q** 退出 **multitail** 并返回到正常的屏幕视图。 + +### 分割屏幕 + +如果你愿意,**multitail** 将垂直分割你的终端窗口(即,左和右)。为此,请使用 **-s** 选项。如果指定了三个文件,那么屏幕右侧的窗口将会水平分隔。四个文件的话,你将拥有四个大小相等的窗口。 + +``` ++-----------+-----------+ +-----------+-----------+ +-----------+-----------+ +| | | | | | | | | +| | | | | | | | | +| | | | +-----------+ +-----------+-----------+ +| | | | | | | | | +| | | | | | | | | ++-----------+-----------+ +-----------+-----------+ +-----------+-----------+ + 2 个文件 3 个文件 4 个文件 +``` + +如果要将屏幕分为三列,请使用 **multitail -s 3 file1 file2 file3**。 + +``` ++-------+-------+-------+ +| | | | +| | | | +| | | | +| | | | +| | | | ++-------+-------+-------+ + 3 个文件带上 -s 3 选项 +``` + +### 滚动 + +你可以上下滚动文件,但是需要按下 **b** 弹出选择菜单,然后使用向上和向下箭头按钮选择要滚动浏览的文件。然后按下回车键。然后,你可以再次使用向上和向下箭头在放大的区域中滚动浏览各行。完成后按下 **q** 返回正常视图。 + +### 获得帮助 + +在 **multitail** 中按下 **h** 将打开一个帮助菜单,其中描述了一些基本操作,但是手册页提供了更多信息,如果莫想了解更多有关使用此工具的信息,请仔细阅读。 + +默认情况下,你的系统商不会安装 **multitail**,但是使用 **apt-get** 或 **yum** 可以使你轻松安装。该工具提供了许多功能,但是通过基于字符的显示,窗口边框将只是 **q** 和 **x** 的字符串。 当你需要关注文件更新时,它非常方便。 + +加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3445228/using-multitail-on-linux.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 +[1]: https://www.flickr.com/photos/glenbowman/7992498919/in/photolist-dbgDtv-gHfRRz-5uRM4v-gHgFnz-6sPqTZ-5uaP7H-USFPqD-pbtRUe-fiKiYn-nmgWL2-pQNepR-q68p8d-dDsUxw-dbgFKG-nmgE6m-DHyqM-nCKA4L-2d7uFqH-Kbqzk-8EwKg-8Vy72g-2X3NSN-78Bv84-buKWXF-aeM4ok-yhweWf-4vwpyX-9hu8nq-9zCoti-v5nzP5-23fL48r-24y6pGS-JhWDof-6zF75k-24y6nHS-9hr19c-Gueh6G-Guei7u-GuegFy-24y6oX5-26qu5iX-wKrnMW-Gueikf-24y6oYh-27y4wwA-x4z19F-x57yP4-24BY6gc-24y6nPo-QGwbkf +[2]: https://creativecommons.org/licenses/by-sa/2.0/legalcode +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world From 5c785a264a242a837b6950811504d7ba630c390c Mon Sep 17 00:00:00 2001 From: geekpi Date: Wed, 4 Dec 2019 09:03:17 +0800 Subject: [PATCH 764/800] translating --- sources/tech/20191202 Use the Window Maker desktop on Linux.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191202 Use the Window Maker desktop on Linux.md b/sources/tech/20191202 Use the Window Maker desktop on Linux.md index 9f8dcc2f2a..5048eeefeb 100644 --- a/sources/tech/20191202 Use the Window Maker desktop on Linux.md +++ b/sources/tech/20191202 Use the Window Maker desktop on Linux.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From b7f30bee967c75eb00598e7c789dca470b6db71e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Dec 2019 09:31:18 +0800 Subject: [PATCH 765/800] PRF @LuuMing --- ...en source audio-visual production tools.md | 164 +++++++++++------- 1 file changed, 99 insertions(+), 65 deletions(-) diff --git a/translated/tech/20180207 23 open source audio-visual production tools.md b/translated/tech/20180207 23 open source audio-visual production tools.md index ac414cf5f1..ac3b6affaa 100644 --- a/translated/tech/20180207 23 open source audio-visual production tools.md +++ b/translated/tech/20180207 23 open source audio-visual production tools.md @@ -1,101 +1,120 @@ -23 款开源的声音视觉生产工具 +23 款开源的声音、视觉生产工具 ====== -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-photo-camera-blue.png?itok=AsIMZ9ga) +> 无论你是要进行音频、图形、视频、动画还是它们的任意组合,都有一个开源工具可以帮助你产生专业水平的结果。 + +![](https://img.linux.net.cn/data/attachment/album/201912/04/093037w8ab8v0voz0b5u88.jpg) “开源”在云基础设施、网站托管、嵌入式设备和其他领域已经建立的相当完善。很少数人知道开源在生产专业级的声音视觉素材上也是一个不错的选择。 -作为一名产品经理(有时候也是市场支持),我为终端用户提供很多内容:文档,文章,视频教学,甚至是展台物料,白纸,采访等等。我找到了很多可以帮我制作音频、视频,排版,截屏的开源软件。人们选择开源软件而不是专有软件的[原因][1]有很多,而我也为以下人群编制了一份开源音视频工具清单: +作为一名产品经理(有时候也是市场支持),我为终端用户提供很多内容:文档、文章、视频教学,甚至是展台物料、白皮书、采访等等。我找到了很多可以帮我制作音频、视频、排版、截屏的开源软件。人们选择开源软件而不是专有软件的[原因][1]有很多,而我也为以下人群编制了一份开源音视频工具清单: - * 想要入坑 GNU/Linux,但需要在原来的操作系统上慢慢开始使用跨平台软件 - * 热爱开源,但对音视频开源软件所知甚少,不知道该如何选择 - * 想要为创造力充电而探索新的工具,并且不想使用其他人使用过的方法工具 - * 存在某些其他的原因使用开源音视频解决方案(如果是你,不妨在评论里分享一下) +* 想要入坑 GNU/Linux,但需要在原来的操作系统上慢慢从使用跨平台软件开始 +* 热爱开源,但对音视频开源软件所知甚少,不知道该如何选择 +* 想要为创造力充电而探索新的工具,并且不想使用其他人使用过的方法工具 +* 存在某些其他的原因使用开源音视频解决方案(如果是你,不妨在评论里分享一下) -幸运的是,存在着很多开源音视频软件的创造者,也存在着很多硬件来支持这些应用。本文清单里的所有软件都符合以下标准: +幸运的是,存在着很多开源的音视频创作软件,也存在着很多硬件来支持这些应用。本文清单里的所有软件都符合以下标准: - * 跨平台 - * 开源(软件和驱动) - * 稳定 - * 积极维护 - * 良好的文档与技术支持 +* 跨平台 +* 开源(软件和驱动) +* 稳定 +* 积极维护 +* 良好的文档与技术支持 -我将清单中的解决方案划分为图形,音频,视频和动画。注意,本文中提到的应用程序并不完全等同于一些有名的私有软件,它们需要花时间来学习,并且可能需要改变你的工作流程,但是学习新的工具能够让体验全新的创造方式。 +我将清单中的解决方案划分为图形、音频、视频和动画。注意,本文中提到的应用程序并不完全等同于一些有名的私有软件,它们需要花时间来学习,并且可能需要改变你的工作流程,但是学习新的工具能够让体验全新的创造方式。 ### 图形 -我制作过很多出版和网站使用的图形,包括 logo,横幅,视频标题,模型。这里是一些我用过的开源应用,也包括一起使用的硬件。 +我制作过很多出版和网站使用的图形,包括徽标、横幅、视频节目、草图。这里是一些我用过的开源应用,也包括一同使用的硬件。 #### 软件 -**1.[Inkscape][2]** (矢量图) +**1、[Inkscape][2]**(矢量图) + Inkscape 是一款不错的矢量图编辑器,用来制作 RGB 颜色空间下的 SVG 和 PDF 文件。(它可以制作 CMYK 图像,但不是主要用途)它是为 web 应用制作 SVG 格式的地图和图表的人的救命稻草。你不仅可以使用集成的 XML 编辑器打开文件,也可以用它查看对象的所有参数。但有一个缺点:它在 Mac 上的优化不是很好。有很多样例,可以看[Inkscape 画廊][3]。 -**2.[GIMP][4]** (图片编辑器) -GIMP 是我最喜欢的图片编辑程序,它包括了色彩调整,裁剪和拉伸,并且(尤其是)对于网页使用的文件大小进行了优化(很多使用 Photoshop 的同事让我帮他们做这最后一步)。你也可以从头制作并绘制一张图片,但 GIMP 并不是我最喜欢用来做这件事的工具。在 [GIMP Artists on DevianArt][5] 上查看众多的样例。 +**2、[GIMP][4]**(图片编辑器) + +GIMP 是我最喜欢的图片编辑程序,它包括了色彩调整、裁剪和拉伸,并且(尤其是)对于网页使用的文件大小进行了优化(很多使用 Photoshop 的同事让我帮他们做这最后一步)。你也可以从头制作并绘制一张图片,但 GIMP 并不是我最喜欢用来做这件事的工具。在 [GIMP Artists on DevianArt][5] 上查看众多的样例。 + +**3、[Krita][6]**(数字绘画) -**3.[Krita][6]** (数字绘画) 当你桌子上摆着一个漂亮的 Wacom 数位板,你肯定想试试真正的数字绘画应用。Krita 就是你创作漂亮插画所需要的工具。在 [Krita 画廊][7] 里看看我说的东西吧。 -**4.[Scribus][8]** (桌面印刷系统) -你可以使用 Scribus 来创建一个完整的文档,或者通过 Inkscape 或 Libre Office 将 PDF 从 RGB 转换到 CMYK 。有一个功能我非常喜欢:你可以试着模拟视觉障碍人士使用 Scribus 时的体验。当我发送 PDF 文件给商用打印机时全指望 Scribus。尽管出版社可能使用像 InDesign 这样的私有软件创建文档,但如果你用 Scribus 正确的完成一份文档,那么打印时就不会出现任何问题。免费建议:第一次发送文件给打印机时,不要告诉打印机创建该文档所使用的软件。你可以在 [Scribus 教程][9]中寻找创建文档的例子。 +**4、[Scribus][8]**(桌面印刷系统) + +你可以使用 Scribus 来创建一个完整的文档,或者只是把用 Inkscape 或 Libre Office 制作的 PDF 从 RGB 转换到 CMYK。有一个功能我非常喜欢:你可以试着模拟视觉障碍人士使用 Scribus 时的体验。当我发送 PDF 文件给商业印刷公司时全指望 Scribus。尽管出版社可能使用像 InDesign 这样的私有软件创建文档,但如果你用 Scribus 正确的完成一份文档,那么打印时就不会出现任何问题。免费建议:第一次发送文件给印刷公司时,不要告诉印刷公司创建该文档所使用的软件。你可以在 [Scribus 教程][9]中寻找创建文档的例子。 + +**5、[RawTherapee][10]**(RAW 图像开发工具) -**5.[RawTherapee][10]** (RAW 图像开发工具) RawTherapee 是我所知道唯一跨平台可替代 Lightroom 的软件。你可以将相机调整到 RAW 模式,然后使用 RawTherapee 来修图。它提供了非常强大的引擎和对图片没有破坏的编辑器。例如,可以见 [Raw Therapee 截图][11]。 -**6.[LibreOffice Draw][12]** (桌面印刷系统) -尽管你可能认为 LibraOffice Draw 不是一款专业的桌面印刷解决方案,但它仍然能够在很多情况下帮助你。例如,制作白皮书,图表,或其他人(尽管是那些不懂图形软件的人)以后可以修改的海报。它不仅方便使用,而且当创建有趣的文档时也是 Impress 或 PowerPoint 的绝佳替代软件。 +**6、[LibreOffice Draw][12]**(桌面印刷系统) + +尽管你可能认为 LibraOffice Draw 不是一款专业的桌面印刷解决方案,但它仍然能够在很多情况下帮助你。例如,制作其他人(尽管是那些不懂图形软件的人)以后可以修改的白皮书、图表或海报。它不仅方便使用,而且当创建有趣的文档时也是 Impress 或 PowerPoint 的绝佳替代软件。 #### 图形硬件 **绘图板** -[Wacom][13] 数位板(和配件)通常支持所有的操作系统。 + +[Wacom][13] 数位板(和兼容设备)通常支持所有的操作系统。 **颜色校正** + 颜色校正产品通常可用于所有操作系统,也包括了 GNU/Linux。Datacolor 生产的 [Spyder][14] 在所有平台上都有应用程序的支持。 **扫描仪和打印机** -图形艺术家需要输出(无论是打印还是数字存储)精确的颜色。但是真正跨平台的设备,以及所有平台都易于安装的驱动,并不像你想的那样普遍。你的最佳选择是兼容 TWAIN 的扫描仪和兼容 Postscript 的打印机。以我的经验,Epson 和 Xerox 的专业级扫描仪和打印机更不容易出现驱动问题,并且它们通常也是开箱即用,拥有漂亮精确的颜色。 + +图形艺术家需要输出(无论是打印还是电子版)的颜色是精确的。但是真正跨平台的设备,以及所有平台都易于安装的驱动,并不像你想的那样普遍。你的最佳选择是兼容 TWAIN 的扫描仪和兼容 Postscript 的打印机。以我的经验,Epson 和 Xerox 的专业级扫描仪和打印机更不容易出现驱动问题,并且它们通常也是开箱即用,拥有漂亮精确的颜色。 ### 音频 -有许多可供音乐家,视频制作者,游戏制作者,音乐出版商等等人群选择的开源音频软件。这里有一些我曾经用来进行内容创作与声音录制时所使用的软件。 +有许多可供音乐家、视频制作者、游戏制作者、音乐出版商等等人群选择的开源音频软件。这里有一些我曾经用来进行内容创作与声音录制时所使用的软件。 #### 软件 -**7. [Ardour][15] **(数字音频录制) -对录音与编辑来说,最专业级的工具选择当然是唾手可得的 Ardour。听起来很棒,它的混音部分非常的完整灵活,能够提供给你喜欢的插件,并且易于回放、编辑、对比修改。我经常用它进行声音录制和视频混音。要找出一些使用 Ardour 录制好的音乐并不容易,因为音乐家们很少相信它们使用的软件。然而,你可以查看它的[截图][16]和一些特性来了解它的功能。 +**7、[Ardour][15] **(数字音频录制) -(如果你在寻求一种声音制作方面的“模拟感觉”,你可以试试 [Harrison Mixbus][17],它并不是一个开源项目,但是高度基于 Ardour,拥有模拟显示的终端。我非常喜欢用它进行工作,我的客户也喜欢用它制作的声音。Mixbus 也是跨平台的) +对录音与编辑来说,最专业级的工具选择当然是唾手可得的 Ardour。听起来很棒,它的混音部分非常的完整灵活,能够提供给你喜欢的插件,并且易于回放、编辑、对比修改。我经常用它进行声音录制和视频混音。要找出一些使用 Ardour 录制好的音乐并不容易,因为音乐家们很少表明他们使用的软件。然而,你可以查看它的[截图][16]和一些特性来了解它的功能。 + +(如果你在寻求一种声音制作方面的“模拟体验”,你可以试试 [Harrison Mixbus][17],它并不是一个开源项目,但是高度基于 Ardour,拥有模拟显示的终端。我非常喜欢用它进行工作,我的客户也喜欢用它制作的声音。Mixbus 也是跨平台的) + +**8、[Audacity][18]** (声音编辑) -**8.[Audacity][18]** (声音编辑) Audacity 属于“瑞士军刀”级的声音制作软件。它并不完美,但你几乎可以用它做所有的事情。加上非常易于使用,任何人都能在几分钟之内上手。像 Ardour 一样,很难找到一份归功于 Audacity 的作品,但你可以从这些[截图][19]中了解如何使用它。 -**9.[LMMS][20]** (音乐制作) -LMMS,设计的就像 FL Studio 的替代品,也许并不那么广泛,但它非常完整并易于使用。你可以使用自己最喜欢的插件,使用“钢琴键”编辑乐器,使用步定序器step sequencer播放鼓点,混合音轨...几乎能做任何事情。在我没有时间给音乐家录音的时候我就使用它为视频创建声音片段。查看[最好的 LMMS][21] 榜单来看看一些例子。 +**9、[LMMS][20]** (音乐制作) -**10.[Mixxx][22]** (DJ,音乐混音) -如果你需要强大的混音和播放 DJ 软件,Mixx 就可以满足你的需求。它与大多数 MIDI 控制器,唱片,专用声卡所兼容。你可以用它管理音乐库,添加音效,做一些有趣的事情。查看它的[功能][23]来了解它是如何工作的。 +LMMS,设计作为 FL Studio 的替代品,也许使用并不那么广泛,但它非常完整并易于使用。你可以使用自己最喜欢的插件,使用“钢琴键”编辑乐器,使用步定序器step sequencer播放鼓点,混合音轨...几乎能做任何事情。在我没有时间为音乐家录音的时候我就使用它为视频创建声音片段。查看[最好的 LMMS][21] 榜单来看看一些例子。 + +**10、[Mixxx][22]** (DJ,音乐混音) + +如果你需要强大的混音和播放 DJ 软件,Mixxx 就可以满足你的需求。它与大多数 MIDI 控制器、唱片、专用声卡所兼容。你可以用它管理音乐库、添加音效,做一些有趣的事情。查看它的[功能][23]来了解它是如何工作的。 #### 音频接口硬件 -尽管你可以使用任何一个计算机的声卡录制音频,但要录制的很好,就需要一个音频接口——一个录制高质量音频输入的专用的外部声卡。对于跨平台兼容性来说,大多数“兼容 USB”和“兼容 IOS”的音频接口设备应该都能录制 MIDI 或其他音频。下面是一些我用过的一些有名气的跨平台设备。 +尽管你可以使用任何一个计算机的声卡录制音频,但要录制的很好,就需要一个音频接口——一个录制高质量音频输入的专用的外部声卡。对于跨平台兼容性来说,大多数“兼容 USB”和“兼容 iOS”的音频接口设备应该都能录制 MIDI 或其他音频。下面是一些我用过的一些有名气的跨平台设备。 **[Behringer U-PHORIA UMC22][24]** + UMC22 是你可以考虑的最便宜的选择。但它的前置放大器噪音太大,音腔box质量也比较低。 **[Presonus AudioBox USB][25]** -AudioBox USB 是第一个兼容 USB(因此也跨平台) 的录音系统。它非常的耐用,经常在二手市场也能见到。 + +AudioBox USB 是第一个兼容 USB(因此也跨平台)的录音系统。它非常的耐用,经常在二手市场也能见到。 **[Focusrite Scarlett][26]** + Scarlett 在我看来是目前最高质量的跨平台声卡。不同种类的设备可以涵盖 2-18 个输入/输出端口。你可以在二手市场找到它的最初版本,而最新的第二代具有更好的前置放大器与规格。[2i2][27] 型号是我经常使用的那一款。 **[Arturia AudioFuse][28]** + AudioFuse 几乎可以让你接入任何设备,从麦克风到黑胶唱片机再到各种数字输入设备。它具有优质的声音与良好的设计,也是我目前用的最多的一款设备。它是跨平台的,但目前配置软件还不能在 GUN/Linux 上使用。即使我把它从 Windows 电脑上断开,它仍然保留着我的配置。但是讲真,Arturia,劳烦认真考虑做一个 Linux 的软件。 #### MIDI 控制器 -MIDI 控制器是一种乐器——例如电子琴,鼓垫等等。可以让你控制音乐软件或者硬件。现有的大多数 USB MIDI 控制器都跨平台并兼容主流的录音编辑软件。基于网页的教程可以帮你对不同的软件进行配置。尽管找到有关 GNU/Linux 的配置信息可能比较困难,但它们仍然是可以使用的。我用过许多 Akai 和 M-Audio 设备,没有任何问题。在买乐器之前最好先试一下,至少去听一下它们的音质或体验一下按键触感。 +MIDI 控制器是一种乐器——例如电子琴、鼓垫等等。可以让你控制音乐软件或者硬件。现有的大多数 USB MIDI 控制器都跨平台并兼容主流的录音编辑软件。基于网页的教程可以帮你对不同的软件进行配置。尽管找到有关在 GNU/Linux 上配置的信息可能比较困难,但它们仍然是可以使用的。我用过许多 Akai 和 M-Audio 设备,没有任何问题。在买乐器之前最好先试一下,至少去听一下它们的音质或体验一下按键触感。 #### 音频编解码器 @@ -107,38 +126,46 @@ MIDI 控制器是一种乐器——例如电子琴,鼓垫等等。可以让你 #### 软件 -**11.[VLC][31]** (视频播放器与转换器) +**11、[VLC][31]** (视频播放器与转换器) + 最初是为流媒体而开发的,VLC 现在因能够在所有设备上读取所有的视频格式被人们熟知。它非常的实用,例如,你可以使用它将视频转换成其他编解码格式或容器,也可以用来恢复破损的视频。 -**12.[OpenShot][32]** (视频编辑) -OpenShot 是一个简单的软件,但它却可以制作出很好的效果,尤其是在短视频上。(在编辑或改善音质方面有一定的限制,但它也能够完成)我非常喜欢它的移动,拉伸,裁剪工具;用它创建视频的开头或结尾,导出之后使用更复杂的编辑器进行编辑,非常的完美。你可以在 OpenShot 的网站上看这些[例子][33](并获取更多信息)。 +**12、[OpenShot][32]** (视频编辑) + +OpenShot 是一个简单的软件,但它却可以制作出很好的效果,尤其是在短视频上。(在编辑或改善音质方面有一定的限制,但它也能够完成)我非常喜欢它的移动、拉伸、裁剪工具;用它创建视频的开头或结尾,导出之后使用更复杂的编辑器进行编辑,非常的完美。你可以在 OpenShot 的网站上看这些[例子][33](并获取更多信息)。 + +**13、[Shotcut][34]** (视频编辑) -**13.[Shotcut][34]** (视频编辑) 我认为 Shotcut 是比 OpenShot 更完整一些的工具——它在你的操作系统上比起其他较为基础的编辑器更具有竞争力,并且它支持 4K 分辨率,具有专业的解码器。尝试一下,我相信你会爱上它的。你可以在这些[视频教程][35]里看一些范例。 -**14.[Blender Velvets][36]** (视频编辑,合成,特效) -尽管这一章节不是本文的学习重点,但 Blender Velvets 是你能找到的最强大的解决方案之一。它是由一些视频创作者所制作的一系列扩展工具和脚本的合集,是通过 Blender 3D 制作软件转换成的 2D 视频编辑器。 尽管它的复杂度意味着不是我的首选视频编辑器,但你仍可以在 YouTube 和其他网站上找到它的教程,并且一旦你学习了它,你就能通过它做任何事情。观看这个[视频教程][37]来了解它的功能与运作方式。 +**14、[Blender Velvets][36]** (视频编辑、合成、特效) + +尽管这一章节不是本文的学习重点,但 Blender Velvets 是你能找到的最强大的解决方案之一。它是由一些视频创作者所制作的一系列扩展工具和脚本的合集,是通过 Blender 3D 制作软件转换成的 2D 视频编辑器。尽管它的复杂度意味着不是我的首选视频编辑器,但你仍可以在 YouTube 和其他网站上找到它的教程,并且一旦你学习了它,你就能通过它做任何事情。观看这个[视频教程][37]来了解它的功能与运作方式。 + +**15、[Natron][38]**(合成) -**15.[Natron][38]** (合成) 我不使用 Natron,但我听说它广受好评。它是 Adobe After Effects 的替代品,但运作方式并不同。想了解更多可以观看一些视频教程,比如这些 Natron 的 [YouTube 频道][39]。 -**16.[OBS][40]** (实时编辑,录制,流媒体) -Open Broadcaster Software (OBS)是一个领先的在 YouTube 或 Twitch 上进行现场录制或现场直播电子竞技,电视游戏的解决方案。我经常使用它记录用户的屏幕,会议和聚会。获取更多信息,查看我曾经在 Opensource.com 上写的关于录制现场汇报的教程,[第一部分:选择你的设备][42]和[第二部分:软件安装][43]。 +**16、[OBS][40]** (实时编辑、录制、流媒体) + +Open Broadcaster Software(OBS)是一个领先的在 YouTube 或 Twitch 上进行现场录制或现场直播电子竞技、电视游戏的解决方案。我经常使用它记录用户的屏幕、会议和聚会。要获取更多信息,查看我曾经在 Opensource.com 上写的关于录制现场汇报的教程,[第一部分:选择你的设备][42]和[第二部分:软件安装][43]。 #### 视频硬件 -结论先行:你需要一个强大的工作站以及快速的硬盘和更新后的软件和驱动。 +结论先行:你需要一个强大的工作站以及快速的硬盘和更新的软件和驱动。 **图形处理单元(GPU)** + 一部分包含在清单里的软件比如 Blender 和 Shotcut 使用 OpenGL 和硬件加速,这些都高度依赖 GPU。我建议你使用可以负担起的最强大的 GPU。我所使用过的 AMD 和 Nvidia 都有着良好的体验,这取决于使用的平台。不要忘记安装最新的驱动。 -**硬件驱动** -大体上来说,驱动做的越快越大,对视频越好。不要忘记在软件里配置好正确的路径。 +**硬盘** + +大体上来说,越快越大的硬盘,对视频越好。不要忘记在软件里配置好正确的路径。 **视频录制硬件** - * [Blackmagic Design][44]: Blackmagic 提供了非常好,专业级的视频录制和回放硬件。驱动支持 Mac,Windows,和 GNU/Linux(但不是所有的发行版) - * [Epiphan][45]: 在 Epiphan 的专业级 USB 视频录制设备中有一款新型产品,它适用于 HDMI 和高分辨率的屏幕。然而,你也可以在二手市场找到旧的 VGA 设备,因为他们还在继续为 GNU/Linux 和 Windows 上提供专用的驱动程序。 +* [Blackmagic Design][44]: Blackmagic 提供了非常好的、专业级的视频录制和回放硬件。驱动支持 Mac、Windows 和 GNU/Linux(但不是所有的发行版) +* [Epiphan][45]: 在 Epiphan 的专业级 USB 视频录制设备中有一款新型产品,它适用于 HDMI 和高分辨率的屏幕。然而,你也可以在二手市场找到旧的 VGA 设备,因为他们还在继续为 GNU/Linux 和 Windows 上提供专用的驱动程序。 #### 视频编解码 @@ -152,13 +179,16 @@ Open Broadcaster Software (OBS)是一个领先的在 YouTube 或 Twitch 上 #### 软件 -**17. [Blender][48] ** (3D 模型和渲染) -Blender 是顶级的开源跨平台 3D 建模和渲染软件。你可以直接在 Blender 中完成整个项目的工作,或者使用它为电影或视频创建 3D 效果。你能够在网上找到许多视频教程,因此即使它不是一个简单的软件,但非常容易上手。Blender 是一个非常活跃的项目,经常还会制作一些微电影来展示他们的技术。你可以在 [Blender Open Movies][49] 上观看。 +**17、[Blender][48]** (3D 模型和渲染) -**18.[Synfig Studio][50]** (2D 动画) -第一次用 Synfig 时,它让我想起了那个不错的 Macromedia 老式 Flash 编辑器。在那之后,它已经发展成一个全功能的 2D 动画工作室。你可以使用它制作畅销故事,商业广告,演示,开场或结尾动画以及视频中的转场,或者甚至用它制作全动画的电影。见[ Synfig 作品集][51]。 +Blender 是顶级的开源跨平台 3D 建模和渲染软件。你可以直接在 Blender 中完成整个项目的工作,或者使用它为电影或视频创建 3D 效果。你能够在网上找到许多视频教程,因此即使它不是一个简单的软件,但也非常容易上手。Blender 是一个非常活跃的项目,经常还会制作一些微电影来展示他们的技术。你可以在 [Blender Open Movies][49] 上观看。 + +**18、[Synfig Studio][50]** (2D 动画) + +第一次用 Synfig 时,它让我想起了那个不错的 Macromedia 老式 Flash 编辑器。在那之后,它已经发展成一个全功能的 2D 动画工作室。你可以使用它制作宣传故事、商业广告、演示、开场或结尾动画以及视频中的转场,或者甚至用它制作全动画的电影。见 [Synfig 作品集][51]。 + +**19、[TupiTube][52]** (定格 2D 动画) -**19.[TupiTube][52]** (定格 2D 动画) 使用 TupiTube 是一个学习基本 2D 动画的极好方法。你可以将一系列绘画或其他图片转换成一个视频或者创建一个 GIF 循环动画。它是一个相当简单的软件,但非常完整。查看 [TupiTude 的 YouTube][53] 频道获取一些教程和范例。 #### 硬件 @@ -169,18 +199,22 @@ Blender 是顶级的开源跨平台 3D 建模和渲染软件。你可以直接 ### Linux 上的选择 -如果你是 GUN/Linux 用户,那么我为您提供了更多不错的选择。它们并不是完全跨平台的,但部分拥有 Windows 版本,还有一些可以在 Mac 上使用 Macports 安装。 +如果你是 GUN/Linux 用户,那么我为你提供了更多不错的选择。它们并不是完全跨平台的,但部分拥有 Windows 版本,还有一些可以在 Mac 上使用 Macports 安装。 -**20.[Kdenlive][54]** (视频编辑) -伴随着最新版本的发布(几个月之前),Kdenlive 成为了我最喜欢的视频编辑器,尤其是当我在 Linux 机器上处理一些长视频的时候。如果你经常使用流行的非线性视频编辑器,Kdenlive(全称是 KDE 非线性视频编辑器KDE Non-Linear Video Editor)对你来说将非常简单。他拥有很棒的视频和音频特效,强大的细节处理能力。并且在 BSD 和 MacOS(尽管它对准的是 GNU/Linux)都能使用,还有望移植到 Windows 上。 +**20、[Kdenlive][54]** (视频编辑) + +伴随着最新版本的发布(几个月之前),Kdenlive 成为了我最喜欢的视频编辑器,尤其是当我在 Linux 机器上处理一些长视频的时候。如果你经常使用流行的非线性视频编辑器,Kdenlive(全称是 KDE 非线性视频编辑器KDE Non-Linear Video Editor)对你来说将非常简单。它拥有很棒的视频和音频特效,强大的细节处理能力。并且在 BSD 和 MacOS(尽管它对准的是 GNU/Linux)都能使用,还有望移植到 Windows 上。 + +**21、[Darktable][55]** (RAW 图像开发) -**21.[Darktable][55]** (RAW 图像开发) Darktable 是一款由摄影师制作的非常完整的 DxO PhotoLab 替代品。一些研究型项目使用它当做开发平台并测试一些图像处理算法。它是一个非常活跃的项目,我已经等不及的见到它的跨平台版本了。 -**22.[MyPaint][56]** (digital painting数字绘画) -MyPaint 就像数字绘画领域的 light table。(译注:集成开发环境)它在 Wacom 设备上表现良好,并且它的笔刷引擎尤其值得赞赏,因此 GIMP 开发人员正在密切的关注它。 +**22、[MyPaint][56]** (digital painting数字绘画) + +MyPaint 就像数字绘画领域的 light table(LCTT 译注:集成开发环境)。它在 Wacom 设备上表现良好,并且它的笔刷引擎尤其值得赞赏,因此 GIMP 开发人员正在密切的关注它。 + +**23、[Shutter][57]** (桌面截图) -**23.[Shutter][57]** (桌面截图) 当我写这篇教程的时候,我使用了许多截图来进行展示。我最喜欢的 GNU/Linux 截图工具就是 Shutter。事实上,我都找不到在 Windows 或 Mac 上能与之抗衡的一些功能。有一点小遗憾:我很期待 Shutter 在将来能够增加新的功能来创建几秒动态的 GIF 截图。 我希望这些足以说服你开源软件是一种非常卓越且可行的音视频内容生产解决方案。如果你正在使用其他开源软件,或者对于使用跨平台软件和硬件进行音视频项目有好的建议,请在评论中分享你的观点。 @@ -191,7 +225,7 @@ via: https://opensource.com/article/18/2/open-source-audio-visual-production-too 作者:[Antoine Thomas][a] 译者:[LuuMing](https://github.com/LuuMing) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 7769287d8c32759ff14e8555f2f5b45c7bfa02e1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Wed, 4 Dec 2019 09:32:46 +0800 Subject: [PATCH 766/800] PUB @LuuMing https://linux.cn/article-11641-1.html --- .../20180207 23 open source audio-visual production tools.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename {translated/tech => published}/20180207 23 open source audio-visual production tools.md (99%) diff --git a/translated/tech/20180207 23 open source audio-visual production tools.md b/published/20180207 23 open source audio-visual production tools.md similarity index 99% rename from translated/tech/20180207 23 open source audio-visual production tools.md rename to published/20180207 23 open source audio-visual production tools.md index ac3b6affaa..3df9236b46 100644 --- a/translated/tech/20180207 23 open source audio-visual production tools.md +++ b/published/20180207 23 open source audio-visual production tools.md @@ -74,7 +74,7 @@ RawTherapee 是我所知道唯一跨平台可替代 Lightroom 的软件。你可 #### 软件 -**7、[Ardour][15] **(数字音频录制) +**7、[Ardour][15]**(数字音频录制) 对录音与编辑来说,最专业级的工具选择当然是唾手可得的 Ardour。听起来很棒,它的混音部分非常的完整灵活,能够提供给你喜欢的插件,并且易于回放、编辑、对比修改。我经常用它进行声音录制和视频混音。要找出一些使用 Ardour 录制好的音乐并不容易,因为音乐家们很少表明他们使用的软件。然而,你可以查看它的[截图][16]和一些特性来了解它的功能。 From 963458bd3a920e1451596a666c40a394a9a97665 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 4 Dec 2019 19:52:04 +0800 Subject: [PATCH 767/800] Rename sources/tech/20191203 What we risk when we open up to customers (and why it-s worth it).md to sources/talk/20191203 What we risk when we open up to customers (and why it-s worth it).md --- ...e risk when we open up to customers (and why it-s worth it).md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191203 What we risk when we open up to customers (and why it-s worth it).md (100%) diff --git a/sources/tech/20191203 What we risk when we open up to customers (and why it-s worth it).md b/sources/talk/20191203 What we risk when we open up to customers (and why it-s worth it).md similarity index 100% rename from sources/tech/20191203 What we risk when we open up to customers (and why it-s worth it).md rename to sources/talk/20191203 What we risk when we open up to customers (and why it-s worth it).md From 064c372405309a49f398dda3bfbfe71cf22b9402 Mon Sep 17 00:00:00 2001 From: hj24 Date: Wed, 4 Dec 2019 20:31:02 +0800 Subject: [PATCH 768/800] hj24 is translating. --- .../20191203 Using Ansible to organize your SSH keys in AWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md b/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md index f82603fefb..44826bf630 100644 --- a/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md +++ b/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (hj24) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 6a44fb6e2071cfc0951aae45925c77f648e91400 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Wed, 4 Dec 2019 22:48:20 +0800 Subject: [PATCH 769/800] translating by lxbwolf --- ... Check if a Website is up or down from the Linux Terminal.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md b/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md index 85e70ba6a8..b67701a063 100644 --- a/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md +++ b/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 81e5190e0209249165ccdcba820ec7e48d26b5d5 Mon Sep 17 00:00:00 2001 From: hanwckf Date: Wed, 4 Dec 2019 23:30:22 +0800 Subject: [PATCH 770/800] translated.1 --- ...ugging Software Deployments with strace.md | 347 ------------------ ...ugging Software Deployments with strace.md | 347 ++++++++++++++++++ 2 files changed, 347 insertions(+), 347 deletions(-) delete mode 100644 sources/tech/20191114 Debugging Software Deployments with strace.md create mode 100644 translated/tech/20191114 Debugging Software Deployments with strace.md diff --git a/sources/tech/20191114 Debugging Software Deployments with strace.md b/sources/tech/20191114 Debugging Software Deployments with strace.md deleted file mode 100644 index ed80c84912..0000000000 --- a/sources/tech/20191114 Debugging Software Deployments with strace.md +++ /dev/null @@ -1,347 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (hanwckf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Debugging Software Deployments with strace) -[#]: via: (https://theartofmachinery.com/2019/11/14/deployment_debugging_strace.html) -[#]: author: (Simon Arneaud https://theartofmachinery.com) - -Debugging Software Deployments with strace -====== - -Most of my paid work involves deploying software systems, which means I spend a lot of time trying to answer the following questions: - - * This software works on the original developer’s machine, so why doesn’t it work on mine? - * This software worked on my machine yesterday, so why doesn’t it work today? - - - -That’s a kind of debugging, but it’s a different kind of debugging from normal software debugging. Normal debugging is usually about the logic of the code, but deployment debugging is usually about the interaction between the code and its environment. Even when the root cause is a logic bug, the fact that the software apparently worked on another machine means that the environment is usually involved somehow. - -So, instead of using normal debugging tools like `gdb`, I have another toolset for debugging deployments. My favourite tool for “Why isn’t this software working on this machine?” is `strace`. - -### What is `strace`? - -[`strace`][1] is a tool for “system call tracing”. It’s primarily a Linux tool, but you can do the same kind of debugging tricks with tools for other systems (such as [DTrace][2] and [ktrace][3]). - -The basic usage is very simple. Just run it against a command and it dumps all the system calls (you’ll probably need to install `strace` first): - -``` -$ strace echo Hello -...Snip lots of stuff... -write(1, "Hello\n", 6) = 6 -close(1) = 0 -close(2) = 0 -exit_group(0) = ? -+++ exited with 0 +++ -``` - -What are these system calls? They’re like the API for the operating system kernel. Once upon a time, software used to have direct access to the hardware it ran on. If it needed to display something on the screen, for example, it could twiddle with ports and/or memory-mapped registers for the video hardware. That got chaotic when multitasking computer systems became popular because different applications would “fight” over hardware, and bugs in one application could crash other applications, or even bring down the whole system. So CPUs started supporting different privilege modes (or “protection rings”). They let an operating system kernel run in the most privileged mode with full hardware access, while spawning less-privileged software applications that must ask the kernel to interact with the hardware for them using system calls. - -At the binary level, making a system call is a bit different from making a simple function call, but most programs use wrappers in a standard library. E.g. the POSIX C standard library contains a `write()` function call that contains all the architecture-dependent code for making the `write` system call. - -![][4] - -In short, an application’s interaction with its environment (the computer system) is all done through system calls. So when software works on one machine but not another, looking at system call traces is a good way to find what’s wrong. More specifically, here are the typical things you can analyse using a system call trace: - - * Console input and output (IO) - * Network IO - * Filesystem access and file IO - * Process/thread lifetime management - * Raw memory management - * Access to special device drivers - - - -### When can `strace` be used? - -In theory, `strace` can be used with any userspace program because all userspace programs have to make system calls. It’s more effective with compiled, lower-level programs, but still works with high-level languages like Python if you can wade through the extra noise from the runtime environment and interpreter. - -`strace` shines with debugging software that works fine on one machine, but on another machine fails with a vague error message about files or permissions or failure to run some command or something. Unfortunately, it’s not so great with higher-level problems, like a certificate verification failure. They usually need a combination of `strace`, sometimes [`ltrace`][5], and higher-level tooling (like the `openssl` command line tool for certificate debugging). - -The examples in this post are based on a standalone server, but system call tracing can often be done on more complicated deployment platforms, too. Just search for appropriate tooling. - -### A simple debugging example - -Let’s say you’re trying to run an awesome server application called foo, but here’s what happens: - -``` -$ foo -Error opening configuration file: No such file or directory -``` - -Obviously it’s not finding the configuration file that you’ve written. This can happen because package managers sometimes customise the expected locations of files when compiling an application, so following an installation guide for one distro leads to files in the wrong place on another distro. You could fix the problem in a few seconds if only the error message told you where the configuration file is expected to be, but it doesn’t. How can you find out? - -If you have access to the source code, you could read it and work it out. That’s a good fallback plan, but not the fastest solution. You also could use a stepping debugger like `gdb` to see what the program does, but it’s more efficient to use a tool that’s specifically designed to show the interaction with the environment: `strace`. - -The output of `strace` can be a bit overwhelming at first, but the good news is that you can ignore most of it. It often helps to use the `-o` switch to save the trace to a separate file: - -``` -$ strace -o /tmp/trace foo -Error opening configuration file: No such file or directory -$ cat /tmp/trace -execve("foo", ["foo"], 0x7ffce98dc010 /* 16 vars */) = 0 -brk(NULL) = 0x56363b3fb000 -access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) -openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 -fstat(3, {st_mode=S_IFREG|0644, st_size=25186, ...}) = 0 -mmap(NULL, 25186, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2f12cf1000 -close(3) = 0 -openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 -read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260A\2\0\0\0\0\0"..., 832) = 832 -fstat(3, {st_mode=S_IFREG|0755, st_size=1824496, ...}) = 0 -mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2f12cef000 -mmap(NULL, 1837056, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2f12b2e000 -mprotect(0x7f2f12b50000, 1658880, PROT_NONE) = 0 -mmap(0x7f2f12b50000, 1343488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f2f12b50000 -mmap(0x7f2f12c98000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16a000) = 0x7f2f12c98000 -mmap(0x7f2f12ce5000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f2f12ce5000 -mmap(0x7f2f12ceb000, 14336, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2f12ceb000 -close(3) = 0 -arch_prctl(ARCH_SET_FS, 0x7f2f12cf0500) = 0 -mprotect(0x7f2f12ce5000, 16384, PROT_READ) = 0 -mprotect(0x56363b08b000, 4096, PROT_READ) = 0 -mprotect(0x7f2f12d1f000, 4096, PROT_READ) = 0 -munmap(0x7f2f12cf1000, 25186) = 0 -openat(AT_FDCWD, "/etc/foo/config.json", O_RDONLY) = -1 ENOENT (No such file or directory) -dup(2) = 3 -fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) -brk(NULL) = 0x56363b3fb000 -brk(0x56363b41c000) = 0x56363b41c000 -fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x8), ...}) = 0 -write(3, "Error opening configuration file"..., 60) = 60 -close(3) = 0 -exit_group(1) = ? -+++ exited with 1 +++ -``` - -The first page or so of `strace` output is typically low-level process startup. (You can see a lot of `mmap`, `mprotect`, `brk` calls for things like allocating raw memory and mapping dynamic libraries.) Actually, when debugging an error, `strace` output is best read from the bottom up. You can see the `write` call that outputs the error message at the end. If you work up, the first failing system call is the `openat` call that fails with `ENOENT` (“No such file or directory”) trying to open `/etc/foo/config.json`. And now we know where the configuration file is supposed to be. - -That’s a simple example, but I’d say at least 90% of the time I use `strace`, I’m not doing anything more complicated. Here’s the complete debugging formula step-by-step: - - 1. Get frustrated by a vague system-y error message from a program - 2. Run the program again with `strace` - 3. Find the error message in the trace - 4. Work upwards to find the first failing system call - - - -There’s a very good chance the system call in step 4 shows you what went wrong. - -### Some tips - -Before walking through a more complicated example, here are some useful tips for using `strace` effectively: - -#### `man` is your friend - -On many *nix systems, you can get a list of all kernel system calls by running `man syscalls`. You’ll see things like `brk(2)`, which means you can get more information by running `man 2 brk`. - -One little gotcha: `man 2 fork` shows me the man page for the `fork()` wrapper in GNU `libc`, which is actually now implemented using the `clone` system call instead. The semantics of `fork` are the same, but if I write a program using `fork()` and `strace` it, I won’t find any `fork` calls in the trace, just `clone` calls. Gotchas like that are only confusing if you’re comparing source code to `strace` output. - -#### Use `-o` to save output to a file - -`strace` can generate a lot of output so it’s often helpful to store the trace in a separate file (as in the example above). It also avoids mixing up program output with `strace` output in the console. - -#### Use `-s` to see more argument data - -You might have noticed that the second part of the error message doesn’t appear in the example trace above. That’s because `strace` only shows the first 32 bytes of string arguments by default. If you need to capture more, add something like `-s 128` to the `strace` invocation. - -#### `-y` makes it easier to track files/sockets/etc - -“Everything is a file” means *nix systems do all IO using file descriptors, whether it’s to an actual file or over networks or through interprocess pipes. That’s convenient for programming, but makes it harder to follow what’s really going on when you see generic `read` and `write` in the system call trace. - -Adding the `-y` switch makes `strace` annotate every file descriptor in the output with a note about what it points to. - -#### Attach to an already-running process with `-p` - -As we’ll see in the example later, sometimes you want to trace a program that’s already running. If you know it’s running as process 1337 (say, by looking at the output of `ps`), you can trace it like this: - -``` -$ strace -p 1337 -...system call trace output... -``` - -You probably need root. - -#### Use `-f` to follow child processes - -By default, `strace` only traces the one process. If that process spawns a child process, you’ll see the system call for spawning the process (normally `clone` nowadays), but not any of the calls made by the child process. - -If you think the bug is in a child process, you’ll need to use the `-f` switch to enable tracing it. A downside is that the output can be more confusing. When tracing one process and one thread, `strace` can show you a single stream of call events. When tracing multiple processes, you might see the start of a call cut off with ``, then a bunch of calls for other threads of execution, before seeing the end of the original call with `<... foocall resumed>`. Alternatively, you can separate all the traces into different files by using the `-ff` switch as well (see [the `strace` manual][6] for details). - -#### You can filter the trace with `-e` - -As you’ve seen, the default trace output is a firehose of all system calls. You can filter which calls get traced using the `-e` flag (see [the `strace` manual][6]). The main advantage is that it’s faster to run the program under a filtered `strace` than to trace everything and `grep` the results later. Honestly, I don’t bother most of the time. - -#### Not all errors are bad - -A simple and common example is a program searching for a file in multiple places, like a shell searching for which `bin/` directory has an executable: - -``` -$ strace sh -c uname -... -stat("/home/user/bin/uname", 0x7ffceb817820) = -1 ENOENT (No such file or directory) -stat("/usr/local/bin/uname", 0x7ffceb817820) = -1 ENOENT (No such file or directory) -stat("/usr/bin/uname", {st_mode=S_IFREG|0755, st_size=39584, ...}) = 0 -... -``` - -The “last failed call before the error message” heuristic is pretty good at finding relevent errors. In any case, working from the bottom up makes sense. - -#### C programming guides are good for understanding system calls - -Standard C library calls aren’t system calls, but they’re only thin layers on top. So if you understand (even just roughly) how to do something in C, it’s easier to read a system call trace. For example, if you’re having trouble debugging networking system calls, you could try skimming through [Beej’s classic Guide to Network Programming][7]. - -### A more complicated debugging example - -As I said, that simple debugging example is representative of most of my `strace` usage. However, sometimes a little more detective work is required, so here’s a slightly more complicated (and real) example. - -[`bcron`][8] is a job scheduler that’s yet another implementation of the classic *nix `cron` daemon. It’s been installed on a server, but here’s what happens when someone tries to edit a job schedule: - -``` -# crontab -e -u logs -bcrontab: Fatal: Could not create temporary file -``` - -Okay, so bcron tried to write some file, but it couldn’t, and isn’t telling us why. This is a debugging job for `strace`: - -``` -# strace -o /tmp/trace crontab -e -u logs -bcrontab: Fatal: Could not create temporary file -# cat /tmp/trace -... -openat(AT_FDCWD, "bcrontab.14779.1573691864.847933", O_RDONLY) = 3 -mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82049b4000 -read(3, "#Ansible: logsagg\n20 14 * * * lo"..., 8192) = 150 -read(3, "", 8192) = 0 -munmap(0x7f82049b4000, 8192) = 0 -close(3) = 0 -socket(AF_UNIX, SOCK_STREAM, 0) = 3 -connect(3, {sa_family=AF_UNIX, sun_path="/var/run/bcron-spool"}, 110) = 0 -mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82049b4000 -write(3, "156:Slogs\0#Ansible: logsagg\n20 1"..., 161) = 161 -read(3, "32:ZCould not create temporary f"..., 8192) = 36 -munmap(0x7f82049b4000, 8192) = 0 -close(3) = 0 -write(2, "bcrontab: Fatal: Could not creat"..., 49) = 49 -unlink("bcrontab.14779.1573691864.847933") = 0 -exit_group(111) = ? -+++ exited with 111 +++ -``` - -There’s the error message `write` near the end, but a couple of things are different this time. First, there’s no relevant system call error that happens before it. Second, we see that the error message has just been `read` from somewhere else. It looks like the real problem is happening somewhere else, and `bcrontab` is just replaying the message. - -If you look at `man 2 read`, you’ll see that the first argument (the 3) is a file descriptor, which is what *nix uses for all IO handles. How do you know what file descriptor 3 represents? In this specific case, you could run `strace` with the `-y` switch (as explained above) and it would tell you automatically, but it’s useful to know how to read and analyse traces to figure things like this out. - -A file descriptor can come from one of many system calls (depending on whether it’s a descriptor for the console, a network socket, an actual file, or something else), but in any case we can search for calls returning 3 (i.e., search for “= 3” in the trace). There are two in this trace: the `openat` at the top, and the `socket` in the middle. `openat` opens a file, but the `close(3)` afterwards shows that it gets closed again. (Gotcha: file descriptors can be reused as they’re opened and closed.) The `socket` call is the relevant one (it’s the last one before the `read`), which tells us `bcrontab` is talking to something over a network socket. The next line, `connect` shows file descriptor 3 being configured as a Unix domain socket connection to `/var/run/bcron-spool`. - -So now we need to figure out what’s listening on the other side of the Unix socket. There are a couple of neat tricks for that, both useful for debugging server deployments. One is to use `netstat` or the newer `ss` (“socket status”). Both commands describe active network sockets on the system, and take the `-l` switch for describing listening (server) sockets, and the `-p` switch to get information about what program is using the socket. (There are many more useful options, but those two are enough to get this job done.) - -``` -# ss -pl | grep /var/run/bcron-spool -u_str LISTEN 0 128 /var/run/bcron-spool 1466637 * 0 users:(("unixserver",pid=20629,fd=3)) -``` - -That tells us that the listener is a command `unixserver` running as process ID 20629. (It’s a coincidence that it’s also using file descriptor 3 for the socket.) - -The second really useful tool for finding the same information is `lsof`. It can list all open files (or file descriptors) on the system. Alternatively, we can get information about a specific file: - -``` -# lsof /var/run/bcron-spool -COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME -unixserve 20629 cron 3u unix 0x000000005ac4bd83 0t0 1466637 /var/run/bcron-spool type=STREAM -``` - -Process 20629 is a long-running server, so we can attach `strace` to it using something like `strace -o /tmp/trace -p 20629`. If we then try to edit the cron schedule in another terminal, we can capture a trace while the error is happening. Here’s the result: - -``` -accept(3, NULL, NULL) = 4 -clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21181 -close(4) = 0 -accept(3, NULL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) ---- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21181, si_uid=998, si_status=0, si_utime=0, si_stime=0} --- -wait4(0, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED, NULL) = 21181 -wait4(0, 0x7ffe6bc36764, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes) -rt_sigaction(SIGCHLD, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, 8) = 0 -rt_sigreturn({mask=[]}) = 43 -accept(3, NULL, NULL) = 4 -clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21200 -close(4) = 0 -accept(3, NULL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) ---- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21200, si_uid=998, si_status=111, si_utime=0, si_stime=0} --- -wait4(0, [{WIFEXITED(s) && WEXITSTATUS(s) == 111}], WNOHANG|WSTOPPED, NULL) = 21200 -wait4(0, 0x7ffe6bc36764, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes) -rt_sigaction(SIGCHLD, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, 8) = 0 -rt_sigreturn({mask=[]}) = 43 -accept(3, NULL, NULL -``` - -(The last `accept` doesn’t complete during the trace period.) Unfortunately, once again, this trace doesn’t contain the error we’re after. We don’t see any of the messages that we saw `bcrontab` sending to and receiving from the socket. Instead, we see a lot of process management (`clone`, `wait4`, `SIGCHLD`, etc.). This process is spawning a child process, which we can guess is doing the real work. If we want to catch a trace of that, we have to add `-f` to the `strace` invocation. Here’s what we find if we search for the error message after getting a new trace with `strace -f -o /tmp/trace -p 20629`: - -``` -21470 openat(AT_FDCWD, "tmp/spool.21470.1573692319.854640", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) -21470 write(1, "32:ZCould not create temporary f"..., 36) = 36 -21470 write(2, "bcron-spool[21470]: Fatal: logs:"..., 84) = 84 -21470 unlink("tmp/spool.21470.1573692319.854640") = -1 ENOENT (No such file or directory) -21470 exit_group(111) = ? -21470 +++ exited with 111 +++ -``` - -Now we’re getting somewhere. Process ID 21470 is getting a permission denied error trying to create a file at the path `tmp/spool.21470.1573692319.854640` (relative to the current working directory). If we just knew the current working directory, we would know the full path and could figure out why the process can’t create create its temporary file there. Unfortunately, the process has already exited, so we can’t just use `lsof -p 21470` to find out the current directory, but we can work backwards looking for PID 21470 system calls that change directory. (If there aren’t any, PID 21470 must have inherited it from its parent, and we can `lsof -p` that.) That system call is `chdir` (which is easy to find out using today’s web search engines). Here’s the result of working backwards through the trace, all the way to the server PID 20629: - -``` -20629 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21470 -... -21470 execve("/usr/sbin/bcron-spool", ["bcron-spool"], 0x55d2460807e0 /* 27 vars */) = 0 -... -21470 chdir("/var/spool/cron") = 0 -... -21470 openat(AT_FDCWD, "tmp/spool.21470.1573692319.854640", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) -21470 write(1, "32:ZCould not create temporary f"..., 36) = 36 -21470 write(2, "bcron-spool[21470]: Fatal: logs:"..., 84) = 84 -21470 unlink("tmp/spool.21470.1573692319.854640") = -1 ENOENT (No such file or directory) -21470 exit_group(111) = ? -21470 +++ exited with 111 +++ -``` - -(If you’re getting lost here, you might want to read [my previous post about *nix process management and shells][9].) Okay, so the server PID 20629 doesn’t have permission to create a file at `/var/spool/cron/tmp/spool.21470.1573692319.854640`. The most likely reason would be classic *nix filesystem permission settings. Let’s check: - -``` -# ls -ld /var/spool/cron/tmp/ -drwxr-xr-x 2 root root 4096 Nov 6 05:33 /var/spool/cron/tmp/ -# ps u -p 20629 -USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND -cron 20629 0.0 0.0 2276 752 ? Ss Nov14 0:00 unixserver -U /var/run/bcron-spool -- bcron-spool -``` - -There’s the problem! The server is running as user `cron`, but only `root` has permissions to write to that `/var/spool/cron/tmp/` directory. A simple `chown cron /var/spool/cron/tmp/` makes `bcron` work properly. (If that weren’t the problem, the next most likely suspect would be a kernel security module like SELinux or AppArmor, so I’d check the kernel logs with `dmesg`.) - -### Summary - -System call traces can be overwhelming at first, but I hope I’ve shown that they’re a fast way to debug a whole class of common deployment problems. Imagine trying to debug that multi-process `bcron` problem using a stepping debugger. - -Working back through a chain of system calls takes practice, but as I said, most of the time I use `strace` I just get a trace and look for errors, working from the bottom up. In any case, `strace` has saved me hours and hours of debugging time. I hope it’s useful for you, too. - --------------------------------------------------------------------------------- - -via: https://theartofmachinery.com/2019/11/14/deployment_debugging_strace.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://strace.io/ -[2]: http://dtrace.org/blogs/about/ -[3]: https://man.openbsd.org/ktrace -[4]: https://theartofmachinery.com/images/strace/system_calls.svg -[5]: https://linux.die.net/man/1/ltrace -[6]: https://linux.die.net/man/1/strace -[7]: https://beej.us/guide/bgnet/html/index.html -[8]: https://untroubled.org/bcron/ -[9]: https://theartofmachinery.com/2018/11/07/writing_a_nix_shell.html diff --git a/translated/tech/20191114 Debugging Software Deployments with strace.md b/translated/tech/20191114 Debugging Software Deployments with strace.md new file mode 100644 index 0000000000..ee3c54090d --- /dev/null +++ b/translated/tech/20191114 Debugging Software Deployments with strace.md @@ -0,0 +1,347 @@ +[#]: collector: (lujun9972) +[#]: translator: (hanwckf) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Debugging Software Deployments with strace) +[#]: via: (https://theartofmachinery.com/2019/11/14/deployment_debugging_strace.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +在软件部署中使用 strace 进行调试 +====== + +我的大部分工作都包括部署软件系统,这意味着我需要花费很多时间来解决以下问题: + + * 这个软件可以在原始开发者的机器上工作,但是为什么不能在我这里运行? + * 这个软件昨天可以在我的机器上工作,但是为什么今天就不行? + + + +这是调试的一种类型,但是与传统的软件调试有所不同。传统的调试通常只关心代码的逻辑,但是在软件部署中的调试关注的是程序的代码和它所在的运行环境之间的相互影响。即便问题的根源是代码的逻辑错误,但软件显然可以在别的机器上运行的事实意味着这类问题与运行环境密切相关。 + +所以,在软件部署过程中,我没有使用传统的调试工具(例如 `gdb`),而是选择了其它工具进行调试。我最喜欢的用来解决“为什么这个软件无法在这台机器上运行?”这类问题的工具就是 `strace`。 + +### 什么是 `strace`? + +[`strace`][1] 是一个用来“追踪系统调用”的工具。它主要是一个 Linux 工具,但是你也可以在其它系统上使用类似的工具(例如 [DTrace][2] 和 [ktrace][3])。 + +它的基本用法非常简单。只需要在 `strace` 后面跟上你需要运行的命令,它就会显示出该命令触发的所有系统调用(你可能需要先安装好 `strace`): + +``` +$ strace echo Hello +...Snip lots of stuff... +write(1, "Hello\n", 6) = 6 +close(1) = 0 +close(2) = 0 +exit_group(0) = ? ++++ exited with 0 +++ +``` + +这些系统调用都是什么?他们就像是操作系统提供的 API。很久以前,软件拥有直接访问硬件的权限。如果软件需要在屏幕上显示一些东西,它将会与视频硬件的端口和内存映射寄存器纠缠不清。当多任务操作系统变得流行以后,这就导致了混乱的局面,因为不同的应用程序将“争夺”硬件,并且一个应用程序的错误可能致使其它应用程序崩溃,甚至导致整个系统崩溃。所以 CPUs 开始支持多种不同的特权模式 (或者称为“保护环”)。它们让操作系统内核在具有完全硬件访问权限的最高特权模式下运行,于此同时,其它在低特权模式下运行的应用程序必须通过向内核发起系统调用才能够与硬件进行交互。 + +在二进制级别上,发起系统调用相比简单的函数调用有一些区别,但是大部分程序都使用标准库提供的封装函数。例如,POSIX C 标准库包含一个 `write()` 函数,该函数包含用于进行 `write` 系统调用的所有与硬件体系结构相关的代码。 + +![][4] + +简单来说,一个应用程序与其环境(计算机系统)的相互影响都是通过系统调用来作用的。所以当软件在一台机器上可以工作但是在另一台机器无法工作的时候,追踪系统调用是一个很好的查错方法。具体地说,你可以通过追踪系统调用分析以下典型操作: + + * 控制台输入与输出 (IO) + * 网络 IO + * 文件系统访问以及文件 IO + * 进程/线程 生命周期管理 + * 原始内存管理 + * 访问特定的设备驱动 + + + +### 什么时候可以使用 `strace`? + +理论上,`strace` 适用于任何用户空间程序,因为所有的用户空间程序都需要进行系统调用。`strace` 对于已编译的低级程序最有效果,但如果你可以避免运行时环境和解释器带来的大量额外输出,则仍然可以与 Python 等高级语言程序一起使用。 + +当软件在一台机器上正常工作,但在另一台机器上却不能正常工作,同时抛出有关文件、权限或者不能运行某某命令等模糊的错误信息时,`strace` 往往能大显身手。不幸的是,它不能诊断高等级的问题,例如数字证书验证错误等。这些问题通常需要结合 `strace`(有时候是 [`ltrace`][5]),以及其它高级工具(例如使用 `openssl` 命令行工具调试数字证书错误)。 + +本文中的示例基于独立的服务器,但是对系统调用的追踪通常也可以在更复杂的部署平台上完成,仅需要找到合适的工具。 + +### 一个简单的例子 + +假设你正在尝试运行一个叫做 foo 的服务器应用程序,但是发生了以下情况: + +``` +$ foo +Error opening configuration file: No such file or directory +``` + +显然,它没有找到你已经写好的配置文件。之所以会发生这种情况,是因为包管理工具有时候在编译应用程序时指定了自定义的路径,所以你应当遵循特定发行版提供的安装指南。如果错误信息告诉你正确的配置文件应该在什么地方,你就可以在几秒钟内解决这个问题,但事实并非如此。你该如何找到正确的路径? + +如果你有权访问源代码,则可以通过阅读源代码来解决问题。这是一个好的备用计划,但不是最快的解决方案。你还可以使用类似 `gdb` 的单步调试器来观察程序的行为,但使用专门用于展示程序与系统环境交互作用的工具 `strace` 更加有效。 + +一开始, `strace` 产生的大量输出可能会让你不知所措,幸好你可以忽略其中大部分的无用信息。我经常使用 `-o` 参数把输出的追踪结果保存到单独的文件里: + +``` +$ strace -o /tmp/trace foo +Error opening configuration file: No such file or directory +$ cat /tmp/trace +execve("foo", ["foo"], 0x7ffce98dc010 /* 16 vars */) = 0 +brk(NULL) = 0x56363b3fb000 +access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +fstat(3, {st_mode=S_IFREG|0644, st_size=25186, ...}) = 0 +mmap(NULL, 25186, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2f12cf1000 +close(3) = 0 +openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 +read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260A\2\0\0\0\0\0"..., 832) = 832 +fstat(3, {st_mode=S_IFREG|0755, st_size=1824496, ...}) = 0 +mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2f12cef000 +mmap(NULL, 1837056, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f2f12b2e000 +mprotect(0x7f2f12b50000, 1658880, PROT_NONE) = 0 +mmap(0x7f2f12b50000, 1343488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x22000) = 0x7f2f12b50000 +mmap(0x7f2f12c98000, 311296, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16a000) = 0x7f2f12c98000 +mmap(0x7f2f12ce5000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b6000) = 0x7f2f12ce5000 +mmap(0x7f2f12ceb000, 14336, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f2f12ceb000 +close(3) = 0 +arch_prctl(ARCH_SET_FS, 0x7f2f12cf0500) = 0 +mprotect(0x7f2f12ce5000, 16384, PROT_READ) = 0 +mprotect(0x56363b08b000, 4096, PROT_READ) = 0 +mprotect(0x7f2f12d1f000, 4096, PROT_READ) = 0 +munmap(0x7f2f12cf1000, 25186) = 0 +openat(AT_FDCWD, "/etc/foo/config.json", O_RDONLY) = -1 ENOENT (No such file or directory) +dup(2) = 3 +fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) +brk(NULL) = 0x56363b3fb000 +brk(0x56363b41c000) = 0x56363b41c000 +fstat(3, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0x8), ...}) = 0 +write(3, "Error opening configuration file"..., 60) = 60 +close(3) = 0 +exit_group(1) = ? ++++ exited with 1 +++ +``` + +`strace` 输出的第一页通常是低级的进程启动过程。(你可以看到很多 `mmap`,`mprotect`,`brk` 调用,这是用来分配原始内存和映射动态链接库的。)实际上,在查找错误时,最好从下往上阅读 `strace` 的输出。你可以看到 `write` 调用在最后返回了错误信息。如果你努力了,你将会看到第一个失败的系统调用是 `openat`,它在尝试打开 `/etc/foo/config.json` 时抛出了 `ENOENT` (“No such file or directory”)的错误。现在我们已经知道了配置文件应该放在哪里。 + +这是一个简单的例子,但我敢说在 90% 的情况下,使用 `strace` 进行调试不需要更多复杂的工作。以下是完整的调试步骤: + + 1. 从程序中获得含糊不清的错误信息 + 2. 使用 `strace` 运行程序 + 3. 在输出中找到错误信息 + 4. 往前追溯并找到第一个失败的系统调用 + + + +第四步中的系统调用很可能向你显示出问题所在。 + +### 小技巧 + +在开始更加复杂的调试之前,这里有一些有用的调试技巧帮助你高效使用 `strace`: + +#### `man` 是你的朋友 + +在很多 *nix 操作系统中,你可以通过 `man syscalls` 查看系统调用的列表。你将会看到类似于 `brk(2)` 之类的东西,这意味着你可以通过运行 `man 2 brk` 得到与此相关的更多信息。 + +一个小问题:`man 2 fork` 会显示出在 GNU `libc` 里封装的 `fork()` 手册页,而 `fork()` 现在实际上是由 `clone` 系统调用实现的。`fork` 的语义与 `clone` 相同,但是如果我写了一个含有 `fork()` 的程序并使用 `strace` 去调试它,我将找不到任何关于 `fork` 调用的信息,只能看到 `clone` 调用。只有在将源代码与 `strace` 的输出进行比较的时候,这种问题才会让人感到困惑。 + +#### 使用 `-o` 将输出保存到文件 + +`strace` 可以生成很多输出,所以将输出保存到单独的文件是很有帮助的 (就像上面的例子一样)。它还能够在控制台中避免程序自身的输出与 `strace` 的输出发生混淆。 + +#### 使用 `-s` 查看更多的参数 + +你可能已经注意到,错误信息的第二部分没有出现在上面的例子中。这是因为 `strace` 默认仅显示字符串参数的前 32 个字节。如果你需要捕获更多参数,请向 `strace` 追加类似于 `-s 128` 之类的参数。 + +#### `-y` 使得追踪文件或套接字更加容易 + +“一切皆文件”意味着 *nix 系统通过文件描述符进行所有 IO 操作,不管是真实的文件还是通过网络或者进程间管道。这对于编程而言是很方便的,但是在追踪系统调用时,你将很难分辨出 `read` 和 `write` 的真实行为。 + +`-y` 参数使 `strace` 在注释中注明每个文件描述符的具体指向。 + +#### 使用 `-p` 附加到正在运行的进程中 + +正如我们将在后面的例子中看到的,有时候你想追踪一个正在运行的程序。如果你知道这个程序的进程号为 1337 (可以通过 `ps` 查询),则可以这样操作: + +``` +$ strace -p 1337 +...system call trace output... +``` + +你可能需要 root 权限才能运行。 + +#### 使用 `-f` 追踪子进程 + +`strace` 默认只追踪一个进程。如果这个进程产生了一个子进程,你将会看到创建子进程的系统调用(一般是 `clone`),但是你看不到子进程内触发的任何调用。 + +如果你认为在子进程中存在 bug,则需要使用 `-f` 参数启用子进程追踪功能。这样做的缺点是输出的内容会让人更加困惑。当追踪一个进程时,`strace` 显示的是单个调用事件流。当追踪多个进程的时候,你将会看到以 `` 开始的初始调用,接着是一系列针对其它线程的调用,最后才出现以 `<... foocall resumed>` 结束的初始调用。此外,你可以使用 `-ff` 参数将所有的调用分离到不同的文件中(查看 [the `strace` manual][6] 获取更多信息)。 + +#### 使用 `-e` 进行过滤 + +正如你所看到的,默认的追踪输出是所有的系统调用。你可以使用 `-e` 参数过滤你需要追踪的调用(查看 [the `strace` manual][6])。这样做的好处是运行过滤后的 `strace` 比起使用 `grep` 进行二次过滤要更快。老实说,我大部分时间都不会被打扰。 + +#### 并非所有的错误都是不好的 + +一个简单而常用的例子是一个程序在多个位置搜索文件,例如 shell 搜索哪个 `bin/` 目录包含可执行文件: + +``` +$ strace sh -c uname +... +stat("/home/user/bin/uname", 0x7ffceb817820) = -1 ENOENT (No such file or directory) +stat("/usr/local/bin/uname", 0x7ffceb817820) = -1 ENOENT (No such file or directory) +stat("/usr/bin/uname", {st_mode=S_IFREG|0755, st_size=39584, ...}) = 0 +... +``` + +“错误信息之前的最后一次失败调用”这种启发式方法非常适合于查找错误。无论如何,自下而上地工作是有道理的。 + +#### C编程指南非常有助于理解系统调用 + +标准 C 库函数调用不属于系统调用,但它们仅是系统调用之上的唯一一个薄层。所以如果你了解(甚至只是略知一二)如何使用 C 语言,那么阅读系统调用追踪信息就非常容易。例如,如果你在调试网络系统调用,你可以尝试略读 [Beej’s classic Guide to Network Programming][7]。 + +### 一个更复杂的调试例子 + +就像我说的那样,简单的调试例子代表我在大部分情况下如何使用 `strace` 。然而,有时候需要一些更加细致的工作,所以这里有一个稍微复杂(且真实)的例子。 + +[`bcron`][8] 是一个任务调度器,它是经典 *nix `cron` 守护程序的一种实现。它已经被安装到一台服务器上,但是当有人尝试编辑作业时间表时,发生了以下情况: + +``` +# crontab -e -u logs +bcrontab: Fatal: Could not create temporary file +``` + +好的,现在 bcron 尝试写入一些文件,但是它失败了,也没有告诉我们原因。以下是 `strace` 的输出: + +``` +# strace -o /tmp/trace crontab -e -u logs +bcrontab: Fatal: Could not create temporary file +# cat /tmp/trace +... +openat(AT_FDCWD, "bcrontab.14779.1573691864.847933", O_RDONLY) = 3 +mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82049b4000 +read(3, "#Ansible: logsagg\n20 14 * * * lo"..., 8192) = 150 +read(3, "", 8192) = 0 +munmap(0x7f82049b4000, 8192) = 0 +close(3) = 0 +socket(AF_UNIX, SOCK_STREAM, 0) = 3 +connect(3, {sa_family=AF_UNIX, sun_path="/var/run/bcron-spool"}, 110) = 0 +mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f82049b4000 +write(3, "156:Slogs\0#Ansible: logsagg\n20 1"..., 161) = 161 +read(3, "32:ZCould not create temporary f"..., 8192) = 36 +munmap(0x7f82049b4000, 8192) = 0 +close(3) = 0 +write(2, "bcrontab: Fatal: Could not creat"..., 49) = 49 +unlink("bcrontab.14779.1573691864.847933") = 0 +exit_group(111) = ? ++++ exited with 111 +++ +``` + +在程序结束之前有一个 `write` 的错误信息,但是这次有些不同。首先,在此之前没有任何相关的失败系统调用。其次,我们看到这个错误信息是由 `read` 从别的地方读取而来的。这看起来像是真正的错误发生在别的地方,而 `bcrontab` 只是在转播这些信息。 + +如果你查阅了 `man 2 read`,你将会看到 `read` 的第三个参数 (3) 代表文件描述符,这是 *nix 操作系统用于所有 IO 操作的句柄。你该如何知道文件描述符 3 代表什么?在这种情况下,你可以使用 `-y` 参数运行 `strace`(如上文所述),它将会在注释里告诉你文件描述符的具体指向,但是了解如何从上面这种输出中分析追踪结果是很有用的。 + +一个文件描述符可以来自于许多系统调用之一(这取决于它是用于控制台、网络套接字还是真实文件等的描述符),但不论如何,我们都可以搜索返回值为 3 的系统调用(例如,在 `strace` 的输出中查找 “=3”)。在这次 `strace` 中可以看到有两个这样的调用:最上面的 `openat` 以及中间的 `socket`。`openat` 打开一个文件,但是紧接着的 `close(3)` 表明其已经被关闭。(注意:文件描述符可以在打开并关闭后重复使用。)所以 `socket` 调用才是与此相关的(它是在 `read` 之前的最后一次),这告诉我们 `brcontab` 正在与一个网络套接字通信。在下一行,`connect` 表明文件描述符 3 是一个连接到 `/var/run/bcron-spool` 的 Unix 域套接字。 + +因此,我们需要弄清楚 Unix 套接字的另一侧是哪个进程在监听。有两个巧妙的技巧适用于在服务器部署中调试。一个是使用 `netstat` 或者较新的 `ss`。这两个命令都描述了当前系统中活跃的网络套接字,使用 `-l` 参数可以显示出处于监听状态的套接字,而使用 `-p` 参数可以得到正在使用该套接字的程序信息。(它们还有更多有用的选项,但是这两个已经足够完成工作了。) + +``` +# ss -pl | grep /var/run/bcron-spool +u_str LISTEN 0 128 /var/run/bcron-spool 1466637 * 0 users:(("unixserver",pid=20629,fd=3)) +``` + +这告诉我们 `/var/run/bcron-spool` 套接字的监听程序是 `unixserver` 这个命令,它的进程 ID 为 20629。(巧合的是,这个程序也使用文件描述符 3 去连接这个套接字。) + +第二个常用的工具就是使用 `lsof` 查找相同的信息。它可以列出当前系统中打开的所有文件(或文件描述符)。或者,我们可以得到一个具体文件的信息: + +``` +# lsof /var/run/bcron-spool +COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME +unixserve 20629 cron 3u unix 0x000000005ac4bd83 0t0 1466637 /var/run/bcron-spool type=STREAM +``` + +进程 20629 是一个常驻进程,所以我们可以使用 `strace -o /tmp/trace -p 20629` 去查看该进程的系统调用。如果我们在另一个终端尝试编辑 cron 的计划任务表,就可以在错误发生时捕获到以下信息: + +``` +accept(3, NULL, NULL) = 4 +clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21181 +close(4) = 0 +accept(3, NULL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) +--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21181, si_uid=998, si_status=0, si_utime=0, si_stime=0} --- +wait4(0, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], WNOHANG|WSTOPPED, NULL) = 21181 +wait4(0, 0x7ffe6bc36764, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes) +rt_sigaction(SIGCHLD, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, 8) = 0 +rt_sigreturn({mask=[]}) = 43 +accept(3, NULL, NULL) = 4 +clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21200 +close(4) = 0 +accept(3, NULL, NULL) = ? ERESTARTSYS (To be restarted if SA_RESTART is set) +--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=21200, si_uid=998, si_status=111, si_utime=0, si_stime=0} --- +wait4(0, [{WIFEXITED(s) && WEXITSTATUS(s) == 111}], WNOHANG|WSTOPPED, NULL) = 21200 +wait4(0, 0x7ffe6bc36764, WNOHANG|WSTOPPED, NULL) = -1 ECHILD (No child processes) +rt_sigaction(SIGCHLD, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, {sa_handler=0x55d244bdb690, sa_mask=[CHLD], sa_flags=SA_RESTORER|SA_RESTART, sa_restorer=0x7faa47ab9840}, 8) = 0 +rt_sigreturn({mask=[]}) = 43 +accept(3, NULL, NULL +``` + +(最后一个 `accept` 调用没有在追踪周期里完成。)不幸的是,这次追踪没有包含我们想要的错误信息。我们没有观察到 `bcrontan` 往套接字发送或接受的任何信息。然而,我们看到了很多进程管理操作(`clone`,`wait4`,`SIGCHLD`,等等)。这个进程产生了子进程,我们猜测真实的工作是由子进程完成的。如果我们想捕获子进程的追踪信息,就必须往 `strace` 追加 `-f` 参数。以下是我们最终使用 `strace -f -o /tmp/trace -p 20629` 找到的错误信息: + +``` +21470 openat(AT_FDCWD, "tmp/spool.21470.1573692319.854640", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) +21470 write(1, "32:ZCould not create temporary f"..., 36) = 36 +21470 write(2, "bcron-spool[21470]: Fatal: logs:"..., 84) = 84 +21470 unlink("tmp/spool.21470.1573692319.854640") = -1 ENOENT (No such file or directory) +21470 exit_group(111) = ? +21470 +++ exited with 111 +++ +``` + +现在我们知道了进程 ID 21470 在尝试创建文件 `tmp/spool.21470.1573692319.854640` (相对于当前的工作目录)时得到了一个没有权限的错误。如果我们知道当前的工作目录,就可以得到完整路径并能指出为什么该进程无法在此处创建临时文件。不幸的是,这个进程已经退出了,所以我们不能使用 `lsof -p 21470` 去找出当前的工作目录,但是我们可以往前追溯,查找进程 ID 21470 使用哪个系统调用改变了它的工作目录。这个系统调用是 `chdir`(可以在搜索引擎很轻松地找到)。以下是一直往前追溯到服务器进程 ID 20629 的结果: + +``` +20629 clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7faa47c44810) = 21470 +... +21470 execve("/usr/sbin/bcron-spool", ["bcron-spool"], 0x55d2460807e0 /* 27 vars */) = 0 +... +21470 chdir("/var/spool/cron") = 0 +... +21470 openat(AT_FDCWD, "tmp/spool.21470.1573692319.854640", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied) +21470 write(1, "32:ZCould not create temporary f"..., 36) = 36 +21470 write(2, "bcron-spool[21470]: Fatal: logs:"..., 84) = 84 +21470 unlink("tmp/spool.21470.1573692319.854640") = -1 ENOENT (No such file or directory) +21470 exit_group(111) = ? +21470 +++ exited with 111 +++ +``` + +(如果你在这里失败了,你可能需要阅读 [我之前有关 *nix 进程管理和 shell 的文章][9])好的,现在 PID 为 20629 的服务器进程没有权限在 `/var/spool/cron/tmp/spool.21470.1573692319.854640` 创建文件。最可能的原因就是典型的 *nix 文件系统权限设置。让我们检查一下: + +``` +# ls -ld /var/spool/cron/tmp/ +drwxr-xr-x 2 root root 4096 Nov 6 05:33 /var/spool/cron/tmp/ +# ps u -p 20629 +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +cron 20629 0.0 0.0 2276 752 ? Ss Nov14 0:00 unixserver -U /var/run/bcron-spool -- bcron-spool +``` + +这就是问题所在!这个服务进程以 `cron` 用户运行,但是只有 `root` 用户才有向 `/var/spool/cron/tmp/` 目录写入的权限。一个简单 `chown cron /var/spool/cron/tmp/` 命令就能让 `bcron` 正常工作。(如果不是这个问题,那么下一个最有可能的怀疑对象是诸如 SELinux 或者 AppArmor 之类的内核安全模块,因此我将会使用 `dmesg` 检查内核日志。) + +### 总结 + +最初,系统调用追踪可能会让人不知所措,但是我希望我已经证明它们是调试一整套常见部署问题的快速方法。你可以设想一下尝试用单步调试器去调试多进程的 `bcron` 问题。 + +通过一连串的系统调用解决问题是需要练习的,但正如我说的那样,在大多数情况下,我只需要使用 `strace` 从下往上追踪并查找错误。不管怎样,`strace` 节省了我很多的调试时间。我希望这也对你有所帮助。 + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2019/11/14/deployment_debugging_strace.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[hanwckf](https://github.com/hanwckf) +校对:[校对者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://strace.io/ +[2]: http://dtrace.org/blogs/about/ +[3]: https://man.openbsd.org/ktrace +[4]: https://theartofmachinery.com/images/strace/system_calls.svg +[5]: https://linux.die.net/man/1/ltrace +[6]: https://linux.die.net/man/1/strace +[7]: https://beej.us/guide/bgnet/html/index.html +[8]: https://untroubled.org/bcron/ +[9]: https://theartofmachinery.com/2018/11/07/writing_a_nix_shell.html From 9f9634e15b25c490eedbd66c46c923f9bf481ea7 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Dec 2019 00:52:11 +0800 Subject: [PATCH 771/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191204=20Fedora?= =?UTF-8?q?=20Desktops=20=E2=80=93=20Memory=20Footprints?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191204 Fedora Desktops - Memory Footprints.md --- ...204 Fedora Desktops - Memory Footprints.md | 82 +++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 sources/tech/20191204 Fedora Desktops - Memory Footprints.md diff --git a/sources/tech/20191204 Fedora Desktops - Memory Footprints.md b/sources/tech/20191204 Fedora Desktops - Memory Footprints.md new file mode 100644 index 0000000000..f9a3ea0f3b --- /dev/null +++ b/sources/tech/20191204 Fedora Desktops - Memory Footprints.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora Desktops – Memory Footprints) +[#]: via: (https://fedoramagazine.org/fedora-desktops-memory-footprints/) +[#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) + +Fedora Desktops – Memory Footprints +====== + +![][1] + +There are over 40 desktops in Fedora. Each desktop has it’s own strengths and weaknesses. Usually picking a desktop is a very personal preference based on features, looks, and other qualities. Sometimes, what you pick for a desktop is limited by hardware constraints. + +This article is to help people compare Fedora desktops based on the desktop baseline memory. To narrow the scope, we are only looking at the desktops that have an official Fedora Live image. + +### Installation and Setup + +Each of the desktops was installed on it’s own KVM virtual machine. Each virtual machine had 1 CPU, 4GB of memory, 15 GB virtio solid state disk, and everything else that comes standard on RHEL 8.0 kvm. + +The images for installation were the standard Fedora 31 Live images. For GNOME, that image was the Fedora Workstation. For the other desktops, the corresponding Spin was used. Sugar On A Stick (SOAS) was not tested because it does not install easily onto a local drive. + +The virtual machine booted into the Live CD. “Install to Hard Disk” was selected. During the install, only the defaults were used. A root user, and a regular users were created. After installation and reboot, the Live image was verified to not be in the virtual CDROM. + +The settings for each desktop was not touched. They each ran whatever settings came default from the Live CD installation. Each desktop was logged into via the regular user. A terminal was opened. Using sudo each machine ran “dnf -y update”. After update, in that sudo terminal, each machine ran “/sbin/shutdown -h now” to shut down. + +### Testing + +Each machine was started up. The desktop was logged into via the regular user. Three of the desktop terminals were opened. xterm was never used, it was always the terminal for that desktop, such as konsole. + +In one terminal, top was started and M pressed, showing the processes sorted by memory. In another terminal, a simple while loop showed “free -m” every 30 seconds. The third terminal was idle. + +I then waited 5 minutes. This allowed any startup services to finish. I recorded the final free result, as well as the final top three memory consumers from top. + +### Results + + * Cinnamon + * 624 MB Memory used + * cinnamon 4.8% / Xorg 2.2% / dnfdragora 1.8% + * GNOME + * 612 MB Memory used + * gnome-shell 6.9% / gnome-software 1.8% / ibus-x11 1.5% + * KDE + * 733 MB Memory used + * plasmashell 6.2% / kwin_x11 3.6% / akonadi_mailfil 2.9% + * LXDE + * 318 MB Memory used + * Xorg 1.9% / nm-applet 1.8% / dnfdragora 1.8% + * LXQt + * 391 MB Memory used + * lxqt-panel 2.2% / pcmanfm-qt 2.1% / Xorg 2.1% + * MATE + * 465 MB Memory used + * Xorg 2.5% / dnfdragora 1.8% / caja 1.5% + * XFCE + * 448 MB Memory used + * Xorg 2.3% / xfwm4 2.0% / dnfdragora 1.8% + + + +### Conclusion + +I will let the numbers speak for themselves. + +Remember that these numbers are from a default Live install. If you remove, or add services and features, your memory usage will change. But this is a good baseline to look at if you are determining your desktop based on memory consumption. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-desktops-memory-footprints/ + +作者:[Troy Dawson][a] +选题:[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/tdawson/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/11/desktop-memory-footprint-816x346.jpg From 3f3ac8891675ac2f72712f5434b09047bb451889 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Dec 2019 00:58:26 +0800 Subject: [PATCH 772/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191204=20Comple?= =?UTF-8?q?mentary=20engineering=20indicators?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191204 Complementary engineering indicators.md --- ...04 Complementary engineering indicators.md | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sources/tech/20191204 Complementary engineering indicators.md diff --git a/sources/tech/20191204 Complementary engineering indicators.md b/sources/tech/20191204 Complementary engineering indicators.md new file mode 100644 index 0000000000..981720ab11 --- /dev/null +++ b/sources/tech/20191204 Complementary engineering indicators.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Complementary engineering indicators) +[#]: via: (https://dave.cheney.net/2019/12/04/complementary-engineering-indicators) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Complementary engineering indicators +====== + +Last year I had the opportunity to watch Cat Swetel’s presentation _[The Development Metrics You Should Use (but Don’t)][1]_. The information that could be gleaned from just tracking the start and finish date of work items was eye opening. If you’re using an issue tracker this information is probably already (perhaps with some light data munging) available — no need for TPS reports. Additionally, statistics obtained by data mining your project’s issue tracker are, perhaps, less likely to be juked. + +Around the time I saw Cat’s presentation I finished reading Andy Grove’s _High Output Management_. The hidden gem in this book (assuming becoming a meeting powerhouse isn’t your bag) was Grove’s notion of indicator pairs. An example of a paired indicator might be the number of sales deals closed paired with the customer retention rate. The underling principle being optimising for one indicator will have an adverse impact on the other. In the example, overly aggressive or deceptive tactics could superficially raise the number of sales made, but would be reflected in a dip in the retention rate as customers returned the product or terminated their service prematurely. + +These ideas lead me to thinking about indicators you could use for a team delivering a software product. Could those indicators be derived cheaply from the hand to hand combat of software delivery? Could they be structured in a way that aggressively pursuing one metric would be reflected negatively in another? I think so. + +These are the three metrics that I’ve been using to track the health of the project that I lead. + + * Date; was the software done when we said it would be done. If you prefer this indicator as a scalar, how many days difference is there between the ship date agreed on at the start of the sprint/milestone/whatever and what was the actual date that you considered it done. + * Completeness; when the software is done, how many of the things we said we’re going to do actually got delivered in that release. + * Defects reported; once the software is in the field, what is the rate of bugs reported. + + + +It is relatively easy, for example, to hit a delivery date if you aggressively descope anything risky or simply don’t do it. But in doing so this lack of promised functionality would impact the completeness metric. + +Conversely, it’s straight forward to hit your milestone’s completeness target if you let the release date slip and slip. Bringing both the metics into line requires good estimation skills to judge how much can be attempted in milestone and provide direct feedback if your estimation skills needed work. + +The third indicator, defects reported in the field, acts as a check on the other two. It would be easy to consistent hit your delivery date with 100% feature completion if your team does a shoddy job. The high fives and 🎉 emojis will be short lived if each release brings with it a swathe of high priority bug reports. This indicator also tends to have a second order effect, rushed features to meet a deadline tend to generate remedial work in the following milestones, crowding out promised work or blowing later deadlines. + +I consider these to be complementary metrics, they should be considered together, as a group, rather than individually. Ideally your team should be delivering what you promised, when you promised it, with a low defect rate. But more importantly, if that isn’t the case, if one of the indicators is unhealthy, addressing it shouldn’t result in the problem moving to another. + +### Related posts: + + 1. [Never edit a method, always rewrite it][2] + 2. [The Mythical Man-Month selection bias][3] + 3. [The office coffee model of concurrent garbage collection][4] + 4. [Sydney High Performance Go workshop][5] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/12/04/complementary-engineering-indicators + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/watch?v=cW3yM-K2M08 +[2]: https://dave.cheney.net/2017/11/30/never-edit-a-method-always-rewrite-it (Never edit a method, always rewrite it) +[3]: https://dave.cheney.net/2013/12/04/the-mythical-man-month-selection-bias (The Mythical Man-Month selection bias) +[4]: https://dave.cheney.net/2018/12/28/the-office-coffee-model-of-concurrent-garbage-collection (The office coffee model of concurrent garbage collection) +[5]: https://dave.cheney.net/2019/07/05/sydney-high-performance-go-workshop (Sydney High Performance Go workshop) From 01c3026fff1ad7818a1970fc6cdc750ccffa0b70 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Dec 2019 00:58:51 +0800 Subject: [PATCH 773/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191204=20Java?= =?UTF-8?q?=20vs.=20Python:=20Which=20should=20you=20choose=3F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191204 Java vs. Python- Which should you choose.md --- ...ava vs. Python- Which should you choose.md | 157 ++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 sources/tech/20191204 Java vs. Python- Which should you choose.md diff --git a/sources/tech/20191204 Java vs. Python- Which should you choose.md b/sources/tech/20191204 Java vs. Python- Which should you choose.md new file mode 100644 index 0000000000..b8b38f494b --- /dev/null +++ b/sources/tech/20191204 Java vs. Python- Which should you choose.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Java vs. Python: Which should you choose?) +[#]: via: (https://opensource.com/article/19/12/java-vs-python) +[#]: author: (Archit Modi https://opensource.com/users/architmodi) + +Java vs. Python: Which should you choose? +====== +Compare the two most popular programming languages in the world, and let +us know which one you prefer in our poll. +![Developing code.][1] + +Let's compare the two most popular and powerful programming languages in the world: Java and Python! Both languages have huge community support and libraries to perform almost any programming task, although selecting a programming language usually depends on the developer's use case. After you compare and contrast, please make sure to answer our poll to [share your opinion][2] on which is best. + +### What is it? + + * **Java** is a general-purpose object-oriented programming language used mostly for developing a wide range of applications from mobile to web to enterprise apps. + * **Python** is a high-level object-oriented programming language used mostly for web development, artificial intelligence, machine learning, automation, and other data science applications. + + + +### Creator + + * **Java** was created by James Gosling (Sun Microsystems). + * **Python** was created by Guido van Rossum. + + + +### Open source status + + * **Java** is free and (mostly) open source except for corporate use. + * **Python** is free and open source for all use cases. + + + +### Platform dependencies + + * **Java** is platform-independent (although JVM isn't) per its WORA ("write once, run anywhere") philosophy. + * **Python** is platform-dependent. + + + +### Compiled or interpreted + + * **Java** is a compiled language. Java programs are translated to byte code at compile time and not runtime. + * **Python** is an interpreted language. Python programs are translated at runtime. + + + +### File creation + + * **Java**: After compilation, **<filename>.class** is generated. + * **Python**: During runtime, **<filename>.pyc** is created. + + + +### Errors types + + * **Java** has ****2 ****types of errors: compile and runtime errors. + * **Python** has 1 error type: traceback (or runtime) error. + + + +### Statically or dynamically typed + + * **Java** is statically typed. When initiating variables, their types need to be specified in the program because type checking is done at compile time. + * **Python** is dynamically typed. Variables don't need to have a type specified when initiated because type checking is done at runtime. + + + +### Syntax + + * **Java**: Every statement needs to end with a semicolon ( **;** ), and blocks of code are separated by curly braces ( **{}** ). + * **Python**: Blocks of code are separated by indentation (the user can choose how many white spaces to use, but it should be consistent throughout the block). + + + +### Number of classes + + * **Java**: Only one public top-level class can exist in a single file in Java. + * **Python**: Any number of classes can exist in a single file in Python. + + + +### More or less code? + + * **Java** generally involves writing more lines of code compared to Python. + * **Python** involves writing fewer lines of code compared to Java. + + + +### Multiple inheritance + + * **Java** does not support multiple inheritance (inheriting from two or more base classes) + * **Python** supports multiple inheritance although it is rarely implemented due to various issues like inheritance complexity, hierarchy, dependency issues, etc. + + + +### Multi-threading + + * **Java** multi-threading can support two or more concurrent threads running at the same time. + * **Python** uses a global interpreter lock (GIL), allowing only a single thread (CPU core) to run at a time. + + + +### Execution speed + + * **Java** is usually faster in execution time than Python. + * **Python** is usually slower in execution time than Java. + + + +### Hello world in Java + + +``` +public class Hello { +   public static void main([String][3][] args) { +      [System][4].out.println("Hello Opensource.com from Java!"); +   } +} +``` + +### Hello world in Python + + +``` +`print("Hello Opensource.com from Java!")` +``` + +### Run the programs + +![Java vs. Python][5] + +To run the java program "Hello.java" you need to compile it first which creates a "Hello.class" file. To run just the class name, use "java Hello." For Python, you would just run the file "python3 helloworld.py." + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/java-vs-python + +作者:[Archit Modi][a] +选题:[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/architmodi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_development_programming.png?itok=M_QDcgz5 (Developing code.) +[2]: tmp.Bpi8QYfp8j#poll +[3]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[4]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[5]: https://opensource.com/sites/default/files/uploads/python-java-hello-world_0.png (Java vs. Python) From 6499d001b189725b3249415419dd7316b7886473 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Dec 2019 00:59:08 +0800 Subject: [PATCH 774/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191204=204=20wa?= =?UTF-8?q?ys=20to=20control=20the=20flow=20of=20your=20awk=20script?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191204 4 ways to control the flow of your awk script.md --- ... to control the flow of your awk script.md | 273 ++++++++++++++++++ 1 file changed, 273 insertions(+) create mode 100644 sources/tech/20191204 4 ways to control the flow of your awk script.md diff --git a/sources/tech/20191204 4 ways to control the flow of your awk script.md b/sources/tech/20191204 4 ways to control the flow of your awk script.md new file mode 100644 index 0000000000..df08e99812 --- /dev/null +++ b/sources/tech/20191204 4 ways to control the flow of your awk script.md @@ -0,0 +1,273 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways to control the flow of your awk script) +[#]: via: (https://opensource.com/article/19/12/control-awk-script) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +4 ways to control the flow of your awk script +====== +Learn to use switch statements and the break, continue, and next +commands to control awk scripts. +![JavaScript in Vim][1] + +There are many ways to control the flow of an awk script, including [loops][2], **switch** statements and the **break**, **continue**, and **next** commands. + +### Sample data + +Create a sample data set called **colours.txt** and copy this content into it: + + +``` +name       color  amount +apple      red    4 +banana     yellow 6 +strawberry red    3 +raspberry  red    99 +grape      purple 10 +apple      green  8 +plum       purple 2 +kiwi       brown  4 +potato     brown  9 +pineapple  yellow 5 +``` + +### Switch statements + +The **switch** statement is a feature specific to GNU awk, so you can only use it with **gawk**. If your system or your target system doesn't have **gawk**, then you should not use a switch statement. + +The **switch** statement in **gawk** is similar to the one in C and many other languages. The syntax is: + + +``` +switch (expression) { +        case VALUE: +                <do something here> +        [...] +        default: +                <do something here> +} +``` + +The **expression** part can be any awk expression that returns a numeric or string result. The **VALUE** part (after the word **case**) is a numeric or string constant or a regular expression. + +When a **switch** statement runs, the _expression_ is evaluated, and the result is matched against each case value. If there's a match, then the code contained within a case definition is executed. If there's no match in any case definition, then the default statement is executed. + +The keyword **break** is at the end of the code in each case definition to break the loop. Without **break**, awk would continue to search for matching case values. + +Here's an example **switch** statement: + + +``` +#!/usr/bin/awk -f +# +# Example of the use of 'switch' in GNU Awk. + +NR > 1 { +    printf "The %s is classified as: ",$1 + +    switch ($1) { +        case "apple": +            print "a fruit, pome" +            break +        case "banana": +        case "grape": +        case "kiwi": +            print "a fruit, berry" +            break +                case "raspberry": +                        print "a computer, pi" +                        break +        case "plum": +            print "a fruit, drupe" +            break +        case "pineapple": +            print "a fruit, fused berries (syncarp)" +            break +        case "potato": +            print "a vegetable, tuber" +            break +        default: +            print "[unclassified]" +    } +} +``` + +This script notably ignores the first line of the file, which in the case of the sample data is just a header. It does this by operating only on records with an index number greater than 1. On all other records, this script compares the contents of the first field (**$1**, as you know from previous articles) to the value of each **case** definition. If there's a match, the **print** function is used to print the botanical classification of the entry. If there are no matches, then the **default** instance prints **"[unclassified]"**. + +The banana, grape, and kiwi are all botanically classified as a berry, so there are three **case** definitions associated with one **print** result. + +Run the script on the **colours.txt** sample file, and you should get this: + + +``` +The apple is classified as: a fruit, pome +The banana is classified as: a fruit, berry +The strawberry is classified as: [unclassified] +The raspberry is classified as: a computer, pi +The grape is classified as: a fruit, berry +The apple is classified as: a fruit, pome +The plum is classified as: a fruit, drupe +The kiwi is classified as: a fruit, berry +The potato is classified as: a vegetable, tuber +The pineapple is classified as: a fruit, fused berries (syncarp) +``` + +### Break + +The **break** statement is mainly used for the early termination of a **for**, **while**, or **do-while** loop or a **switch** statement. In a loop, **break** is often used where it's not possible to determine the number of iterations of the loop beforehand. Invoking **break** terminates the enclosing loop (which is relevant when there are nested loops or loops within loops). + +This example, straight out of the [GNU awk manual][3], shows a method of finding the smallest divisor. Read the additional comments for a clear understanding of how the code works: + + +``` +#!/usr/bin/awk -f + +{ +    num = $1 + +    # Make an infinite FOR loop +    for (divisor = 2; ; divisor++) { + +        # If num is divisible by divisor, then break +        if (num % divisor == 0) { +            printf "Smallest divisor of %d is %d\n", num, divisor +            break +        } + +        # If divisor has gotten too large, the number has no +        # divisor, so is a prime +        if (divisor * divisor > num) { +            printf "%d is prime\n", num +            break +        } +    } +} +``` + +Try running the script to see its results: + + +``` +    $ echo 67 | ./divisor.awk +    67 is prime +    $ echo 69 | ./divisor.awk +    Smallest divisor of 69 is 3 +``` + +As you can see, even though the script starts out with an explicit _infinite_ loop with no end condition, the **break** function ensures that the script eventually terminates. + +### Continue + +The **continue** function is similar to **break**. It can be used in a **for**, **while**, or **do-while** loop (it's not relevant to a **switch** statements, though). Invoking **continue** skips the rest of the enclosing loop and begins the next cycle. + +Here's another good example from the GNU awk manual to demonstrate a possible use of **continue**: + + +``` +#!/usr/bin/awk -f + +# Loop, printing numbers 0-20, except 5 + +BEGIN { +    for (x = 0; x <= 20; x++) { +        if (x == 5) +            continue +        printf "%d ", x +    } +    print "" +} +``` + +This script analyzes the value of **x** before printing anything. If the value is exactly 5, then **continue** is invoked, causing the **printf** line to be skipped, but leaves the loop unbroken. Try the same code but with **break** instead to see the difference. + +### Next + +This statement is not related to loops like **break** and **continue** are. Instead, **next** applies to the main record processing cycle of awk: the functions you place between the BEGIN and END functions. The **next** statement causes awk to stop processing the _current input record_ and to move to the next one. + +As you know from the earlier articles in this series, awk reads records from its input stream and applies rules to them. The **next** statement stops the execution of rules for the current record and moves to the next one. + +Here's an example of **next** being used to "hold" information upon a specific condition: + + +``` +#!/usr/bin/awk -f + +# Ignore the header +NR == 1 { next } + +# If field 2 (colour) is less than 6 +# characters, then save it with its +#  line number and skip it + +length($2) < 6 { +    skip[NR] = $0 +    next +} + +# It's not the header and +# the colour name is > 6 characters, +# so print the line +{ +    print +} + +# At the end, show what was skipped +END { +    printf "\nSkipped:\n" +    for (n in skip) +        print n": "skip[n] +} +``` + +This sample uses **next** in the first rule to avoid the first line of the file, which is a header row. The second rule skips lines when the color name is less than six characters long, but it also saves that line in an array called **skip**, using the line number as the key (also known as the _index_). + +The third rule prints anything it sees, but it is not invoked if either rule 1 or rule 2 causes it to be skipped. + +Finally, at the end of all the processing, the **END** rule prints the contents of the array. + +Run the sample script on the **colours.txt** file from above (and previous articles): + + +``` +$ ./next.awk colours.txt +banana     yellow 6 +grape      purple 10 +plum       purple 2 +pineapple  yellow 5 + +Skipped: +2: apple      red    4 +4: strawberry red    3 +6: apple      green  8 +8: kiwi       brown  4 +9: potato     brown  9 +``` + +### Control freak + +In summary, **switch**, **continue**, **next**, and **break** are important preemptive exceptions to awk rules that provide greater control of your script. You don't have to use them directly; often, you can gain the same logic through other means, but they're great convenience functions that make the coder's life a lot easier. The next article in this series covers the **printf** statement. + +* * * + +Would you rather listen to this article? It was adapted from an episode of [Hacker Public Radio][4], a community technology podcast by hackers, for hackers. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/control-awk-script + +作者:[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/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim) +[2]: https://opensource.com/article/19/11/loops-awk +[3]: https://www.gnu.org/software/gawk/manual/ +[4]: http://hackerpublicradio.org/eps.php?id=2438 From b0b81c79508cb8d40140098b58641e2bdcd5f16b Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Dec 2019 00:59:27 +0800 Subject: [PATCH 775/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191204=20Spice?= =?UTF-8?q?=20up=20your=20Linux=20desktop=20with=20Cinnamon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191204 Spice up your Linux desktop with Cinnamon.md --- ...ice up your Linux desktop with Cinnamon.md | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sources/tech/20191204 Spice up your Linux desktop with Cinnamon.md diff --git a/sources/tech/20191204 Spice up your Linux desktop with Cinnamon.md b/sources/tech/20191204 Spice up your Linux desktop with Cinnamon.md new file mode 100644 index 0000000000..036f253188 --- /dev/null +++ b/sources/tech/20191204 Spice up your Linux desktop with Cinnamon.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Spice up your Linux desktop with Cinnamon) +[#]: via: (https://opensource.com/article/19/12/cinnamon-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Spice up your Linux desktop with Cinnamon +====== +This article is part of a special series of 24 days of Linux desktops. +Just like its namesake, the Cinnamon Linux desktop is warm and inviting +and cozy. +![Cinnamon][1] + +When GNOME 3 was released, some GNOME users were not ready to give up GNOME 2. The [Linux Mint][2] project was so dissatisfied with GNOME 3 that it started its own desktop as an alternative, and thus the [Cinnamon][3] desktop was born. + +Cinnamon originally sought to "remix" GNOME 3 so that it looked and acted like the GNOME 2 so many users knew and loved, but eventually, it diverged enough to be a true fork. Today, Cinnamon uses GTK3 libraries and forked versions of key GNOME 3 applications to create a classic GNOME experience. + +You may find Cinnamon in your distribution's software repository, or you can download and install a distribution that ships with Cinnamon as its default desktop. Before you do, though, be aware that it is meant to provide a full desktop experience, so many Cinnamon apps are installed along with the desktop. If you're already running a different desktop, you may find yourself with redundant applications (two PDF readers, two media players, two file managers, and so on). + +If you just want to try the Cinnamon desktop, you can install a Cinnamon-based distribution in a virtual machine, such as [GNOME Boxes][4]. + +### Cinnamon desktop tour + +The Cinnamon desktop layout has a classic look, although—in spite of being inspired by GNOME 2—that look is not at all like GNOME 2. In fact, it shares more with KDE's Plasma desktop than with GNOME 2, with an application menu in the lower-left corner, a taskbar for pinned and active applications, and a system tray in the lower-right corner. There's no top menu bar with Applications and Places and System menus, and the taskbar uses icons with no text, so if it's a clone of GNOME 2 you're looking for, Cinnamon doesn't provide that. + +![Cinnamon desktop on Linux Mint][5] + +What Cinnamon does provide, however, is the opportunity for Linux Mint developers to control the environment they maintain. The Mint desktop is very much a Linux Mint creation, so much so that it's almost a part of the Mint brand. And yet it's appealing enough for enough users that it's available on [other distributions][6], even ones traditionally seen as "rivals" (at least, insofar as there are rivalries in open source). Here's the Cinnamon desktop environment fitting in nicely with a Fedora install: + +![Cinnamon desktop on Fedora][7] + +The desktop experience, aside from its panel layout, is a simple and classic one. There are icons on the desktop serving as shortcuts to common locations, there's an application for most file-management tasks, and there are applets in the systems tray for common administrative tasks. It's a familiar user experience. Just like its name, it's warm and inviting and cozy. + +### Customizing the desktop + +Cinnamon isn't as flexible as something like Fluxbox or KDE, but it's not as rigid as GNOME 3 or Pantheon. The System Settings application provides customization for all the usual small details, such as keyboard layout, keyboard shortcuts, workspace behavior, a firewall, and so on. A right-click on any element usually brings up a useful contextual menu with settings or information about what you've clicked. + +There are definitely some expectations about what your workflow ought to be when using Cinnamon, but these assumptions are all generic and safe. It may not be the most efficient desktop environment, but it's soundly a generic, all-purpose one. Both power users and new users feel at home in Cinnamon. You can customize the experience within certain parameters, and if you hit the ceiling when you try to make drastic changes, then you can fall back on the fact that this is open source, and you have plenty of other options. + +You may never hit that ceiling, though. Cinnamon's an attractive and responsive interface. It's a pleasure to use because it's simple and intuitive, with no surprises or puzzling user-interface choices to slow you down. With a few custom keyboard shortcuts and a little time to settle into a new environment, you can do amazing things with Cinnamon, and you'll love every moment of it because it's a beautiful thing to witness. Cinnamon is restrained with animations and effects, and the ones it uses are appealing and even informative. + +### Spice of life + +It's fun to try new desktops, and Cinnamon is worth trying. Install or download it today and see what you think. It's one of those desktops that you already know how to use, even if you've never used it before. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/cinnamon-linux-desktop + +作者:[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/cinnamon.jpg?itok=4GV-boum (Cinnamon) +[2]: https://www.linuxmint.com/ +[3]: https://github.com/linuxmint/Cinnamon +[4]: https://opensource.com/article/19/5/getting-started-gnome-boxes-virtualization +[5]: https://opensource.com/sites/default/files/uploads/advent-cinnamon.jpg (Cinnamon desktop on Linux Mint) +[6]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment)#Adoption +[7]: https://opensource.com/sites/default/files/uploads/advent-cinnamon-fedora.jpg (Cinnamon desktop on Fedora) From cc2010e8ed8ad6480b58af9d883a90680f5fe68c Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Dec 2019 00:59:44 +0800 Subject: [PATCH 776/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20How=20?= =?UTF-8?q?to=20write=20a=20security=20integration=20module=20for=20Ansibl?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 How to write a security integration module for Ansible.md --- ... How to write a security integration module for Ansible.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/tech/20191203 How to write a security integration module for Ansible.md b/sources/tech/20191203 How to write a security integration module for Ansible.md index 5cbe10e482..550dfd44a6 100644 --- a/sources/tech/20191203 How to write a security integration module for Ansible.md +++ b/sources/tech/20191203 How to write a security integration module for Ansible.md @@ -4,7 +4,7 @@ [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (How to write a security integration module for Ansible) -[#]: via: (https://opensource.com/article/19/12/how-write-security-integration-module-ansible) +[#]: via: (https://opensource.com/article/19/12/security-ansible-module) [#]: author: (Adam Miller https://opensource.com/users/maxamillion) How to write a security integration module for Ansible @@ -149,7 +149,7 @@ If you have questions about Ansible module development models, feel free to reac -------------------------------------------------------------------------------- -via: https://opensource.com/article/19/12/how-write-security-integration-module-ansible +via: https://opensource.com/article/19/12/security-ansible-module 作者:[Adam Miller][a] 选题:[lujun9972][b] From 06dda6683073ebe4e6f8b7c0eb75d5f1fe37691d Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Dec 2019 01:00:04 +0800 Subject: [PATCH 777/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191203=20Soluti?= =?UTF-8?q?ons=20to=20the=20tiny=20window=20manager=20challenge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/tech/20191203 Solutions to the tiny window manager challenge.md --- ...ns to the tiny window manager challenge.md | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 sources/tech/20191203 Solutions to the tiny window manager challenge.md diff --git a/sources/tech/20191203 Solutions to the tiny window manager challenge.md b/sources/tech/20191203 Solutions to the tiny window manager challenge.md new file mode 100644 index 0000000000..54883376cc --- /dev/null +++ b/sources/tech/20191203 Solutions to the tiny window manager challenge.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solutions to the tiny window manager challenge) +[#]: via: (https://jvns.ca/blog/2019/12/03/solutions-to-the-tiny-window-manager-challenge/) +[#]: author: (Julia Evans https://jvns.ca/) + +Solutions to the tiny window manager challenge +====== + +Hello! Last week I posted a small [programming challenge to write a tiny window manager that bounces windows around the screen][1]. + +![][2] + +I’ll write a bit about my experience of solving the challenge, or you can just skip to the end to see the solutions. + +### what’s a window manager? + +An X window manager is a program that sends messages to the X server (which is in charge of drawing your windows) to tell it which windows to display and where. + +I found out that you can trace those events with `xtrace`. Here’s some example output from xtrace (for the toy window manager which is just moving windows about) + +``` +000:<:02d8: 20: Request(12): ConfigureWindow window=0x004158e5 values={x=560 y=8} +000:<:02da: 20: Request(12): ConfigureWindow window=0x004158e5 values={x=554 y=12} +000:<:02dc: 20: Request(12): ConfigureWindow window=0x004158e5 values={x=548 y=16} +000:<:02de: 20: Request(12): ConfigureWindow window=0x004158e5 values={x=542 y=20} +000:<:02e0: 20: Request(12): ConfigureWindow window=0x004158e5 values={x=536 y=24} +000:<:02e2: 20: Request(12): ConfigureWindow window=0x004158e5 values={x=530 y=28} +000:<:02e4: 20: Request(12): ConfigureWindow window=0x004158e5 values={x=524 y=32} +``` + +### you can run programs without a window manager + +You technically don’t _need_ a window manager to run graphical programs – if you want to start an xterm in a window-manager-less X session you can just run + +``` +xterm -display :1 +``` + +and it’ll start the xterm. Here’s a screenshot of an X session with no window manager open. I even have 2 windows open! (chrome and an xterm). It has some major usability problems, for example I don’t think you can resize or move or switch between windows. Which is where the window manager comes in! + + + +### move a window with XMoveWindow + +The challenge was to make the window bounce around the screen. + +In the [tinywm source][3] they use `XMoveResizeWindow` to move and resize windows, but I found in the [docs][4] that there’s also a function called `XMoveWindow`. Perfect! + +Here’s what it looks like. What could be simpler, right? And it works just the way I’d expect! + +``` +XMoveWindow(display, windowID, x, y) +``` + +Except… + +### problem: multiple `XMoveWindow`s don’t work + +I ran into a problem (which I got stuck on for a couple of hours) where when I ran XMoveWindow twice, it would only apply the last move. + +``` +XMoveWindow(display, windowID, 100, 200) +usleep(2000 * 1000); # sleep for 2 seconds +XMoveWindow(display, windowID, 300, 400) +``` + +I’d expect this to move the window once, wait 2 seconds, and them move it again. But that was not what happened! Instead, it would pause for 2 seconds and then move the window once (to the second location). + +### use xtrace to trace window manager events + +I used xtrace to trace the events and found out that my `ConfigureWindow` events that `XMoveWindow` was sending were all being sent at the same time. So it seemed like X was batching the events. But why? + +### XSync forces X to process events + +I didn’t know why this was happening, but I emailed Julian about it and he pointed me in the direction of [XSync][5], which forces X to process all the events you’ve sent it. Sure enough, I used XSync and everything worked beautifully. + +### solutions + +I asked people to email me if they completed the challenge, and 4 people did! Here are their solutions. All the solutions I got implemented more features than I did, so I’d encourage you to look at all the solutions if you’re interested in how to solve this problem! + + * [Kacper Słomiński’s solution][6] (which uses `XQueryTree` to find the windows to bounce, which is nice) + * [@whichxyj’s solution][7] + * [Alexsey Lagoshin’s stressfulwm][8], which allows bouncing multiple windows: + * [Aldrin Martoq Ahumada’s bouncywm-ruby][9], which is the only solution in a language other than C I got! It uses an Xlib Ruby library that looks pretty straightforward to use. + * one really nice one with fancier bouncing effects which I’ll post here later if the person sends me the source + * [my solution][10] + + + +Here’s a gif of Alexsey’s solution. Apparently `XQuartz` on a Mac performs better than Xephyr! + +![][11] + +And Aldrin’s solution, with a great use of `xeyes`: + +![][12] + +### thanks! + +Thanks to everyone who emailed me a solution, and if you write your own implementation I’d love to post it here too, especially if you write one that isn’t in C or Ruby! I’m [[email protected]][13] + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2019/12/03/solutions-to-the-tiny-window-manager-challenge/ + +作者:[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/2019/11/25/challenge--make-a-bouncy-window-manager/ +[2]: https://jvns.ca/images/bouncewm.gif +[3]: http://incise.org/tinywm.html +[4]: https://tronche.com/gui/x/xlib/window/XMoveWindow.html +[5]: https://tronche.com/gui/x/xlib/event-handling/XSync.html +[6]: https://gist.github.com/jvns/d5a0a4daf300f3dd7fa76d13b5aa2d53 +[7]: https://github.com/whichxjy/bounce-wm/blob/master/bounce-wm.c +[8]: https://github.com/ayzenquwe/stressfulwm +[9]: https://github.com/aldrinmartoq/bouncywm-ruby +[10]: https://gist.github.com/jvns/c7a297fc4e17e797fd7b76b68860e55c +[11]: https://raw.githubusercontent.com/ayzenquwe/stressfulwm/d06531d286a5f00424bf12f7c77b18e11437ff20/gif/example.gif +[12]: https://raw.githubusercontent.com/aldrinmartoq/bouncywm-ruby/f6d424b6107c1349c8ee338b6a46c7116c6d1ea7/demo/demo.gif +[13]: https://jvns.ca/cdn-cgi/l/email-protection From aafddb529d5084314b5e860bbaecf287be7d3fe8 Mon Sep 17 00:00:00 2001 From: DarkSun Date: Thu, 5 Dec 2019 01:03:59 +0800 Subject: [PATCH 778/800] =?UTF-8?q?=E9=80=89=E9=A2=98:=2020191204=20Amazon?= =?UTF-8?q?=20joins=20the=20quantum=20computing=20crowd=20with=20Braket=20?= =?UTF-8?q?testbed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sources/talk/20191204 Amazon joins the quantum computing crowd with Braket testbed.md --- ...tum computing crowd with Braket testbed.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 sources/talk/20191204 Amazon joins the quantum computing crowd with Braket testbed.md diff --git a/sources/talk/20191204 Amazon joins the quantum computing crowd with Braket testbed.md b/sources/talk/20191204 Amazon joins the quantum computing crowd with Braket testbed.md new file mode 100644 index 0000000000..7c4acb0f53 --- /dev/null +++ b/sources/talk/20191204 Amazon joins the quantum computing crowd with Braket testbed.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Amazon joins the quantum computing crowd with Braket testbed) +[#]: via: (https://www.networkworld.com/article/3487421/amazon-joins-the-quantum-computing-crowd-with-braket-testbed.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Amazon joins the quantum computing crowd with Braket testbed +====== +The newest part of AWS’ huge public-cloud ecosystem is Braket, a way for companies to experiment with quantum computing without having to own quantum computers. +Vizio + +Amazon’s initial foray into the heavily hyped world of [quantum computing][1] is a virtual sandbox in which companies can test potential quantum-enabled applications and generally get to grips with the new technology, the company announced Monday. + +The product is named Braket, after a system of notation used in quantum physics. The idea, according to Amazon, is to democratize access to quantum computing in a small way. Most organizations aren’t going to own their own quantum computers for the foreseeable future; they’re impractically expensive and require a huge amount of infrastructure even for the limited proof-of-concept models at the current cutting-edge. + +[10 of the world's fastest supercomputers][2] + +Hence, providing cloud-based access to three of those proofs-of-concept – the D-Wave 2000Q, Rigetti 16Q , Aspen-4 and IonQ linear ion trap – offers businesses the opportunity to learn firsthand about the way qubits work and how the basic building blocks of quantum programming might look. Braket will let users work remotely with those quantum computers or try out quantum algorithms in a classically driven simulated environment. + +[][3] + +BrandPost Sponsored by HPE + +[Take the Intelligent Route with Consumption-Based Storage][3] + +Combine the agility and economics of HPE storage with HPE GreenLake and run your IT department with efficiency. + +“Our goal is to make sure you know enough about quantum computing to start looking for some appropriate use cases and conducting some tests and experiments,” said chief AWS evangelist Jeff Barr in [a blog post][4]. + +To help guide those efforts, Amazon also announced that it would form the AWS Center for Quantum Computing in partnership with Cal Tech. The idea here seems to be to create a center of excellence for research into both how quantum computers can be put to use and how they can be manufactured on a slightly larger scale. Furthermore, the new Amazon Quantum Solutions Lab would allow for a collaborative space in which companies can partner to share newfound expertise in quantum computing, as well as workshops and brainstorming sessions for education on quantum topics. + +“Quantum computing is rapidly evolving, but the limited scale of the quantum hardware available today, fragmented development tools, and general shortage of quantum expertise, make it difficult to build near-term quantum applications,” said Amazon in a statement. + +Quantum computing technology is still in the very early stages of development – something like classical computing in the days of the Bletchley Park codebreaking machines, or ENIAC at the latest. Yet major tech companies have been eager to grab headlines in the field. Google boasted in October of [having achieved quantum supremacy][5], the ability to solve a problem with a quantum computer more quickly than with a classical one. + +This sort of cloud-based quantum testbed isn’t a wholly new idea. IBM has offered its Q Experience platform since 2016, and the company recently announced that more than 10 million experiments have been run there to date. And Amazon’s cloud rival Microsoft announced its Azure Quantum service just last month, offering a similar combination of cloud access, quantum programming tools, and remote access to prototype quantum computers. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3487421/amazon-joins-the-quantum-computing-crowd-with-braket-testbed.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/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html +[2]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE20773&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://aws.amazon.com/blogs/aws/amazon-braket-get-started-with-quantum-computing/ +[5]: https://www.networkworld.com/article/3447743/google-claims-quantum-supremacy-over-supercomputers.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world From 1f6fafe6f32732ca905706be0118dcde3252719e Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 05:34:38 +0800 Subject: [PATCH 779/800] PRF @geekpi --- .../tech/20191017 Using multitail on Linux.md | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/translated/tech/20191017 Using multitail on Linux.md b/translated/tech/20191017 Using multitail on Linux.md index c4625e2b03..090b246de5 100644 --- a/translated/tech/20191017 Using multitail on Linux.md +++ b/translated/tech/20191017 Using multitail on Linux.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Using multitail on Linux) @@ -10,14 +10,13 @@ 在 Linux 上使用 Multitail ====== -[Glen Bowman][1] [(CC BY-SA 2.0)][2] - -当你想同时查看多个文件(尤其是日志文件)的活动时,**multitail** 命令会非常有用。它的工作方式类似于多窗口形式的 **tail -f** 命令。也就是说,它显示文件底部和添加的新行。虽然通常使用简单,但是 **multitail** 提供了一些命令行和交互式选项,在开始使用它之前,你应该了解它们。 +![](https://img.linux.net.cn/data/attachment/album/201912/05/053423mpnrn95hqqknzheq.jpg) +当你想同时查看多个文件(尤其是日志文件)的活动时,`multitail` 命令会非常有用。它的工作方式类似于多窗口形式的 `tail -f` 命令。也就是说,它显示这些文件的底部和添加的新行。虽然通常使用简单,但是 `multitail` 提供了一些命令行和交互式选项,在开始使用它之前,你应该了解它们。 ### 基本 multitail 使用 -**multitail** 的最简单用法是在命令行中列出你要查看的文件名称。此命令水平分割屏幕(即顶部和底部),并显示每个文件的底部以及更新。 +`multitail` 的最简单用法是在命令行中列出你要查看的文件名称。此命令水平分割屏幕(即顶部和底部),并显示每个文件的底部以及更新。 ``` $ multitail /var/log/syslog /var/log/dmesg @@ -50,7 +49,7 @@ more lines 01] my2.log 120KB - 2019/10/14 14:22:29 ``` -请注意,如果你要求 **multitail** 显示非文本文件或者你无权查看的文件,它不会报错。你只是看不到内容。 +请注意,如果你要求 `multitail` 显示非文本文件或者你无权查看的文件,它不会报错。你只是看不到内容。 你还可以使用通配符指定要查看的文件: @@ -58,13 +57,13 @@ more lines $ multitail my*.log ``` -要记住的一件事是,**multitail** 将平均分割屏幕。如果指定的文件太多,那么除非你采取额外的步骤查看之后的文件(参考下面的滚动选项),否则你将只会看到前面 7 个文件的前面几行。确切的结果取决于终端窗口中有多少行可用。 +要记住的一件事是,`multitail` 将平均分割屏幕。如果指定的文件太多,那么除非你采取额外的步骤查看之后的文件(参考下面的滚动选项),否则你将只会看到前面 7 个文件的前面几行。确切的结果取决于终端窗口中有多少行可用。 -按 **q** 退出 **multitail** 并返回到正常的屏幕视图。 +按 `q` 退出 `multitail` 并返回到正常的屏幕视图。 ### 分割屏幕 -如果你愿意,**multitail** 将垂直分割你的终端窗口(即,左和右)。为此,请使用 **-s** 选项。如果指定了三个文件,那么屏幕右侧的窗口将会水平分隔。四个文件的话,你将拥有四个大小相等的窗口。 +如果你愿意,`multitail` 也可以垂直分割你的终端窗口(即,左和右)。为此,请使用 `-s` 选项。如果指定了三个文件,那么屏幕右侧的窗口将会水平分隔。四个文件的话,你将拥有四个大小相等的窗口。 ``` +-----------+-----------+ +-----------+-----------+ +-----------+-----------+ @@ -77,7 +76,7 @@ $ multitail my*.log 2 个文件 3 个文件 4 个文件 ``` -如果要将屏幕分为三列,请使用 **multitail -s 3 file1 file2 file3**。 +如果要将屏幕分为三列,请使用 `multitail -s 3 file1 file2 file3`。 ``` +-------+-------+-------+ @@ -92,15 +91,13 @@ $ multitail my*.log ### 滚动 -你可以上下滚动文件,但是需要按下 **b** 弹出选择菜单,然后使用向上和向下箭头按钮选择要滚动浏览的文件。然后按下回车键。然后,你可以再次使用向上和向下箭头在放大的区域中滚动浏览各行。完成后按下 **q** 返回正常视图。 +你可以上下滚动文件,但是需要按下 `b` 弹出选择菜单,然后使用向上和向下箭头按钮选择要滚动浏览的文件。然后按下回车键。然后,你可以再次使用向上和向下箭头在放大的区域中滚动浏览各行。完成后按下 `q` 返回正常视图。 ### 获得帮助 -在 **multitail** 中按下 **h** 将打开一个帮助菜单,其中描述了一些基本操作,但是手册页提供了更多信息,如果莫想了解更多有关使用此工具的信息,请仔细阅读。 +在 `multitail` 中按下 `h` 将打开一个帮助菜单,其中描述了一些基本操作,但是手册页提供了更多信息,如果莫想了解更多有关使用此工具的信息,请仔细阅读。 -默认情况下,你的系统商不会安装 **multitail**,但是使用 **apt-get** 或 **yum** 可以使你轻松安装。该工具提供了许多功能,但是通过基于字符的显示,窗口边框将只是 **q** 和 **x** 的字符串。 当你需要关注文件更新时,它非常方便。 - -加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。 +默认情况下,你的系统上不会安装 `multitail`,但是使用 `apt-get` 或 `yum` 可以使你轻松安装。该工具提供了许多功能,不过它是基于字符显示的,窗口边框只是 `q` 和 `x` 的字符串组成的。当你需要关注文件更新时,它非常方便。 -------------------------------------------------------------------------------- @@ -109,7 +106,7 @@ via: https://www.networkworld.com/article/3445228/using-multitail-on-linux.html 作者:[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 e89ca3c7099d7cdf6fb2bdfa02562058dbb61497 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 05:35:10 +0800 Subject: [PATCH 780/800] PUB @geekpi https://linux.cn/article-11643-1.html --- .../tech => published}/20191017 Using multitail on Linux.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191017 Using multitail on Linux.md (98%) diff --git a/translated/tech/20191017 Using multitail on Linux.md b/published/20191017 Using multitail on Linux.md similarity index 98% rename from translated/tech/20191017 Using multitail on Linux.md rename to published/20191017 Using multitail on Linux.md index 090b246de5..0d8870c9fc 100644 --- a/translated/tech/20191017 Using multitail on Linux.md +++ b/published/20191017 Using multitail on Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11643-1.html) [#]: subject: (Using multitail on Linux) [#]: via: (https://www.networkworld.com/article/3445228/using-multitail-on-linux.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) From efa118dd86353dc39b36b6e67a21e145dad6e5b9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 06:23:04 +0800 Subject: [PATCH 781/800] PRF @hello-wn --- ...s for programming in multiple languages.md | 73 +++++++++---------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md b/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md index 6375a1b126..467175d8b1 100644 --- a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md +++ b/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md @@ -1,99 +1,98 @@ [#]: collector: "lujun9972" [#]: translator: "hello-wn" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Top 10 Vim plugins for programming in multiple languages" [#]: via: "https://opensource.com/article/19/11/vim-plugins" [#]: author: "Maxim Burgerhout https://opensource.com/users/wzzrd" -多语言编程必备的十大Vim插件 +多语言编程必备的十大 Vim 插件 ====== -使用这 10 个 Vim 插件,可以让你在写代码或运维时,感觉更棒。 -![OpenStack source code \(Python\) in VIM][1] +> 使用这 10 个 Vim 插件,可以让你在写代码或运维时,感觉更棒。 -我使用 [Vim][2] 文本编辑器大约20年了。有一段时间,我一直在定制我的Vim配置,但在过去几年我会使用插件。 +![](https://img.linux.net.cn/data/attachment/album/201912/05/062256bnauidfsf7155d1n.jpeg) -最近,当我重新安装 Vim 时(就像我经常做的那样),我决定把这次安装作为一次尝试,找到多种编程语言环境下的最佳 Vim 插件,以及如何将这些插件和每种语言结合起来。 +我使用 [Vim][2] 文本编辑器大约 20 年了。有一段时间,我一直在定制我的 Vim 配置,但在只有在最近两年我才会使用插件。 -有时,我会为特定的语言和配置使用特定的插件(例如,我只在 Ansible 配置中安装 Rocannon ),在此不细讲了。但是下面介绍的 10 个 Vim 插件是我的最爱,无论使用哪种编程语言,我几乎都会使用它们。 +最近,当我重新安装系统时(就像我经常做的那样),我觉得这是一次好的机会,我想找出多种编程语言环境下的最佳 Vim 插件,以及如何将这些插件和每种语言结合起来。 -### 1\. Volt +有时,我会为特定的语言和配置使用特定的插件(例如,我只在 Ansible 配置中安装 Rocannon),在此不细讲了。不过下面介绍的 10 个 Vim 插件都是我的最爱,无论使用哪种编程语言,我几乎都会使用它们。 -我的首选并不是一个插件, 但是它可以替换类似于 [Vundle][3] 的插件,所以在此介绍。 +### 1、Volt -[Volt][4] 是一个不依存于 Vim 的 Vim 插件管理器。 你可以用它安装插件,通过 `profiles` 组合使用不同的插件。你可以使用一个简单的命令 ```volt profile set myprofile``` 使得新 `profiles` 生效。 这样可以 因制宜地使用插件,比如,我在 Python 配置中单独使用 [indentpython][5] 插件。 Volt 还可以更方便地配置每个插件,这些配置会在 `profiles` 之间共享,因此只需要安装一次插件,就可以在多个 `profiles` 之间使用。 +我的首选并不是一个插件,但是它可以替换类似于 [Vundle][3] 的插件,所以在此介绍。 -Volt 还是相对较新且不完美的(比如,无论使用多少 `profiles` ,每个插件只能有一个配置文件),但除此之外,我发现它非常方便、快速和简单。 +[Volt][4] 是一个不依存于 Vim 的 Vim 插件管理器。你可以用它安装插件,并创建名为“profile”的插件组合。你可以使用一个简单的命令 `volt profile set myprofile` 启用新的配置。这样我可以做到这样的事情,如为 Python 配置单独启用 [indentpython][5] 插件。Volt 还提供了一种针对每个插件配置的简单方法,这些配置会在“profile”之间共享,因此只需要安装一次插件,就可以在多个“profile”之间使用。 + +Volt 还是相对较新且不够完美(比如,不管你想要使用多少个“profile”,每个插件只能有一个配置文件),但除此之外,我发现它非常方便、快速和简单。 ![Volt plugin][6] -### 2\. Vim-Rainbow +### 2、Vim-Rainbow -除了 Python,几乎所有的主流编程语言都使用括号( 小括号,方括号和大括号)。 通常,它们会嵌套使用多对括号,因此很难搞清楚某个括号的开闭区间。我发现自己经常要数小括号,尤其是在复杂的 Bash 脚本中,以确保无误。 +除了 Python,几乎所有的主流编程语言都使用括号(小括号、方括号和大括号)。通常,它们会嵌套使用多对括号,因此很难搞清楚某个括号的开闭区间。我发现自己经常要数小括号,尤其是在复杂的 Bash 脚本中,以确保无误。 -这时候就需要 [vim-rainbow][7] 插件! 它为每对括号设置不同的颜色,因此很容易识别出哪些括号是一对括号。 它非常有用而且五彩斑斓。 +这时候就需要 [vim-rainbow][7] 插件!它为每对括号设置不同的颜色,因此很容易识别出哪些括号是一对括号。它非常有用而且五彩斑斓。 ![vim-rainbow plugin][8] -### 3\. lightline +### 3、lightline -Vim 有很多插件,例如 [Powerline][9] ,它会在底部栏显示你正在处理的文件,光标所在的文件位置以及文件类型等信息。 这些插件各有利弊,在简单比较后,我选择了 [lightline][10]。 它相对较小,便于安装和扩展,并且不依赖于其他工具或插件。 +Vim 有很多这种插件,例如 [Powerline][9],它会在底部栏显示你正在处理的文件、光标所在的文件位置以及文件类型等信息。这些插件各有利弊,在简单比较后,我选择了 [lightline][10]。它相对较小,便于安装和扩展,并且不依赖于其他工具或插件。 ![Lightline plugin][11] -### 4\. NERDTree +### 4、NERDTree -[NERDTree][12] 是一个很经典的插件。在大型项目中,你可能很难找到想要编辑的内容所在文件的确切名称和路径。使用快捷键(我使用的是 **F7** ,因为我在 `.vimrc` 中配置了这个快捷键),搜索窗会以垂直分屏的方式打开,就可以轻松找到所需文件并打开它。 对于大型项目,这是必备插件。 对于那些经常忘记文件名的人也很有用,比如我。 +[NERDTree][12] 是一个很经典的插件。在大型项目中,你可能很难找到想要编辑的内容所在文件的确切名称和路径。使用快捷键(我使用的是 `F7`,因为我在 `.vimrc` 中配置了这个快捷键),搜索窗会以垂直分屏的方式打开,就可以轻松找到所需文件并打开它。对于大型项目,这是必备插件。对于那些经常忘记文件名的人也很有用,比如我。 ![NERDTree vim plugin][13] -### 5\. NERD Commenter +### 5、NERD Commenter -程序员们在写代码时,有时会遇到一些难以调试的问题,导致他们想要注释或不执行某段代码。 这时候就需要 [NERD Commenter][14] 出场了。选择代码段,按 **Leader键 + cc**,代码就会被注释掉。 (标准的 Vim Leader 键 是 **/** 字符。)按 **Leader键 + cn**,取消注释。 对于大多数文件类型,NERD Commenter 会自动使用正确的注释符。 例如,如果你正在编辑 [BIND区域文件][15],并将文件类型设置为绑定区域,Vim 会正确地使用 **;** (分号)字符进行注释。 +程序员们在写代码时,有时会遇到一些难以调试的问题,导致他们想要注释或不执行某段代码。这时候就需要 [NERD Commenter][14] 出场了。选择代码段,按 `Leader 键 + cc`,代码就会被注释掉。(标准的 Vim Leader 键 是 `/` 字符。)按 `Leader 键 + cn`,取消注释。对于大多数文件类型,NERD Commenter 会自动使用正确的注释符。例如,如果你正在编辑 [BIND 区域文件][15],并将文件类型设置为 BIND 区域文件,Vim 会正确地使用 `;`(分号)字符进行注释。 ![NERD Commenter][16] -### 6\. Solarized +### 6、Solarized 我喜欢我的 Vim 主题配色。我也喜欢终端的主题色。我一直在 Vim 上使用 [Solarized][17] 配色,并且将我的终端、文件夹配色和 Vim 设为一致。 -但是,有时我会根据周边环境,屏幕亮度以及是否需要分享投屏,切换明暗模式。 +但是,有时我会根据周边环境、屏幕亮度以及是否需要分享投屏,来切换明暗模式。 -显然,你可以选择自己喜欢的任何配色方案,但我喜欢 `Solarized`,因为它有明暗模式功能,他可以简单快捷地切换两种模式。我的第二个选择是 [Monokai][18]。 Volt 插件管理器让我可以轻松地在两者之间切换,因此我在Python编程时,使用 Monokai ;Bash 编程时,使用 Solarized。 +显然,你可以选择自己喜欢的任何配色方案,但我喜欢 `Solarized`,因为它有明暗模式功能,它可以简单快捷地切换两种模式。我的第二个选择是 [Monokai][18]。Volt 插件管理器让我可以轻松地在两者之间切换,因此我在 Python 编程时,使用 Monokai;Bash 编程时,使用 Solarized。 我没有给 Solarized 找相应的图片,因为本文中的所有其他图片都使用了 Solarized 中的浅色或深色效果,可以确认一下这些图片。 -### 7\. fzf +### 7、fzf -当寻找一个文件时,有时你想要一个文件浏览器,有时你只想在键盘上敲打出与文件名类似的内容,对吗? +当寻找一个文件时,有时你想要一个文件浏览器,有时你只想在键盘上敲打出与文件名模糊匹配的内容,对吗? -[fzf][19](全称 “模糊查找器”)插件提供了这一功能。打出 **:FZF** 并输入文件名内容。 不断缩短的列表将显示出与你输入的文件名内容相匹配的一些文件。我经常使用它,最近使用它的频率估计比使用 NERDTree 还多。缺点是这个插件依赖于 `fzf binary` ,因此也必须安装这个依赖包。它适用于 Fedora,Debian 和 Arch,据我所知并不适用于 EPEL。 +[fzf][19](全称 “模糊查找器”)插件提供了这一功能。打出 `:FZF` 并输入文件名内容。不断缩短的列表将显示出与你输入的文件名内容相匹配的一些文件。我经常使用它,最近使用它的频率估计比使用 NERDTree 还多。缺点是这个插件依赖于 `fzf binary`,因此也必须安装这个依赖包。它适用于 Fedora、Debian 和 Arch,据我所知并不在 EPEL 中。 ![fzf Vim plugin][20] -### 8\. ack +### 8、ack -有时,你需要搜索包含特定行或特定单词的文件。我真的很喜欢使用 [ack][21] 插件,最好与 **ag** 结合使用,他俩的组合又被称为 “[silver searcher][22]”。 这一组合的速度非常快,覆盖了 **grep** 或 **vimgrep** 的绝大多数使用场景。 缺点是您需要安装 ack 或 ag 才能正常运行。 好消息是 Fedora 和 EPEL7 都可以使用 ag 和 ack 。 +有时,你需要搜索包含特定行或特定单词的文件。我真的很喜欢使用 [ack][21] 插件,最好与 `ag` 结合使用,它俩的组合又被称为 “[silver searcher][22]”。这一组合的速度非常快,覆盖了 `grep` 或 `vimgrep` 的绝大多数使用场景。缺点是你需要安装 `ack` 或 `ag` 才能正常运行。好消息是 Fedora 和 EPEL7 都可以使用 `ag` 和 `ack`。 ![ack vim plugin][23] -### 9\. gitgutter -大多数 IT 人员都使用 [Git][24] 和 Git 仓库中的文件进行工作。[gitgutter][25] 插件在行号附近添加了一列,通过符号显示该行的状态为,已更改(**~**),已添加(**+**)或者已删除(**-**)。这有利于跟踪你所做的更改,并且可以使你专注于手头的任务,例如编写补丁来修复一个关键 bug。 +### 9、gitgutter + +大多数 IT 人员都使用 [Git][24] 和 Git 仓库中的文件进行工作。[gitgutter][25] 插件在行号附近添加了一列,通过符号显示该行的状态为:已更改(`~`)、已添加(`+`)或者已删除(`-`)。这有利于跟踪你所做的更改,并且可以使你专注于手头的任务,例如编写补丁来修复一个关键错误。 ![gitgutter vim plugin][26] -### 10\. Tag List +### 10、Tag List -如果你在一个很大的文件中编写代码,会很容易忘记当前所在的位置,你可能需要上下滚动来查找某个功能。使用 [Tag List][27] 插件,只需要输入 **:Tlist** ,就能垂直分屏显示出 包含变量、类型、类和函数的代码,你可以轻松跳转到这些变量、类型、类和函数。这个功能对于多语言同样适用,例如 Java 、Python 以及任何能够使用 **ctags** 功能的文件类型。 +如果你在一个很大的文件中编写代码,会很容易忘记当前所在的位置,你可能需要上下滚动来查找某个功能。使用 [Tag List][27] 插件,只需要输入 `:Tlist`,就能垂直分屏显示出包含变量、类型、类和函数的代码,你可以轻松跳转到这些变量、类型、类和函数。这个功能对于多语言同样适用,例如 Java、Python 以及任何能够使用 `ctags` 功能的文件类型。 ![Tag List vim plugin][28] - -以上介绍的 10 个 Vim 插件使我作为系统管理员和兼职程序员的生活变得更轻松。你正在使用哪些Vim插件?请在评论中分享你最爱的插件。 - -Vim 为写作者提供了很多便利,无论他们是否了解技术。 +以上介绍的 10 个 Vim 插件使我作为系统管理员和兼职程序员的生活变得更轻松。你正在使用哪些 Vim 插件?请在评论中分享你最爱的插件。 -------------------------------------------------------------------------------- @@ -102,7 +101,7 @@ via: https://opensource.com/article/19/11/vim-plugins 作者:[Maxim Burgerhout][a] 选题:[lujun9972][b] 译者:[hello-wn][c] -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6ab36eec91c117689a812858f2befd9218565b91 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 06:23:50 +0800 Subject: [PATCH 782/800] PUB @hello-wn https://linux.cn/article-11644-1.html --- ...op 10 Vim plugins for programming in multiple languages.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191119 Top 10 Vim plugins for programming in multiple languages.md (99%) diff --git a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md b/published/20191119 Top 10 Vim plugins for programming in multiple languages.md similarity index 99% rename from translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md rename to published/20191119 Top 10 Vim plugins for programming in multiple languages.md index 467175d8b1..a4a6d82093 100644 --- a/translated/tech/20191119 Top 10 Vim plugins for programming in multiple languages.md +++ b/published/20191119 Top 10 Vim plugins for programming in multiple languages.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "hello-wn" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11644-1.html" [#]: subject: "Top 10 Vim plugins for programming in multiple languages" [#]: via: "https://opensource.com/article/19/11/vim-plugins" [#]: author: "Maxim Burgerhout https://opensource.com/users/wzzrd" From b148ba1173db6ed917d4338d665159dc3ea066cf Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 06:49:56 +0800 Subject: [PATCH 783/800] PRF @lxbwolf --- ... on Linux Every Time You Log into Shell.md | 84 ++++++++++--------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md b/translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md index 46bc1c699b..ca2e688e14 100644 --- a/translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md +++ b/translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md @@ -1,6 +1,6 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" -[#]: reviewer: " " +[#]: reviewer: "wxy" [#]: publisher: " " [#]: url: " " [#]: subject: "Bash Script to View System Information on Linux Every Time You Log into Shell" @@ -10,11 +10,7 @@ Bash 脚本实现每次登录到 Shell 时可以查看 Linux 系统信息 ====== -Linux 中有很多可以查看系统信息如处理器信息,生产商名字,序列号等的命令。 - -你可能需要执行多个命令来收集这些信息。 - -同时,记住所有的命令和他们的选项也是有难度。 +Linux 中有很多可以查看系统信息如处理器信息、生产商名字、序列号等的命令。你可能需要执行多个命令来收集这些信息。同时,记住所有的命令和他们的选项也是有难度。 你可以写一个 [shell 脚本](https://www.2daygeek.com/category/shell-script/) 基于你的需求来自定义显示的信息。 @@ -24,14 +20,12 @@ Linux 中有很多可以查看系统信息如处理器信息,生产商名字 这个j脚本有 6 部分,细节如下: - * **Part-1:** 通用系统信息 - * **Part-2:** CPU/内存当前使用情况 - * **Part-3:** 硬盘使用率超过 80% - * **Part-4:** 列出系统 WWN 详情 - * **Part-5:** Oracle DB 实例 - * **Part-6:** 可更新的包 - - +1. 通用系统信息 +2. CPU/内存当前使用情况 +3. 硬盘使用率超过 80% +4. 列出系统 WWN 详情 +5. Oracle DB 实例 +6. 可更新的包 我们已经基于我们的需求把可能需要到的信息加到了每个部分。之后你可以基于自己的意愿修改这个脚本。 @@ -39,21 +33,19 @@ Linux 中有很多可以查看系统信息如处理器信息,生产商名字 你可以参照以前文章,了解工具详情。 - * **[inxi – A Great Tool to Check Hardware Information on Linux][3]** - * **[Dmidecode – Easy Way To Get Linux System Hardware Information][3]** - * **[LSHW (Hardware Lister) – A Nifty Tool To Get A Hardware Information On Linux][3]** - * **[hwinfo (Hardware Info) – A Nifty Tool To Detect System Hardware Information On Linux][3]** - * **[python-hwinfo : Display Summary Of Hardware Information Using Standard Linux Utilities][3]** - * **[How To Use lspci, lsscsi, lsusb, And lsblk To Get Linux System Devices Information][3]** - * **[How To Check System Hardware Manufacturer, Model And Serial Number In Linux][3]** - * **[How To Find WWN, WWNN and WWPN Number Of HBA Card In Linux][3]** - * **[How to check HP iLO Firmware version from Linux command line][3]** - * **[How to check Wireless network card and WiFi information from Linux Command Line][3]** - * **[How to check CPU & Hard Disk temperature on Linux][3]** - * **[Hegemon – A modular System & Hardware monitoring tool for Linux][3]** - * **[How to Check System Configuration and Hardware Information on Linux][3]** - - +* [inxi – 在 Linux 上检查硬件信息的绝佳工具][3] +* [Dmidecode – 获取 Linux 系统硬件信息的简便方法][4] +* [LSHW(硬件列表程序)– 在 Linux 上获取硬件信息的漂亮工具][5] +* [hwinfo(硬件信息)– 在 Linux 上检测系统硬件信息的漂亮工具][6] +* [python-hwinfo:使用标准 Linux 实用工具显示硬件信息摘要][7] +* [如何使用 lspci、lsscsi、lsusb 和 lsblk 获取 Linux 系统设备信息][8] +* [如何在 Linux 中检查系统硬件制造商、型号和序列号][9] +* [如何在 Linux 中查找 HBA 卡的 WWN、WWNN 和 WWPN 号][10] +* [如何从 Linux 命令行检查 HP iLO 固件版本][11] +* [如何从 Linux 命令行检查无线网卡和 WiFi 信息][12] +* [如何在 Linux 上检查 CPU 和硬盘温度][13] +* [Hegemon – Linux 的模块化系统和硬件监视工具][14] +* [如何在 Linux 上检查系统配置和硬件信息][15] 如果你想为这个脚本增加其他的信息,请在评论去留下你的需求,以便我们帮助你。 @@ -62,8 +54,10 @@ Linux 中有很多可以查看系统信息如处理器信息,生产商名字 这个脚本会在你每次登录 shell 时把系统信息打印到 terminal。 ``` -#vi /opt/scripts/system-info.sh +# vi /opt/scripts/system-info.sh +``` +``` #!/bin/bash echo -e "-------------------------------System Information----------------------------" echo -e "Hostname:\t\t"`hostname` @@ -90,12 +84,12 @@ df -Ph | sed s/%//g | awk '{ if($5 > 80) print $0;}' echo "" echo -e "-------------------------------For WWN Details-------------------------------" -vserver=$(lscpu | grep vendor | wc -l) +vserver=$(lscpu | grep Hypervisor | wc -l) if [ $vserver -gt 0 ] then echo "$(hostname) is a VM" else -systool -c fc_host -v | egrep "(Class Device path | port_name |port_state)" > systool.out +cat /sys/class/fc_host/host?/port_name fi echo "" @@ -120,37 +114,37 @@ echo -e "----------------------------------------------------------------------- fi ``` -把上面脚本内容保存到一个文件 "system-info.sh",之后添加可执行权限 +把上面脚本内容保存到一个文件 `system-info.sh`,之后添加可执行权限: ``` # chmod +x ~root/system-info.sh ``` -当脚本准备好后,把脚本文件的路径加到 ".bash_profile" 文件末尾(红帽系列的系统:CentOS,Oracle Linux 和 Fedora)。 +当脚本准备好后,把脚本文件的路径加到 `.bash_profile` 文件末尾(红帽系列的系统:CentOS、Oracle Linux 和 Fedora): ``` # echo "/root/system-info.sh" >> ~root/.bash_profile ``` -执行以下命令,来让修改的内容生效。 +执行以下命令,来让修改的内容生效: ``` # source ~root/.bash_profile ``` -对于 Debian 系统的系统,你可能需要把文件路径加到 ".profile" 文件中。 +对于 Debian 系统的系统,你可能需要把文件路径加到 `.profile` 文件中: ``` # echo "/root/system-info.sh" >> ~root/.profile ``` -运行以下命令使修改生效。 +运行以下命令使修改生效: ``` # source ~root/.profile ``` -你以前运行上面 "source" 命令时可能见过类似下面的输出。从下次开始,你在每次登录 shell 时会看到这些信息。当然,如果有必要你也可以随时手动执行这个脚本。 +你以前运行上面 `source` 命令时可能见过类似下面的输出。从下次开始,你在每次登录 shell 时会看到这些信息。当然,如果有必要你也可以随时手动执行这个脚本。 ``` -------------------------------System Information--------------------------- @@ -203,7 +197,7 @@ via: https://www.2daygeek.com/bash-shell-script-view-linux-system-information/ 作者:[Magesh Maruthamuthu][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/) 荣誉推出 @@ -212,3 +206,15 @@ via: https://www.2daygeek.com/bash-shell-script-view-linux-system-information/ [1]: https://www.2daygeek.com/category/shell-script/ [2]: https://www.2daygeek.com/category/bash-script/ [3]: https://www.2daygeek.com/inxi-system-hardware-information-on-linux/ +[4]: https://www.2daygeek.com/dmidecode-get-print-display-check-linux-system-hardware-information/ +[5]: https://www.2daygeek.com/lshw-find-check-system-hardware-information-details-linux/ +[6]: https://www.2daygeek.com/hwinfo-check-display-detect-system-hardware-information-linux/ +[7]: https://www.2daygeek.com/python-hwinfo-check-display-system-hardware-configuration-information-linux/ +[8]: https://www.2daygeek.com/check-system-hardware-devices-bus-information-lspci-lsscsi-lsusb-lsblk-linux/ +[9]: https://www.2daygeek.com/how-to-check-system-hardware-manufacturer-model-and-serial-number-in-linux/ +[10]: https://www.2daygeek.com/how-to-find-wwn-wwnn-and-wwpn-number-of-hba-card-in-linux/ +[11]: https://www.2daygeek.com/how-to-check-hp-ilo-firmware-version-from-linux-command-line/ +[12]: https://www.2daygeek.com/linux-find-out-wireless-network-wifi-speed-signal-strength-quality/ +[13]: https://www.2daygeek.com/view-check-cpu-hard-disk-temperature-linux/ +[14]: https://www.2daygeek.com/hegemon-a-modular-system-and-hardware-monitoring-tool-for-linux/ +[15]: https://www.2daygeek.com/check-linux-hardware-information-system-configuration/ From 16387af30e7f493f0675cda3d628cf9a2b25aaa9 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 06:50:23 +0800 Subject: [PATCH 784/800] PUB @lxbwolf https://linux.cn/article-11645-1.html --- ...stem Information on Linux Every Time You Log into Shell.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md (99%) diff --git a/translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md b/published/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md similarity index 99% rename from translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md rename to published/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md index ca2e688e14..74bca82720 100644 --- a/translated/tech/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md +++ b/published/20191121 Bash Script to View System Information on Linux Every Time You Log into Shell.md @@ -1,8 +1,8 @@ [#]: collector: "lujun9972" [#]: translator: "lxbwolf" [#]: reviewer: "wxy" -[#]: publisher: " " -[#]: url: " " +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-11645-1.html" [#]: subject: "Bash Script to View System Information on Linux Every Time You Log into Shell" [#]: via: "https://www.2daygeek.com/bash-shell-script-view-linux-system-information/" [#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/" From c18ea08d405720102b9528f13af46c75852c2890 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 5 Dec 2019 07:06:17 +0800 Subject: [PATCH 785/800] Rename sources/tech/20191204 Java vs. Python- Which should you choose.md to sources/talk/20191204 Java vs. Python- Which should you choose.md --- .../20191204 Java vs. Python- Which should you choose.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sources/{tech => talk}/20191204 Java vs. Python- Which should you choose.md (100%) diff --git a/sources/tech/20191204 Java vs. Python- Which should you choose.md b/sources/talk/20191204 Java vs. Python- Which should you choose.md similarity index 100% rename from sources/tech/20191204 Java vs. Python- Which should you choose.md rename to sources/talk/20191204 Java vs. Python- Which should you choose.md From 18ffbade1e53ae406cdaa090e567c74dcd1008b2 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 5 Dec 2019 08:53:38 +0800 Subject: [PATCH 786/800] translated --- ...quick introduction to Toolbox on Fedora.md | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) rename {sources => translated}/tech/20191129 A quick introduction to Toolbox on Fedora.md (51%) diff --git a/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md b/translated/tech/20191129 A quick introduction to Toolbox on Fedora.md similarity index 51% rename from sources/tech/20191129 A quick introduction to Toolbox on Fedora.md rename to translated/tech/20191129 A quick introduction to Toolbox on Fedora.md index e320696435..07b7fd64a5 100644 --- a/sources/tech/20191129 A quick introduction to Toolbox on Fedora.md +++ b/translated/tech/20191129 A quick introduction to Toolbox on Fedora.md @@ -7,20 +7,20 @@ [#]: via: (https://fedoramagazine.org/a-quick-introduction-to-toolbox-on-fedora/) [#]: author: (Ryan Walter https://fedoramagazine.org/author/rwaltr/) -A quick introduction to Toolbox on Fedora +快速介绍 Fedora 中的 Toolbox ====== ![][1] -Toolbox allows you to [sort and manage your development environments in containers][2] without requiring root privileges or manually attaching volumes. It creates a container where you can install your own CLI tools, without installing them on the base system itself. You can also utilize it when you do not have root access or cannot install programs directly. This article gives you an introduction to toolbox and what it does. +Toolbox 使你可以[在容器中分类和管理开发环境][2],而无需 root 权限或手动添加卷。它创建一个容器,你可以在其中安装自己的命令行工具,而无需在基础系统中安装它们。当你没有root 权限或无法直接安装程序时,也可以使用它。本文会介绍 Toolbox 及其功能。 -### Installing Toolbox +### 安装 Toolbox -[Silverblue][3] includes Toolbox by default. For the Workstation and Server editions, you can grab it from the default repositories using _dnf install toolbox_. +[Silverblue][3] 默认包含 Toolbox。对于 Workstation 和 Server 版本,你可以使用 _dnf install toolbox_ 从默认仓库中获取它。 -### Creating Toolboxes +### 创建 Toolbox -Open your terminal and run _toolbox enter_. The utility will automatically request permission to download the latest image, create your first container, and place your shell inside this container. +打开终端并运行 _toolbox enter_。程序将自动请求许可来下载最新的镜像,创建第一个容器并将你的 shell 放在该容器中。 ``` $ toolbox enter @@ -29,7 +29,7 @@ Image required to create toolbox container. Download registry.fedoraproject.org/f30/fedora-toolbox:30 (500MB)? [y/N]: y ``` -Currently there is no difference between the toolbox and your base system. Your filesystems and packages appear unchanged. Here is an example using a repository that contains documentation source for a resume under a _~/src/resume_ folder. The resume is built using the _pandoc_ tool. +当前,toolbox 和你的基本系统之间没有区别。你的文件系统和软件包未更改。这是一个使用仓库的示例,它包含 _~/src/resume_ 文件夹下的简历的文档源。简历是使用 _pandoc_ 工具构建的。 ``` $ pwd @@ -47,7 +47,7 @@ $ pandoc -v bash: pandoc: command not found ``` -This toolbox does not have the programs required to build the resume. You can remedy this by installing the tools with _dnf_. You will not be prompted for the root password, because you are running in a container. +这个 toolbox 没有构建简历所需的程序。你可以通过使用 _dnf_ 安装工具来解决此问题。由于正在容器中运行,因此不会提示你输入 root 密码。 ``` $ sudo dnf groupinstall "Authoring and Publishing" -y && sudo dnf install pandoc make -y @@ -63,7 +63,7 @@ $ ls BUILDS/ resume.docx resume.html resume.pdf resume.rtf resume.txt ``` -Run _exit_ at any time to exit the toolbox. +运行 _exit_ 退出 toolbox。 ``` $ cd BUILDS/ @@ -80,21 +80,20 @@ bash: pandoc: command not found... resume.docx resume.html resume.pdf resume.rtf resume.txt ``` -You retain the files created by your toolbox in your home directory. None of the programs installed in your toolbox will be available outside of it. +你会在主目录中得到由 toolbox 创建的文件。toolbox 中安装的程序无法在外部访问。 -### Tips and tricks +### 提示和技巧 -This introduction to toolbox only scratches the surface. Here are some additional tips, but you can also check out [the official documentation][2]. - - * _Toolbox –help_ will show you the man page for Toolbox - * You can have multiple toolboxes at once. Use _toolbox create -c Toolboxname_ and _toolbox enter -c Toolboxname_ - * Toolbox uses [Podman][4] to do the heavy lifting. Use _toolbox list_ to find the IDs of the containers Toolbox creates. Podman can use these IDs to perform actions such as _rm_ and _stop_. (You can also read more about Podman [in this Magazine article][5].) +本介绍仅涉及 toolbox 的表明。还有一些其他提示,但是你也可以查看[官方文档][2]。 + * _Toolbox –help_ 会显示 Toolbox 的手册页 + * 你可以一次有多个 toolbox。使用 _toolbox create -c Toolboxname_ 和 _toolbox enter -c Toolboxname_。 + * Toolbox 使用 [Podman][4] 来完成繁重的工作。使用 _toolbox list_ 查找 Toolbox 创建的容器的 ID。Podman 可以使用这些 ID 来执行 _rm_ 和 _stop_ 之类的操作。 (你也可以在[此文章][5]中阅读有关 Podman 的更多信息。) * * * -_Photo courtesy of [Florian Richter][6] from [Flickr][7]._ +_照片出自 [Flickr][7] 的 [Florian Richter][6]。_ -------------------------------------------------------------------------------- @@ -102,7 +101,7 @@ via: https://fedoramagazine.org/a-quick-introduction-to-toolbox-on-fedora/ 作者:[Ryan Walter][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 1698d8278466b408ca1941278ca9b1166b186776 Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 5 Dec 2019 08:59:07 +0800 Subject: [PATCH 787/800] translating --- ...1203 Why use the Pantheon desktop for Linux Elementary OS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md b/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md index f66f0a5bd8..e1b1fc16c8 100644 --- a/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md +++ b/sources/tech/20191203 Why use the Pantheon desktop for Linux Elementary OS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 228d53098dc22bb83db91620d2eafccfcfbcdc93 Mon Sep 17 00:00:00 2001 From: chai-yuan <42235952+chai-yuan@users.noreply.github.com> Date: Thu, 5 Dec 2019 13:08:08 +0800 Subject: [PATCH 788/800] Update 20191031 A Bird-s Eye View of Big Data for Enterprises.md --- .../20191031 A Bird-s Eye View of Big Data for Enterprises.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md b/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md index c62169b830..23db96ce3d 100644 --- a/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md +++ b/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chai-yuan) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 14250e87247fed79134dcc1045dc5d4e4e8436c8 Mon Sep 17 00:00:00 2001 From: hj24 Date: Thu, 5 Dec 2019 13:09:00 +0800 Subject: [PATCH 789/800] translated --- ...nsible to organize your SSH keys in AWS.md | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md b/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md index 44826bf630..ffb4e2582a 100644 --- a/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md +++ b/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md @@ -7,28 +7,28 @@ [#]: via: (https://fedoramagazine.org/using-ansible-to-organize-your-ssh-keys-in-aws/) [#]: author: (Daniel Leite de Abreu https://fedoramagazine.org/author/dabreu/) -Using Ansible to organize your SSH keys in AWS +在 AWS 中使用 Ansible 来管理你的 SSH keys ====== ![][1] -If you’ve worked with instances in Amazon Web Services (AWS) for a long time, you may run into this common issue. It’s not technical, but more to do with the human nature of getting too comfortable. When you launch a new instance in a region you haven’t used recently, you may end up creating a new SSH key pair. This leads to having too many keys, which can become complicated and disordered. +如果你长期使用亚马逊Web服务(AWS)中的实例,你可能会遇到下面这个常见的问题,它不是因为技术性的原因导致的,更多的是因为人类追求方便舒适的天性:当你登录一台你最近没有使用的区域的实例,你最终就会创建一个新的SSH密钥对,久而久之这最终就会造成个人拥有太多密钥,导致管理起来复杂混乱。 -This article shows you a way to have your public key in all regions. A recent [Fedora Magazine article][2] includes one solution. But the solution in this article is automated even further, and in a more concise and scalable way. +本文将会介绍一种在所有区域中使用你的公钥的方法。最近,一篇[Fedora Magazine article][2]介绍了另一种解决方案。但本文中的解决方案可以进一步的以更简洁和可扩展的方式实现自动化。 -Say you have a Fedora 30 or 31 desktop system where your key is stored, and Ansible is installed as well. These two things together provide the solution to this problem and many more. +假设你有一个Fedora 30或31系统,其中存储了你的密钥,并且还安装了Ansible。当这两件事同时满足时,就提供了解决这个问题的办法,甚至它还能做到更多。 -With Ansible’s [ec2_key module][3], you can create a simple playbook that will maintain your SSH key pair in all regions. If you need to add or remove keys, it’s as simple as adding and removing lines from a file. +使用Ansible的[ec2_key 模块][3],你可以创建一个简单的playbook来在所有区域中维护你的SSH密钥对。如果你需要增加或者删除密钥,在ansible中这就像从文件中添加和删除行一样简单。 -### Setting up and running the playbook +### 设置和运行 playbook -To use the playbook, first install necessary dependencies for the _ec2_key_ module: +如果要使用playbook,首先需要安装 _ec2_key_ 模块的必要依赖项: ``` $ sudo dnf install python3-boto python3-boto3 ``` -The playbook is simple: you need only to change your key and its name as in the example below. After that, run the playbook and it iterates over all the public AWS regions listed. The example also includes the restricted regions in case you have access. To include them, uncomment each line as needed, save the file, and then run the playbook again. +playbook很简单:你只需要像下面的例子一样,修改其中的密钥及其对应的名称。然后,运行playbook,它会帮你遍历所有列出的公共AWS区域。该示例还包括一些受限区域,以防你有访问权限,只需根据需要来取消对应行的注释,然后,保存文件重新运行playbook即可。 ``` --- @@ -71,37 +71,34 @@ The playbook is simple: you need only to change your key and its name as in the # - cn-northwest-1 #China (Ningxia) ``` -This playbook requires AWS access via API, as well. To do this, use environment variables as follows: +这个playbook需要通过API访问AWS,为此,请使用环境变量,如下所示: ``` $ AWS_ACCESS_KEY="aws-access-key-id" AWS_SECRET_KEY="aws-secret-key-id" ansible-playbook ec2-playbook.yml ``` -Another option is to install the aws cli tools and add the credentials as explained in a [previous Fedora Magazine article][4]. It is **not recommended** to insert these values in the playbook if you store it anywhere online! You can find this playbook code on [GitHub][5]. +另一个选项是安装aws cli工具并添加凭据,如以前的一篇[Fedora Magazine article][4]文章所述。如果你在线存储它们,这些参数将不建议插入到playbook中!你可以在[GitHub][5]中找到本文的playbook代码。 -After the playbook finishes, confirm that your key is available on the AWS console. To do that: +完成playbook之后,请确认你的密钥在AWS控制台上可用。为此,可以做如下操作: + 1. 登录你的AWS控制台 + 2. 转到 **EC2 > Key Pairs** + 3. 您应该会看到列出的密钥。唯一的限制是你必须使用此方法逐个区域来检查。 - 1. Log into your AWS console - 2. Go to **EC2 > Key Pairs** - 3. You should see your key listed. The only limitation is that you have to check region-by-region with this method. +另一种方法是在shell中使用一个快速命令来为你做这些检查。 - - -Another way is to use a quick command in a shell to do this check for you. - -First create a variable with all regions on the playbook: +首先在playbook上创建一个包含所有区域的变量: ``` AWS_REGION="us-east-1 us-west-1 us-west-2 ap-east-1 ap-south-1 ap-northeast-2 ap-southeast-1 ap-southeast-2 ap-northeast-1 ca-central-1 eu-central-1 eu-west-1 eu-west-2 eu-west-3 eu-north-1 me-south-1 sa-east-1" ``` -Then do a for loop and you will get the result from aws API: +然后,执行如下循环,你就可以从aws的API获得结果: ``` for each in ${AWS_REGION} ; do aws ec2 describe-key-pairs --key-name ; done ``` -Keep in mind that to do the above you need to have the aws cli installed. +请记住,要执行上述操作,您需要安装 aws cli。 -------------------------------------------------------------------------------- @@ -109,7 +106,7 @@ via: https://fedoramagazine.org/using-ansible-to-organize-your-ssh-keys-in-aws/ 作者:[Daniel Leite de Abreu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[hj24](https://github.com/hj24) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 3affe4c46b15d8264ae1a1879ade5322ac3b9720 Mon Sep 17 00:00:00 2001 From: hj24 Date: Thu, 5 Dec 2019 13:33:14 +0800 Subject: [PATCH 790/800] translated and modify path --- .../20191203 Using Ansible to organize your SSH keys in AWS.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191203 Using Ansible to organize your SSH keys in AWS.md (100%) diff --git a/sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md b/translated/tech/20191203 Using Ansible to organize your SSH keys in AWS.md similarity index 100% rename from sources/tech/20191203 Using Ansible to organize your SSH keys in AWS.md rename to translated/tech/20191203 Using Ansible to organize your SSH keys in AWS.md From 534d6c1a664b778039e7f6379b9c42c61ffce9ff Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 20:37:13 +0800 Subject: [PATCH 791/800] PRF @wxy --- .../tech/20190927 5 tips for GNU Debugger.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/translated/tech/20190927 5 tips for GNU Debugger.md b/translated/tech/20190927 5 tips for GNU Debugger.md index 8c3b2be12c..07d28e0d2e 100644 --- a/translated/tech/20190927 5 tips for GNU Debugger.md +++ b/translated/tech/20190927 5 tips for GNU Debugger.md @@ -1,6 +1,6 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (5 tips for GNU Debugger) @@ -12,7 +12,7 @@ > 了解如何使用 gdb 的一些鲜为人知的功能来检查和修复代码。 -![Bug tracking magnifying glass on computer screen][1] +![](https://img.linux.net.cn/data/attachment/album/201912/05/203701ss8onfvpsnvnsnn5.jpg) [GNU 调试器][2](`gdb`)是一种宝贵的工具,可用于在开发程序时检查正在运行的进程并解决问题。 @@ -54,7 +54,7 @@ Breakpoint 1, sometimes_crashes (f=0x0) at prog.c:5 (gdb) ``` -条件断点使你不必让 `gdb` 每次调用该函数时都去问你要做什么,而是让条件断点仅在特定表达式的值为 `true` 时才使 `gdb` 停止在该位置。如果执行到达条件断点的位置,但表达式的计算结果为 `false` ,调试器会自动使程序继续运行,而无需询问用户该怎么做。 +条件断点使你不必让 `gdb` 每次调用该函数时都去问你要做什么,而是让条件断点仅在特定表达式的值为 `true` 时才使 `gdb` 停止在该位置。如果执行到达条件断点的位置,但表达式的计算结果为 `false`,调试器会自动使程序继续运行,而无需询问用户该怎么做。 ### 断点命令 @@ -101,14 +101,14 @@ GNU 调试器内置支持使用 `x` 命令以各种格式检查内存,包括 ``` (gdb) x/33xb mydata -0x404040 : 0x02 0x01 0x00 0x02 0x00 0x00 0x00 0x01 -0x404048 : 0x01 0x47 0x00 0x12 0x61 0x74 0x74 0x72 +0x404040 : 0x02 0x01 0x00 0x02 0x00 0x00 0x00 0x01 +0x404048 : 0x01 0x47 0x00 0x12 0x61 0x74 0x74 0x72 0x404050 : 0x69 0x62 0x75 0x74 0x65 0x73 0x2d 0x63 0x404058 : 0x68 0x61 0x72 0x73 0x65 0x75 0x00 0x05 0x404060 : 0x00 ``` -如果你想让 `gdb` 像 `hexdump` 一样显示内存怎么办?这是可以的, 实际上,你可以将这种方法用于你喜欢的任何格式。 +如果你想让 `gdb` 像 `hexdump` 一样显示内存怎么办?这是可以的,实际上,你可以将这种方法用于你喜欢的任何格式。 通过使用 `dump` 命令以将字节存储在文件中,结合 `shell` 命令以在文件上运行 `hexdump` 以及`define` 命令,我们可以创建自己的新的 `hexdump` 命令来使用 `hexdump` 显示内存内容。 @@ -162,7 +162,7 @@ prog.c: 有时,你希望自己可以逆转时间。想象一下,你已经达到了变量的监视点。监视点像是一个断点,但不是在程序中的某个位置设置,而是在表达式上设置(使用 `watch` 命令)。每当表达式的值更改时,执行就会停止,并且调试器将获得控制权。 -想象一下你已经达到了这个监视点,并且由该变量使用的内存已更改了值。事实证明,这可能是由更早发生的事情引起的。例如,内存已释放,现在正在重新使用。但是是何时何地被释放的呢? +想象一下你已经达到了这个监视点,并且由该变量使用的内存已更改了值。事实证明,这可能是由更早发生的事情引起的。例如,内存已释放,现在正在重新使用。但是它是何时何地被释放的呢? GNU 调试器甚至可以解决此问题,因为你可以反向运行程序! @@ -209,7 +209,7 @@ via: https://opensource.com/article/19/9/tips-gnu-debugger 作者:[Tim Waugh][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 faa7e306a1eede828da7a57d46f84e1776f778e1 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 20:38:04 +0800 Subject: [PATCH 792/800] PUB @wxy https://linux.cn/article-11647-1.html --- .../tech => published}/20190927 5 tips for GNU Debugger.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190927 5 tips for GNU Debugger.md (99%) diff --git a/translated/tech/20190927 5 tips for GNU Debugger.md b/published/20190927 5 tips for GNU Debugger.md similarity index 99% rename from translated/tech/20190927 5 tips for GNU Debugger.md rename to published/20190927 5 tips for GNU Debugger.md index 07d28e0d2e..9bb6329a4b 100644 --- a/translated/tech/20190927 5 tips for GNU Debugger.md +++ b/published/20190927 5 tips for GNU Debugger.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11647-1.html) [#]: subject: (5 tips for GNU Debugger) [#]: via: (https://opensource.com/article/19/9/tips-gnu-debugger) [#]: author: (Tim Waugh https://opensource.com/users/twaugh) From 9e8f13aefe1cd0274fcea00cce0fc1e912cb6374 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 21:04:19 +0800 Subject: [PATCH 793/800] PRF MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @hanwckf 恭喜你,完成了第一篇翻译! --- translated/tech/20190827 curl exercises.md | 29 +++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/translated/tech/20190827 curl exercises.md b/translated/tech/20190827 curl exercises.md index 95f071697b..489625ada3 100644 --- a/translated/tech/20190827 curl exercises.md +++ b/translated/tech/20190827 curl exercises.md @@ -1,25 +1,26 @@ [#]: collector: (lujun9972) [#]: translator: (hanwckf) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (curl exercises) [#]: via: (https://jvns.ca/blog/2019/08/27/curl-exercises/) [#]: author: (Julia Evans https://jvns.ca/) -curl 练习 +21 个 curl 命令练习 ====== -最近,我对人们如何学习新事物感兴趣。我正在读 Kathy Sierra 的好书 [Badass: Making Users Awesome][1],它探讨了有关“刻意练习”的想法。这个想法是,你找到一个可以用三个45分钟课程内能够学会的小技能,并专注于学习这项小技能。因此,作为一项练习,我尝试考虑一项能够在3个45分钟课程内学会的计算机技能。 +最近,我对人们如何学习新事物感兴趣。我正在读 Kathy Sierra 的好书《[Badass: Making Users Awesome][1]》,它探讨了有关“刻意练习”的想法。这个想法是,你找到一个可以用三节 45 分钟课程内能够学会的小技能,并专注于学习这项小技能。因此,作为一项练习,我尝试考虑一项能够在三节 45 分钟课程内学会的计算机技能。 -我认为使用 curl 构造 HTTP 请求也许就是这样的一项技能,所以这里有一些curl练习作为实验! +我认为使用 `curl` 构造 HTTP 请求也许就是这样的一项技能,所以这里有一些 `curl` 练习作为实验! ### 什么是 curl ? -curl 是用于构造 HTTP 请求的命令行工具。我喜欢使用 curl ,因为它能够很轻松地测试服务器或API的行为是否符合预期,但是刚开始接触它的时候会让你感到一些困惑! +`curl` 是用于构造 HTTP 请求的命令行工具。我喜欢使用 `curl`,因为它能够很轻松地测试服务器或 API 的行为是否符合预期,但是刚开始接触它的时候会让你感到一些困惑! -下面是一幅解释 curl 常用命令行参数的漫画 (在我的 [Bite Size Networking][2] 杂志的第6页)。 - +下面是一幅解释 `curl` 常用命令行参数的漫画 (在我的 [Bite Size Networking][2] 杂志的第 6 页)。 + +![](https://jvns.ca/images/curl.jpeg) ### 熟能生巧 @@ -35,15 +36,15 @@ curl https://api.gumroad.com/v2/sales \ ### 21 个 curl 练习 -这些练习是用来理解如何使用 curl 构造不同种类的 HTTP 请求的,它们是故意重复的,基本上包含了我需要 curl 做的任何事情。 +这些练习是用来理解如何使用 `curl` 构造不同种类的 HTTP 请求的,它们是故意有点重复的,基本上包含了我需要 `curl` 做的任何事情。 为了简单起见,我们将对 https://httpbin.org 发起一系列 HTTP 请求,httpbin 接受 HTTP 请求,然后在响应中回显你所发起的 HTTP 请求。 1. 请求 - 2. 请求 ,httpbin.org/anything 将会解析你发起的请求,并且在响应中回显。curl 默认发起的是 GET 请求 + 2. 请求 ,它将会解析你发起的请求,并且在响应中回显。`curl` 默认发起的是 GET 请求 3. 向 发起 GET 请求 - 4. 向 发起 GET 请求,但是这次需要添加一些查询参数(设置 `value=panda` ) - 5. 请求 Google 的 robots.txt 文件 ([www.google.com/robots.txt][3]) + 4. 向 发起 GET 请求,但是这次需要添加一些查询参数(设置 `value=panda`) + 5. 请求 Google 的 `robots.txt` 文件 ([www.google.com/robots.txt][3]) 6. 向 发起 GET 请求,并且设置请求头为 `User-Agent: elephant` 7. 向 发起 DELETE 请求 8. 请求 并获取响应头信息 @@ -54,12 +55,12 @@ curl https://api.gumroad.com/v2/sales \ 13. 设置请求头为 `Accept: image/png` 并且向 发起请求,将输出保存为 PNG 文件,然后使用图片浏览器打开。尝试使用不同的 `Accept:` 字段去请求此 URL 14. 向 发起 PUT 请求 15. 请求 并保存为文件,然后使用你的图片编辑器打开这个文件 - 16. 请求 ,你将会得到空的响应。让 curl 显示出响应头信息,并尝试找出响应内容为空的原因 + 16. 请求 ,你将会得到空的响应。让 `curl` 显示出响应头信息,并尝试找出响应内容为空的原因 17. 向 发起任意的请求,同时设置一些无意义的请求头(例如:`panda: elephant`) 18. 请求 ,然后再次请求它们并且让 curl 显示响应头信息 19. 请求 并且设置用户名和密码(使用 `-u username:password`) 20. 设置 `Accept-Language: es-ES` 的请求头用以下载 Twitter 的西班牙语主页 () - 21. 使用 curl 向 Stripe API 发起请求(请查看 了解如何使用,他们会给你一个测试用的 API key)。尝试向 发起相同的请求 + 21. 使用 `curl` 向 Stripe API 发起请求(请查看 了解如何使用,他们会给你一个测试用的 API key)。尝试向 发起相同的请求 @@ -70,7 +71,7 @@ via: https://jvns.ca/blog/2019/08/27/curl-exercises/ 作者:[Julia Evans][a] 选题:[lujun9972][b] 译者:[hanwckf](https://github.com/hanwckf) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From f4f6d2b513fbb4aac93ae2ec99b83f607a8f9924 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Thu, 5 Dec 2019 21:05:16 +0800 Subject: [PATCH 794/800] PUB MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit @hanwckf 本文首发地址: https://linux.cn/article-11648-1.html 您的 LCTT 专页地址: https://linux.cn/lctt/hanwckf 请注册以领取 LCCN: https://lctt.linux.cn/ --- {translated/tech => published}/20190827 curl exercises.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename {translated/tech => published}/20190827 curl exercises.md (98%) diff --git a/translated/tech/20190827 curl exercises.md b/published/20190827 curl exercises.md similarity index 98% rename from translated/tech/20190827 curl exercises.md rename to published/20190827 curl exercises.md index 489625ada3..35984c6e31 100644 --- a/translated/tech/20190827 curl exercises.md +++ b/published/20190827 curl exercises.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (hanwckf) [#]: reviewer: (wxy) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11648-1.html) [#]: subject: (curl exercises) [#]: via: (https://jvns.ca/blog/2019/08/27/curl-exercises/) [#]: author: (Julia Evans https://jvns.ca/) From efc290ab9319d663c94953610f32adaa538e313e Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Thu, 5 Dec 2019 22:08:55 +0800 Subject: [PATCH 795/800] translated --- ...e is up or down from the Linux Terminal.md | 124 ++++++------------ 1 file changed, 40 insertions(+), 84 deletions(-) diff --git a/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md b/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md index b67701a063..39e12ca4a3 100644 --- a/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md +++ b/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md @@ -7,34 +7,18 @@ [#]: via: (https://www.2daygeek.com/linux-command-check-website-is-up-down-alive/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -6 Methods to Quickly Check if a Website is up or down from the Linux Terminal +在 Linux Terminal 快速检测网站是否宕机的 6 个方法 ====== -This tutorial shows you how to quickly check whether a given website is up (alive) or down from a Linux terminal. +本教程教你怎样在 Linux terminal 快速检测一个网站是否宕机。 -You may already know some of these commands to verify about this, namely ping, curl, and wget. +你可能已经了解了一些类似的命令,像 ping,curl 和 wget。我们在本教程中又加入了一些其他命令。同时,对于要检测单个和多个主机的信息我们也加入了不同的选项。 -But we have added some other commands as well in this tutorial. +本文将帮助你检测网站是否宕机。但是如果你在维护一个网站,希望网站宕掉时得到实时的报警,我推荐你去使用实时网站监控工具。这种工具有很多,有些是免费的,大部分收费。根据你的需求,选择合适的工具。在后续的文章中我们会涉及这个主题。 -Also, we have added various options to check this information for single host and multiple hosts. +### 方法 1:使用 fping 命令检测一个网站是否宕机 -This article will help you to check whether the website is up or down. - -But if you maintain some websites and want to get real-time alerts when the website is down. - -I recommend you to use real-time website monitoring tools. There are many tools for this, and some are free and most of them are paid. - -So choose the preferred one based on your needs. We will cover this topic in our upcoming article. - -### Method-1: How to Check if a Website is up or down Using the fping Command - -**[fping command][1]** is a program such as ping, which uses the Internet Control Message Protocol (ICMP) echo request to determine whether a target host is responding. - -fping differs from ping because it allows users to ping any number of host in parallel. Also, hosts can be entered from a text file. - -fping sends an ICMP echo request, moves the next target in a round-robin fashion, and does not wait until the target host responds. - -If a target host replies, it is noted as active and removed from the list of targets to check; if a target does not respond within a certain time limit and/or retry limit it is designated as unreachable. +**[fping 命令][1]** 是一个类似 ping 的程序,使用互联网控制消息协议回应请求报文(ICMP echo request)来判断目标主机是否能回应。fping 与 ping 的不同之处在于它可以并行地 ping 任意数量的主机,也可以从一个文本文件读入主机。fping 发送一个 ICMP echo request 后不等待目标主机响应,就以 round-robin 模式向下一个目标主机发请求。如果一个目标主机有响应,那么它就被标记为存活的(active)然后从检查目标列表里去掉。如果一个目标主机在限定的时间和(或)重试次数内没有响应,则被指定为网站无法到达(unreachable)。 ``` # fping 2daygeek.com linuxtechnews.com magesh.co.in @@ -44,15 +28,9 @@ linuxtechnews.com is alive magesh.co.in is alive ``` -### Method-2: How to Quickly Check Whether a Website is up or down Using the http Command +### 方法 2:使用 http 命令检测一个网站是否宕机 -HTTPie (pronounced aitch-tee-tee-pie) is a command line HTTP client. - -The **[httpie tool][2]** is a modern command line http client which makes CLI interaction with web services. - -It provides a simple http command that allows for sending arbitrary HTTP requests using a simple and natural syntax, and displays colorized output. - -HTTPie can be used for testing, debugging, and generally interacting with HTTP servers. +HTTPie(读作 aitch-tee-tee-pie)是一个命令行 HTTP 客户端。**[httpie tool][2]** 是一个可以与 web 服务通过 CLI(command-line interface)进行交互的现代工具。httpie tool 提供了简单的 http 命令,可以通过发送简单的、自然语言语法的任意 HTTP 请求得到多彩的结果输出。HTTPie 可以用来对 HTTP 服务器进行测试、调试和基本的交互。 ``` # http 2daygeek.com @@ -69,15 +47,9 @@ Transfer-Encoding: chunked Vary: Accept-Encoding ``` -### Method-3: How to Check if a Website is up or down Using the curl Command +### 方法 3:使用 curl 命令检测一个网站是否宕机 -**[curl command][3]** is a tool to transfer data from a server or to server, using one of the supported protocols (DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET and TFTP). - -The command is designed to work without user interaction. - -Also curl support proxy support, user authentication, FTP upload, HTTP post, SSL connections, cookies, file transfer resume, Metalink, and more. - -curl is powered by libcurl for all transfer-related features. +**[curl 命令](https://www.2daygeek.com/curl-linux-command-line-download-manager/)** 是一个用于在服务器间通过支持的协议(DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET 和 TFTP)传输数据的工具。这个工具不支持用户交互。curl 也支持使用代理、用户认证、FTP 上传、HTTP post、SSL 连接、cookies、断点续传、Metalink等等。curl 由 libcurl 库提供所有与传输有关的能力。 ``` # curl -I https://www.magesh.co.in @@ -95,14 +67,14 @@ server: cloudflare cf-ray: 535b74123ca4dbf3-LHR ``` -Use the following curl command if you want to see only the HTTP status code instead of entire output. +如果你只想看 HTTP 状态码而不是返回的全部信息,用下面的 curl 命令: ``` # curl -I "www.magesh.co.in" 2>&1 | awk '/HTTP\// {print $2}' 200 ``` -If you want to see if a given website is up or down, use the following Bash script. +如果你想看一个网站是否宕机,用下面的 bash 脚本: ``` # vi curl-url-check.sh @@ -115,7 +87,7 @@ else fi ``` -Once you have added the above script to a file, run the file to see the output. +当你把脚本内容添加到一个文件后,执行文件,查看结果 ``` # sh curl-url-check.sh @@ -124,7 +96,7 @@ HTTP/2 200 magesh.co.in is up ``` -Use the following shell script if you want to see the status of multiple websites. +如果你想看多个网站的状态,使用下面的 shell 脚本: ``` # vi curl-url-check-1.sh @@ -141,7 +113,7 @@ echo "----------------------------------" done ``` -Once you have added the above script to a file, run the file to see the output. +当你把上面脚本内容添加到一个文件后,执行文件,查看结果 ``` # sh curl-url-check-1.sh @@ -156,13 +128,9 @@ www.xyzzz.com is down ---------------------------------- ``` -### Method-4: How to Quickly Check Whether a Website is up or down Using the wget Command +### 方法 4:使用 wget 命令检测一个网站是否宕机 -**[wget command][4]** (formerly known as Geturl) is a Free, open source, command line download tool which is retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. - -It is a non-interactive command line tool and Its name is derived from World Wide Web and get. - -wget handle download pretty much good compared with other tools, futures included working in background, recursive download, multiple file downloads, resume downloads, non-interactive downloads & large file downloads. +**[wget 命令][4]** (前身是 Geturl)是一个免费的开源命令行下载工具,通过 HTTP、HTTPS、FTP和其他广泛使用的互联网协议检索文件。wget 是非交互式的命令行工具,由 World Wide Web 和 get 得名。wget 相对于其他工具来说更优秀,功能包括后台运行、递归下载、多文件下载、断点续传、非交互式下载和大文件下载。 ``` # wget -S --spider https://www.magesh.co.in @@ -190,14 +158,14 @@ Remote file exists and could contain further links, but recursion is disabled -- not retrieving. ``` -Use the following wget command if you want to see only the HTTP status code instead of entire output. +如果你只想看 HTTP 状态码而不是返回的全部结果,用下面的 wget 命令: ``` # wget --spider -S "www.magesh.co.in" 2>&1 | awk '/HTTP\// {print $2}' 200 ``` -If you want to see if a given website is up or down, use the following Bash script. +如果你想看一个网站是否宕机,用下面的 bash 脚本: ``` # vi wget-url-check.sh @@ -210,7 +178,7 @@ else fi ``` -Once you have added the above script to a file, run the file to see the output. +当你把脚本内容添加到一个文件后,执行文件,查看结果 ``` # wget-url-check.sh @@ -219,7 +187,7 @@ HTTP/1.1 200 OK Google.com is up ``` -Use the following shell script if you want to see the status of multiple websites. +如果你想看多个网站的状态,使用下面的 shell 脚本: ``` # vi curl-url-check-1.sh @@ -236,7 +204,7 @@ echo "----------------------------------" done ``` -Once you have added the above script to a file, run the file to see the output. +当你把上面脚本内容添加到一个文件后,执行文件,查看结果: ``` # sh wget-url-check-1.sh @@ -251,9 +219,9 @@ www.xyzzz.com is down ---------------------------------- ``` -### Method-5: How to Quickly Check Whether a Website is up or down Using the lynx Command +### 方法 5:使用 lynx 命令检测一个网站是否宕机 -**[lynx][5]** is a highly configurable text-based web browser for use on cursor-addressable character cell terminals. It’s the oldest web browser and it’s still in active development. +**[lynx][5]** 是一个在可寻址光标字符单元终端上使用的基于文本的高度可配的 web 浏览器,它是最古老的 web 浏览器并且现在仍在开发。 ``` # lynx -head -dump http://www.magesh.co.in @@ -272,14 +240,14 @@ Server: cloudflare CF-RAY: 535fc5704a43e694-LHR ``` -Use the following lynx command if you want to see only the HTTP status code instead of entire output. +如果你只想看 HTTP 状态码而不是返回的全部结果,用下面的 lynx 命令: ``` # lynx -head -dump https://www.magesh.co.in 2>&1 | awk '/HTTP\// {print $2}' 200 ``` -If you want to see if a given website is up or down, use the following Bash script. +如果你想看一个网站是否宕机,用下面的 bash 脚本: ``` # vi lynx-url-check.sh @@ -292,7 +260,7 @@ else fi ``` -Once you have added the above script to a file, run the file to see the output. +当你把脚本内容添加到一个文件后,执行文件,查看结果 ``` # sh lynx-url-check.sh @@ -301,7 +269,7 @@ HTTP/1.1 200 OK magesh.co.in is up ``` -Use the following shell script if you want to see the status of multiple websites. +如果你想看多个网站的状态,使用下面的 shell 脚本: ``` # vi lynx-url-check-1.sh @@ -318,7 +286,7 @@ echo "----------------------------------" done ``` -Once you have added the above script to a file, run the file to see the output. +当你把上面脚本内容添加到一个文件后,执行文件,查看结果: ``` # sh lynx-url-check-1.sh @@ -333,13 +301,9 @@ www.xyzzz.com is down ---------------------------------- ``` -### Method-6: How to Check if a Website is up or down Using the ping Command +### 方法 6:使用 ping 命令检测一个网站是否宕机 -**[ping command][1]** stands for (Packet Internet Groper) command is a networking utility that used to test the target of a host availability/connectivity on an Internet Protocol (IP) network. - -It’s verify a host availability by sending Internet Control Message Protocol (ICMP) Echo Request packets to the target host and waiting for an ICMP Echo Reply. - -It summarize statistical results based on the packets transmitted, packets received, packet loss, typically including the min/avg/max times. +**[ping 命令][1]** (Packet Internet Groper)是网络工具的代表,用于在互联网协议(IP)的网络中测试一个目标主机是否可用/可连接。通过向目标主机发送 ICMP 回应请求报文包并等待 ICMP 回应响应报文来检测主机的可用性。它基于已发送的包、接收到的包和丢失了的包来统计结果数据,通常包含最小/平均/最大响应时间。 ``` # ping -c 5 2daygeek.com @@ -356,15 +320,9 @@ PING 2daygeek.com (104.27.157.177) 56(84) bytes of data. rtt min/avg/max/mdev = 170.668/213.824/250.295/28.320 ms ``` -### Method-7: How to Quickly Check Whether a Website is up or down Using the telnet Command +### 方法 7:使用 telnet 命令检测一个网站是否宕机 -The Telnet command is an old network protocol used to communicate with another host over a TCP/IP network using the TELNET protocol. - -It uses port 23 to connect to other devices, such as computer and network equipment. - -Telnet is not a secure protocol and is now not recommended to use because the data sent to the protocol is not encrypted and can be intercepted by hackers. - -Everyone uses SSH protocol instead of telnet, which is encrypted and very secure. +telnet 命令是一个使用 TELNET 协议用于 TCP/IP 网络中多个主机相互通信的古老的网络协议。它通过 23 端口连接其他设备如计算机和网络设备。telnet 是不安全的协议,现在由于用这个协议发送的数据没有经过加密可能被黑客拦截,所以不推荐使用。大家都使用经过加密且非常安全的 SSH 协议来代替 telnet。 ``` # telnet google.com 80 @@ -377,13 +335,11 @@ telnet> quit Connection closed. ``` -### Method-8: How to Check if a Website is up or down Using the Bash Script +### 方法 8:使用 bash 脚本检测一个网站是否宕机 -In simple words, a **[shell script][6]** is a file that contains a series of commands. The shell reads this file and executes the commands one by one as they are entered directly on the command line. +简而言之,一个 **[shell 脚本][6]** 就是一个包含一系列命令的文件。shell 从文件读取内容按输入顺序逐行在命令行执行。为了让它更有效,我们添加一些条件。这也减轻了 Linux 管理员的负担。 -To make this more useful we can add some conditions. This reduces the Linux admin task. - -If you want to see the status of multiple websites using the wget command, use the following shell script. +如果你想想用 wget 命令看多个网站的状态,使用下面的 shell 脚本: ``` # vi wget-url-check-2.sh @@ -399,7 +355,7 @@ fi done ``` -Once you have added the above script to a file, run the file to see the output. +当你把上面脚本内容添加到一个文件后,执行文件,查看结果: ``` # sh wget-url-check-2.sh @@ -409,7 +365,7 @@ google.co.in is up www.xyzzz.com is down ``` -If you want to see the status of multiple websites using the curl command, use the following **[bash script][7]**. +如果你想想用 wget 命令看多个网站的状态,使用下面的 **[shell 脚本][7]**: ``` # vi curl-url-check-2.sh @@ -425,7 +381,7 @@ fi done ``` -Once you have added the above script to a file, run the file to see the output. +当你把上面脚本内容添加到一个文件后,执行文件,查看结果: ``` # sh curl-url-check-2.sh @@ -441,7 +397,7 @@ via: https://www.2daygeek.com/linux-command-check-website-is-up-down-alive/ 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[lxbwolf](https://github.com/lxbwolf) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From a26736ea757fa7634c6e590748befa9b2349f925 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Thu, 5 Dec 2019 22:10:59 +0800 Subject: [PATCH 796/800] translated --- ...ly Check if a Website is up or down from the Linux Terminal.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {sources => translated}/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md (100%) diff --git a/sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md b/translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md similarity index 100% rename from sources/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md rename to translated/tech/20191116 6 Methods to Quickly Check if a Website is up or down from the Linux Terminal.md From a6f06f9b280b33c215e5568af09a1e3215ba2446 Mon Sep 17 00:00:00 2001 From: Brooke Lau Date: Thu, 5 Dec 2019 23:48:04 +0800 Subject: [PATCH 797/800] translating by lxbwolf --- ...0191028 How to remove duplicate lines from files with awk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191028 How to remove duplicate lines from files with awk.md b/sources/tech/20191028 How to remove duplicate lines from files with awk.md index 0282a26768..fea53c85a9 100644 --- a/sources/tech/20191028 How to remove duplicate lines from files with awk.md +++ b/sources/tech/20191028 How to remove duplicate lines from files with awk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (lxbwolf) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 028e792c6761fc77cf4777b7b34a68c67a7e76f0 Mon Sep 17 00:00:00 2001 From: Xingyu Wang Date: Fri, 6 Dec 2019 07:07:36 +0800 Subject: [PATCH 798/800] APL --- sources/tech/20191115 How to port an awk script to Python.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/tech/20191115 How to port an awk script to Python.md b/sources/tech/20191115 How to port an awk script to Python.md index 2476fb079d..1d9e5ba354 100644 --- a/sources/tech/20191115 How to port an awk script to Python.md +++ b/sources/tech/20191115 How to port an awk script to Python.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (wxy) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) From 20b388054a0538aea23b934ff414d1a496abbaa0 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 6 Dec 2019 08:53:17 +0800 Subject: [PATCH 799/800] translated --- ...2 Use the Window Maker desktop on Linux.md | 64 ------------------- ...2 Use the Window Maker desktop on Linux.md | 63 ++++++++++++++++++ 2 files changed, 63 insertions(+), 64 deletions(-) delete mode 100644 sources/tech/20191202 Use the Window Maker desktop on Linux.md create mode 100644 translated/tech/20191202 Use the Window Maker desktop on Linux.md diff --git a/sources/tech/20191202 Use the Window Maker desktop on Linux.md b/sources/tech/20191202 Use the Window Maker desktop on Linux.md deleted file mode 100644 index 5048eeefeb..0000000000 --- a/sources/tech/20191202 Use the Window Maker desktop on Linux.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use the Window Maker desktop on Linux) -[#]: via: (https://opensource.com/article/19/12/linux-window-maker-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Use the Window Maker desktop on Linux -====== -This article is part of a special series of 24 days of Linux desktops. -Take a step back in time with Window Maker, which implements the old -Unix NeXTSTEP environment for today's users. -![Penguin with green background][1] - -Before Mac OS X, there was a quirky closed-source Unix system called [NeXTSTEP][2]. Sun Microsystems later made NeXTSTEP's underpinnings an open specification, which enabled other projects to create free and open source versions of many NeXT libraries and components. GNUStep implemented the bulk of NeXTSTEP's libraries, and [Window Maker][3] implemented its desktop environment. - -Window Maker mimics the NeXTSTEP desktop GUI closely and provides some interesting insight into what Unix was like in the late '80s and early '90s. It also reveals some of the foundational concepts behind window managers like Fluxbox and Openbox. - -You can install Window Maker from your distribution's repository. To try it out, log out of your desktop session after the installation is complete. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your default desktop, so you must override the default when logging in. - -To switch to Window Maker on GDM: - -![Selecting the Window Maker desktop in GDM][4] - -And on KDM: - -![Selecting the Window Maker desktop in KDM][5] - -### Window Maker dock - -By default, the Window Maker desktop is empty but for a few _docks_ in each corner. As in NeXTSTEP, in Window Maker, a dock area is where major applications can go to be minimized as icons, where launchers can be created for quick access to common applications, and where tiny "dockapps" can run. - -You can try out a dockapp by searching for "dockapp" in your software repository. They tend to be network and system monitors, audio-setting panels, clocks, and similar. Here's Window Maker running on Fedora: - -![Window Maker running on Fedora][6] - -### Application menu - -To access the application menu, right-click anywhere on the desktop. To close it again, right-click. Window Maker isn't a desktop environment; rather it's a window manager. It helps you arrange and manage windows. Its only bundled application is called [WPrefs][7] (or more commonly, Window Maker Preferences), a settings application that helps you configure commonly used settings, while the application menu provides access to other options, including themes. - -The applications you run are entirely up to you. Within Window Maker, you can choose to run KDE applications, GNOME applications, and applications that are not considered part of any major desktop. Your work environment is yours to create, and you can manage it with Window Maker. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/linux-window-maker-desktop - -作者:[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/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) -[2]: https://en.wikipedia.org/wiki/NeXTSTEP -[3]: https://www.windowmaker.org/ -[4]: https://opensource.com/sites/default/files/uploads/advent-windowmaker-gdm.jpg (Selecting the Window Maker desktop in GDM) -[5]: https://opensource.com/sites/default/files/uploads/advent-windowmaker-kdm.jpg (Selecting the Window Maker desktop in KDM) -[6]: https://opensource.com/sites/default/files/uploads/advent-windowmaker.jpg (Window Maker running on Fedora) -[7]: http://www.windowmaker.org/docs/guidedtour/prefs.html diff --git a/translated/tech/20191202 Use the Window Maker desktop on Linux.md b/translated/tech/20191202 Use the Window Maker desktop on Linux.md new file mode 100644 index 0000000000..41082d7fc0 --- /dev/null +++ b/translated/tech/20191202 Use the Window Maker desktop on Linux.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use the Window Maker desktop on Linux) +[#]: via: (https://opensource.com/article/19/12/linux-window-maker-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在 Linux 上使用 Window Maker 桌面 +====== +本文是 24 天 Linux 桌面特别系列的一部分。与 Window Maker 一起倒退,它为如今的用户实现了老式 Unix NeXTSTEP 环境。 +![Penguin with green background][1] + +在 Mac OS X 之前,有一个古怪的闭源 Unix 系统,称为 [NeXTSTEP][2]。Sun Microsystems 后来将 NeXTSTEP 的基础设为开放规范,这使其他项目可以创建许多免费开源的 NeXT 库和组件。GNUStep 实现了 NeXTSTEP 的大量库,[Window Maker][3] 实现了其桌面环境。 + +Window Maker 非常接近地模仿了 NeXTSTEP 桌面GUI,并提供了一些有趣东西来了解 80 年代末 90 年代初的 Unix 是什么样子。它还揭示了窗口管理器(例如 Fluxbox 和 Openbox)背后的一些基本概念。 + +你可以从发行版的仓库中安装 Window Maker。要尝试它,请在安装完成后退出桌面会话。默认情况下,会话管理器(KDM、GDM、LightDM 或 XDM,这取决于你的设置)将继续将登录到默认桌面,因此登录时必须覆盖默认设置。 + +要在 GDM 上切换到 Window Maker: + +![Selecting the Window Maker desktop in GDM][4] + +在 KDM 上: + +![Selecting the Window Maker desktop in KDM][5] + +### Window Maker dock + +默认情况下,Window Maker 桌面是空的,但每个角落都有几个 _dock_。像在 NeXTSTEP 中一样,在 Window Maker 中,在 dock 区,应用可最小化成图标后停靠,可创建启动器来快速访问常见应用,并且可运行微型的 ”dockapp“。 + +你可以在软件仓库中搜索 “dockapp” 来试用 dockapp。它们常常是网络和系统监控器、音频设置面板、时钟等。这是在 Fedora 上运行 Window Maker: + + +![Window Maker running on Fedora][6] + +### 应用菜单 + +要访问应用菜单,请右键单击桌面上的任意位置。要再次关闭它,请单击鼠标右键。Window Maker 不是桌面环境。而是一个窗口管理器。它可以帮助你安排和管理窗口。它唯一捆绑的程序是 [WPrefs][7](或更常见的说法 Window Maker Preferences),它可帮助你配置常用设置,而应用菜单则提供对其他选项(包括主题)的访问。 + +运行什么应用完全由你决定。在 Window Maker 中,你可以选择运行 KDE 应用、GNOME 应用以及不被视为任何其他不被视为桌面程序的应用。你可以创建自己的工作环境,并且可以使用 Window Maker 对其进行管理。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-window-maker-desktop + +作者:[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/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://en.wikipedia.org/wiki/NeXTSTEP +[3]: https://www.windowmaker.org/ +[4]: https://opensource.com/sites/default/files/uploads/advent-windowmaker-gdm.jpg (Selecting the Window Maker desktop in GDM) +[5]: https://opensource.com/sites/default/files/uploads/advent-windowmaker-kdm.jpg (Selecting the Window Maker desktop in KDM) +[6]: https://opensource.com/sites/default/files/uploads/advent-windowmaker.jpg (Window Maker running on Fedora) +[7]: http://www.windowmaker.org/docs/guidedtour/prefs.html From aa1b1b21a2e7ea3719a4b097245a924b8885173f Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 6 Dec 2019 08:58:04 +0800 Subject: [PATCH 800/800] translating --- .../talk/20191204 Java vs. Python- Which should you choose.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources/talk/20191204 Java vs. Python- Which should you choose.md b/sources/talk/20191204 Java vs. Python- Which should you choose.md index b8b38f494b..edc59c7b3d 100644 --- a/sources/talk/20191204 Java vs. Python- Which should you choose.md +++ b/sources/talk/20191204 Java vs. Python- Which should you choose.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (geekpi) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( )