Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
Xingyu.Wang 2018-07-09 17:49:32 +08:00
commit 0386a8a3f7
21 changed files with 1314 additions and 429 deletions

View File

@ -1,7 +1,11 @@
Python 字节码介绍
======
> 了解 Python 字节码是什么Python 如何使用它来执行你的代码,以及知道它是如何帮到你的。
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82)
如果你从没有写过 Python或者甚至只是使用过 Python你或许已经习惯于看 Python 源代码文件;它们的名字以 `.py` 结尾。你可能还看到过其它类型的文件,比如使用 `.pyc` 结尾的文件,或许你可能听说过,它们就是 Python 的 "字节码" 文件。(在 Python 3 上这些可能不容易看到 — 因为它们与你的 `.py` 文件不在同一个目录下,它们在一个叫 `__pycache__` 的子目录中)或者你也听说过,这是节省时间的一种方法,它可以避免每次运行 Python 时去重新解析源代码。
如果你曾经编写过 Python或者只是使用过 Python你或许经常会看到 Python 源代码文件——它们的名字以 `.py` 结尾。你可能还看到过其它类型的文件,比如以 `.pyc` 结尾的文件,或许你可能听说过它们就是 Python 的 “<ruby>字节码<rt>bytecode</rt></ruby>” 文件。(在 Python 3 上这些可能不容易看到 —— 因为它们与你的 `.py` 文件不在同一个目录下,它们在一个叫 `__pycache__` 的子目录中)或者你也听说过,这是节省时间的一种方法,它可以避免每次运行 Python 时去重新解析源代码。
但是,除了 “噢,原来这就是 Python 字节码” 之外,你还知道这些文件能做什么吗?以及 Python 是如何使用它们的?
@ -9,29 +13,26 @@ Python 字节码介绍
### Python 如何工作
Python 经常被介绍为它是一个解释型语言 — 其中一个原因是程序运行时,你的源代码被转换成 CPU 的原生指令 — 但这样认为只是部分正确。Python 与大多数解释型语言一样,确实是将源代码编译为一组虚拟机指令,并且 Python 解释器是针对相应的虚拟机实现的。这种中间格式被称为 “字节码”。
Python 经常被介绍为它是一个解释型语言 — 其中一个原因是程序运行时,你的源代码被转换成 CPU 的原生指令 —— 但这样的看法只是部分正确。Python 与大多数解释型语言一样,确实是将源代码编译为一组虚拟机指令,并且 Python 解释器是针对相应的虚拟机实现的。这种中间格式被称为 “字节码”。
因此,这些 `.pyc` 文件是 Python 悄悄留下的,是为了让它们运行的 “更快”,或者是针对你的源代码的 “优化” 版本;它们是你的程序在 Python 虚拟机上运行的字节码指令。
我们来看一个示例。这里是用 Python 写的经典程序 "Hello, World!"
我们来看一个示例。这里是用 Python 写的经典程序 “Hello, World!”:
```
def hello()
    print("Hello, World!")
```
下面是转换后的字节码(转换为人类可读的格式):
```
2           0 LOAD_GLOBAL              0 (print)
            2 LOAD_CONST               1 ('Hello, World!')
            4 CALL_FUNCTION            1
```
2 0 LOAD_GLOBAL 0 (print)
2 LOAD_CONST 1 ('Hello, World!')
4 CALL_FUNCTION 1
```
如果你输入那个 `hello()` 函数,然后使用 [CPython][1] 解释器去运行它,上面的 Python 程序将会运行。它看起来可能有点奇怪,因此,我们来深入了解一下它都做了些什么。
如果你输入那个 `hello()` 函数,然后使用 [CPython][1] 解释器去运行它,那么上述列出的内容就是 Python 所运行的。它看起来可能有点奇怪,因此,我们来深入了解一下它都做了些什么。
### Python 虚拟机内幕
@ -39,84 +40,68 @@ CPython 使用一个基于栈的虚拟机。也就是说,它完全面向栈数
CPython 使用三种类型的栈:
1. **调用栈**。这是运行 Python 程序的主要结构。它为每个当前活动的函数调用使用了一个东西 — "帧“,栈底是程序的入口点。每个函数调用推送一个新帧到调用栈,每当函数调用返回后,这个帧被销毁。
2. 在每个帧中,有一个 **计算栈** (也称为 **数据栈**)。这个栈就是 Python 函数运行的地方,运行的 Python 代码大多数是由推入到这个栈中的东西组成的,操作它们,然后在返回后销毁它们。
3. 在每个帧中,还有一个 **块栈**。它被 Python 用于去跟踪某些类型的控制结构loops、`try`/`except` 块、以及 `with` 块,全部推入到块栈中,当你退出这些控制结构时,块栈被销毁。这将帮助 Python 了解任意给定时刻哪个块是活动的,比如,一个 `continue` 或者 `break` 语句可能影响正确的块。
1. <ruby>调用栈<rt>call stack</rt></ruby>。这是运行 Python 程序的主要结构。它为每个当前活动的函数调用使用了一个东西 —— “<ruby><rt>frame</rt></ruby>”,栈底是程序的入口点。每个函数调用推送一个新的帧到调用栈,每当函数调用返回后,这个帧被销毁。
2. 在每个帧中,有一个<ruby>计算栈<rt>evaluation stack</rt></ruby> (也称为<ruby>数据栈<rt>data stack</rt></ruby>)。这个栈就是 Python 函数运行的地方,运行的 Python 代码大多数是由推入到这个栈中的东西组成的,操作它们,然后在返回后销毁它们。
3. 在每个帧中,还有一个<ruby>块栈<rt>block stack</rt></ruby>。它被 Python 用于去跟踪某些类型的控制结构:循环、`try` / `except` 块、以及 `with` 块,全部推入到块栈中,当你退出这些控制结构时,块栈被销毁。这将帮助 Python 了解任意给定时刻哪个块是活动的,比如,一个 `continue` 或者 `break` 语句可能影响正确的块。
大多数 Python 字节码指令操作的是当前调用栈帧的计算栈,虽然,还有一些指令可以做其它的事情(比如跳转到指定指令,或者操作块栈)。
为了更好地理解,假设我们有一些调用函数的代码,比如这个:`my_function(my_variable, 2)`。Python 将转换为一系列字节码指令:
1. 一个 `LOAD_NAME` 指令去查找函数对象 `my_function`,然后将它推入到计算栈的顶部
2. 另一个 `LOAD_NAME` 指令去查找变量 `my_variable`,然后将它推入到计算栈的顶部
3. 一个 `LOAD_CONST` 指令去推入一个实整数值 `2` 到计算栈的顶部
4. 一个 `CALL_FUNCTION` 指令
1. 一个 `LOAD_NAME` 指令去查找函数对象 `my_function`,然后将它推入到计算栈的顶部
2. 另一个 `LOAD_NAME` 指令去查找变量 `my_variable`,然后将它推入到计算栈的顶部
3. 一个 `LOAD_CONST` 指令去推入一个实整数值 `2` 到计算栈的顶部
4. 一个 `CALL_FUNCTION` 指令
这个 `CALL_FUNCTION` 指令将有 2 个参数,它表示那个 Python 需要从栈顶弹出两个位置参数;然后函数将在它上面进行调用,并且它也同时被弹出(对于函数涉及的关键字参数,它使用另一个不同的指令 — `CALL_FUNCTION_KW`,但使用的操作原则类似,以及第三个指令 — `CALL_FUNCTION_EX`,它适用于函数调用涉及到使用 `*``**` 操作符的情况)。一旦 Python 拥有了这些之后,它将在调用栈上分配一个新帧,填充到函数调用的本地变量上,然后,运行那个帧内的 `my_function` 字节码。运行完成后,这个帧将被调用栈销毁,最初的帧内返回的 `my_function` 将被推入到计算栈的顶部。
这个 `CALL_FUNCTION` 指令将有 2 个参数,它表示那个 Python 需要从栈顶弹出两个位置参数;然后函数将在它上面进行调用,并且它也同时被弹出(对于函数涉及的关键字参数,它使用另一个不同的指令 —— `CALL_FUNCTION_KW`,但使用的操作原则类似,以及第三个指令 —— `CALL_FUNCTION_EX`,它适用于函数调用涉及到参数使用 `*``**` 操作符的情况)。一旦 Python 拥有了这些之后,它将在调用栈上分配一个新帧,填充到函数调用的本地变量上,然后,运行那个帧内的 `my_function` 字节码。运行完成后,这个帧将被调用栈销毁,而在最初的帧内,`my_function` 的返回值将被推入到计算栈的顶部。
### 访问和理解 Python 字节码
如果你想玩转字节码那么Python 标准库中的 `dis` 模块将对你有非常大的帮助;`dis` 模块为 Python 字节码提供了一个 "反汇编",它可以让你更容易地得到一个人类可读的版本,以及查找各种字节码指令。[`dis` 模块的文档][2] 可以让你遍历它的内容,并且提供一个字节码指令能够做什么和有什么样的参数的完整清单。
如果你想玩转字节码那么Python 标准库中的 `dis` 模块将对你有非常大的帮助;`dis` 模块为 Python 字节码提供了一个 “反汇编”,它可以让你更容易地得到一个人类可读的版本,以及查找各种字节码指令。[`dis` 模块的文档][2] 可以让你遍历它的内容,并且提供一个字节码指令能够做什么和有什么样的参数的完整清单。
例如,获取上面的 `hello()` 函数的列表,可以在一个 Python 解析器中输入如下内容,然后运行它:
```
import dis
dis.dis(hello)
```
函数 `dis.dis()` 将反汇编一个函数、方法、类、模块、编译过的 Python 代码对象、或者字符串包含的源代码,以及显示出一个人类可读的版本。`dis` 模块中另一个方便的功能是 `distb()`。你可以给它传递一个 Python 追溯对象,或者发生预期外情况时调用它,然后它将反汇编发生预期外情况时在调用栈上最顶端的函数,并显示它的字节码,以及插入一个指向到引发意外情况的指令的指针。
函数 `dis.dis()` 将反汇编一个函数、方法、类、模块、编译过的 Python 代码对象、或者字符串包含的源代码,以及显示出一个人类可读的版本。`dis` 模块中另一个方便的功能是 `distb()`。你可以给它传递一个 Python 追溯对象,或者在发生预期外情况时调用它,然后它将在发生预期外情况时反汇编调用栈上最顶端的函数,并显示它的字节码,以及插入一个指向到引发意外情况的指令的指针。
它也可以用于查看 Python 为每个函数构建的编译后的代码对象,因为运行一个函数将会用到这些代码对象的属性。这里有一个查看 `hello()` 函数的示例:
```
>>> hello.__code__
<code object hello at 0x104e46930, file "<stdin>", line 1>
>>> hello.__code__.co_consts
(None, 'Hello, World!')
>>> hello.__code__.co_varnames
()
>>> hello.__code__.co_names
('print',)
```
代码对象在函数中可以作为属性 `__code__` 来访问,并且携带了一些重要的属性:
代码对象在函数中可以属性 `__code__` 来访问,并且携带了一些重要的属性:
* `co_consts` 是存在于函数体内的任意实数的元组
* `co_varnames` 是函数体内使用的包含任意本地变量名字的元组
* `co_names` 是在函数体内引用的任意非本地名字的元组
许多字节码指令 — 尤其是那些推入到栈中的加载值,或者在变量和属性中的存储值 — 在这些用作它们参数的元组中使用索引。
许多字节码指令 —— 尤其是那些推入到栈中的加载值,或者在变量和属性中的存储值 —— 在这些元组中的索引作为它们参数。
因此,现在我们能够理解 `hello()` 函数中所列出的字节码:
1. `LOAD_GLOBAL 0`:告诉 Python 通过 `co_names` (它是 `print` 函数)的索引 0 上的名字去查找它指向的全局对象,然后将它推入到计算栈
2. `LOAD_CONST 1`:带入 `co_consts` 在索引 1 上的实数值,并将它推入(索引 0 上的实数值是 `None`,它表示在 `co_consts` 中,因为 Python 函数调用有一个隐式的返回值 `None`,如果没有显式的返回表达式,就返回这个隐式的值 )。
3. `CALL_FUNCTION 1`:告诉 Python 去调用一个函数;它需要从栈中弹出一个位置参数,然后,新的栈顶将被函数调用。
1. `LOAD_GLOBAL 0`:告诉 Python 通过 `co_names` (它是 `print` 函数)的索引 0 上的名字去查找它指向的全局对象,然后将它推入到计算栈
2. `LOAD_CONST 1`:带入 `co_consts` 在索引 1 上的字面值,并将它推入(索引 0 上的字面值是 `None`,它表示在 `co_consts` 中,因为 Python 函数调用有一个隐式的返回值 `None`,如果没有显式的返回表达式,就返回这个隐式的值 )。
3. `CALL_FUNCTION 1`:告诉 Python 去调用一个函数;它需要从栈中弹出一个位置参数,然后,新的栈顶将被函数调用。
"原始的" 字节码 — 是非人类可读格式的字节 — 也可以在代码对象上作为 `co_code` 属性可用。如果你有兴趣尝试手工反汇编一个函数时,你可以从它们的十进制字节值中,使用列出 `dis.opname` 的方式去查看字节码指令的名字。
“原始的” 字节码 —— 是非人类可读格式的字节 —— 也可以在代码对象上作为 `co_code` 属性可用。如果你有兴趣尝试手工反汇编一个函数时,你可以从它们的十进制字节值中,使用列出 `dis.opname` 的方式去查看字节码指令的名字。
### 字节码的用处
现在,你已经了解的足够多了,你可能会想 ” OK我认为它很酷但是知道这些有什么实际价值呢由于对它很好奇我们去了解它但是除了好奇之外Python 字节码在几个方面还是非常有用的。
现在,你已经了解的足够多了,你可能会想 “OK我认为它很酷但是知道这些有什么实际价值呢由于对它很好奇我们去了解它但是除了好奇之外Python 字节码在几个方面还是非常有用的。
首先,理解 Python 的运行模型可以帮你更好地理解你的代码。人们都开玩笑说C 将成为一个 ”便携式汇编器“,在那里你可以很好地猜测出一段 C 代码转换成什么样的机器指令。理解 Python 字节码之后,你在使用 Python 时也具备同样的能力 — 如果你能预料到你的 Python 源代码将被转换成什么样的字节码,那么你可以知道如何更好地写和优化 Python 源代码。
首先,理解 Python 的运行模型可以帮你更好地理解你的代码。人们都开玩笑说C 是一种 “可移植汇编器”,你可以很好地猜测出一段 C 代码转换成什么样的机器指令。理解 Python 字节码之后,你在使用 Python 时也具备同样的能力 — 如果你能预料到你的 Python 源代码将被转换成什么样的字节码,那么你可以知道如何更好地写和优化 Python 源代码。
第二,理解字节码可以帮你更好地回答有关 Python 的问题。比如,我经常看到一些 Python 新手困惑为什么某些结构比其它结构运行的更快(比如,为什么 `{}``dict()` 快)。知道如何去访问和阅读 Python 字节码将让你很容易回答这样的问题(尝试对比一下: `dis.dis("{}")``dis.dis("dict()")` 就会明白)。
@ -131,7 +116,6 @@ dis.dis(hello)
* 最后CPython 解析器是一个开源软件,你可以在 [GitHub][1] 上阅读它。它在文件 `Python/ceval.c` 中实现了字节码解析器。[这是 Python 3.6.4 发行版中那个文件的链接][5];字节码指令是由第 1266 行开始的 `switch` 语句来处理的。
学习更多内容,参与到 James Bennett 的演讲,[有关字节的知识:理解 Python 字节码][6],将在 [PyCon Cleveland 2018][7] 召开。
--------------------------------------------------------------------------------
@ -141,7 +125,7 @@ via: https://opensource.com/article/18/4/introduction-python-bytecode
作者:[James Bennett][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[qhwdw](https://github.com/qhwdw)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,9 +1,11 @@
将你的树莓派打造成一个 Tor 中继节点
======
> 在此教程中学习如何将你的旧树莓派打造成一个完美的 Tor 中继节点。
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/tor-onion-router.jpg?itok=6WUl0ElH)
你是否和我一样,在第一代或者第二代树莓派发布时买了一个,玩了一段时间就把它搁置“吃灰”了。毕竟,除非你是机器人爱好者,否则一般不太可能去长时间使用一个处理器很慢的并且内存只有 256 MB 的计算机。这并不是说你不能用它去做一件很酷的东西,但是在工作和其它任务之间,我还没有看到用一些旧的物件发挥新作用的机会。
你是否和我一样,在第一代或者第二代树莓派发布时买了一个,玩了一段时间就把它搁置“吃灰”了。毕竟,除非你是机器人爱好者,否则一般不太可能去长时间使用一个处理器很慢的并且内存只有 256 MB 的计算机。这并不是说你不能用它去做一件很酷的东西,但是在工作和其它任务之间,我还没有看到用一些旧的物件发挥新作用的机会。
然而,如果你想去好好利用它并且不想花费你太多的时间和资源的话,可以将你的旧树莓派打造成一个完美的 Tor 中继节点。
@ -11,18 +13,13 @@
在此之前你或许听说过 [Tor 项目][1]如果恰好你没有听说过我简单给你介绍一下“Tor” 是 “The Onion Router洋葱路由器” 的缩写,它是用来对付在线追踪和其它违反隐私行为的技术。
不论你在因特网上做什么事情,都会在你的 IP 包通过的设备上留下一些数字“脚印”:所有的交换机、路由器、负载均衡,以及目标网络记录的来自你的原始会话的 IP 地址,以及你访问的因特网资源(经常是主机名、[甚至是在使用 HTTPS 时][2])的 IP 地址。如何你是在家中上因特网,那么你的 IP 地址可以直接映射到你的家庭所在地。如果你使用了 VPN 服务([你应该使用][3]),那么你的 IP 地址是映射到你的 VPN 提供商那里,而 VPN 提供商是可以映射到你的家庭所在地的。无论如何,有可能在某个地方的某个人正在根据你访问的网络和在网站上呆了多长时间来为你建立一个个人的在线资料。然后将这个资料进行出售,并与从其它服务上收集的资料进行聚合,然后利用广告网络进行赚钱。至少,这是乐观主义者对如何利用这些数据的一些看法 —— 我相信你还可以找到更多的更恶意地使用这些数据的例子。
Tor 项目尝试去提供一个解决这种问题的方案,使它们不可能(或者至少是更加困难)追踪到你的终端 IP 地址。Tor 是通过让你的连接在一个由匿名的入口节点、中继节点、和出口节点组成的匿名中继链上反复跳转的方式来实现防止追踪的目的:
1. **入口节点** 只知道你的 IP 地址和中继节点的 IP 地址,但是不知道你最终要访问的目标 IP 地址
2. **中继节点** 只知道入口节点和出口节点的 IP 地址,以及即不是源也不是最终目标的 IP 地址
3. **出口节点** 仅知道中继节点和最终目标地址,它是在到达最终目标地址之前解密流量的节点
不论你在互联网上做什么事情,都会在你的 IP 包通过的设备上留下一些数字“脚印”:所有的交换机、路由器、负载均衡,以及目标网络记录的来自你的原始会话的 IP 地址,以及你访问的互联网资源(通常是它的主机名,[即使是在使用 HTTPS 时][2])的 IP 地址。如过你是在家中上互联网,那么你的 IP 地址可以直接映射到你的家庭所在地。如果你使用了 VPN 服务([你应该使用][3]),那么你的 IP 地址映射到你的 VPN 提供商那里,而 VPN 提供商是可以映射到你的家庭所在地的。无论如何,有可能在某个地方的某个人正在根据你访问的网络和在网站上呆了多长时间来为你建立一个个人的在线资料。然后将这个资料进行出售,并与从其它服务上收集的资料进行聚合,然后利用广告网络进行赚钱。至少,这是乐观主义者对如何利用这些数据的一些看法 —— 我相信你还可以找到更多的更恶意地使用这些数据的例子。
Tor 项目尝试去提供一个解决这种问题的方案,使它们不可能(或者至少是更加困难)追踪到你的终端 IP 地址。Tor 是通过让你的连接在一个由匿名的入口节点、中继节点和出口节点组成的匿名中继链上反复跳转的方式来实现防止追踪的目的:
1. **入口节点** 只知道你的 IP 地址和中继节点的 IP 地址,但是不知道你最终要访问的目标 IP 地址
2. **中继节点** 只知道入口节点和出口节点的 IP 地址,以及既不是源也不是最终目标的 IP 地址
3. **出口节点** 仅知道中继节点和最终目标地址,它是在到达最终目标地址之前解密流量的节点
中继节点在这个交换过程中扮演一个关键的角色,因为它在源请求和目标地址之间创建了一个加密的障碍。甚至在意图偷窥你数据的对手控制了出口节点的情况下,在他们没有完全控制整个 Tor 中继链的情况下仍然无法知道请求源在哪里。
@ -30,81 +27,68 @@ Tor 项目尝试去提供一个解决这种问题的方案,使它们不可能
#### 考虑去做 Tor 中继时要记住的一些事情
一个 Tor 中继节点仅发送和接收加密流量 —— 它从不访问任何其它站点或者在线资源,因此你不用担心有人会利用你的家庭 IP 地址去直接浏览一些令人担心的站点。话虽如此,但是如果你居住在一个提供匿名增强服务anonymity-enhancing services是违法行为的司法管辖区的话,那么你还是不要运营你的 Tor 中继节点了。你还需要去查看你的因特网服务提供商的服务条款是否允许你去运营一个 Tor 中继。
一个 Tor 中继节点仅发送和接收加密流量 —— 它从不访问任何其它站点或者在线资源,因此你不用担心有人会利用你的家庭 IP 地址去直接浏览一些令人担心的站点。话虽如此,但是如果你居住在一个提供<ruby>匿名增强服务<rt>anonymity-enhancing services</rt></ruby>是违法行为的司法管辖区的话,那么你还是不要运营你的 Tor 中继节点了。你还需要去查看你的互联网服务提供商的服务条款是否允许你去运营一个 Tor 中继。
### 需要哪些东西
* 一个带完整外围附件的树莓派(任何型号/代次都行)
* 一张有 [Raspbian Stretch Lite][4] 的 SD 卡
* 一根以太网线缆
* 一根用于供电的 micro-USB 线缆
* 一个键盘和带 HDMI 接口的显示器(在配置期间使用)
本指南假设你已经配置好了你的家庭网络连接的线缆或者 ADSL 路由器,它用于运行 NAT 转换(它几乎是必需的)。大多数型号的树莓派都有一个可用于为树莓派供电的 USB 端口,如果你只是使用路由器的 WiFi 功能,那么路由器应该有空闲的以太网口。但是在我们将树莓派设置为一个“配置完不管”的 Tor 中继之前,我们还需要一个键盘和显示器。
### 引导脚本
我改编了一个很流行的 Tor 中继节点引导脚本以适配树莓派上使用 —— 你可以在我的 GitHub 仓库 <https://github.com/mricon/tor-relay-bootstrap-rpi> 上找到它。你用它引导树莓派并使用缺省的用户 “pi” 登入之后,做如下的工作:
我改编了一个很流行的 Tor 中继节点引导脚本以适配树莓派上使用 —— 你可以在我的 GitHub 仓库 <https://github.com/mricon/tor-relay-bootstrap-rpi> 上找到它。你用它引导树莓派并使用缺省的用户 `pi` 登入之后,做如下的工作:
```
sudo apt-get install -y git
git clone https://github.com/mricon/tor-relay-bootstrap-rpi
cd tor-relay-bootstrap-rpi
sudo ./bootstrap.sh
```
这个脚本将做如下的工作:
1. 安装最新版本的操作系统更新以确保树莓派打了所有的补丁
2. 将系统配置为无人值守自动更新,以确保有可用更新时会自动接收并安装
3. 安装 Tor 软件
4. 告诉你的 NAT 路由器去转发所需要的端口(端口一般是 443 和 8080因为这两个端口最不可能被互联网提供商过滤掉上的数据包到你的中继节点
4. 告诉你的 NAT 路由器去转发所需要的端口(端口一般是 443 和 8080因为这两个端口最不可能被因特网提供商过滤掉上的数据包到你的中继节点
脚本运行完成后,你需要去配置 torrc 文件 —— 但是首先,你需要决定打算贡献给 Tor 流量多大带宽。首先,在 Google 中输入 “[Speed Test][5]”,然后点击 “Run Speed Test” 按钮。你可以不用管 “Download speed” 的结果,因为你的 Tor 中继能处理的速度不会超过最大的上行带宽。
脚本运行完成后,你需要去配置 `torrc` 文件 —— 但是首先,你需要决定打算贡献给 Tor 流量多大带宽。首先,在 Google 中输入 “[Speed Test][5]”,然后点击 “Run Speed Test” 按钮。你可以不用管 “Download speed” 的结果,因为你的 Tor 中继能处理的速度不会超过最大的上行带宽。
所以,将 “Mbps upload” 的数字除以 8然后再乘以 1024结果就是每秒多少 KB 的宽带速度。比如,如果你得到的上行带宽是 21.5 Mbps那么这个数字应该是
```
21.5 Mbps / 8 * 1024 = 2752 KBytes per second
```
你可以限制你的中继带宽为那个数字的一半,并允许突发带宽为那个数字的四分之三。确定好之后,使用喜欢的文本编辑器打开 /etc/tor/torrc 文件,调整好带宽设置。
你可以限制你的中继带宽为那个数字的一半,并允许突发带宽为那个数字的四分之三。确定好之后,使用喜欢的文本编辑器打开 `/etc/tor/torrc` 文件,调整好带宽设置。
```
RelayBandwidthRate 1300 KBytes
RelayBandwidthBurst 2400 KBytes
```
当然,如果你想更慷慨,你可以将那几个设置的数字调的更大,但是尽量不要设置为最大的出口带宽 —— 如果设置的太高,它会影响你的日常使用。
你打开那个文件之后,你应该去设置更多的东西。首先是昵称 —— 只是为了你自己保存记录,第二个是联系信息,只需要一个电子邮件地址。由于你的中继是运行在无人值守模式下的,你应该使用一个定期检查的电子邮件地址 —— 如果你的中继节点离线超过 48 个小时,你将收到 “Tor Weather” 服务的告警信息。
```
Nickname myrpirelay
ContactInfo you@example.com
```
保存文件并重引导系统去启动 Tor 中继。
### 测试它确认有 Tor 流量通过
如果你想去确认中继节点的功能,你可以运行 “arm” 工具:
如果你想去确认中继节点的功能,你可以运行 `arm` 工具:
```
sudo -u debian-tor arm
```
它需要一点时间才显示,尤其是在老板子上。它通常会给你显示一个表示入站和出站流量(或者是错误信息,它将有助于你去排错)的柱状图。
@ -120,7 +104,7 @@ via: https://www.linux.com/blog/intro-to-linux/2018/6/turn-your-raspberry-pi-tor
作者:[Konstantin Ryabitsev][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[qhwdw](https://github.com/qhwdw)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,41 +1,42 @@
Sosreport - 收集系统日志和诊断信息的工具
Sosreport收集系统日志和诊断信息的工具
======
![](https://www.ostechnix.com/wp-content/uploads/2018/06/sos-720x340.png)
如果你是 RHEL 管理员,你可能肯定听说过 **Sosreport** - 一个可扩展、可移植和支持的数据收集工具。它是一个从类 Unix 操作系统收集系统配置详细信息和诊断信息的工具。当用户提出支持服务单时,他/她必须运行此工具并将由 Sosreport 工具生成的结果报告发送给 Red Hat 支持人员。然后,执行人员将根据报告进行初步分析,并尝试找出系统中的问题。不仅在 RHEL 系统上,你可以在任何类 Unix 操作系统上使用它来收集系统日志和其他调试信息。
如果你是 RHEL 管理员,你可能肯定听说过 **Sosreport** :一个可扩展、可移植的支持数据收集工具。它是一个从类 Unix 操作系统收集系统配置详细信息和诊断信息的工具。当用户提出支持服务单时,他/她必须运行此工具并将由 Sosreport 工具生成的结果报告发送给 Red Hat 支持人员。然后,执行人员将根据报告进行初步分析,并尝试找出系统中的问题。不仅在 RHEL 系统上,你可以在任何类 Unix 操作系统上使用它来收集系统日志和其他调试信息。
### 安装 Sosreport
Sosreport 在 Red Hat 官方系统仓库中,因此你可以使用 Yum 或 DNF 包管理器安装它,如下所示。
```
$ sudo yum install sos
```
要么,
```
$ sudo dnf install sos
```
在 Debian、Ubuntu 和 Linux Mint 上运行:
```
$ sudo apt install sosreport
```
### 用法
安装后,运行以下命令以收集系统配置详细信息和其他诊断信息。
```
$ sudo sosreport
```
系统将要求你输入系统的一些详细信息,例如系统名称、案例 ID 等。相应地输入详细信息,然后按 ENTER 键生成报告。如果你不想更改任何内容并使用默认值,只需按 ENTER 键即可。
系统将要求你输入系统的一些详细信息,例如系统名称、案例 ID 等。相应地输入详细信息,然后按回车键生成报告。如果你不想更改任何内容并使用默认值,只需按回车键即可。
我的 CentOS 7 服务器的示例输出:
```
sosreport (version 3.5)
@ -79,51 +80,49 @@ Please send this file to your support representative.
```
如果你不希望系统提示你输入此类详细信息,请如下使用批处理模式。
```
$ sudo sosreport --batch
```
正如你在上面的输出中所看到的,生成了一个归档报告并保存在 **/var/tmp/sos.DiJXi7** 中。在 RHEL 6/CentOS 6 中,报告将在 **/tmp** 中生成。你现在可以将此报告发送给你的支持人员,以便他可以进行初步分析并找出问题所在。
正如你在上面的输出中所看到的,生成了一个归档报告并保存在 `/var/tmp/sos.DiJXi7` 中。在 RHEL 6/CentOS 6 中,报告将在 `/tmp` 中生成。你现在可以将此报告发送给你的支持人员,以便他可以进行初步分析并找出问题所在。
你可能会担心或想知道报告中的内容。如果是这样,你可以通过运行以下命令来查看它:
```
$ sudo tar -tf /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz
```
要么,
```
$ sudo vim /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz
```
请注意,上述命令不会解压存档,而只显示存档中的文件和文件夹列表。如果要查看存档中文件的实际内容,请首先使用以下命令解压存档:
```
$ sudo tar -xf /var/tmp/sosreport-server.ostechnix.local-20180628171844.tar.xz
```
存档的所有内容都将解压当前工作目录中 “ssosreport-server.ostechnix.local-20180628171844/” 目录中。进入目录并使用 cat 命令或任何其他文本浏览器查看文件内容:
存档的所有内容都将解压当前工作目录中 `ssosreport-server.ostechnix.local-20180628171844/` 目录中。进入目录并使用 `cat` 命令或任何其他文本浏览器查看文件内容:
```
$ cd sosreport-server.ostechnix.local-20180628171844/
$ cat uptime
17:19:02 up 1:03, 2 users, load average: 0.50, 0.17, 0.10
```
有关 Sosreport 的更多详细信息,请参阅手册页。
```
$ man sosreport
```
就是这些了。希望这些有用。还有更多好东西。敬请关注!
干杯!
干杯!
--------------------------------------------------------------------------------
@ -132,7 +131,7 @@ via: https://www.ostechnix.com/sosreport-a-tool-to-collect-system-logs-and-diagn
作者:[SK][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[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/) 荣誉推出

View File

@ -1,3 +1,5 @@
Translating by Valoniakim
What is open source programming?
======

View File

@ -1,60 +0,0 @@
Translating by vk
How to make a career move from proprietary to open source technology
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open%20source_collaboration_0.png?itok=YEl_GXbv)
I started my journey as a software engineer at Northern Telecom, where I developed proprietary software for carrier-grade telephone switches. Although I learned Pascal while in college, at Northern Telecom I was trained in a proprietary programming language based on C. I also used a proprietary operating system and a proprietary version-control software.
I enjoyed working in the proprietary environment and had opportunities to do some interesting work. Then I had a turning point in my career that made me think about things. It happened at a career fair. I was invited to speak at a STEM career panel at a local middle school. I shared with the students my day-to-day responsibilities as a software engineer, and one of the students asked me a question: "Is this really what you always wanted to do in life? Do you enjoy and love what you are doing?"
Whenever my manager asked me this question, I would safely answer, "Yes, of course, I do!" But I had never been asked this by an innocent 6th grader who is interested in STEM. My response to the student was the same: "Of course I do!"
The truth was I did enjoy my career, but that student had me thinking… I had to reassess where I was in my career. I thought about the proprietary environment. I was an expert in my specialty, but that was one of the downsides: I was only modifying my area of code. Was I learning about different types of technology in a closed system? Was my skillset still marketable? Was I going through the motions? Is this what I really want to continue to do?
I thought all of those things, and I wondered: Was the challenge and creativity still there?
Life went on, and I had major life changes. I left Nortel Networks and took a career break to focus on my family.
When I was ready to re-enter the workforce, that 6th-grader's questions lingered in my mind. Is this want I've always wanted to do? I applied for several jobs that appeared to be a good match, but the feedback I received from recruiters was that they were looking for people with five or more years of Java and Python skills. It seemed that the skills and knowledge I had acquired over the course of my 15-year career at Nortel were no longer in demand or in use.
### Challenges
My first challenge was figuring out how to leverage the skills I gained while working at a proprietary company. I noticed there had been a huge shift in IT from proprietary to open source. I decided to learn and teach myself Python because it was the most in-demand language. Once I started to learn Python, I realized I needed a project to gain experience and make myself more marketable.
The next challenge was figuring out how to gain project experience with my new knowledge of Python. Former colleagues and my husband directed me toward open source software. When I googled "open source project," I discovered there were hundreds of open source projects, ranging from very small (one contributor) ones, to communities of less than 50 people, to huge projects with hundreds of contributors all over the world.
I did a keyword search in GitHub of technical terms that fit my skillset and found several projects that matched. I decided to leverage my interests and networking background to make my first contribution to OpenStack. I also discovered the [Outreachy][1] program, which offers three-month paid internships to people who are under-represented in tech.
### Lessons learned
One of the first things I learned is that I could contribute in many different ways. I could contribute to documentation and user design. I could also contribute by writing test cases. These are skillsets I developed over my career, and I didn't need five years of experience to contribute. All I needed was the commitment and drive to make a contribution.
After my first contribution to OpenStack was merged into the release, I was accepted into the Outreachy program. One of the best things about Outreachy is the mentor I was assigned to help me navigate the open source world.
Here are three other valuable lessons I learned that might help others who are interested in breaking into the open source world:
**Be persistent.** Be persistent in finding the right open source projects. Look for projects that match your core skillset. Also, look for ones that have a code of conduct and that are welcoming to newcomers—especially those with a getting started guide for newcomers. Be persistent in engaging in the community.
**Be patient.** Adjusting to open source takes time. Engagingin the community takes time. Giving thoughtful and meaningful feedback takes time, and reading and considering feedback you receive takes time.
**Participate in the community.** You don't have to have permission to work on a certain technology or a certain area. You can decide what you would like to work on and dive in.
Petra Sargent will present [You Can Teach an Old Dog New Tricks: Moving From Proprietary to Open Source][2] at the 20th annual [OSCON][3] event, July 16-19 in Portland, Oregon.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/career-move
作者:[Petra Sargent][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://opensource.com/users/psargent
[1]:https://www.outreachy.org/
[2]:https://conferences.oreilly.com/oscon/oscon-or/public/schedule/speaker/307631
[3]:https://conferences.oreilly.com/oscon/oscon-or

View File

@ -1,140 +0,0 @@
translating by wenwensnow
An Advanced System Configuration Utility For Ubuntu Power Users
======
![](https://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-4-1-720x340.png)
**Ubunsys** is a Qt-based advanced system utility for Ubuntu and its derivatives. Most of the configuration can be easily done from the command-line by the advanced users. Just in case, you dont want to use CLI all the time, you can use Ubunsys utility to configure your Ubuntu desktop system or its derivatives such as Linux Mint, Elementary OS etc. Ubunsys can be used to modify system configuration, install, remove, update packages and old kernels, enable/disable sudo access, install mainline kernel, update software repositories, clean up junk files, upgrade your Ubuntu to latest version, and so on. All of the aforementioned actions can be done with simple mouse clicks. You dont need to depend on CLI mode anymore. Here is the list of things you can do with Ubunsys:
* Install, update, and remove packages.
* Update and upgrade software repositories.
* Install mainline Kernel.
* Remove old and unused Kernels.
* Full system update.
* Complete System upgrade to next available version.
* Upgrade to latest development version.
* Clean up junk files from your system.
* Enable and/or disable sudo access without password.
* Make Sudo Passwords visible when you type them in the Terminal.
* Enable and/or disable hibernation.
* Enable and/or disable firewall.
* Open, backup and import sources.list.d and sudoers files.
* Show/unshow hidden startup items.
* Enable and/or disable Login sounds.
* Configure dual boot.
* Enable/disable Lock screen.
* Smart system update.
* Update and/or run all scripts at once using Scripts Manager.
* Exec normal user installation script from git.
* Check system integrity and missing GPG keys.
* Repair network.
* Fix broken packages.
* And more yet to come.
**Important note:** Ubunsys is not for Ubuntu beginners. It is dangerous and not a stable version yet. It might break your system. If youre a new to Ubuntu, dont use it. If you are very curious to use this application, go through each option carefully and proceed at your own risk. Do not forget to backup your important data before using this application.
### Ubunsys An Advanced System Configuration Utility For Ubuntu Power Users
#### Install Ubunsys
Ubunusys developer has made a PPA to make the installation process much easier. Ubunsys will currently work on Ubuntu 16.04 LTS, Ubuntu 17.04 64bit editions.
Run the following commands one by one to add Ubunsys PPA and install it.
```
sudo add-apt-repository ppa:adgellida/ubunsys
sudo apt-get update
sudo apt-get install ubunsys
```
If the PPA doesnt work, head over to the [**releases page**][1], download and install the Ubunsys package depending upon the architecture you use.
#### Usage
Once installed, launch Ubunsys from Menu. This is how Ubunsys main interface looks like.
![][3]
As you can see, Ubunusys has four main sections namely **Packages** , **Tweaks** , **System** , and **Repair**. There are one or more sub-sections available for each main tab to do different operations.
**Packages**
This section allows you to install, remove, update packages.
![][4]
**Tweaks**
In this section, we can do various various system tweaks such as,
* Open, backup, import sources.list and sudoers file;
* Configure dual boot;
* Enable/disable login sound, firewall, lock screen, hibernation, sudo access without password. You can also enable or disable for sudo access without password to specific users.
* Can make the passwords visible while typing them in Terminal (Disable Asterisks).
![][5]
**System**
This section further categorized into three sub-categories, each for distinct user type.
The **Normal user** tab allows us to,
* Update, upgrade packages and software repos.
* Clean system.
* Exec normal user installation script.
The **Advanced user** section allows us to,
* Clean Old/Unused Kernels.
* Install mainline Kernel.
* do smart packages update.
* Upgrade system.
The **Developer** section allows us to upgrade the Ubuntu system to latest development version.
![][6]
**Repair**
This is the fourth and last section of Ubunsys. As the name says, this section allows us to do repair our system, network, missing GPG keys, and fix broken packages.
![][7]
As you can see, Ubunsys helps you to do any system configuration, maintenance and software management tasks with few mouse clicks. You dont need to depend on Terminal anymore. Ubunsys can help you to accomplish any advanced tasks. Again, I warn you, Its not for beginners and it is not stable yet. So, you can expect bugs and crashes when using it. Use it with care after studying options and impact.
Cheers!
**Resource:**
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/ubunsys-advanced-system-configuration-utility-ubuntu-power-users/
作者:[SK][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://www.ostechnix.com/author/sk/
[1]:https://github.com/adgellida/ubunsys/releases
[2]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-1.png
[4]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-2.png
[5]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-5.png
[6]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-9.png
[7]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-11.png

View File

@ -1,84 +0,0 @@
translating---geekpi
Migrating to Linux: Using Sudo
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ray-hennessy-233438-unsplash.jpg?itok=d4l7QUtF)
This article is the fifth in our series about migrating to Linux. If you missed earlier ones, you can catch up here:
[Part 1 - An Introduction][1]
[Part 2 - Disks, Files, and Filesystems][2]
[Part 3 - Graphical Environments][3]
[Part 4 - The Command Line][4]
You may have been wondering about Linux for a while. Perhaps it's used in your workplace and you'd be more efficient at your job if you used it on a daily basis. Or, perhaps you'd like to install Linux on some computer equipment you have at home. Whatever the reason, this series of articles is here to make the transition easier.
Linux, like many other operating systems supports multiple users. It even supports multiple users being logged in simultaneously.
User accounts are typically assigned a home directory where files can be stored. Usually this home directory is in:
```
/home/<login name>
```
This way, each user has their own separate location for their documents and other files.
### Admin Tasks
In a traditional Linux installation, regular user accounts don't have permissions to perform administrative tasks on the system. And instead of assigning rights to each user to perform various tasks, a typical Linux installation will require a user to log in as the admin to do certain tasks.
The administrator account on Linux is called root.
### Sudo Explained
Historically, to perform admin tasks, one would have to login as root, perform the task, and then log back out. This process was a bit tedious, so many folks logged in as root and worked all day long as the admin. This practice could lead to disastrous results, for example, accidentally deleting all the files in the system. The root user, of course, can do anything, so there are no protections to prevent someone from accidentally performing far-reaching actions.
The sudo facility was created to make it easier to login as your regular user account and occasionally perform admin tasks as root without having to login, do the task, and log back out. Specifically, sudo allows you to run a command as a different user. If you don't specify a specific user, it assumes you mean root.
Sudo can have complex settings to allow users certain permissions to use sudo for some commands but not for others. Typically, a desktop installation will make it so the first account created has full permissions in sudo, so you as the primary user can fully administer your Linux installation.
### Using Sudo
Some Linux installations set up sudo so that you still need to know the password for the root account to perform admin tasks. Others, set up sudo so that you type in your own password. There are different philosophies here.
When you try to perform an admin task in the graphical environment, it will usually open a dialog box asking for a password. Enter either your own password (e.g., on Ubuntu), or the root account's password (e.g., Red Hat).
When you try to perform an admin task in the command line, it will usually just give you a "permission denied" error. Then you would re-run the command with sudo in front. For example:
```
systemctl start vsftpd
Failed to start vsftpd.service: Access denied
sudo systemctl start vsftpd
[sudo] password for user1:
```
### When to Use Sudo
Running commands as root (under sudo or otherwise) is not always the best solution to get around permission errors. While will running as root will remove the "permission denied" errors, it's sometimes best to look for the root cause rather than just addressing the symptom. Sometimes files have the wrong owner and permissions.
Use sudo when you are trying to perform a task or run a program and the program requires root privileges to perform the operation. Don't use sudo if the file just happens to be owned by another user (including root). In this second case, it's better to set the permission on the file correctly.
Learn more about Linux through the free ["Introduction to Linux" ][5]course from The Linux Foundation and edX.
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/learn/2018/3/migrating-linux-using-sudo
作者:[John Bonesio][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://www.linux.com/users/johnbonesio
[1]:https://www.linux.com/blog/learn/intro-to-linux/2017/10/migrating-linux-introduction
[2]:https://www.linux.com/blog/learn/intro-to-linux/2017/11/migrating-linux-disks-files-and-filesystems
[3]:https://www.linux.com/blog/learn/2017/12/migrating-linux-graphical-environments
[4]:https://www.linux.com/blog/learn/2018/1/migrating-linux-command-line
[5]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@ -1,3 +1,5 @@
translating---geekpi
4 cool new projects to try in COPR for June 2018
======
COPR is a [collection][1] of personal repositories for software that isnt carried in Fedora. Some software doesnt 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 isnt supported by Fedora infrastructure or signed by the project. However, it can be a neat way to try new or experimental software.

View File

@ -1,3 +1,5 @@
translated by hopefully2333
Install an NVIDIA GPU on almost any machine
======

View File

@ -0,0 +1,75 @@
6 RFCs for understanding how the internet works
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe)
Reading the source is an important part of open source software. It means users have the ability to look at the code and see what it does.
But "read the source" doesn't apply only to code. Understanding the standards the code implements can be just as important. These standards are codified in documents called "Requests for Comments" (RFCs) published by the [Internet Engineering Task Force][1] (IETF). Thousands of RFCs have been published over the years, so we collected a few that our contributors consider must-reads.
### 6 must-read RFCs
#### RFC 2119—Key words for use in RFCs to indicate requirement levels
This is a quick read, but it's important to understanding other RFCs. [RFC 2119][2] defines the requirement levels used in subsequent RFCs. What does "MAY" really mean? If the standard says "SHOULD," do you really have to do it? By giving the requirements a well-defined taxonomy, RFC 2119 helps avoid ambiguity.
Time is the bane of programmers the world over. [RFC 3339][3] defines how timestamps are to be formatted. Based on the [ISO 8601][4] standard, 3339 gives us a common way to represent time and its relentless march. For example, redundant information like the day of the week should not be included in a stored timestamp since it is easy to compute.
#### RFC 1918—Address allocation for private internets
There's the internet that's everyone's and then there's the internet that's just yours. Private networks are used all the time, and [RFC 1918][5] defines those networks. Sure, you could set up your router to route public spaces internally, but that's a bad idea. Alternately, you could take your unused public IP addresses and treat them as an internal network. In either case, you're making it clear you've never read RFC 1918.
#### RFC 1912—Common DNS operational and configuration errors
Everything is a #@%@ DNS problem, right? [RFC 1912][6] lays out mistakes that admins make when they're just trying to keep the internet running. Although it was published in 1996, DNS (and the mistakes people make with it) hasn't really changed all that much. To understand why we need DNS in the first place, consider what [RFC 289—What we hope is an official list of host names][7] would look like today.
#### RFC 2822—Internet message format
Think you know what a valid email address looks like? If the number of sites that won't accept a "+" in my address is any indication, you don't. [RFC 2822][8] defines what a valid email address looks like. It also goes into detail about the rest of an email message.
#### RFC 7231—Hypertext Transfer Protocol (HTTP/1.1): Semantics and content
When you stop to think about it, almost everything we do online relies on HTTP. [RFC 7231][9] is among the most recent updates to that protocol. Weighing in at just over 100 pages, it defines methods, headers, and status codes.
### 3 should-read RFCs
Okay, not every RFC is serious business.
#### RFC 1149—A standard for the transmission of IP datagrams on avian carriers
Networks pass packets in many different ways. [RFC 1149][10] describes the use of carrier pigeons. They can't be any less reliable than my mobile provider when I'm more than a mile away from an interstate highway.
#### RFC 2324—Hypertext coffee pot control protocol (HTCPCP/1.0)
Coffee is very important to getting work done, so of course, we need a programmatic interface for managing our coffee pots. [RFC 2324][11] defines a protocol for interacting with coffee pots and adds HTTP 418 ("I am a teapot").
#### RFC 69—Distribution list change for M.I.T.
Is [RFC 69][12] the first published example of a misdirected unsubscribe request?
What are your must-read RFCs (whether they're serious or not)? Share your list in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/requests-for-comments-to-know
作者:[Ben Cotton][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://opensource.com/users/bcotton
[1]:https://www.ietf.org
[2]:https://www.rfc-editor.org/rfc/rfc2119.txt
[3]:https://www.rfc-editor.org/rfc/rfc3339.txt
[4]:https://www.iso.org/iso-8601-date-and-time-format.html
[5]:https://www.rfc-editor.org/rfc/rfc1918.txt
[6]:https://www.rfc-editor.org/rfc/rfc1912.txt
[7]:https://www.rfc-editor.org/rfc/rfc289.txt
[8]:https://www.rfc-editor.org/rfc/rfc2822.txt
[9]:https://www.rfc-editor.org/rfc/rfc7231.txt
[10]:https://www.rfc-editor.org/rfc/rfc1149.txt
[11]:https://www.rfc-editor.org/rfc/rfc2324.txt
[12]:https://www.rfc-editor.org/rfc/rfc69.txt

View File

@ -0,0 +1,126 @@
How to Run Windows Apps on Android with Wine
======
![](https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-featured-image.jpg)
Wine (on Linux, not the one you drink) is a free and open-source compatibility layer for running Windows programs on Unix-like operating systems. Begun in 1993, it could run a wide variety of Windows programs on Linux and macOS, although sometimes with modification. Now the Wine Project has rolled out version 3.0 which is compatible with your Android devices.
In this article we will show you how you can run Windows apps on your Android device with WINE.
**Related** : [How to Easily Install Windows Games on Linux with Winepak][1]
### What can you run on Wine?
Wine is only a compatibility layer, not a full-blown emulator, so you need an x86 Android device to take full advantage of it. However, most Androids in the hands of consumers are ARM-based.
Since most of you are using an ARM-based Android device, you will only be able to use Wine to run apps that have been adapted to run on Windows RT. There is a limited, but growing, list of software available for ARM devices. You can find a list of these apps that are compatible in this [thread][2] on XDA Developers Forums.
Some examples of apps you will be able to run on ARM are:
* [Keepass Portable][3]: A password storage wallet
* [Paint.NET][4]: An image manipulation program
* [SumatraPDF][5]: A document reader for PDFs and possibly some other document types
* [Audacity][6]: A digital audio recording and editing program
There are also some open-source retro games available like [Doom][7] and [Quake 2][8], as well as the open-source clone, [OpenTTD][9], a version of Transport Tycoon.
The list of programs that Wine can run on Android ARM devices is bound to grow as the popularity of Wine on Android expands. The Wine project is working on using QEMU to emulate x86 CPU instructions on ARM, and when that is complete, the number of apps your Android will be able to run should grow rapidly.
### Installing Wine
To install Wine you must first make sure that your devices settings allow it to download and install APKs from other sources than the Play Store. To do this youll need to give your device permission to download apps from unknown sources.
1\. Open Settings on your phone and select your Security options.
![wine-android-security][10]
2\. Scroll down and click on the switch next to “Unknown Sources.”
![wine-android-unknown-sources][11]
3\. Accept the risks in the warning.
![wine-android-unknown-sources-warning][12]
4\. Open the [Wine installation site][13], and tap the first checkbox in the list. The download will automatically begin.
![wine-android-download-button][14]
5\. Once the download completes, open it from your Downloads folder, or pull down the notifications menu and click on the completed download there.
6\. Install the program. It will notify you that it needs access to recording audio and to modify, delete, and read the contents of your SD card. You may also need to give access for audio recording for some apps you will use in the program.
![wine-android-app-access][15]
7\. When the installation completes, click on the icon to open the program.
![wine-android-icon-small][16]
When you open Wine, the desktop mimics Windows 7.
![wine-android-desktop][17]
One drawback of Wine is that you have to have an external keyboard available to type. An external mouse may also be useful if you are running it on a small screen and find it difficult to tap small buttons.
You can tap the Start button to open two menus Control Panel and Run.
![wine-android-start-button][18]
### Working with Wine
When you tap “Control panel” you will see three choices Add/Remove Programs, Game Controllers, and Internet Settings.
Using “Run,” you can open a dialogue box to issue commands. For instance, launch Internet Explorer by entering `iexplore`.
![wine-android-run][19]
### Installing programs on Wine
1\. Download the application (or sync via the cloud) to your Android device. Take note of where you save it.
2\. Open the Wine Command Prompt window.
3\. Type the path to the location of the program. If you have saved it to the Download folder on your SD card, type:
4\. To run the file in Wine for Android, simply input the name of the EXE file.
If the ARM-ready file is compatible, it should run. If not, youll see a bunch of error messages. At this stage, installing Windows software on Android in Wine can be hit or miss.
There are still a lot of issues with this new version of Wine for Android. It doesnt work on all Android devices. It worked on my Galaxy S6 Edge but not on my Galaxy Tab 4. Many games wont work because the graphics driver doesnt support Direct3D yet. You need an external keyboard and mouse to be able to easily manipulate the screen because touch-screen is not fully developed yet.
Even with these issues in the early stages of release, the possibilities for this technology are thought-provoking. Its certainly likely that it will take some time yet before you can launch Windows programs on your Android smartphone using Wine without a hitch.
--------------------------------------------------------------------------------
via: https://www.maketecheasier.com/run-windows-apps-android-with-wine/
作者:[Tracey Rosenberger][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://www.maketecheasier.com/author/traceyrosenberger/
[1]:https://www.maketecheasier.com/winepak-install-windows-games-linux/ (How to Easily Install Windows Games on Linux with Winepak)
[2]:https://forum.xda-developers.com/showthread.php?t=2092348
[3]:http://downloads.sourceforge.net/keepass/KeePass-2.20.1.zip
[4]:http://forum.xda-developers.com/showthread.php?t=2411497
[5]:http://forum.xda-developers.com/showthread.php?t=2098594
[6]:http://forum.xda-developers.com/showthread.php?t=2103779
[7]:http://forum.xda-developers.com/showthread.php?t=2175449
[8]:http://forum.xda-developers.com/attachment.php?attachmentid=1640830&d=1358070370
[9]:http://forum.xda-developers.com/showpost.php?p=36674868&postcount=151
[10]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-security.png (wine-android-security)
[11]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-unknown-sources.jpg (wine-android-unknown-sources)
[12]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-unknown-sources-warning.png (wine-android-unknown-sources-warning)
[13]:https://dl.winehq.org/wine-builds/android/
[14]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-download-button.png (wine-android-download-button)
[15]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-app-access.jpg (wine-android-app-access)
[16]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-icon-small.jpg (wine-android-icon-small)
[17]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-desktop.png (wine-android-desktop)
[18]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-start-button.png (wine-android-start-button)
[19]:https://www.maketecheasier.com/assets/uploads/2018/07/Wine-Android-Run.png (wine-android-run)

View File

@ -0,0 +1,70 @@
Revisiting wallabag, an open source alternative to Instapaper
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ)
Back in 2014, I [wrote about wallabag][1], an open source alternative to read-it-later applications like Instapaper and Pocket. Go take a look at that article if you want to. Don't worry, I'll wait for you.
Done? Great!
In the four years since I wrote that article, a lot about [wallabag][2] has changed. It's time to take a peek to see how wallabag has matured.
### What's new
The biggest change took place behind the scenes. Wallabag's developer Nicolas Lœuillet and the project's contributors did a lot of tinkering with the code, which improved the application. You see and feel the changes wrought by wallabag's newer codebase every time you use it.
So what are some of those changes? There are [quite a few][3]. Here are the ones I found most interesting and useful.
Besides making wallabag a bit snappier and more stable, the application's ability to import and export content has improved. You can import articles from Pocket and Instapaper, as well as articles marked as "To read" in bookmarking service [Pinboard][4]. You can also import Firefox and Chrome bookmarks.
You can also export your articles in several formats including EPUB, MOBI, PDF, and plaintext. You can do that for individual articles, all your unread articles, or every article—read and unread. The version of wallabag that I used four years ago could export to EPUB and PDF, but that export was balky at times. Now, those exports are quick and smooth.
Annotations and highlighting in the web interface now work much better and more consistently. Admittedly, I don't use them often—but they don't randomly disappear like they sometimes did with version 1 of wallabag.
![](https://opensource.com/sites/default/files/uploads/wallabag-annotation.png)
The look and feel of wallabag have improved, too. That's thanks to a new theme inspired by [Material Design][5]. That might not seem like a big deal, but that theme makes wallabag a bit more visually attractive and makes articles easier to scan and read. Yes, kids, good UX can make a difference.
![](https://opensource.com/sites/default/files/uploads/wallabag-theme.png)
One of the biggest changes was the introduction of [a hosted version][6] of wallabag. More than a few people (yours truly included) don't have a server to run web apps and aren't entirely comfortable doing that. When it comes to anything technical, I have 10 thumbs. I don't mind paying € 9 (just over US$ 10 at the time I wrote this) a year to get a fully working version of the application that I don't need to watch over.
### What hasn't changed
Overall, wallabag's core functions are the same. The updated codebase, as I mentioned above, makes those functions run quite a bit smoother and quicker.
Wallabag's [browser extensions][7] do the same job in the same way. I've found that the extensions work a bit better than they did when I first tried them and when the application was at version 1.
### What's disappointing
The mobile app is good, but it's not great. It does a good job of rendering articles and has a few configuration options. But you can't highlight or annotate articles. That said, you can use the app to dip into your stock of archived articles.
![](https://opensource.com/sites/default/files/uploads/wallabag-android.png)
While wallabag does a great job collecting articles, there are sites whose content you can't save to it. I haven't run into many such sites, but there have been enough for the situation to be annoying. I'm not sure how much that has to do with wallabag. Rather, I suspect it has something to do with the way the sites are coded—I ran into the same problem while looking at a couple of proprietary read-it-later tools.
Wallabag might not be a feature-for-feature replacement for Pocket or Instapaper, but it does a great job. It has improved noticeably in the four years since I first wrote about it. There's still room for improvement, but does what it says on the tin.
### Final thoughts
Since 2014, wallabag has evolved. It's gotten better, bit by bit and step by step. While it might not be a feature-for-feature replacement for the likes of Instapaper and Pocket, wallabag is a worthy open source alternative to proprietary read-it-later tools.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/wallabag
作者:[Scott Nesbitt][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://opensource.com/users/scottnesbitt
[1]:https://opensource.com/life/14/4/open-source-read-it-later-app-wallabag
[2]:https://wallabag.org/en
[3]:https://www.wallabag.org/en/news/wallabag-v2
[4]:https://pinboard.in
[5]:https://en.wikipedia.org/wiki/Material_Design
[6]:https://www.wallabag.it
[7]:https://github.com/wallabag/wallabagger

View File

@ -0,0 +1,141 @@
Robolinux Lets You Easily Run Linux and Windows Without Dual Booting
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/robolinux-main.jpg?itok=zsMPdGsP)
The number of Linux distributions available just keeps getting bigger. In fact, in the time it took me to write this sentence, another one may have appeared on the market. Many Linux flavors have trouble standing out in this crowd, and some are just a different combination of puzzle pieces joined to form something new: An Ubuntu base with a KDE desktop environment. A Debian base with an Xfce desktop. The combinations go on and on.
[Robolinux][1], however, does something unique. Its the only distro, to my knowledge, that makes working with Windows alongside Linux a little easier for the typical user. With just a few clicks, it lets you create a Windows virtual machine (by way of VirtualBox) that can run side by side with Linux. No more dual booting. With this process, you can have Windows XP, Windows 7, or Windows 10 up and running with ease.
And, you get all this on top of an operating system thats pretty fantastic on its own. Robolinux not only makes short work of having Windows along for the ride, it simplifies using Linux itself. Installation is easy, and the installed collection of software means anyone can be productive right away.
Lets install Robolinux and see what there is to see.
### Installation
As I mentioned earlier, installing Robolinux is easy. Obviously, you must first [download an ISO][2] image of the operating system. You have the choice of installing a Cinnamon, Mate, LXDE, or xfce desktop (I opted to go the Mate route). I will warn you, the developers do make a pretty heavy-handed plea for donations. I dont fault them for this. Developing an operating system takes a great deal of time. So if you have the means, do make a donation.
Once youve downloaded the file, burn it to a CD/DVD or flash drive. Boot your system with the media and then, once the desktop loads, click the Install icon on the desktop. As soon as the installer opens (Figure 1), you should be immediately familiar with the layout of the tool.
![Robolinux installer][4]
Figure 1: The Robolinux installer is quite user-friendly.
[Used with permission][5]
Once youve walked through the installer, reboot, remove the installation media, and login when prompted. I will say that I installed Robolinux as a VirtualBox VM and it installed to perfection. This however, isnt a method you should use, if youre going to take advantage of the Stealth VM option. After logging in, the first thing I did was install the Guest Additions and everything was working smoothly.
### Default applications
The collection of default applications is impressive, but not overwhelming. Youll find all the standard tools to get your work done, including:
* LibreOffice
* Atril Document Viewer
* Backups
* GNOME Disks
* Medit text editor
* Seahorse
* GIMP
* Shotwell
* Simple Scan
* Firefox
* Pidgen
* Thunderbird
* Transmission
* Brasero
* Cheese
* Kazam
* Rhythmbox
* VLC
* VirtualBox
* And more
With that list of software, you shouldnt want for much. However, should you find a app not installed, click on the desktop menu button and then click Package Manager, which will open Synaptic Package Manager, where you can install any of the Linux software you need.
If thats not enough, its time to take a look at the Windows side of things.
### Installing Windows
This is what sets Robolinux apart from other Linux distributions. If you click on the desktop menu button, you see a Stealth VM entry. Within that sub-menu, a listing of the different Windows VMs that can be installed appears (Figure 2).
![Windows VMs][7]
Figure 2: The available Windows VMs that can be installed alongside of Robolinux.
[Used with permission][5]
Before you can install one of the VMs, you must first download the Stealth VM file. To do that, double-click on the desktop icon that includes an image of the developers face (labeled Robos FREE Stealth VM). You must save that file to the ~/Downloads directory. Dont save it anywhere else, dont extract it, and dont rename it. With that file in place, click the start menu and then click Stealth VM. From the listing, click the top entry, Robolinx Stealth VM Installer. When prompted, type your sudo password. You will then be prompted that the Stealth VM is ready to be used. Go back to the start menu and click Stealth VM and select the version of Windows you want to install. A new window will appear (Figure 3). Click Yes and the installation will continue.
![Installing Windows][9]
Figure 3: Installing Windows in the Stealth VM.
[Used with permission][5]
Next you will be prompted to type your sudo password again (so your user can be added to the vboxusers group). Once youve taken care of that, youll be prompted to configure the RAM you want to dedicate to the VM. After that, a browser window will appear (once again asking for a donation). At this point everything is (almost) done. Close the browser and the terminal window.
Youre not finished.
Next you must insert the Windows installer media that matches the type of Windows VM you installed. You then must start VirtualBox by click start menu > System Tools > Oracle VM VirtualBox. When VirtualBox opens, an entry will already be created for your Windows VM (Figure 4).
![Windows VM][11]
Figure 4: Your Windows VM is ready to go.
[Used with permission][5]
You can now click the Start button (in VirtualBox) to finish up the installation. When the Windows installation completes, youre ready to work with Linux and Windows side-by-side.
### Making VMs a bit more user-friendly
You may be thinking to yourself, “Creating a virtual machine for Windows is actually easier than that!”. Although you are correct with that sentiment, not everyone knows how to create a new VM with VirtualBox. In the time it took me to figure out how to work with the Robolinux Stealth VM, I could have had numerous VMs created in VirtualBox. Additionally, this approach doesnt happen free of charge. You do still have to have a licensed copy of Windows (as well as the installation media). But anything developers can do to make using Linux easier is a plus. Thats how I see this—a Linux distribution doing something just slightly different that could remove a possible barrier to entry for the open source platform. From my perspective, thats a win-win. And, youre getting a pretty solid Linux distribution to boot.
If you already know the ins and outs of VirtualBox, Robolinux might not be your cuppa. But, if you dont like technology getting in the way of getting your work done and you want to have a Linux distribution that includes all the necessary tools to help make you productive, Robolinux is definitely worth a look.
Learn more about Linux through the free ["Introduction to Linux" ][12] course from The Linux Foundation and edX.
--------------------------------------------------------------------------------
via: https://www.linux.com/learn/intro-to-linux/2018/7/robolinux-lets-you-easily-run-linux-and-windows-without-dual-booting
作者:[Jack Wallen][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://www.linux.com/users/jlwallen
[1]:https://www.robolinux.org
[2]:https://www.robolinux.org/downloads/
[3]:/files/images/robolinux1jpg
[4]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/robolinux_1.jpg?itok=MA0MD6KY (Robolinux installer)
[5]:/licenses/category/used-permission
[6]:/files/images/robolinux2jpg
[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/robolinux_2.jpg?itok=bHktIhhK (Windows VMs)
[8]:/files/images/robolinux3jpg
[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/robolinux_3.jpg?itok=B7ar6hZf (Installing Windows)
[10]:/files/images/robolinux4jpg
[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/robolinux_4.jpg?itok=nEOt5Vnc (Windows VM)
[12]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@ -0,0 +1,168 @@
Using Ansible to set up a workstation
======
![](https://fedoramagazine.org/wp-content/uploads/2018/07/ansible-workstation-816x345.png)
Ansible is an extremely popular [open-source configuration management and software automation project][1]. While IT professionals almost certainly use Ansible on a daily basis, its influence outside the IT industry is not as wide. Ansible is a powerful and flexible tool. It is easily applied to a task common to nearly every desktop computer user: the post-installation “checklist”.
Most users like to apply one “tweak” after a new installation. Ansibles idempotent, declarative syntax lends itself perfectly to describing how a system should be configured.
### Ansible in a nutshell
The _ansible_ program itself performs a **single task** against a set of hosts. This is roughly conceptualized as:
```
for HOST in $HOSTS; do
ssh $HOST /usr/bin/echo "Hello World"
done
```
To perform more than one task, Ansible defines the concept of a “playbook”. A playbook is a YAML file describing the _state_ of the targeted machine. When run, Ansible inspects each host and performs only the tasks necessary to enforce the state defined in the playbook.
```
- hosts: all
tasks:
- name: Echo "Hello World"
command: echo "Hello World"
```
Run the playbook using the _ansible-playbook_ command:
```
$ ansible-playbook ~/playbook.yml
```
### Configuring a workstation
Start by installing ansible:
```
dnf install ansible
```
Next, create a file to store the playbook:
```
touch ~/post_install.yml
```
Start by defining the host on which to run this playbook. In this case, “localhost”:
```
- hosts: localhost
```
Each task consists of a _name_ field and a module field. Ansible has **a lot** of [modules][2]. Be sure to browse the module index to become familiar with all Ansible has to offer.
#### The package module
Most users install additional packages after a fresh install, and many like to remove some shipped software they dont use. The _[package][3]_ module provides a generic wrapper around the system package manager (in Fedoras case, _dnf_ ).
```
- hosts: localhost
tasks:
- name: Install Builder
become: yes
package:
name: gnome-builder
state: present
- name: Remove Rhythmbox
become: yes
package:
name: rhythmbox
state: absent
- name: Install GNOME Music
become: yes
package:
name: gnome-music
state: present
- name: Remove Shotwell
become: yes
package:
name: shotwell
state: absent
```
This playbook results in the following outcomes:
* GNOME Builder and GNOME Music are installed
* Rhythmbox is removed
* On Fedora 28 or greater, nothing happens with Shotwell (it is not in the default list of packages)
* On Fedora 27 or older, Shotwell is removed
This playbook also introduces the **become: yes** directive. This specifies the task must be run by a privileged user (in most cases, _root_ ).
#### The DConf Module
Ansible can do a lot more than install software. For example, GNOME includes a great color-shifting feature called Night Light. It ships disabled by default, however the Ansible _[dconf][4]_ module can very easily enable it.
```
- hosts: localhost
tasks:
- name: Enable Night Light
dconf:
key: /org/gnome/settings-daemon/plugins/color/night-light-enabled
value: true
- name: Set Night Light Temperature
dconf:
key: /org/gnome/settings-daemon/plugins/color/night-light-temperature
value: uint32 5500
```
Ansible can also create files at specified locations with the _[copy][5]_ module. In this example, a local file is copied to the destination path.
```
- hosts: localhost
tasks:
- name: Enable "AUTH_ADMIN_KEEP" for pkexec
become: yes
copy:
src: files/51-pkexec-auth-admin-keep.rules
dest: /etc/polkit-1/rules.d/51-pkexec-auth-admin-keep.rules
```
#### The Command Module
Ansible can still run commands even if no specialized module exists (via the aptly named _[command][6]_ module). This playbook enables the [Flathub][7] repository and installs a few Flatpaks. The commands are crafted in such a way that they are effectively idempotent. This is an important behavior to consider; a playbook should succeed each time it is run on a machine.
```
- hosts: localhost
tasks:
- name: Enable Flathub repository
become: yes
command: flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
- name: Install Fractal
become: yes
command: flatpak install --assumeyes flathub org.gnome.Fractal
- name: Install Spotify
become: yes
command: flatpak install --assumeyes flathub com.spotify.Client
```
Combine all these tasks together into a single playbook and, in one command, ** Ansible will customize a freshly installed workstation. Not only that, but 6 months later, after making changes to the playbook, run it again to bring a “seasoned” install back to a known state.
```
$ ansible-playbook -K ~/post_install.yml
```
This article only touched the surface of whats possible with Ansible. A follow-up article will go into more advanced Ansible concepts such as _roles,_ configuring multiple hosts with a divided set of responsibilities.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/using-ansible-setup-workstation/
作者:[Link Dupont][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://fedoramagazine.org/author/linkdupont/
[1]:https://ansible.com
[2]:https://docs.ansible.com/ansible/latest/modules/list_of_all_modules.html
[3]:https://docs.ansible.com/ansible/latest/modules/package_module.html#package-module
[4]:https://docs.ansible.com/ansible/latest/modules/dconf_module.html#dconf-module
[5]:https://docs.ansible.com/ansible/latest/modules/copy_module.html#copy-module
[6]:https://docs.ansible.com/ansible/latest/modules/command_module.html#command-module
[7]:https://flathub.org

View File

@ -0,0 +1,212 @@
Getting Started with Debian Packaging
======
![](http://minkush.me/img/posts/12.jpg)
One of my tasks in GSoC involved set up of Thunderbird extensions for the user. Some of the more popular add-ons like [Lightning][1] (calendar organiser) already has a Debian package.
Another important add on is [Cardbook][2] which is used to manage contacts for the user based on CardDAV and vCard standards. But it doesnt have a package yet.
My mentor, [Daniel][3] motivated me to create a package for it and upload it to [mentors.debian.net][4]. It would ease the installation process as it could get installed through `apt-get`. This blog describes how I learned and created a Debian package for CardBook from scratch.
Since, I was new to packaging, I did extensive research on basics of building a package from the source code and checked if the license was [DFSG][5] compatible.
I learned from various Debian wiki guides like [Packaging Intro][6], [Building a Package][7] and blogs.
I also studied the amd64 files included in [Lightning extension package][8].
The package I created could be found [here][9].
![Debian Package!][10]
Debian Package
### Creating an empty package
I started by creating a `debian` directory by using `dh_make` command
```
# Empty project folder
$ mkdir -p Debian/cardbook
```
```
# create files
$ dh_make\
> --native \
> --single \
> --packagename cardbook_1.0.0 \
> --email minkush@example.com
```
Some important files like control, rules, changelog, copyright are initialized with it.
The list of all the files created:
```
$ find /debian
debian/
debian/rules
debian/preinst.ex
debian/cardbook-docs.docs
debian/manpage.1.ex
debian/install
debian/source
debian/source/format
debian/cardbook.debhelper.lo
debian/manpage.xml.ex
debian/README.Debian
debian/postrm.ex
debian/prerm.ex
debian/copyright
debian/changelog
debian/manpage.sgml.ex
debian/cardbook.default.ex
debian/README
debian/cardbook.doc-base.EX
debian/README.source
debian/compat
debian/control
debian/debhelper-build-stamp
debian/menu.ex
debian/postinst.ex
debian/cardbook.substvars
debian/files
```
I gained an understanding of [Dpkg][11] package management program in Debian and its use to install, remove and manage packages.
I build an empty package with `dpkg` commands. This created an empty package with four files namely `.changes`, `.deb`, `.dsc`, `.tar.gz`
`.dsc` file contains the changes made and signature
`.deb` is the main package file which can be installed
`.tar.gz` (tarball) contains the source package
The process also created the README and changelog files in `/usr/share`. They contain the essential notes about the package like description, author and version.
I installed the package and checked the installed package contents. My new package mentions the version, architecture and description!
```
$ dpkg -L cardbook
/usr
/usr/share
/usr/share/doc
/usr/share/doc/cardbook
/usr/share/doc/cardbook/README.Debian
/usr/share/doc/cardbook/changelog.gz
/usr/share/doc/cardbook/copyright
```
### Including CardBook source files
After successfully creating an empty package, I added the actual CardBook add-on files inside the package. The CardBooks codebase is hosted [here][12] on Gitlab. I included all the source files inside another directory and told the build package command which files to include in the package.
I did this by creating a file `debian/install` using vi editor and listed the directories that should be installed. In this process I spent some time learning to use Linux terminal based text editors like vi. It helped me become familiar with editing, creating new files and shortcuts in vi.
Once, this was done, I updated the package version in the changelog file to document the changes that I have made.
```
$ dpkg -l | grep cardbook
ii cardbook 1.1.0 amd64 Thunderbird add-on for address book
```
![Changelog][13]
Changelog file after updating Package
After rebuilding it, dependencies and detailed description can be added if necessary. The Debian control file can be edited to add the additional package requirements and dependencies.
### Local Debian Repository
Without creating a local repository, CardBook could be installed with:
```
$ sudo dpkg -i cardbook_1.1.0.deb
```
To actually test the installation for the package, I decided to build a local Debian repository. Without it, the `apt-get` command would not locate the package, as it is not in uploaded in Debian packages on net.
For configuring a local Debian repository, I copied my packages (.deb) to `Packages.gz` file placed in a `/tmp` location.
![Packages-gz][14]
Local Debian Repo
To make it work, I learned about the apt configuration and where it looks for files.
I researched for a way to add my file location in apt-config. Finally I could accomplish the task by adding `*.list` file with packages path in APT and updating apt-cache afterwards.
Hence, the latest CardBook version could be successfully installed by `apt-get install cardbook`
![Package installation!][15]
CardBook Installation through apt-get
### Fixing Packaging errors and bugs
My mentor, Daniel helped me a lot during this process and guided me how to proceed further with the package. He told me to use [Lintian][16] for fixing common packaging error and then using [dput][17] to finally upload the CardBook package.
> Lintian is a Debian package checker which finds policy violations and bugs. It is one of the most widely used tool by Debian Maintainers to automate checks for Debian policies before uploading the package.
I have uploaded the second updated version of the package in a separate branch of the repository on Salsa [here][18] inside Debian directory.
I installed Lintian from backports and learned to use it on a package to fix errors. I researched on the abbreviations used in its errors and how to show detailed response from lintian commands
```
$ lintian -i -I --show-overrides cardbook_1.2.0.changes
```
Initially on running the command on the `.changes` file, I was surprised to see that a large number of errors, warnings and notes were displayed!
![Package Error Brief!][19]
Brief errors after running Lintian on Package
![Lintian error1!][20]
Detailed Lintian errors
Detailed Lintian errostyle=”width:200px;”rs
I spend some days to fix some errors related to Debian package policy violations. I had to dig into every policy and Debian rules carefully to eradicate a simple error. For this I referred various sections on [Debian Policy Manual][21] and [Debian Developers Reference][22].
I am still working on making it flawless and hope to upload it on mentors.debian.net soon!
It would be grateful if people from the Debian community who use Thunderbird could help fix these errors.
--------------------------------------------------------------------------------
via: http://minkush.me/cardbook-debian-package/
作者:[Minkush Jain][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]:http://minkush.me/cardbook-debian-package/#
[1]:https://addons.mozilla.org/en-US/thunderbird/addon/lightning/
[2]:https://addons.mozilla.org/nn-NO/thunderbird/addon/cardbook/?src=hp-dl-featured
[3]:https://danielpocock.com/
[4]:https://mentors.debian.net/
[5]:https://wiki.debian.org/DFSGLicenses
[6]:https://wiki.debian.org/Packaging/Intro
[7]:https://wiki.debian.org/BuildingAPackage
[8]:https://packages.debian.org/stretch/amd64/lightning/filelist
[9]:https://salsa.debian.org/minkush-guest/CardBook/tree/debian-package/Debian
[10]:/img/posts/13.png
[11]:https://packages.debian.org/stretch/dpkg
[12]:https://gitlab.com/CardBook/CardBook
[13]:/img/posts/15.png
[14]:/img/posts/14.png
[15]:/img/posts/11.png
[16]:https://packages.debian.org/stretch/lintian
[17]:https://packages.debian.org/stretch/dput
[18]:https://salsa.debian.org/minkush-guest/CardBook/tree/debian-package
[19]:/img/posts/16.png (Running Lintian on package)
[20]:/img/posts/10.png
[21]:https://www.debian.org/doc/debian-policy/
[22]:https://www.debian.org/doc/manuals/developers-reference/

View File

@ -0,0 +1,119 @@
simple and elegant free podcast player
======
![](https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2018/07/CPod-Subscriptions.jpg?resize=750%2C393&ssl=1)
CPod (formerly known as Cumulonimbus) is a cross-platform, open source podcast player for the desktop. The application is built with web technologies its written in the JavaScript programming language and uses the Electron framework. Electron is often (rightly?) criticized for being a memory hog and dog slow. But is that mainly because of poor programming, rather than an inherent flaw in the technology?
CPod is available for Linux, Mac OS, and Windows. Installation was a breeze on my Ubuntu 18.04 distribution as the author conveniently provides a 64-bit deb package. If you dont run a Debian/Ubuntu based distro, theres an AppImage which effortlessly installs the software on all major Linux distributions. Theres also a snap package from the snapcraft website, but bizarrely (and incorrectly) flags the software as proprietary software. As CPod is released under an open source license, theres the full source code available too.
The deb package installs the software to /opt/CPod, although the binary is still called cumulonimbus. A bit of tidying up needed there. For Mac OS users, theres an Apple Disk Image file.
### Home
![CPod Playlist][2]
First off, you cannot fail to notice the gorgeous attractive interface. Presentation is first class.
First off, you cannot fail to notice the gorgeous attractive interface. Presentation is first class.
The home section shows your subscribed podcasts. There are helpful filters at the top. They let you select podcasts of specified duration (handy if time is limited), you can filter by date, filter for podcasts that youve downloaded an offline copy, as well as podcasts that have not been listened to, youve started listening to, and podcasts youve heard to the end.
Below the filters, theres the option to select multiple podcasts, download local copies, add podcasts to your queue, as well as actually playing a podcast. The interface is remarkably intuitive.
One quirk is that offline episodes are downloaded to the directory ~/.config/cumulonimbus/offline_episodes/. The downloaded podcasts are therefore not visible in the Files file manager by default (this is because the standard installation of Files does not display hidden files). Its easy to enable hidden files in the file manager. Good news, the developer plans to add a configurable default download directory.
Theres lots of nice touches which enhance the user experience, such as the progress bars when downloading episodes.
### Playing a podcast
![CPod][3]
Heres one of my favourite podcasts, Ubuntu Podcast, in playback. Theres visualization effects enabled; they only show when the window has focus. The visualizations dont always display properly. Theres also the option of changing the playback speed (0.5x 4x speed). Im not sure why Id want to change the playback speed though. Maybe someone could enlighten me?
More functional is the slider that lets you skip to a specific point of the podcast although this is a tad buggy. The software is in an early stage of development. In any case, I prefer using the keyboard shortcuts to move forwards and backwards, and they work fine. Some podcasts offer links that let you skip to a particular segment; they are displayed in the large pane.
Theres also the ability to watch video podcasts in both fullscreen and window mode. I spend most of my time listening to audio podcasts, but having full screen video podcasts is a pretty cool feature. Video playback is powered by ffmpeg.
### Queue
![CPod Queue][4]
Theres not much to say about the queue functionality, but its worth noting you can change the order of episodes simply by dragging and dropping them in the interface. Its well implemented and really simple to use. Another tick for CPod.
### Subscriptions
Theres not much to say about the queue functionality, but its worth noting you can change the order of episodes simply by dragging and dropping them in the interface. Its well implemented and really simple to use. Another tick for CPod.
![CPod Subscriptions][5]
The interface makes it really easy to subscribe and unsubscribe to podcasts. Clicking the image of a subscribed podcast lets you find an episode, as well as a list of recent episodes, again with the ability to play, queue, and download. Its all very clean and easy to use.
### Explore
In explore you can search for podcasts. Just type some keywords into the Explore dialog box, and youre presented with a list of podcasts you can listen and subscribe.
If youre a fan of YouTube, youre in luck. Theres the ability to preview and subscribe to YouTube channels by pasting a channels URL into the Explore box. Thats great if you have YouTube channel hyperlinks handy, but some sort of YouTube channel finder would be a great addition.
Heres a YouTube video in action.
![CPod YTube][6]
### Settings
![CPod Settings][7]
Theres a lot you can configure in Settings. Theres functionality to:
* Internationalization support the ability to select the language displayed. Currently, theres fairly limited support in this respect. Besides English, theres Chinese, French, German, Korean, Portuguese, Portuguese (Brazilian), and Spanish available. Contributing translations is probably the easiest way for non-programmers to contribute to an open source project.
* Option to group episodes in Home by day or month.
* Keyboard shortcuts that let you skip backward, skip forward, and play/pause playback. I love my keyboard shortcuts.
* Configure different lengths of forward/backward skip.
* Enable waveform visualization you can see examples of the visualization in our images (Playlist and Subscription sections).
* Basic gpodder.net integration (currently only subscriptions and device sync are supported; other functionality such as episodes actions and queue are planned).
* Allow pre-releases when auto-updating.
* Export subscriptions to OPML Outline Processor Markup Language is an XML format commonly used to exchange lists of web feeds between web feed aggregators.
* Import subscriptions from OPML.
* Update podcast cover art.
* View offline episodes directory.
The software has a bag of neat touches. For example, if I change the language setting, the software presents a pop up saying CPod needs to be restarted for the change to take effect. All very user-friendly.
The Media Player Remote Interfacing Specification (MPRIS) is a standard D-Bus interface which aims to provide a common programmatic API for controlling media players. CPod offers basic MPRIS integration.
### Summary
CPod is another good example of whats possible with modern web technologies. Sure, its got a few quirks, its in an early stage of development (read expect to find lots of bugs), and theres some useful functionality waiting to be implemented. But Im using the software on a daily basis, and will definitely keep up-to-date with developments.
Linux already has some high quality open source podcast players. But CPod is definitely worth a download if youre passionate about podcasts.
**Website:** [**github.com/z————-/CPod**][8]
**Support:**
**Developer:** Zack Guard
**License:** Apache License 2.0
Zack Guard, CPods developer, is a student who lives in Hong Kong. You can buy him a coffee at **<https://www.buymeacoffee.com/zackguard>**. Unfortunately, Im an impoverished student too.
### Related
--------------------------------------------------------------------------------
via: https://www.linuxlinks.com/cpod-simple-elegant-free-podcast-player/
作者:[Luke Baker][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://www.linuxlinks.com/author/luke-baker/
[1]:https://www.linuxlinks.com/wp-content/plugins/jetpack/modules/lazy-images/images/1x1.trans.gif
[2]:https://i2.wp.com/www.linuxlinks.com/wp-content/uploads/2018/07/CPod-Playlist.jpg?resize=750%2C368&ssl=1
[3]:https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2018/07/CPod-Main.jpg?resize=750%2C368&ssl=1
[4]:https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2018/07/CPod-Queue.jpg?resize=750%2C368&ssl=1
[5]:https://i0.wp.com/www.linuxlinks.com/wp-content/uploads/2018/07/CPod-Subscriptions.jpg?resize=750%2C368&ssl=1
[6]:https://i1.wp.com/www.linuxlinks.com/wp-content/uploads/2018/07/CPod-YouTube.jpg?resize=750%2C368&ssl=1
[7]:https://i1.wp.com/www.linuxlinks.com/wp-content/uploads/2018/07/CPod-Settings.jpg?resize=750%2C368&ssl=1
[8]:https://github.com/z-------------/CPod

View File

@ -0,0 +1,58 @@
怎样实现由专有环境向开源环境的职业转变
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open%20source_collaboration_0.png?itok=YEl_GXbv)
作为一名软件工程师,我的职业生涯是从 Northern Telecom 开始的,在这里我开发出了电信级的通讯转换设备可以使用的专有软件等。 即使我已经在大学中学习了 Pascal 语言,公司还是给我进行了以 C 语言为基础是专有编程语言培养。在公司中我使用的也是专有操作系统和专有版本控制软件。
我很享受专有环境下的工作,并有幸接触了很多有趣的项目,这样过了很多年,直到一场招聘会,我遇到了事业转折点。那时我受邀在当地一所中学的 STEM 行业座谈会进行演讲,给学生们讲述了作为一名软件工程师的主要工作内容和责任,一名学生问我:“这些事是你一直梦想要做的吗?你热爱你现在的工作吗?”
每次领导问我这个问题时,保险起见,我都会回答他,“我当然热爱工作了!”但从来没有一名还在读六年级的单纯的 STEM 小爱好者问过我这个问题。我的回答还是一样,“我当然喜欢!”
我确实很热爱我当时的事业,但那名学生的话让我忍不住思考,我开始重新审视我的事业,重新审视专有环境。在我的领域里我如鱼得水,但这也有局限性:我只能用代码来定义我的领域。我忍不住反思,这些年我有没有试着去学一些其他可应用于专有环境的技术?在同行中我的技能组还算得上先进吗?我有没有混日子?我真的想继续为这项事业奋斗吗?
我想了很多,忍不住问自己:当年的激情和创意还在吗?
时间不会停止,但我的生活发生了改变。我离开了 Nortel Networks ,打算休息一段时间来陪陪我的家人。
在我准备返回工作岗位时,那个小朋友的话又在我的脑海中响起,这真的是我想要的工作吗?我投了很多份简历,有一个岗位是我最中意的,但那家公司的回复是,他们想要的是拥有五年及以上 Java and Python 工作经验的人。在过去十五年里我以之为生的知识和技术看起来已经过时了。
### 机遇与挑战
我的第一项挑战是学会在新的环境下应用我先前在封闭环境学到的技能。IT 行业由专有环境转向开源后发生了天翻地覆的变化。我打算先自学眼下最需要的 Python 。接触 Python 后我意识到,我需要一个项目来证明自己的能力,让自己更具有竞争力。
我的第二个挑战是怎么获得 Python 相关的项目经验。我丈夫和之前的同事都向我推荐了开源软件通过谷歌搜索我发现网上有许许多多的开源项目它们分别来源于一个人的小团队50 人左右的团队,还有跨国的百人大团队。
在 Github 上我用相关专业术语搜索出了许多适合我的项目。综合我的兴趣和网络相关的工作经验,我打算把第一个项目贡献给 OpenStack 。 我还注意到了 [Outreachy][1] 项目,它为不具备相关技术基础的人员提供三个月的实习期。
### 经验与教训
我学到的第一件事是我发现可以通过许多方式进行贡献。不论是文件编制、用户设计还是测试用例都是贡献的形式。我在探索中丰富了我的技能组根本用不着5年的时间只需要在开源平台上接受委托之后做出成果。
在我为 OpenStack 做出的第一个贡献被合并、发表后,我正式成为了 Outreachy 项目的一员。 Outreachy 项目最好的一点是,项目分配给我的导师能够引领我在开源世界中找到方向。
下面还有三个宝贵的提示:
**持之以恒** 你需要找到最适合你核心技能组的项目,当然,最好有行为准则和新人入门指南,这样的项目比较适合初学者加入。找到了合适的项目你可以持之以恒地在社区中进行贡献。
**不厌其烦** 适应开源环境需要一段时间。融入开源社区需要时间。进行深思熟虑的反馈需要时间。阅读反馈并经行改进也需要时间。在这其中你需要耐心等待。
**参与其中** 在开源社区,从事什么领域或技术的工作不需要特殊批准,你可以自己选择工作的领域,并深入其中。
7 月 16-19 日,俄勒冈州波特兰,第 20 届 [开源大会][3] 上Petra Sargent 将为您展示:[老狗也能学会新把戏——封闭环境工作者如何适应开源环境][2]。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/7/career-move
作者:[Petra Sargent][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[Valoniakim](https://github.com/Valoniakim)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/psargent
[1]:https://www.outreachy.org/
[2]:https://conferences.oreilly.com/oscon/oscon-or/public/schedule/speaker/307631
[3]:https://conferences.oreilly.com/oscon/oscon-or

View File

@ -0,0 +1,146 @@
对Ubuntu标准用户的一个高级系统配置程序
======
![](https://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-4-1-720x340.png)
**Ubunsys** 是一个基于Qt 的高级系统程序,可以在Ubuntu和其他Ubuntu系列衍生系统上使用.大多数情况下,高级用户可以使用命令行轻松完成大多数配置.
不过为了以防万一某天,你突然不想用命令行了,就可以用 Ubnusys 这个程序来配置你的系统或其衍生系统,如Linux Mint,Elementary OS 等. Ubunsys 可用来修改系统配置,安装,删除,更新包和旧内核,启用或禁用sudo 权限,安装主线内核,更新软件安装源,清理垃圾文件,将你的Ubuntu 系统升级到最新版本等等
以上提到的所有功能都可以通过鼠标点击完成.你不需要再依赖于命令行模式,下面是你能用Ubunsys 做到的事:
* 安装,删除,更新包
* 更新和升级软件源
* 安装主线内核
* 删除旧的和不再使用的内核
* 系统整体更新
* 将系统升级到下一个可用的版本
* 将系统升级到最新的开发版本
* 清理系统垃圾文件
* 在不输入密码的情况下启用或者禁用sudo 权限
* 当你在terminal输入密码时使Sudo 密码可见
* 启用或禁用系统冬眠
* 启用或禁用防火墙
* 打开,备份和导入 sources.list.d 和sudoers 文件.
* 显示或者隐藏启动项
* 启用或禁用登录音效
* 配置双启动
* 启用或禁用锁屏
* 智能系统更新
* 使用脚本管理器更新/一次性执行脚本
* 从git执行常规用户安装脚本
* 检查系统完整性和缺失的GPG keys.
* 修复网络
* 修复已破损的包
* 还有更多功能在开发中
**重要提示:** Ubunsys 不适用于Ubuntu 新手.它很危险并且没有一个稳定的版本.它可能会使你的系统崩溃.如果你刚接触Ubuntu不久,不要使用.但如果你真的很好奇这个应用能做什么,仔细浏览每一个选项,并确定自己能承担风险.在使用这一应用之前记着备份你自己的重要数据
### Ubunsys - 对Ubuntu标准用户的一个高级系统配置程序
#### 安装 Ubunsys
Ubunusys 开发者制作了一个ppa 来简化安装过程,Ubunusys现在可以在Ubuntu 16.04 LTS, Ubuntu 17.04 64 位版本上使用.
逐条执行下面的命令,将Ubunsys的PPA 添加进去,并安装它
```
sudo add-apt-repository ppa:adgellida/ubunsys
sudo apt-get update
sudo apt-get install ubunsys
```
如果ppa 无法使用,你可以在[**发布页面**][1]根据你自己当前系统,选择正确的安装包,直接下载并安装Ubunsys
#### 用途
一旦安装完成,从菜单栏启动Ubunsys.下图是Ubunsys 主界面
![][3]
你可以看到,Ubunusys 有四个主要部分,分别是 **Packages** , **Tweaks** , **System** ,和**Repair**. 在每一个标签项下面都有一个或多个子标签项以对应不同的操作
**Packages**
这一部分允许你安装,删除和更新包
![][4]
**Tweaks**
在这一部分,我们可以对系统进行多种调整,例如,
* 打开,备份和导入 sources.list.d 和sudoers 文件;
* 配置双启动;
* 启用或禁用登录音效,防火墙,锁屏,系统冬眠,sudo 权限在不需要密码的情况下同时你还可以针对某一用户启用或禁用sudo 权限(在不需要密码的情况下)
* 在terminal 中输入密码时可见禁用Asterisk.
![][5]
**System**
这一部分被进一步分成3个部分,每个都是针对某一特定用户.
**Normal user** 这一标签下的选项可以,
* 更新,升级包和软件源
* 清理系统
* 执行常规用户安装脚本
**Advanced user** 这一标签下的选项可以,
* 清理旧的/无用的内核
* 安装主线内核
* 智能包更新
* 升级系统
**Developer** 这一部分可以将系统升级到最新的开发版本
![][6]
**Repair**
这是Ubunsys 的第四个也是最后一个部分.正如名字所示,这一部分能让我们修复我们的系统,网络,缺失的GPG keys,和已经缺失的包
![][7]
正如你所见,Ubunsys可以在几次点击下就能完成诸如系统配置,系统维护和软件维护之类的任务.你不需要一直依赖于Terminal. Ubunsys 能帮你完成任何高级任务.再次声明,我警告你,这个应用不适合新手,而且它并不稳定.所以当你使用的时候,可能会出现bug或者系统崩溃.在仔细研究过每一个选项的影响之后再使用它.
谢谢阅读!
**参考资源:**
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/ubunsys-advanced-system-configuration-utility-ubuntu-power-users/
作者:[SK][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://www.ostechnix.com/author/sk/
[1]:https://github.com/adgellida/ubunsys/releases
[2]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-1.png
[4]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-2.png
[5]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-5.png
[6]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-9.png
[7]:http://www.ostechnix.com/wp-content/uploads/2017/08/Ubunsys-11.png

View File

@ -1,37 +1,34 @@
Translating by MjSeven
How To Find The Installed Proprietary Packages In Arch Linux
如何在 Arch Linux 中查找已安装的专有软件包?
======
![](https://www.ostechnix.com/wp-content/uploads/2018/01/Absolutely-Proprietary-720x340.jpg)
Are you an avid free software supporter and currently using any Arch based distribution? I've got a small tip for you! Now, you can easily find the installed proprietary packages in Arch Linux and its variants such as Antergos, Manjaro Linux etc. You don't need to refer the license details of the installed package in its website or use any external tool to find out whether the package is free or proprietary.
你是狂热的自由软件支持者吗?你目前在使用任何基于 Arch 的 Linux 发行版吗?我有一个小小的提示送给你!现在,你可以轻松地在 Arch Linux 及其变体(如 Antergos, Manjaro Linux 等)中找到已安装的专有软件包。你无需在已安装软件包的网站中参考其许可细节,也无需使用任何外部工具来查明软件包是自由的还是专有的。(译注:其实下面还是借助了一个外部程序)
### Find The Installed Proprietary Packages In Arch Linux
### 在 Arch Linux 中查找已安装的专有软件包
A fellow developer has developed an utility named **" Absolutely Proprietary"**, a proprietary package detector for arch-based distributions. It compares all installed packages in your Arch based system against Parabola's package [blacklist][1] and [aur-blacklist][2] and then prints your **Stallman Freedom Index** (free/total). Additionally, you can save the list to a file and share or compare it with other systems/users.
一位开发人员开发了一个名为 **"Absolutely Proprietary"** 的实用程序,它是一种用于基于 Arch 发行版的专有软件包检测器。它将基于 Arch 系统中的所有安装包与 Parabola 的 [blacklist黑名单][1]软件包和 [aur-blacklist][2] 进行比较,然后打印你的 **Stallman Freedom Index Stallman 自由指数)** (free/total自由/总计))。此外,你可以将列表保存到文件中,并与其他系统/用户共享或比较。
Before installing it, Make sure you have installed **python** and **git**.
在安装之前,确保你安装了 **python****git**
Then, git clone the repository:
然后git clone 仓库:
```
git clone https://github.com/vmavromatis/absolutely-proprietary.git
```
This command will download all contents in a directory called 'absolutely-proprietary' in your current working directory.
这条命令将会下载所有内容到你当前工作目录中的 'absolutely-proprietary' 目录。
Change to that directory:
进入此目录:
```
cd absolutely-proprietary
```
And, find the installed proprietary packages using command:
接着,使用以下命令查找已安装的专有软件:
```
python main.py
```
This command will download the blacklist.txt, aur-blacklist.txt and compare the locally installed packages with the remote packages and displays the
这条命令将会下载 blacklist.txt, aur-blacklist.txt并将本地已安装的软件包与远程软件包进行比较并显示to 校正者:原文这里似乎没写完)不同。
Here is the sample output from my Arch Linux desktop:
以下是在我的 Arch Linux 桌面的示例输出:
```
Retrieving local packages (including AUR)...
Downloading https://git.parabola.nu/blacklist.git/plain/blacklist.txt
@ -78,7 +75,7 @@ Save list to file? (Y/n)
[![][3]][4]
As you can see, I have 47 proprietary packages in my system. Like I said already, we can save it to a file and review them later. To do so, jut press 'y' when you are prompted to save the list in a file. Then press 'y' to accept the defaults or hit 'n' to save it in your preferred format and location.
如你所见,我的系统中有 47 个专有软件包。就像我说的那样,我们可以将它保存到文件中稍后查看。为此,当提示你将列表保存在文件时,请按 y。然后按 y 接受默认值或点击 n以你喜欢的格式和位置来保存它。
```
Save list to file? (Y/n) y
Save as markdown table? (Y/n) y
@ -90,20 +87,17 @@ using the "less -S /home/sk/absolutely-proprietary/y.md"
or, if installed, the "most /home/sk/absolutely-proprietary/y.md" commands
```
As you may noticed, I have only the **nonfree** packages. It will display two more type of packages such as semifree, uses-nonfree.
你可能已经注意到,我只有 **nonfree** 包。它还会显示另外两种类型的软件包,例如 semifree, uses-nonfree。
* **nonfree** : This package is blatantly nonfree software.
* **semifree** : This package is mostly free, but contains some nonfree software.
* **uses-nonfree** : This package depends on, recommends, or otherwise inappropriately integrates with other nonfree software or services.
* **nonfree**:这个软件包是公然的非自由软件。
* **semifree**:这个软件包大部分是免费的,但包含一些非自由软件。
* **uses-nonfree**:这个软件包依赖,推荐或不恰当地与其他自由软件或服务集成。
该使用程序的另一个显著特点是它不仅显示了专有软件包,而且还显示这些包的替代品。
希望这有些帮助。我很快就会在这里提供另一份有用的指南。敬请关注!
Another notable feature of this utility is it's not just displays the propriety packages, but also alternatives to such packages.
Hope this helps. I will be soon here with another useful guide soon. Stay tuned!
Cheers!
干杯!
--------------------------------------------------------------------------------
@ -111,7 +105,7 @@ Cheers!
via: https://www.ostechnix.com/find-installed-proprietary-packages-arch-linux/
作者:[SK][a]
译者:[译者ID](https://github.com/译者ID)
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,82 @@
迁移到 Linux使用 Sudo
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ray-hennessy-233438-unsplash.jpg?itok=d4l7QUtF)
本文是我们关于迁移到 Linux 的系列文章的第五篇。如果你错过了之前的那些,你可以在这里赶上:
[第1部分 - 介绍][1]
[第2部分 - 磁盘,文件和文件系统][2]
[第3部分 - 图形环境][3]
[第4部分 - 命令行][4]
你可能一直想了解 Linux。也许它在你的工作场所使用如果你每天使用它你的工作效率会更高。或者也许你想在家里的某些计算机上安装 Linux。无论是什么原因这一系列文章都是为了让过渡更容易。
与许多其他操作系统一样Linux 支持多用户。它甚至支持多个用户同时登录。
用户帐户通常会被分配一个可以存储文件的家目录。通常这个家目​​录位于:
```
/home/<login name>
```
这样,每个用户都有存储自己的文档和其他文件的独立位置。
### 管理任务
在传统的 Linux 安装中,常规用户帐户无权在系统上执行管理任务。典型的 Linux 安装将要求用户以管理员身份登录以执行某些任务,而不是为每个用户分配权限以执行各种任务。
Linux 上的管理员帐户称为 root。
### Sudo 解释
从历史上看,要执行管理任务,必须以 root 身份登录,执行任务,然后登出。这个过程有点乏味,所以很多人以 root 登录并且整天都以管理员身份工作。这种做法可能会导致灾难性的后果例如意外删除系统中的所有文件。当然root 用户可以做任何事情,因此没有任何保护措施可以防止有人意外地执行影响很大的操作。
创建 sudo 工具是为了使你更容易以常规用户帐户登录,偶尔以 root 身份执行管理任务而无需登录、执行任务然后登出。具体来说sudo 允许你以不同的用户身份运行命令。如果你未指定特定用户,则假定你指的是 root 用户。
Sudo 可以有复杂的设置,允许用户使用有权限使用 sudo 运行某些命令,而其他的不行。通常,桌面安装会使创建的第一个帐户在 sudo 中有完全的权限,因此你作为主要用户可以完全管理 Linux 安装。
### 使用 Sudo
某些 Linux 安装设置了 sudo因此你仍需要知道 root 帐户的密码才能执行管理任务。其他人,设置 sudo 输入自己的密码。这里有不同的哲学。
当你尝试在图形环境中执行管理任务时,通常会打开一个要求输入密码的对话框。输入你自己的密码(例如,在 Ubuntu 上)或 root 帐户的密码例如Red Hat
当你尝试在命令行中执行管理任务时,它通常只会给你一个 “permission denied” 错误。然后你在前面用 sudo 重新运行命令。例如:
```
systemctl start vsftpd
Failed to start vsftpd.service: Access denied
sudo systemctl start vsftpd
[sudo] password for user1:
```
### 何时使用 Sudo
以 root 身份运行命令(在 sudo 或其他情况下)并不总是解决权限错误的最佳解决方案。虽然将以 root 身份运行将移除 “permission denied” 错误,但有时最好寻找根本原因而不是仅仅解决症状。有时文件拥有错误的所有者和权限。
当你在尝试一个需要 root 权限来执行操作的任务或者程序时使用 sudo。如果文件恰好由另一个用户包括 root 用户)拥有,请不要使用 sudo。在第二种情况下最好正确设置文件的权限。
通过 Linux 基金会和 edX 的免费[“Linux 介绍”][5]课程了解有关 Linux 的更多信息。
--------------------------------------------------------------------------------
via: https://www.linux.com/blog/learn/2018/3/migrating-linux-using-sudo
作者:[John Bonesio][a]
选题:[lujun9972](https://github.com/lujun9972)
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.linux.com/users/johnbonesio
[1]:https://www.linux.com/blog/learn/intro-to-linux/2017/10/migrating-linux-introduction
[2]:https://www.linux.com/blog/learn/intro-to-linux/2017/11/migrating-linux-disks-files-and-filesystems
[3]:https://www.linux.com/blog/learn/2017/12/migrating-linux-graphical-environments
[4]:https://www.linux.com/blog/learn/2018/1/migrating-linux-command-line
[5]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux

View File

@ -1,8 +1,9 @@
迁移到 Linux 之安装软件
=====
======
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/birds-1835510_1920.jpg?itok=8i6mBStG)
你看到的所有有关 Linux 的关注,以及它在互联网,以及 Arduino, Beagle 和 Raspberry Pi boards树莓派板等设备上的使用或许你正在考虑是时候尝试一下 Linux 了。本系列将帮助你成功过渡到 Linux。如果你错过了本系列的早期文章可以在这里找到它们
你看到的所有有关 Linux 的关注,以及它在互联网,以及 ArduinoBeagle 和 Raspberry Pi boards树莓派板等设备上的使用或许你正在考虑是时候尝试一下 Linux 了。本系列将帮助你成功过渡到 Linux。如果你错过了本系列的早期文章可以在这里找到它们
[Part 1 - 介绍][1]
@ -18,36 +19,41 @@
要在你的计算机上获得新软件,通常的方法是从供应商处获得软件产品,然后运行一个安装程序。过去,软件产品会像 CD-ROM 或 DVD 一样出现在物理媒介上。而现在我们经常从网上下载软件产品。
使用 Linux安装软件就像在你的智能手机上安装一样。就像去你的手机应用商店一样在 Linux 上有个开源软件工具和程序的中央仓库,几乎任何你可能想要的程序都会在你可安装的可用软件包列表中。
使用 Linux安装软件就像在你的智能手机上安装一样。就像去你的手机应用商店一样在 Linux 上有个开源软件工具和程序的<ruby>中央仓库<rt>central repository</rt></ruby>,几乎任何你可能想要的程序都会在你可安装的可用软件包列表中。
没有为每个程序运行的单独安装程序。相反,你可以使用 Linux 发行版附带的软件包管理工具。请记住Linux 发行版是你安装的 Linux例如 Ubuntu, Fedora, Debian 等)每个发行版在 Internet 上都有自己的集中位置(称为仓库),用于存储数千个预先安装的应用程序。
没有为每个程序运行的单独安装程序。相反,你可以使用 Linux 发行版附带的软件包管理工具。请记住Linux 发行版是你安装的 Linux例如 UbuntuFedoraDebian 等)每个发行版在 Internet 上都有自己的集中位置(称为仓库),用于存储数千个预先安装的应用程序。
你可能会注意到,在 Linux 上安装软件有几个例外。有时候,你仍然需要去供应商处获取他们的软件,因为该程序不存在于你发行版的中央仓库中。当软件不是开源和/或免费(自由)的时候,通常就是这种情况。
另外请记住,如果你最终想要安装一个不在发行版仓库中的程序,事情就不是那么简单了,即使你正在安装免费(自由)和开源程序。这篇文章没有涉及到这些更复杂的情况,最好遵循在线引
另外请记住,如果你最终想要安装一个不在发行版仓库中的程序,事情就不是那么简单了,即使你正在安装免费(自由)和开源程序。这篇文章没有涉及到这些更复杂的情况,最好遵循在线引。
有了所有的 Linux 包管理系统和工具,接下来干什么可能仍然令人困惑。本文应该有助于澄清一些事情。
### 包管理
一些用于管理、安装和删除软件的包管理系统在 Linux 发行版中竞争。那个发行版背后的人都选择一个包管理系统来使用。Red Hat, Fedora, CentOS, Scientific Linux, SUSE 等使用 Red Hat 包管理RPM。Debian, Ubuntu, Linux Mint 等等都使用 Debian 包管理系统,简称 DPKG。其他包管理系统也存在但 RPM 和 DPKG 是最常见的。
一些用于管理、安装和删除软件的包管理系统在 Linux 发行版中竞争。那个发行版背后的人都选择一个<ruby>包管理工具<rt>package management tools<rt></ruby>来使用。Red HatFedoraCentOSScientific LinuxSUSE 等使用 Red Hat 包管理RPM。DebianUbuntuLinux Mint 等等都使用 Debian 包管理系统,简称 DPKG。其他包管理系统也存在但 RPM 和 DPKG 是最常见的。
![](https://www.linux.com/sites/lcom/files/styles/floated_images/public/package-installer.png?itok=V9OU1Q0u)
图 1: Package installers
无论你使用的软件包管理是什么,它们通常都附带一组工具,它们是分层的(图 1。最底层是一个命令行工具它可以让你做任何事情以及与安装软件相关的一切。你可以列出已安装的程序删除程序安装软件包文件等等。
无论你使用的软件包管理是什么,它们通常都附带一组工具,它们是分层的(图 1。最底层是一个命令行工具它可以让你做任何与安装软件相关的一切。你可以列出已安装的程序删除程序安装软件包文件等等。
这个底层工具并不总是最方便使用的,所以通常会有一个命令行工具,它可以在发行版的中央仓库中找到软件包,并使用单个命令下载和安装它以及任何依赖项。最后,通常会有一个<ruby>图形应用程序<rt>graphical application<rt></ruby>,让你使用鼠标选择任何想要的内容,然后单击 “install” 按钮。
这个底层工具并不总是最方便使用的,所以通常会有一个命令行工具,它可以在发行版的中央仓库中找到软件包,并使用单个命令下载和安装它以及任何依赖项。最后,通常会有一个图形应用程序,让你使用鼠标选择任何想要的内容,然后单击 “install” 按钮。
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/package-kit.png?itok=YimOq2Je)
图 2: PackageKit
对于基于 Red Hat 的发行版,包括 Fedora, CentOS, Scientific Linux 等。它们的底层工具是 rpm高级工具叫做 dnf在旧系统上是 yum。图形安装程序称为 PackageKit图 2它可能在系统管理下显示为 “Add/Remove Software添加/删除软件)”。
对于基于 Red Hat 的发行版,包括 FedoraCentOSScientific Linux 等。它们的底层工具是 rpm高级工具叫做 dnf在旧系统上是 yum。图形安装程序称为 PackageKit图 2它可能在系统管理下显示为 “Add/Remove Software添加/删除软件)”。
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/ubuntu-software.png?itok=5QSctLEW)
图 3: Ubuntu Software
对于基于 Debian 的发行版,包括 Debian, Ubuntu, Linux Mint, Elementary OS 等。它们的底层命令行工具是 dpkg高级工具称为 apt。在 Ubuntu 上管理已安装软件的图形工具是 Ubuntu Software图 3。对于 Debian 和 Linux Mint图形工具称为 Synaptic,它也可以安装在 Ubuntu 上。
对于基于 Debian 的发行版,包括 DebianUbuntuLinux MintElementary OS 等。它们的底层命令行工具是 dpkg高级工具称为 apt。在 Ubuntu 上管理已安装软件的图形工具是 Ubuntu Software图 3。对于 Debian 和 Linux Mint图形工具称为<ruby>新立得<rt>Synaptic</rt></ruby>,它也可以安装在 Ubuntu 上。
你也可以在 Debian 相关发行版上安装基于文本的图形工具 aptitude。它比 Synaptic新立得更强大并且即使你只能访问命令行也能工作。如果你想获得所有花里胡哨的东西to 校正者:这句话仔细考虑一下)你可以试试那个,尽管有更多的选择,但使用起来比 Synaptic(新立得)更复杂。其他发行版可能有自己独特的工具。
你也可以在 Debian 相关发行版上安装基于文本的图形工具 aptitude。它比 Synaptic新立得更强大并且即使你只能访问命令行也能工作。如果你想获得所有花里胡哨的东西你可以试试那个尽管有更多的选择但使用起来比 Synaptic 更复杂。其他发行版可能有自己独特的工具。
### 命令行工具
@ -65,14 +71,13 @@
通过 Linux 基金会和 edX 的免费 [“Linux 入门”][6]课程了解有关 Linux 的更多信息。
--------------------------------------------------------------------------------
---
via: https://www.linux.com/blog/learn/2018/3/migrating-linux-installing-software
作者:[JOHN BONESIO][a]
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
校对:[pityonline](https://github.com/pityonline)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出