Merge pull request #10 from LCTT/master

update
This commit is contained in:
wyxplus 2021-04-29 16:27:38 +08:00 committed by GitHub
commit 52fe640d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
153 changed files with 18902 additions and 3996 deletions

View File

@ -0,0 +1,69 @@
[#]: collector: (lujun9972)
[#]: translator: (Kevin3599)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13321-1.html)
[#]: subject: (Open Source Supply Chain: A Matter of Trust)
[#]: via: (https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/)
[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/)
开源供应链:一个有关信任的问题
======
[![][1]][2]
共同作者Curtis Franklin, Jr
开源软件通常被认为比专有软件更安全、更有保障,因为如果用户愿意,他们可以从源代码编译软件。他们知道在他们环境中运行的代码的来源。在他们的环境中运行的代码每个部分都可以被审查,也可以追溯每段代码的开发者。
然而,用户和提供者们正在逐渐远离完全控制软件所带来的复杂性,而在转而追求软件的便捷和易用。
VMware 副总裁兼首席开源官 Dirk Hohndel 说:“当我看到在一个有关网络安全和隐私的讲座中,演讲者运行 `docker run` 命令来安装和运行一些从互联网上下载的随机二进制文件时,我经常会大吃一惊。这两件事似乎有点相左。”
软件供应链,即将应用程序从编码、打包、分发到最终用户的过程是相当复杂的。如果其中有一环出现错误,可能会导致软件存在潜在的风险,特别是对于开源软件。一个恶意行为者可以访问后端,并在用户不知情或不受控的情况下向其插入任何可能的恶意代码。
这样的问题不单单存在于云原生领域,在现代应用开发中很常见,这包括 JavaScript、NPM、PyPI、RubyGems 等等。甚至连 Mac 上的 Homebrew 过去也是通过源代码提供,由用户自己编译。
“如今你只需要下载二进制文件并安装它并期望其源代码并没有被恶意修改过。”Hohndel 说,“作为一个行业,我们需要更加关注我们的开源代码供应。这对我来说是非常重要的事,我正努力让更多的人意识到其重要性。”
然而,这不仅仅是一个二进制与源代码的关系。只运行一个二进制文件,而不必从源代码构建所有东西有着巨大的优势。当软件开发需求发生转变时候,这种运行方式允许开发人员在过程中更加灵活和响应更快。通过重用一些二进制文件,他们可以在新的开发和部署中快速地循环。
Hohndel 说:“如果有办法向这些软件添加签名,并建立一个‘即时’验证机制,让用户知道他们可以信任此软件,那就更好了。”
Linux 发行版解决了这个问题,因为发行版充当了看门人的角色,负责检查进入受支持的软件存储库的软件包的完整性。
“像通过 Debian 等发行版提供的软件包都使用了密钥签名。要确保它确实是发行版中应包含的软件需要进行大量工作。开发者们通过这种方式解决了开源供应链问题。”Hohndel 说。
但是,即使在 Linux 发行版上,人们也希望简化事情,并以正确性和安全性换取速度。现在,诸如 AppImage、Snap 和 Flatpack 之类的项目已经采用了二进制方式,从而将开源供应链信任问题带入了 Linux 发行版。这和 Docker 容器的问题如出一辙。
“理想的解决方案是为开源社区找到一种设计信任系统的方法,该系统可以确保如果二进制文件是用受信任网络中的密钥签名的,那么它就可以被信任,并允许我们可靠地返回源头并进行审核,” Hohndel 建议。
但是所有这些额外的步骤都会产生成本大多数项目开发者要么不愿意或无力承担。一些项目正在尝试寻找解决该问题的方法。例如NPM 已开始鼓励提交软件包的用户正确认证和保护其账户安全,以提高平台的可信度。
### 开源社区善于解决问题
Hohndel 致力于解决开源供应链问题并正试图让更多开发者意识到其重要性。去年VMware 收购了 Bitnami这为管理由 VMware 所签名的开源软件提供了一个良机。
“我们正在与各种上游开源社区进行交流,以提高对此的认识。我们还在讨论技术解决方案,这些方案将使这些社区更容易解决潜在的开源供应链问题。” Hohndel 说。
开源社区历来致力于确保软件质量这其中也包括安全性和隐私性。不过Hohndel 说:“我最担心的是,在对下一个新事物感到兴奋时,我们经常忽略了需要的基础工程原则。”
最终Hohndel 认为答案将来自开源社区本身。 “开源是一种工程方法论,是一种社会实验。开源就是人们之间相互信任、相互合作、跨国界和公司之间以及竞争对手之间的合作,以我们以前从未有过的方式。”他解释说。
--------------------------------------------------------------------------------
via: https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/
作者:[Swapnil Bhartiya][a]
选题:[lujun9972][b]
译者:[Kevin3599](https://github.com/kevin3599)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/author/swapnil/
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920-1068x801.jpg (hand-1137978_1920)
[2]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920.jpg
[3]: https://www.swapnilbhartiya.com/open-source-leaders-dirk-hohndel-brings-open-source-to-vmware/
[4]: https://techcrunch.com/2019/05/15/vmware-acquires-bitnami-to-deliver-packaged-applications-anywhere/

View File

@ -1,23 +1,23 @@
[#]: collector: (lujun9972)
[#]: translator: (wyxplus)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13271-1.html)
[#]: subject: (4 open source chat applications you should use right now)
[#]: via: (https://opensource.com/article/20/4/open-source-chat)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
现如今你应当使用的四款开源聊天应用软件
值得现在就去尝试的四款开源聊天应用软件
======
现在,远程协作已作为一项必不可少的能力,让开源实时聊天成为你工具箱中必不可少的一部分吧。
![Chat bubbles][1]
> 现在,远程协作已作为一项必不可少的能力,让开源实时聊天成为你工具箱中必不可少的一部分吧。
![](https://img.linux.net.cn/data/attachment/album/202104/06/103454xundd858446u08r0.jpg)
清晨起床后,我们通常要做的第一件事是检查手机,看看是否有同事和朋友发来的重要信息。无论这是否是一个好习惯,但这种行为早已成为我们日常生活的一部分。
> 人是理性动物。他总能想出任何自己愿意相信的理由。
> –阿纳托尔·法朗士
> 人是理性动物。他可以为任何他想相信的事情想出一个理由。
> 阿纳托尔·法朗士
无论理由是否合理,我们每天都在使用的一系列的通讯工具,例如电子邮件、电话、网络会议工具或社交网络。甚至在 COVID-19 之前,居家办公就已经使这些通信工具成为我们生活中的重要部分。随着疫情出现,居家办公成为新常态,我们交流方式的方方面面正面临着前所未有的改变,这让这些工具变得不可或缺。
@ -25,7 +25,7 @@
作为全球团队的一部分进行远程工作时,我们必须要有一个相互协作的环境。聊天应用软件在帮助我们保持相互联系中起着至关重要的作用。与电子邮件相比,聊天应用软件可提供与全球各地的同事快速、实时的通信。
考虑选择一款聊天应用软件需要考虑很多因素。为了帮助你选择最适合你的应用软件,在本文中,我将探讨四款开源聊天应用软件和一个开源视频通信工具(用于当你需要与同事“面对面”时),然后概述在高效的通讯应用软件中,你应当考虑的一些功能。
选择一款聊天应用软件需要考虑很多因素。为了帮助你选择最适合你的应用软件,在本文中,我将探讨四款开源聊天应用软件,和一个当你需要与同事“面对面”时的开源视频通信工具,然后概述在高效的通讯应用软件中,你应当考虑的一些功能。
### 四款开源聊天软件
@ -33,64 +33,53 @@
![Rocket.Chat][2]
[Rocket.Chat][3] 是一个综合性的通讯平台,其将频道分为公开房间(任何人都可以加入)和私有房间(仅受邀请)。你还可以直接将消息发送给已登录的人员。其能共享文档、链接、照片、视频和<ruby>动态图<rt>GIF</rt></ruby>,以及进行视频通话,并可以在平台中发送语音信息。
Rocket.Chat 是免费开源的软件,但是其独特之处在于其可自托管的聊天系统。你可以将其下载到你的服务器上,无论它是本地服务器或是在公有云上的虚拟专用服务器。
Rocket.Chat 是自由开源软件,但是其独特之处在于其可自托管的聊天系统。你可以将其下载到你的服务器上,无论它是本地服务器或是在公有云上的虚拟专用服务器。
Rocket.Chat 是完全免费,其 [源码][4] 可在 Github 获得。许多开源项目都使用 Rocket.Chat 作为他们官方交流平台。该软件在持续不断的发展且不断更新和改进新功能。
我最喜欢 Rocket.Chat 的地方是其能够根据用户需求来进行自定义操作,并且它使用机器学习来自动化处理,在用户通讯间实时翻译信息。你也可以下载适用于你移动设备的 Rocket.Chat以便能随时随地使用。
我最喜欢 Rocket.Chat 的地方是其能够根据用户需求来进行自定义操作,并且它使用机器学习在用户通讯间进行自动的、实时消息翻译。你也可以下载适用于你移动设备的 Rocket.Chat以便能随时随地使用。
#### IRC
![IRC on WeeChat 0.3.5][5]
[Internet Relay Chat (IRC)][6] 是一款实时、基于文本格式的通信软件。尽管其是最古老的电子通讯形式之一,但在许多知名的软件项目中仍受欢迎。
IRC<ruby>[互联网中继聊天][6]<rt>Internet Relay Chat</rt></ruby>是一款实时、基于文本格式的通信软件。尽管其是最古老的电子通讯形式之一,但在许多知名的软件项目中仍受欢迎。
IRC 频道是单独的聊天室。它可以让你在一个开放的频道中与多人进行聊天或与某人私下一对一聊天。如果频道名称以 `#` 开头,则可以假定它是官方的聊天室,而以 `##` 开头的聊天室通常是非官方的聊天室。
IRC 频道是单独的聊天室。它可以让你在一个开放的频道中与多人进行聊天或与某人私下一对一聊天。如果频道名称以 开头,则可以假定它是官方的聊天室,然而以 ## 开头的聊天室通常是非官方的聊天室
[上手 IRC][7] 很容易。你的 IRC 昵称可以让人们找到你,因此它必须是唯一的。但是,你可以完全自主地选择 IRC 客户端。如果你需要比标准 IRC 客户端更多功能的应用程序,则可以使用 [Riot.im][8] 连接到 IRC
[使用 IRC][7] 是很容易上手。你的 IRC 昵称可以让人们找到你,因此它必须是唯一的。但是,你可以完全自主地选择 IRC 客户端。如果你需要比标准 IRC 客户端更多功能的应用程序,则可以使用 [Riot.im][8] 连接到 IRC。
考虑到它悠久的历史,你为什么还要继续使用 IRC出于一个原因是其仍是我们所依赖的许多免费和开源项目的家园。如果你想参于开源软件开发和社区可以选择用 IRC。
考虑到它悠久的历史,你为什么还要继续使用 IRC出于一个原因是其仍是我们所依赖的许多自由及开源项目的家园。如果你想参于开源软件开发和社区可以选择用 IRC。
#### Zulip
![Zulip][9]
[Zulip][10] 是十分流行的群聊应用程序,它遵循基于话题线索的模式。在 Zulip 中,你可以订阅<ruby><rt>stream</rt></ruby>,就像在 IRC 频道或 Rocket.Chat 中一样。但是,每个 Zulip 流都会拥有一个唯一的<ruby>话题<rt>topic</rt></ruby>,该话题可帮助你以后查找对话,因此其更有条理。
[Zulip][10] 是遵循基于话题时间线模式且十分流行的群聊应用程序。在 Zulip 中,你可以订阅<ruby><rt>stream</rt></ruby>,就像在 IRC 频道或 Rocket.Chat 中一样。但是,每个 Zulip 流都会拥有一个唯一的<ruby>话题<rt>topic</rt></ruby>,该话题可帮助你以后查找对话,因此其更有条理
与其他平台一样,它支持表情符号、内嵌图片、视频和推特预览。它还支持 LaTeX 来分享数学公式或方程式、支持 Markdown 和语法高亮来分享代码
Zulip 是跨平台的,并提供 API 用于编写你自己的程序。我特别喜欢 Zulip 的一点是它与 GitHub 的集成整合功能:如果我正在处理某个<ruby>议题<rt>issue</rt></ruby>,则可以使用 Zulip 的标记回链某个<ruby>拉取请求<rt>pull request</rt></ruby> ID。
与其他平台一样,它支持表情符号、图片、视频和推特预览。它还支持 LaTeX 共享数学公式或等式、Markdown 语法和共享代码的语法高亮。
Zulip 是跨平台、并提供 API 用于编写你自己的程序。我特别喜欢 Zulip 的一点是它与 GitHub 的集成整合功能:如果我正在处理某个<ruby>问题<rt>issue</rt></ruby>,则可以使用 Zulip 的标记链接<ruby>拉回<rt>pull</rt></ruby>某个请求 ID。
Zulip是开源你可以在 GitHub 上访问其[源码][11])并且免费使用,但是其已经为本地支持、[LDAP][12] 的集成整合和存储扩展提供了付费服务。
Zulip 是开源的(你可以在 GitHub 上访问其 [源码][11])并且免费使用,但它有提供预置支持、[LDAP][12] 集成和更多存储类型的付费产品。
#### Let's Chat
![Let's Chat][13]
[Let's Chat][14] 是面向小型团队的自托管的聊天解决方案。它使用 Node.js 和 MongoDB 编写运行,只需鼠标点击几下即可将其部署到本地服务器或云服务器。它是免费且开源,可以在 GitHub 上查看其 [源码][15]。
[Let's Chat][14] 是一个面向小型团队的自托管的聊天解决方案。它使用 Node.js 和 MongoDB 编写运行,只需鼠标点击几下即可将其部署到本地服务器或云服务器。它是自由开源软件,可以在 GitHub 上查看其 [源码][15]。
Let's Chat 与其他开源聊天工具的不同之处在于其企业功能:它支持 LDAP 和 [Kerberos][16] 身份验证。它还具有新用户想要的所有功能:你可以在历史记录中搜索过往消息,并使用 @username 之类的标签来标记人员。
我喜欢 Let's Chat 的地方是它拥有私人、受密码保护的聊天室、发送图片、GIPHY 支持和代码拷贝。它不断更新,并不断增加新功能。
我喜欢 Let's Chat 的地方是它拥有私人的受密码保护的聊天室、发送图片、支持 GIPHY 和代码粘贴。它不断更新,不断增加新功能。
### 附加:开源视频聊天软件 Jitsi
![Jitsi][17]
有时,文字聊天还不够,你还可能需要与某人面谈。在这种情况下,如果不能选择面对面开会交流,那么视频聊天是最好的选择。[Jitsi][18] 是一个完全开源的,多平台且兼容 WebRTC 的视频会议工具。
有时,文字聊天还不够,你还可能需要与某人面谈。在这种情况下,如果不能选择面对面开会交流,那么视频聊天是最好的选择。[Jitsi][18] 是一个完全开源的、支持多平台且兼容 WebRTC 的视频会议工具。
Jitsi 从 Jitsi Desktop 开始,已经发展成为许多 [项目][19],包括 Jitsi Meet、Jitsi Videobridge、jibri 和 libjitsi并且每个项目都在 GitHub 上开放了 [源码][20]。
@ -106,10 +95,10 @@ Jitsi 是安全且可扩展的,并支持诸如<ruby>联播<rt>simulcast</rt></
* 最好寻找一种功能强大且能让人们以各种方式使用它的工具。
* 如果与你所使用的工具有进行集成整合的话,可以重点考虑。一些工具与 GitHub 或 GitLab 以及某些应用程序具有良好的无缝衔接,这将是一个非常有用的功能。
* 有能托管到云主机的工具将十分方便。
* 应考虑到聊天服务的安全性。对于许多组织和个人而言,能在个人服务器上进行托管服务是不可或缺的。
* 应考虑到聊天服务的安全性。在私人服务器上托管服务的能力对许多组织和个人来说是必要的。
* 最好选择那些具有丰富的隐私设置,并拥有私人聊天室和公共聊天室的通讯工具。
由于人们比以往任何时候都更加依赖在线服务,因此拥有备用的通讯平台是明智之举。例如,如果一个项目正在使用 Rocket.Chat则必要之时它还应具有跳转到 IRC 的能力。由于这些软件在不断更新,你可能会发现自己已经连接到多个道,因此集成整合其他应用将变得非常有价值。
由于人们比以往任何时候都更加依赖在线服务,因此拥有备用的通讯平台是明智之举。例如,如果一个项目正在使用 Rocket.Chat则必要之时它还应具有跳转到 IRC 的能力。由于这些软件在不断更新,你可能会发现自己已经连接到多个道,因此集成整合其他应用将变得非常有价值。
在各种可用的开源聊天服务中,你喜欢和使用哪些?这些工具又是如何帮助你进行远程办公?请在评论中分享你的想法。
@ -120,7 +109,7 @@ via: https://opensource.com/article/20/4/open-source-chat
作者:[Sudeshna Sur][a]
选题:[lujun9972][b]
译者:[wyxplus](https://github.com/wyxplus)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,271 @@
[#]: collector: (lujun9972)
[#]: translator: (tt67wq)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13318-1.html)
[#]: subject: (How to handle dynamic and static libraries in Linux)
[#]: via: (https://opensource.com/article/20/6/linux-libraries)
[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99)
怎样在 Linux 中使用动态和静态库
======
> 了解 Linux 如何使用库,包括静态库和动态库的差别,有助于你解决依赖问题。
![](https://img.linux.net.cn/data/attachment/album/202104/21/184822euzoqsiwxxpiqqrr.jpg)
Linux 从某种意义上来说就是一堆相互依赖的静态和动态库。对于 Linux 系统新手来说,库的整个处理过程简直是个迷。但对有经验的人来说,被构建进操作系统的大量共享代码对于编写新应用来说却是个优点。
为了让你熟悉这个话题,我准备了一个小巧的 [应用例子][2] 来展示在普通的 Linux 发行版(在其他操作系统上未验证)上是经常是如何处理库的。为了用这个例子来跟上这个需要动手的教程,请打开命令行输入:
```
$ git clone https://github.com/hANSIc99/library_sample
$ cd library_sample/
$ make
cc -c main.c -Wall -Werror
cc -c libmy_static_a.c -o libmy_static_a.o -Wall -Werror
cc -c libmy_static_b.c -o libmy_static_b.o -Wall -Werror
ar -rsv libmy_static.a libmy_static_a.o libmy_static_b.o
ar: creating libmy_static.a
a - libmy_static_a.o
a - libmy_static_b.o
cc -c -fPIC libmy_shared.c -o libmy_shared.o
cc -shared -o libmy_shared.so libmy_shared.o
$ make clean
rm *.o
```
当执行完这些命令,这些文件应当被添加进目录下(执行 `ls` 来查看):
```
my_app
libmy_static.a
libmy_shared.so
```
### 关于静态链接
当你的应用链接了一个静态库,这个库的代码就变成了可执行文件的一部分。这个动作只在链接过程中执行一次,这些静态库通常以 `.a` 扩展符结尾。
静态库是多个<ruby>目标<rt>object</rt></ruby>文件的<ruby>归档<rt>archive</rt></ruby>[ar][3])。这些目标文件通常是 ELF 格式的。ELF 是 <ruby>[可执行可链接格式][4]<rt>Executable and Linkable Format</rt></ruby> 的简写,它与多个操作系统兼容。
`file` 命令的输出可以告诉你静态库 `libmy_static.a``ar` 格式的归档文件类型。
```
$ file libmy_static.a
libmy_static.a: current ar archive
```
使用 `ar -t`,你可以看到归档文件的内部。它展示了两个目标文件:
```
$ ar -t libmy_static.a
libmy_static_a.o
libmy_static_b.o
```
你可以用 `ax -x <archive-file>` 命令来提取归档文件的文件。被提出的都是 ELF 格式的目标文件:
```
$ ar -x libmy_static.a
$ file libmy_static_a.o
libmy_static_a.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
```
### 关于动态链接
动态链接指的是使用共享库。共享库通常以 `.so` 的扩展名结尾(“<ruby>共享对象<rt>shared object</rt></ruby>” 的简写)。
共享库是 Linux 系统中依赖管理的最常用方法。这些共享库在应用启动前被载入内存,当多个应用都需要同一个库时,这个库在系统中只会被加载一次。这个特性减少了应用的内存占用。
另外一个值得注意的地方是,当一个共享库的 bug 被修复后,所有引用了这个库的应用都会受益。但这也意味着,如果一个 bug 还没被发现,那所有相关的应用都会遭受这个 bug 影响(如果这个应用使用了受影响的部分)。
当一个应用需要某个特定版本的库,但是<ruby>链接器<rt>linker</rt></ruby>只知道某个不兼容版本的位置,对于初学者来说这个问题非常棘手。在这个场景下,你必须帮助链接器找到正确版本的路径。
尽管这不是一个每天都会遇到的问题,但是理解动态链接的原理总是有助于你修复类似的问题。
幸运的是,动态链接的机制其实非常简洁明了。
为了检查一个应用在启动时需要哪些库,你可以使用 `ldd` 命令,它会打印出给定文件所需的动态库:
```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffd1299c000)
        libmy_shared.so => not found
        libc.so.6 => /lib64/libc.so.6 (0x00007f56b869b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f56b8881000)
```
可以注意到 `libmy_shared.so` 库是代码仓库的一部分,但是没有被找到。这是因为负责在应用启动之前将所有依赖加载进内存的动态链接器没有在它搜索的标准路径下找到这个库。
对新手来说,与常用库(例如 `bizp2`)版本不兼容相关的问题往往十分令人困惑。一种方法是把该仓库的路径加入到环境变量 `LD_LIBRARY_PATH` 中来告诉链接器去哪里找到正确的版本。在本例中,正确的版本就在这个目录下,所以你可以导出它至环境变量:
```
$ LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH
```
现在动态链接器知道去哪找库了,应用也可以执行了。你可以再次执行 `ldd` 去调用动态链接器,它会检查应用的依赖然后加载进内存。内存地址会在对象路径后展示:
```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffd385f7000)
        libmy_shared.so => /home/stephan/library_sample/libmy_shared.so (0x00007f3fad401000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f3fad21d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f3fad408000)
```
想知道哪个链接器被调用了,你可以用 `file` 命令:
```
$ file my_app
my_app: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=26c677b771122b4c99f0fd9ee001e6c743550fa6, for GNU/Linux 3.2.0, not stripped
```
链接器 `/lib64/ld-linux-x8664.so.2` 是一个指向 `ld-2.30.so` 的软链接,它也是我的 Linux 发行版的默认链接器:
```
$ file /lib64/ld-linux-x86-64.so.2
/lib64/ld-linux-x86-64.so.2: symbolic link to ld-2.31.so
```
回头看看 `ldd` 命令的输出,你还可以看到(在 `libmy_shared.so` 边上)每个依赖都以一个数字结尾(例如 `/lib64/libc.so.6`)。共享对象的常见命名格式为:
```
libXYZ.so.<MAJOR>.<MINOR>
```
在我的系统中,`libc.so.6` 也是指向同一目录下的共享对象 `libc-2.31.so` 的软链接。
```
$ file /lib64/libc.so.6
/lib64/libc.so.6: symbolic link to libc-2.31.so
```
如果你正在面对一个应用因为加载库的版本不对导致无法启动的问题有很大可能你可以通过检查整理这些软链接或者确定正确的搜索路径查看下方“动态加载器ld.so”一节来解决这个问题。
更为详细的信息请查看 [ldd 手册页][5]。
#### 动态加载
动态加载的意思是一个库(例如一个 `.so` 文件)在程序的运行时被加载。这是使用某种特定的编程方法实现的。
当一个应用使用可以在运行时改变的插件时,就会使用动态加载。
查看 [dlopen 手册页][6] 获取更多信息。
#### 动态加载器ld.so
在 Linux 系统中,你几乎总是正在跟共享库打交道,所以必须有个机制来检测一个应用的依赖并将其加载进内存中。
`ld.so` 按以下顺序在这些地方寻找共享对象:
1. 应用的绝对路径或相对路径下(用 GCC 编译器的 `-rpath` 选项硬编码的)
2. 环境变量 `LD_LIBRARY_PATH`
3. `/etc/ld.so.cache` 文件
需要记住的是,将一个库加到系统库归档 `/usr/lib64` 中需要管理员权限。你可以手动拷贝 `libmy_shared.so` 至库归档中来让应用可以运行,而避免设置 `LD_LIBRARY_PATH`
```
unset LD_LIBRARY_PATH
sudo cp libmy_shared.so /usr/lib64/
```
当你运行 `ldd` 时,你现在可以看到归档库的路径被展示出来:
```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffe82fab000)
        libmy_shared.so => /lib64/libmy_shared.so (0x00007f0a963e0000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f0a96216000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0a96401000)
```
### 在编译时定制共享库
如果你想你的应用使用你的共享库,你可以在编译时指定一个绝对或相对路径。
编辑 `makefile`(第 10 行)然后通过 `make -B` 来重新编译程序。然后 `ldd` 输出显示 `libmy_shared.so` 和它的绝对路径一起被列出来了。
把这个:
```
CFLAGS =-Wall -Werror -Wl,-rpath,$(shell pwd)
```
改成这个(记得修改用户名):
```
CFLAGS =/home/stephan/library_sample/libmy_shared.so
```
然后重新编译:
```
$ make
```
确认下它正在使用你设定的绝对路径,你可以在输出的第二行看到:
```
$ ldd my_app
    linux-vdso.so.1 (0x00007ffe143ed000)
        libmy_shared.so => /lib64/libmy_shared.so (0x00007fe50926d000)
        /home/stephan/library_sample/libmy_shared.so (0x00007fe509268000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fe50909e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe50928e000)
```
这是个不错的例子,但是如果你在编写给其他人用的库,它是怎样工作的呢?新库的路径可以通过写入 `/etc/ld.so.conf` 或是在 `/etc/ld.so.conf.d/` 目录下创建一个包含路径的 `<library-name>.conf` 文件来注册至系统。之后,你必须执行 `ldconfig` 命令来覆写 `ld.so.cache` 文件。这一步有时候在你装了携带特殊的共享库的程序来说是不可省略的。
查看 [ld.so 的手册页][7] 获取更多详细信息。
### 怎样处理多种架构
通常来说32 位和 64 位版本的应用有不同的库。下面列表展示了不同 Linux 发行版库的标准路径:
**红帽家族**
* 32 位:`/usr/lib`
* 64 位:`/usr/lib64`
**Debian 家族**
* 32 位:`/usr/lib/i386-linux-gnu`
* 64 位:`/usr/lib/x86_64-linux-gnu`
**Arch Linux 家族**
* 32 位:`/usr/lib32`
* 64 位:`/usr/lib64`
[FreeBSD][8](技术上来说不算 Linux 发行版)
* 32 位:`/usr/lib32`
* 64 位:`/usr/lib`
知道去哪找这些关键库可以让库链接失效的问题成为历史。
虽然刚开始会有点困惑,但是理解 Linux 库的依赖管理是一种对操作系统掌控感的表现。在其他应用程序中运行这些步骤,以熟悉常见的库,然后继续学习怎样解决任何你可能遇到的库的挑战。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/linux-libraries
作者:[Stephan Avenwedde][a]
选题:[lujun9972][b]
译者:[tt67wq](https://github.com/tt67wq)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/hansic99
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
[2]: https://github.com/hANSIc99/library_sample
[3]: https://en.wikipedia.org/wiki/Ar_%28Unix%29
[4]: https://linuxhint.com/understanding_elf_file_format/
[5]: https://www.man7.org/linux/man-pages/man1/ldd.1.html
[6]: https://www.man7.org/linux/man-pages/man3/dlopen.3.html
[7]: https://www.man7.org/linux/man-pages/man8/ld.so.8.html
[8]: https://opensource.com/article/20/5/furybsd-linux

View File

@ -0,0 +1,529 @@
[#]: collector: (lujun9972)
[#]: translator: (tt67wq)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13307-1.html)
[#]: subject: (Use systemd timers instead of cronjobs)
[#]: via: (https://opensource.com/article/20/7/systemd-timers)
[#]: author: (David Both https://opensource.com/users/dboth)
使用 systemd 定时器代替 cron 作业
======
> 定时器提供了比 cron 作业更为细粒度的事件控制。
![](https://img.linux.net.cn/data/attachment/album/202104/18/104406dgszkj3eeibkea55.jpg)
我正在致力于将我的 [cron][2] 作业迁移到 systemd 定时器上。我已经使用定时器多年了,但通常来说,我的学识只足以支撑我当前的工作。但在我研究 [systemd 系列][3] 的过程中,我发现 systemd 定时器有一些非常有意思的能力。
与 cron 作业类似systemd 定时器可以在特定的时间间隔触发事件shell 脚本和程序),例如每天一次或在一个月中的特定某一天(或许只有在周一生效),或在从上午 8 点到下午 6 点的工作时间内每隔 15 分钟一次。定时器也可以做到 cron 作业无法做到的一些事情。举个例子,定时器可以在特定事件发生后的一段时间后触发一段脚本或者程序去执行,例如开机、启动、上个任务完成,甚至于定时器调用的上个服务单元的完成的时刻。
### 操作系统维护的计时器
当在一个新系统上安装 Fedora 或者是任意一个基于 systemd 的发行版时,作为系统维护过程的一部分,它会在 Linux 宿主机的后台中创建多个定时器。这些定时器会触发事件来执行必要的日常维护任务,比如更新系统数据库、清理临时目录、轮换日志文件,以及更多其他事件。
作为示例,我会查看一些我的主要工作站上的定时器,通过执行 `systemctl status *timer` 命令来展示主机上的所有定时器。星号的作用与文件通配相同,所以这个命令会列出所有的 systemd 定时器单元。
```
[root@testvm1 ~]# systemctl status *timer
● mlocate-updatedb.timer - Updates mlocate database every day
Loaded: loaded (/usr/lib/systemd/system/mlocate-updatedb.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
Trigger: Fri 2020-06-05 00:00:00 EDT; 15h left
Triggers: ● mlocate-updatedb.service
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Updates mlocate database every day.
● logrotate.timer - Daily rotation of log files
Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
Trigger: Fri 2020-06-05 00:00:00 EDT; 15h left
Triggers: ● logrotate.service
Docs: man:logrotate(8)
man:logrotate.conf(5)
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Daily rotation of log files.
● sysstat-summary.timer - Generate summary of yesterday's process accounting
Loaded: loaded (/usr/lib/systemd/system/sysstat-summary.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
Trigger: Fri 2020-06-05 00:07:00 EDT; 15h left
Triggers: ● sysstat-summary.service
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Generate summary of yesterday's process accounting.
● fstrim.timer - Discard unused blocks once a week
Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
Trigger: Mon 2020-06-08 00:00:00 EDT; 3 days left
Triggers: ● fstrim.service
Docs: man:fstrim
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Discard unused blocks once a week.
● sysstat-collect.timer - Run system activity accounting tool every 10 minutes
Loaded: loaded (/usr/lib/systemd/system/sysstat-collect.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
Trigger: Thu 2020-06-04 08:50:00 EDT; 41s left
Triggers: ● sysstat-collect.service
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Run system activity accounting tool every 10 minutes.
● dnf-makecache.timer - dnf makecache --timer
Loaded: loaded (/usr/lib/systemd/system/dnf-makecache.timer; enabled; vendor preset: enabled)
Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
Trigger: Thu 2020-06-04 08:51:00 EDT; 1min 41s left
Triggers: ● dnf-makecache.service
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started dnf makecache timer.
● systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories
Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.timer; static; vendor preset: disabled)
Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
Trigger: Fri 2020-06-05 08:19:00 EDT; 23h left
Triggers: ● systemd-tmpfiles-clean.service
Docs: man:tmpfiles.d(5)
man:systemd-tmpfiles(8)
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Daily Cleanup of Temporary Directories.
```
每个定时器至少有六行相关信息:
* 定时器的第一行有定时器名字和定时器目的的简短介绍
* 第二行展示了定时器的状态,是否已加载,定时器单元文件的完整路径以及预设信息。
* 第三行指明了其活动状态,包括该定时器激活的日期和时间。
* 第四行包括了该定时器下次被触发的日期和时间和距离触发的大概时间。
* 第五行展示了被定时器触发的事件或服务名称。
* 部分不是全部systemd 单元文件有相关文档的指引。我虚拟机上输出中有三个定时器有文档指引。这是一个很好(但非必要)的信息。
* 最后一行是计时器最近触发的服务实例的日志条目。
你也许有一些不一样的定时器,取决于你的主机。
### 创建一个定时器
尽管我们可以解构一个或多个现有的计时器来了解其工作原理,但让我们创建我们自己的 [服务单元][4] 和一个定时器去触发它。为了保持简单,我们将使用一个相当简单的例子。当我们完成这个实验之后,就能更容易理解其他定时器的工作原理以及发现它们正在做什么。
首先,创建一个运行基础东西的简单的服务,例如 `free` 命令。举个例子,你可能想定时监控空余内存。在 `/etc/systemd/system` 目录下创建如下的 `myMonitor.server` 单元文件。它不需要是可执行文件:
```
# This service unit is for testing timer units
# By David Both
# Licensed under GPL V2
#
[Unit]
Description=Logs system statistics to the systemd journal
Wants=myMonitor.timer
[Service]
Type=oneshot
ExecStart=/usr/bin/free
[Install]
WantedBy=multi-user.target
```
这大概是你能创建的最简单的服务单元了。现在我们查看一下服务状态同时测试一下服务单元确保它和我们预期一样可用。
```
[root@testvm1 system]# systemctl status myMonitor.service
● myMonitor.service - Logs system statistics to the systemd journal
Loaded: loaded (/etc/systemd/system/myMonitor.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@testvm1 system]# systemctl start myMonitor.service
[root@testvm1 system]#
```
输出在哪里呢默认情况下systemd 服务单元执行程序的标准输出(`STDOUT`)会被发送到系统日志中,它保留了记录供现在或者之后(直到某个时间点)查看。(在本系列的后续文章中,我将介绍系统日志的记录和保留策略)。专门查看你的服务单元的日志,而且只针对今天。`-S` 选项,即 `--since` 的缩写,允许你指定 `journalctl` 工具搜索条目的时间段。这并不代表你不关心过往结果 —— 在这个案例中,不会有过往记录 —— 如果你的机器以及运行了很长时间且堆积了大量的日志,它可以缩短搜索时间。
```
[root@testvm1 system]# journalctl -S today -u myMonitor.service
-- Logs begin at Mon 2020-06-08 07:47:20 EDT, end at Thu 2020-06-11 09:40:47 EDT. --
Jun 11 09:12:09 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 11 09:12:09 testvm1.both.org free[377966]: total used free shared buff/cache available
Jun 11 09:12:09 testvm1.both.org free[377966]: Mem: 12635740 522868 11032860 8016 1080012 11821508
Jun 11 09:12:09 testvm1.both.org free[377966]: Swap: 8388604 0 8388604
Jun 11 09:12:09 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
[root@testvm1 system]#
```
由服务触发的任务可以是单个程序、一组程序或者是一个脚本语言写的脚本。通过在 `myMonitor.service` 单元文件里的 `[Service]` 块末尾中添加如下行可以为服务添加另一个任务:
```
ExecStart=/usr/bin/lsblk
```
再次启动服务,查看日志检查结果,结果应该看上去像这样。你应该在日志中看到两条命令的结果输出:
```
Jun 11 15:42:18 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 11 15:42:18 testvm1.both.org free[379961]: total used free shared buff/cache available
Jun 11 15:42:18 testvm1.both.org free[379961]: Mem: 12635740 531788 11019540 8024 1084412 11812272
Jun 11 15:42:18 testvm1.both.org free[379961]: Swap: 8388604 0 8388604
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: sda 8:0 0 120G 0 disk
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: ├─sda1 8:1 0 4G 0 part /boot
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: └─sda2 8:2 0 116G 0 part
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: ├─VG01-root 253:0 0 5G 0 lvm /
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: ├─VG01-swap 253:1 0 8G 0 lvm [SWAP]
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: ├─VG01-usr 253:2 0 30G 0 lvm /usr
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: ├─VG01-tmp 253:3 0 10G 0 lvm /tmp
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: ├─VG01-var 253:4 0 20G 0 lvm /var
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: └─VG01-home 253:5 0 10G 0 lvm /home
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: sr0 11:0 1 1024M 0 rom
Jun 11 15:42:18 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
Jun 11 15:42:18 testvm1.both.org systemd[1]: Finished Logs system statistics to the systemd journal.
```
现在你知道了你的服务可以按预期工作了,在 `/etc/systemd/system` 目录下创建 `myMonitor.timer` 定时器单元文件,添加如下代码:
```
# This timer unit is for testing
# By David Both
# Licensed under GPL V2
#
[Unit]
Description=Logs some system statistics to the systemd journal
Requires=myMonitor.service
[Timer]
Unit=myMonitor.service
OnCalendar=*-*-* *:*:00
[Install]
WantedBy=timers.target
```
`myMonitor.timer` 文件中的 `OnCalendar` 时间格式,`*-*-* *:*:00`,应该会每分钟触发一次定时器去执行 `myMonitor.service` 单元。我会在文章的后面进一步探索 `OnCalendar` 设置。
到目前为止,在服务被计时器触发运行时观察与之有关的日志记录。你也可以跟踪计时器,跟踪服务可以让你接近实时的看到结果。执行 `journalctl` 时带上 `-f` 选项:
```
[root@testvm1 system]# journalctl -S today -f -u myMonitor.service
-- Logs begin at Mon 2020-06-08 07:47:20 EDT. --
```
执行但是不启用该定时器,看看它运行一段时间后发生了什么:
```
[root@testvm1 ~]# systemctl start myMonitor.service
[root@testvm1 ~]#
```
一条结果立即就显示出来了,下一条大概在一分钟后出来。观察几分钟日志,看看你有没有跟我发现同样的事情:
```
[root@testvm1 system]# journalctl -S today -f -u myMonitor.service
-- Logs begin at Mon 2020-06-08 07:47:20 EDT. --
Jun 13 08:39:18 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 13 08:39:18 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
Jun 13 08:39:19 testvm1.both.org free[630566]: total used free shared buff/cache available
Jun 13 08:39:19 testvm1.both.org free[630566]: Mem: 12635740 556604 10965516 8036 1113620 11785628
Jun 13 08:39:19 testvm1.both.org free[630566]: Swap: 8388604 0 8388604
Jun 13 08:39:18 testvm1.both.org systemd[1]: Finished Logs system statistics to the systemd journal.
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: sda 8:0 0 120G 0 disk
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: ├─sda1 8:1 0 4G 0 part /boot
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: └─sda2 8:2 0 116G 0 part
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: ├─VG01-root 253:0 0 5G 0 lvm /
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: ├─VG01-swap 253:1 0 8G 0 lvm [SWAP]
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: ├─VG01-usr 253:2 0 30G 0 lvm /usr
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: ├─VG01-tmp 253:3 0 10G 0 lvm /tmp
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: ├─VG01-var 253:4 0 20G 0 lvm /var
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: └─VG01-home 253:5 0 10G 0 lvm /home
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: sr0 11:0 1 1024M 0 rom
Jun 13 08:40:46 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 13 08:40:46 testvm1.both.org free[630572]: total used free shared buff/cache available
Jun 13 08:40:46 testvm1.both.org free[630572]: Mem: 12635740 555228 10966836 8036 1113676 11786996
Jun 13 08:40:46 testvm1.both.org free[630572]: Swap: 8388604 0 8388604
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: sda 8:0 0 120G 0 disk
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: ├─sda1 8:1 0 4G 0 part /boot
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: └─sda2 8:2 0 116G 0 part
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: ├─VG01-root 253:0 0 5G 0 lvm /
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: ├─VG01-swap 253:1 0 8G 0 lvm [SWAP]
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: ├─VG01-usr 253:2 0 30G 0 lvm /usr
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: ├─VG01-tmp 253:3 0 10G 0 lvm /tmp
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: ├─VG01-var 253:4 0 20G 0 lvm /var
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: └─VG01-home 253:5 0 10G 0 lvm /home
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: sr0 11:0 1 1024M 0 rom
Jun 13 08:40:46 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
Jun 13 08:40:46 testvm1.both.org systemd[1]: Finished Logs system statistics to the systemd journal.
Jun 13 08:41:46 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 13 08:41:46 testvm1.both.org free[630580]: total used free shared buff/cache available
Jun 13 08:41:46 testvm1.both.org free[630580]: Mem: 12635740 553488 10968564 8036 1113688 11788744
Jun 13 08:41:46 testvm1.both.org free[630580]: Swap: 8388604 0 8388604
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: sda 8:0 0 120G 0 disk
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: ├─sda1 8:1 0 4G 0 part /boot
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: └─sda2 8:2 0 116G 0 part
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: ├─VG01-root 253:0 0 5G 0 lvm /
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: ├─VG01-swap 253:1 0 8G 0 lvm [SWAP]
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: ├─VG01-usr 253:2 0 30G 0 lvm /usr
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: ├─VG01-tmp 253:3 0 10G 0 lvm /tmp
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: ├─VG01-var 253:4 0 20G 0 lvm /var
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: └─VG01-home 253:5 0 10G 0 lvm /home
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: sr0 11:0 1 1024M 0 rom
Jun 13 08:41:47 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
Jun 13 08:41:47 testvm1.both.org systemd[1]: Finished Logs system statistics to the systemd journal.
```
别忘了检查下计时器和服务的状态。
你在日志里大概至少注意到两件事。第一,你不需要特地做什么来让 `myMonitor.service` 单元中 `ExecStart` 触发器产生的 `STDOUT` 存储到日志里。这都是用 systemd 来运行服务的一部分功能。然而,它确实意味着你需要小心对待服务单元里面执行的脚本和它们能产生多少 `STDOUT`
第二,定时器并不是精确在每分钟的 :00 秒执行的,甚至每次执行的时间间隔都不是刚好一分钟。这是特意的设计,但是有必要的话可以改变这种行为(如果只是它挑战了你的系统管理员的敏感神经)。
这样设计的初衷是为了防止多个服务在完全相同的时刻被触发。举个例子,你可以用例如 WeeklyDaily 等时间格式。这些快捷写法都被定义为在某一天的 00:00:00 执行。当多个定时器都这样定义的话,有很大可能它们会同时执行。
systemd 定时器被故意设计成在规定时间附近随机波动的时间点触发,以避免同一时间触发。它们在一个时间窗口内半随机触发,时间窗口开始于预设的触发时间,结束于预设时间后一分钟。根据 `systemd.timer` 的手册页,这个触发时间相对于其他已经定义的定时器单元保持在稳定的位置。你可以在日志条目中看到,定时器在启动后立即触发,然后在每分钟后的 46 或 47 秒触发。
大部分情况下,这种概率抖动的定时器是没事的。当调度类似执行备份的任务,只需要它们在下班时间运行,这样是没问题的。系统管理员可以选择确定的开始时间来确保不和其他任务冲突,例如 01:05:00 这样典型的 cron 作业时间,但是有很大范围的时间值可以满足这一点。在开始时间上的一个分钟级别的随机往往是无关紧要的。
然而,对某些任务来说,精确的触发时间是个硬性要求。对于这类任务,你可以向单元文件的 `Timer` 块中添加如下声明来指定更高的触发时间跨度精确度(精确到微秒以内):
```
AccuracySec=1us
```
时间跨度可用于指定所需的精度,以及定义重复事件或一次性事件的时间跨度。它能识别以下单位:
* `usec`、`us`、`µs`
* `msec`、`ms`
* `seconds`、`second`、`sec`、`s`
* `minutes`、`minute`、`min`、`m`
* `hours`、`hour`、`hr`、`h`
* `days`、`day`、`d`
* `weeks`、`week`、`w`
* `months`、`month`、`M`(定义为 30.44 天)
* `years`、`year`、`y`(定义为 365.25 天)
所有 `/usr/lib/systemd/system` 中的定时器都指定了一个更宽松的时间精度,因为精准时间没那么重要。看看这些系统创建的定时器的时间格式:
```
[root@testvm1 system]# grep Accur /usr/lib/systemd/system/*timer
/usr/lib/systemd/system/fstrim.timer:AccuracySec=1h
/usr/lib/systemd/system/logrotate.timer:AccuracySec=1h
/usr/lib/systemd/system/logwatch.timer:AccuracySec=12h
/usr/lib/systemd/system/mlocate-updatedb.timer:AccuracySec=24h
/usr/lib/systemd/system/raid-check.timer:AccuracySec=24h
/usr/lib/systemd/system/unbound-anchor.timer:AccuracySec=24h
[root@testvm1 system]#
```
看下 `/usr/lib/systemd/system` 目录下部分定时器单元文件的完整内容,看看它们是如何构建的。
在本实验中不必让这个定时器在启动时激活,但下面这个命令可以设置开机自启:
```
[root@testvm1 system]# systemctl enable myMonitor.timer
```
你创建的单元文件不需要是可执行的。你同样不需要启用服务,因为它是被定时器触发的。如果你需要的话,你仍然可以在命令行里手动触发该服务单元。尝试一下,然后观察日志。
关于定时器精度、事件时间规格和触发事件的详细信息,请参见 systemd.timer 和 systemd.time 的手册页。
### 定时器类型
systemd 定时器还有一些在 cron 中找不到的功能cron 只在确定的、重复的、具体的日期和时间触发。systemd 定时器可以被配置成根据其他 systemd 单元状态发生改变时触发。举个例子,定时器可以配置成在系统开机、启动后,或是某个确定的服务单元激活之后的一段时间被触发。这些被称为单调计时器。“单调”指的是一个持续增长的计数器或序列。这些定时器不是持久的,因为它们在每次启动后都会重置。
表格 1 列出了一些单调定时器以及每个定时器的简短定义,同时有 `OnCalendar` 定时器,这些不是单调的,它们被用于指定未来有可能重复的某个确定时间。这个信息来自于 `systemd.timer` 的手册页,有一些不重要的修改。
定时器 | 单调性 | 定义
---|---|---
`OnActiveSec=` | X | 定义了一个与定时器被激活的那一刻相关的定时器。
`OnBootSec=` | X | 定义了一个与机器启动时间相关的计时器。
`OnStartupSec=` | X | 定义了一个与服务管理器首次启动相关的计时器。对于系统定时器来说,这个定时器与 `OnBootSec=` 类似,因为系统服务管理器在机器启动后很短的时间后就会启动。当以在每个用户服务管理器中运行的单元进行配置时,它尤其有用,因为用户的服务管理器通常在首次登录后启动,而不是机器启动后。
`OnUnitActiveSec=` | X | 定义了一个与将要激活的定时器上次激活时间相关的定时器。
`OnUnitInactiveSec=` | X | 定义了一个与将要激活的定时器上次停用时间相关的定时器。
`OnCalendar=` | | 定义了一个有日期事件表达式语法的实时(即时钟)定时器。查看 `systemd.time(7)` 的手册页获取更多与日历事件表达式相关的语法信息。除此以外,它的语义和 `OnActiveSec=` 类似。
_Table 1: systemd 定时器定义_
单调计时器可使用同样的简写名作为它们的时间跨度,即我们之前提到的 `AccuracySec` 表达式,但是 systemd 将这些名字统一转换成了秒。举个例子,比如你想规定某个定时器在系统启动后五天触发一次事件;它可能看起来像 `OnBootSec=5d`。如果机器启动于 `2020-06-15 09:45:27`,这个定时器会在 `2020-06-20 09:45:27` 或在这之后的一分钟内触发。
### 日历事件格式
日历事件格式是定时器在所需的重复时间触发的关键。我们开始看下一些 `OnCalendar` 设置一起使用的格式。
与 crontab 中的格式相比systemd 及其计时器使用的时间和日历格式风格不同。它比 crontab 更为灵活,而且可以使用类似 `at` 命令的方式允许模糊的日期和时间。它还应该足够熟悉使其易于理解。
systemd 定时器使用 `OnCalendar=` 的基础格式是 `DOW YYYY-MM-DD HH:MM:SS`。DOW星期几是选填的其他字段可以用一个星号`*`)来匹配此位置的任意值。所有的日历时间格式会被转换成标准格式。如果时间没有指定,它会被设置为 `00:00:00`。如果日期没有指定但是时间指定了,那么下次匹配的时间可能是今天或者明天,取决于当前的时间。月份和星期可以使用名称或数字。每个单元都可以使用逗号分隔的列表。单元范围可以在开始值和结束值之间用 `..` 指定。
指定日期有一些有趣的选项,波浪号(`~`)可以指定月份的最后一天或者最后一天之前的某几天。`/` 可以用来指定星期几作为修饰符。
这里有几个在 `OnCalendar` 表达式中使用的典型时间格式例子。
日期事件格式 | 描述
---|---
`DOW YYYY-MM-DD HH:MM:SS` |
`*-*-* 00:15:30` | 每年每月每天的 0 点 15 分 30 秒
`Weekly` | 每个周一的 00:00:00
`Mon *-*-* 00:00:00` | 同上
`Mon` | 同上
`Wed 2020-*-*` | 2020 年每个周三的 00:00:00
`Mon..Fri 2021-*-*` | 2021 年的每个工作日(周一到周五)的 00:00:00
`2022-6,7,8-1,15 01:15:00` | 2022 年 6、7、8 月的 1 到 15 号的 01:15:00
`Mon *-05~03` | 每年五月份的下个周一同时也是月末的倒数第三天
`Mon..Fri *-08~04` | 任何年份 8 月末的倒数第四天,同时也须是工作日
`*-05~03/2` | 五月末的倒数第三天,然后 2 天后再来一次。每年重复一次。注意这个表达式使用了波浪号(`~`)。
`*-05-03/2` | 五月的第三天,然后每两天重复一次直到 5 月底。注意这个表达式使用了破折号(`-`)。
_Table 2: `OnCalendar` 事件时间格式例子_
### 测试日历格式
systemd 提供了一个绝佳的工具用于检测和测试定时器中日历时间事件的格式。`systemd-analyze calendar` 工具解析一个时间事件格式,提供标准格式和其他有趣的信息,例如下次“经过”(即匹配)的日期和时间,以及距离下次触发之前大概时间。
首先,看看未来没有时间的日(注意 `Next elapse``UTC` 的时间会根据你当地时区改变):
```
[student@studentvm1 ~]$ systemd-analyze calendar 2030-06-17
  Original form: 2030-06-17                
Normalized form: 2030-06-17 00:00:00        
    Next elapse: Mon 2030-06-17 00:00:00 EDT
       (in UTC): Mon 2030-06-17 04:00:00 UTC
       From now: 10 years 0 months left    
[root@testvm1 system]#
```
现在添加一个时间,在这个例子中,日期和时间是当作无关的部分分开解析的:
```
[root@testvm1 system]# systemd-analyze calendar 2030-06-17 15:21:16
  Original form: 2030-06-17                
Normalized form: 2030-06-17 00:00:00        
    Next elapse: Mon 2030-06-17 00:00:00 EDT
       (in UTC): Mon 2030-06-17 04:00:00 UTC
       From now: 10 years 0 months left    
  Original form: 15:21:16                  
Normalized form: *-*-* 15:21:16            
    Next elapse: Mon 2020-06-15 15:21:16 EDT
       (in UTC): Mon 2020-06-15 19:21:16 UTC
       From now: 3h 55min left              
[root@testvm1 system]#
```
为了把日期和时间当作一个单元来分析,可以把它们包在引号里。你在定时器单元里 `OnCalendar=` 时间格式中使用的时候记得把引号去掉,否则会报错:
```
[root@testvm1 system]# systemd-analyze calendar "2030-06-17 15:21:16"
Normalized form: 2030-06-17 15:21:16        
    Next elapse: Mon 2030-06-17 15:21:16 EDT
       (in UTC): Mon 2030-06-17 19:21:16 UTC
       From now: 10 years 0 months left    
[root@testvm1 system]#
```
现在我们测试下 Table2 里的例子。我尤其喜欢最后一个:
```
[root@testvm1 system]# systemd-analyze calendar "2022-6,7,8-1,15 01:15:00"
  Original form: 2022-6,7,8-1,15 01:15:00
Normalized form: 2022-06,07,08-01,15 01:15:00
    Next elapse: Wed 2022-06-01 01:15:00 EDT
       (in UTC): Wed 2022-06-01 05:15:00 UTC
       From now: 1 years 11 months left
[root@testvm1 system]#
```
让我们看一个例子,这个例子里我们列出了时间表达式的五个经过时间。
```
[root@testvm1 ~]# systemd-analyze calendar --iterations=5 "Mon *-05~3"
  Original form: Mon *-05~3                
Normalized form: Mon *-05~03 00:00:00      
    Next elapse: Mon 2023-05-29 00:00:00 EDT
       (in UTC): Mon 2023-05-29 04:00:00 UTC
       From now: 2 years 11 months left    
       Iter. #2: Mon 2028-05-29 00:00:00 EDT
       (in UTC): Mon 2028-05-29 04:00:00 UTC
       From now: 7 years 11 months left    
       Iter. #3: Mon 2034-05-29 00:00:00 EDT
       (in UTC): Mon 2034-05-29 04:00:00 UTC
       From now: 13 years 11 months left    
       Iter. #4: Mon 2045-05-29 00:00:00 EDT
       (in UTC): Mon 2045-05-29 04:00:00 UTC
       From now: 24 years 11 months left    
       Iter. #5: Mon 2051-05-29 00:00:00 EDT
       (in UTC): Mon 2051-05-29 04:00:00 UTC
       From now: 30 years 11 months left    
[root@testvm1 ~]#
```
这些应该为你提供了足够的信息去开始测试你的 `OnCalendar` 时间格式。`systemd-analyze` 工具可用于其他有趣的分析,我会在这个系列的下一篇文章来探索这些。
### 总结
systemd 定时器可以用于执行和 cron 工具相同的任务,但是通过按照日历和单调时间格式去触发事件的方法提供了更多的灵活性。
虽然你为此次实验创建的服务单元通常是由定时器调用的,你也可以随时使用 `systemctl start myMonitor.service` 命令去触发它。可以在一个定时器中编写多个维护任务的脚本;它们可以是 Bash 脚本或者其他 Linux 程序。你可以通过触发定时器来运行所有的脚本来运行服务,也可以按照需要执行单独的脚本。
我会在下篇文章中更加深入的探索 systemd 时间格式的用处。
我还没有看到任何迹象表明 cron 和 at 将被废弃。我希望这种情况不会发生,因为至少 `at` 在执行一次性调度任务的时候要比 systemd 定时器容易的多。
### 参考资料
网上有大量的关于 systemd 的参考资料,但是大部分都有点简略、晦涩甚至有误导性。除了本文中提到的资料,下列的网页提供了跟多可靠且详细的 systemd 入门信息。
* Fedora 项目有一篇切实好用的 [systemd 入门][5],它囊括了几乎所有你需要知道的关于如何使用 systemd 配置、管理和维护 Fedora 计算机的信息。
* Fedora 项目也有一个不错的 [备忘录][6],交叉引用了过去 SystemV 命令和 systemd 命令做对比。
* 关于 systemd 的技术细节和创建这个项目的原因,请查看 [Freedesktop.org][7] 上的 [systemd 描述][8]。
* [Linux.com][9] 的“更多 systemd 的乐趣”栏目提供了更多高级的 systemd [信息和技巧][10]。
此外,还有一系列深度的技术文章,是由 systemd 的设计者和主要实现者 Lennart Poettering 为 Linux 系统管理员撰写的。这些文章写于 2010 年 4 月至 2011 年 9 月间,但它们现在和当时一样具有现实意义。关于 systemd 及其生态的许多其他好文章都是基于这些文章:
* [Rethinking PID 1][11]
* [systemd for AdministratorsPart I][12]
* [systemd for AdministratorsPart II][13]
* [systemd for AdministratorsPart III][14]
* [systemd for AdministratorsPart IV][15]
* [systemd for AdministratorsPart V][16]
* [systemd for AdministratorsPart VI][17]
* [systemd for AdministratorsPart VII][18]
* [systemd for AdministratorsPart VIII][19]
* [systemd for AdministratorsPart IX][20]
* [systemd for AdministratorsPart X][21]
* [systemd for AdministratorsPart XI][22]
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/7/systemd-timers
作者:[David Both][a]
选题:[lujun9972][b]
译者:[tt67wq](https://github.com/tt67wq)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist)
[2]: https://opensource.com/article/17/11/how-use-cron-linux
[3]: https://opensource.com/users/dboth
[4]: https://opensource.com/article/20/5/manage-startup-systemd
[5]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html
[6]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
[7]: http://Freedesktop.org
[8]: http://www.freedesktop.org/wiki/Software/systemd
[9]: http://Linux.com
[10]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/
[11]: http://0pointer.de/blog/projects/systemd.html
[12]: http://0pointer.de/blog/projects/systemd-for-admins-1.html
[13]: http://0pointer.de/blog/projects/systemd-for-admins-2.html
[14]: http://0pointer.de/blog/projects/systemd-for-admins-3.html
[15]: http://0pointer.de/blog/projects/systemd-for-admins-4.html
[16]: http://0pointer.de/blog/projects/three-levels-of-off.html
[17]: http://0pointer.de/blog/projects/changing-roots
[18]: http://0pointer.de/blog/projects/blame-game.html
[19]: http://0pointer.de/blog/projects/the-new-configuration-files.html
[20]: http://0pointer.de/blog/projects/on-etc-sysinit.html
[21]: http://0pointer.de/blog/projects/instances.html
[22]: http://0pointer.de/blog/projects/inetd.html

View File

@ -0,0 +1,317 @@
[#]: collector: (lujun9972)
[#]: translator: (stevenzdg988)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13326-1.html)
[#]: subject: (11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer)
[#]: via: (https://itsfoss.com/32-bit-linux-distributions/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
14 种可以在古老的 32 位计算机上使用的 Linux 发行版
======
如果你一直关注最新的 [Linux 发行版][1],那么你一定已经注意到,[大多数流行的 Linux 发行版][2] 已经终止了 32 位支持。Arch Linux、Ubuntu、Fedora每一个都已经放弃了对这种较旧架构的支持。
但是,如果你拥有仍然需要再利用的老式硬件,或者想将其用于某些用途,该怎么办?不用担心,你的 32 位系统还有一些选择。
在本文中,我试图汇编一些最好的 Linux 发行版,这些发行版将在未来几年继续支持 32 位平台。
### 仍提供 32 位支持的最佳 Linux 发行版
![][3]
此列表与 [我们之前的支持旧笔记本电脑的 Linux 发行版列表][4] 略有不同。即使是 64 位计算机,如果是在 2010 年之前发布的,那么也可以认为它们是旧的。这就是为什么其中列出的一些建议包括现在仅支持 64 位版本的发行版的原因。
根据我的知识和认知,此处提供的信息是正确的,但是如果你发现有误,请在评论部分让我知道。
在继续之前,我认为你知道 [如何检查你拥有的是否是 32 位或 64 位计算机][5]。
#### 1、Debian
![图片来源: mrneilypops / Deviantart][6]
对于 32 位系统,[Debian][11] 是一个绝佳的选择,因为他们的最新的稳定版本仍然支持它。在撰写本文时,最新的稳定发行版 **Debian 10 “buster”** 提供了 32 位版本,并一直支持到 2024 年。
如果你是 Debian 的新手,值得一提的是,你可以在 [官方 Wiki][7] 上获得有关其所有内容的可靠文档。因此,上手应该不是问题。
你可以浏览 [可用的安装程序][8] 进行安装。但是,在开始之前,除了 [安装手册][10] 外,我建议你参考 [安装 Debian 之前要记住的事情][9] 列表。
最低系统要求:
- 512 MB 内存
- 10 GB 磁盘空间
- 1 GHz 处理器(奔腾 4 或同等水平)
#### 2、Slax
![][12]
如果你只是想快速启动设备以进行一些临时工作,[Slax][13] 是一个令人印象深刻的选择。
它基于 Debian但它通过 USB 设备或 DVD 运行旨在成为一种便携且快速的选项。你可以从他们的网站免费下载 32 位 ISO 文件,或购买预装有 Slax 的可擦写 DVD 或加密的闪存盘。
当然,这并不是要取代传统的桌面操作系统。但是,是的,你确实获得了以 Debian 为基础的 32 位支持。
最低系统要求:
- 内存128MB离线使用/ 512MB用于网页浏览器使用
- CPU: i686 或更新版本
#### 3、AntiX
![图片来源: Opensourcefeed][14]
[AntiX][15] 是另一个令人印象深刻的基于 Debian 的发行版。AntiX 是众所周知的无 systemd 发行版,该发行版侧重于性能,是一个轻量级的系统。
它完全适合于所有老式的 32 位系统。它只需要低至 256 MB 内存和 2.7 GB 存储空间。不仅易于安装,而且用户体验也是针对新手和有经验的用户的。
你应该可以得到基于 Debian 的最新稳定分支的最新版本。
最低系统要求:
- 内存256 MB 的内存
- CPU奔腾 3 系统
- 磁盘空间5GB 的驱动器空间
#### 4、openSUSE
![][16]
[openSUSE][18] 是一个独立的 Linux 发行版,也支持 32 位系统。实际上最新的常规版本Leap不提供 32 位镜像但滚动发行版本Tumbleweed确实提供了 32 位镜像。
如果你是新手,那将是完全不同的体验。但是,我建议你仔细阅读 [为什么要使用 openSUSE 的原因][17]。
它主要面向开发人员和系统管理员但也可以将其用作普通桌面用户。值得注意的是openSUSE 不意味在老式硬件上运行,因此必须确保至少有 2 GB 内存、40+ GB 存储空间和双核处理器。
最低系统要求:
- 奔腾 4 1.6 GHz 或更高的处理器
- 1GB 物理内存
- 5 GB 硬盘
#### 5、Emmabuntüs
![][19]
[Emmanbuntus][20] 是一个有趣的发行版,旨在通过 32 位支持来延长硬件的使用寿命,以减少原材料的浪费。作为一个团体,他们还参与向学校提供计算机和数字技术的工作。
它提供了两个不同的版本,一个基于 Ubuntu另一个基于 Debian。如果你需要更长久的 32 位支持,则可能要使用 Debian 版本。它可能不是最好的选择,但是它具有许多预配置的软件来简化 Linux 学习体验,并提供 32 位支持,如果你希望在此过程中支持他们的事业,那么这是一个相当不错的选择。
最低系统要求:
- 512MB 内存
- 硬盘驱动器2GB
- 奔腾处理器或同等配置
#### 6、NixOS
![Nixos KDE Edition \(图片来源: Distrowatch\)][21]
[NixOS][23] 是另一个支持 32 位系统的独立 Linux 发行版。它着重于提供一个可靠的系统,其中程序包彼此隔离。
这可能不是直接面向普通用户,但它是一个 KDE 支持的可用发行版,具有独特的软件包管理方式。你可以从其官方网站上了解有关其 [功能][22] 的更多信息。
最低系统要求:
- 内存768 MB
- 8GB 磁盘空间
- 奔腾 4 或同等水平
#### 7、Gentoo Linux
![][24]
如果你是经验丰富的 Linux 用户,并且正在寻找 32 位 Linux 发行版,那么 [Gentoo Linux][26] 应该是一个不错的选择。
如果需要,你可以使用 Gentoo Linux 的软件包管理器轻松配置、编译和安装内核。不仅限于众所周知的可配置性,你还可以在较旧的硬件上运行而不会出现任何问题。
即使你不是经验丰富的用户,也想尝试一下,只需阅读 [安装说明][25],就可以大胆尝试了。
最低系统要求:
- 256MB 内存
- 奔腾 4 或 AMD 的同类产品
- 2.5 GB 磁盘空间
#### 8、Devuan
![][27]
[Devuan][30] 是另一种无 systemd 的发行版。从技术上讲,它是 Debian 的一个分支,只是没有 systemd ,并鼓励 [初始化系统自由][29]。
对于普通用户来说,它可能不是一个非常流行的 Linux 发行版,但是如果你想要一个无 systemd 的发行版和 32 位支持Devuan 应该是一个不错的选择。
最低系统要求:
- 内存1GB
- CPU奔腾 1.0GHz
#### 9、Void Linux
![][31]
[Void Linux][33] 是由志愿者独立开发的有趣发行版。它旨在成为一个通用的操作系统,同时提供稳定的滚动发布周期。它以 runit 作为初始化系统替代 systemd并为你提供了多个 [桌面环境][32] 选择。
它具有非常令人印象深刻的最低需求规格,只需 96 MB 的内存配以奔腾 4 或等同的芯片。试试看吧!
最低系统要求:
- 96MB 内存
- 奔腾 4 或相当的 AMD 处理器
#### 10、Q4OS
![][34]
[Q4OS][37] 是另一个基于 Debian 的发行版,致力于提供极简和快速的桌面用户体验。它也恰好是我们的 [最佳轻量级 Linux 发行版][4] 列表中的一个。它的 32 位版本具有 [Trinity 桌面][35],你可以在 64 位版本上找到 KDE Plasma 支持。
与 Void Linux 类似Q4OS 可以运行在至低 128 MB 的内存和 300 MHz 的 CPU 上,需要 3 GB 的存储空间。对于任何老式硬件来说,它应该绰绰有余。因此,我想说,你绝对应该尝试一下!
要了解更多信息,你还可以查看 [我们对 Q4OS 的点评][36]。
Q4OS 的最低要求:
- 内存128MBTrinity 桌面)/ 1GBPlasma 桌面)
- CPU300 MHzTrinity 桌面)/ 1 GHzPlasma 桌面)
- 存储空间5GBTrinity 桌面)/3GBPlasma 桌面)
#### 11、MX Linux
![][38]
如果有一个稍微不错的配置(不完全是老式的,而是旧的),对于 32 位系统,我个人推荐 [MX Linux][39]。它也恰好是适合各种类型用户的 [最佳 Linux 发行版][2] 之一。
通常MX Linux 是基于 Debian 的出色的轻量级和可定制的发行版。你可以选择 KDE、XFce 或 Fluxbox这是他们自己为旧硬件设计的桌面环境。你可以在他们的官方网站上找到更多关于它的信息并尝试一下。
最低系统要求:
- 1GB 内存(建议使用 2GB以便舒适地使用
- 15GB 的磁盘空间(建议 20GB
#### 12、Linux Mint Debian Edtion
![][44]
[基于 Debian 的 Linux Mint][45]?为什么不可以呢?
你可以得到同样的 Cinnamon 桌面体验,只是不基于 Ubuntu。它和基于 Ubuntu 的 Linux Mint 一样容易使用,一样可靠。
不仅仅是基于 Debian你还可以得到对 64 位和 32 位系统的支持。如果你不想在 32 位系统上使用一个你从未听说过的 Linux 发行版,这应该是一个不错的选择。
最低系统要求:
- 1GB 内存(建议使用 2GB以便舒适地使用
- 15GB 的磁盘空间(建议 20GB
#### 13、Sparky Linux
![][46]
[Sparky Linux][47] 是 [为初学者定制的最好的轻量级 Linux 发行版][4] 之一。它很容易定制,而且资源占用很少。
它可以根据你的要求提供不同的版本,但它确实支持 32 位版本。考虑到你想为你的旧电脑买点东西,我建议你看看它的 MinimalGUI 版本,除非你真的需要像 Xfce 或 LXQt 这样成熟的桌面环境。
最低系统要求:
- 内存512 MB
- CPU奔腾 4或 AMD Athlon
- 磁盘空间2GB命令行版10GB家庭版20GB游戏版
#### 14、Mageia
![][48]
作为 [Mandriva Linux][49] 的分支,[Mageia Linux][50] 是一个由社区推动的 Linux 发行版,支持 32 位系统。
通常情况下,你会注意到每年都有一个重大版本。他们的目的是贡献他们的工作,以提供一个自由的操作系统,这也是潜在的安全。对于 32 位系统来说,它可能不是一个流行的选择,但它支持很多桌面环境(如 KDE Plasma、GNOME如果你需要你只需要从它的软件库中安装它。
你应该可以从他们的官方网站上得到下载桌面环境特定镜像的选项。
最低系统要求:
- 512MB 内存(推荐 2GB
- 最小安装需 5GB 存储空间(常规安装 20GB
- CPU奔腾4或 AMD Athlon
### 荣誉提名Funtoo & Puppy Linux
[Funtoo][40] 是基于 Gentoo 的由社区开发的 Linux 发行版。它着重于为你提供 Gentoo Linux 的最佳性能以及一些额外的软件包,以使用户获得完整的体验。有趣的是,该开发实际上是由 Gentoo Linux 的创建者 Daniel Robbins 领导的。
[Puppy Linux][51] 是一个很小的 Linux 发行版除了基本的工具几乎没有捆绑的软件应用。如果其他选择都不行而你又想要最轻量级的发行版Puppy Linux 可能是一个选择。
当然,如果你不熟悉 Linux这两个可能都不能提供最好的体验。但是它们确实支持 32 位系统,并且可以在许多较旧的 Intel/AMD 芯片组上很好地工作。可以在它们的官方网站上探索更多的信息。
### 总结
我将列表重点放在基于 Debian 的发行版和一些独立发行版上。但是,如果你不介意长期支持条款,而只想获得一个支持 32 位的镜像,也可以尝试使用任何基于 Ubuntu 18.04 的发行版(或任何官方版本)。
在撰写本文时,它们只剩下几个月的软件支持。因此,我避免将其作为主要选项提及。但是,如果你喜欢基于 Ubuntu 18.04 的发行版或其它任何版本,可以选择 [LXLE][41]、[Linux Lite][42]、[Zorin Lite 15][43] 及其他官方版本。
即使大多数基于 Ubuntu 的现代桌面操作系统都放弃了对 32 位的支持。你仍然有很多选项可以选择。
在 32 位系统中更喜欢哪一个?在下面的评论中让我知道你的想法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/32-bit-linux-distributions/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[stevenzdg988](https://github.com/stevenzdg988)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/what-is-linux-distribution/
[2]: https://itsfoss.com/best-linux-distributions/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/32-bit-linux.png?resize=800%2C450&ssl=1
[4]: https://itsfoss.com/lightweight-linux-beginners/
[5]: https://itsfoss.com/32-bit-64-bit-ubuntu/
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/debian-screenshot.png?resize=800%2C450&ssl=1
[7]: https://wiki.debian.org/FrontPage
[8]: https://www.debian.org/releases/buster/debian-installer/
[9]: https://itsfoss.com/before-installing-debian/
[10]: https://www.debian.org/releases/buster/installmanual
[11]: https://www.debian.org/
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/slax-screenshot.jpg?resize=800%2C600&ssl=1
[13]: https://www.slax.org
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/antiX-19-1.jpg?resize=800%2C500&ssl=1
[15]: https://antixlinux.com
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/opensuse-15-1.png?resize=800%2C500&ssl=1
[17]: https://itsfoss.com/why-use-opensuse/
[18]: https://www.opensuse.org/
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/Emmabuntus-xfce.png?resize=800%2C500&ssl=1
[20]: https://emmabuntus.org/
[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/nixos-kde.jpg?resize=800%2C500&ssl=1
[22]: https://nixos.org/features.html
[23]: https://nixos.org/
[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/gentoo-linux.png?resize=800%2C450&ssl=1
[25]: https://www.gentoo.org/get-started/
[26]: https://www.gentoo.org
[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/devuan-beowulf.jpg?resize=800%2C600&ssl=1
[28]: https://itsfoss.com/devuan-3-release/
[29]: https://www.devuan.org/os/init-freedom
[30]: https://www.devuan.org
[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/void-linux.jpg?resize=800%2C450&ssl=1
[32]: https://itsfoss.com/best-linux-desktop-environments/
[33]: https://voidlinux.org/
[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os8Debonaire.jpg?resize=800%2C500&ssl=1
[35]: https://en.wikipedia.org/wiki/Trinity_Desktop_Environment
[36]: https://itsfoss.com/q4os-linux-review/
[37]: https://q4os.org/index.html
[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/mx-linux-19-2-kde.jpg?resize=800%2C452&ssl=1
[39]: https://mxlinux.org/
[40]: https://www.funtoo.org/Welcome
[41]: https://www.lxle.net/
[42]: https://www.linuxliteos.com
[43]: https://zorinos.com/download/15/lite/32/
[44]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/cinnamon-debian-edition.jpg?w=800&ssl=1
[45]: https://www.linuxmint.com/download_lmde.php
[46]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/sparky-linux.jpg?w=800&ssl=1
[47]: https://sparkylinux.org/download/stable/
[48]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/mageia.jpg?w=800&ssl=1
[49]: https://en.wikipedia.org/wiki/Mandriva_Linux
[50]: https://www.mageia.org/en/
[51]: http://puppylinux.com/

View File

@ -0,0 +1,201 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13311-1.html)
[#]: subject: (Getting started with Stratis encryption)
[#]: via: (https://fedoramagazine.org/getting-started-with-stratis-encryption/)
[#]: author: (briansmith https://fedoramagazine.org/author/briansmith/)
Stratis 加密入门
======
![](https://img.linux.net.cn/data/attachment/album/202104/19/094919orzaxwl5axiqqfiu.jpg)
Stratis 在其 [官方网站][2] 上被描述为“_易于使用的 Linux 本地存储管理_”。请看这个 [短视频][3],快速演示基础知识。该视频是在 Red Hat Enterprise Linux 8 系统上录制的。视频中显示的概念也适用于 Fedora 中的 Stratis。
Stratis 2.1 版本引入了对加密的支持。继续阅读以了解如何在 Stratis 中开始加密。
### 先决条件
加密需要 Stratis 2.1 或更高版本。这篇文章中的例子使用的是 Fedora 33 的预发布版本。Stratis 2.1 将用在 Fedora 33 的最终版本中。
你还需要至少一个可用的块设备来创建一个加密池。下面的例子是在 KVM 虚拟机上完成的,虚拟磁盘驱动器为 5GB`/dev/vdb`)。
### 在内核密钥环中创建一个密钥
Linux 内核<ruby>密钥环<rt>keyring</rt></ruby>用于存储加密密钥。关于内核密钥环的更多信息,请参考 `keyrings` 手册页(`man keyrings`)。  
使用 `stratis key set` 命令在内核钥匙圈中设置密钥。你必须指定从哪里读取密钥。要从标准输入中读取密钥,使用 `-capture-key` 选项。要从文件中读取密钥,使用 `-keyfile-path <file>` 选项。最后一个参数是一个密钥描述。它将稍后你创建加密的 Stratis 池时使用。
例如,要创建一个描述为 `pool1key` 的密钥,并从标准输入中读取密钥,可以输入:
```
# stratis key set --capture-key pool1key
Enter desired key data followed by the return key:
```
该命令提示我们输入密钥数据/密码,然后密钥就创建在内核密钥环中了。
要验证密钥是否已被创建,运行 `stratis key list`
```
# stratis key list
Key Description
pool1key
```
这将验证是否创建了 `pool1key`。请注意,这些密钥不是持久的。如果主机重启,在访问加密的 Stratis 池之前,需要再次提供密钥(此过程将在后面介绍)。
如果你有多个加密池,它们可以有一个单独的密钥,也可以共享同一个密钥。
也可以使用以下 `keyctl` 命令查看密钥:
```
# keyctl get_persistent @s
318044983
# keyctl show
Session Keyring
701701270 --alswrv 0 0 keyring: _ses
649111286 --alswrv 0 65534 \_ keyring: _uid.0
318044983 ---lswrv 0 65534 \_ keyring: _persistent.0
1051260141 --alswrv 0 0 \_ user: stratis-1-key-pool1key
```
### 创建加密的 Stratis 池
现在已经为 Stratis 创建了一个密钥,下一步是创建加密的 Stratis 池。加密池只能在创建池时进行。目前不可能对现有的池进行加密。
使用 `stratis pool create` 命令创建一个池。添加 `-key-desc` 和你在上一步提供的密钥描述(`pool1key`)。这将向 Stratis 发出信号,池应该使用提供的密钥进行加密。下面的例子是在 `/dev/vdb` 上创建 Stratis 池,并将其命名为 `pool1`。确保在你的系统中指定一个空的/可用的设备。
```
# stratis pool create --key-desc pool1key pool1 /dev/vdb
```
你可以使用 `stratis pool list` 命令验证该池是否已经创建:
```
# stratis pool list
Name Total Physical Properties
pool1 4.98 GiB / 37.63 MiB / 4.95 GiB ~Ca, Cr
```
在上面显示的示例输出中,`~Ca` 表示禁用了缓存(`~` 否定了该属性)。`Cr` 表示启用了加密。请注意,缓存和加密是相互排斥的。这两个功能不能同时启用。
接下来,创建一个文件系统。下面的例子演示了创建一个名为 `filesystem1` 的文件系统,将其挂载在 `/filesystem1` 挂载点上,并在新文件系统中创建一个测试文件:
```
# stratis filesystem create pool1 filesystem1
# mkdir /filesystem1
# mount /stratis/pool1/filesystem1 /filesystem1
# cd /filesystem1
# echo "this is a test file" > testfile
```
### 重启后访问加密池
当重新启动时,你会发现 Stratis 不再显示你的加密池或它的块设备:
```
# stratis pool list
Name Total Physical Properties
```
```
# stratis blockdev list
Pool Name Device Node Physical Size Tier
```
要访问加密池,首先要用之前使用的相同的密钥描述和密钥数据/口令重新创建密钥:
```
# stratis key set --capture-key pool1key
Enter desired key data followed by the return key:
```
接下来,运行 `stratis pool unlock` 命令,并验证现在可以看到池和它的块设备:
```
# stratis pool unlock
# stratis pool list
Name Total Physical Properties
pool1 4.98 GiB / 583.65 MiB / 4.41 GiB ~Ca, Cr
# stratis blockdev list
Pool Name Device Node Physical Size Tier
pool1 /dev/dm-2 4.98 GiB Data
```
接下来,挂载文件系统并验证是否可以访问之前创建的测试文件:
```
# mount /stratis/pool1/filesystem1 /filesystem1/
# cat /filesystem1/testfile
this is a test file
```
### 使用 systemd 单元文件在启动时自动解锁 Stratis 池
可以在启动时自动解锁 Stratis 池,无需手动干预。但是,必须有一个包含密钥的文件。在某些环境下,将密钥存储在文件中可能会有安全问题。
下图所示的 systemd 单元文件提供了一个简单的方法来在启动时解锁 Stratis 池并挂载文件系统。欢迎提供更好的/替代方法的反馈。你可以在文章末尾的评论区提供建议。
首先用下面的命令创建你的密钥文件。确保用之前输入的相同的密钥数据/密码来代替`passphrase`。
```
# echo -n passphrase > /root/pool1key
```
确保该文件只能由 root 读取:
```
# chmod 400 /root/pool1key
# chown root:root /root/pool1key
```
`/etc/systemd/system/stratis-filesystem1.service` 创建包含以下内容的 systemd 单元文件:
```
[Unit]
Description = stratis mount pool1 filesystem1 file system
After = stratisd.service
[Service]
ExecStartPre=sleep 2
ExecStartPre=stratis key set --keyfile-path /root/pool1key pool1key
ExecStartPre=stratis pool unlock
ExecStartPre=sleep 3
ExecStart=mount /stratis/pool1/filesystem1 /filesystem1
RemainAfterExit=yes
[Install]
WantedBy = multi-user.target
```
接下来,启用服务,使其在启动时运行:
```
# systemctl enable stratis-filesystem1.service
```
现在重新启动并验证 Stratis 池是否已自动解锁,其文件系统是否已挂载。
### 结语
在今天的环境中,加密是很多人和组织的必修课。本篇文章演示了如何在 Stratis 2.1 中启用加密功能。
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/getting-started-with-stratis-encryption/
作者:[briansmith][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/briansmith/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/stratis-encryption-2-816x345.jpg
[2]: https://stratis-storage.github.io/
[3]: https://www.youtube.com/watch?v=CJu3kmY-f5o

View File

@ -0,0 +1,213 @@
[#]: collector: (lujun9972)
[#]: translator: (stevenzdg988)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13329-1.html)
[#]: subject: (9 Open Source Forum Software That You Can Deploy on Your Linux Servers)
[#]: via: (https://itsfoss.com/open-source-forum-software/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
11 个可以部署在 Linux 服务器上的开源论坛软件
======
> 是否想要建立社区论坛或客户支持门户站点?以下是一些可以在服务器上部署的最佳开源论坛软件。
就像我们的论坛一样,重要的是建立一个让志趣相投的人可以讨论,互动和寻求支持的平台。
论坛为用户(或客户)提供了一个空间,让他们可以接触到在互联网上大多数情况下不容易找到的东西。
如果你是一家企业,则可以聘请开发人员团队并按照自己的方式建立自己的论坛,但这会增加大量预算。
幸运的是,有几个令人印象深刻的开源论坛软件,你只需要将其部署在你的服务器上就万事大吉了!在此过程中,你将节省很多钱,但仍能获得所需的东西。
在这里,我列出了可以在 Linux 服务器上安装的最佳开源论坛软件列表。
### 建立社区门户的最佳开源论坛软件
![][2]
如果你尚未建立过网站,则在部署论坛之前,可能需要看一下 [某些开源网站创建工具][3]。
**注意:** 此列表没有特定的排名顺序。
#### 1、Discourse现代、流行
![][4]
[Discourse][7] 是人们用来部署配置讨论平台的最流行的现代论坛软件。实际上,[It's FOSS 社区][1] 论坛使用了 Discourse 平台。
它提供了我所知道的大多数基本功能包括电子邮件通知、审核工具、样式自定义选项Slack/WordPress 等第三方集成等等。
它的自托管是完全免费的,你也可以在 [GitHub][5] 上找到该项目。如果你要减少将其部署在自托管服务器上的麻烦,可以选择 [Discourse 提供的托管服务][6](肯定会很昂贵)。
#### 2、Talkyard受 Discourse 和 StackOverflow 启发)
![][8]
[Talkyard][10] 是完全免费使用的,是一个开源项目。它看起来很像 Discourse但是如果你深入了解一下还是有区别的。
你可以在这里获得 StackOverflow 的大多数关键功能,以及在论坛平台上期望得到的所有基本功能。它可能不是一个流行的论坛解决方案,但是如果你想要类似于 Discourse 的功能以及一些有趣的功能,那么值得尝试一下。
你可以在他们的 [GitHub 页面][9] 中进一步了解它。
#### 3、Forem (一种独特的社区平台,正在测试中)
![](https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/12/dev-community-forem.png?w=800&ssl=1)
你可能以前没有听说过 [Forem](https://www.forem.com/),但它支持了 [dev.to](https://dev.to/)(这是一个越来越受欢迎的开发者社区网站)。
它仍然处于测试阶段,所以你或许不会选择在生产服务器上实验。但是,你可以通过在他们的官方网站上填写一个表格并与他们取得联系,让他们为你托管。
尽管没有官方的功能列表来强调所有的东西,但如果我们以 [dev.to](https://dev.to/) 为例,你会得到许多基本的特性和功能,如社区列表、商店、帖子格式化等。你可以在他们的 [公告帖子](https://dev.to/devteam/for-empowering-community-2k6h) 中阅读更多关于它提供的内容,并在 [GitHub](https://github.com/forem/forem) 上探索该项目。
#### 4、NodeBB现代化、功能齐全
![][11]
[NodeBB][14] 是一个基于 [Node.js][12] 的开源论坛软件。它的目标是简单、优雅和快速。首先,它面向有托管计划的组织和企业。但是,你也可以选择自己托管它。
你还可以获得实时本地分析功能,以及聊天和通知支持。它还提供一个 API可以将其与你的现有产品集成。它还支持审核工具和打击垃圾邮件的工具。
你可以获得一些开箱即用的第三方集成支持,例如 WordPress、Mailchimp 等。
请在他们的 [GitHub 页面][13] 或官方网站上可以进一步了解它。
#### 5、Vanilla 论坛(面向企业)
![][15]
[Vanilla 论坛][17] 主要是一款以企业为中心的论坛软件,它的基本功能是为你的平台打造品牌,为客户提供问答,还可以对帖子进行投票。
用户体验具有现代的外观,并且已被像 EA、Adobe 和其他一些大公司使用。
当然,如果你想尝试基于云的 Vanilla 论坛(由专业团队管理)以及对某些高级功能的访问权,可以随时申请演示。无论哪种情况,你都可以选择社区版,该社区版可以免费使用大多数最新功能,但需要自己托管和管理。
你可以在他们的官方网站和 [GitHub 页面][16] 上进一步了解它。
#### 6、bbPress (来自 WordPress
![][20]
[bbPress][22] 是一个可靠的论坛软件,由 WordPress 的创建者建立。旨在提供一个简单而迅速的论坛体验。
用户界面看起来很老旧,但易于使用,它提供了你通常在论坛软件中需要的基本功能。审核工具很好用,易于设置。你可以使用现有的插件扩展功能,并从几个可用的主题中进行选择以调整论坛的外观。
如果你只想要一个没有花哨功能的简单论坛平台bbPress 应该是完美的。你也可以查看他们的 [GitHub 页面][21] 了解更多信息。
#### 7、phpBB经典论坛软件
![][23]
如果你想要传统的论坛设计,只想要基本功能,则 [phpBB][25] 软件是一个不错的选择。当然,你可能无法获得最佳的用户体验或功能,但是作为按传统设计的论坛平台,它是实用的并且非常有效。
尤其是,对于习惯使用传统方式的用户而言,这将是一种简单而有效的解决方案。
不仅仅是简单,而且在一般的托管供应商那里,它的设置也是非常容易的。在任何共享主机平台上,你都能获得一键式安装功能,因此也不需要太多的技术知识来进行设置。
你可以在他们的官方网站或 [GitHub 页面][24] 上找到更多有关它的信息。
#### 8、Simple Machines 论坛(另一个经典)
![][26]
与 phpBB 类似,[Simple Machines 论坛][27] 是另一种基本(或简单)的论坛。很大程度上你可能无法自定义外观(至少不容易),但是默认外观是干净整洁的,提供了良好的用户体验。
就个人而言,相比 php BB 我更喜欢它,但是你可以前往他们的 [官方网站][27] 进行进一步的探索。同样,你可以使用一键安装方法在任何共享托管服务上轻松安装 Simple Machines 论坛。
#### 9、FluxBB古典
![][28]
[FluxBB][30] 是另一个简单、轻量级的开源论坛。与其他的相比,它可能维护的不是非常积极,但是如果你只想部署一个只有很少几个用户的基本论坛,则可以轻松尝试一下。
你可以在他们的官方网站和 [GitHub 页面][29] 上找到更多有关它的信息。
#### 10、MyBB不太流行但值得看看
![][31]
[MyBB][33] 是一款独特的开源论坛软件,它提供多种样式,并包含你需要的基本功能。
从插件支持和审核工具开始,你将获得管理大型社区所需的一切。它还支持类似于 Discourse 和同类论坛软件面向个人用户的私人消息传递。
它可能不是一个流行的选项,但是它可以满足大多数用例,并且完全免费。你可以在 [GitHub][32] 上得到支持和探索这个项目。
#### 11、Flarum测试版
![][34]
如果你想要更简单和独特的论坛,请看一下 [Flarum][37]。它是一款轻量级的论坛软件,旨在以移动为先,同时提供快速的体验。
它支持某些第三方集成,也可以使用扩展来扩展功能。就我个人而言,它看起来很漂亮。我没有机会尝试它,你可以看一下它的 [文档][35],可以肯定它具有论坛所需的所有必要功能的特征。
值得注意的是 Flarum 是相当新的,因此仍处于测试阶段。你可能需要先将其部署在测试服务器上测试后,再应用到生产环境。请查看其 [GitHub 页面][36] 了解更多详细信息。
#### 补充Lemmy更像是 Reddit 的替代品,但也是一个不错的选择)
![](https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/12/lemmy-forum.png?w=800&ssl=1)
一个用 [Rust](https://www.rust-lang.org/) 构建的 Reddit 的联盟式论坛的替代品。它的用户界面很简单,有些人可能觉得它不够直观,无法获得有吸引力的论坛体验。
其联盟网络仍在构建中,但如果你想要一个类似 Reddit 的社区平台,你可以很容易地将它部署在你的 Linux 服务器上,并制定好管理规则、版主,然后就可以开始了。它支持跨版发帖(参见 Reddit以及其他基本功能如标签、投票、用户头像等。
你可以通过其 [官方文档](https://lemmy.ml/docs/about.html) 和 [GitHub 页面](https://github.com/LemmyNet/lemmy) 探索更多信息。
### 总结
大多数开源论坛软件都为基本用例提供了几乎相同的功能。如果你正在寻找特定的功能,则可能需要浏览其文档。
就个人而言,我推荐 Discourse。它很流行外观现代拥有大量的用户基础。
你认为最好的开源论坛软件是什么?我是否错过了你的偏爱?在下面的评论中让我知道。
--------------------------------------------------------------------------------
via: https://itsfoss.com/open-source-forum-software/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[stevenzdg988](https://github.com/stevenzdg988)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.community/
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/12/open-source-forum-software.png?resize=800%2C450&ssl=1
[3]: https://itsfoss.com/open-source-cms/
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/itsfoss-community-discourse.jpg?resize=800%2C561&ssl=1
[5]: https://github.com/discourse/discourse
[6]: https://discourse.org/buy
[7]: https://www.discourse.org/
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/talkyard-forum.jpg?resize=800%2C598&ssl=1
[9]: https://github.com/debiki/talkyard
[10]: https://www.talkyard.io/
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/nodebb.jpg?resize=800%2C369&ssl=1
[12]: https://nodejs.org/en/
[13]: https://github.com/NodeBB/NodeBB
[14]: https://nodebb.org/
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/vanilla-forums.png?resize=800%2C433&ssl=1
[16]: https://github.com/Vanilla
[17]: https://vanillaforums.com/en/
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/open-source-eCommerce.png?fit=800%2C450&ssl=1
[19]: https://itsfoss.com/open-source-ecommerce/
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/bbpress.jpg?resize=800%2C552&ssl=1
[21]: https://github.com/bbpress
[22]: https://bbpress.org/
[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/phpBB.png?resize=798%2C600&ssl=1
[24]: https://github.com/phpbb/phpbb
[25]: https://www.phpbb.com/
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/simplemachines.jpg?resize=800%2C343&ssl=1
[27]: https://www.simplemachines.org/
[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/FluxBB.jpg?resize=800%2C542&ssl=1
[29]: https://github.com/fluxbb/fluxbb/
[30]: https://fluxbb.org/
[31]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/mybb-example.png?resize=800%2C461&ssl=1
[32]: https://github.com/mybb/mybb
[33]: https://mybb.com/
[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/flarum-screenshot.png?resize=800%2C503&ssl=1
[35]: https://docs.flarum.org/
[36]: https://github.com/flarum
[37]: https://flarum.org/
[38]: https://highoncloud.com/

View File

@ -0,0 +1,134 @@
[#]: collector: (lujun9972)
[#]: translator: (tt67wq)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13292-1.html)
[#]: subject: (Program a simple game with Elixir)
[#]: via: (https://opensource.com/article/20/12/elixir)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
使用 Elixir 语言编写一个小游戏
======
> 通过编写“猜数字”游戏来学习 Elixir 编程语言,并将它与一个你熟知的语言做对比。
![](https://img.linux.net.cn/data/attachment/album/202104/12/223351t68886wmza1m9jnt.jpg)
为了更好的学习一门新的编程语言,最好的方法是去关注主流语言的一些共有特征:
* 变量
* 表达式
* 语句
这些概念是大多数编程语言的基础。因为这些相似性,只要你通晓了一门编程语言,你可以通过对比差异来熟知另一门编程语言。
另外一个学习新编程语言的好方法是开始编写一个简单标准的程序。它可以让你集中精力在语言上而非程序的逻辑本身。在这个系列的文章中,我们使用“猜数字”程序来实现,在这个程序中,计算机会选择一个介于 1 到 100 之间的数字,并要求你来猜测它。程序会循环执行,直到你正确猜出该数字为止。
“猜数字”这个程序使用了编程语言的以下概念:
* 变量
* 输入
* 输出
* 条件判断
* 循环
这是一个学习新编程语言的绝佳实践。
### 猜数字的 Elixir 实现
[Elixir][2] 是一门被设计用于构建稳定可维护应用的动态类型的函数式编程语言。它与 [Erlang][3] 运行于同一虚拟机之上,吸纳了 Erlang 的众多长处的同时拥有更加简单的语法。
你可以编写一个 Elixir 版本的“猜数字”游戏来体验这门语言。
这是我的实现方法:
```
defmodule Guess do
def guess() do
random = Enum.random(1..100)
IO.puts "Guess a number between 1 and 100"
Guess.guess_loop(random)
end
def guess_loop(num) do
data = IO.read(:stdio, :line)
{guess, _rest} = Integer.parse(data)
cond do
guess < num ->
IO.puts "Too low!"
guess_loop(num)
guess > num ->
IO.puts "Too high!"
guess_loop(num)
true ->
IO.puts "That's right!"
end
end
end
Guess.guess()
```
Elixir 通过列出变量的名称后面跟一个 `=` 号来为了给变量分配一个值。举个例子,表达式 `random = 0``random` 变量分配一个数值 0。
代码以定义一个模块开始。在 Elixir 语言中,只有模块可以包含命名函数。
紧随其后的这行代码定义了入口函数 `guess()`,这个函数:
* 调用 `Enum.random()` 函数来获取一个随机整数
* 打印游戏提示
* 调用循环执行的函数
剩余的游戏逻辑实现在 `guess_loop()` 函数中。
`guess_loop()` 函数利用 [尾递归][4] 来实现循环。Elixir 中有好几种实现循环的方法,尾递归是比较常用的一种方式。`guess_loop()` 函数做的最后一件事就是调用自身。
`guess_loop()` 函数的第一行读取用户输入。下一行调用 `parse()` 函数将输入转换成一个整数。
`cond` 表达式是 Elixir 版本的多重分支表达式。与其他语言中的 `if/elif` 或者 `if/elsif` 表达式不同Elixir 对于的首个分支或者最后一个没有分支并没有区别对待。
这个 `cond` 表达式有三路分支:猜测的结果可以比随机数大、小或者相等。前两个选项先输出不等式的方向然后递归调用 `guess_loop()`,循环返回至函数开始。最后一个选项输出 `That's right`,然后这个函数就完成了。
### 输出例子
现在你已经编写了你的 Elixir 代码你可以运行它来玩“猜数字”的游戏。每次你执行这个程序Elixir 会选择一个不同的随机数,你可以一直猜下去直到你找到正确的答案:
```
$ elixir guess.exs
Guess a number between 1 and 100
50
Too high
30
Too high
20
Too high
10
Too low
15
Too high
13
Too low
14
That's right!
```
“猜数字”游戏是一个学习一门新编程语言的绝佳入门程序,因为它用了非常直接的方法实践了常用的几个编程概念。通过用不同语言实现这个简单的小游戏,你可以实践各个语言的核心概念并且比较它们的细节。
你是否有你最喜爱的编程语言?你将怎样用它来编写“猜数字”这个游戏?关注这个系列的文章来看看其他你可能感兴趣的语言实现。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/12/elixir
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[tt67wq](https://github.com/tt67wq)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dice_tabletop_board_gaming_game.jpg?itok=y93eW7HN (A die with rainbow color background)
[2]: https://elixir-lang.org/
[3]: https://www.erlang.org/
[4]: https://en.wikipedia.org/wiki/Tail_call

View File

@ -0,0 +1,103 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13337-1.html)
[#]: subject: (How to Add Fingerprint Login in Ubuntu and Other Linux Distributions)
[#]: via: (https://itsfoss.com/fingerprint-login-ubuntu/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
如何在 Ubuntu 中添加指纹登录
======
![](https://img.linux.net.cn/data/attachment/album/202104/26/191530msmenm3ges3kgyet.jpg)
现在很多高端笔记本都配备了指纹识别器。Windows 和 macOS 支持指纹登录已经有一段时间了。在桌面 Linux 中,对指纹登录的支持更多需要极客的调整,但 [GNOME][1] 和 [KDE][2] 已经开始通过系统设置来支持它。
这意味着在新的 Linux 发行版上,你可以轻松使用指纹识别。在这里我将在 Ubuntu 中启用指纹登录,但你也可以在其他运行 GNOME 3.38 的发行版上使用这些步骤。
> **前提条件**
>
> 当然,这是显而易见的。你的电脑必须有一个指纹识别器。
>
> 这个方法适用于任何运行 GNOME 3.38 或更高版本的 Linux 发行版。如果你不确定,你可以[检查你使用的桌面环境版本][3]。
>
> KDE 5.21 也有一个指纹管理器。当然,截图看起来会有所不同。
### 在 Ubuntu 和其他 Linux 发行版中添加指纹登录功能
进入 “设置”,然后点击左边栏的 “用户”。你应该可以看到系统中所有的用户账号。你会看到几个选项,包括 “指纹登录”。
点击启用这里的指纹登录选项。
![Enable fingerprint login in Ubuntu][4]
它将立即要求你扫描一个新的指纹。当你点击 “+” 号来添加指纹时,它会提供一些预定义的选项,这样你就可以很容易地识别出它是哪根手指或拇指。
当然,你可以点击右手食指但扫描左手拇指,不过我看不出你有什么好的理由要这么做。
![Adding fingerprint][5]
在添加指纹时,请按照指示旋转你的手指或拇指。
![Rotate your finger][6]
系统登记了整个手指后,就会给你一个绿色的信号,表示已经添加了指纹。
![Fingerprint successfully added][7]
如果你想马上测试一下,在 Ubuntu 中按 `Super+L` 快捷键锁定屏幕,然后使用指纹进行登录。
![Login With Fingerprint in Ubuntu][8]
#### 在 Ubuntu 上使用指纹登录的经验
指纹登录顾名思义就是使用你的指纹来登录系统。就是这样。当要求对需要 `sudo` 访问的程序进行认证时,你不能使用手指。它不能代替你的密码。
还有一件事。指纹登录可以让你登录,但当系统要求输入 `sudo` 密码时你不能用手指。Ubuntu 中的 [钥匙环][9] 也仍然是锁定的。
另一件烦人的事情是因为 GNOME 的 GDM 登录界面。当你登录时,你必须先点击你的账户才能进入密码界面。你在这可以使用手指。如果能省去先点击用户帐户 ID 的麻烦就更好了。
我还注意到,指纹识别没有 Windows 中那么流畅和快速。不过,它可以使用。
如果你对 Linux 上的指纹登录有些失望,你可以禁用它。让我在下一节告诉你步骤。
### 禁用指纹登录
禁用指纹登录和最初启用指纹登录差不多。
进入 “设置→用户”,然后点击指纹登录选项。它会显示一个有添加更多指纹或删除现有指纹的页面。你需要删除现有的指纹。
![Disable Fingerprint Login][10]
指纹登录确实有一些好处,特别是对于我这种懒人来说。我不用每次锁屏时输入密码,我也对这种有限的使用感到满意。
用 [PAM][11] 启用指纹解锁 `sudo` 应该不是完全不可能。我记得我 [在 Ubuntu 中设置脸部解锁][12]时,也可以用于 `sudo`。看看以后的版本是否会增加这个功能吧。
你有带指纹识别器的笔记本吗?你是否经常使用它,或者它只是你不关心的东西之一?
--------------------------------------------------------------------------------
via: https://itsfoss.com/fingerprint-login-ubuntu/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.gnome.org/
[2]: https://kde.org/
[3]: https://itsfoss.com/find-desktop-environment/
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/02/enable-fingerprint-ubuntu.png?resize=800%2C607&ssl=1
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/adding-fingerprint-login-ubuntu.png?resize=800%2C496&ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/adding-fingerprint-ubuntu-linux.png?resize=800%2C603&ssl=1
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/fingerprint-added-ubuntu.png?resize=797%2C510&ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/login-with-fingerprint-ubuntu.jpg?resize=800%2C320&ssl=1
[9]: https://itsfoss.com/ubuntu-keyring/
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/02/disable-fingerprint-login.png?resize=798%2C524&ssl=1
[11]: https://tldp.org/HOWTO/User-Authentication-HOWTO/x115.html
[12]: https://itsfoss.com/face-unlock-ubuntu/

View File

@ -0,0 +1,68 @@
[#]: collector: (lujun9972)
[#]: translator: (max27149)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13284-1.html)
[#]: subject: (5 benefits of choosing Linux)
[#]: via: (https://opensource.com/article/21/2/linux-choice)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
选择 Linux 的五大好处
======
> Linux 的一大优点是多样化选择选择激发了用户之间自由分享想法和解决方案。Linux 将如何激发你为这个社区做出贡献呢?
![](https://img.linux.net.cn/data/attachment/album/202104/10/131305ei6yyuyujui9fkkr.jpg)
到了 2021 年,人​​们比以往任何时候都更有理由喜欢 Linux。在本系列中我将分享 21 个使用 Linux 的理由。本文讨论选择 Linux 带来的好处。
_选择_ 是 Linux 中被误解最深的特性之一。这种误解从可被选择的 Linux 发行版数量就开始了。Distrowatch.org 报告了数百种可用的和活跃的 Linux 发行版。当然,在这些发行版当中,许多都是业余爱好项目或者针对某些晦涩需求的特别版。因为是开源的,所以实际上,任何人都可以“重新设计”或“重新混搭”现有的 Linux 发行版,赋予一个新名称,提供一个新的默认墙纸,然后称其为自己的作品。尽管这些修改似乎微不足道,但我认为这显示了 Linux 的一些特别之处。
### 灵感
Linux 似乎一直在启迪着人们,从了解它的那一刻起,到创造出自己的版本。
有数十家公司花费数百万美元来从他们自己的产品中获取灵感。商业技术广告试着强硬地说服你,只要你购买某种产品,你就会与所关心的人建立更多的联系,更具创造力、更加充满活力。这些广告用 4k 视频拍摄,焦点柔和,并在欢快振奋的音乐节奏下播放,试图说服人们不仅购买而且还要支持和宣传该公司的产品。
当然Linux 基本没有营销预算,因为 Linux 是个形形色色的大集合,*没有固定实体*。然而,当人们发现它的存在时候,他们似乎就被启发着去构建属于自己的版本。
灵感的数量很难量化,但是它显然很有价值,要不然那些公司不会花钱来尝试创造灵感。
### 革新
灵感,无论给它标价有多难,它都因它的生产创造而有价值。许多 Linux 用户受启发来为各种奇怪问题定制解决方案。我们解决的大多数问题,对于其他大部分人而言,似乎微不足道:也许你使用 [Seeed 微控制器][2] 来监控番茄植株土壤的水分含量;或者你使用脚本来搜索 Python 软件包的索引,因为你总是会忘记每天导入的库的名称;或者设置了自动清理下载文件夹,因为将文件图标拖进回收站这个活儿干太多了。不管你在使用 Linux 的过程中,为自己解决过什么问题,都是这个平台包含的特性之一,你被这个正在运行中的开放的技术所启发,使其更好地服务于你自己。
### 开放策略
诚然,不论是灵感,还是创新,都不能算 Linux 独有的属性。其他平台也确实让我们激发灵感,我们也以或大或小的方式进行创新。运算能力已在很大程度上拉平了操作系统的竞争领域,你在一个操作系统上可以完成的任何事,在另一个操作系统上或许都能找到对应的方法来完成。
但是许多用户发现Linux 操作系统保留了坚定的开放策略当你尝试可能无人想到过的尝试时Linux 不会阻挡你。这种情况不会也不可能发生在专有的操作系统上,因为无法进入系统层级的某些区域,因为它们本身就是被设计为不开放源码的。有各种独断的封锁。当你完全按照操作系统的期望进行操作时,你不会碰到那些看不见的墙,但是当你心里想着要做一些只对你有意义的事情的时候,你的系统环境可能变得无从适应。
### 小小的选择,大大的意义
并非所有创新都是大的或重要的,但总的来说,它们带来的变化并不小。如今,数百万用户的那些疯狂想法在 Linux 的各个部分中愈发显现。它们存在于 KDE 或 GNOME 桌面的工作方式中,存在于 [31 种不同的文本编辑器][3] 中 —— 每一种都有人喜爱,存在于不计其数的浏览器插件和多媒体应用程序中,存在于文件系统和扩展属性中,以及数以百万行计的 Linux 内核代码中。而且,如果上述功能中的哪怕仅其中一项,能让你每天额外节省下一小时时间,陪家人、朋友或用在自己的业余爱好上,那么按照定义,套用一句老话就是,“改变生活”。
### 在社区中交流
开源的重要组成部分之一是共享工作。共享代码是开源软件中显而易见的、普遍流行的事务,但我认为,分享,可不仅仅是在 Gitlab 做一次提交那么简单。当人们彼此分享着自己的奇思妙想,除了获得有用的代码贡献作为回报外,再无其他动机,我们都认为这是一种馈赠。这与你花钱从某公司购买软件时的感觉非常不同,甚至与得到某公司对外分享他们自己生产的开源代码时的感觉也有很大不同。开源的实质是,由全人类创造,服务于全人类。当知识和灵感可以被自由地分享时,人与人之间就建立了连接,这是市场营销活动无法复制的东西,我认为我们都认同这一点。
### 选择
Linux 并不是唯一拥有很多选择的平台。无论使用哪种操作系统你都可以找到针对同一问题的多种解决方案尤其是在深入研究开源软件的时候。但是Linux 明显的选择水准指示了推动 Linux 前进的因素:诚邀协作。在 Linux 上,有些创造会很快消失,有些会在你家用电脑中保留数年 —— 即便只是执行一些不起眼的自动化任务,然而有一些则非常成功,以至于被其他系统平台借鉴并变得司空见惯。没关系,无论你在 Linux 上创作出什么,都请毫不犹豫地把它加入千奇百怪的选择之中,你永远都不知道它可能会激发到谁的灵感。
---
via: https://opensource.com/article/21/2/linux-choice
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[max27149](https://github.com/max27149)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
[2]: https://opensource.com/article/19/12/seeeduino-nano-review
[3]: https://opensource.com/article/21/1/text-editor-roundup

View File

@ -0,0 +1,160 @@
[#]: subject: (How to use the Linux anacron command)
[#]: via: (https://opensource.com/article/21/2/linux-automation)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13270-1.html)
如何使用 Linux anacron 命令
======
> 与其手动执行重复性的任务,不如让 Linux 为你做。
![](https://img.linux.net.cn/data/attachment/album/202104/06/084133bphrxxeolhoyqr0o.jpg)
在 2021 年,人们有更多的理由喜欢 Linux。在这个系列中我将分享使用 Linux 的 21 个不同理由。自动化是使用 Linux 的最佳理由之一。
我最喜欢 Linux 的一个原因是它愿意为我做工作。我不想执行重复性的任务,这些任务会占用我的时间,或者容易出错,或者我可能会忘记,我安排 Linux 为我做这些工作。
### 为自动化做准备
“自动化”这个词既让人望而生畏,又让人心动。我发现用模块化的方式来处理它是有帮助的。
#### 1、你想实现什么
首先,要知道你想产生什么结果。你是要给图片加水印吗?从杂乱的目录中删除文件?执行重要数据的备份?为自己明确定义任务,这样你就知道自己的目标是什么。如果有什么任务是你发现自己每天都在做的,甚至一天一次以上,那么它可能是自动化的候选者。
#### 2、学习你需要的应用
将大的任务分解成小的组件,并学习如何手动但以可重复和可预测的方式产生每个结果。在 Linux 上可以做的很多事情都可以用脚本来完成,但重要的是要认识到你当前的局限性。学习如何自动调整几张图片的大小,以便可以方便地通过电子邮件发送,与使用机器学习为你的每周通讯生成精心制作的艺术品之间有天壤之别。有的事你可以在一个下午学会,而另一件事可能要花上几年时间。然而,我们都必须从某个地方开始,所以只要从小做起,并时刻注意改进的方法。
#### 3、自动化
在 Linux 上使用一个自动化工具来定期实现它。这就是本文介绍的步骤!
要想自动化一些东西,你需要一个脚本来自动化一个任务。在测试时,最好保持简单,所以本文自动化的任务是在 `/tmp` 目录下创建一个名为 `hello` 的文件。
```
#!/bin/sh
touch /tmp/hello
```
将这个简单的脚本复制并粘贴到一个文本文件中,并将其命名为 `example`
### Cron
每个安装好的 Linux 系统都会有的内置自动化解决方案就是 cron 系统。Linux 用户往往把 cron 笼统地称为你用来安排任务的方法(通常称为 “cron 作业”),但有多个应用程序可以提供 cron 的功能。最通用的是 [cronie][2];它的优点是,它不会像历史上为系统管理员设计的 cron 应用程序那样,假设你的计算机总是开着。
验证你的 Linux 发行版提供的是哪个 cron 系统。如果不是 cronie你可以从发行版的软件仓库中安装 cronie。如果你的发行版没有 cronie 的软件包,你可以使用旧的 anacron 软件包来代替。`anacron` 命令是包含在 cronie 中的,所以不管你是如何获得它的,你都要确保在你的系统上有 `anacron` 命令然后再继续。anacron 可能需要管理员 root 权限,这取决于你的设置。
```
$ which anacron
/usr/sbin/anacron
```
anacron 的工作是确保你的自动化作业定期执行。为了做到这一点anacron 会检查找出最后一次运行作业的时间,然后检查你告诉它运行作业的频率。
假设你将 anacron 设置为每五天运行一次脚本。每次你打开电脑或从睡眠中唤醒电脑时anacron都会扫描其日志以确定是否需要运行作业。如果一个作业在五天或更久之前运行那么 anacron 就会运行该作业。
### Cron 作业
许多 Linux 系统都捆绑了一些维护工作,让 cron 来执行。我喜欢把我的工作与系统工作分开,所以我在我的主目录中创建了一个目录。具体来说,有一个叫做 `~/.local` 的隐藏文件夹“local” 的意思是它是为你的用户账户定制的,而不是为你的“全局”计算机系统定制的),所以我创建了子目录 `etc/cron.daily` 来作为 cron 在我的系统上的家目录。你还必须创建一个 spool 目录来跟踪上次运行作业的时间。
```
$ mkdir -p ~/.local/etc/cron.daily ~/.var/spool/anacron
```
你可以把任何你想定期运行的脚本放到 `~/.local/etc/cron.daily` 目录中。现在把 `example` 脚本复制到目录中,然后 [用 chmod 命令使其可执行][3]。
```
$ cp example ~/.local/etc/cron.daily
# chmod +x ~/.local/etc/cron.daily/example
```
接下来,设置 anacron 来运行位于 `~/.local/etc/cron.daily` 目录下的任何脚本。
### anacron
默认情况下cron 系统的大部分内容都被认为是系统管理员的领域,因为它通常用于重要的底层任务,如轮换日志文件和更新证书。本文演示的配置是为普通用户设置个人自动化任务而设计的。
要配置 anacron 来运行你的 cron 作业,请在 `/.local/etc/anacrontab` 创建一个配置文件:
```
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
1  0  cron.mine    run-parts /home/tux/.local/etc/cron.daily/
```
这个文件告诉 anacron 每到新的一天(也就是每日),延迟 0 分钟后,就运行(`run-parts`)所有在 `~/.local/etc/cron.daily` 中找到的可执行脚本。有时,会使用几分钟的延迟,这样你的计算机就不会在你登录后就被所有可能的任务冲击。不过这个设置适合测试。
`cron.mine` 值是进程的一个任意名称。我称它为 `cron.mine`,但你也可以称它为 `cron.personal``penguin` 或任何你想要的名字。
验证你的 `anacrontab` 文件的语法:
```
$ anacron -T -t ~/.local/etc/anacrontab \
-S /home/tux/.var/spool/anacron
```
沉默意味着成功。
### 在 .profile 中添加 anacron
最后,你必须确保 anacron 以你的本地配置运行。因为你是以普通用户而不是 root 用户的身份运行 anacron所以你必须将它引导到你的本地配置告诉 anacron 要做什么的 `anacrontab` 文件,以及帮助 anacron 跟踪每一个作业最后一次执行是多少天的 spool 目录:
```
anacron -fn -t /home/tux/.local/etc/anacrontab \
-S /home/tux/.var/spool/anacron
```
`-fn` 选项告诉 anacron *忽略* 时间戳,这意味着你强迫它无论如何都要运行你的 cron 作业。这完全是为了测试的目的。
### 测试你的 cron 作业
现在一切都设置好了,你可以测试作业了。从技术上讲,你可以在不重启的情况下进行测试,但重启是最有意义的,因为这就是设计用来处理中断和不规则的登录会话的。花点时间重启电脑、登录,然后寻找测试文件:
```
$ ls /tmp/hello
/tmp/hello
```
假设文件存在,那么你的示例脚本已经成功执行。现在你可以从 `~/.profile` 中删除测试选项,留下这个作为你的最终配置。
```
anacron -t /home/tux/.local/etc/anacrontab \
-S /home/tux/.var/spool/anacron
```
### 使用 anacron
你已经配置好了你的个人自动化基础设施,所以你可以把任何你想让你的计算机替你管理的脚本放到 `~/.local/etc/cron.daily` 目录下,它就会按计划运行。
这取决于你希望作业运行的频率。示例脚本是每天执行一次。很明显,这取决于你的计算机在任何一天是否开机和醒着。如果你在周五使用电脑,但把它设置在周末,脚本就不会在周六和周日运行。然而,在周一,脚本会执行,因为 anacron 会知道至少有一天已经过去了。你可以在 `~/.local/etc` 中添加每周、每两周、甚至每月的目录,以安排各种各样的间隔。
要添加一个新的时间间隔:
1. 在 `~/.local/etc` 中添加一个目录(例如 `cron.weekly`)。
2. 在 `~/.local/etc/anacrontab` 中添加一行,以便在新目录下运行脚本。对于每周一次的间隔,其配置如下。`7 0 cron.mine run-parts /home/tux/.local/etc/cron.weekly/``0` 的值可以选择一些分钟数,以适当地延迟脚本的启动)。
3. 把你的脚本放在 `cron.weekly` 目录下。
欢迎来到自动化的生活方式。它不会让人感觉到,但你将会变得更有效率。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/2/linux-automation
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt)
[2]: https://github.com/cronie-crond/cronie
[3]: https://opensource.com/article/19/8/linux-chmod-command

View File

@ -0,0 +1,73 @@
[#]: subject: (5 signs you might be a Rust programmer)
[#]: via: (https://opensource.com/article/21/3/rust-programmer)
[#]: author: (Mike Bursell https://opensource.com/users/mikecamel)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13280-1.html)
你可能是 Rust 程序员的五个迹象
======
> 在我学习 Rust 的过程中,我注意到了 Rust 一族的一些常见行为。
![](https://img.linux.net.cn/data/attachment/album/202104/08/233233asbjasbfuiuosiha.jpg)
我是最近才 [皈依 Rust][2] 的,我大约在是 2020 年 4 月底开始学习的。但是,像许多皈依者一样,我还是一个热情的布道者。说实话,我也不是一个很好的 Rust 人,因为我的编码风格不是很好,我写的也不是特别符合 Rust 习惯。我猜想这一方面是因为我在写大量代码之前还没有没有真正学完 Rust其中一些代码又困扰了我另一方面是因为我并不是那么优秀的程序员。
但我喜欢 Rust你也应该喜欢吧。它很友好比 C 或 C++ 更友好;它为低级系统任务做好了准备,这比 Python 做的更好;而且结构良好,这要超过 Perl而且最重要的是从设计层面开始它就是完全开源的这要比 Java 那些语言好得多。
尽管我缺乏专业知识,但我注意到了一些我认为是许多 Rust 爱好者和程序员的共同点。如果你对以下五个迹象点头(其中第一个迹象是由最近的一些令人兴奋的新闻引发的),那么你也可能是一个 Rust 程序员。
### 1、“基金会”一词会使你兴奋
对于 Rust 程序员来说,“基金会”一词将不再与<ruby>艾萨克·阿西莫夫<rt>Isaac Asimov</rt></ruby>关联在一起,而是与新成立的 [Rust 基金会][3] 关联。微软、华为、谷歌、AWS 和Mozilla 为该基金会提供了董事(大概也提供了大部分初始资金),该基金会将负责该语言的各个方面,“预示着 Rust 成为企业生产级技术的到来”,[根据临时执行董事][4] Ashley Williams 说。(顺便说一句,很高兴看到一位女士领导这样一项重大的行业计划。)
该基金会似乎致力于维护 Rust 的理念并确保每个人都有参与的机会。在许多方面Rust 都是开源项目的典型示例。并不是说它是完美的(无论是语言还是社区),而是因为似乎有足够的爱好者致力于维护高参与度、低门槛的社区方式,我认为这是许多开源项目的核心。我强烈欢迎此举,我认为这只会帮助促进 Rust 在未来数年和数月内的采用和成熟。
### 2、你会因为新闻源中提到 Rust 游戏而感到沮丧
还有一款和电脑有关的东西也叫做“Rust”它是一款“只限多玩家生存类的电子游戏”。它比 Rust 这个语言更新一些2013 年宣布2018 年发布),但我曾经在搜索 Rust 相关的内容时,犯了一个错误,用这个名字搜索了游戏。互联网络就是这样的,这意味着我的新闻源现在被这个另类的 Rust 野兽感染了,我现在会从它的影迷和公关人员那里随机得到一些更新消息。这是个低调的烦恼,但我很确定在 Rust语言社区中并不是就我一个人这样。我强烈建议如果你确实想了解更多关于这个计算世界的后起之秀的信息你可以使用一个提高隐私我拒绝说 "保护隐私")的 [开源浏览器][5] 来进行研究。
### 3、“不安全”这个词会让你感到恐惧。
Rust语言再次强调在帮助你做**正确的事情**™方面做得非常好,当然,在内存安全方面,这是 C 和 C++ 内部的主要关注点不是因为不可能做到而是因为真的很难持续正确。Dave Herman 在 2016 年写了一篇文章《[Safety is Rust's fireflower][6]》,讲述了为什么安全是 Rust 语言的一个积极属性。安全性(内存、类型安全)可能并不赏心悦目,但随着你写的 Rust 越多,你就会习惯并感激它,尤其是当你参与任何系统编程时,这也是 Rust 经常擅长的地方。
现在Rust 并不能阻止你做**错误的事情**™,但它确实通过让你使用 `unsafe` 关键字,让你在希望超出安全边界的时候做出一个明智的决定。这不仅对你有好处,因为它(希望)会让你非常、非常仔细地思考你在任何使用它的代码块中放入了什么;它对任何阅读你的代码的人也有好处,这是一个触发词,它能让任何不太清醒的 Rust 人至少可以稍微打起精神,在椅子上坐直,然后想:“嗯,这里发生了什么?我需要特别注意。”如果幸运的话,读你代码的人也许能想到重写它的方法,使它利用到 Rust 的安全特性,或者至少减少提交和发布的不安全代码的数量。
### 4、你想知道为什么没有 `?;`、`{:?}` 、`::<>` 这样的表情符号
人们喜欢(或讨厌)涡轮鱼(`::<>`),但在 Rust 代码中你经常还会看到其他的语义结构。特别是 `{:?}` (用于字符串格式化)和 `?;``?` 是向调用栈传播错误的一种方式,`;` 则是行/块的结束符,所以你经常会看到它们在一起)。它们在 Rust 代码中很常见,你只需边走边学,边走边解析,而且它们也很有用,我有时会想,为什么它们没有被纳入到正常对话中,至少可以作为表情符号。可能还有其他的。你有什么建议?
### 5、Clippy 是你的朋友(而不是一个动画回形针)
微软的动画回形针 Clippy 可能是 Office 用户很快就觉得讨厌的“功能”,并成为许多 [模因][7] 的起点。另一方面,`cargo clippy` 是那些 [很棒的 Cargo 命令][8] 之一,应该成为每个 Rust 程序员工具箱的一部分。Clippy 是一个语言<ruby>整洁器<rt>Linter</rt></ruby>,它可以帮助改进你的代码,使它更干净、更整洁、更易读、更惯用,让你与同事或其他人分享 Rust 代码时不会感到尴尬。Cargo 可以说是让 “Clippy” 这个名字恢复了声誉,虽然我不会选择给我的孩子起这个名字,但现在每当我在网络上遇到这个词的时候,我不会再有一种不安的感觉。
* * *
这篇文章最初发表在 [Alice, Eve, and Bob] [9]上,经作者许可转载。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/rust-programmer
作者:[Mike Bursell][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mikecamel
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OSDC_IntroOS_520x292_FINAL.png?itok=woiZamgj (name tag that says hello my name is open source)
[2]: https://opensource.com/article/20/6/why-rust
[3]: https://foundation.rust-lang.org/
[4]: https://foundation.rust-lang.org/posts/2021-02-08-hello-world/
[5]: https://opensource.com/article/19/7/open-source-browsers
[6]: https://www.thefeedbackloop.xyz/safety-is-rusts-fireflower/
[7]: https://knowyourmeme.com/memes/clippy
[8]: https://opensource.com/article/20/11/commands-rusts-cargo
[9]: https://aliceevebob.com/2021/02/09/5-signs-that-you-may-be-a-rust-programmer/

View File

@ -0,0 +1,141 @@
[#]: subject: (Cast your Android device with a Raspberry Pi)
[#]: via: (https://opensource.com/article/21/3/android-raspberry-pi)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
[#]: collector: (lujun9972)
[#]: translator: (ShuyRoy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13314-1.html)
将你的安卓手机屏幕投射到 Linux
======
> 使用 Scrcpy 可以把你的手机屏幕变成一个“应用”,与在树莓派或任何其他基于 Linux 的设备上的应用一起运行。
![](https://img.linux.net.cn/data/attachment/album/202104/20/162346alpbh85xz26xcb5h.jpg)
要远离我们日常使用的电子产品是很难的。在熙熙攘攘的现代生活中,我想确保我不会错过手机屏幕上弹出的来自朋友和家人的重要信息。我也很忙,不希望迷失在令人分心的事情中,但是拿起手机并且回复信息往往会使我分心。
更糟糕的是,有很多的设备。幸运地是,大多数的设备(从功能强大的笔记本电脑到甚至不起眼的树莓派)都可以运行 Linux。因为它们运行的是 Linux所以我为一种设置找到的解决方案几乎都适用于其他设备。
### 普遍适用
我想要一种无论我使用什么屏幕,都能统一我生活中不同来源的数据的方法。
我决定通过把手机屏幕复制到电脑上来解决这个问题。本质上,我把手机变成了一个“应用”,可以和我所有的其他程序运行在一起。这有助于我将注意力集中在桌面上,防止我走神,并使我更容易回复紧急通知。
听起来有吸引力吗?你也可以这样做。
### 设置 Scrcpy
[Scrcpy][2] 俗称屏幕复制Screen Copy是一个开源的屏幕镜像工具它可以在 Linux、Windows 或者 macOS 上显示和控制安卓设备。安卓设备和计算机之间的通信主要是通过 USB 连接和<ruby>安卓调试桥<rt>Android Debug Bridge</rt></ruby>ADB。它使用 TCP/IP且不需要 root 权限访问。
Scrcpy 的设置和配置非常简单。如果你正在运行 Fedora你可以从 COPR 仓库安装它:
```
$ sudo dnf copr enable zeno/scrcpy
$ sudo dnf install scrcpy -y
```
在 Debian 或者 Ubuntu 上:
```
$ sudo apt install scrcpy
```
你也可以自己编译 Scrcpy。即使是在树莓派上按照 [Scrcpy 的 GitHub 主页][3] 上的说明来构建也不需要很长时间。
### 设置手机
Scrcpy 安装好后,你必须启用 USB 调试并授权每个设备(你的树莓派、笔记本电脑或者工作站)为受信任的控制器。
打开安卓上的“设置”应用程序。如果“开发者选项”没有被激活,按照安卓的 [说明来解锁它][4]。
接下来启用“USB 调试”。
![Enable USB Debugging option][5]
然后通过 USB 将手机连接到你的树莓派或者笔记本电脑(或者你正在使用的任何设备),如果可以选择的话,将模式设置为 [PTP][7]。如果你的手机不能使用 PTP将你的手机设置为用于传输文件的模式而不是作为一个<ruby>叠接<rt>tethering</rt></ruby>或者 MIDI 设备)。
你的手机可能会提示你授权你的电脑,这是通过它的 RSA 指纹进行识别的。你只需要在你第一次连接的时候操作即可,在之后你的手机会识别并信任你的计算机。
使用 `lsusb` 命令确认设置:
```
$ lsusb
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 011 Device 004: ID 046d:c21d Logitech, Inc. F310 Gamepad
Bus 005 Device 005: ID 0951:1666 Kingston Technology DataTraveler G4
Bus 005 Device 004: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 004 Device 001: ID 18d1:4ee6 Google Inc. Nexus/Pixel Device (PTP + debug)
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
```
然后执行 `scrcpy` 以默认设置运行。
![Scrcpy running on a Raspberry Pi][8]
性能和响应能力取决于你使用什么设备来控制你的手机。在树莓派派上一些动画可能会变慢甚至有时候会响应滞后。Scrcpy 提供了一个简单的解决办法:降低 Scrcpy 显示图像的位速率和分辨率使得你的计算机能够容易显示动画。使用以下命令来实现:
```
$ scrcpy --bit-rate 1M --max-size 800
```
尝试不同的值来找到一个适合你的值。为了使键入更方便,在选定一个命令之后,可以考虑 [创建自己的 Bash 别名][9]。
### 剪断连线
Scrcpy 开始运行后,你甚至可以通过 WiFi 连接你的手机和计算机。Scrcpy 安装过程也会安装 `adb`它是一个与安卓设备通信的命令。Scrcpy 也可以使用这个命令与你的设备通信,`adb` 可以通过 TCP/IP 连接。
![Scrcpy running on a computer][10]
要尝试的话,请确保你的手机通过 WiFi 连在与你的计算机所使用的相同的无线网络上。依然不要断开你的手机与 USB 的连接!
接下来,通过手机中的“设置”,选择“关于手机”来获取你手机的 IP 地址。查看“状态”选项来获得你的地址。它通常是 192.168 或者 10 开头。
或者,你也可以使用 `adb` 来获得你手机的IP地址
```
$ adb shell ip route | awk '{print $9}'
To connect to your device over WiFi, you must enable TCP/IP connections. This, you must do through the adb command:
$ adb tcpip 5555
Now you can disconnect your mobile from USB.
Whenever you want to connect over WiFi, first connect to the mobile with the command adb connect. For instance, assuming my mobile's IP address is 10.1.1.22, the command is:
$ adb connect 10.1.1.22:5555
```
连接好之后,你就可以像往常一样运行 Scrcpy 了。
### 远程控制
Scrcpy 很容易使用。你可以在终端或者 [一个图形界面应用][11] 中尝试它。
你是否在使用其它的屏幕镜像工具?如果有的话,请在评论中告诉我们吧。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/android-raspberry-pi
作者:[Sudeshna Sur][a]
选题:[lujun9972][b]
译者:[ShuyRoy](https://github.com/ShuyRoy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/sudeshna-sur
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone)
[2]: https://github.com/Genymobile/scrcpy
[3]: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md
[4]: https://developer.android.com/studio/debug/dev-options
[5]: https://opensource.com/sites/default/files/uploads/usb-debugging.jpg (Enable USB Debugging option)
[6]: https://creativecommons.org/licenses/by-sa/4.0/
[7]: https://en.wikipedia.org/wiki/Picture_Transfer_Protocol
[8]: https://opensource.com/sites/default/files/uploads/scrcpy-pi.jpg (Scrcpy running on a Raspberry Pi)
[9]: https://opensource.com/article/19/7/bash-aliases
[10]: https://opensource.com/sites/default/files/uploads/ssur-desktop.png (Scrcpy running on a computer)
[11]: https://opensource.com/article/19/9/mirror-android-screen-guiscrcpy

View File

@ -0,0 +1,167 @@
[#]: subject: (My favorite open source project management tools)
[#]: via: (https://opensource.com/article/21/3/open-source-project-management)
[#]: author: (Frank Bergmann https://opensource.com/users/fraber)
[#]: collector: (lujun9972)
[#]: translator: (stevenzdg988)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13344-1.html)
我最喜欢的开源项目管理工具
======
> 如果你要管理大型复杂的项目,请尝试利用开源选择替换 MS-Project。
![](https://img.linux.net.cn/data/attachment/album/202104/29/145942py6qcc3lz1dyt1s6.jpg)
诸如建造卫星、开发机器人或推出新产品之类的项目都是昂贵的,涉及不同的提供商,并且包含必须跟踪的硬依赖性。
大型项目领域中的项目管理方法非常简单(至少在理论上如此)。你可以创建项目计划并将其拆分为较小的部分,直到你可以合理地将成本、持续时间、资源和依赖性分配给各种活动。一旦项目计划获得负责人的批准,你就可以使用它来跟踪项目的执行情况。在时间轴上绘制项目的所有活动将产生一个称为<ruby>[甘特图][2]<rt>Gantt chart</rt></ruby>的条形图。
甘特图一直被用于 [瀑布项目方法][3],也可以用于敏捷方法。例如,大型项目可能将甘特图用于 Scrum 冲刺,而忽略其他像用户需求这样的细节,从而嵌入敏捷阶段。其他大型项目可能包括多个产品版本(例如,最低可行产品 [MVP]、第二版本、第三版本等)。在这种情况下,上层结构是一种敏捷方法,而每个阶段都计划为甘特图,以处理预算和复杂的依赖关系。
### 项目管理工具
不夸张地说,有数百种现成的工具使用甘特图管理大型项目,而 MS-Project 可能是最受欢迎的工具。它是微软办公软件家族的一部分,可支持到成千上万的活动,并且有大量的功能,支持几乎所有可以想象到的管理项目进度的方式。对于 MS-Project有时候你并不知道什么更昂贵是软件许可证还是该工具的培训课程。
另一个缺点是 MS-Project 是一个独立的桌面应用程序,只有一个人可以更新进度表。如果要多个用户进行协作,则需要购买微软 Project 服务器、Web 版的 Project 或 Planner 的许可证。
幸运的是专有工具还有开源的替代品包括本文中提及的应用程序。所有这些都是开源的并且包括基于资源和依赖项的分层活动调度的甘特图。ProjectLibre、GanttProject 和 TaskJuggler 都针对单个项目经理的桌面应用程序。ProjeQtOr 和 Redmine 是用于项目团队的 Web 应用程序,而 ]project-open[ 是用于管理整个组织的 Web 应用程序。
我根据一个单用户计划和对一个大型项目的跟踪评估了这些工具。我的评估标准包括甘特图编辑器功能、Windows/Linux/macOS 上的可用性、可扩展性、导入/导出和报告。(背景披露:我是 ]project-open[ 的创始人,我在多个开源社区中活跃了很多年。此列表包括我们的产品,因此我的观点可能有偏见,但我尝试着眼于每个产品的最佳功能。)
### Redmine 4.1.0
![Redmine][4]
[Redmine][6] 是一个基于 Web 的专注于敏捷方法论的项目管理工具。
其标准安装包括一个甘特图时间轴视图,但缺少诸如调度、拖放、缩进(缩排和凸排)以及资源分配之类的基本功能。你必须单独编辑任务属性才能更改任务树的结构。
Redmine 具有甘特图编辑器插件,但是它们要么已经过时(例如 [Plus Gantt][7]),要么是专有的(例如 [ANKO 甘特图][8])。如果你知道其他开源的甘特图编辑器插件,请在评论中分享它们。
Redmine 用 Ruby on Rails 框架编写,可用于 Windows、Linux 和 macOS。其核心部分采用 GPLv2 许可证。
* **适合于:** 使用敏捷方法的 IT 团队。
* **独特卖点:** 这是 OpenProject 和 EasyRedmine 的原始“上游”父项目。
### ]project-open[ 5.1
![\]project-open\[][9]
[\]project-open\[][10] 是一个基于 Web 的项目管理系统,从整个组织的角度看类似于<ruby>企业资源计划<rt>enterprise resource planning</rt></ruby>ERP系统。它还可以管理项目档案、预算、发票、销售、人力资源和其他功能领域。有一些不同的变体如用于管理项目公司的<ruby>专业服务自动化<rt>professional services automation</rt></ruby>PSA、用于管理企业战略项目的<ruby>项目管理办公室<rt>project management office</rt></ruby>PMO和用于管理部门项目的<ruby>企业项目管理<rt>enterprise project management</rt></ruby>EPM
]project-open[ 甘特图编辑器包括按等级划分的任务、依赖关系和基于计划工作和分配资源的调度。它不支持资源日历和非人力资源。]project-open[ 系统非常复杂,其 GUI 可能需要刷新。
]project-open[ 是用 TCL 和 JavaScript 编写的,可用于 Windows 和 Linux。 ]project-open[ 核心采用 GPLv2 许可证,并具有适用于大公司的专有扩展。
* **适合于:** 需要大量财务项目报告的大中型项目组织。
* **独特卖点:** ]project-open[ 是一个综合系统,可以运行整个项目公司或部门。
### ProjectLibre 1.9.3
![ProjectLibre][11]
在开源世界中,[ProjectLibre][12] 可能是最接近 MS-Project 的产品。它是一个桌面应用程序,支持所有重要的项目计划功能,包括资源日历、基线和成本管理。它还允许你使用 MS-Project 的文件格式导入和导出计划。
ProjectLibre 非常适合计划和执行中小型项目。然而,它缺少 MS-Project 中的一些高级功能,并且它的 GUI 并不是最漂亮的。
ProjectLibre 用 Java 编写,可用于 Windows、Linux 和macOS并在开源的<ruby>通用公共署名许可证<rt>Common Public Attribution License</rt></ruby>CPAL下授权。ProjectLibre 团队目前正在开发一个名为 ProjectLibre Cloud 的 Web 产品,并采用专有许可证。
* **适合于:** 负责中小型项目的个人项目管理者,或者作为没有完整的 MS-Project 许可证的项目成员的查看器。
* **独特卖点:** 这是最接近 MS-Project 的开源软件。
### GanttProject 2.8.11
![GanttProject][13]
[GanttProject][14] 与 ProjectLibre 类似,它是一个桌面甘特图编辑器,但功能集更为有限。它不支持基线,也不支持非人力资源,并且报告功能比较有限。
GanttProject 是一个用 Java 编写的桌面应用程序,可在 GPLv3 许可下用于 Windows、Linux 和 macOS。
* **适合于:** 简单的甘特图或学习基于甘特图的项目管理技术。
* **独特卖点:** 它支持<ruby>流程评估和审阅技术<rt>program evaluation and review technique</rt></ruby>[PERT][15])图表,并使用 WebDAV 的协作。
### TaskJuggler 3.7.1
![TaskJuggler][16]
[TaskJuggler][17] 用于在大型组织中安排多个并行项目,重点是自动解决资源分配冲突(即资源均衡)。
它不是交互式的甘特图编辑器,而是一个命令行工具,其工作方式类似于一个编译器:它从文本文件中读取任务列表,并生成一系列报告,这些报告根据分配的资源、依赖项、优先级和许多其他参数为每个任务提供最佳的开始和结束时间。它支持多个项目、基线、资源日历、班次和时区,并且被设计为可扩展到具有许多项目和资源的企业场景。
使用特定语法编写 TaskJuggler 输入文件可能超出了普通项目经理的能力。但是,你可以使用 ]project-open[ 作为 TaskJuggler 的图形前端来生成输入包括缺勤、任务进度和记录的工作时间。当以这种方式使用时TaskJuggler 就成为了功能强大的假设情景规划器。
TaskJuggler 用 Ruby 编写,并且在 GPLv2 许可证下可用于 Windows、Linux 和 macOS。
* **适合于:** 由真正的技术极客管理的中大型部门。
* **独特卖点:** 它在自动资源均衡方面表现出色。
### ProjeQtOr 9.0.4
![ProjeQtOr][18]
[ProjeQtOr][19] 是适用于 IT 项目的、基于 Web 的项目管理应用程序。除了项目、工单和活动外,它还支持风险、预算、可交付成果和财务文件,以将项目管理的许多方面集成到单个系统中。
ProjeQtOr 提供了一个甘特图编辑器,与 ProjectLibre 功能类似,包括按等级划分的任务、依赖关系以及基于计划工作和分配资源。但是,它不支持取值的就地编辑(例如,任务名称、估计时间等);用户必须在甘特图视图下方的输入表单中更改取值,然后保存。
ProjeQtOr 用 PHP 编写,并且在 Affero GPL3 许可下可用于 Windows、Linux 和 macOS。
* **适合于:** 跟踪项目列表的 IT 部门。
* **独特卖点:** 让你为存储每个项目的大量信息,将所有信息保存在一个地方。
### 其他工具
对于特定的用例,以下系统可能是有效的选择,但由于各种原因,它们被排除在主列表之外。
![LIbrePlan][20]
* [LibrePlan][21] 是一个基于 Web 的项目管理应用程序,专注于甘特图。由于其功能集,它本来会在上面的列表中会占主导地位,但是没有可用于最新 Linux 版本CentOS 7 或 8的安装。作者说更新的说明将很快推出。
* [dotProject][22] 是一个用 PHP 编写的基于 Web 的项目管理系统,可在 GPLv2.x 许可证下使用。它包含一个甘特图时间轴报告,但是没有编辑它的选项,并且依赖项还不起作用(它们“仅部分起作用”)。
* [Leantime][23] 是一个基于 Web 的项目管理系统,具有漂亮的用 PHP 编写的 GUI并且可以在 GPLv2 许可证下使用。它包括一个里程碑的甘特时间线,但没有依赖性。
* [Orangescrum][24] 是基于 Web 的项目管理工具。甘特图图可以作为付费附件或付费订阅使用。
* [Talaia/OpenPPM][25] 是一个基于 Web 的项目组合管理系统。但是,版本 4.6.1 仍显示“即将推出:交互式甘特图”。
* [Odoo][26] 和 [OpenProject][27] 都将某些重要功能限制在付费企业版中。
在这篇评论中,目的是包括所有带有甘特图编辑器和依赖调度的开源项目管理系统。如果我错过了一个项目或误导了什么,请在评论中让我知道。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/open-source-project-management
作者:[Frank Bergmann][a]
选题:[lujun9972][b]
译者:[stevenzdg988](https://github.com/stevenzdg988)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/fraber
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban_trello_organize_teams_520.png?itok=ObNjCpxt (Kanban-style organization action)
[2]: https://en.wikipedia.org/wiki/Gantt_chart
[3]: https://opensource.com/article/20/3/agiles-vs-waterfall
[4]: https://opensource.com/sites/default/files/uploads/redmine.png (Redmine)
[5]: https://creativecommons.org/licenses/by-sa/4.0/
[6]: https://www.redmine.org/
[7]: https://redmine.org/plugins/plus_gantt
[8]: https://www.redmine.org/plugins/anko_gantt_chart
[9]: https://opensource.com/sites/default/files/uploads/project-open.png (]project-open[)
[10]: https://www.project-open.com
[11]: https://opensource.com/sites/default/files/uploads/projectlibre.png (ProjectLibre)
[12]: http://www.projectlibre.org
[13]: https://opensource.com/sites/default/files/uploads/ganttproject.png (GanttProject)
[14]: https://www.ganttproject.biz
[15]: https://en.wikipedia.org/wiki/Program_evaluation_and_review_technique
[16]: https://opensource.com/sites/default/files/uploads/taskjuggler.png (TaskJuggler)
[17]: https://taskjuggler.org/
[18]: https://opensource.com/sites/default/files/uploads/projeqtor.png (ProjeQtOr)
[19]: https://www.projeqtor.org
[20]: https://opensource.com/sites/default/files/uploads/libreplan.png (LIbrePlan)
[21]: https://www.libreplan.dev/
[22]: https://dotproject.net/
[23]: https://leantime.io
[24]: https://orangescrum.org/
[25]: http://en.talaia-openppm.com/
[26]: https://odoo.com
[27]: http://openproject.org

View File

@ -0,0 +1,94 @@
[#]: subject: (Plausible: Privacy-Focused Google Analytics Alternative)
[#]: via: (https://itsfoss.com/plausible/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13283-1.html)
Plausible注重隐私的 Google Analytics 替代方案
======
![](https://img.linux.net.cn/data/attachment/album/202104/10/110720jc8hckngaqr6wch1.jpg)
[Plausible][1]是一款简单的、对隐私友好的分析工具。它可以帮助你分析独立访客数量、页面浏览量、跳出率和访问时间。
如果你有一个网站,你可能会理解这些术语。作为一个网站所有者,它可以帮助你了解你的网站是否随着时间的推移获得更多的访问者,流量来自哪里,如果你对这些事情有一定的了解,你可以努力改进你的网站,以获得更多的访问量。
说到网站分析,统治这个领域的一个服务就是谷歌的免费工具 Google Analytics。就像 Google 是事实上的搜索引擎一样Google Analytics 是事实上的分析工具。但你不必再忍受它,尤其是当你无法信任大科技公司使用你和你的网站访问者的数据的时候。
Plausible 让你摆脱 Google Analytics 的束缚,我将在本文中讨论这个开源项目。
请注意,如果你从来没有管理过网站或对分析感兴趣,文章中的一些技术术语可能对你来说是陌生的。
### Plausible 是隐私友好的网站分析工具
Plausible 使用的分析脚本是非常轻量级的,大小不到 1KB。
其重点在于保护隐私因此你可以在不影响访客隐私的情况下获得有价值且可操作的统计数据。Plausible 是为数不多的不需要 cookie 横幅或 GDP 同意的分析工具之一,因为它在隐私方面已经符合 [GDPR 标准][2]。这是超级酷的。
在功能上,它没有 Google Analytics 那样的粒度和细节。Plausible 靠的是简单。它显示的是你过去 30 天的流量统计图。你也可以切换到实时视图。
![][3]
你还可以看到你的流量来自哪里,以及你网站上的哪些页面访问量最大。来源也可以显示 UTM 活动。
![][4]
你还可以选择启用 GeoIP 来了解网站访问者的地理位置。你还可以检查有多少访问者使用桌面或移动设备访问你的网站。还有一个操作系统的选项,正如你所看到的,[Linux Handbook][5] 有 48% 的访问者来自 Windows 设备。很奇怪,对吧?
![][6]
显然,提供的数据与 Google Analytics 的数据相差甚远但这是有意为之。Plausible 意图是为你提供简单的模式。
### 使用 Plausible选择付费托管或在你的服务器上自行托管
使用 Plausible 有两种方式:注册他们的官方托管服务。你必须为这项服务付费,这最终会帮助 Plausible 项目的发展。它们有 30 天的试用期,甚至不需要你这边提供任何支付信息。
定价从每月 1 万页浏览量 6 美元开始。价格会随着页面浏览量的增加而增加。你可以在 Plausible 网站上计算价格。
- [Plausible 价格][7]
你可以试用 30 天,看看你是否愿意向 Plausible 开发者支付服务费用,并拥有你的数据。
如果你觉得定价不合理,你可以利用 Plausible 是开源的优势,自己部署。如果你有兴趣,请阅读我们的 [使用 Docker 自助托管 Plausible 实例的深度指南][8]。
我们自行托管 Plausible。我们的 Plausible 实例添加了我们的三个网站。
![Plausble dashboard for Its FOSS websites][9]
如果你维护一个开源项目的网站,并且想使用 Plausible你可以通过我们的 [High on Cloud 项目][10] 联系我们。通过 High on Cloud我们帮助小企业在其服务器上托管和使用开源软件。
### 总结
如果你不是超级痴迷于数据只是想快速了解网站的表现Plausible 是一个不错的选择。我喜欢它,因为它是轻量级的,而且遵守隐私。这也是我在 Linux Handbook我们 [教授 Linux 服务器相关的门户网站][11] 上使用它的主要原因。
总的来说,我对 Plausible 相当满意,并向其他网站所有者推荐它。
你也经营或管理一个网站吗?你是用什么工具来做分析,还是根本不关心这个?
--------------------------------------------------------------------------------
via: https://itsfoss.com/plausible/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://plausible.io/
[2]: https://gdpr.eu/compliance/
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/03/plausible-graph-lhb.png?resize=800%2C395&ssl=1
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/03/plausible-stats-lhb-2.png?resize=800%2C333&ssl=1
[5]: https://linuxhandbook.com/
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/plausible-geo-ip-stats.png?resize=800%2C331&ssl=1
[7]: https://plausible.io/#pricing
[8]: https://linuxhandbook.com/plausible-deployment-guide/
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/plausible-analytics-for-itsfoss.png?resize=800%2C231&ssl=1
[10]: https://highoncloud.com/
[11]: https://linuxhandbook.com/about/#ethical-web-portal

View File

@ -3,14 +3,16 @@
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13268-1.html)
用 Lua 操作文件中的数据
======
了解 Lua 如何处理数据的读写。
![Person standing in front of a giant computer screen with numbers, data][1]
> 了解 Lua 如何处理数据的读写。
![](https://img.linux.net.cn/data/attachment/album/202104/05/102424yczwucc3xcuyzkgw.jpg)
有些数据是临时的,存储在 RAM 中,只有在应用运行时才有意义。但有些数据是要持久的,存储在硬盘上供以后使用。当你编程时,无论是简单的脚本还是复杂的工具套件,通常都需要读取和写入文件。有时文件可能包含配置选项,而另一些时候这个文件是你的用户用你的应用创建的数据。每种语言都会以不同的方式处理这项任务,本文将演示如何使用 Lua 处理文件数据。
@ -22,8 +24,7 @@
### 用 Lua 读取文件
Lua 使用 `io` 库进行数据输入和输出。下面的例子创建了一个名为 `ingest` 的函数来从文件中读取数据,然后用 `:read` 函数进行解析。在 Lua 中打开一个文件时,有几种模式可以启用。因为我只需要从这个文件中读取数据,所以我使用 `r`(代表”读“)模式:
Lua 使用 `io` 库进行数据输入和输出。下面的例子创建了一个名为 `ingest` 的函数来从文件中读取数据,然后用 `:read` 函数进行解析。在 Lua 中打开一个文件时,有几种模式可以启用。因为我只需要从这个文件中读取数据,所以我使用 `r`(代表“读”)模式:
```
function ingest(file)
@ -37,7 +38,7 @@ myfile=ingest("example.txt")
print(myfile)
```
在这段代码中,注意到变量 `myfile` 是为了触发 `ingest` 函数而创建的,因此,它接收该函数返回的任何内容。`ingest` 函数返回文件的行数(从一个称为 `lines` 的变量中)。当最后一步打印 `myfile` 变量的内容时,文件的行数就会出现在终端中。
在这段代码中,注意到变量 `myfile` 是为了触发 `ingest` 函数而创建的,因此,它接收该函数返回的任何内容。`ingest` 函数返回文件的行数(从一个称为 `lines` 的变量中0。当最后一步打印 `myfile` 变量的内容时,文件的行数就会出现在终端中。
如果文件 `example.txt` 中包含了配置选项,那么我会写一些额外的代码来解析这些数据,可能会使用另一个 Lua 库,这取决于配置是以 INI 文件还是 YAML 文件或其他格式存储。如果数据是 SVG 图形,我会写额外的代码来解析 XML可能会使用 Lua 的 SVG 库。换句话说,你的代码读取的数据一旦加载到内存中,就可以进行操作,但是它们都需要加载 `io` 库。
@ -45,7 +46,6 @@ print(myfile)
无论你是要存储用户用你的应用创建的数据,还是仅仅是关于用户在应用中做了什么的元数据(例如,游戏保存或最近播放的歌曲),都有很多很好的理由来存储数据供以后使用。在 Lua 中,这是通过 `io` 库实现的,打开一个文件,将数据写入其中,然后关闭文件:
```
function exgest(file)
   local f = io.open(file, "a")
@ -63,13 +63,11 @@ exgest("example.txt")
在 Lua 中打开文件时,有一些保护措施和参数来定义如何处理文件。默认值是 `r`,允许你只读数据:
* **r** 只读
* **w** 如果文件不存在,覆盖或创建一个新文件。
* **r+** 读取和覆盖。
* **a** 追加数据到文件中,或在文件不存在的情况下创建一个新文件。
* **a+** 读取数据,将数据追加到文件中,或文件不存在的话,创建一个新文件。
* `r` 只读
* `w` 如果文件不存在,覆盖或创建一个新文件。
* `r+` 读取和覆盖。
* `a` 追加数据到文件中,或在文件不存在的情况下创建一个新文件。
* `a+` 读取数据,将数据追加到文件中,或文件不存在的话,创建一个新文件。
还有一些其他的(例如,`b` 代表二进制格式),但这些是最常见的。关于完整的文档,请参考 [Lua.org/manual][5] 上的优秀 Lua 文档。
@ -84,7 +82,7 @@ via: https://opensource.com/article/21/3/lua-files
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,157 @@
[#]: subject: (Why I love using the IPython shell and Jupyter notebooks)
[#]: via: (https://opensource.com/article/21/3/ipython-shell-jupyter-notebooks)
[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13277-1.html)
为什么我喜欢使用 IPython shell 和 Jupyter 笔记本
======
> Jupyter 笔记本将 IPython shell 提升到一个新的高度。
![](https://img.linux.net.cn/data/attachment/album/202104/08/125206uvglkoqzukhfk3uv.jpg)
Jupyter 项目最初是以 IPython 和 IPython 笔记本的形式出现的。它最初是一个专门针对 Python 的交互式 shell 和笔记本环境,后来扩展为不分语言的环境,支持 Julia、Python 和 R 以及其他任何语言。
![Jupyter][2]
IPython 是一个 Python shell类似于你在命令行输入 `python` 或者 `python3` 时看到的,但它更聪明、更有用。如果你曾经在 Python shell 中输入过多行命令,并且想重复它,你就会理解每次都要一行一行地滚动浏览历史记录的挫败感。有了 IPython你可以一次滚动浏览整个块同时还可以逐行浏览和编辑这些块的部分内容。
![iPython][4]
它具有自动补全,并提供上下文感知的建议:
![iPython offers suggestions][5]
它默认会整理输出:
![iPython pretty prints][6]
它甚至允许你运行 shell 命令:
![IPython shell commands][7]
它还提供了一些有用的功能,比如将 `?` 添加到对象中,作为运行 `help()` 的快捷方式,而不会破坏你的流程:
![IPython help][8]
如果你使用的是虚拟环境(参见我关于 [virtualenvwrapper][9] 的帖子),可以在环境中用 `pip` 安装:
```
pip install ipython
```
要在全系统范围内安装,你可以在 Debian、Ubuntu 或树莓派上使用 `apt`
```
sudo apt install ipython3
```
或使用 `pip`
```
sudo pip3 install ipython
```
### Jupyter 笔记本
Jupyter 笔记本将 IPython shell 提升到了一个新的高度。首先,它们是基于浏览器的,而不是基于终端的。要开始使用,请安装 `jupyter`
如果你使用的是虚拟环境,请在环境中使用 `pip` 进行安装:
```
pip install jupyter
```
要在全系统范围内安装,你可以在 Debian、Ubuntu 或树莓派上使用 `apt`
```
sudo apt install jupyter-notebook
```
或使用 `pip`
```
sudo pip3 install jupyter
```
启动笔记本:
```
jupyter notebook
```
这将在你的浏览器中打开:
![Jupyter Notebook][10]
你可以使用 “New” 下拉菜单创建一个新的 Python 3 笔记本:
![Python 3 in Jupyter Notebook][11]
现在你可以在 `In[ ]` 字段中编写和执行命令。使用 `Enter` 在代码块中换行,使用 `Shift+Enter` 来执行:
![Executing commands in Jupyter][12]
你可以编辑和重新运行代码块,你可以重新排序、删除,复制/粘贴,等等。你可以以任何顺序运行代码块,但是要注意的是,任何创建的变量的作用域都将根据执行的时间而不是它们在笔记本中出现的顺序。你可以在 “Kernel” 菜单中重启并清除输出或重启并运行所有的代码块。
使用 `print` 函数每次都会输出。但是如果你有一条没有分配的语句,或者最后一条语句没有分配,那么它总是会输出:
![Jupyter output][13]
你甚至可以把 `In``Out` 作为可索引对象:
![Jupyter output][14]
所有的 IPython 功能都可以使用,而且通常也会表现得更漂亮一些:
![Jupyter supports IPython features][15]
你甚至可以使用 [Matplotlib][16] 进行内联绘图:
![Graphing in Jupyter Notebook][17]
最后,你可以保存你的笔记本,并将其包含在 Git 仓库中,如果你将其推送到 GitHub它们将作为已完成的笔记本被渲染输出、图形和所有一切如 [本例][18]
![Saving Notebook to GitHub][19]
* * *
本文原载于 Ben Nuttall 的 [Tooling Tuesday 博客][20],经许可后重用。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/ipython-shell-jupyter-notebooks
作者:[Ben Nuttall][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/bennuttall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space)
[2]: https://opensource.com/sites/default/files/uploads/jupyterpreview.png (Jupyter)
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://opensource.com/sites/default/files/uploads/ipython-loop.png (iPython)
[5]: https://opensource.com/sites/default/files/uploads/ipython-suggest.png (iPython offers suggestions)
[6]: https://opensource.com/sites/default/files/uploads/ipython-pprint.png (iPython pretty prints)
[7]: https://opensource.com/sites/default/files/uploads/ipython-ls.png (IPython shell commands)
[8]: https://opensource.com/sites/default/files/uploads/ipython-help.png (IPython help)
[9]: https://opensource.com/article/21/2/python-virtualenvwrapper
[10]: https://opensource.com/sites/default/files/uploads/jupyter-notebook-1.png (Jupyter Notebook)
[11]: https://opensource.com/sites/default/files/uploads/jupyter-python-notebook.png (Python 3 in Jupyter Notebook)
[12]: https://opensource.com/sites/default/files/uploads/jupyter-loop.png (Executing commands in Jupyter)
[13]: https://opensource.com/sites/default/files/uploads/jupyter-cells.png (Jupyter output)
[14]: https://opensource.com/sites/default/files/uploads/jupyter-cells-2.png (Jupyter output)
[15]: https://opensource.com/sites/default/files/uploads/jupyter-help.png (Jupyter supports IPython features)
[16]: https://matplotlib.org/
[17]: https://opensource.com/sites/default/files/uploads/jupyter-graph.png (Graphing in Jupyter Notebook)
[18]: https://github.com/piwheels/stats/blob/master/2020.ipynb
[19]: https://opensource.com/sites/default/files/uploads/savenotebooks.png (Saving Notebook to GitHub)
[20]: https://tooling.bennuttall.com/the-ipython-shell-and-jupyter-notebooks/

View File

@ -0,0 +1,181 @@
[#]: subject: (3 reasons I use the Git cherry-pick command)
[#]: via: (https://opensource.com/article/21/3/git-cherry-pick)
[#]: author: (Manaswini Das https://opensource.com/users/manaswinidas)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13305-1.html)
我使用 Git cherry-pick 命令的 3 个理由
======
> “遴选”可以解决 Git 仓库中的很多问题。以下是用 `git cherry-pick` 修复错误的三种方法。
![](https://img.linux.net.cn/data/attachment/album/202104/17/174429qw1im6if6mf6zi9i.jpg)
在版本控制系统中摸索前进是一件很棘手的事情。对于一个新手来说,这可能是非常难以应付的,但熟悉版本控制系统(如 Git的术语和基础知识是开始为开源贡献的第一步。
熟悉 Git 也能帮助你在开源之路上走出困境。Git 功能强大,让你感觉自己在掌控之中 —— 没有哪一种方法会让你无法恢复到工作版本。
这里有一个例子可以帮助你理解“<ruby>遴选<rt>cherry-pick</rt></ruby>”的重要性。假设你已经在一个分支上做了好几个提交但你意识到这是个错误的分支你现在该怎么办你现在要做什么要么在正确的分支上重复所有的变更然后重新提交要么把这个分支合并到正确的分支上。等一下前者太过繁琐而你可能不想做后者。那么还有没有办法呢有的Git 已经为你准备好了。这就是“遴选”的作用。顾名思义,你可以用它从一个分支中手工遴选一个提交,然后转移到另一个分支。
使用遴选的原因有很多。以下是其中的三个原因。
### 避免重复性工作
如果你可以直接将相同的提交复制到另一个分支,就没有必要在不同的分支中重做相同的变更。请注意,遴选出来的提交会在另一个分支中创建带有新哈希的新提交,所以如果你看到不同的提交哈希,请不要感到困惑。
如果您想知道什么是提交的哈希,以及它是如何生成的,这里有一个说明可以帮助你。提交哈希是用 [SHA-1][2] 算法生成的字符串。SHA-1 算法接收一个输入,然后输出一个唯一的 40 个字符的哈希值。如果你使用的是 [POSIX][3] 系统,请尝试在您的终端上运行这个命令:
```
$ echo -n "commit" | openssl sha1
```
这将输出一个唯一的 40 个字符的哈希值 `4015b57a143aec5156fd1444a017a32137a3fd0f`。这个哈希代表了字符串 `commit`
Git 在提交时生成的 SHA-1 哈希值不仅仅代表一个字符串。它代表的是:
```
sha1(
    meta data
        commit message
        committer
        commit date
        author
        authoring date
    Hash of the entire tree object
)
```
这就解释了为什么你对代码所做的任何细微改动都会得到一个独特的提交哈希值。哪怕是一个微小的改动都会被发现。这是因为 Git 具有完整性。
### 撤销/恢复丢失的更改
当你想恢复到工作版本时,遴选就很方便。当多个开发人员在同一个代码库上工作时,很可能会丢失更改,最新的版本会被转移到一个陈旧的或非工作版本上。这时,遴选提交到工作版本就可以成为救星。
#### 它是如何工作的?
假设有两个分支:`feature1` 和 `feature2`,你想把 `feature1` 中的提交应用到 `feature2`
`feature1` 分支上,运行 `git log` 命令,复制你想遴选的提交哈希值。你可以看到一系列类似于下面代码示例的提交。`commit` 后面的字母数字代码就是你需要复制的提交哈希。为了方便起见,您可以选择复制前六个字符(本例中为 `966cf3`)。
```
commit 966cf3d08b09a2da3f2f58c0818baa37184c9778 (HEAD -> master)
Author: manaswinidas <me@example.com>
Date: Mon Mar 8 09:20:21 2021 +1300
add instructions
```
然后切换到 `feature2` 分支,在刚刚从日志中得到的哈希值上运行 `git cherry-pick`
```
$ git checkout feature2
$ git cherry-pick 966cf3.
```
如果该分支不存在,使用 `git checkout -b feature2` 来创建它。
这里有一个问题。你可能会遇到下面这种情况:
```
$ git cherry-pick 966cf3
On branch feature2
You are currently cherry-picking commit 966cf3d.
nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
   git commit --allow-empty
Otherwise, please use 'git reset'
```
不要惊慌。只要按照建议运行 `git commit --allow-empty`
```
$ git commit --allow-empty
[feature2 afb6fcb] add instructions
Date: Mon Mar 8 09:20:21 2021 +1300
```
这将打开你的默认编辑器,允许你编辑提交信息。如果你没有什么要补充的,可以保存现有的信息。
就这样,你完成了你的第一次遴选。如上所述,如果你在分支 `feature2` 上运行 `git log`,你会看到一个不同的提交哈希。下面是一个例子:
```
commit afb6fcb87083c8f41089cad58deb97a5380cb2c2 (HEAD -&gt; feature2)
Author: manaswinidas &lt;[me@example.com][4]&gt;
Date:   Mon Mar 8 09:20:21 2021 +1300
   add instructions
```
不要对不同的提交哈希感到困惑。这只是区分 `feature1``feature2` 的提交。
### 遴选多个提交
但如果你想遴选多个提交的内容呢?你可以使用:
```
git cherry-pick <commit-hash1> <commit-hash2>... <commit-hashn>
```
请注意,你不必使用整个提交的哈希值,你可以使用前五到六个字符。
同样,这也是很繁琐的。如果你想遴选的提交是一系列的连续提交呢?这种方法太费劲了。别担心,有一个更简单的方法。
假设你有两个分支:
* `feature1` 包括你想复制的提交(从更早的 `commitA``commitB`)。
* `feature2` 是你想把提交从 `feature1` 转移到的分支。
然后:
1. 输入 `git checkout <feature1>`
2. 获取 `commitA``commitB` 的哈希值。
3. 输入 `git checkout <branchB>`
4. 输入 `git cherry-pick <commitA>^..<commitB>` (请注意,这包括 `commitA``commitB`)。
5. 如果遇到合并冲突,[像往常一样解决][5],然后输入 `git cherry-pick --continue` 恢复遴选过程。
### 重要的遴选选项
以下是 [Git 文档][6] 中的一些有用的选项,你可以在 `cherry-pick` 命令中使用。
* `-e`、`--edit`:用这个选项,`git cherry-pick` 可以让你在提交前编辑提交信息。
* `-s`、`--signoff`:在提交信息的结尾添加 `Signed-off by` 行。更多信息请参见 `git-commit(1)` 中的 signoff 选项。
* `-S[<keyid>]`、`--pgg-sign[=<keyid>]`:这些是 GPG 签名的提交。`keyid` 参数是可选的,默认为提交者身份;如果指定了,则必须嵌在选项中,不加空格。
* `--ff`:如果当前 HEAD 与遴选的提交的父级提交相同,则会对该提交进行快进操作。
下面是除了 `--continue` 外的一些其他的后继操作子命令:
* `--quit`:你可以忘记当前正在进行的操作。这可以用来清除遴选或撤销失败后的后继操作状态。
* `--abort`:取消操作并返回到操作序列前状态。
下面是一些关于遴选的例子:
* `git cherry-pick master`:应用 `master` 分支顶端的提交所引入的变更,并创建一个包含该变更的新提交。
* `git cherry-pick master~4 master~2':应用 `master` 指向的第五个和第三个最新提交所带来的变化,并根据这些变化创建两个新的提交。
感到不知所措?你不需要记住所有的命令。你可以随时在你的终端输入 `git cherry-pick --help` 查看更多选项或帮助。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/git-cherry-pick
作者:[Manaswini Das][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/manaswinidas
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/pictures/cherry-picking-recipe-baking-cooking.jpg?itok=XVwse6hw (Measuring and baking a cherry pie recipe)
[2]: https://en.wikipedia.org/wiki/SHA-1
[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[4]: mailto:me@example.com
[5]: https://opensource.com/article/20/4/git-merge-conflict
[6]: https://git-scm.com/docs/git-cherry-pick

View File

@ -0,0 +1,169 @@
[#]: subject: (Use this open source tool to monitor variables in Python)
[#]: via: (https://opensource.com/article/21/4/monitor-debug-python)
[#]: author: (Tian Gao https://opensource.com/users/gaogaotiantian)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13279-1.html)
使用这个开源工具来监控 Python 中的变量
======
> Watchpoints 是一个简单但功能强大的工具,可以帮助你在调试 Python 时监控变量。
![](https://img.linux.net.cn/data/attachment/album/202104/08/231614imw8zqfncz5qwwow.jpg)
在调试代码时,你经常面临着要弄清楚一个变量何时发生变化。如果没有任何高级工具,那么可以选择使用打印语句在期望它们更改时输出变量。然而,这是一种非常低效的方法,因为变量可能在很多地方发生变化,并且不断地将其打印到终端上会产生很大的干扰,而将它们打印到日志文件中则变得很麻烦。
这是一个常见的问题,但现在有一个简单而强大的工具可以帮助你监控变量:[watchpoints][2]。
[“监视点”的概念在 C 和 C++ 调试器中很常见][3],用于监控内存,但在 Python 中缺乏相应的工具。`watchpoints` 填补了这个空白。
### 安装
要使用它,你必须先用 `pip` 安装它:
```
$ python3 -m pip install watchpoints
```
### 在Python中使用 watchpoints
对于任何一个你想监控的变量,使用 `watch` 函数对其进行监控。
```
from watchpoints import watch
a = 0
watch(a)
a = 1
```
当变量发生变化时,它的值就会被打印到**标准输出**
```
====== Watchpoints Triggered ======
Call Stack (most recent call last):
<module> (my_script.py:5):
> a = 1
a:
0
->
1
```
信息包括:
* 变量被改变的行。
* 调用栈。
* 变量的先前值/当前值。
它不仅适用于变量本身,也适用于对象的变化:
```
from watchpoints import watch
a = []
watch(a)
a = {} # 触发
a["a"] = 2 # 触发
```
当变量 `a` 被重新分配时,回调会被触发,同时当分配给 `a` 的对象发生变化时也会被触发。
更有趣的是,监控不受作用域的限制。你可以在任何地方观察变量/对象,而且无论程序在执行什么函数,回调都会被触发。
```
from watchpoints import watch
def func(var):
    var["a"] = 1
a = {}
watch(a)
func(a)
```
例如,这段代码打印出:
```
====== Watchpoints Triggered ======
Call Stack (most recent call last):
<module> (my_script.py:8):
> func(a)
func (my_script.py:4):
> var["a"] = 1
a:
{}
->
{'a': 1}
```
`watch` 函数不仅可以监视一个变量,它也可以监视一个字典或列表的属性和元素。
```
from watchpoints import watch
class MyObj:
    def __init__(self):
        self.a = 0
obj = MyObj()
d = {"a": 0}
watch(obj.a, d["a"]) # 是的,你可以这样做
obj.a = 1 # 触发
d["a"] = 1 # 触发
```
这可以帮助你缩小到一些你感兴趣的特定对象。
如果你对输出格式不满意,你可以自定义它。只需定义你自己的回调函数:
```
watch(a, callback=my_callback)
# 或者全局设置
watch.config(callback=my_callback)
```
当触发时,你甚至可以使用 `pdb`
```
watch.config(pdb=True)
```
这与 `breakpoint()` 的行为类似,会给你带来类似调试器的体验。
如果你不想在每个文件中都导入这个函数,你可以通过 `install` 函数使其成为全局:
```
watch.install() # 或 watch.install("func_name") ,然后以 func_name() 方式使用
```
我个人认为,`watchpoints` 最酷的地方就是使用直观。你对一些数据感兴趣吗?只要“观察”它,你就会知道你的变量何时发生变化。
### 尝试 watchpoints
我在 [GitHub][2] 上开发维护了 `watchpoints`,并在 Apache 2.0 许可下发布了它。安装并使用它,当然也欢迎大家做出贡献。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/monitor-debug-python
作者:[Tian Gao][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/gaogaotiantian
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/look-binoculars-sight-see-review.png?itok=NOw2cm39 (Looking back with binoculars)
[2]: https://github.com/gaogaotiantian/watchpoints
[3]: https://opensource.com/article/21/3/debug-code-gdb

View File

@ -0,0 +1,134 @@
[#]: subject: (Find what changed in a Git commit)
[#]: via: (https://opensource.com/article/21/4/git-whatchanged)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (DCOLIVERSUN)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13286-1.html)
查看 Git 提交中发生了什么变化
======
> Git 提供了几种方式可以帮你快速查看提交中哪些文件被改变。
![](https://img.linux.net.cn/data/attachment/album/202104/11/093421yuololouo66woulu.jpg)
如果你每天使用 Git应该会提交不少改动。如果你每天和其他人在一个项目中使用 Git假设 _每个人_ 每天的提交都是安全的,你会意识到 Git 日志会变得多么混乱,似乎永恒地滚动着变化,却没有任何迹象表明修改了什么。
那么,你该怎样查看指定提交中文件发生哪些变化?这比你想的容易。
### 查看提交中文件发生的变化
要想知道指定提交中哪些文件发生变化,可以使用 `git log --raw` 命令。这是发现一个提交影响了哪些文件的最快速、最方便的方法。`git log` 命令一般都没有被充分利用,主要是因为它有太多的格式化选项,许多用户在面对很多选择以及在一些情况下不明所以的文档时,会望而却步。
然而Git 的日志机制非常灵活,`--raw` 选项提供了当前分支中的提交日志,以及更改的文件列表。
以下是标准的 `git log` 输出:
```
$ git log
commit fbbbe083aed75b24f2c77b1825ecab10def0953c (HEAD -> dev, origin/dev)
Author: tux <tux@example.com>
Date: Sun Nov 5 21:40:37 2020 +1300
exit immediately from failed download
commit 094f9948cd995acfc331a6965032ea0d38e01f03 (origin/master, master)
Author: Tux <tux@example.com>
Date: Fri Aug 5 02:05:19 2020 +1200
export makeopts from etc/example.conf
commit 76b7b46dc53ec13316abb49cc7b37914215acd47
Author: Tux <tux@example.com>
Date: Sun Jul 31 21:45:24 2020 +1200
fix typo in help message
```
即使作者在提交消息中指定了哪些文件发生变化,日志也相当简洁。
以下是 `git log --raw` 输出:
```
$ git log --raw
commit fbbbe083aed75b24f2c77b1825ecab10def0953c (HEAD -> dev, origin/dev)
Author: tux <tux@example.com>
Date: Sun Nov 5 21:40:37 2020 +1300
exit immediately from failed download
:100755 100755 cbcf1f3 4cac92f M src/example.lua
commit 094f9948cd995acfc331a6965032ea0d38e01f03 (origin/master, master)
Author: Tux <tux@example.com>
Date: Fri Aug 5 02:05:19 2020 +1200
export makeopts from etc/example.conf
:100755 100755 4c815c0 cbcf1f3 M src/example.lua
:100755 100755 71653e1 8f5d5a6 M src/example.spec
:100644 100644 9d21a6f e33caba R100 etc/example.conf etc/example.conf-default
commit 76b7b46dc53ec13316abb49cc7b37914215acd47
Author: Tux <tux@example.com>
Date: Sun Jul 31 21:45:24 2020 +1200
fix typo in help message
:100755 100755 e253aaf 4c815c0 M src/example.lua
```
这会准确告诉你哪个文件被添加到提交中,哪些文件发生改变(`A` 是添加,`M` 是修改,`R` 是重命名,`D` 是删除)。
### Git whatchanged
`git whatchanged` 命令是一个遗留命令,它的前身是日志功能。文档说用户不应该用该命令替代 `git log --raw`,并且暗示它实质上已经被废弃了。不过,我还是觉得它是一个很有用的捷径,可以得到同样的输出结果(尽管合并提交的内容不包括在内),如果它被删除的话,我打算为它创建一个别名。如果你只想查看已更改的文件,不想在日志中看到合并提交,可以尝试 `git whatchanged` 作为简单的助记符。
### 查看变化
你不仅可以看到哪些文件发生更改,还可以使用 `git log` 显示文件中发生了哪些变化。你的 Git 日志可以生成一个内联差异,用 `--patch` 选项可以逐行显示每个文件的所有更改:
```
commit 62a2daf8411eccbec0af69e4736a0fcf0a469ab1 (HEAD -> master)
Author: Tux <Tux@example.com>
Date: Wed Mar 10 06:46:58 2021 +1300
commit
diff --git a/hello.txt b/hello.txt
index 65a56c3..36a0a7d 100644
--- a/hello.txt
+++ b/hello.txt
@@ -1,2 +1,2 @@
Hello
-world
+opensource.com
```
在这个例子中“world” 这行字从 `hello.txt` 中删掉“opensource.com” 这行字则添加进去。
如果你需要在其他地方手动进行相同的修改,这些<ruby>补丁<rt>patch</rt></ruby>可以与常见的 Unix 命令一起使用,例如 [diff 与 patch][4]。补丁也是一个好方法,可以总结指定提交中引入新信息的重要部分内容。当你在冲刺阶段引入一个 bug 时,你会发现这里的内容就是非常有价值的概述。为了更快地找到错误的原因,你可以忽略文件中没有更改的部分,只检查新代码。
### 用简单命令得到复杂的结果
你不必理解引用、分支和提交哈希,就可以查看提交中更改了哪些文件。你的 Git 日志旨在向你报告 Git 的活动,如果你想以特定方式格式化它或者提取特定的信息,通常需要费力地浏览许多文档来组合出正确的命令。幸运的是,关于 Git 历史记录最常用的请求之一只需要一两个选项:`--raw` 与 `--patch`。如果你不记得 `--raw`就想想“Git什么改变了然后输入 `git whatchanged`
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/git-whatchanged
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[DCOLIVERSUN](https://github.com/DCOLIVERSUN)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.)
[2]: mailto:tux@example.com
[3]: mailto:Tux@example.com
[4]: https://opensource.com/article/18/8/diffs-patches

View File

@ -0,0 +1,104 @@
[#]: subject: (Wrong Time Displayed in Windows-Linux Dual Boot Setup? Heres How to Fix it)
[#]: via: (https://itsfoss.com/wrong-time-dual-boot/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13276-1.html)
如何解决 Windows-Linux 双启动设置中显示时间错误的问题
======
![](https://img.linux.net.cn/data/attachment/album/202104/08/102102xaup3iofozn2uvbf.jpg)
如果你 [双启动 Windows 和 Ubuntu][1] 或任何其他 Linux 发行版,你可能会注意到两个操作系统之间的时间差异。
当你 [使用 Linux][2] 时,它会显示正确的时间。但当你进入 Windows 时它显示的时间是错误的。有时情况正好相反Linux 显示的是错误的时间,而 Windows 的时间是正确的。
特别奇怪的是,因为你已连接到互联网,并且已将日期和时间设置为自动使用。
别担心!你并不是唯一一个遇到这种问题的人。你可以在 Linux 终端上使用以下命令来解决这个问题:
```
timedatectl set-local-rtc 1
```
同样,不要担心。我会解释为什么你在双启动设置中会遇到时间差。我会向你展示上面的命令是如何修复 Windows 双启动后的时间错误问题的。
### 为什么 Windows 和 Linux 在双启动时显示不同的时间?
一台电脑有两个主要时钟:系统时钟和硬件时钟。
硬件时钟也叫 RTC[实时时钟][3])或 CMOS/BIOS 时钟。这个时钟在操作系统之外,在电脑的主板上。即使在你的系统关机后,它也会继续运行。
系统时钟是你在操作系统内看到的。
当计算机开机时,硬件时钟被读取并用于设置系统时钟。之后,系统时钟被用于跟踪时间。如果你的操作系统对系统时钟做了任何改变,比如改变时区等,它就会尝试将这些信息同步到硬件时钟上。
默认情况下Linux 认为硬件时钟中存储的时间是 UTC而不是本地时间。另一方面Windows 认为硬件时钟上存储的时间是本地时间。这就是问题的开始。
让我用例子来解释一下。
你看我在加尔各答 UTC+5:30 时区。安装后,当我把 [Ubuntu 中的时区][4] 设置为加尔各答时区时Ubuntu 会把这个时间信息同步到硬件时钟上,但会有 5:30 的偏移,因为对于 Linux 来说它必须是 UTC。
假设加尔各答时区的当前时间是 15:00这意味着 UTC 时间是 09:30。
现在当我关闭系统并启动到 Windows 时,硬件时钟有 UTC 时间(本例中为 09:30。但是 Windows 认为硬件时钟已经存储了本地时间。因此,它改变了系统时钟(应该显示为 15:00而使用 UTC 时间09:30作为本地时间。因此Windows 显示时间为 09:30这比实际时间我们的例子中为 15:00早了 5:30。
![][5]
同样,如果我在 Windows 中通过自动时区和时间按钮来设置正确的时间你知道会发生什么吗现在它将在系统上显示正确的时间15:00并将此信息注意图片中的“同步你的时钟”选项同步到硬件时钟。
如果你启动到 Linux它会从硬件时钟读取时间而硬件时钟是当地时间15:00但由于 Linux 认为它是 UTC 时间,所以它在系统时钟上增加了 5:30 的偏移。现在 Linux 显示的时间是 20:30比实际时间超出晚了 5:30。
现在你了解了双启动中时差问题的根本原因,是时候看看如何解决这个问题了。
### 修复 Windows 在 Linux 双启动设置中显示错误时间的问题
有两种方法可以处理这个问题:
* 让 Windows 将硬件时钟作为 UTC 时间
* 让 Linux 将硬件时钟作为本地时间
在 Linux 中进行修改是比较容易的,因此我推荐使用第二种方法。
现在 Ubuntu 和大多数其他 Linux 发行版都使用 systemd因此你可以使用 `timedatectl` 命令来更改设置。
你要做的是告诉你的 Linux 系统将硬件时钟RTC作为本地时间。你可以通过 `set-local-rtc` (为 RTC 设置本地时间)选项来实现:
```
timedatectl set-local-rtc 1
```
如下图所示RTC 现在使用本地时间。
![][6]
现在如果你启动 Windows它把硬件时钟当作本地时间而这个时间实际上是正确的。当你在 Linux 中启动时,你的 Linux 系统知道硬件时钟使用的是本地时间,而不是 UTC。因此它不会尝试添加这个时间的偏移。
这就解决了 Linux 和 Windows 双启动时的时差问题。
你会看到一个关于 RTC 不使用本地时间的警告。对于桌面设置,它不应该引起任何问题。至少,我想不出有什么问题。
希望我把事情给你讲清楚了。如果你还有问题,请在下面留言。
--------------------------------------------------------------------------------
via: https://itsfoss.com/wrong-time-dual-boot/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/
[2]: https://itsfoss.com/why-use-linux/
[3]: https://www.computerhope.com/jargon/r/rtc.htm
[4]: https://itsfoss.com/change-timezone-ubuntu/
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/03/set-time-windows.jpg?resize=800%2C491&ssl=1
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/set-local-time-for-rtc-ubuntu.png?resize=800%2C490&ssl=1

View File

@ -0,0 +1,223 @@
[#]: subject: (A practical guide to using the git stash command)
[#]: via: (https://opensource.com/article/21/4/git-stash)
[#]: author: (Ramakrishna Pattnaik https://opensource.com/users/rkpattnaik780)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13293-1.html)
git stash 命令实用指南
======
> 学习如何使用 `git stash` 命令,以及何时应该使用它。
![](https://img.linux.net.cn/data/attachment/album/202104/12/232830chuyr6lkzevrfuzr.jpg)
版本控制是软件开发人员日常生活中不可分割的一部分。很难想象有哪个团队在开发软件时不使用版本控制工具。同样也很难想象有哪个开发者没有使用过或没有听说过Git。在 2018 年 Stackoverflow 开发者调查中74298 名参与者中有 87.2% 的人 [使用 Git][2] 进行版本控制。
Linus Torvalds 在 2005 年创建了 Git 用于开发 Linux 内核。本文将介绍 `git stash` 命令,并探讨一些有用的暂存变更的选项。本文假定你对 [Git 概念][3] 有基本的了解,并对工作树、暂存区和相关命令有良好的理解。
### 为什么 git stash 很重要?
首先要明白为什么在 Git 中暂存变更很重要。假设 Git 没有暂存变更的命令。当你正在一个有两个分支A 和 B的仓库上工作时这两个分支已经分叉了一段时间并且有不同的头。当你正在处理 A 分支的一些文件时,你的团队要求你修复 B 分支的一个错误。你迅速将你的修改保存到 A 分支(但没有提交),并尝试用 `git checkout B` 来签出 B 分支。Git 会立即中止了这个操作,并抛出错误:“你对以下文件的本地修改会被该签出覆盖……请在切换分支之前提交你的修改或将它们暂存起来。”
在这种情况下,有几种方法可以启用分支切换:
* 在分支 A 中创建一个提交,提交并推送你的修改,以修复 B 中的错误,然后再次签出 A并运行 `git reset HEAD^` 来恢复你的修改。
* 手动保留不被 Git 跟踪的文件中的改动。
第二种方法是个馊主意。第一种方法虽然看起来很传统,但却不太灵活,因为保存未完成工作的修改会被当作一个检查点,而不是一个仍在进行中的补丁。这正是设计 `git stash` 的场景。
`git stash` 将未提交的改动保存在本地,让你可以进行修改、切换分支以及其他 Git 操作。然后,当你需要的时候,你可以重新应用这些存储的改动。暂存是本地范围的,不会被 `git push` 推送到远程。
### 如何使用 git stash
下面是使用 `git stash` 时要遵循的顺序:
1. 将修改保存到分支 A。
2. 运行 `git stash`
3. 签出分支 B。
4. 修正 B 分支的错误。
5. 提交并(可选)推送到远程。
6. 查看分支 A
7. 运行 `git stash pop` 来取回你的暂存的改动。
`git stash` 将你对工作目录的修改存储在本地(在你的项目的 `.git` 目录内,准确的说是 `/.git/refs/stash`),并允许你在需要时检索这些修改。当你需要在不同的上下文之间切换时,它很方便。它允许你保存以后可能需要的更改,是让你的工作目录干净同时保持更改完整的最快方法。
### 如何创建一个暂存
暂存你的变化的最简单的命令是 `git stash`
```
$ git stash
Saved working directory and index state WIP on master; d7435644 Feat: configure graphql endpoint
```
默认情况下,`git stash` 存储(或称之为“暂存”)未提交的更改(已暂存和未暂存的文件),并忽略未跟踪和忽略的文件。通常情况下,你不需要暂存未跟踪和忽略的文件,但有时它们可能会干扰你在代码库中要做的其他事情。
你可以使用附加选项让 `git stash` 来处理未跟踪和忽略的文件:
* `git stash -u``git stash --includ-untracked` 储存未追踪的文件。
* `git stash -a``git stash --all` 储存未跟踪的文件和忽略的文件。
要存储特定的文件,你可以使用 `git stash -p``git stash -patch` 命令:
```
$ git stash --patch
diff --git a/.gitignore b/.gitignore
index 32174593..8d81be6e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
 # dependencies
 node_modules/
 /.pnp
+f,fmfm
 .pnp.js
 # testing
(1/1) Stash this hunk [y,n,q,a,d,e,?]?
```
### 列出你的暂存
你可以用 `git stash list` 命令查看你的暂存。暂存是后进先出LIFO方式保存的
```
$ git stash list
stash@{0}: WIP on master: d7435644 Feat: configure graphql endpoint
```
默认情况下,暂存会显示在你创建它的分支和提交的顶部,被标记为 `WIP`。然而,当你有多个暂存时,这种有限的信息量并没有帮助,因为很难记住或单独检查它们的内容。要为暂存添加描述,可以使用命令 `git stash save <description>`
```
$ git stash save "remove semi-colon from schema"
Saved working directory and index state On master: remove semi-colon from schema
$ git stash list
stash@{0}: On master: remove semi-colon from schema
stash@{1}: WIP on master: d7435644 Feat: configure graphql endpoint
```
### 检索暂存起来的变化
你可以用 `git stash apply``git stash pop` 这两个命令来重新应用暂存的变更。这两个命令都会重新应用最新的暂存(即 `stash@{0}`)中的改动。`apply` 会重新应用变更;而 `pop` 则会将暂存的变更重新应用到工作副本中,并从暂存中删除。如果你不需要再次重新应用被暂存的更改,则首选 `pop`
你可以通过传递标识符作为最后一个参数来选择你想要弹出或应用的储藏:
```
$ git stash pop stash@{1}
```
```
$ git stash apply stash@{1}
```
### 清理暂存
删除不再需要的暂存是好的习惯。你必须用以下命令手动完成:
* `git stash clear` 通过删除所有的暂存库来清空该列表。
* `git stash drop <stash_id>` 从暂存列表中删除一个特定的暂存。
### 检查暂存的差异
命令 `git stash show <stash_id>` 允许你查看一个暂存的差异:
```
$ git stash show stash@{1}
console/console-init/ui/.graphqlrc.yml        |   4 +-
console/console-init/ui/generated-frontend.ts | 742 +++++++++---------
console/console-init/ui/package.json          |   2 +-
```
要获得更详细的差异,需要传递 `--patch``-p` 标志:
```
$ git stash show stash@{0} --patch
diff --git a/console/console-init/ui/package.json b/console/console-init/ui/package.json
index 755912b97..5b5af1bd6 100644
--- a/console/console-init/ui/package.json
+++ b/console/console-init/ui/package.json
@@ -1,5 +1,5 @@
 {
- "name": "my-usepatternfly",
+ "name": "my-usepatternfly-2",
  "version": "0.1.0",
  "private": true,
  "proxy": "http://localhost:4000"
diff --git a/console/console-init/ui/src/AppNavHeader.tsx b/console/console-init/ui/src/AppNavHeader.tsx
index a4764d2f3..da72b7e2b 100644
--- a/console/console-init/ui/src/AppNavHeader.tsx
+++ b/console/console-init/ui/src/AppNavHeader.tsx
@@ -9,8 +9,8 @@ import { css } from "@patternfly/react-styles";
interface IAppNavHeaderProps extends PageHeaderProps {
- toolbar?: React.ReactNode;
- avatar?: React.ReactNode;
+ toolbar?: React.ReactNode;
+ avatar?: React.ReactNode;
}
export class AppNavHeader extends React.Component&lt;IAppNavHeaderProps&gt;{
  render()
```
### 签出到新的分支
你可能会遇到这样的情况:一个分支和你的暂存中的变更有分歧,当你试图重新应用暂存时,会造成冲突。一个简单的解决方法是使用 `git stash branch <new_branch_name stash_id>` 命令,它将根据创建暂存时的提交创建一个新分支,并将暂存中的修改弹出:
```
$ git stash branch test_2 stash@{0}
Switched to a new branch 'test_2'
On branch test_2
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: .graphqlrc.yml
modified: generated-frontend.ts
modified: package.json
no changes added to commit (use "git add" and/or "git commit -a")
Dropped stash@{0} (fe4bf8f79175b8fbd3df3c4558249834ecb75cd1)
```
### 在不打扰暂存参考日志的情况下进行暂存
在极少数情况下,你可能需要创建一个暂存,同时保持暂存参考日志(`reflog`)的完整性。这些情况可能出现在你需要一个脚本作为一个实现细节来暂存的时候。这可以通过 `git stash create` 命令来实现;它创建了一个暂存条目,并返回它的对象名,而不将其推送到暂存参考日志中:
```
$ git stash create "sample stash"
63a711cd3c7f8047662007490723e26ae9d4acf9
```
有时,你可能会决定将通过 `git stash create` 创建的暂存条目推送到暂存参考日志:
```
$ git stash store -m "sample stash testing.." "63a711cd3c7f8047662007490723e26ae9d4acf9"
$ git stash list
stash @{0}: sample stash testing..
```
### 结论
我希望你觉得这篇文章很有用,并学到了新的东西。如果我遗漏了任何有用的使用暂存的选项,请在评论中告诉我。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/git-stash
作者:[Ramakrishna Pattnaik][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/rkpattnaik780
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop)
[2]: https://insights.stackoverflow.com/survey/2018#work-_-version-control
[3]: https://opensource.com/downloads/cheat-sheet-git

View File

@ -0,0 +1,136 @@
[#]: subject: (What problems do people solve with strace?)
[#]: via: (https://jvns.ca/blog/2021/04/03/what-problems-do-people-solve-with-strace/)
[#]: author: (Julia Evans https://jvns.ca/)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13267-1.html)
strace 可以解决什么问题?
======
![](https://img.linux.net.cn/data/attachment/album/202104/05/094825y66126r56z361rz1.jpg)
昨天我 [在 Twitter 上询问大家用 strace 解决了什么问题?][1],和往常一样,大家真的是给出了自己的答案! 我收到了大约 200 个答案,然后花了很多时间手动将它们归为 9 类。
这些解决的问题都是关于寻找程序依赖的文件、找出程序卡住或慢的原因、或者找出程序失败的原因。这些总体上与我自己使用 `strace` 的内容相吻合,但也有一些我没有想到的东西!
我不打算在这篇文章里解释什么是 `strace`,但我有一本 [关于它的免费杂志][2] 和 [一个讲座][3] 以及 [很多博文][4]。
### 问题 1配置文件在哪里
最受欢迎的问题是“这个程序有一个配置文件,但我不知道它在哪里”。这可能也是我最常使用 `strace` 解决的问题,因为这是个很简单的问题。
这很好,因为一个程序有一百万种方法来记录它的配置文件在哪里(在手册页、网站上、`--help`等),但只有一种方法可以让它真正打开它(用系统调用!)。
### 问题 2这个程序还依赖什么文件
你也可以使用 `strace` 来查找程序依赖的其他类型的文件,比如:
* 动态链接库(“为什么我的程序加载了这个错误版本的 `.so` 文件?"),比如 [我在 2014 年调试的这个 ruby 问题][5]
* 它在哪里寻找它的 Ruby gemRuby 出现了几次这种情况!)
* SSL 根证书
* 游戏的存档文件
* 一个闭源程序的数据文件
* [哪些 node_modules 文件没有被使用][6]
### 问题 3为什么这个程序会挂掉
你有一个程序,它只是坐在那里什么都不做,这是怎么回事?这个问题特别容易回答,因为很多时候你只需要运行 `strace -p PID`,看看当前运行的是什么系统调用。你甚至不需要看几百行的输出。
答案通常是“正在等待某种 I/O”。“为什么会卡住”的一些可能的答案虽然还有很多
* 它一直在轮询 `select()`
* 正在 `wait()` 等待一个子进程完成
* 它在向某个没有响应的东西发出网络请求
* 正在进行 `write()`,但由于缓冲区已满而被阻止。
* 它在 stdin 上做 `read()`,等待输入。
有人还举了一个很好的例子,用 `strace` 调试一个卡住的 `df` 命令:“用 `strace df -h` 你可以找到卡住的挂载,然后卸载它”。
### 问题 4这个程序卡住了吗
这是上一个问题的变种:有时一个程序运行的时间比你预期的要长,你只是想知道它是否卡住了,或者它是否还在继续进行。
只要程序在运行过程中进行系统调用,用 `strace` 就可以超简单地回答这个问题:只需 `strace` 它,看看它是否在进行新的系统调用!
### 问题 5为什么这个程序很慢
你可以使用 `strace` 作为一种粗略的剖析工具:`strace -t` 会显示每次系统调用的时间戳,这样你就可以寻找大的漏洞,找到罪魁祸首。
以下是 Twitter 上 9 个人使用 `strace` 调试“为什么这个程序很慢?”的小故事。
* 早在 2000 年,我帮助支持的一个基于 Java 的网站在适度的负载下奄奄一息:页面加载缓慢,甚至完全加载不出来。我们对 J2EE 应用服务器进行了测试,发现它每次只读取一个类文件。开发人员没有使用 BufferedReader这是典型的 Java 错误。
* 优化应用程序的启动时间……运行 `strace` 可以让人大开眼界,因为有大量不必要的文件系统交互在进行(例如,在同一个配置文件上反复打开/读取/关闭;在一个缓慢的 NFS 挂载上加载大量的字体文件,等等)。
* 问自己为什么在 PHP 中从会话文件中读取(通常是小于 100 字节)非常慢。结果发现一些 `flock` 系统调用花了大约 60 秒。
* 一个程序表现得异常缓慢。使用 `strace` 找出它在每次请求时,通过从 `/dev/random` 读取数据并耗尽熵来重新初始化其内部伪随机数发生器。
* 我记得最近一件事是连接到一个任务处理程序,看到它有多少网络调用(这是意想不到的)。
* `strace` 显示它打开/读取同一个配置文件数千次。
* 服务器随机使用 100% 的 CPU 时间,实际流量很低。原来是碰到打开文件数限制,接受一个套接字时,得到 EMFILE 错误而没有报告,然后一直重试。
* 一个工作流运行超慢,但是没有日志,结果它做一个 POST 请求花了 30 秒而超时,然后重试了 5 次……结果后台服务不堪重负,但是也没有可视性。
* 使用 `strace` 注意到 `gethostbyname()` 需要很长时间才能返回(你不能直接看到 `gethostbyname`,但你可以看到 `strace` 中的 DNS 数据包)
### 问题 6隐藏的权限错误
有时候程序因为一个神秘的原因而失败但问题只是有一些它没有权限打开的文件。在理想的世界里程序会报告这些错误“Error opening file /dev/whatever: permission denied”当然这个世界并不完美所以 `strace` 真的可以帮助解决这个问题!
这其实是我最近使用 `strace` 做的事情。我使用了一台 AxiDraw 绘图仪,当我试图启动它时,它打印出了一个难以理解的错误信息。我 `strace` 它,结果发现我的用户没有权限打开 USB 设备。
### 问题 7正在使用什么命令行参数
有时候,一个脚本正在运行另一个程序,你想知道它传递的是什么命令行标志!
几个来自 Twitter 的例子。
* 找出实际上是用来编译代码的编译器标志
* 由于命令行太长,命令失败了
### 问题 8为什么这个网络连接失败
基本上,这里的目标是找到网络连接的域名 / IP 地址。你可以通过 DNS 请求来查找域名,或者通过 `connect` 系统调用来查找 IP。
一般来说,当 `tcpdump` 因为某些原因不能使用或者只是因为比较熟悉 `strace` 时,就经常会使用 `strace` 调试网络问题。
### 问题 9为什么这个程序以一种方式运行时成功以另一种方式运行时失败
例如:
* 同样的二进制程序在一台机器上可以运行,在另一台机器上却失败了
* 可以运行,但被 systemd 单元文件生成时失败
* 可以运行,但以 `su - user /some/script` 的方式运行时失败
* 可以运行,作为 cron 作业运行时失败
能够比较两种情况下的 `strace` 输出是非常有用的。虽然我在调试“以我的用户身份工作,而在同一台计算机上以不同方式运行时却失败了”时,第一步是“看看我的环境变量”。
### 我在做什么:慢慢地建立一些挑战
我之所以会想到这个问题,是因为我一直在慢慢地进行一些挑战,以帮助人们练习使用 `strace` 和其他命令行工具。我的想法是,给你一个问题,一个终端,你可以自由地以任何方式解决它。
所以我的目标是用它来建立一些你可以用 `strace` 解决的练习题,这些练习题反映了人们在现实生活中实际使用它解决的问题。
### 就是这样!
可能还有更多的问题可以用 `strace` 解决,我在这里还没有讲到,我很乐意听到我错过了什么!
我真的很喜欢看到很多相同的用法一次又一次地出现:至少有 20 个不同的人回答说他们使用 `strace` 来查找配置文件。而且和以往一样,我觉得这样一个简单的工具(“跟踪系统调用!”)可以用来解决这么多不同类型的问题,真的很令人高兴。
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2021/04/03/what-problems-do-people-solve-with-strace/
作者:[Julia Evans][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://jvns.ca/
[b]: https://github.com/lujun9972
[1]: https://twitter.com/b0rk/status/1378014888405168132
[2]: https://wizardzines.com/zines/strace
[3]: https://www.youtube.com/watch?v=4pEHfGKB-OE
[4]: https://jvns.ca/categories/strace
[5]: https://jvns.ca/blog/2014/03/10/debugging-shared-library-problems-with-strace/
[6]: https://indexandmain.com/post/shrink-node-modules-with-refining

View File

@ -0,0 +1,146 @@
[#]: subject: "Converting Multiple Markdown Files into HTML or Other Formats in Linux"
[#]: via: "https://itsfoss.com/convert-markdown-files/"
[#]: author: "Bill Dyer https://itsfoss.com/author/bill/"
[#]: collector: "lujun9972"
[#]: translator: "lxbwolf"
[#]: reviewer: "wxy"
[#]: publisher: "wxy"
[#]: url: "https://linux.cn/article-13274-1.html"
在 Linux 中把多个 Markdown 文件转换成 HTML 或其他格式
======
![](https://img.linux.net.cn/data/attachment/album/202104/07/095441bztj6cz68j89568u.jpg)
很多时候我与 Markdown 打交道的方式是,先写完一个文件,然后把它转换成 HTML 或其他格式。也有些时候,需要创建一些新的文件。当我要写多个 Markdown 文件时,通常要把他们全部写完之后才转换它们。
我用 `pandoc` 来转换文件,它可以一次性地转换所有 Markdown 文件。
Markdown 格式的文件可以转换成 .html 文件,有时候我需要把它转换成其他格式,如 epub这个时候 [pandoc][1] 就派上了用场。我更喜欢用命令行,因此本文我会首先介绍它,然而你还可以使用 [VSCodium][2] 在非命令行下完成转换。后面我也会介绍它。
### 使用 pandoc 把多个 Markdown 文件转换成其他格式(命令行方式)
你可以在 Ubuntu 及其他 Debian 系发行版本终端输入下面的命令来快速开始:
```
sudo apt-get install pandoc
```
本例中,在名为 `md_test` 目录下我有四个 Markdown 文件需要转换。
```
[email protected]:~/Documents/md_test$ ls -l *.md
-rw-r--r-- 1 bdyer bdyer 3374 Apr 7 2020 file01.md
-rw-r--r-- 1 bdyer bdyer 782 Apr 2 05:23 file02.md
-rw-r--r-- 1 bdyer bdyer 9257 Apr 2 05:21 file03.md
-rw-r--r-- 1 bdyer bdyer 9442 Apr 2 05:21 file04.md
[email protected]:~/Documents/md_test$
```
现在还没有 HTML 文件。现在我要对这些文件使用 `pandoc`。我会运行一行命令来实现:
* 调用 `pandoc`
* 读取 .md 文件并导出为 .html
下面是我要运行的命令:
```
for i in *.md ; do echo "$i" && pandoc -s $i -o $i.html ; done
```
如果你不太理解上面的命令中的 `;`,可以参考 [在 Linux 中一次执行多个命令][3]。
我执行命令后,运行结果如下:
```
[email protected]:~/Documents/md_test$ for i in *.md ; do echo "$i" && pandoc -s $i -o $i.html ; done
file01.md
file02.md
file03.md
file04.md
[email protected]:~/Documents/md_test$
```
让我再使用一次 `ls` 命令来看看是否已经生成了 HTML 文件:
```
[email protected]:~/Documents/md_test$ ls -l *.html
-rw-r--r-- 1 bdyer bdyer 4291 Apr 2 06:08 file01.md.html
-rw-r--r-- 1 bdyer bdyer 1781 Apr 2 06:08 file02.md.html
-rw-r--r-- 1 bdyer bdyer 10272 Apr 2 06:08 file03.md.html
-rw-r--r-- 1 bdyer bdyer 10502 Apr 2 06:08 file04.md.html
[email protected]:~/Documents/md_test$
```
转换很成功,现在你已经有了四个 HTML 文件,它们可以用在 Web 服务器上。
pandoc 功能相当多,你可以通过指定输出文件的扩展名来把 Markdown 文件转换成其他支持的格式。不难理解它为什么会被认为是[最好的写作开源工具][4]。
### 使用 VSCodium 把 Markdown 文件转换成 HTMLGUI 方式)
就像我们前面说的那样我通常使用命令行但是对于批量转换我不会使用命令行你也不必。VSCode 或 [VSCodium][7] 可以完成批量操作。你只需要安装一个 Markdown-All-in-One 扩展,就可以在一次运行中转换多个 Markdown 文件。
有两种方式安装这个扩展:
* VSCodium 的终端
* VSCodium 的插件管理器
通过 VSCodium 的终端安装该扩展:
1. 点击菜单栏的 `终端`。会打开终端面板
2. 输入,或[复制下面的命令并粘贴到终端][8]
```
codium --install-extension yzhang.markdown-all-in-one
```
**注意**:如果你使用的 VSCode 而不是 VSCodium那么请把上面命令中的 `codium` 替换为 `code`
![][9]
第二种安装方式是通过 VSCodium 的插件/扩展管理器:
1. 点击 VSCodium 窗口左侧的块区域。会出现一个扩展列表,列表最上面有一个搜索框。
2. 在搜索框中输入 “Markdown All in One”。在列表最上面会出现该扩展。点击 “安装” 按钮来安装它。如果你已经安装过,在安装按钮的位置会出现一个齿轮图标。
![][10]
安装完成后,你可以打开含有需要转换的 Markdown 文件的文件夹。
点击 VSCodium 窗口左侧的纸张图标。你可以选择文件夹。打开文件夹后,你需要打开至少一个文件。你也可以打开多个文件,但是最少打开一个。
当打开文件后,按下 `CTRL+SHIFT+P` 唤起命令面板。然后,在出现的搜索框中输入 `Markdown`。当你输入时,会出现一列 Markdown 相关的命令。其中有一个是 `Markdown All in One: Print documents to HTML` 命令。点击它:
![][11]
你需要选择一个文件夹来存放这些文件。它会自动创建一个 `out` 目录,转换后的 HTML 文件会存放在 `out` 目录下。从下面的图中可以看到Markdown 文档被转换成了 HTML 文件。在这里,你可以打开、查看、编辑这些 HTML 文件。
![][12]
在等待转换 Markdown 文件时,你可以更多地集中精力在写作上。当你准备好时,你就可以把它们转换成 HTML —— 你可以通过两种方式转换它们。
--------------------------------------------------------------------------------
via: https://itsfoss.com/convert-markdown-files/
作者:[Bill Dyer][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/bill/
[b]: https://github.com/lujun9972
[1]: https://pandoc.org/
[2]: https://vscodium.com/
[3]: https://itsfoss.com/run-multiple-commands-linux/
[4]: https://itsfoss.com/open-source-tools-writers/
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/10/Best-Markdown-Editors-for-Linux.jpg?fit=800%2C450&ssl=1
[6]: https://itsfoss.com/best-markdown-editors-linux/
[7]: https://itsfoss.com/vscodium/
[8]: https://itsfoss.com/copy-paste-linux-terminal/
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/04/vscodium_terminal.jpg?resize=800%2C564&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/vscodium_extension_select.jpg?resize=800%2C564&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/vscodium_markdown_function_options.jpg?resize=800%2C564&ssl=1
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/04/vscodium_html_filelist_shown.jpg?resize=800%2C564&ssl=1

View File

@ -0,0 +1,135 @@
[#]: subject: (7 Git tips for managing your home directory)
[#]: via: (https://opensource.com/article/21/4/git-home)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (stevenzdg988)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13313-1.html)
7个管理家目录的 Git 技巧
======
> 这是我怎样设置 Git 来管理我的家目录的方法。
![](https://img.linux.net.cn/data/attachment/album/202104/20/095224mtq14szo7opfofq7.jpg)
我有好几台电脑。一台笔记本电脑用于工作,一台工作站放在家里,一台树莓派(或四台),一台 [Pocket CHIP][2],一台 [运行各种不同的 Linux 的 Chromebook][3],等等。我曾经在每台计算机上或多或少地按照相同的步骤设置我的用户环境,也经常告诉自己让每台计算机都略有不同。例如,我在工作中比在家里更经常使用 [Bash 别名][4],并且我在家里使用的辅助脚本可能对工作没有用。
这些年来,我对各种设备的期望开始相融,我会忘记我在家用计算机上建立的功能没有移植到我的工作计算机上,诸如此类。我需要一种标准化我的自定义工具包的方法。使我感到意外的答案是 Git。
Git 是版本跟踪软件。它以既可以用在非常大的开源项目也可以用在极小的开源项目而闻名,甚至最大的专有软件公司也在用它。但是它是为源代码设计的,而不是用在一个装满音乐和视频文件、游戏、照片等的家目录。我听说过有人使用 Git 管理其家目录,但我认为这是程序员们进行的一项附带实验,而不是像我这样的现实生活中的用户。
用 Git 管理我的家目录是一个不断发展的过程。随着时间的推移我一直在学习和适应。如果你决定使用 Git 管理家目录,则可能需要记住以下几点。
### 1、文本和二进制位置
![家目录][5]
当由 Git 管理时,除了配置文件之外,你的家目录对于所有内容而言都是“无人之地”。这意味着当你打开主目录时,除了可预见的目录的列表之外,你什么都看不到。不应有任何杂乱无章的照片或 LibreOffice 文档,也不应有 “我就在这里放一分钟” 的临时文件。
原因很简单:使用 Git 管理家目录时,家目录中所有 _未_ 提交的内容都会变成噪音。每次执行 `git status` 时,你都必须翻过去之前 Git 未跟踪的任何文件,因此将这些文件保存在子目录(添加到 `.gitignore` 文件中)至关重要。
许多 Linux 发行版提供了一组默认目录:
* `Documents`
* `Downloads`
* `Music`
* `Photos`
* `Templates`
* `Videos`
如果需要,你可以创建更多。例如,我把创作的音乐(`Music`)和购买来聆听的音乐(`Albums`)区分开来。同样,我的电影(`Cinema`)目录包含了其他人的电影,而视频(`Videos`)目录包含我需要编辑的视频文件。换句话说,我的默认目录结构比大多数 Linux 发行版提供的默认设置更详细,但是我认为这样做有好处。如果没有适合你的目录结构,你更会将其存放在家目录中,因为没有更好的存放位置,因此请提前考虑并规划好适合你的工作目录。你以后总是可以添加更多,但是最好先开始擅长的。
### 2、、设置最优的 `.gitignore`
清理家目录后,你可以像往常一样将其作为 Git 存储库实例化:
```
$ cd
$ git init .
```
你的 Git 仓库中还没有任何内容,你的家目录中的所有内容均未被跟踪。你的第一项工作是筛选未跟踪文件的列表,并确定要保持未跟踪状态的文件。要查看未跟踪的文件:
```
$ git status
  .AndroidStudio3.2/
  .FBReader/
  .ICEauthority
  .Xauthority
  .Xdefaults
  .android/
  .arduino15/
  .ash_history
[...]
```
根据你使用家目录的时间长短,此列表可能很长。简单的是你在上一步中确定的目录。通过将它们添加到名为 `.gitignore` 的隐藏文件中,你告诉 Git 停止将它们列为未跟踪文件,并且永远不对其进行跟踪:
```
$ \ls -lg | grep ^d | awk '{print $8}' >> ~/.gitignore
```
完成后,浏览 `git status` 所示的其余未跟踪文件,并确定是否有其他文件需要排除。这个过程帮助我发现了几个陈旧的配置文件和目录,这些文件和目录最终被我全部丢弃了,而且还发现了一些特定于一台计算机的文件和目录。我在这里非常严格,因为许多配置文件在自动生成时会表现得更好。例如,我从不提交我的 KDE 配置文件,因为许多文件包含了诸如最新文档之类的信息以及其他机器上不存在的其他元素。
我会跟踪我的个性化配置文件、脚本和实用程序、配置文件和 Bash 配置,以及速查表和我经常引用的其他文本片段。如果有软件主要负责维护的文件,则将其忽略。当对一个文件不确定时,我将其忽略。你以后总是可以取消忽略它(通过从 `.gitignore` 文件中删除它)。
### 3、了解你的数据
我使用的是 KDE因此我使用开源扫描程序 [Filelight][7] 来了解我的数据概况。Filelight 为你提供了一个图表,可让你查看每个目录的大小。你可以浏览每个目录以查看占用了空间的内容,然后回溯调查其他地方。这是一个令人着迷的系统视图,它使你可以以全新的方式看待你的文件。
![Filelight][8]
使用 Filelight 或类似的实用程序查找不需要提交的意外数据缓存。例如KDE 文件索引器Baloo生成了大量特定于其主机的数据我绝对不希望将其传输到另一台计算机。
### 4、不要忽略你的 `.gitignore` 文件
在某些项目中,我告诉 Git 忽略我的 `.gitignore` 文件,因为有时我要忽略的内容特定于我的工作目录,并且我不认为同一项目中的其他开发人员需要我告诉他们 `.gitignore` 文件应该是什么样子。因为我的家目录仅供我使用,所以我 _不_ 会忽略我的家目录的 `.gitignore` 文件。我将其与其他重要文件一起提交,因此它已在我的所有系统中被继承。当然,从家目录的角度来看,我所有的系统都是相同的:它们具有一组相同的默认文件夹和许多相同的隐藏配置文件。
### 5、不要担心二进制文件
我对我的系统进行了数周的严格测试,确信将二进制文件提交到 Git 绝对不是明智之举。我试过 GPG 加密的密码文件、试过 LibreOffice 文档、JPEG、PNG 等等。我甚至有一个脚本,可以在将 LibreOffice 文件添加到 Git 之前先解压缩,提取其中的 XML以便仅提交 XML然后重新构建 LibreOffice 文件,以便可以在 LibreOffice 中继续工作。我的理论是,提交 XML 会比使用 ZIP 文件LibreOffice 文档实际上就是一个 ZIP 文件)会让 Git 存储库更小一些。
令我惊讶的是,我发现偶尔提交一些二进制文件并没有大幅增加我的 Git 存储库的大小。我使用 Git 已经很长时间了,我知道如果我要提交几千兆的二进制数据,我的存储库将会受到影响,但是偶尔提交几个二进制文件也不是不惜一切代价要避免的紧急情况。
有了这种信心,我将字体 OTF 和 TTF 文件添加到我的标准主存储库,以及 GDM 的 `.face` 文件以及其他偶尔小型二进制 Blob 文件。不要想太多,不要浪费时间去避免它。只需提交即可。
### 6、使用私有存储库
即使托管方提供了私人帐户,也不要将你的主目录提交到公共 Git 存储库。如果你像我一样,拥有 SSH 密钥、GPG 密钥链和 GPG 加密的文件,这些文件不应该出现在任何人的服务器上,而应该出现在我自己的服务器上。
我在树莓派上 [运行本地 Git 服务器][9](这比你想象的要容易),因此我可以在家里时随时更新任何一台计算机。我是一名远程工作者,所以通常情况下就足够了,但是我也可以在旅行时通过 [虚拟私人网络][10] 访问我的计算机。
### 7、要记得推送
Git 的特点是,只有当你告诉它要推送改动时,它才会把改动推送到你的服务器上。如果你是 Git 的老用户,则此过程可能对你很自然。对于可能习惯于 Nextcloud 或 Syncthing 自动同步的新用户,这可能需要一些时间来适应。
### Git 家目录
使用 Git 管理我的常用文件,不仅使我在不同设备上的生活更加便利。我知道我拥有所有配置和实用程序脚本的完整历史记录,这会鼓励我尝试新的想法,因为如果结果变得 _很糟糕_则很容易回滚我的更改。Git 曾将我从在 `.bashrc` 文件中一个欠考虑的 `umask` 设置中解救出来、从深夜对包管理脚本的拙劣添加中解救出来、从当时看似很酷的 [rxvt][11] 配色方案的修改中解救出来,也许还有其他一些错误。在家目录中尝试 Git 吧,因为这些提交会让家目录融合在一起。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/git-home
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[stevenzdg988](https://github.com/stevenzdg988)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/house_home_colors_live_building.jpg?itok=HLpsIfIL (Houses in a row)
[2]: https://opensource.com/article/17/2/pocketchip-or-pi
[3]: https://opensource.com/article/21/2/chromebook-linux
[4]: https://opensource.com/article/17/5/introduction-alias-command-line-tool
[5]: https://opensource.com/sites/default/files/uploads/home-git.jpg (home directory)
[6]: https://creativecommons.org/licenses/by-sa/4.0/
[7]: https://utils.kde.org/projects/filelight
[8]: https://opensource.com/sites/default/files/uploads/filelight.jpg (Filelight)
[9]: https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6
[10]: https://www.redhat.com/sysadmin/run-your-own-vpn-libreswan
[11]: https://opensource.com/article/19/10/why-use-rxvt-terminal

View File

@ -0,0 +1,135 @@
[#]: subject: (Experiment on your code freely with Git worktree)
[#]: via: (https://opensource.com/article/21/4/git-worktree)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13301-1.html)
使用 Git 工作树对你的代码进行自由实验
======
> 获得自由尝试的权利,同时在你的实验出错时可以安全地拥有一个新的、链接的克隆存储库。
![](https://img.linux.net.cn/data/attachment/album/202104/16/085512x3auafu5uaymk52u.jpg)
Git 的设计部分是为了进行实验。如果你知道你的工作会被安全地跟踪,并且在出现严重错误时有安全状态存在,你就不会害怕尝试新的想法。不过,创新的部分代价是,你很可能会在这个过程中弄得一团糟。文件会被重新命名、移动、删除、更改、切割成碎片;新的文件被引入;你不打算跟踪的临时文件会在你的工作目录中占据一席之地等等。
简而言之,你的工作空间变成了纸牌屋,在“快好了!”和“哦,不,我做了什么?”之间岌岌可危地平衡着。那么,当你需要把仓库恢复到下午的一个已知状态,以便完成一些真正的工作时,该怎么办?我立刻想到了 `git branch` 和 [git stash][2] 这两个经典命令,但这两个命令都不是用来处理未被跟踪的文件的,而且文件路径的改变和其他重大的转变也会让人困惑,它们只能把工作暂存(`stash`)起来以备后用。解决这个需求的答案是 Git 工作树。
### 什么是 Git 工作树
Git <ruby>工作树<rt>worktree</rt></ruby>是 Git 仓库的一个链接副本,允许你同时签出多个分支。工作树与主工作副本的路径是分开的,它可以处于不同的状态和不同的分支上。在 Git 中新建工作树的好处是,你可以在不干扰当前工作环境的情况下,做出与当前任务无关的修改、提交修改,然后在以后合并。
直接从 `git-worktree` 手册中找到了一个典型的例子:当你正在为一个项目做一个令人兴奋的新功能时,你的项目经理告诉你有一个紧急的修复工作。问题是你的工作仓库(你的“工作树”)处于混乱状态,因为你正在开发一个重要的新功能。你不想在当前的冲刺中“偷偷地”进行修复,而且你也不愿意把变更暂存起来,为修复创建一个新的分支。相反,你决定创建一个新的工作树,这样你就可以在那里进行修复:
```
$ git branch | tee
* dev
trunk
$ git worktree add -b hotfix ~/code/hotfix trunk
Preparing ../hotfix (identifier hotfix)
HEAD is now at 62a2daf commit
```
在你的 `code` 目录中,你现在有一个新的目录叫做 `hotfix`,它是一个与你的主项目仓库相连的 Git 工作树,它的 `HEAD` 停在叫做 `trunk` 的分支上。现在你可以把这个工作树当作你的主工作区来对待。你可以把目录切换到它里面,进行紧急修复、提交、并最终删除这个工作树:
```
$ cd ~/code/hotfix
$ sed -i 's/teh/the/' hello.txt
$ git commit --all --message 'urgent hot fix'
```
一旦你完成了你的紧急工作,你就可以回到你之前的任务。你可以控制你的热修复何时被集成到主项目中。例如,你可以直接将变更从其工作树推送到项目的远程存储库中:
```
$ git push origin HEAD
$ cd ~/code/myproject
```
或者你可以将工作树存档为 TAR 或 ZIP 文件:
```
$ cd ~/code/myproject
$ git archive --format tar --output hotfix.tar master
```
或者你可以从单独的工作树中获取本地的变化:
```
$ git worktree list
/home/seth/code/myproject  15fca84 [dev]
/home/seth/code/hotfix     09e585d [master]
```
从那里,你可以使用任何最适合你和你的团队的策略合并你的变化。
### 列出活动工作树
你可以使用 `git worktree list` 命令获得工作树的列表,并查看每个工作树签出的分支:
```
$ git worktree list
/home/seth/code/myproject  15fca84 [dev]
/home/seth/code/hotfix     09e585d [master]
```
你可以在任何一个工作树中使用这个功能。工作树始终是连接的(除非你手动移动它们,破坏 Git 定位工作树的能力,从而切断连接)。
### 移动工作树
Git 会跟踪项目 `.git` 目录下工作树的位置和状态:
```
$ cat ~/code/myproject/.git/worktrees/hotfix/gitdir
/home/seth/code/hotfix/.git
```
如果你需要重定位一个工作树,必须使用 `git worktree move`;否则,当 Git 试图更新工作树的状态时,就会失败:
```
$ mkdir ~/Temp
$ git worktree move hotfix ~/Temp
$ git worktree list
/home/seth/code/myproject  15fca84 [dev]
/home/seth/Temp/hotfix     09e585d [master]
```
### 移除工作树
当你完成你的工作时,你可以用 `remove` 子命令删除它:
```
$ git worktree remove hotfix
$ git worktree list
/home/seth/code/myproject  15fca84 [dev]
```
为了确保你的 `.git` 目录是干净的,在删除工作树后使用 `prune` 子命令:
```
$ git worktree remove prune
```
### 何时使用工作树
与许多选项一样,无论是标签还是书签还是自动备份,都要靠你来跟踪你产生的数据,否则可能会变得不堪重负。不要经常使用工作树,要不你最终会有 20 份存储库的副本,每份副本的状态都略有不同。我发现最好是创建一个工作树,做需要它的任务,提交工作,然后删除树。保持简单和专注。
重要的是,工作树为你管理 Git 存储库的方式提供了更好的灵活性。在需要的时候使用它们,再也不用为了检查另一个分支上的内容而争先恐后地保存工作状态了。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/git-worktree
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/science_experiment_beaker_lab.png?itok=plKWRhlU (Science lab with beakers)
[2]: https://linux.cn/article-13293-1.html

View File

@ -0,0 +1,80 @@
[#]: subject: (Teach anyone how to code with Hedy)
[#]: via: (https://opensource.com/article/21/4/hedy-teach-code)
[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13290-1.html)
用 Hedy 教人编程
======
> Hedy 是一种专门为教人编程而设计的新型编程语言。
![](https://img.linux.net.cn/data/attachment/album/202104/12/111814w62da2sannsd2q76.jpg)
学习编程既要学习编程逻辑,又要学习特定编程语言的语法。我在大学上第一堂编程课的时候,教的语言是 C++。第一个代码例子是基本的 “Hello World” 程序,就像下面的例子。
```
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
```
老师直到几节课后才会解释大部分的代码。我们的期望是,我们只需输入代码,并最终了解为什么需要这些东西以及它们如何工作。
C++(以及其他类似的语言)的复杂语法是为什么 Python 经常被建议作为一种更容易的编程教学语言。下面是 Python 中的同一个例子:
```
print("Hello World!")
```
虽然 Python 中的 “Hello World” 基础例子要简单得多,但它仍然有复杂而精确的语法规则。`print` 函数需要在字符串周围加括号和引号。这对于没有编程经验的人来说还是会感到困惑。Python 比 C++ 少了 “我以后再解释” 的语法问题,但还是有一些。
[Hedy][2] 是一种专门为编码教学而设计的新语言它通过在语言中将复杂性分成多个关卡来解决语法复杂性的问题。Hedy 没有马上提供语言的全部功能,而是采取循序渐进的方式,随着学生在 Hedy 的学习的通关,慢慢变得更加复杂。随着关卡的进展,该语言获得了新的功能,最终变得更像 Python。目前有七个关卡但更多的关卡正在计划中。
在第 1 关Hedy 程序除了打印(`print`)一条语句(不需要引号或括号),提出(`ask`)一个问题,并回传(`echo`)一个答案外,不能做任何事情。第 1 关没有变量,没有循环,结构极精简。回传的工作原理几乎和变量一样,但只针对用户的最后一个输入。这可以让学生对基本概念感到舒适,而不必一下子学习所有的东西。
这是一个第 1 关的 Hedy “Hello World” 程序:
```
print Hello World
```
第 2 关引入了变量,但由于 `print` 函数没有使用引号,可能会出现一些有趣的结果。如果用来存储一个人的名字的变量是 `name`,那么就不可能打印输出 `Your name is [name]`,因为 `name` 的第一次使用(本意是字符串)和第二次使用(是变量)都被解释为变量。如果将 `name` 设置为(`is` `John Doe`,那么 `print Your name is name.` 的输出就会是 `Your John Doe is John Doe`。虽然这听起来很奇怪,但这是一个引入变量概念的好方法,这恰好是第 3 关中增加的一个功能。
第 3 关要求在字符串周围加引号,这使得变量的功能就像在 Python 中一样。现在可以输出与变量相结合的字符串,做出复杂的语句,而不用担心变量名和字符串中的单词之间的冲突。这个级别取消了 “回传”(`echo`)函数,这看起来确实是一个可能会让一些学习者感到沮丧的东西。他们应该使用变量,这是更好的代码,但如果一个 `ask`/`echo` 代码块变成无效语法,可能会让人感到困惑。
第 4 关增加了基本的 `if`/`else` 功能。学生可以从简单的问/答代码转向复杂的交互。例如,一个问“你最喜欢的颜色是什么?”的提示可以根据用户输入的内容接受不同的回复。如果他们输入绿色,回答可以是“绿色!这也是我最喜欢的颜色。”如果他们输入其他的东西,回复可以是不同的。`if`/`else` 块是一个基本的编程概念Hedy 引入了这个概念,而不必担心复杂的语法或过于精确的格式。
第 5 关有一个 `repeat` 函数,在现有的功能上增加了一个基本的循环。这个循环只能多次重复同一个命令,所以它没有 Python 中的循环那么强大,但它让学生习惯了重复命令的一般概念。这是多介绍了一个编程概念,而不会用无谓的复杂来拖累。学生们可以先掌握概念的基础知识,然后再继续学习同一事物的更强大、更复杂的版本。
在第 6 关Hedy 现在可以进行基本的数学计算。加法、减法、乘法和除法都支持,但更高级的数学功能不支持。不能使用指数、模数或其他任何 Python 和其他语言能处理的东西。目前Hedy 还没有更高关卡的产品增加更复杂的数学功能。
第 7 关引入了 Python 风格的缩进,这意味着 `repeat` 可以处理多行代码。学生在这之前都是逐行处理代码,但现在他们可以处理代码块。这个 Hedy 关卡与非教学型编程语言能做的事情相比还是有很大的差距,但它可以教会学生很多东西。
开始学习 Hedy 最简单的方法是访问 Hedy 网站上的 [课程][3],目前有荷兰语、英语、法语、德语、葡萄牙语和西班牙语。这样一来,任何有网页浏览器的人都可以进入学习过程。也可以从 [GitHub][4] 下载 Hedy并从命令行运行解释器或者运行 Hedy 网站的本地副本及其交互式课程。基于网页的版本更容易使用,但网页版本和命令行版本都支持运行针对不同复杂程度的 Hedy 程序。
Hedy 永远不会与 Python、C++ 或其他语言竞争成为现实世界项目编码的首选语言但它是编码教学的绝佳方式。作为学习过程的一部分学生编写的程序是真实的甚至可能是复杂的。Hedy 可以促进学生的学习和创造力,而不会让学生在学习过程中过早地被过多的信息所迷惑。就像数学课一样,在进入微积分之前很久要从学习计数、相加等开始(这个过程需要数年时间),编程也不必一开始就对编程语言的语法问题“我稍后再解释”、精确地遵循这些语法问题,才能产生哪怕是最基本的语言程序。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/hedy-teach-code
作者:[Joshua Allen Holm][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/holmja
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/5538035618_4e19c9787c_o.png?itok=naiD1z1S (Teacher or learner?)
[2]: https://www.hedycode.com/
[3]: https://www.hedycode.com/hedy?lang=en
[4]: https://github.com/felienne/hedy

View File

@ -0,0 +1,107 @@
[#]: subject: (Show CPU Details Beautifully in Linux Terminal With CPUFetch)
[#]: via: (https://itsfoss.com/cpufetch/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13289-1.html)
使用 CPUFetch 在 Linux 终端中漂亮地显示 CPU 细节
======
![](https://img.linux.net.cn/data/attachment/album/202104/12/093818iie270mi8am6ttk7.jpg)
Linux 上有 [检查 CPU 信息的方法][1]。最常见的可能是 `lscpu` 命令,它可以提供大量的系统上所有 CPU 核心的信息。
![lscpu command output][2]
你可以在那里找到 CPU 信息,而无需安装任何额外的包。当然这是可行的。然而,我最近偶然发现了一个新的工具,它以一种漂亮的方式显示 Linux 中的 CPU 细节。
处理器制造商的 ASCII 艺术使它看起来很酷。
![][3]
这看起来很美,不是吗?这类似于 [Neoftech 或者 Screenfetch在 Linux 中用漂亮的 ASCII 艺术来展示系统信息][4]。与这些工具类似,如果你要展示你的桌面截图,可以使用 CPUFetch。
该工具可以输出处理器制造商的 ASCII 艺术,它的名称、微架构、频率、核心、线程、峰值性能、缓存大小、[高级向量扩展][5] 等等。
除了它提供的一些主题外,你还可以使用自定义颜色。当你在整理桌面,并希望对 Linux 环境中的所有元素进行颜色匹配时,这给了你更多的自由度。
### 在 Linux 上安装 CPUFetch
不幸的是CPUFetch 是一个相当新的软件,而且它并不包含在你的发行版的软件库中,甚至没有提供现成的 DEB/RPM 二进制文件、PPA、Snap 或 Flatpak 包。
Arch Linux 用户可以在 [AUR][7] 中 [找到][6] 它,但对于其他人来说,唯一的出路是 [从源代码构建][8]。
不要担心。安装以及删除并不是那么复杂。让我来告诉你步骤。
我使用的是 Ubuntu你会 [需要先在 Ubuntu 上安装 Git][9]。一些发行版会预装 Git如果没有请使用你的发行版的包管理器来安装。
现在,把 Git 仓库克隆到你想要的地方。家目录也可以。
```
git clone https://github.com/Dr-Noob/cpufetch
```
切换到你刚才克隆的目录:
```
cd cpufetch
```
你会在这里看到一个 Makefile 文件。用它来编译代码。
```
make
```
![CPUFetch Installation][10]
现在你会看到一个新的可执行文件,名为 `cpufetch`。你运行这个可执行文件来显示终端的 CPU 信息。
```
./cpufetch
```
这是我系统的显示。AMD 的徽标用 ASCII 码看起来更酷,你不觉得吗?
![][11]
如何删除 CPUFetch这很简单。当你编译代码时它只产生了一个文件而且也和其他代码在同一个目录下。
所以,要想从系统中删除 CPUFetch只需删除它的整个文件夹即可。你知道 [在 Linux 终端中删除一个目录][12] 的方法吧?从 `cpufetch` 目录中出来,然后使用 `rm` 命令。
```
rm -rf cpufetch
```
这很简单,值得庆幸的是,因为从源代码中删除安装的软件有时真的很棘手。
说回 CPUFetch。我想这是一个实用工具适合那些喜欢在各种 Linux 群里炫耀自己桌面截图的人。既然发行版有了 NeofetchCPU 有了 CPUFetch不知道能不能也来个 Nvidia ASCII 艺术的 GPUfetch
--------------------------------------------------------------------------------
via: https://itsfoss.com/cpufetch/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://linuxhandbook.com/check-cpu-info-linux/
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/04/lscpu-command-output.png?resize=800%2C415&ssl=1
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/cpufetch-1.png?resize=800%2C307&ssl=1
[4]: https://itsfoss.com/display-linux-logo-in-ascii/
[5]: https://software.intel.com/content/www/us/en/develop/articles/introduction-to-intel-advanced-vector-extensions.html
[6]: https://aur.archlinux.org/packages/cpufetch-git
[7]: https://itsfoss.com/aur-arch-linux/
[8]: https://itsfoss.com/install-software-from-source-code/
[9]: https://itsfoss.com/install-git-ubuntu/
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/cpufetch-installation.png?resize=800%2C410&ssl=1
[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/cpufetch-for-itsfoss.png?resize=800%2C335&ssl=1
[12]: https://linuxhandbook.com/remove-files-directories/

View File

@ -0,0 +1,284 @@
[#]: subject: (Using network bound disk encryption with Stratis)
[#]: via: (https://fedoramagazine.org/network-bound-disk-encryption-with-stratis/)
[#]: author: (briansmith https://fedoramagazine.org/author/briansmith/)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13340-1.html)
使用 Stratis 的网络绑定磁盘加密
======
![](https://img.linux.net.cn/data/attachment/album/202104/27/221704gyzyvyroyyrybany.jpg)
在一个有许多加密磁盘的环境中,解锁所有的磁盘是一项困难的任务。<ruby>网络绑定磁盘加密<rt>Network bound disk encryption</rt></ruby>NBDE有助于自动解锁 Stratis 卷的过程。这是在大型环境中的一个关键要求。Stratis 2.1 版本增加了对加密的支持,这在《[Stratis 加密入门][4]》一文中介绍过。Stratis 2.3 版本最近在使用加密的 Stratis 池时引入了对网络绑定磁盘加密NBDE的支持这是本文的主题。
[Stratis 网站][5] 将 Stratis 描述为一个“_易于使用的 Linux 本地存储管理_”。短视频《[使用 Stratis 管理存储][6]》对基础知识进行了快速演示。该视频是在 Red Hat Enterprise Linux 8 系统上录制的,然而,视频中显示的概念也适用于 Fedora Linux 中的 Stratis。
### 先决条件
本文假设你熟悉 Stratis也熟悉 Stratis 池加密。如果你不熟悉这些主题,请参考这篇 [文章][4] 和前面提到的 [Stratis 概述视频][6]。
NBDE 需要 Stratis 2.3 或更高版本。本文中的例子使用的是 Fedora Linux 34 的预发布版本。Fedora Linux 34 的最终版本将包含 Stratis 2.3。
### 网络绑定磁盘加密NBDE概述
加密存储的主要挑战之一是有一个安全的方法在系统重启后再次解锁存储。在大型环境中手动输入加密口令并不能很好地扩展。NBDE 解决了这一问题,允许以自动方式解锁加密存储。
在更高层次上NBDE 需要环境中的 Tang 服务器。客户端系统(使用 Clevis Pin只要能与 Tang 服务器建立网络连接,就可以自动解密存储。如果网络没有连接到 Tang 服务器,则必须手动解密存储。
这背后的想法是Tang 服务器只能在内部网络上使用,因此,如果加密设备丢失或被盗,它将不再能够访问内部网络连接到 Tang 服务器,因此不会被自动解密。
关于 Tang 和 Clevis 的更多信息,请参见手册页(`man tang`、`man clevis`)、[Tang 的 GitHub 页面][7] 和 [Clevis 的 GitHub 页面][8]。
### 设置 Tang 服务器
本例使用另一个 Fedora Linux 系统作为 Tang 服务器,主机名为 `tang-server`。首先安装 `tang` 包。
```
dnf install tang
```
然后用 `systemctl` 启用并启动 `tangd.socket`
```
systemctl enable tangd.socket --now
```
Tang 使用的是 TCP 80 端口,所以你也需要在防火墙中打开该端口。
```
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=80/tcp
```
最后,运行 `tang-show-keys` 来显示输出签名密钥指纹。你以后会需要这个。
```
# tang-show-keys
l3fZGUCmnvKQF_OA6VZF9jf8z2s
```
### 创建加密的 Stratis 池
上一篇关于 Stratis 加密的文章详细介绍了如何设置加密的 Stratis 池,所以本文不会深入介绍。
第一步是捕获一个将用于解密 Stratis 池的密钥。即使使用 NBDE也需要设置这个因为在 NBDE 服务器无法到达的情况下,可以用它来手动解锁池。使用以下命令捕获 `pool1` 密钥。
```
# stratis key set --capture-key pool1key
Enter key data followed by the return key:
```
然后我将使用 `/dev/vdb` 设备创建一个加密的 Stratis 池(使用刚才创建的 `pool1key`),命名为 `pool1`
```
# stratis pool create --key-desc pool1key pool1 /dev/vdb。
```
接下来,在这个 Stratis 池中创建一个名为 `filesystem1` 的文件系统,创建一个挂载点,挂载文件系统,并在其中创建一个测试文件:
```
# stratis filesystem create pool1 filesystem1
# mkdir /filesystem1
# mount /dev/stratis/pool1/filesystem1 /filesystem1
# cd /filesystem1
# echo "this is a test file" > testfile
```
### 将 Stratis 池绑定到 Tang 服务器上
此时,我们已经创建了加密的 Stratis 池,并在池中创建了一个文件系统。下一步是将你的 Stratis 池绑定到刚刚设置的 Tang 服务器上。使用 `stratis pool bind nbde` 命令进行。
当你进行 Tang 绑定时,需要向该命令传递几个参数:
* 池名(在本例中,`pool1`
* 钥匙描述符名称(本例中为 `pool1key`
* Tang 服务器名称(在本例中,`http://tang-server`
记得之前在 Tang 服务器上,运行了 `tang-show-keys`,显示 Tang 输出的签名密钥指纹是 `l3fZGUCmnvKQF_OA6VZF9jf8z2s`。除了前面的参数外,还需要用参数 `-thumbprint l3fZGUCmnvKQF_OA6VZF9jf8z2s` 传递这个指纹,或者用 `-trust-url` 参数跳过对指纹的验证。
使用 `-thumbprint` 参数更安全。例如:
```
# stratis pool bind nbde pool1 pool1key http://tang-server --thumbprint l3fZGUCmnvKQF_OA6VZF9jf8z2s
```
### 用 NBDE 解锁 Stratis 池
接下来重启主机,并验证你可以用 NBDE 解锁 Stratis 池,而不需要使用密钥口令。重启主机后,该池不再可用:
```
# stratis pool list
Name Total Physical Properties
```
要使用 NBDE 解锁池,请运行以下命令:
```
# stratis pool unlock clevis
```
注意,你不需要使用密钥口令。这个命令可以在系统启动时自动运行。
此时Stratis 池已经可以使用了:
```
# stratis pool list
Name Total Physical Properties
pool1 4.98 GiB / 583.65 MiB / 4.41 GiB ~Ca, Cr
```
你可以挂载文件系统,访问之前创建的文件:
```
# mount /dev/stratis/pool1/filesystem1 /filesystem1/
# cat /filesystem1/testfile
this is a test file
```
### 轮换 Tang 服务器密钥
最好定期轮换 Tang 服务器密钥,并更新 Stratis 客户服务器以使用新的 Tang 密钥。
要生成新的 Tang 密钥,首先登录到 Tang 服务器,查看 `/var/db/tang` 目录的当前状态。然后,运行 `tang-show-keys` 命令:
```
# ls -al /var/db/tang
total 8
drwx------. 1 tang tang 124 Mar 15 15:51 .
drwxr-xr-x. 1 root root 16 Mar 15 15:48 ..
-rw-r--r--. 1 tang tang 361 Mar 15 15:51 hbjJEDXy8G8wynMPqiq8F47nJwo.jwk
-rw-r--r--. 1 tang tang 367 Mar 15 15:51 l3fZGUCmnvKQF_OA6VZF9jf8z2s.jwk
# tang-show-keys
l3fZGUCmnvKQF_OA6VZF9jf8z2s
```
要生成新的密钥,运行 `tangd-keygen` 并将其指向 `/var/db/tang` 目录:
```
# /usr/libexec/tangd-keygen /var/db/tang
```
如果你再看看 `/var/db/tang` 目录,你会看到两个新文件:
```
# ls -al /var/db/tang
total 16
drwx------. 1 tang tang 248 Mar 22 10:41 .
drwxr-xr-x. 1 root root 16 Mar 15 15:48 ..
-rw-r--r--. 1 tang tang 361 Mar 15 15:51 hbjJEDXy8G8wynMPqiq8F47nJwo.jwk
-rw-r--r--. 1 root root 354 Mar 22 10:41 iyG5HcF01zaPjaGY6L_3WaslJ_E.jwk
-rw-r--r--. 1 root root 349 Mar 22 10:41 jHxerkqARY1Ww_H_8YjQVZ5OHao.jwk
-rw-r--r--. 1 tang tang 367 Mar 15 15:51 l3fZGUCmnvKQF_OA6VZF9jf8z2s.jwk
```
如果你运行 `tang-show-keys`,就会显示出 Tang 所公布的密钥:
```
# tang-show-keys
l3fZGUCmnvKQF_OA6VZF9jf8z2s
iyG5HcF01zaPjaGY6L_3WaslJ_E
```
你可以通过将两个原始文件改名为以句号开头的隐藏文件,来防止旧的密钥(以 `l3fZ` 开头)被公布。通过这种方法,旧的密钥将不再被公布,但是它仍然可以被任何没有更新为使用新密钥的现有客户端使用。一旦所有的客户端都更新使用了新密钥,这些旧密钥文件就可以删除了。
```
# cd /var/db/tang
# mv hbjJEDXy8G8wynMPqiq8F47nJwo.jwk .hbjJEDXy8G8wynMPqiq8F47nJwo.jwk
# mv l3fZGUCmnvKQF_OA6VZF9jf8z2s.jwk .l3fZGUCmnvKQF_OA6VZF9jf8z2s.jwk
```
此时,如果再运行 `tang-show-keys`Tang 只公布新钥匙:
```
# tang-show-keys
iyG5HcF01zaPjaGY6L_3WaslJ_E
```
下一步,切换到你的 Stratis 系统并更新它以使用新的 Tang 密钥。当文件系统在线时, Stratis 支持这样做。
首先,解除对池的绑定:
```
# stratis pool unbind pool1
```
接下来,用创建加密池时使用的原始口令设置密钥:
```
# stratis key set --capture-key pool1key
Enter key data followed by the return key:
```
最后,用更新后的密钥指纹将 Stratis 池绑定到 Tang 服务器上:
```
# stratis pool bind nbde pool1 pool1key http://tang-server --thumbprint iyG5HcF01zaPjaGY6L_3WaslJ_E
```
Stratis 系统现在配置为使用更新的 Tang 密钥。一旦使用旧的 Tang 密钥的任何其他客户系统被更新,在 Tang 服务器上的 `/var/db/tang` 目录中被重命名为隐藏文件的两个原始密钥文件就可以被备份和删除了。
### 如果 Tang 服务器不可用怎么办?
接下来,关闭 Tang 服务器,模拟它不可用,然后重启 Stratis 系统。
重启后Stratis 池又不可用了:
```
# stratis pool list
Name Total Physical Properties
```
如果你试图用 NBDE 解锁,会因为 Tang 服务器不可用而失败:
```
# stratis pool unlock clevis
Execution failed:
An iterative command generated one or more errors: The operation 'unlock' on a resource of type pool failed. The following errors occurred:
Partial action "unlock" failed for pool with UUID 4d62f840f2bb4ec9ab53a44b49da3f48: Cryptsetup error: Failed with error: Error: Command failed: cmd: "clevis" "luks" "unlock" "-d" "/dev/vdb" "-n" "stratis-1-private-42142fedcb4c47cea2e2b873c08fcf63-crypt", exit reason: 1 stdout: stderr: /dev/vdb could not be opened.
```
此时,在 Tang 服务器无法到达的情况下,解锁池的唯一选择就是使用原密钥口令:
```
# stratis key set --capture-key pool1key
Enter key data followed by the return key:
```
然后你可以使用钥匙解锁池:
```
# stratis pool unlock keyring
```
接下来,验证池是否成功解锁:
```
# stratis pool list
Name Total Physical Properties
pool1 4.98 GiB / 583.65 MiB / 4.41 GiB ~Ca, Cr
```
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/network-bound-disk-encryption-with-stratis/
作者:[briansmith][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/briansmith/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/03/stratis-nbde-816x345.jpg
[2]: https://unsplash.com/@imattsmart?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[3]: https://unsplash.com/s/photos/lock?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[4]: https://linux.cn/article-13311-1.html
[5]: https://stratis-storage.github.io/
[6]: https://www.youtube.com/watch?v=CJu3kmY-f5o
[7]: https://github.com/latchset/tang
[8]: https://github.com/latchset/clevis

View File

@ -0,0 +1,187 @@
[#]: subject: (What is Git cherry-picking?)
[#]: via: (https://opensource.com/article/21/4/cherry-picking-git)
[#]: author: (Rajeev Bera https://opensource.com/users/acompiler)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13295-1.html)
什么是 Git 遴选cherry-pick
======
> 了解 `git cherry-pick` 命令是什么,为什么用以及如何使用。
![](https://img.linux.net.cn/data/attachment/album/202104/14/131735o63v3ow6y2wc281o.jpg)
当你和一群程序员一起工作时,无论项目大小,处理多个 Git 分支之间的变更都会变得很困难。有时,你不想将整个 Git 分支合并到另一个分支,而是想选择并移动几个特定的提交。这个过程被称为 “<ruby>遴选<rt>cherry-pick</rt></ruby>”。
本文将介绍“遴选”是什么、为何使用以及如何使用。
那么让我们开始吧。
### 什么是遴选?
使用遴选(`cherry-pick`命令Git 可以让你将任何分支中的个别提交合并到你当前的 [Git HEAD][2] 分支中。
当执行 `git merge` 或者 `git rebase` 时,一个分支的所有提交都会被合并。`cherry-pick` 命令允许你选择单个提交进行整合。
### 遴选的好处
下面的情况可能会让你更容易理解遴选功能。
想象一下,你正在为即将到来的每周冲刺实现新功能。当你的代码准备好了,你会把它推送到远程分支,准备进行测试。
然而,客户并不是对所有修改都满意,要求你只呈现某些修改。因为客户还没有批准下次发布的所有修改,所以 `git rebase` 不会有预期的结果。为什么会这样?因为 `git rebase` 或者 `git merge` 会把上一个冲刺的每一个调整都纳入其中。
遴选就是答案!因为它只关注在提交中添加的变更,所以遴选只会带入批准的变更,而不添加其他的提交。
还有其他几个原因可以使用遴选:
* 这对于 bug 修复是必不可少的,因为 bug 是出现在开发分支中对应的提交的。
* 你可以通过使用 `git cherry-pick` 来避免不必要的工作,而不用使用其他选项例如 `git diff` 来应用特定变更。
* 如果因为不同 Git 分支的版本不兼容而无法将整个分支联合起来,那么它是一个很有用的工具。
### 使用 cherry-pick 命令
`cherry-pick` 命令的最简单形式中,你只需使用 [SHA][3] 标识符来表示你想整合到当前 HEAD 分支的提交。
要获得提交的哈希值,可以使用 `git log` 命令:
```
$ git log --oneline
```
当你知道了提交的哈希值后,你就可以使用 `cherry-pick` 命令。
语法是:
```
$ git cherry-pick <commit sha>
```
例如:
```
$ git cherry-pick 65be1e5
```
这将会把指定的修改合并到当前已签出的分支上。
如果你想做进一步的修改,也可以让 Git 将提交的变更内容添加到你的工作副本中。
语法是:
```
$ git cherry-pick <commit sha> --no-commit
```
例如:
```
$ git cherry-pick 65be1e5 --no-commit
```
如果你想同时选择多个提交,请将它们的提交哈希值用空格隔开:
```
$ git cherry-pick hash1 hash3
```
当遴选提交时,你不能使用 `git pull` 命令,因为它能获取一个仓库的提交**并**自动合并到另一个仓库。`cherry-pick` 是一个专门不这么做的工具;另一方面,你可以使用 `git fetch`,它可以获取提交,但不应用它们。毫无疑问,`git pull` 很方便,但它不精确。
### 自己尝试
要尝试这个过程,启动终端并生成一个示例项目:
```
$ mkdir fruit.git
$ cd fruit.git
$ git init .
```
创建一些数据并提交:
```
$ echo "Kiwifruit" > fruit.txt
$ git add fruit.txt
$ git commit -m 'First commit'
```
现在,通过创建一个项目的复刻来代表一个远程开发者:
```
$ mkdir ~/fruit.fork
$ cd !$
$ echo "Strawberry" >> fruit.txt
$ git add fruit.txt
$ git commit -m 'Added a fruit"
```
这是一个有效的提交。现在,创建一个不好的提交,代表你不想合并到你的项目中的东西:
```
$ echo "Rhubarb" >> fruit.txt
$ git add fruit.txt
$ git commit -m 'Added a vegetable that tastes like a fruit"
```
返回你的仓库,从你的假想的开发者那里获取提交的内容:
```
$ cd ~/fruit.git
$ git remote add dev ~/fruit.fork
$ git fetch dev
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (6/6), done...
```
```
$ git log oneline dev/master
e858ab2 Added a vegetable that tastes like a fruit
0664292 Added a fruit
b56e0f8 First commit
```
你已经从你想象中的开发者那里获取了提交的内容,但你还没有将它们合并到你的版本库中。你想接受第二个提交,但不想接受第三个提交,所以使用 `cherry-pick`
```
$ git cherry-pick 0664292
```
第二次提交现在在你的仓库里了:
```
$ cat fruit.txt
Kiwifruit
Strawberry
```
将你的更改推送到远程服务器上,这就完成了!
### 避免使用遴选的原因
在开发者社区中,通常不鼓励所以遴选。主要原因是它会造成重复提交,而你也失去了跟踪你的提交历史的能力。
如果你不按顺序地遴选了大量的提交,这些提交会被记录在你的分支中,这可能会在 Git 分支中导致不理想的结果。
遴选是一个强大的命令,如果没有正确理解可能发生的情况,它可能会导致问题。不过,当你搞砸了,提交到错误的分支时,它可能会救你一命(至少是你当天的工作)。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/cherry-picking-git
作者:[Rajeev Bera][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/acompiler
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/pictures/cherry-picking-recipe-baking-cooking.jpg?itok=XVwse6hw (Measuring and baking a cherry pie recipe)
[2]: https://acompiler.com/git-head/
[3]: https://en.wikipedia.org/wiki/Secure_Hash_Algorithms

View File

@ -0,0 +1,107 @@
[#]: subject: (Why I love using bspwm for my Linux window manager)
[#]: via: (https://opensource.com/article/21/4/bspwm-linux)
[#]: author: (Stephen Adams https://opensource.com/users/stevehnh)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13308-1.html)
为什么我喜欢用 bspwm 来做我的 Linux 窗口管理器
======
> 在 Fedora Linux 上安装、配置并开始使用 bspwm 窗口管理器。
![](https://img.linux.net.cn/data/attachment/album/202104/18/114637hxvqp4hfvbbhihb4.jpg)
有些人喜欢重新布置家具。还有的人喜欢尝试新鞋或定期重新装修他们的卧室。我呢,则是尝试 Linux 桌面。
在对网上看到的一些不可思议的桌面环境流口水之后,我对一个窗口管理器特别好奇:[bspwm][2]。
![bspwm desktop][3]
我喜欢 [i3][5] 窗口管理器已经有一段时间了,我很喜欢它的布局方式和上手的便捷性。但 bspwm 的某些特性吸引了我。有几个原因让我决定尝试一下:
* 它_只是_一个窗口管理器WM
* 它由几个易于配置的脚本管理。
* 它默认支持窗口之间的间隙。
可能是最需要指出的第一个原因是它只是一个窗口管理器。和 i3 一样默认情况下没有任何图形化的那些花哨东西。你当然可以随心所欲地定制它但_你_需要付出努力来使它看起来像你想要的。这也是它吸引我的部分原因。
虽然它可以在许多发行版上使用,但在我这个例子中使用的是 Fedora Linux。
### 安装 bspwm
bspwm 在大多数常见的发行版中都有打包,所以你可以用系统的包管理器安装它。下面这个命令还会安装 [sxkhd][6],这是一个 X 窗口系统的守护程序,它“通过执行命令对输入事件做出反应”;还有 [dmenu][7],这是一个通用的 X 窗口菜单:
```
dnf install bspwm sxkhd dmenu
```
因为 bspwm 只是一个窗口管理器,所以没有任何内置的快捷键或键盘命令。这也是它与 i3 等软件的不同之处。所以,在你第一次启动窗口管理器之前,请先配置一下 `sxkhd`
```
systemctl start sxkhd
systemctl enable sxkhd
```
这样就可以在登录时启用 `sxkhd`,但你还需要一些基本功能的配置:
```
curl https://raw.githubusercontent.com/baskerville/bspwm/master/examples/sxhkdrc --output ~/.config/sxkhd/sxkhdrc
```
在你深入了解之前,不妨先看看这个文件,因为有些脚本调用的命令可能在你的系统中并不存在。一个很好的例子是调用 `urxvt``super + Return` 快捷键。把它改成你喜欢的终端,尤其是当你没有安装 `urxvt` 的时候:
```
#
# wm independent hotkeys
#
   
# terminal emulator
super + Return
        urxvt
   
# program launcher
super + @space
        dmenu_run
```
如果你使用的是 GDM、LightDM 或其他显示管理器DM只要在登录前选择 `bspwm` 即可。
### 配置 bspwm
当你登录后,你会看到屏幕上什么都没有。这不是你感觉到的空虚感。而是无限可能性!你现在可以开始摆弄桌面环境的所有部分了。你现在可以开始摆弄这些年你认为理所当然的桌面环境的所有部分了。从头开始构建并不容易,但一旦你掌握了诀窍,就会非常有收获。
任何窗口管理器最困难的是掌握快捷键。你开始会很慢,但在很短的时间内,你就可以只使用键盘在系统中到处操作,在你的朋友和家人面前看起来像一个终极黑客。
你可以通过编辑 `~/.config/bspwm/bspwmrc`,在启动时添加应用,设置桌面和显示器,并为你的窗口应该如何表现设置规则,随心所欲地定制系统。有一些默认设置的例子可以让你开始使用。键盘快捷键都是由 `sxkhdrc` 文件管理的。
还有更多的开源项目可以安装,让你的电脑看起来更漂亮,比如用于桌面背景的 [Feh][8]、状态栏的 [Polybar][9]、应用启动器的 [Rofi][10],还有 [Compton][11] 可以给你提供阴影和透明度,可以让你的电脑看起来焕然一新。
玩得愉快!
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/bspwm-linux
作者:[Stephen Adams][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/stevehnh
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/windows_building_sky_scale.jpg?itok=mH6CAX29 (Tall building with windows)
[2]: https://github.com/baskerville/bspwm
[3]: https://opensource.com/sites/default/files/uploads/bspwm-desktop.png (bspwm desktop)
[4]: https://creativecommons.org/licenses/by-sa/4.0/
[5]: https://i3wm.org/
[6]: https://github.com/baskerville/sxhkd
[7]: https://linux.die.net/man/1/dmenu
[8]: https://github.com/derf/feh
[9]: https://github.com/polybar/polybar
[10]: https://github.com/davatorium/rofi
[11]: https://github.com/chjj/compton

View File

@ -0,0 +1,84 @@
[#]: subject: (4 ways open source gives you a competitive edge)
[#]: via: (https://opensource.com/article/21/4/open-source-competitive-advantage)
[#]: author: (Jason Blais https://opensource.com/users/jasonblais)
[#]: collector: (lujun9972)
[#]: translator: (DCOLIVERSUN)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13299-1.html)
开源为你带来竞争优势的 4 种方式
======
> 使用开源技术可以帮助组织获得更好的业务结果。
![](https://img.linux.net.cn/data/attachment/album/202104/15/085345a2aani3axxj7wcis.jpg)
构建技术栈是每个组织的主要决策。选择合适的工具将让团队获得成功,选择错误的解决方案或平台会对生产率和利润率产生毁灭性影响。为了在当今快节奏的世界中脱颖而出,组织必须明智地选择数字解决方案,好的数字解决方案可以提升团队行动力与运营敏捷性。
这就是为什么越来越多的组织都采用开源解决方案的原因,这些组织来自各行各业,规模有大有小。根据 [麦肯锡][2] 最近的报告,高绩效组织的最大区别是采用不同的开源方案。
采用开源技术可以帮助组织提高竞争优势、获得更好业务成果的原因有以下四点。
### 1、可拓展性和灵活性
可以说,技术世界发展很快。例如,在 2014 年之前Kubernetes 并不存在,但今天,它却令人印象深刻,无处不在。根据 CNCF [2020 云原生调查][3]91% 的团队正在以某种形式使用 Kubernetes。
组织投资开源的一个主要原因是因为开源赋予组织行动敏捷性,组织可以迅速地将新技术集成到技术栈中。这与传统方法不同,在传统方法中,团队需要几个季度甚至几年来审查、实施、采用软件,这导致团队不可能实现火速转变。
开源解决方案完整地提供源代码,团队可以轻松将软件与他们每天使用的工具连接起来。
简而言之,开源让开发团队能够为手头的东西构建完美的工具,而不是被迫改变工作方式来适应不灵活的专有工具。
### 2、安全性和高可信的协作
在数据泄露备受瞩目的时代,组织需要高度安全的工具来保护敏感数据的安全。
专有解决方案中的漏洞不易被发现,被发现时为时已晚。不幸的是,使用这些平台的团队无法看到源代码,本质上是他们将安全性外包给特定供应商,并希望得到最好的结果。
采用开源的另一个主要原因是开源工具使组织能够自己把控安全。例如,开源项目——尤其是拥有大型开源社区的项目——往往会收到更负责任的漏洞披露,因为每个人在使用过程中都可以彻底检查源代码。
由于源代码是免费提供的,因此披露通常伴随着修复缺陷的详细建议解决方案。这些方案使得开发团队能够快速解决问题,不断增强软件。
在远程办公时代,对于分布式团队来说,在知道敏感数据受到保护的情况下进行协作比以往任何时候都更重要。开源解决方案允许组织审核安全性、完全掌控自己数据,因此开源方案可以促进远程环境下高可信协作方式的成长。
### 3、不受供应商限制
根据 [最近的一项研究][4]68% 的 CIO 担心受供应商限制。当你受限于一项技术中,你会被迫接受别人的结论,而不是自己做结论。
当组织更换供应商时,专有解决方案通常会 [给你带走数据带来挑战][5]。另一方面,开源工具提供了组织需要的自由度和灵活性,以避免受供应商限制,开源工具可以让组织把数据带去任意地方。
### 4、顶尖人才和社区
随着越来越多的公司 [接受远程办公][6],人才争夺战变得愈发激烈。
在软件开发领域,获得顶尖人才始于赋予工程师先进工具,让工程师在工作中充分发挥潜力。开发人员 [越来越喜欢开源解决方案][7] 而不是专有解决方案,组织应该强烈考虑用开源替代商业解决方案,以吸引市场上最好的开发人员。
除了雇佣、留住顶尖人才更容易,公司能够通过开源平台利用贡献者社区,得到解决问题的建议,从平台中得到最大收益。此外,社区成员还可以 [直接为开源项目做贡献][8]。
### 开源带来自由
开源软件在企业团队中越来越受到欢迎——[这是有原因的][8]。它帮助团队灵活地构建完美的工作工具,同时使团队可以维护高度安全的环境。同时,开源允许团队掌控未来方向,而不是局限于供应商的路线图。开源还帮助公司接触才华横溢的工程师和开源社区成员。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/open-source-competitive-advantage
作者:[Jason Blais][a]
选题:[lujun9972][b]
译者:[DCOLIVERSUN](https://github.com/DCOLIVERSUN)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jasonblais
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openwires_fromRHT_520_0612LL.png?itok=PqZi55Ab (Open ethernet cords.)
[2]: https://www.mckinsey.com/industries/technology-media-and-telecommunications/our-insights/developer-velocity-how-software-excellence-fuels-business-performance#
[3]: https://www.cncf.io/blog/2020/11/17/cloud-native-survey-2020-containers-in-production-jump-300-from-our-first-survey/
[4]: https://solutionsreview.com/cloud-platforms/flexera-68-percent-of-cios-worry-about-vendor-lock-in-with-public-cloud/
[5]: https://www.computerworld.com/article/3428679/mattermost-makes-case-for-open-source-as-team-messaging-market-booms.html
[6]: https://mattermost.com/blog/tips-for-working-remotely/
[7]: https://opensource.com/article/20/6/open-source-developers-survey
[8]: https://mattermost.com/blog/100-most-popular-mattermost-features-invented-and-contributed-by-our-amazing-open-source-community/
[9]: https://mattermost.com/open-source-advantage/

View File

@ -0,0 +1,80 @@
[#]: subject: (5 signs you're a groff programmer)
[#]: via: (https://opensource.com/article/21/4/groff-programmer)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
[#]: collector: (lujun9972)
[#]: translator: (liweitianux)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13316-1.html)
groff 程序员的 5 个标志
======
> 学习一款老派的文本处理软件 groff就像是学习骑自行车。
![](https://img.linux.net.cn/data/attachment/album/202104/20/221218y34lew4gewqw2xg2.jpg)
我第一次发现 Unix 系统是在 20 世纪 90 年代早期,当时我还在大学读本科。我太喜欢这个系统了,所以我将家里电脑上的 MS-DOS 也换成了 Linux 系统。
在 90 年代早期至中期Linux 所缺失的一个东西是<ruby>字处理软件<rt>word processor</rt></ruby>。作为其他桌面操作系统的标准办公程序,字处理软件能让你轻松地编辑文本。我经常在 DOS 上使用字处理软件来撰写课程论文。直到 90 年代末,我都没能找到一款 Linux 原生的字处理软件。直到那时,文字处理是我在第一台电脑上保留双启动的少有的原因之一,那样我可以偶尔切换到 DOS 系统写论文。
后来,我发现 Linux 提供了一款文字处理软件GNU troff它一般称为 [groff][2],是经典的文本处理系统 troff 的一个现代实现。troff 是 “<ruby>排版工快印<rt>typesetter roff</rt></ruby>” 的简称,是 nroff 系统的改进版本,而 nroff 又是最初的 roff 系统的新实现。roff 表示<ruby>快速印出<rt>run off</rt></ruby>,比如“快速印出”一份文档。
利用文本处理系统,你在纯文本编辑器里编辑内容,通过<ruby><rt>macro</rt></ruby>或其他处理命令来添加格式。然后将文件输入文本处理系统,比如 groff来生成适合打印的格式化输出。另一个知名的文本处理系统是 LaTeX但是 groff 已经满足我的需求,而且足够简单。
经过一点实践,我发现在 Linux 上使用 groff 来撰写课程论文与使用字处理软件一样容易。尽管我现在不再使用 groff 来写文档了,我依然记得它的那些宏和命令。如果你也是这样并且在那么多年之前学会了使用 groff 写作,你可能会认出这 5 个 groff 程序员的标志。
### 1、你有一个喜欢的宏集
输入由宏点缀的纯文本,你便能在 groff 里对文档进行格式化。groff 里的宏是行首为单个句点(`.`)的短命令。例如:如果你想在输出里插入几行,宏命令 `.sp 2` 会添加两个空行。groff 还具有其他一些基本的宏,支持各种各样的格式化。
为了能让作者更容易地格式化文档groff 还提供了不同的 <ruby>宏集<rt>macro set</rt></ruby>,即一组能够让你以自己的方式格式化文档的宏的集合。我学会的第一个宏集是 `-me` 宏集。这个宏集的名称其实是 `e`,你在处理文件时使用 `-me` 选项来指定这个 `e` 宏集。
groff 还包含其他宏集。例如,`-man` 宏集以前是用于格式化 Unix 系统内置的 <ruby>手册页<rt>manual page</rt></ruby> 的标准宏集,`-ms` 宏集经常用于格式化其他一些技术文档。如果你学会了使用 groff 写作,你可能有一个喜欢的宏集。
### 2、你想专注于内容而非格式
使用 groff 写作的一个很好的特点是,你能专注于你的 _内容_而不用太担心它看起来会怎么样。对于技术作者而言这是一个很实用的特点。对专业作家来说groff 是一个很好的、“不会分心”的写作环境。至少,使用 groff `-T` 选项所支持的任何格式来交付内容时你不用担心,这包括 PDF、PostScript、HTML、以及纯文本。不过你无法直接从 groff 生成 LibreOffice ODT 文件或者 Word DOC 文件。
一旦你使用 groff 写作变得有信心之后,宏便开始 _消失_。用于格式化的宏变成了背景的一部分,而你纯粹地专注于眼前的文本内容。我已经使用 groff 写了足够多内容,以至于我甚至不再看见那些宏。也许,这就像写代码,而你的大脑随意换档,于是你就像计算机一样思考,看到的代码就是一组指令。对我而言,使用 groff 写作就像那样:我仅仅看到文本,而我的大脑将宏自动地翻译成格式。
### 3、你喜欢怀旧复古的感觉
当然,使用一个更典型的字处理软件来写你的文档可能更 _简单_,比如 LibreOffice Writer、甚至 Google Docs 或 Microsoft Word。而且对于某些种类的文档桌面型字处理软件才是正确的选择。但是如果你想要这种怀旧复古的感觉使用 groff 写作很难被打败。
我承认,我的大部分写作是用 LibreOffice Writer 完成的,它的表现很出色。但是当我渴望以一种怀旧复古的方式去做时,我会打开编辑器用 groff 来写文档。
### 4、你希望能到处使用它
groff 及其同类软件在几乎所有的 Unix 系统上都是标准软件包。此外groff 宏不会随系统而变化。比如,`-me` 宏集在不同系统上都应该相同。因此,一旦你在一个系统上学会使用宏,你能在下一个系统上同样地使用它们。
另外,因为 groff 文档就是纯文本文档,所以你能使用任何你喜欢的编辑器来编辑文档。我喜欢使用 GNU Emacs 来编辑我的 groff 文档,但是你可能使用 GNOME Gedit、Vim、其他你 [最喜欢的文本编辑器][3]。大部分编辑器会支持这样一种模式,其中 groff 宏会以不同的颜色高亮显示,帮助你在处理文件之前便能发现错误。
### 5、你使用 -me 写了这篇文章
当我决定要写这篇文章时,我认为最佳的方式便是直接使用 groff。我想要演示 groff 在编写文档方面是多么的灵活。所以,虽然你正在网上读这篇文章,但是它最初是用 groff 写的。
我希望这激发了你学习如何使用 groff 撰写文档的兴趣。如果你想学习 `-me` 宏集里更高级的函数,参考 Eric Allman 的《Writing papers with groff using -me》你应该能在系统的 groff 文档找到这本书,文件名为 `meintro.me`。这是一份很好的参考资料,还解释了使用 `-me` 宏集格式化论文的其他方式。
我还提供了这篇文章的原始草稿,其中使用了 `-me` 宏集。下载这个文件并保存为 `five-signs-groff.me`,然后运行 groff 处理来查看它。`-T` 选项设置输出类型,比如 `-Tps` 用于生成 PostScript 输出,`-Thtml` 用于生成 HTML 文件。比如:
```
groff -me -Thtml five-signs-groff.me > five-signs-groff.html
```
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/groff-programmer
作者:[Jim Hall][a]
选题:[lujun9972][b]
译者:[liweitianux](https://github.com/liweitianux)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead.png?itok=h3fCkVmU (Typewriter in the grass)
[2]: https://en.wikipedia.org/wiki/Groff_(software)
[3]: https://opensource.com/article/21/2/open-source-text-editors

View File

@ -0,0 +1,119 @@
[#]: subject: (How to Install Steam on Fedora [Beginners Tip])
[#]: via: (https://itsfoss.com/install-steam-fedora/)
[#]: author: (John Paul https://itsfoss.com/author/john/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13302-1.html)
如何在 Fedora 上安装 Steam
======
![](https://img.linux.net.cn/data/attachment/album/202104/16/090703cg4t5npnseskhxhv.jpg)
Steam 对 Linux 游戏玩家来说是最好的东西了。由于 Steam你可以在 Linux 上玩成百上千的游戏。
如果你还不知道Steam 是最流行的 PC 游戏平台。2013 年,它开始可以在 Linux 使用。[Steam 最新的 Proton 项目][1] 允许你在 Linux 上玩为 Windows 平台创建的游戏。这让 Linux 游戏库增强了许多倍。
![][2]
Steam 提供了一个桌面客户端,你可以用它从 Steam 商店下载或购买游戏,然后安装并玩它。
过去我们曾讨论过 [在 Ubuntu 上安装 Steam][3]。在这个初学者教程中,我将向你展示在 Fedora Linux 上安装 Steam 的步骤。
### 在 Fedora 上安装 Steam
要在 Fedora 上使用 Steam你必须使用 RMPFusion 软件库。[RPMFusion][4] 是一套第三方软件库,其中包含了 Fedora 选择不与它们的操作系统一起发布的软件。它们提供自由(开源)和非自由(闭源)的软件库。由于 Steam 在非自由软件库中,你将只安装那一个。
我将同时介绍终端和图形安装方法。
#### 方法 1通过终端安装 Steam
这是最简单的方法,因为它需要的步骤最少。只需输入以下命令即可启用仓库:
```
sudo dnf install https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
```
你会被要求输入密码。然后你会被要求验证是否要安装这些仓库。你同意后,仓库安装就会完成。
要安装 Steam只需输入以下命令
```
sudo dnf install steam
```
![Install Steam via command line][5]
输入密码后按 `Y` 接受。安装完毕后,打开 Steam玩一些游戏。
#### 方法 2通过 GUI 安装 Steam
你可以从软件中心 [启用 Fedora 上的第三方仓库][6]。打开软件中心并点击菜单。
![][7]
在 “软件仓库” 窗口中,你会看到顶部有一个 “第三方软件仓库”。点击 “安装” 按钮。当提示你输入密码时,就完成了。
![][8]
安装了 Steam 的 RPM Fusion 仓库后,更新你系统的软件缓存(如果需要),并在软件中心搜索 Steam。
![Steam in GNOME Software Center][9]
安装完成后,打开 GNOME 软件中心,搜索 Steam。找到 Steam 页面后,点击安装。当被问及密码时,输入你的密码就可以了。
安装完 Steam 后,启动应用,输入你的 Steam 帐户详情或注册它,然后享受你的游戏。
### 将 Steam 作为 Flatpak 使用
Steam 也可以作为 Flatpak 使用。Fedora 上默认安装 Flatpak。在使用该方法安装 Steam 之前,我们必须安装 Flathub 仓库。
![Install Flathub][10]
首先,在浏览器中打开 [Flatpak 网站][11]。现在,点击标有 “Flathub repository file” 的蓝色按钮。浏览器会询问你是否要在 GNOME 软件中心打开该文件。点击确定。在 GNOME 软件中心打开后,点击安装按钮。系统会提示你输入密码。
如果你在尝试安装 Flathub 仓库时出现错误,请在终端运行以下命令:
```
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
```
安装好 Flathub 仓库后,你需要做的就是在 GNOME 软件中心搜索 Steam。找到后安装它你就可以开始玩了。
![Fedora Repo Select][12]
Flathub 版本的 Steam 也有几个附加组件可以安装。其中包括一个 DOS 兼容工具和几个 [Vulkan][13] 和 Proton 工具。
![][14]
我想这应该可以帮助你在 Fedora 上使用 Steam。享受你的游戏 :)
--------------------------------------------------------------------------------
via: https://itsfoss.com/install-steam-fedora/
作者:[John Paul][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/john/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/steam-play-proton/
[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/05/Steam-Store.jpg?resize=800%2C382&ssl=1
[3]: https://itsfoss.com/install-steam-ubuntu-linux/
[4]: https://rpmfusion.org/
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/install-steam-fedora.png?resize=800%2C588&ssl=1
[6]: https://itsfoss.com/fedora-third-party-repos/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/software-meni.png?resize=800%2C672&ssl=1
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-third-party-repo-gui.png?resize=746%2C800&ssl=1
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/gnome-store-steam.jpg?resize=800%2C434&ssl=1
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/03/flatpak-install-button.jpg?resize=800%2C434&ssl=1
[11]: https://www.flatpak.org/setup/Fedora/
[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/fedora-repo-select.jpg?resize=800%2C434&ssl=1
[13]: https://developer.nvidia.com/vulkan
[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/steam-flatpak-addons.jpg?resize=800%2C434&ssl=1

View File

@ -0,0 +1,135 @@
[#]: subject: (GNOMEs Very Own “GNOME OS” is Not a Linux Distro for Everyone [Review])
[#]: via: (https://itsfoss.com/gnome-os/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13287-1.html)
GNOME OS一个并不是适合所有人的 Linux 发行版
======
![](https://img.linux.net.cn/data/attachment/album/202104/11/103205t34lcaa3t0a3xjjw.jpg)
每当 GNOME 的一个重要版本到来时,总是很想尽快试用它。但是,要想第一时间进行测试,主要还是得依靠 [Fedora Rawhide][1] 开发分支。
然而,开发分支并不总是让人放心的,所以,用来尝试最新的 GNOME 并不是最方便的解决方案。这里,我所说的测试,并不仅仅是指用户的测试,同时也能够用于开发者对设计变更进行测试。
所以,最近来了个大救星 GNOME OS让测试的过程变得轻松起来。但是它到底是什么怎么安装呢让我们一起来看看吧。
### 什么是 GNOME OS
GNOME OS 并不是一个独立完整的 Linux 发行版。事实上,它根本不基于任何东西。它是一个不完整的参考系统,只是为了让 GNOME 桌面工作。它仅仅是一个可启动的虚拟机镜像,在 GNOME 进入任何发行版的仓库之前,为调试和测试功能而量身定做的。
在 GNOME 的博客中,有一篇提到了它:
> GNOME OS 旨在通过提供一个用于开发、设计和用户测试的工作系统,来更好地促进 GNOME 的开发。
如果你好奇的话,你可以看看 GNOME 星球上的一篇 [博客文章][2] 来了解关于 GNOME OS 的更多信息。
### 如果它不是一个成熟的 Linux 发行版,那么它是用来干什么的?
![][3]
值得注意的是,每一次新的提交都可以创建一个新的 GNOME OS 镜像,所以它应该会使测试过程变得高效,并帮助你在开发周期的早期测试并发现问题。
不要忘了,设计者不再需要自己构建软件来测试 GNOME Shell 或任何其他核心模块。这为他们节省了时间和整个 GNOME 开发周期。
当然,不仅限于开发者和技术测试人员,它还可以让记者们拿到最新的和最棒的东西,来报道 GNOME 下一个版本或它是如何成型的。
媒体和 GNOME 团队也得到了一个很好的机会,借助于 GNOME OS他们可以准备视频、图片两种形式的视觉资料来宣传此次发布。
### 如何安装 GNOME OS
要轻松安装 GNOME OS你需要先安装 GNOME Boxes 应用程序。
#### 安装 GNOME Boxes
Boxes 是一款简单的虚拟化软件,它不提供任何高级选项,但可以让你轻松安装操作系统镜像来快速测试。它是专门针对桌面终端用户的,所以使用起来也很方便。
要在任何 Linux 发行版上安装它,你可以利用 [Flathub][5] 的 [Flatpak][4] 包。如果你不知道 Flatpak你可能需要阅读我们的《[在 Linux 中安装和使用 Flatpak][6]》指南。
你也可以在任何基于 Ubuntu 的发行版上直接在终端上输入以下内容进行安装:
```
sudo apt install gnome-boxes
```
一旦你安装了 Boxes从这里安装 GNOME OS 就相当容易了。
#### 安装 GNOME OS
安装好 Boxes 后,你需要启动程序。接下来,点击窗口左上角的 “+” 标志,然后点击 “操作系统下载”,如下图所示。
![][7]
这个选项可以让你直接下载镜像文件,然后就可以继续安装它。
你所需要做的就是搜索 “GNOME”然后你应该会找到可用的每夜构建版。这可以确保你正在尝试最新和最优秀的 GNOME 开发版本。
另外,你也可以前往 [GNOME OS 每夜构建网站][8] 下载系统镜像,然后在 Boxes 应用中选择 “运行系统镜像文件” 选择该 ISO如上图截图所示继续安装。
![][9]
考虑到你没有单独下载镜像。当你点击后,应该会开始下载,并且会出现一个进度条。
![][10]
完成后,如果需要,它会要求你自定义配置,让你创建虚拟机,如下图所示。
![][11]
你可以根据你可用的系统资源来定制资源分配,但应该可以使用默认设置。
点击 “创建”,就会直接开始 GNOME OS 的安装。
![][12]
选择“使用现有的版本”,然后继续。接下来,你必须选择磁盘(保持原样),然后同意擦除你所有的文件和应用程序(它不会删除本地计算机上的任何东西)。
![][13]
现在,它将简单地重新格式化并安装它。然后就完成了。它会提示你重启,重启后,你会发现 GNOME OS 已经安装好了。
它会像其他 Linux 发行版一样简单地启动,并要求你设置一些东西,包括用户名和密码。然后,你就可以开始探索了。
如果你想知道它的样子,它基本上就是最新的 GNOME 桌面环境。在 GNOME 40 正式发布之前,我用 GNOME OS 做了一个 GNOME 40 的概述视频。
### 结束语
GNOME OS 绝对是对开发者、设计师和媒体有用的东西。它可以让你轻松地测试最新的 GNOME 开发版本,而无需投入大量的时间。
我可以很快地测试 [GNOME 40][14],就是因为这个。当然,你要记住,这并不是一个可以在物理设备上安装的完整功能的操作系统。他们有计划让它可以在物理机器上运行,但就目前而言,它只是为虚拟机量身定做的,尤其是使用 GNOME Boxes。
GNOME Boxes 并没有提供任何高级选项,所以设置和使用它变得相当容易。如果体验太慢的话,你可能要调整一下资源,但在我的情况下,总体来说是一个不错的体验。
你试过 GNOME OS 了吗?欢迎在下面的评论中告诉我你的想法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/gnome-os/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://fedoraproject.org/wiki/Releases/Rawhide
[2]: https://blogs.gnome.org/alatiera/2020/10/07/what-is-gnome-os/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/04/GNOME-OS-distro-review.png?resize=800%2C450&ssl=1
[4]: https://itsfoss.com/what-is-flatpak/
[5]: https://flathub.org/apps/details/org.gnome.Boxes
[6]: https://itsfoss.com/flatpak-guide/
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/gnome-os-search.jpg?resize=800%2C729&ssl=1
[8]: https://os.gnome.org/
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/gnome-os-boxes.jpg?resize=800%2C694&ssl=1
[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/gnome-os-download.jpg?resize=798%2C360&ssl=1
[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/gnome-boxes-vm-setup.png?resize=800%2C301&ssl=1
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/gnome-nightly-install.jpg?resize=800%2C636&ssl=1
[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/04/gnome-os-installation.jpg?resize=800%2C619&ssl=1
[14]: https://news.itsfoss.com/gnome-40-release/

View File

@ -0,0 +1,191 @@
[#]: subject: (6 open source tools and tips to securing a Linux server for beginners)
[#]: via: (https://opensource.com/article/21/4/securing-linux-servers)
[#]: author: (Sahana Sreeram https://opensource.com/users/sahanasreeram01gmailcom)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13298-1.html)
6 个提升 Linux 服务器安全的开源工具和技巧
======
> 使用开源工具来保护你的 Linux 环境不被入侵。
![](https://img.linux.net.cn/data/attachment/album/202104/15/082334ltqtgg40tu7l80rd.jpg)
如今我们的许多个人和专业数据都可以在网上获得,因此无论是专业人士还是普通互联网用户,学习安全和隐私的基本知识是非常重要的。作为一名学生,我通过学校的 CyberPatriot 活动获得了这方面的经验,在那里我有机会与行业专家交流,了解网络漏洞和建立系统安全的基本步骤。
本文基于我作为初学者迄今所学的知识,详细介绍了六个简单的步骤,以提高个人使用的 Linux 环境的安全性。在我的整个旅程中,我利用开源工具来加速我的学习过程,并熟悉了与提升 Linux 服务器安全有关的更高层次的概念。
我使用我最熟悉的 Ubuntu 18.04 版本测试了这些步骤,但这些步骤也适用于其他 Linux 发行版。
### 1、运行更新
开发者们不断地寻找方法,通过修补已知的漏洞,使服务器更加稳定、快速、安全。定期运行更新是一个好习惯,可以最大限度地提高安全性。运行它们:
```
sudo apt-get update && apt-get upgrade
```
### 2、启用防火墙保护
[启用防火墙][2] 可以更容易地控制服务器上的进站和出站流量。在 Linux 上有许多防火墙应用程序可以使用,包括 [firewall-cmd][3] 和 <ruby>简单防火墙<rt>Uncomplicated Firewall</rt></ruby>[UFW][4])。我使用 UFW所以我的例子是专门针对它的但这些原则适用于你选择的任何防火墙。
安装 UFW
```
sudo apt-get install ufw
```
如果你想进一步保护你的服务器,你可以拒绝传入和传出的连接。请注意,这将切断你的服务器与世界的联系,所以一旦你封锁了所有的流量,你必须指定哪些出站连接是允许从你的系统中发出的:
```
sudo ufw default deny incoming
sudo ufw default allow outgoing
```
你也可以编写规则来允许你个人使用所需要的传入连接:
```
ufw allow <service>
```
例如,允许 SSH 连接:
```
ufw allow ssh
```
最后,启用你的防火墙:
```
sudo ufw enable
```
### 3、加强密码保护
实施强有力的密码政策是保持服务器安全、防止网络攻击和数据泄露的一个重要方面。密码策略的一些最佳实践包括强制要求最小长度和指定密码年龄。我使用 libpam-cracklib 软件包来完成这些任务。
安装 libpam-cracklib 软件包:
```
sudo apt-get install libpam-cracklib
```
强制要求密码的长度:
* 打开 `/etc/pam.d/common-password` 文件。
* 将 `minlen=12` 行改为你需要的任意字符数,从而改变所有密码的最小字符长度要求。
为防止密码重复使用:
* 在同一个文件(`/etc/pam.d/common-password`)中,添加 `remember=x` 行。
* 例如,如果你想防止用户重复使用他们最后 5 个密码中的一个,使用 `remember=5`
要强制要求密码年龄:
* 在 `/etc/login.defs` 文件中找到以下几行,并用你喜欢的时间(天数)替换。例如:
```
PASS_MIN_AGE: 3
PASS_MAX_AGE: 90
PASS_WARN_AGE: 14
```
强制要求字符规格:
* 在密码中强制要求字符规格的四个参数是 `lcredit`(小写)、`ucredit`(大写)、`dcredit`(数字)和 `ocredit`(其他字符)。
* 在同一个文件(`/etc/pam.d/common-password`)中,找到包含 `pam_cracklib.so` 的行。
* 在该行末尾添加以下内容:`lcredit=-a ucredit=-b dcredit=-c ocredit=-d`。
* 例如,下面这行要求密码必须至少包含一个每种字符。你可以根据你喜欢的密码安全级别来改变数字。`lcredit=-1 ucredit=-1 dcredit=-1 ocredit=-1`。
### 4、停用容易被利用的非必要服务。
停用不必要的服务是一种最好的做法。这样可以减少开放的端口,以便被利用。
安装 systemd 软件包:
```
sudo apt-get install systemd
```
查看哪些服务正在运行:
```
systemctl list-units
```
[识别][5] 哪些服务可能会导致你的系统出现潜在的漏洞。对于每个服务可以:
* 停止当前正在运行的服务:`systemctl stop <service>`。
* 禁止服务在系统启动时启动:`systemctl disable <service>`。
* 运行这些命令后,检查服务的状态:`systemctl status <service>`。
### 5、检查监听端口
开放的端口可能会带来安全风险,所以检查服务器上的监听端口很重要。我使用 [netstat][6] 命令来显示所有的网络连接:
```
netstat -tulpn
```
查看 “address” 列,确定 [端口号][7]。一旦你找到了开放的端口,检查它们是否都是必要的。如果不是,[调整你正在运行的服务][8],或者调整你的防火墙设置。
### 6、扫描恶意软件
杀毒扫描软件可以有用的防止病毒进入你的系统。使用它们是一种简单的方法,可以让你的服务器免受恶意软件的侵害。我首选的工具是开源软件 [ClamAV][9]。
安装 ClamAV
```
sudo apt-get install clamav
```
更新病毒签名:
```
sudo freshclam
```
扫描所有文件,并打印出被感染的文件,发现一个就会响铃:
```
sudo clamscan -r --bell -i /
```
你可以而且应该设置为自动扫描,这样你就不必记住或花时间手动进行扫描。对于这样简单的自动化,你可以使用 [systemd 定时器][10] 或者你的 [喜欢的 cron][11] 来做到。
### 保证你的服务器安全
我们不能把保护服务器安全的责任只交给一个人或一个组织。随着威胁环境的不断迅速扩大,我们每个人都应该意识到服务器安全的重要性,并采用一些简单、有效的安全最佳实践。
这些只是你提升 Linux 服务器的安全可以采取的众多步骤中的一部分。当然,预防只是解决方案的一部分。这些策略应该与严格监控拒绝服务攻击、用 [Lynis][12] 做系统分析以及创建频繁的备份相结合。
你使用哪些开源工具来保证服务器的安全?在评论中告诉我们它们的情况。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/securing-linux-servers
作者:[Sahana Sreeram][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/sahanasreeram01gmailcom
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices)
[2]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd
[3]: https://opensource.com/article/20/2/firewall-cheat-sheet
[4]: https://wiki.ubuntu.com/UncomplicatedFirewall
[5]: http://www.yorku.ca/infosec/Administrators/UNIX_disable.html
[6]: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/netstat
[7]: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers
[8]: https://opensource.com/article/20/5/systemd-units
[9]: https://www.clamav.net/
[10]: https://opensource.com/article/20/7/systemd-timers
[11]: https://opensource.com/article/21/2/linux-automation
[12]: https://opensource.com/article/20/5/linux-security-lynis

View File

@ -0,0 +1,87 @@
[#]: subject: (Encrypt your files with this open source software)
[#]: via: (https://opensource.com/article/21/4/open-source-encryption)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13304-1.html)
用开源的 VeraCrypt 加密你的文件
======
> VeraCrypt 提供跨平台的开源文件加密功能。
![](https://img.linux.net.cn/data/attachment/album/202104/17/110244p1g4tbpnw00tqwq3.jpg)
许多年前,有一个名为 [TrueCrypt][2] 的加密软件。它的源码是可以得到的,尽管没有任何人声称曾对它进行过审计或贡献过。它的作者是(至今仍是)匿名的。不过,它是跨平台的,易于使用,而且真的非常有用。
TrueCrypt 允许你创建一个加密的文件“保险库”在那里你可以存储任何类型的敏感信息文本、音频、视频、图像、PDF 等。只要你有正确的口令TrueCrypt 就可以解密保险库,并在任何运行 TrueCrypt 的电脑上提供读写权限。这是一项有用的技术,它基本上提供了一个虚拟的、可移动的、完全加密的驱动器(除了文件以外),你可以在其中安全地存储你的数据。
TrueCrypt 最终关闭了,但一个名为 VeraCrypt 的替代项目迅速兴起,填补了这一空白。[VeraCrypt][3] 基于 TrueCrypt 7.1a,比原来的版本有许多改进(包括标准加密卷和引导卷的算法的重大变化)。在 VeraCrypt 1.12 及以后的版本中你可以使用自定义迭代来提高加密安全性。更好的是VeraCrypt 可以加载旧的 TrueCrypt 卷,所以如果你是 TrueCrypt 用户,可以很容易地将它们转移到 VeraCrypt 上。
### 安装 VeraCrypt
你可以从 [VeraCrypt 下载页面][4] 下载相应的安装文件,之后在所有主流平台上安装 VeraCrypt。
另外,你也可以自己从源码构建它。在 Linux 上,它需要 wxGTK3、makeself 和通常的开发栈Binutils、GCC 等)。
当你安装后,从你的应用菜单中启动 VeraCrypt。
### 创建一个 VeraCrypt 卷
如果你刚接触 VeraCrypt你必须先创建一个 VeraCrypt 加密卷(否则,你没有任何东西可以解密)。在 VeraCrypt 窗口中,点击左侧的 “Create Volume” 按钮。
![Creating a volume with VeraCrypt][5]
在出现的 VeraCrypt 的卷创建向导窗口中,选择要创建一个加密文件容器还是要加密整个驱动器或分区。向导将为你的数据创建一个保险库,所以请按照提示进行操作。
在本文中我创建了一个文件容器。VeraCrypt 容器和其他文件很像它保存在硬盘、外置硬盘、云存储或其他任何你能想到的存储数据的地方。与其他文件一样它可以被移动、复制和删除。与大多数其他文件不同的是它可以_容纳_更多的文件这就是为什么我认为它是一个“保险库”而 VeraCrypt 开发者将其称为“容器”。它的开发者将 VeraCrypt 文件称为“容器”,是因为它可以包含其他数据对象;它与 LXC、Kubernetes 和其他现代 IT 机制所流行的容器技术无关。
#### 选择一个文件系统
在创建卷的过程中,你会被要求选择一个文件系统来决定你放在保险库中的文件的存储方式。微软 FAT 格式是过时的、非日志型,并且限制了卷和文件的大小,但它是所有平台都能读写的一种格式。如果你打算让你的 VeraCrypt 保险库跨平台FAT 是你最好的选择。
除此之外NTFS 适用于 Windows 和 Linux。开源的 EXT 系列适用于 Linux。
### 挂载 VeraCrypt 加密卷
当你创建了 VeraCrypt 卷,你就可以在 VeraCrypt 窗口中加载它。要挂载一个加密库,点击右侧的 “Select File” 按钮。选择你的加密文件,选择 VeraCrypt 窗口上半部分的一个编号栏,然后点击位于 VeraCrypt 窗口左下角的 “Mount” 按钮。
你挂载的卷在 VeraCrypt 窗口的可用卷列表中,你可以通过文件管理器访问该卷,就像访问一个外部驱动器一样。例如,在 KDE 上,我打开 [Dolphin][7],进入 `/media/veracrypt1`,然后我就可以把文件复制到我的保险库里。
只要你的设备上有 VeraCrypt你就可以随时访问你的保险库。在你手动在 VeraCrypt 中挂载之前,文件都是加密的,在那里,文件会保持解密,直到你再次关闭卷。
### 关闭 VeraCrypt 卷
为了保证你的数据安全,当你不需要打开 VeraCrypt 卷时,关闭它是很重要的。这样可以保证数据的安全,不被人窥视,且不被人趁机犯罪。
![Mounting a VeraCrypt volume][8]
关闭 VeraCrypt 容器和打开容器一样简单。在 VeraCrypt 窗口中选择列出的卷,然后点击 “Dismount”。你就不能访问保险库中的文件了其他人也不会再有访问权。
### VeraCrypt 轻松实现跨平台加密
有很多方法可以保证你的数据安全VeraCrypt 试图为你提供方便,而无论你需要在什么平台上使用这些数据。如果你想体验简单、开源的文件加密,请尝试 VeraCrypt。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/open-source-encryption
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock)
[2]: https://en.wikipedia.org/wiki/TrueCrypt
[3]: https://www.veracrypt.fr/en/Home.html
[4]: https://www.veracrypt.fr/en/Downloads.html
[5]: https://opensource.com/sites/default/files/uploads/veracrypt-create.jpg (Creating a volume with VeraCrypt)
[6]: https://creativecommons.org/licenses/by-sa/4.0/
[7]: https://en.wikipedia.org/wiki/Dolphin_%28file_manager%29
[8]: https://opensource.com/sites/default/files/uploads/veracrypt-volume.jpg (Mounting a VeraCrypt volume)

View File

@ -0,0 +1,113 @@
[#]: subject: (Create an encrypted file vault on Linux)
[#]: via: (https://opensource.com/article/21/4/linux-encryption)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13296-1.html)
在 Linux 上创建一个加密文件保险库
======
> 使用 Linux 统一密钥设置LUKS为物理驱动器或云存储上的敏感文件创建一个加密保险库。
![](https://img.linux.net.cn/data/attachment/album/202104/14/151220l5zkkxiukgzix54k.jpg)
最近,我演示了如何在 Linux 上使用<ruby>统一密钥设置<rt>Linux Unified Key Setup</rt></ruby>[LUKS][3])和 `cryptsetup` 命令 [实现全盘加密][2]。虽然加密整个硬盘在很多情况下是有用的,但也有一些原因让你不想对整个硬盘进行加密。例如,你可能需要让一个硬盘在多个平台上工作,其中一些平台可能没有集成 [LUKS][3]。此外,现在是 21 世纪,由于云的存在,你可能不会使用物理硬盘来处理所有的数据。
几年前,有一个名为 [TrueCrypt][4] 的系统,允许用户创建加密的文件保险库,可以通过 TrueCrypt 解密来提供读/写访问。这是一项有用的技术基本上提供了一个虚拟的便携式、完全加密的驱动器你可以在那里存储重要数据。TrueCrypt 项目关闭了,但它可以作为一个有趣的模型。
幸运的是LUKS 是一个灵活的系统,你可以使用它和 `cryptsetup` 在一个独立的文件中创建一个加密保险库,你可以将其保存在物理驱动器或云存储中。
下面就来介绍一下怎么做。
### 1、建立一个空文件
首先,你必须创建一个预定大小的空文件。就像是一种保险库或保险箱,你可以在其中存储其他文件。你使用的命令是 `util-linux` 软件包中的 `fallocate`
```
$ fallocate --length 512M vaultfile.img
```
这个例子创建了一个 512MB 的文件,但你可以把你的文件做成任何你想要的大小。
### 2、创建一个 LUKS 卷
接下来,在空文件中创建一个 LUKS 卷:
```
$ cryptsetup --verify-passphrase \
luksFormat vaultfile.img
```
### 3、打开 LUKS 卷
要想创建一个可以存储文件的文件系统,必须先打开 LUKS 卷,并将其挂载到电脑上:
```
$ sudo cryptsetup open \
--type luks vaultfile.img myvault
$ ls /dev/mapper
myvault
```
### 4、建立一个文件系统
在你打开的保险库中建立一个文件系统:
```
$ sudo mkfs.ext4 -L myvault /dev/mapper/myvault
```
如果你现在不需要它做什么,你可以关闭它:
```
$ sudo cryptsetup close myvault
```
### 5、开始使用你的加密保险库
现在一切都设置好了,你可以在任何需要存储或访问私人数据的时候使用你的加密文件库。要访问你的保险库,必须将其挂载为一个可用的文件系统:
```
$ sudo cryptsetup open \
--type luks vaultfile.img myvault
$ ls /dev/mapper
myvault
$ sudo mkdir /myvault
$ sudo mount /dev/mapper/myvault /myvault
```
这个例子用 `cryptsetup` 打开保险库,然后把保险库从 `/dev/mapper` 下挂载到一个叫 `/myvault` 的新目录。和 Linux 上的任何卷一样,你可以把 LUKS 卷挂载到任何你想挂载的地方,所以除了 `/myvault`,你可以用 `/mnt``~/myvault` 或任何你喜欢的位置。
当它被挂载后,你的 LUKS 卷就会被解密。你可以像读取和写入文件一样读取和写入它,就像它是一个物理驱动器一样。
当使用完你的加密保险库时,请卸载并关闭它:
```
$ sudo umount /myvault
$ sudo cryptsetup close myvault
```
### 加密的文件保险库
你用 LUKS 加密的镜像文件和其他文件一样,都是可移动的,因此你可以将你的保险库存储在硬盘、外置硬盘,甚至是互联网上。只要你可以使用 LUKS就可以解密、挂载和使用它来保证你的数据安全。轻松加密提高数据安全性不妨一试。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/linux-encryption
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life_bank_vault_secure_safe.png?itok=YoW93h7C (Secure safe)
[2]: https://opensource.com/article/21/3/encryption-luks
[3]: https://gitlab.com/cryptsetup/cryptsetup/blob/master/README.md
[4]: https://en.wikipedia.org/wiki/TrueCrypt

View File

@ -0,0 +1,101 @@
[#]: subject: (Create and Edit EPUB Files on Linux With Sigil)
[#]: via: (https://itsfoss.com/sigile-epub-editor/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13325-1.html)
用 Sigil 在 Linux 上创建和编辑 EPUB 文件
======
![](https://img.linux.net.cn/data/attachment/album/202104/23/184455qn6u6oozmf6gmnec.jpg)
Sigil 是一个开源的 Linux、Windows 和 MacOS 上的 EPUB 编辑器。你可以使用 Sigil 创建一个新的 EPUB 格式的电子书,或编辑现有的 EPUB 电子书(以 `.epub` 扩展结尾的文件)。
如果你感到好奇EPUB 是一个标准的电子书格式,并被几个数字出版集团认可。它被许多设备和电子阅读器支持,除了亚马逊的 Kindle。
### Sigil 让你创建或编辑 EPUB 文件
[Sigil][1] 是一个允许你编辑 EPUB 文件的开源软件。当然,你可以从头开始创建一个新的 EPUB 文件。
![][2]
很多人在 [创建或编辑电子书时非常相信 Calibre][3]。它确实是一个完整的工具,它有很多的功能,支持的格式不只是 EPUB 格式。然而Calibre 有时可能需要过多的资源。
Sigil 只专注于 EPUB 书籍,它有以下功能:
* 支持 EPUB 2 和 EPUB 3有一定的限制
* 提供代码视图预览
* 编辑 EPUB 语法
* 带有多级标题的目录生成器
* 编辑元数据
* 拼写检查
* 支持正则查找和替换
* 支持导入 EPUB、HTML 文件、图像和样式表
* 额外插件
* 多语言支持的接口
* 支持 Linux、Windows 和 MacOS
Sigil 不是你可以直接输入新书章节的 [所见即所得][4] 类型的编辑器。由于 EPUB 依赖于 XML因此它专注于代码。可以将其视为用于 EPUB 文件的 [类似于 VS Code 的代码编辑器][5]。出于这个原因,你应该使用一些其他 [开源写作工具][6],以 epub 格式导出你的文件(如果可能的话),然后在 Sigil 中编辑它。
![][7]
Sigil 有一个 [Wiki][8] 来提供一些安装和使用 Sigil 的文档。
### 在 Linux 上安装 Sigil
Sigil 是一款跨平台应用,支持 Windows 和 macOS 以及 Linux。它是一个流行的软件有超过十年的历史。这就是为什么你应该会在你的 Linux 发行版仓库中找到它。只要在你的发行版的软件中心应用中寻找它就可以了。
![Sigil in Ubuntu Software Center][9]
你可能需要事先启用 universe 仓库。你也可以在 Ubuntu发行版中使用 `apt` 命令:
```
sudo apt install sigil
```
Sigil 有很多对 Python 库和模块的依赖,因此它下载和安装了大量的包。
![][10]
我不会列出 Fedora、SUSE、Arch 和其他发行版的命令。你可能已经知道如何使用你的发行版的软件包管理器,对吧?
你的发行版提供的版本不一定是最新的。如果你想要 Sigil 的最新版本,你可以查看它的 GitHub 仓库。
- [Sigil 的 GitHub 仓库][11]
### 并不适合所有人,当然也不适合用于阅读 ePUB 电子书
我不建议使用 Sigil 阅读电子书。Linux 上有 [其他专门的应用来阅读 .epub 文件][12]。
如果你是一个必须处理 EPUB 书籍的作家或者如果你在数字化旧书并在各种格式间转换Sigil 可能是值得一试。
我还没有大量使用 过 Sigil所以我不提供对它的评论。我让你去探索它并在这里与我们分享你的经验。
--------------------------------------------------------------------------------
via: https://itsfoss.com/sigile-epub-editor/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://sigil-ebook.com/
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/open-epub-sigil.png?resize=800%2C621&ssl=1
[3]: https://itsfoss.com/create-ebook-calibre-linux/
[4]: https://www.computerhope.com/jargon/w/wysiwyg.htm
[5]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
[6]: https://itsfoss.com/open-source-tools-writers/
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/sigil-epub-editor-800x621.png?resize=800%2C621&ssl=1
[8]: https://github.com/Sigil-Ebook/Sigil/wiki
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/sigil-software-center-ubuntu.png?resize=800%2C424&ssl=1
[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/installing-sigil-ubuntu.png?resize=800%2C547&ssl=1
[11]: https://github.com/Sigil-Ebook/Sigil
[12]: https://itsfoss.com/open-epub-books-ubuntu-linux/

View File

@ -0,0 +1,108 @@
[#]: subject: (Make your data boss-friendly with this open source tool)
[#]: via: (https://opensource.com/article/21/4/visualize-data-eda)
[#]: author: (Juanjo Ortilles https://opensource.com/users/jortilles)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13310-1.html)
用这个开源工具让你的数据对老板友好起来
======
> 企业数据分析旨在将数据可视化带给日常商务用户。
![](https://img.linux.net.cn/data/attachment/album/202104/19/092617elri0ff4r6lr06rr.jpg)
<ruby>企业数据分析<rt>Enterprise Data Analytics</rt></ruby>[EDA][2] 是一个网页应用,它可以通过一个简单、清晰的界面来获取信息。
在巴塞罗那开源分析公司 [Jortilles][3] 工作几年后,我们意识到,现代世界强制性地收集数据,但普通人没有简单的方法来查看或解释这些数据。有一些强大的开源工具可用于此目的,但它们非常复杂。我们找不到一个工具设计成能让没有什么技术能力的普通人轻松使用。
我们之所以开发 EDA是因为我们认为获取信息是现代组织的要求和义务并希望为每个人提供获取信息的机会。
![EDA interface][4]
### 可视化你的数据
EDA 使用人们已经理解的商业术语提供了一个数据模型。你可以选择你想要的信息,并可以以你想要的方式查看它。它的目标是对用户友好,同时又功能强大。
EDA 通过元数据模型将数据库中的信息可视化和丰富化。它可以从 BigQuery、Postgres、[MariaDB、MySQL][6] 和其他一些数据库中读取数据。这就把技术性的数据库模型转化为熟悉的商业概念。
它还设计为加快信息传播的速度因为它可以利用已经存储在数据库中的数据。EDA 可以发现数据库的拓扑结构并提出业务模型。如果你设计了一个好的数据库模型你就有了一个好的业务模型。EDA 还可以连接到生产服务器,提供实时分析。
这种数据和数据模型的结合意味着你和你组织中的任何人都可以分析其数据。然而,为了保护数据,你可以定义数据安全,可以精确到行,以授予正当的人访问正当的数据。
EDA 的一些功能包括:
* 自动生成数据模型
* 一致的数据模型,防止出现不一致的查询
* 高级用户的 SQL 模式
* 数据可视化:
* 标准图表(如柱状图、饼状图、线状图、树状图)
* 地图整合(如 geoJSON shapefile、纬度、经度
* 电子邮件提醒,可通过关键绩效指标 KPI 来定义
* 私人和公共信息控制,以启用私人和公共仪表板,你可以通过链接分享它。
* 数据缓存和程序刷新。
### 如何使用 EDA
用 EDA 实现数据可视化的第一步是创建数据模型。
#### 创建数据模型
首先,在左侧菜单中选择 “New Datasource”。
接下来,选择你的数据存储的数据库系统(如 Postgres、MariaDB、MySQL、Vertica、SqlServer、Oracle、Big Query并提供连接参数。
EDA 将自动为你生成数据模型。它读取表和列,并为它们定义名称以及表之间的关系。你还可以通过添加虚拟视图或 geoJSON 图来丰富你的数据模型。
#### 制作仪表板
现在你已经准备好制作第一个仪表板了。在 EDA 界面的主页面上,你应该会看到一个 “New dashboard” 按钮。点击它,命名你的仪表板,并选择你创建的数据模型。新的仪表板将出现一个面板供你配置。
要配置面板,请单击右上角的 “Configuration” 按钮,并选择你要做的事情。在 “Edit query” 中,选择你要显示的数据。这将出现一个新的窗口,你的数据模型由实体和实体的属性表示。选择你要查看的实体和你要使用的属性。例如,对于名为 “Customers” 的实体,你可能会显示 “Customer Name”对于 “Sales” 实体,你可能希望显示 “Total Sales”。
接下来,运行一个查询,并选择你想要的可视化。
![EDA interface][7]
你可以添加任意数量的面板、过滤器和文本字段,所有这些都有说明。当你保存仪表板后,你可以查看它,与同事分享,甚至发布到互联网上。
### 获取 EDA
最快的方法是用 [公开演示][8] 来查看 EDA。但如果你想自己试一试可以用 Docker 获取最新的 EDA 版本:
```
$ docker run -p 80:80 jortilles / eda: latest
```
我们还有一个 SaaS 选项,适用于任何想要使用 EDA 而无需进行安装、配置和持续更新的用户。你可以在我们的网站上查看 [云选项][9]。
如果你想看看它的实际运行情况,你可以在 YouTube 上观看一些 [演示][10]。
EDA 正在持续开发中,你可以在 GitHub 上找到它的 [源代码][11]。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/visualize-data-eda
作者:[Juanjo Ortilles][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jortilles
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen)
[2]: https://eda.jortilles.com/en/jortilles-english/
[3]: https://www.jortilles.com/
[4]: https://opensource.com/sites/default/files/uploads/eda-display.jpeg (EDA interface)
[5]: https://creativecommons.org/licenses/by-sa/4.0/
[6]: https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet
[7]: https://opensource.com/sites/default/files/uploads/eda-chart.jpeg (EDA interface)
[8]: https://demoeda.jortilles.com/
[9]: https://eda.jortilles.com
[10]: https://youtu.be/cBAAJbohHXQ
[11]: https://github.com/jortilles/EDA

View File

@ -0,0 +1,88 @@
[#]: subject: (4 steps to customizing your Mac terminal theme with open source tools)
[#]: via: (https://opensource.com/article/21/4/zsh-mac)
[#]: author: (Bryant Son https://opensource.com/users/brson)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13323-1.html)
用开源工具定制 Mac 终端主题的 4 个步骤
======
> 用开源工具让你的终端窗口在 Mac 上漂亮起来。
![](https://img.linux.net.cn/data/attachment/album/202104/22/234534t3t7ntpvdde3v892.jpg)
你是否曾经厌倦了在你的 macOS 电脑上看到同样老式的终端窗口?如果是这样,使用开源的 Oh My Zsh 框架和 Powerlevel10k 主题为你的视图添加一些点缀。
这个基本的逐步教程将让你开始定制你的 macOS 终端。如果你是一个 Linux 用户,请查看 Seth Kenlon 的指南 [为 Zsh 添加主题和插件][2] 以获得深入指导。
### 步骤 1安装 Oh My Zsh
[Oh My Zsh][3] 是一个开源的、社区驱动的框架,用于管理你的 Z shell Zsh 配置。
![Oh My Zsh][4]
Oh My Zsh 是在 MIT 许可下发布的。使用以下命令安装:
```
$ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
```
### 步骤 2安装 Powerlevel10k 字体
![Powerlevel10k][6]
Powerlevel10k 是一个 MIT 许可的 Zsh 主题。在安装 Powerlevel10k 之前,你需要为你的终端安装自定义字体。
到 [Powerlevel10 GitHub][7] 页面,在 `README` 中 搜索 “fonts”。安装自定义字体的步骤会根据你的操作系统而有所不同。这只需要简单地点击-下载-安装的系列操作。
![Powerlevel10k fonts][8]
### 步骤 3安装 Powerlevel10k 主题
接下来,运行以下命令安装 Powerlevel10k
```
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
```
完成后,用文本编辑器,比如 [Vim][9],打开 `~/.zshrc` 配置文件,设置行 `ZSH_THEME="powerlevel10k/powerlevel10k`,然后保存文件。
### 步骤 4完成 Powerlevel10 的设置
打开一个新的终端,你应该看到 Powerlevel10k 配置向导。如果没有,运行 `p10k configure` 来调出配置向导。如果你在步骤 2 中安装了自定义字体,那么图标和符号应该正确显示。将默认字体更改为 `MeslowLG NF`
![Powerlevel10k configuration][10]
当你完成配置后,你应该会看到一个漂亮的终端。
![Oh My Zsh/Powerlevel10k theme][11]
就是这些了!你应该可以享受你美丽的新终端了。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/zsh-mac
作者:[Bryant Son][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/brson
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/freedos.png?itok=aOBLy7Ky (4 different color terminal windows with code)
[2]: https://opensource.com/article/19/9/adding-plugins-zsh
[3]: https://ohmyz.sh/
[4]: https://opensource.com/sites/default/files/uploads/1_ohmyzsh.jpg (Oh My Zsh)
[5]: https://creativecommons.org/licenses/by-sa/4.0/
[6]: https://opensource.com/sites/default/files/uploads/2_powerlevel10k.jpg (Powerlevel10k)
[7]: https://github.com/romkatv/powerlevel10k
[8]: https://opensource.com/sites/default/files/uploads/3_downloadfonts.jpg (Powerlevel10k fonts)
[9]: https://opensource.com/resources/what-vim
[10]: https://opensource.com/sites/default/files/uploads/4_p10kconfiguration.jpg (Powerlevel10k configuration)
[11]: https://opensource.com/sites/default/files/uploads/5_finalresult.jpg (Oh My Zsh/Powerlevel10k theme)

View File

@ -0,0 +1,70 @@
[#]: subject: (Something bugging you in Fedora Linux? Lets get it fixed!)
[#]: via: (https://fedoramagazine.org/something-bugging-you-in-fedora-linux-lets-get-it-fixed/)
[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/)
[#]: collector: (lujun9972)
[#]: translator: (DCOLIVERSUN)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13333-1.html)
Fedora Linux 中有 Bug 吗?一起来修复它!
======
![][1]
软件有 bug。任何复杂系统都无法保证每个部分都能按计划工作。Fedora Linux 是一个 _非常_ 复杂的系统,包含几千个包,这些包由全球无数个独立的上游项目创建。每周还有数百个更新。因此,问题是不可避免的。本文介绍了 bug 修复过程以及如何确定 bug 优先级。
### 发布开发过程
作为一个 Linux 发行项目,我们希望为用户提供完善的、一切正常的体验。我们的发布起始于 “Rawhide”。我们在 Rawhide 中集成了所有更新的自由及开源软件的新版本。我们一直在不断改进正在进行的测试和<ruby>持续集成<rt>Continuous Integration</rt></ruby>过程,为了让即使是 Rawhide 也能被冒险者安全使用。可是从本质来讲Rawhide 始终有点粗糙。
每年两次,我们把这个粗糙的操作系统先后分支到测试版本、最终版本。当我们这么做时,我们齐心协力地寻找问题。我们在<ruby>测试日<rt>Test Days</rt></ruby>检查特定的区域和功能。制作“<ruby>候选版本<rt>Candidate builds</rt></ruby>”,并根据我们的 [发布验证测试计划][2] 进行检测。然后我们进入<ruby>冻结状态<rt>freeze state</rt></ruby>,只有批准的更改可以并入候选版本。这就把候选版本从持续的开发隔离开来,持续的开发不断并入 Rawhide 中。所以,不会引入新的问题。
在发布过程中许多 bug 被粉碎去除,这些 bug 有大有小。当一切按计划进行时,我们为所有用户提供了按计划发布的崭新的 Fedora Linux 版本。(在过去几年里,我们已经可靠地重复这一动作——感谢每一个为之努力工作的人!)如果确实有问题,我们可以将其标记为<ruby>发布阻碍<rt>release blocker</rt></ruby>。这就意味着我们要等到修复后才能发布。发布阻碍通常代表重大问题,该表达一定会引发对 bug 的关注。
有时,我们遇到的一些问题是持续存在的。可能一些问题已经持续了一两个版本,或者我们还没有达成共识的解决方案。有些问题确实困扰着许多用户,但个别问题并没有达到阻碍发布的程度。我们可以将这些东西标记为<ruby>阻碍<rt>blocker</rt></ruby>。但这会像锤子一样砸下来。阻碍可能导致最终粉碎该 bug但也可能导致破坏了周围。如果进度落后所有其它的 bug 修复、改进以及人们一直在努力的功能,都不能到达用户手中。
### 按优先顺序排列 bug 流程
所以,我们有另一种方法来解决烦人的 bug。[按优先顺序排列 bug 流程][3],与其他方式不同,可以标出导致大量用户不满意的问题。这里没有锤子,更像是聚光灯。与发布阻碍不同,按优先顺序排列 bug 流程没有一套严格定义的标准。每个 bug 都是根据影响范围和严重性来评估的。
一个由感兴趣的贡献者组成的团队帮助策划一个简短列表,上面罗列着需要注意的问题。然后,我们的工作是将问题匹配到能够解决它们的人。这有助于减轻发布过程中的压力,因为它没有给问题指定任何特定的截止时间。理想情况下,我们能在进入测试阶段之前就发现并解决问题。我们尽量保持列表简短,不会超过几个,这样才会真正有重点。这种做法有助于团队和个人解决问题,因为他们知道我们尊重他们捉襟见肘的时间与精力。
通过这个过程Fedora 解决了几十个严重而恼人的问题,包括从键盘输入故障到 SELinux 错误,再到数千兆字节大小的旧包更新会逐渐填满你的磁盘。但是我们可以做得更多——我们实际上收到的提案没有达到我们的处理能力上限。因此,如果你知道有什么事情导致了长期挫折或影响了很多人,至今没有达成解决方案,请遵循 [按优先顺序排列 bug 流程][3],提交给我们。
### 你可以帮助我们
邀请所有 Fedora 贡献者参与按优化顺序排列 bug 的流程。评估会议每两周在 IRC 上举办一次。欢迎任何人加入并帮助我们评估提名的 bug。会议时间和地点参见 [日历][4]。Fedora 项目经理在会议开始的前一天将议程发送到 [triage][5] 和 [devel][6] 邮件列表。
### 欢迎报告 bug
当你发现 bug 时,无论大小,我们很感激你能报告 bug。在很多情况下解决 bug 最好的方式是交给创建该软件的项目。例如,假设渲染数据相机照片的 Darktable 摄影软件出了问题,最好把它带给 Darktable 摄影软件的开发人员。再举个例子,假设 GNOME 或 KDE 桌面环境或组成部分软件出了问题,将这些问题交给这些项目中通常会得到最好的结果。
然而, 如果这是一个特定的 Fedora 问题,比如我们的软件构建或配置或者它的集成方式的问题,请毫不犹豫地 [向我们提交 bug][7]。当你知道有一个问题是我们还没有解决的,也要提交给我们。
我知道这很复杂……最好有一个一站式的地方来处理所有 bug。但是请记住Fedora 打包者大部分是志愿者,他们负责获取上游软件并将其配置到我们系统中。他们并不总是对他们正在使用的软件的代码有深入研究的专家。有疑问的时候,你可以随时提交一个 [Fedora bug][7]。Fedora 中负责相应软件包的人可以通过他们与上游软件项目的联系提供帮助。
请记住,当你发现一个已通过诊断但尚未得到良好修复的 bug 时,当你看到影响很多人的问题时,或者当有一个长期存在的问题没有得到关注时,请将其提名为高优先级 bug。我们会看以看能做些什么。
_附言标题中的著名图片当然是来自哈佛大学马克 2 号计算机的日志,这里曾是格蕾丝·赫柏少将工作的地方。但是与这个故事的普遍看法相背,这并不是 “bug” 一词第一次用于表示系统问题——它在工程中已经很常见了,这就是为什么发现一个字面上的 “bug” 作为问题的原因是很有趣的。 #nowyouknow #jokeexplainer_
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/something-bugging-you-in-fedora-linux-lets-get-it-fixed/
作者:[Matthew Miller][a]
选题:[lujun9972][b]
译者:[DCOLIVERSUN](https://github.com/DCOLIVERSUN)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/mattdm/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/04/bugging_you-816x345.jpg
[2]: https://fedoraproject.org/wiki/QA:Release_validation_test_plan
[3]: https://docs.fedoraproject.org/en-US/program_management/prioritized_bugs/
[4]: https://calendar.fedoraproject.org/base/
[5]: https://lists.fedoraproject.org/archives/list/triage%40lists.fedoraproject.org/
[6]: https://lists.fedoraproject.org/archives/list/devel%40lists.fedoraproject.org/
[7]: https://docs.fedoraproject.org/en-US/quick-docs/howto-file-a-bug/

View File

@ -0,0 +1,80 @@
[#]: subject: (Blanket: Ambient Noise App With Variety of Sounds to Stay Focused)
[#]: via: (https://itsfoss.com/blanket-ambient-noise-app/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13343-1.html)
Blanket拥有各种环境噪音的应用帮助保持注意力集中
======
> 一个开源的环境噪音播放器,提供各种声音,帮助你集中注意力或入睡。
![](https://img.linux.net.cn/data/attachment/album/202104/29/094813oxcitipetajxjiex.jpg)
随着你周围活动的增加,要保持冷静和专注往往是很困难的。
有时,音乐会有所帮助,但在某些情况下也会分散注意力。但是,环境噪音如何?这总是让人听起来很舒心。谁不想在餐厅里听到鸟叫声、雨滴声和人群的交谈声?好吧,可能不是最后一个,但听自然的声音可以帮助放松和集中注意力。这间接地提高了你的工作效率。
最近,我发现了一个专门的播放器,其中包含了不同的声音,可以帮助任何人集中注意力。
### 使用 Blanket 播放不同的环境声音
Blanket 是一个令人印象深刻的环境噪音播放器,它具有不同的声音,可以帮助你入睡或只是通过帮助你忘记周围的干扰来重获注意力。
它包括自然界的声音,像雨声、海浪声、鸟鸣声、风暴声、风声、水流声、夏夜声。
![][1]
此外,如果你是一个通勤者或在轻微繁忙的环境中感到舒适的人,你可以找到火车、船、城市、咖啡馆或壁炉的声音。
如果你喜欢白噪声或粉红噪声,它结合了人类能听到的所有声音频率,这里也可以找到。
它还可以让你在每次开机时自动启动,如果你喜欢这样的话。
![][2]
### 在 Linux 上安装 Blanket
安装 Blanket 的最好方法是来自 [Flathub][3]。考虑到你已经启用了 [Flatpak][4],你只需在终端键入以下命令就可以安装它:
```
flatpak install flathub com.rafaelmardojai.Blanket
```
如果你是 Flatpak 的新手,你可能想通过我们的 [Flatpak 指南][5]了解。
如果你不喜欢使用 Flatpak你可以使用该项目中的贡献者维护的 PPA 来安装它。对于 Arch Linux 用户,你可以在 [AUR][6] 中找到它,以方便安装。
此外,你还可以找到 Fedora 和 openSUSE 的软件包。要探索所有现成的软件包,你可以前往其 [GitHub 页面][7]。
### 结束语
对于一个简单的环境噪音播放器来说,用户体验是相当好的。我有一副 HyperX Alpha S 耳机,我必须要说,声音的质量很好。
换句话说,它听起来很舒缓,如果你想体验环境声音来集中注意力,摆脱焦虑或只是睡着,我建议你试试。
你试过它了吗?欢迎在下面分享你的想法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/blanket-ambient-noise-app/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/04/blanket-screenshot.png?resize=614%2C726&ssl=1
[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/04/blanket-autostart-1.png?resize=514%2C214&ssl=1
[3]: https://flathub.org/apps/details/com.rafaelmardojai.Blanket
[4]: https://itsfoss.com/what-is-flatpak/
[5]: https://itsfoss.com/flatpak-guide/
[6]: https://itsfoss.com/aur-arch-linux/
[7]: https://github.com/rafaelmardojai/blanket

View File

@ -0,0 +1,78 @@
[#]: subject: (The Guided Installer in Arch is a Step in the Right Direction)
[#]: via: (https://news.itsfoss.com/arch-new-guided-installer/)
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
[#]: collector: (lujun9972)
[#]: translator: (Kevin3599)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13328-1.html)
Arch Linux 中的引导式安装程序是迈向正确的一步
======
> 在 Arch ISO 中加入一个可选的引导式安装程序,对新手和高级用户都有好处。
![](https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/04/arch-linux-opinion.png?w=1200&ssl=1)
20 年来Arch Linux 为用户提供了一个完全定制、独特的系统。这些年来,它以牺牲用户友好性为代价,赢得了在定制方面独有的声誉。
作为滚动发行版本Arch Linux 不提供任何固定发行版本,而是每月更新一次。但是,如果你在最近几周下载了 Arch Linux那么你很可能已经注意到了一个新的附加功能archinstall。它使 Arch Linux 更加易于安装。
![][3]
今天,我将探讨 archinstall 的发布对未来的 Arch Linux 项目和发行版意味着什么。
### Arch Linux 新的发展方向?
![][4]
尽管很多人对此感到惊讶,但默认情况下包含官方安装程序实际上是非常明智的举动。这意味着 Arch Linux 的发展方向发生变化,即在保留使其知名的定制性同时更加侧重用户的易用性。
在该安装程序的 GitHub 页面上有这样的描述:
> “引导性安装程序会给用户提供一个友好的逐步安装方式,但是关键在于这个安装程序是个选项,它是可选的,绝不会强迫用户使用其进行安装。”
这意味着新的安装程序不会影响高级用户,同时也使得其可以向更广泛的受众开放,在这一改动所带来的许多优点之中,一个显著的优点即是:更广泛的用户。
更多的用户意味着对项目的更多支持,不管其是通过网络捐赠或参与 Arch Linux 的开发,随着这些项目贡献的增加,不管是新用户还是有经验的用户的使用体验都会得到提升。
### 这必然要发生
回顾过去,我们可以看到安装介质增加了许多对新用户有所帮助的功能。这些示例包括 pacstrap一个安装基本系统的工具和 reflector查找最佳 pacman 镜像的工具)。
另外,多年来,用户一直在追求使用脚本安装的方法,新安装程序允许了用户使用安装脚本。它能够使用 Python 编写脚本,这使得管理员的部署更加容易,成为一个非常有吸引力的选择。
### 更多可定制性(以某种方式?)
尽管这看上去可能有些反直觉,但是这个安装程序实际上能够增进 Arch Linux 的可定制性。当前Arch Linux 定制性的最大瓶颈是用户的技术水平,而这一问题能够通过 archinstall 解决。
有了新的安装程序,用户不需要掌握创建完美开发环境的技巧,安装程序可以帮助用户完成这些工作,这提供了广泛的自定义选项,是普通用户难以实现的。
### 总结
有了这一新功能Arch Linux 似乎正在向着“用户友好”这一软件设计哲学靠近,新安装程序为新手和高级用户提供了广泛的好处。其中包括更广泛的定制性和更大的用户社区。
总而言之,这个新变动对整个 Arch Linux 社区都会产生积极的影响。
你对这个 Arch Linux 安装程序怎么看?是否已经尝试过它了呢?
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/arch-new-guided-installer/
作者:[Jacob Crume][a]
选题:[lujun9972][b]
译者:[Kevin3599](https://github.com/Kevin3599)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/jacob/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/rolling-release/
[2]: https://news.itsfoss.com/arch-linux-easy-install/
[3]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/04/arch-install-tool.png?resize=780%2C411&ssl=1
[4]: https://i0.wp.com/github.com/archlinux/archinstall/raw/master/docs/logo.png?resize=371%2C371&ssl=1
[5]: https://man.archlinux.org/man/pacstrap.8
[6]: https://wiki.archlinux.org/index.php/Reflector

View File

@ -0,0 +1,196 @@
[#]: subject: (Optimize your Python code with C)
[#]: via: (https://opensource.com/article/21/4/cython)
[#]: author: (Alan Smithee https://opensource.com/users/alansmithee)
[#]: collector: (lujun9972)
[#]: translator: (ShuyRoy)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13338-1.html)
使用 C 优化你的 Python 代码
======
> Cython 创建的 C 模块可以加速 Python 代码的执行,这对使用效率不高的解释型语言编写的复杂应用是很重要的。
![](https://img.linux.net.cn/data/attachment/album/202104/26/230709qz64z4af3t9b9jab.jpg)
Cython 是 Python 编程语言的编译器,旨在优化性能并形成一个扩展的 Cython 编程语言。作为 Python 的扩展,[Cython][2] 也是 Python 语言的超集,它支持调用 C 函数和在变量和类属性上声明 C 类型。这使得包装外部 C 库、将 C 嵌入现有应用程序或者为 Python 编写像 Python 一样简单的 C 语言扩展语法变得容易。
Cython 一般用于创建 C 模块来加速 Python 代码的执行。这在使用解释型语言编写的效率不高的复杂应用中非常重要。
### 安装 Cython
你可以在 Linux、BSD、Windows 或 macOS 上安装 Cython 来使用 Python
```
$ python -m pip install Cython
```
安装好后,就可以使用它了。
### 将 Python 转换成 C
使用 Cython 的一个好的方式是从一个简单的 “hello world” 开始。这虽然不是展示 Cython 优点的最好方式,但是它展示了使用 Cython 时发生的情况。
首先,创建一个简单的 Python 脚本,文件命名为 `hello.pyx``.pyx` 扩展名并不神奇,从技术上它可以是任何东西,但它是 Cython 的默认扩展名):
```
print("hello world")
```
接下来,创建一个 Python 设置脚本。一个像 Python 的 makefile 一样的 `setup.py`Cython 可以使用它来处理你的 Python 代码:
```
from setuptools import setup
from Cython.Build import cythonize
setup(
    ext_modules = cythonize("hello.pyx")
)
```
最后,使用 Cython 将你的 Python 脚本转换为 C 代码:
```
$ python setup.py build_ext --inplace
```
你可以在你的工程目录中看到结果。Cython 的 `cythonize` 模块将 `hello.pyx` 转换成一个 `hello.c` 文件和一个 `.so` 库。这些 C 代码有 2648 行,所以它比一个一行的 `hello.pyx` 源码的文本要多很多。`.so` 库也比它的源码大 2000 倍(即 54000 字节和 20 字节相比。然后Python 需要运行单个 Python 脚本,所以有很多代码支持这个只有一行的 `hello.pyx` 文件。
要使用 Python 的 “hello world” 脚本的 C 代码版本,请打开一个 Python 提示符并导入你创建的新 `hello` 模块:
```
>>> import hello
hello world
```
### 将 C 代码集成到 Python 中
测试计算能力的一个很好的通用测试是计算质数。质数是一个比 1 大的正数,且它只有被 1 或它自己除后才会产生正整数。虽然理论很简单,但是随着数的变大,计算需求也会增加。在纯 Python 中,可以用 10 行以内的代码完成质数的计算。
```
import sys
number = int(sys.argv[1])
if not number <= 1:
for i in range(2, number):
if (number % i) == 0:
print("Not prime")
break
else:
print("Integer must be greater than 1")
```
这个脚本在成功的时候是不会提醒的,如果这个数不是质数,则返回一条信息:
```
$ ./prime.py 3
$ ./prime.py 4
Not prime.
```
将这些转换为 Cython 需要一些工作,一部分是为了使代码适合用作库,另一部分是为了提高性能。
#### 脚本和库
许多用户将 Python 当作一种脚本语言来学习:你告诉 Python 想让它执行的步骤,然后它来做。随着你对 Python以及一般的开源编程的了解越多你可以了解到许多强大的代码都存在于其他应用程序可以利用的库中。你的代码越 _不具有针对性_,程序员(包括你)就越可能将其重用于其他的应用程序。将计算和工作流解耦可能需要更多的工作,但最终这通常是值得的。
在这个简单的质数计算的例子中,将其转换成 Cython首先是一个设置脚本
```
from setuptools import setup
from Cython.Build import cythonize
setup(
    ext_modules = cythonize("prime.py")
)
```
将你的脚本转换成 C
```
$ python setup.py build_ext --inplace
```
到目前为止,一切似乎都工作的很好,但是当你试图导入并使用新模块时,你会看到一个错误:
```
>>> import prime
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "prime.py", line 2, in init prime
number = sys.argv[1]
IndexError: list index out of range
```
这个问题是 Python 脚本希望从一个终端运行,其中参数(在这个例子中是要测试是否为质数的整数)是一样的。你需要修改你的脚本,使它可以作为一个库来使用。
#### 写一个库
库不使用系统参数,而是接受其他代码的参数。对于用户输入,与其使用 `sys.argv`,不如将你的代码封装成一个函数来接收一个叫 `number`(或者 `num`,或者任何你喜欢的变量名)的参数:
```
def calculate(number):
if not number <= 1:
for i in range(2, number):
if (number % i) == 0:
print("Not prime")
break
else:
print("Integer must be greater than 1")
```
这确实使你的脚本有些难以测试,因为当你在 Python 中运行代码时,`calculate` 函数永远不会被执行。但是Python 编程人员已经为这个问题设计了一个通用、还算直观的解决方案。当 Python 解释器执行一个 Python 脚本时,有一个叫 `__name__` 的特殊变量,这个变量被设置为 `__main__`,但是当它被作为模块导入的时候,`__name__` 被设置为模块的名字。利用这点,你可以写一个既是 Python 模块又是有效 Python 脚本的库:
```
import sys
def calculate(number):
if not number <= 1:
for i in range(2, number):
if (number % i) == 0:
print("Not prime")
break
else:
print("Integer must be greater than 1")
if __name__ == "__main__":
number = sys.argv[1]
calculate( int(number) )
```
现在你可以用一个命令来运行代码了:
```
$ python ./prime.py 4
Not a prime
```
你可以将它转换为 Cython 来用作一个模块:
```
>>> import prime
>>> prime.calculate(4)
Not prime
```
### C Python
用 Cython 将纯 Python 的代码转换为 C 代码是有用的。这篇文章描述了如何做然而Cython 还有功能可以帮助你在转换之前优化你的代码,分析你的代码来找到 Cython 什么时候与 C 进行交互,以及更多。如果你正在用 Python但是你希望用 C 代码改进你的代码,或者进一步理解库是如何提供比脚本更好的扩展性的,或者你只是好奇 Python 和 C 是如何协作的,那么就开始使用 Cython 吧。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/cython
作者:[Alan Smithee][a]
选题:[lujun9972][b]
译者:[ShuyRoy](https://github.com/ShuyRoy)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/alansmithee
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book )
[2]: https://cython.org/

View File

@ -0,0 +1,94 @@
[#]: subject: (Restore an old MacBook with Linux)
[#]: via: (https://opensource.com/article/21/4/restore-macbook-linux)
[#]: author: (Don Watkins https://opensource.com/users/don-watkins)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-13341-1.html)
用 Linux 翻新旧的 MacBook
======
> 不要把你又旧又慢的 MacBook 扔进垃圾桶。用 Linux Mint 延长它的寿命。
![](https://img.linux.net.cn/data/attachment/album/202104/27/225241mdbp59t67699r9de.jpg)
去年,我写了篇关于如何用 Linux 赋予[旧 MacBook 的新生命][2]的文章,在例子中提到了 Elementary OS。最近我用回那台 2015 年左右的 MacBook Air发现遗失了我的登录密码。我下载了最新的 Elementary OS 5.1.7 Hera但无法让实时启动识别我的 Broadcom 4360 无线芯片组。
最近,我一直在使用 [Linux Mint][3] 来翻新旧的笔记本电脑,我想在这台 MacBook Air 上试一下。我下载了 Linux Mint 20.1 ISO并在我的 Linux 台式电脑上使用 [Popsicle][4] 创建了一个 USB 启动器。
![Popsicle ISO burner][5]
接下来,我将 Thunderbolt 以太网适配器连接到 MacBook并插入 USB 启动器。我打开系统电源,按下 MacBook 上的 Option 键,指示它从 USB 驱动器启动系统。
Linux Mint 在实时启动模式下启动没问题,但操作系统没有识别出无线连接。
### 我的无线网络在哪里?
这是因为为苹果设备制造 WiFi 卡的公司 Broadcom 没有发布开源驱动程序。这与英特尔、Atheros 和许多其他芯片制造商形成鲜明对比,但它是苹果公司使用的芯片组,所以这是 MacBook 上的一个常见问题。
我通过我的 Thunderbolt 适配器有线连接到以太网,因此我 _是_ 在线的。通过之前的研究,我知道要让无线适配器在这台 MacBook 上工作,我需要在 Bash 终端执行三条独立的命令。然而,在安装过程中,我了解到 Linux Mint 有一个很好的内置驱动管理器,它提供了一个简单的图形用户界面来协助安装软件。
![Linux Mint Driver Manager][7]
该操作完成后,我重启了安装了 Linux Mint 20.1 的新近翻新的 MacBook Air。Broadcom 无线适配器工作正常,使我能够轻松地连接到我的无线网络。
### 手动安装无线
你可以从终端完成同样的任务。首先,清除 Broadcom 内核源码的残余。
```
$ sudo apt-get purge bcmwl-kernel-source
```
然后添加一个固件安装程序:
```
$ sudo apt install firmware-b43-installer
```
最后,为系统安装新固件:
```
$ sudo apt install linux-firmware
```
### 将 Linux 作为你的 Mac 使用
我安装了 [Phoronix 测试套件][8] 以获得 MacBook Air 的系统信息。
![MacBook Phoronix Test Suite output][9]
系统工作良好。对内核 5.4.0-64-generic 的最新更新显示,无线连接仍然存在,并且我与家庭网络之间的连接为 866Mbps。Broadcom 的 FaceTime 摄像头不能工作,但其他东西都能正常工作。
我非常喜欢这台 MacBook 上的 [Linux Mint Cinnamon 20.1][10] 桌面。
![Linux Mint Cinnamon][11]
如果你有一台因 macOS 更新而变得缓慢且无法使用的旧 MacBook我建议你试一下 Linux Mint。我对这个发行版印象非常深刻尤其是它在我的 MacBook Air 上的工作情况。它无疑延长了这个强大的小笔记本电脑的寿命。
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/restore-macbook-linux
作者:[Don Watkins][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/don-watkins
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/write-hand_0.jpg?itok=Uw5RJD03 (Writing Hand)
[2]: https://opensource.com/article/20/2/macbook-linux-elementary
[3]: https://linuxmint.com/
[4]: https://github.com/pop-os/popsicle
[5]: https://opensource.com/sites/default/files/uploads/popsicle.png (Popsicle ISO burner)
[6]: https://creativecommons.org/licenses/by-sa/4.0/
[7]: https://opensource.com/sites/default/files/uploads/mint_drivermanager.png (Linux Mint Driver Manager)
[8]: https://www.phoronix-test-suite.com/
[9]: https://opensource.com/sites/default/files/uploads/macbook_specs.png (MacBook Phoronix Test Suite output)
[10]: https://www.linuxmint.com/edition.php?id=284
[11]: https://opensource.com/sites/default/files/uploads/mintcinnamon.png (Linux Mint Cinnamon)

View File

@ -0,0 +1,96 @@
[#]: subject: (ProtonMail Users can Now Access Proton Calendar (beta) for Free)
[#]: via: (https://news.itsfoss.com/protoncalendar-beta-free/)
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
ProtonMail Users can Now Access Proton Calendar (beta) for Free
======
[ProtonMail][1] is one of the [best secure email services][2] out there. While alternatives like [Tutanota][3] already offer a calendar feature, ProtonMail did not offer it for all the users.
The calendar feature (in beta) was limited to paid users. Recently, in an [announcement][4], ProtonMail has made it accessible for all users for free.
It is worth noting that it is still in beta but accessible to more users.
### Try Proton Calendar beta
Proton Calendar is a feature integrated with ProtonMail itself. However, you get a separate mobile app if you want to use it on Android. No signs of an iOS app yet.
If you are already using the **[beta.protonmail.com][5]** portal when accessing through your web browser, you can navigate your way to Proton Calendar as shown below:
![][6]
In either case, you can simply head to [Proton Calendar page][7] (calendar.protonmail.com) and log in to access it.
They should also add the selector menu to the main ProtonMail version, but unfortunately, it is only available on the beta portal for now.
As per the announcement, the features available with Proton Calendar right now are:
* Create, edit, and delete events across devices
* Set reminders
* Send and respond to event invitations (web only for now)
* Set up recurring events annually, monthly, weekly, daily, or on an interval of your choice
* Also available in dark mode
You can also import events from your existing calendar if you are thinking to make a switch. Event invitations should work from both Google and Microsoft Calendars.
Unlike other calendars, Proton Calendar utilizes end-to-end encryption to protect your events. So, only you know what events you have and the information regarding it.
If you are curious to know the details behind how they protect your calendar data, you can refer to their [official blog post][8] about it.
_Have you tried Proton Calendar yet? Is it as useful as Tutanotas already existing calendar if youve tried it?_
![][9]
I'm not interested
#### _Related_
* [Gmail's Privacy Alternative ProtonMail Makes 'Undo Send' Feature Available for All Users][10]
* ![][11] ![ProtonMail undo send option][12]
* [Firefox Proton With Major Redesign Change is Coming Soon. Take a Look Before the Final Release][13]
* ![][11] ![][14]
* [ProtonVPN Adds 'NetShield' Feature to Block Malware, Scripts &amp; Ads Online][15]
* ![][11] ![NetShield by ProtonVPN][16]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/protoncalendar-beta-free/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/recommends/protonmail/
[2]: https://itsfoss.com/secure-private-email-services/
[3]: https://tutanota.com/
[4]: https://protonmail.com/blog/calendar-free-web-android/
[5]: https://beta.protonmail.co
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1OScgd2lkdGg9JzI4NycgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[7]: https://calendar.protonmail.com
[8]: https://protonmail.com/blog/protoncalendar-security-model/
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[10]: https://news.itsfoss.com/protonmail-undo-send/
[11]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[12]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/protonmail-undo-send.png?fit=1200%2C675&ssl=1&resize=350%2C200
[13]: https://news.itsfoss.com/firefox-proton-redesign/
[14]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/04/firefox-proton-look-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[15]: https://news.itsfoss.com/protonvpn-netshield/
[16]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/Netshield-by-ProtonVPN.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,128 @@
[#]: subject: (Kate Editor Set to Become KDEs Answer to Microsofts Visual Studio Code)
[#]: via: (https://news.itsfoss.com/kate/)
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Kate Editor Set to Become KDEs Answer to Microsofts Visual Studio Code
======
KDE has revealed some details on the upcoming 21.04 release of their Kate text editor, or KDE Advanced Text Editor. With this release comes a huge range of new features, such as a new HUD style command palette and improved search in files.
To the Visual Studio Code users out there, this may seem familiar. Microsoft VS Code has had a similar style command palette for a long time, which Kate users (until now) had to leave out of their workflow.
Some of the features I will be looking at in this article include:
* **Integrated Git support**
* HUD style command palette
* Quick open with fuzzy matching
* Improved Search In Files
* Improved Language Server Protocol (LSP) support
### Integrated Git Support Finally!
![][1]
One of the biggest features of this update is the integrated git support. Although it has been possible to load git repositories in Kate for a while now, the new integrated git support allows you to checkout and create branches, stash stuff, stage your files for commit or diff, and do the commit and push afterward, **all without touching the terminal!**
This is a huge improvement over the old way of using Kates built-in terminal to manage your repositories.
Additionally, it opens up the ability to use git on the Windows version of Kate, which still doesnt have the ability to access a command line (most likely due to the locked-down nature of it).
This is a a huge feature, and I suspect that it will be welcomed by developers everywhere.
### HUD Style Command Palette
![][2]
One of the key components of the VS Code workflow is the Command Palette. After waiting for years, this huge feature has finally been added to Kate.
The Command Palette is possibly one of the most commonly used features in VS Code, and it has been one of the few things that have kept me using the aforementioned text editor. Now with the integration into Kate, I can happily switch, without worrying about a huge disruption to my workflow.
### Quick Open (With Fuzzy Matching)
![][3]
A longtime feature of Kate, Quick Open hasnt been improved all that much over the past few years. Now with the new 21.04 release, it is receiving a major overhaul, with things such as Fuzzy Matching and a new UI that aims to be more consistent with the Command Palette.
The new UI is the result of a move to a more consistent design throughout Kate. Although minor, this change definitely is more eye-pleasing and helps improve the layout for those with larger screens.
The fuzzy matching is also a welcome improvement. The Quick Open dialog used to use a wildcard filter for its top result, with direct matches to the search term being listed beneath it. The 21.04 release uses a new fuzzy matching algorithm, providing the best results at the top, with less likely results located at the bottom.
The result of this is far more reliable results, which when combined with the new UI, provides a huge improvement to the user experience.
### Improved Search in Files
![][3]
With the new release comes yet another welcome improvement: Better search in files.
The search plugin got a major overhaul with much better result representation in the proper editor font and colors. It has also been improved in terms of speed, with a very noticeable performance jump.
One way they achieved this is through parallelizing the search engine, allowing it to attempt to utilize all the available cores on the CPU. No longer does Kate need to hide behind Atom/VS Code!
### Improved LSP Support
![][4]
For those unfamiliar with the term, LSP stands for Language Server Protocol. This is whats responsible for the detection of code errors and warnings, go to definition/declaration capabilities, and symbol outlines.
If you happen to be coding in one of the supported languages, it should be enabled out of the box, enabling Kate to be used similarly to a lightweight IDE.
### Wrapping Up
With this [upcoming new release][5], you can expect heaps of cool new features, each providing a better experience to the end-user. After a long wait, it seems that Kate is finally catching up with other [modern code editors like VS Code][6] in terms of features, with the added benefit of better integration into KDE Plasma desktop.
The new release should arrive in within the next two weeks. Keep an eye out for it.
![][7]
I'm not interested
#### _Related_
* [KDE Plasma 5.22 To Include New Adaptive Panel Opacity and Other Exciting Improvements][8]
* ![][9] ![][10]
* [KDE Plasma 5.21 Brings in a New Application Launcher, Wayland Support, and Other Exciting Additions][11]
* ![][9] ![][12]
* [Linux Release Roundup #21.12: 7-Zip, Vivaldi Browser 3.7, Audacity 3.0 and More New Releases][13]
* ![][9] ![Linux Release Roundups][14]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/kate/
作者:[Jacob Crume][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/jacob/
[b]: https://github.com/lujun9972
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzUwNycgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[2]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzUxMCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQzNScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzM3Nycgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[5]: https://kate-editor.org/post/2021/2021-03-29-kate-21.04-feature-preview/
[6]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
[7]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[8]: https://news.itsfoss.com/kde-plasma-5-22-dev/
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[10]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/kde-plasma-22-dev-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[11]: https://news.itsfoss.com/kde-plasma-5-21-release/
[12]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/02/kde-plasma-5-21-feat.png?fit=1200%2C675&ssl=1&resize=350%2C200
[13]: https://news.itsfoss.com/linux-release-roundup-2021-12/
[14]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Linux-release-roundups.png?fit=800%2C450&ssl=1&resize=350%2C200

View File

@ -0,0 +1,84 @@
[#]: subject: (Metro Exodus is Finally Here on Steam for Linux)
[#]: via: (https://news.itsfoss.com/metro-exodus-steam/)
[#]: author: (Asesh Basu https://news.itsfoss.com/author/asesh/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Metro Exodus is Finally Here on Steam for Linux
======
Metro Exodus, a long-time fan favorite, is finally here in Linux. After a long wait of over two years, Linux users can finally get their hands on the third installment of the Metro trilogy. Although a few unofficial ports of the game was available, this is an official release by 4A Games.
It is a first-person shooter game with gorgeous ray tracing graphics and the story is set in Russian wilderness across vast lands. The brilliant story-line spans an entire year through spring, summer and autumn to the nuclear winter. The game is a combination of fast-paced combat and stealth with exploration and survival and is easily one of the most immersive games in Linux.
### Can my PC Run it?
Being a graphically intensive game means you need to have a decent hardware to get good frame rates. This game heavily depends on Ray Tracing to make the images look as good as they do.
Just to run the game, you will need **Intel Core i5 4400** with **8 GB** of RAM and an **NVIDIA GTX670** or AMD Radeon R9 380, at least. The recommended specification is Intel Core i7 4770K with a GTX1070 or RX 5500XT.
Here is the official list of specifications as mentioned by developers:
![][1]
Its a paid game, and you need to shell out $39.99 USD to get your hands on the newest and greatest version of Metro Exodus.
Check for your graphics drivers and Linux kernel version if you cant play it due to constant crashes. Some have reported a few issues with it to start with, but not a widespread problem.
### Where do I get the Game?
The Linux version is available on [Steam][2] for Linux. If you already bought the game, it will appear in your Steam for Linux library automatically.
[Metro Exodus (Steam)][2]
If you dont have it installed, you can follow our guide to [install Steam on Ubuntu][3] and [Fedora][4].
_Do you already have Metro Exodus in your Steam library? Planning to get it? Let me know in the comments below._
![][5]
I'm not interested
#### _Related_
* [Popular Game Titles Metro Exodus and Total War: Rome Remastered Releasing for Linux in April][6]
* ![][7] ![][8]
* [Don't Miss These Epic Deals &amp; Free Games for Linux This Holiday Season][9]
* ![][7] ![][10]
* [The Progress Linux has Made in Terms of Gaming is Simply Incredible: Lutris Creator][11]
* ![][7] ![][12]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/metro-exodus-steam/
作者:[Asesh Basu][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/asesh/
[b]: https://github.com/lujun9972
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzM3Micgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[2]: https://store.steampowered.com/app/412020/Metro_Exodus/
[3]: https://itsfoss.com/install-steam-ubuntu-linux/
[4]: https://itsfoss.com/install-steam-fedora/
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[6]: https://news.itsfoss.com/metro-exodus-total-war-rome-linux/
[7]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[8]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/metro-total-war-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[9]: https://news.itsfoss.com/game-deals-holiday-2020/
[10]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Linux-Game-Deals.png?fit=800%2C450&ssl=1&resize=350%2C200
[11]: https://news.itsfoss.com/lutris-creator-interview/
[12]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/lutris-interview-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,155 @@
[#]: subject: (Much-Anticipated Zorin OS 16 is Available for Beta Testing With A Stunning New Look)
[#]: via: (https://news.itsfoss.com/zorin-os-16-beta/)
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Much-Anticipated Zorin OS 16 is Available for Beta Testing With A Stunning New Look
======
Zorin OS 16 was one of my picks for [distributions to look out for in 2021][1]. They always do something interesting with every major upgrade, and it looks like Zorin OS 16 is going to be an exciting release to talk about.
The Zorin team [announced][2] the availability of Zorin OS 16 (based on **Ubuntu 20.04 LTS**) beta along with all the new features that come with it.
Here, I will mention the highlights of the new release along with a video tour (with the download link at the bottom).
### Zorin OS 16 Beta: Whats New?
Zorin OS always tries to make the UX cleaner and attractive while improving the performance, let us see what Zorin OS 16 is all about. Heres a short video tour to see it in action:
Now, let me highlight the key changes:
#### User Interface Refresh
![][3]
The most exciting part of this release is the UI overhaul that gives it an impressive look.
Zorin OS 15 was already a [gorgeous Linux distribution][4]. And with Zorin OS 16, they have refreshed the user interface to look nicer and cleaner.
It looks like we might have a good-looking alternative to Deepin Linux after all.
The animations and the theme have been polished to look cleaner. Especially, with the new default background, it blends in pretty nice. In fact, it is a dynamic wallpaper that changes based on the time of the day.
Also, the lock screen now displays your wallpaper blurred.
#### Flathub Included
The adoption of [Flatpak][5] is increasing every day. Now, Zorin OS 16 enables the Flathub repository by default.
So, you can easily find Flatpak apps right from the Software store.
Of course, you also have Snap store enabled by default. Hence, the software store presents you a range of catalogs.
#### Improved Welcome Tour
![][6]
This is quite common for every distribution to include. However, this time Zorin OS has updated the tour to guide the user through the basics along with customization options.
This is definitely going to be very helpful for a newbie.
#### New Touchpad Gestures
Even though I stick to my desktop, for users with Laptops the new touchpad gestures should help you navigate quickly between workspaces and activity overview.
#### Addition of a Sound Recorder App
The new sound recorder app is a minimal and beautiful app to let you record audio/speech.
Having an audio recorder out of the box is a plus, not many distributions offer it.
#### Customization Improvements
![][7]
Zorin OS 15 was moderately customizable. With Zorin OS 16, you get enhanced customization options for the taskbar and the overall layout of the system.
You can set the panels transparency, display it on multiple monitors, auto-hide, and more. For the appearance, you can now select an icon theme, change the app theme, fonts, and more.
The options look much cleaner and easier to find.
#### Windows 10X-like Desktop Layout Planned
![][8]
They plan to introduce a Windows 10X-like desktop layout for users with comfortable with touchpad, touchscreens, and mice. This isnt included with the beta, but it is expected arrive before the final release.
Zorin OS was already a good choice as a [Windows-like distribution][9].
#### Other Improvements
There are several under-the-hood tweaks that would contribute to a better user experience. Some of them include:
* A new jelly animation effect when moving windows and minimizing it
* Fractional scaling support for high-res displays
* Improved Fingerprint reader support
* Unread icons
* Refresh settings app
* Disabled built-in tracking and telemetry in Firefox
* Linux Kernel 5.8
### Try Zorin OS 16 (Beta)
You get the Zorin OS 16 beta ISO from the download button below. It is worth noting that it may not be wise to use it on a production system while it is meant for beta testing.
As mentioned in their announcement post, other editions of Zorin OS 16 such as Lite, Education, and Ultimate will be available over the coming months.
[Zorin OS 16 Core Beta][10]
If you are curious, you may take a look at the full changelog to know more about the release.
![][11]
I'm not interested
#### _Related_
* [Linux Release Roundup #21.16: CopyQ 4.0, Zorin OS 16 Beta, Slackware 15 Beta, and More New Releases][12]
* ![][13] ![Linux Release Roundups][14]
* [7 Linux Distros to Look Forward to in 2021][1]
* ![][13] ![Best Linux Distributions in 2021][15]
* [Fedora 34 Beta Arrives With Awesome GNOME 40 (Unlike Ubuntu 21.04)][16]
* ![][13] ![][17]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/zorin-os-16-beta/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://news.itsfoss.com/linux-distros-for-2021/
[2]: https://blog.zorin.com/2021/04/15/introducing-zorin-os-16-test-the-beta-today/
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQ0MCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[4]: https://itsfoss.com/beautiful-linux-distributions/
[5]: https://itsfoss.com/what-is-flatpak/
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzY0MCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[7]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzU3Micgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[8]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQzOScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[9]: https://itsfoss.com/windows-like-linux-distributions/
[10]: https://zorinos.com/download/16/core/beta
[11]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[12]: https://news.itsfoss.com/linux-release-roundup-2021-16/
[13]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[14]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Linux-release-roundups.png?fit=800%2C450&ssl=1&resize=350%2C200
[15]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/best-distros-2021.png?fit=1200%2C675&ssl=1&resize=350%2C200
[16]: https://news.itsfoss.com/fedora-34-beta-release/
[17]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/fedora-34-beta-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,176 @@
[#]: subject: (Ubuntu 21.04 is Releasing This Week! Take a Look at the New Features)
[#]: via: (https://news.itsfoss.com/ubuntu-21-04-features/)
[#]: author: (Abhishek https://news.itsfoss.com/author/root/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Ubuntu 21.04 is Releasing This Week! Take a Look at the New Features
======
Ubuntu 21.04 is releasing this week on April 22. Some of you might already have [upgraded to Ubuntu 21.04 beta][1] to enjoy the latest and greatest (?) version of Ubuntu.
For the rest, who are curious about whats new in Ubuntu 21.04, I have curated a list here.
### Whats new in Ubuntu 21.04 Hiruste Hippo?
First of all, this is an interim release. Dont expect groundbreaking changes here specially when you compare it to Ubuntu 20.10. There are subtle visual changes here and there, a bit of performance improvements, newer versions of popular software and libraries in the official repository along with the addition of a couple of new features.
![][2]
#### 1\. Wayland becomes the default display server
After the failed experiment with Ubuntu 17.10, Canonical is once again going with Wayland as the default display server in Ubuntu 21.04.
Wayland has been available as an alternate option for past several releases. It is just becoming the default in this release.
What does it mean to you? Wayland has a tad bit better performance specially when it comes to [multiple monitors and HiDPI screen handling][3].
However, youll find that several applications do not work very well or do not work at all in Wayland. This is painful for screen capture and recording applications.
The good thing is that [switching back to Xorg from Wayland][4] is a matter of a few clicks. You just have to figure out if you cannot function well without Xorg server.
#### 2\. Darker dark theme
Yaru dark theme in Ubuntu 21.04 has a bit darker shade than the one in Ubuntu 20.10. This actually gives a nice look to the operating system, in my opinion.
You can move the slider to see the visual difference between the dark shade of the two versions.
#### 3\. Dark shell theme by default
Ubuntu 20.10 the standard Yaru theme by default and you had to opt for the dark mode. That remains as it is in 21.04 as well except the shell theme has been switched to Yaru Dark by default.
This means that even though your system will have the light theme by default, the notifications, message tray and the system tray will use dark theme.
![][2]
#### 4\. Power mode option for laptops
This is a minor change in the power settings. If you are using a laptop, you can now choose a power mode from the settings.
![][5]
You have the following options available:
* Performance: Takes a lot of batter power but gives high performance (keeps bluetooth active, screen brightness high and more)
* Balanced power: Standard performance with decent batter usage
* Power saver: The focus is on saving battery power
#### 5\. A hybrid mix of GNOME 3.38 and some GNOME 40 applications
The much anticipated [GNOME 40 with the unorthodox horizontal layout is not available in Ubuntu 21.04][6]. Ubuntu team was not ready for the GTK 4 and the layout change. They are working to bring it to Ubuntu 21.10 in October this year.
While some core components like Nautilus file manager remain at 3.38, some other GNOME apps like Epiphany browser, Disk Utility etc have the latest versions.
#### 6\. Private home directories
So far, the home directories had the permission of 755. Fresh installation of Ubuntu 21.04 will have this changed to 750 and thus making the [home directories private][7].
![][8]
#### 7\. Recovery key option for encrypted installs
While installing Ubuntu, if you opt for disk encryption, you can now also set a recovery key option directly in the installer.
![Image Credit: OMG Ubuntu][9]
#### 8\. Minor visual changes
By no means these are groundbreaking changes. Its just something I noticed in Ubuntu 21.04 so far.
Youll notice that the items on the right click context menu has been divided by more contrast colored lines. I believe this is for accessibility reasons.
![][10]
I also noticed that the mounted drives are displayed in the top-right corner of the desktop. If I recall correctly, it used to be under the Home and Trash icons in the previous versions.
![][11]
The default Yaru icons have been refreshed for a number of software. You can clearly notice it for the LibreOffice icons.
![][12]
#### 9\. Under the hood changes
Some other changes you should be aware:
* Support for [Smart Card][13] authentication via PAM
* Drag and Drop interaction support with software in the desktop view
* Pipewire support enabled to handle audio in sandboxed applications and screen recording
* nftables replaces iptables
There are newer versions of software:
* Linux kernel 5.11
* Python 3.9
* gEdit 3.38.1
* LibreOffice 7.1.2
* Firefox 87
By now you might have realized that there are not many changes in this new release of Ubuntu. There is support for newer hardware and improvements for HiDPI and fingerprint reader but thats not for everyone. It includes the latest Linux kernel 5.11 if thats any consolation.
If you are using Ubuntu 20.10, you should upgrade to Ubuntu 21.04 anyway because 20.10 reaches end of life in July.
Whats your overall feeling about Ubuntu 21.04? Were you expecting more new features? What are you missing the most here?
![][14]
I'm not interested
#### _Related_
* [No GNOME 40 for Ubuntu 21.04 [And That's a Good Thing]][15]
* ![][16] ![No GNOME 40 in Ubuntu 21.04][17]
* [With 21.04, Ubuntu is Switching to Wayland by Default Again][18]
* ![][16] ![Ubuntu 21.04 to use Wayland by default][19]
* [Ubuntu 21.04 Beta is Now Available to Download][20]
* ![][16] ![][21]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/ubuntu-21-04-features/
作者:[Abhishek][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/root/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/upgrade-ubuntu-beta/
[2]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQzOScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[3]: https://news.itsfoss.com/ubuntu-21-04-multi-monitor-support/
[4]: https://itsfoss.com/switch-xorg-wayland/
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQxMScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[6]: https://news.itsfoss.com/gnome-40-release/
[7]: https://news.itsfoss.com/private-home-directory-ubuntu-21-04/
[8]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI2MScgd2lkdGg9Jzc3MScgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQ3OScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[10]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQ2OCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[11]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQxOScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[12]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzE2Nycgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[13]: https://en.wikipedia.org/wiki/Smart_card
[14]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[15]: https://news.itsfoss.com/no-gnome-40-in-ubuntu-21-04/
[16]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[17]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/gnome-40-ubuntu-21-04.png?fit=1200%2C675&ssl=1&resize=350%2C200
[18]: https://news.itsfoss.com/ubuntu-21-04-wayland/
[19]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/wayland-by-default-in-ubuntu-21-04.png?fit=1200%2C675&ssl=1&resize=350%2C200
[20]: https://news.itsfoss.com/ubuntu-21-04-beta-release/
[21]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/04/ubuntu-21-04-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,132 @@
[#]: subject: (Confusion Erupts Around Misleading News Surrounding Youtube-dl Takedown)
[#]: via: (https://news.itsfoss.com/youtube-dl-repo-fork/)
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Confusion Erupts Around Misleading News Surrounding Youtube-dl Takedown
======
In November 2020, [GitHub took down the Youtube-dl repository][1] after a complaint from the [RIAA][2]. This action caused a huge backlash within the open-source community, with many developers boycotting GitHub altogether.
The RIAA claimed that [Youtube-dl][3] was using copyright-protection avoidance technologies, which resulted in immense criticism from multiple open-source organizations. In a surprise move, GitHub reinstated the repository several weeks later.
![][4]
To complement this reinstatement, they created a 1 million dollar takedown defense fund, designed to prevent situations like this in the future.
### False News Surrounding Youtube-dls Forks
![][5]
Among the confusion caused by this takedown, some recent reports have surfaced claiming that forks of the Youtube-dl repository are still disabled. **This is not true**. If we look at the [list of forks,][6] we can see a huge list of repositories, with each one working as normal.
Multiple sources reference [this repository][7], which has been taken down and has still not been reinstated by GitHub. However, it is not actually forked from the [official Youtube-dl repository][8]. Instead, this repository is based on an unofficial version of Youtube-dl and is not actually a Youtube-dl fork.
This isnt to say that GitHub is without blame, as they have still ignored this developers counternotice. However, this warrants nowhere near the amount of criticism GitHub has received because of this.
### GitHub Working on Preventing a Situation Like This In The Future
GitHub reinstated the Youtube-dl repository back then (and its forks), many were pleased to hear that they had also started work on preventing a situation like this in the future. Some of these initiatives include:
* A 1,000,000 USD fund aimed to help developers fight DMCA notices
* Giving the option to developers to dispute the notice
* Requiring additional proof for part 1201 takedown notices
#### New Fund to Fight DMCA Notices
As a result of the community backlash GitHub received, they have invested one million USD into a fund designed to help developers fight unfair DMCA notices. According to the official [GitHub post:][9]
> Developers who want to push back against unwarranted takedowns may face the risk of taking on personal liability and legal defense costs. To help them, GitHub will establish and donate $1M to a developer defense fund to help protect open source developers on GitHub from unwarranted DMCA Section 1201 takedown claims.
GitHub
Although providing legal support for open-source developers is not a new idea, GitHub providing this support directly is worth appreciating.
If you are interested in other ways to get support with legal disputes over open-source software, you may want to look at the [SFLC][10] and [EFF][11]. If possible, it would also be great if you could support them whether thats through donations of time or money.
#### New Way For Developers To Dispute DMCA Notices
Another way GitHub is working to improve its relationship with developers is through a new way to dispute takedown notices. This will improve the transparency between developers and the notice issuers, reducing the likelihood of another situation like this.
> Every single credible 1201 takedown claim will be reviewed by technical experts, including (when appropriate) independent specialists retained by GitHub, to ensure that the project actually circumvents a technical protection measure as described in the claim.
>
> The claim will also be carefully scrutinized by legal experts to ensure that unwarranted claims or claims that extend beyond the boundaries of the DMCA are rejected.
>
> In the case where the claim is ambiguous, we will err on the side of the developer, and leave up the repository unless there is clear evidence of illegal circumvention.
Yet again, it seems that GitHub is putting in a lot of effort to improve its policies on DMCA takedown notices. These improvements will definitely help with the number of false claims that are currently being accepted.
#### More Proof Required for Future Part 1201 Notices
For those without a background in law, Part 1201 DMCA Takedown Notices are a special kind of takedown notice used in cases where the offending party is using code designed to circumvent technical measures to protect copyrighted content. According to GitHub:
> Section 1201 dates back to the late 1990s and did not anticipate the various implications it has for software use today. As a result, Section 1201 makes it illegal to use or distribute technology (including source code) that bypasses technical measures that control access or copying of copyrighted works, even if that technology can be used in a way that would not be copyright infringement.
GitHub has now changed its policies so that anyone issuing a part 1201 notice must include additional evidence. This is beneficial to all involved parties as it means that most of the illegitimate claims will be void anyway.
### Wrapping Up
With the huge mess, this situation has created, I believe GitHub handled this as well as they reasonably could have. Additionally, it brought to light many legal issues surrounding part 1201 notices, which are being remedied right now.
Overall, the outcome of this has actually been positive, with a huge step in the right direction in developer rights. Amidst the rumors and fake news that has been circling lately, I think it is important to recognize the changes that have been made, and what they mean for the future of open-source software.
_What are your thoughts on the removal of Youtube-dl and then reinstating it? Let me know in the comments below!_
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
#### _Related_
* [PHP Repository Moves to GitHub After its Git Server Was Hacked][12]
* ![][13] ![][14]
* [10 Biggest Linux Stories of the Year 2020 [That Made the Biggest Impact]][15]
* ![][13] ![Biggest Linux Stories][16]
* [After Rocky Linux, We Have Another RHEL Fork in Works to Replace CentOS][17]
* ![][13] ![CloudLinux][18]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/youtube-dl-repo-fork/
作者:[Jacob Crume][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/jacob/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/youtube-dl-github-takedown/
[2]: https://www.riaa.com/
[3]: https://youtube-dl.org/
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQzOCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzM3NScgd2lkdGg9Jzc0MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[6]: https://github.com/ytdl-org/youtube-dl/network/members
[7]: https://github.com/spookyahell/youtube-dl
[8]: https://github.com/ytdl-org/youtube-dl
[9]: https://github.blog/2020-11-16-standing-up-for-developers-youtube-dl-is-back/
[10]: https://softwarefreedom.org/donate/
[11]: https://www.eff.org/
[12]: https://news.itsfoss.com/php-repository-github/
[13]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[14]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/php-github-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[15]: https://news.itsfoss.com/biggest-linux-stories-2020/
[16]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/biggest-linux-stories-2020.jpg?fit=1200%2C675&ssl=1&resize=350%2C200
[17]: https://news.itsfoss.com/rhel-fork-by-cloudlinux/
[18]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Untitled-design-2.png?fit=800%2C450&ssl=1&resize=350%2C200

View File

@ -0,0 +1,125 @@
[#]: subject: (Hurrah! Ubuntu 21.04 is Now Available to Download)
[#]: via: (https://news.itsfoss.com/ubuntu-21-04-release/)
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Hurrah! Ubuntu 21.04 is Now Available to Download
======
It is time to make way for Ubuntus latest stable release 21.04 Hiruste Hippo.
While we already know a great deal about the [features introduced with Ubuntu 21.04][1], it has been [officially announced][2].
Yes, theres no GNOME 40, which is a bummer. But, here, let me briefly mention the key highlights of the release and how to get the latest ISO.
### Ubuntu 21.04: Key Highlights
Considering this as an interim release, there are no ground-breaking changes but still a few things to get excited about.
#### Wayland Is The Default Display Server
This could be one of the most significant changes that you may want to keep an eye on.
Many applications fail to work with Wayland, but were slowly getting Wayland support on new application releases considering its performance and security benefits.
So, this is probably a bold step to move away from Xorg.
#### UI Enhancements
![][3]
Ranging from subtle improvements to the Dark Theme to the adoption of dark theme by default, you will be greeted with some UI enhancements for a good user experience.
Also, [Googles Flutter apps are coming to Ubuntu 21.04][4]. You will find them through the snap store, and it should potentially enable Linux desktop to have high quality cross-platform with improved user experience overall.
In addition to that, you might observe a few things here and there that could look a bit different.
#### GNOME 40 Applications &amp; GNOME 3.38
Even though it does not come baked in with [GNOME 40][5], you will find the default applications updated to GNOME 40.
So, the GNOME 40 apps have been made compatible with GNOME 3.38 for this release. The next release should make the transition to GNOME 40 without any hiccups.
#### Private Home Directories
![][6]
The home directory was readable/writable by root and other users. However, with [Ubuntu 21.04, they are making it private][7].
#### Other Improvements
There are plenty of other improvements that include under-the-hood changes for new hardware support, enhanced laptop support, and more.
Of course, the packages have been updated to the latest as well along with the inclusion of [Linux Kernel 5.11][8].
### Things to Know Before You Upgrade
If you are using Ubuntu 20.10, you can easily upgrade to Ubuntu 21.04 through the **Updates** section.
In either case, if you are on Ubuntu 20.04 LTS, I would not recommend upgrading to Ubuntu 21.04 yet unless you want the latest and greatest at the expense of stability and potential issues.
### Download Ubuntu 21.04 Now
You can get the latest release from the official website, both torrent and a direct ISO file download should be available as options.
At the time of publishing this, the official website still did not include a link to the latest images but it should be updated soon enough.
[Ubuntu 21.04 Download][9]
If you need a choice of desktop environment, you will have to wait for the official flavors of Ubuntu to release an upgrade, that will take a while.
_What do you think about Ubuntu 21.04 release? Feel free to let me know your thoughts in the comments!_
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
#### _Related_
* [Ubuntu 21.04 is Releasing This Week! Take a Look at the New Features][1]
* ![][10] ![Ubuntu 21.04 New Features][11]
* [Ubuntu 21.04 Beta is Now Available to Download][12]
* ![][10] ![][13]
* [Ubuntu 21.04 To Offer GNOME 40 Apps with GNOME 3.38 Desktop][14]
* ![][10] ![][15]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/ubuntu-21-04-release/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://news.itsfoss.com/ubuntu-21-04-features/
[2]: https://ubuntu.com/blog/ubuntu-21-04-is-here
[3]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQzOScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[4]: https://itsfoss.com/google-flutter-apps-linux/
[5]: https://news.itsfoss.com/gnome-40-release/
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI2MScgd2lkdGg9Jzc3MScgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[7]: https://news.itsfoss.com/private-home-directory-ubuntu-21-04/
[8]: https://news.itsfoss.com/linux-kernel-5-11-release/
[9]: https://ubuntu.com/download
[10]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[11]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/04/ubuntu_21_04_features.png?fit=1200%2C675&ssl=1&resize=350%2C200
[12]: https://news.itsfoss.com/ubuntu-21-04-beta-release/
[13]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/04/ubuntu-21-04-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[14]: https://news.itsfoss.com/ubuntu-21-04-gnome-40-apps/
[15]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/ubuntu-21-04-gnome-40-feat.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,143 @@
[#]: subject: (Running Linux Apps In Windows Is Now A Reality)
[#]: via: (https://news.itsfoss.com/linux-gui-apps-wsl/)
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Running Linux Apps In Windows Is Now A Reality
======
When Microsoft released [Windows Subsystem for Linux][1] (WSL) in 2016, the hype was unreal. People were dreaming of running their Windows and Linux apps side-by-side, without having to reboot. But alas, WSL could only run terminal applications.
Last year, Microsoft set out again to try to revolutionize the Windows app ecosystem. This time, they replaced the old emulated kernel with a real Linux kernel. This change allowed you to run [Linux apps in Windows][2].
### Initial Preview of GUI Apps for WSL
![][3]
Technically, you did get the initial support for Linux GUI apps on WSL, but only when using a 3rd-party X server. These were often buggy, slow, hard to set up, and posed a privacy concern.
The result of this was a small group of Linux enthusiasts (that happened to run Windows) that had the skills and knowledge to set up an X server. These people were then horribly disappointed at the fact there was no hardware acceleration at all.
So, it was wise to stick to command line utilities on WSL.
**But this all changes now.** Now that Microsoft is [officially supporting][4] GUI Linux apps, we will be receiving hardware acceleration, alongside a huge range of other improvements in WSL.
### Linux GUI Apps For The Masses: WSLg
![Image Credit: Microsoft Devblogs][5]
With the new official support from Microsoft in WSL, there is a huge range of available improvements. These include:
* GPU hardware acceleration
* Audio and microphone support out of the box
* Automatic starting of the X and PulseAudio servers
And, theyve given this feature a nickname “**WSLg**“.
These features will make running Linux apps on WSL almost as easy as running native apps, with a minimal performance impact.
So, you can try running your [favorite IDE][6], Linux-specific testing use-cases, and a variety of other applications like [CAD software][7].
#### GPU Hardware Acceleration In Linux Apps
![Image Credit: Microsoft Devblogs][8]
One of the biggest issues with running GUI Linux apps on Windows previously was that they couldnt use hardware acceleration. This left us with a slow mess when trying to move windows around and doing anything that needed some GPU horsepower.
According to the announcement post from Microsoft:
> As part of this feature, we have also enabled support for GPU accelerated 3D graphics! Thanks to work that was completed in Mesa 21.0, any applications that are doing complex 3D rendering can leverage OpenGL to accelerate these using the GPU on your Windows 10 machine.
This is a useful addition, and should help anyone wanting to run GPU intensive applications through WSL.
#### Audio And Microphone Support Out Of The Box!
One of the key elements to a good experience with Linux apps running alongside Windows apps is the audio. With the new WSL update, audio is supported out of the box. This is achieved with a PulseAudio server being started at the same time as the X server.
Microsoft explains:
> Linux GUI applications on WSL will also include out-of-the-box audio and microphone support. This exciting aspect will let your apps play audio cues and utilize the microphone, perfect for building, testing, or using movie players, telecommunication apps, and more.
If we want Linux apps to become more widespread, this is a key feature. This will also allow developers of Windows apps to better support porting their apps to Linux.
#### Automatic Starting Of All The Required Servers
![Image Credit: Microsoft Devblogs][9]
Previously, you had to start the [PulseAudio][10] and [X servers][11] manually before being able to actually run anything. Now, Microsoft has implemented a service that checks to see if a Linux app is running, and then starts the required servers automatically.
This allows much easier launching and using of Linux apps on Windows.
Microsoft claims this will improve the user experience significantly:
> With this feature, we are automatically starting a companion system distro, containing a Wayland, X server, pulse audio server, and everything else needed to make Linux GUI apps communicate with Windows. After youre finished using GUI applications and terminate your WSL distribution the system distro will automatically end its session as well.
These components combine to make it super easy to run Linux GUI apps alongside regular Windows apps.
### Wrapping Up
With all these new features, it looks like Microsoft is giving it their best to get Linux apps working on Windows. And with more users running Linux apps on Windows, we may see more of them jump ship and move solely to Linux. Especially since the apps theyre used to would run anyway.
If this takes off (and Microsoft doesnt kill it in a few years), it will bring an end to a 5-year quest to bring Linux apps to Windows. If you are curious to learn more about it, you can look at the [release announcement][12].
_What are your thoughts on GUI Linux apps running on Windows? Share them in the comments below!_
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
#### _Related_
* [Linux Mint 20.1 is Available to Download Now, Here are 9 New Features in This Release][13]
* ![][14] ![Linux Mint 20.1][15]
* [The Progress Linux has Made in Terms of Gaming is Simply Incredible: Lutris Creator][16]
* ![][14] ![][17]
* [Nitrux 1.3.8 Release Packs in KDE Plasma 5.21, Linux 5.11, and More Changes][18]
* ![][14] ![][19]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/linux-gui-apps-wsl/
作者:[Jacob Crume][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/jacob/
[b]: https://github.com/lujun9972
[1]: https://docs.microsoft.com/en-us/windows/wsl/
[2]: https://itsfoss.com/run-linux-apps-windows-wsl/
[3]: https://i0.wp.com/i.ytimg.com/vi/f8_nvJzuaSU/hqdefault.jpg?w=780&ssl=1
[4]: https://devblogs.microsoft.com/commandline/the-initial-preview-of-gui-app-support-is-now-available-for-the-windows-subsystem-for-linux-2/
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQ0MScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[6]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/
[7]: https://itsfoss.com/cad-software-linux/
[8]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQ0NScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQ0MCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[10]: https://www.freedesktop.org/wiki/Software/PulseAudio/
[11]: https://x.org/wiki/
[12]: https://blogs.windows.com/windows-insider/2021/04/21/announcing-windows-10-insider-preview-build-21364/
[13]: https://news.itsfoss.com/linux-mint-20-1-release/
[14]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[15]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/linux-mint-20-1.png?fit=1200%2C675&ssl=1&resize=350%2C200
[16]: https://news.itsfoss.com/lutris-creator-interview/
[17]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/lutris-interview-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[18]: https://news.itsfoss.com/nitrux-1-3-8-release/
[19]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/nitrux-1-3-8.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,169 @@
[#]: subject: (KDE Announces Various App Upgrades With Cutting-Edge Features)
[#]: via: (https://news.itsfoss.com/kde-gear-app-release/)
[#]: author: (Jacob Crume https://news.itsfoss.com/author/jacob/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
KDE Announces Various App Upgrades With Cutting-Edge Features
======
Alongside their Plasma Desktop Environment, KDE develops a huge range of other apps collectively named KDE Gear. These range from content creation apps such as **Kdenlive** and **Kwave** to utilities such as Dolphin, Discover, and Index.
KDE Gear is something new. It includes heaps of improvements to almost all the KDE apps, which we will be exploring here.
### What Is KDE Gear?
![][1]
For many people, this name will sound unfamiliar. This is because [KDE Gear][2] is the new name for the [KDE Applications][3]. Previously, they were released individually. The new name aims to unify their marketing and provide greater clarity to users.
According to **KDE developer Jonathan Riddell**:
> KDE Gear is the new name for the app (and libraries and plugins) bundle of projects that want the release faff taken off their hands… It was once called just KDE, then KDE SC, then KDE Applications, then the unbranded release service, and now were banding it again as KDE Gear.
This rebrand makes sense, especially as the KDE logo itself is pretty much a glorified gear.
### Major KDE App Upgrades
KDE Gear contains many applications, each with its purpose. Here, we will be looking at a few of the key highlights. These include:
* Kdenlive
* Dolphin
* Elisa
* Index
We have also covered the new [Kate editor release challenging Microsofts Visual Studio Code][4] separately, if you are curious.
#### Kdenlive
![][5]
KDEs video editor has improved massively over the past few years, with heaps of new features added with this release. It involves:
* Online Resources tool
* Speech-To-Text
* New AV1 support
The Online resources tool is a fairly recent addition. The main purpose of this tool is to download free stock footage for use in your videos.
The Speech-To-Text tool is a nifty little tool that will automatically create subtitles for you, with surprising accuracy. It is also effortless to use, with it being launched in just 3 clicks.
Finally, we get to see the main new feature in the 21.04 release: AV1 codec support. This is a relatively new video format with features such as higher compression, and a royalty-free license.
#### Dolphin
![][5]
Dolphin, the file manager for Plasma 5, is one of the most advanced file managers existing. Some of its notable features include a built-in terminal emulator and file previews.
With this release, there are a multitude of new features, including the ability to:
* Decompress multiple files at once
* Open a folder in a new tab by holding the control key
* Modify the options in the context menu
While minor, these new features are sure to make using Dolphin an even smoother experience.
#### Elisa
![][6]
Elisa is one of the most exciting additions to KDE Gear. For those who dont know about it yet, Elisa is a new music player based on [Kirigami][7]. The result of this is an app capable of running on both desktop and mobile.
With this release, the list of features offered by this application has grown quite a bit longer. Some of these new features include:
* Support for AAC audio files
* Support for .m3u8 playlists
* Reduced memory usage
As always, the inclusion of support for more formats is welcome. As the KDE release announcement says:
> But [the new features] dont mean Elisa has become clunkier. Quite the contrary: the new version released with KDE Gear today actually consumes less memory when you scroll around the app, making it snappy and a joy to use.
This app is becoming better with each release, and is becoming one of my favorite apps for Linux. At the rate it is improving, we can expect Elisa to become one of the best music players in existence.
#### Index
Index is the file manager for Plasma Mobile. Based on Kirigami technologies, it adapts to both mobile and desktop screens well.
Alongside this convergence advantage, it has almost reached feature-parity with Dolphin, making it a viable alternative on the desktop as well. Because it is constantly being updated with new features and is an evolving application, there isnt a set list of new features.
If you want to check out its latest version, feel free to [download it from the project website.][8]
### Other App Updates
![][5]
In addition to the above-mentioned app upgrades, you will also find significant improvements for **Okular**, **KMail**, and other KDE applications.
To learn more about the app updates, you can check out the [official announcement page][9].
### Wrapping Up
The new KDE Gear 21.04 release includes a wide range of new features and updates all the KDE apps. These promise better performance, usability, and compatibility.
I am really excited about Elisa and Index, especially as they make use of Kirigami.
_What do you think about_ _the latest KDE app updates? Let me know your thoughts down in the comments below!_
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
#### _Related_
* [Linux Release Roundup #21.17: Ubuntu 21.04, VirtualBox 6.1.20, Firefox 88, and More New Releases][10]
* ![][11] ![Linux Release Roundups][12]
* [KDE Plasma 5.21 Brings in a New Application Launcher, Wayland Support, and Other Exciting Additions][13]
* ![][11] ![][14]
* [SparkyLinux 2021.03 Release Introduces a KDE Plasma Edition, Xfce 4.16 Update, and More Upgrades][15]
* ![][11] ![][16]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/kde-gear-app-release/
作者:[Jacob Crume][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/jacob/
[b]: https://github.com/lujun9972
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzMxOCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[2]: https://kde.org/announcements/gear/21.04/
[3]: https://apps.kde.org/
[4]: https://news.itsfoss.com/kate/
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQzOScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzczMCcgd2lkdGg9JzYwMCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[7]: https://develop.kde.org/frameworks/kirigami//
[8]: https://download.kde.org/stable/maui/index/1.2.1/index-v1.2.1-amd64.AppImage
[9]: https://kde.org/announcements/releases/2020-04-apps-update/
[10]: https://news.itsfoss.com/linux-release-roundup-2021-17/
[11]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[12]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Linux-release-roundups.png?fit=800%2C450&ssl=1&resize=350%2C200
[13]: https://news.itsfoss.com/kde-plasma-5-21-release/
[14]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/02/kde-plasma-5-21-feat.png?fit=1200%2C675&ssl=1&resize=350%2C200
[15]: https://news.itsfoss.com/sparkylinux-2021-03-release/
[16]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/sparky-linux-feat.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,146 @@
[#]: subject: (Next Mainline Linux Kernel 5.12 Released with Essential Improvements)
[#]: via: (https://news.itsfoss.com/linux-kernel-5-12-release/)
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Next Mainline Linux Kernel 5.12 Released with Essential Improvements
======
[Linux Kernel 5.11][1] was an impressive release with the support for new hardware thats probably out-of-stock till the end of 2022.
Now, almost after 2 months of work and a week of delay for a release candidate version 8, Linux Kernel 5.12 is here.
The improvements span across many things that include processor support, laptop support, new hardware support, storage enhancements, and a few more essential driver additions.
Here, I will highlight the key changes with this release to give you an overview.
### Linux Kernel 5.12: Essential Improvements &amp; Additions
Linux Kernel 5.12 is a neat release with many essential additions. Also, it is worth noting that Linux [5.13 would be the first Linux Kernel to add initial support for Apple M1 devices][2] if you were expecting it here.
With the [release announcement][3], Linus Torvalds mentioned:
> Thanks to everybody who made last week very calm indeed, which just makes me feel much happier about the final 5.12 release.
>
> Both the shortlog and the diffstat are absolutely tiny, and its mainly just a random collection of small fixes in various areas: arm64 devicetree files, some x86 perf event fixes (and a couple of tooling ones), various minor driver fixes (amd and i915 gpu fixes stand out, but honestly, thats not because they are big, but because the rest is even smaller), a couple of small reverts, and a few locking fixes (one kvm serialization fix, one memory ordering fix for rwlocks).
Let us take a look at whats new overall.
#### Official PlayStation 5 Controller Driver
Sonys open-source driver for controllers were pushed back last cycle, but it has been included with Linux 5.12 Kernel.
Not just as a one-time open-source driver addition but Sony has committed to its maintenance as well.
So, if you were looking to use Sonys DualSense PlayStation 5 Controller, now would be a good time to test it out.
#### AMD FreeSync HDMI Support
While AMD has been keeping up with good improvements for its Linux graphics drivers, there was no [FreeSync][4] support over HDMI port.
With Linux Kernel 5.12, a patch has been merged to the driver that enables FreeSync support on HDMI ports.
#### Intel Adaptive-Sync for Xe Graphics
Intels 12th gen Xe Graphics is an exciting improvement for many users. Now, with Linux Kernel 5.12, adaptive sync support (variable refresh rate) will be added to connections over the Display Port.
Of course, considering that AMD has managed to add FreeSync support with HDMI, Intel would probably be working on the same for the next Linux Kernel release.
#### Nintendo 64 Support
Nintendo 64 is a popular but very [old home video game console][5]. For this reason, it might be totally dropped as an obsolete platform but it is good to see the added support (for those few users out there) in Linux Kernel 5.12.
#### OverDrive Overclocking for Radeon 4000 Series
Overlocking support for AMDs latest GPUs was not yet supporting using the command-line based OverDrive utility.
Even though OverDrive has been officially discontinued, there is no GUI-based utility by AMD for Linux. So, this should help meanwhile.
#### Open-Source Nvidia Driver Support for Ampere Cards
The open-source Nvidia [Nouveau][6] drivers introduces improved support for Ampere-based cards with Linux Kernel 5.12, which is a step-up from Linux Kernel 5.11 improvements.
With the upcoming Linux Kernel 5.13, you should start seeing 3D acceleration support as well.
#### Improvements to exFAT Filesystem
There have been significant optimizations for [exFAT Filesytem][7] that should allow you to delete big files much faster.
#### Intels Open-Source Driver to Display Laptop Hinge/Keyboard Angle
If you have a modern Intel laptop, you are in luck. Intel has contributed another open-source driver to help display the laptop hinge angle in reference to the ground.
Maybe you are someone whos writing a script to get something done in your Laptop when the hinge reaches a certain angle or who knows what else? Tinkerers would mostly benefit from this addition by harnessing the information they did not have.
### Other Improvements
In addition to the key additions I mentioned above, there are numerous other improvements that include:
* Improved battery reporting for Logitech peripherals
* Improved Microsoft Surface laptop support
* Snapdragon 888 support
* Getting rid of obsolete ARM platforms
* Networking improvements
* Security improvements
You might want to check out the [full changelog][8] to know all the technical details.
If you think Linux 5.12 could be a useful upgrade for you, Id suggest you to wait for your Linux distribution to push an update or make it available for you to select it as your Linux Kernel from the repository.
It is also directly available in [The Linux Kernel Archives][9] as a tarball if you want to compile it from source.
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
#### _Related_
* [Linux Release Roundup #21.14: AlmaLinux OS, Linux Lite 5.4, Ubuntu 21.04 and More New Releases][10]
* ![][11] ![Linux Release Roundups][12]
* [Linux Kernel 5.11 Released With Support for Wi-Fi 6E, RTX 'Ampere' GPUs, Intel Iris Xe and More][1]
* ![][11] ![][13]
* [Nitrux 1.3.8 Release Packs in KDE Plasma 5.21, Linux 5.11, and More Changes][14]
* ![][11] ![][15]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/linux-kernel-5-12-release/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://news.itsfoss.com/linux-kernel-5-11-release/
[2]: https://news.itsfoss.com/linux-kernel-5-13-apple-m1/
[3]: https://lore.kernel.org/lkml/CAHk-=wj3ANm8QrkC7GTAxQyXyurS0_yxMR3WwjhD9r7kTiOSTw@mail.gmail.com/
[4]: https://en.wikipedia.org/wiki/FreeSync
[5]: https://en.wikipedia.org/wiki/Nintendo_64
[6]: https://nouveau.freedesktop.org
[7]: https://en.wikipedia.org/wiki/ExFAT
[8]: https://cdn.kernel.org/pub/linux/kernel/v5.x/ChangeLog-5.12
[9]: https://www.kernel.org/
[10]: https://news.itsfoss.com/linux-release-roundup-2021-14/
[11]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[12]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Linux-release-roundups.png?fit=800%2C450&ssl=1&resize=350%2C200
[13]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/02/linux-kernel-5-11-release.png?fit=1200%2C675&ssl=1&resize=350%2C200
[14]: https://news.itsfoss.com/nitrux-1-3-8-release/
[15]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/nitrux-1-3-8.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,90 @@
[#]: subject: (CloudLinux Announces Commercial Support for its CentOS Alternative AlmaLinux OS)
[#]: via: (https://news.itsfoss.com/almalinux-commercial-support/)
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
CloudLinux Announces Commercial Support for its CentOS Alternative AlmaLinux OS
======
CentOS alternative [AlmaLinux][1] announced the availability of their [first stable release][2] a month back.
If you are planning to replace your CentOS deployments or have already started to utilize AlmaLinux OS, you will be happy to know that you are about to get commercial support and premium support soon.
CloudLinux, the sponsor of the project announced that it will start providing multiple support options next month.
### More About the Support Options
According to the press release, they aim to offer reasonable pricing for the support tiers:
> “Support services for AlmaLinux OS from CloudLinux provides both the highest quality support from the OS sponsor along with the benefits of an independent technology partnership,” said Jim Jackson, president and chief revenue officer, CloudLinux. “Reasonably priced and flexible support services keep systems running on AlmaLinux OS continuously updated and secure for production workloads.”
They also clarify that the support tiers will include update delivery commitments and 24/7 incident response services.
This means that you will be getting regular patches and updates for the Linux kernel and core packages, patch delivery service-level agreements (SLAs), and 24/7 incident support.
For any business or enterprise, this should be the perfect incentive to start replacing CentOS on their server if looking for a [CentOS alternative][3].
In addition to the plans for the next month, they also plan to offer a premium support option for enterprise use-cases and more:
> CloudLinux is also planning to introduce a premium support tier for enterprises that require enhanced services, as well as Product NodeOS Support for AlmaLinux OS, explicitly tailored to the needs of vendors and OEMs that are planning to use AlmaLinux as a node OS underlying their commercial products and services.
This is definitely exciting and should grab the attention of OEMs, and businesses looking for a CentOS alternative with a long-term support until 2029 at least.
They also added what the community manager of AlmaLinux OS thinks about it going forward:
> “Since launch, weve received tremendous interest and support from both the community as well as many commercial vendors, many of whom have begun using AlmaLinux OS for some pretty amazing use cases,” said Jack Aboutboul, community manager of AlmaLinux. “Our thriving community has supported each other since day one which led to rapid adoption amongst organizations and requests for commercial support.”
The support service options should start rolling out in **May 2021** (next month). If you want to know more about it before the release or how you can use it for your AlmaLinux OS deployments, fill up the form in the [official support page][4].
[Commercial Support for AlmaLinux OS][4]
_So, what do you think about AlmaLinux OS as a CentOS alternative now with the imminent availability of commercial support? Do you have big hopes for it? Feel free to share what you think!_
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
#### _Related_
* [Much-Anticipated CentOS Alternative 'AlmaLinux' Beta Released for Testing][5]
* ![][6] ![][7]
* [AlmaLinux OS First Stable Release is Here to Replace CentOS][2]
* ![][6] ![][8]
* [After Rocky Linux, We Have Another RHEL Fork in Works to Replace CentOS][9]
* ![][6] ![CloudLinux][10]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/almalinux-commercial-support/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://almalinux.org/
[2]: https://news.itsfoss.com/almalinux-first-stable-release/
[3]: https://itsfoss.com/rhel-based-server-distributions/
[4]: https://almalinux.org/support/
[5]: https://news.itsfoss.com/almalinux-beta-released/
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[7]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/02/almalinux-ft.jpg?fit=1200%2C675&ssl=1&resize=350%2C200
[8]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/almalinux-first-iso-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[9]: https://news.itsfoss.com/rhel-fork-by-cloudlinux/
[10]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Untitled-design-2.png?fit=800%2C450&ssl=1&resize=350%2C200

View File

@ -0,0 +1,118 @@
[#]: subject: (Fedora 34 Releases with GNOME 40, Linux Kernel 5.11, and a New i3 Spin)
[#]: via: (https://news.itsfoss.com/fedora-34-release/)
[#]: author: (Arish V https://news.itsfoss.com/author/arish/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Fedora 34 Releases with GNOME 40, Linux Kernel 5.11, and a New i3 Spin
======
After the release of the [Fedora 34 beta][1] a week ago, Fedora 34 stable release is finally here with exciting changes and improvements.
As expected this release of Fedora arrives with the latest Linux kernel 5.11 along with significant changes such as [Gnome 40][2], [PipeWire][3], availability of a [Fedora i3 Spin][4], and various other changes.
Lets take a look at the important changes coming to Fedora 34.
### Major Highlights of Fedora 34 Release
Here is an overview of the major changes in this release of Fedora.
#### Desktop Environment Updates
![][5]
One of the biggest highlights is the arrival of the [GNOME 40][2] desktop. Fedora 34 is one of the few distributions in which you can experience the latest Gnome 40 right now. So, this change is worth noting.
Taking a look at KDE Plasma, Wayland becomes the default display server for KDE Plasma in Fedora 34. Moreover, KDE Plasma Desktop image is available for AArch64 ARM devices as well.
Coming to other Desktop Environments, the latest Xfce 4.16 is available with this release of Fedora and LXQT also receives an update to the latest version LXQT 0.16.
#### PipeWire to Replace PulseAudio
A noteworthy change happening with this release of Fedora is the replacement of PulseAudio by PipeWire. It replaces PulseAudio and JACK by providing a PulseAudio-compatible server implementation and ABI-compatible libraries for JACK clients.
![][6]
Besides, with this release, theres also a Fedora i3 Spin that provides the popular i3 tiling window manager and offers a complete experience with a minimalist user interface.
####  Zstd Compression by Default
BTRSF file system was made default with Fedora 34, with this release zstd algorithm is made default for transparent compression when using BTRSF. The developers hope that this would increase the life span of flash-based media by reducing write amplification.
#### Other Changes
Some of the other changes include package the following package updates.
* Binutils 2.53
* Golang 1.16
* Ruby 3.0
* BIND 9.16
*  MariaDB 10.5
* Ruby on Rails 6.1
* Stratis 2.3.0
Other changes include replacement of The ntp package with ntpsec. Also, the collection packages xorg-x11 are revoked, and the individual utilities within them will be packaged separately.
If you want to see the entire list of changes in Fedora 34, please take a look at the [official announcement post][7] and the [changeset][8] for more technical details.
### Wrapping up
Most of the above changes in Fedora 34 were expected changes, and fortunately nothing went south after the beta release last week. Above all Fedora 34 in powered by the latest Linux kernel 5.11, and you can experience the latest GNOME desktop as well.
_So, what do you think about these exciting additions to Fedora 34? Let me know in the comments below._
 
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
#### _Related_
* [Fedora 34 Beta Arrives With Awesome GNOME 40 (Unlike Ubuntu 21.04)][1]
* ![][9] ![][10]
* [Linux Release Roundup #21.13: GNOME 40, Manjaro 21.0, Fedora 34 and More New Releases][11]
* ![][9] ![Linux Release Roundups][12]
* [Manjaro 21.0 Ornara Comes Packed With GNOME 3.38, KDE Plasma 5.21, Xfce 4.16 and Linux Kernel 5.10][13]
* ![][9] ![][14]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/fedora-34-release/
作者:[Arish V][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/arish/
[b]: https://github.com/lujun9972
[1]: https://news.itsfoss.com/fedora-34-beta-release/
[2]: https://news.itsfoss.com/gnome-40-release/
[3]: https://pipewire.org/
[4]: https://spins.fedoraproject.org/i3/
[5]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzQ2OCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[6]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzUzNicgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[7]: https://fedoramagazine.org/announcing-fedora-34/
[8]: https://fedoraproject.org/wiki/Releases/34/ChangeSet#i3_Spin
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[10]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/fedora-34-beta-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[11]: https://news.itsfoss.com/linux-release-roundup-2021-13/
[12]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/Linux-release-roundups.png?fit=800%2C450&ssl=1&resize=350%2C200
[13]: https://news.itsfoss.com/manjaro-21-0-ornara-release/
[14]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/manjaro-21.png?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -1,69 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Open Source Supply Chain: A Matter of Trust)
[#]: via: (https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/)
[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/)
Open Source Supply Chain: A Matter of Trust
======
[![][1]][2]
_**Co-authored by Curtis Franklin, Jr**_
Open source software is often considered safer and more secure than proprietary software because users can, if they want, compile the software from the source code. They know the source of the code running in their environment.  Every component that they are running in their environment can be audited and the developer held accountable.  
However, users and vendors are moving away from complexity that comes with total control and embracing convenience and ease of use.
“I am often taken aback when I see a talk around security and privacy and then the presenter runs the docker run command to install and run some random binary downloaded from the internet,” said [Dirk Hohndel, Vice-President and Chief Open Source Officer at VMware.][3] “Those two things seem to be a little bit at odds with each other.”
The software supply chain — the process that takes an application from coding through packaging and distribution to its ultimate user — is complicated. If done wrong, it could be potentially risky, especially for open source software.  A malevolent player can get access to the backend and start inserting any random binary code onto a users system without that users knowledge or control.
Its not a problem specific to the cloud-native world. It can be seen in modern app development environments, including JavaScript, npm, PyPI, RubyGems, and so on.  Even Homebrew on Mac used to be provided through source code that a user would compile themselves. 
“Today, you just download the binary and install it, hoping that its built from the same source code that you have access to,” said Hohndel. “As an industry, we need to pay more attention to our supply chain.  Its something that is extremely important to me and that Im trying to get more people interested in it.” 
Its not simply a binary versus source code equation, though. There are huge advantages to just running a binary instead of having to build everything from sources.   It allows developers to be more flexible and more responsive in their turnaround. They can cycle very quickly through new development and product releases by reusing some binaries.
“It would be nice if there was a way to sign these binaries and have an on-the-fly verification mechanism so users know they can trust these,” said Hohndel.
Linux distributions have solved this problem as the distributions act as gatekeepers who check the integrity of packages that go into supported repositories. 
“Packages offered through distributions like Debian are signed with a key. It takes a lot of work to ensure that this is really the software that should be in the distribution. They have solved the supply chain problem,” said Hohndel.
But even on Linux distribution, people want to simplify things and trade correctness and security for speed. There are now projects like AppImage, Snap and Flatpack that have adopted the binary route, bringing the trust issue to Linux distributions. Its the same problem of docker containers all over again.
“The ideal solution would be to find a way for us as a community to devise a system of trust which ensures that if a binary was signed with a key that is in the network of trust, it can be trusted and provides us with the ability to reliably go back to the sources and do an audit,” suggested Hohndel.
However, all this additional steps incur costs that most projects are either unwilling or unable to afford. Some projects are trying to find ways around the problem. NPM, for example, has begun to encourage those submitting packages to properly authenticate and secure their accounts to improve trustworthiness on the platform. 
**Open Source Community Is Good At Solving Problems**
Hohndel is involved with many efforts to solve the open source supply chain problem and is spreading awareness about it. Last year, [VMware acquired Bitnami,][4] which is a great place for curating open source applications that are signed by VMware. 
“We are talking with upstream open source communities in various ecosystems to raise awareness about it. We are also discussing technical solutions that will make it easier for these communities to solve the underlying problems,” said Hohndel.
The open source community has historically been diligent at ensuring software quality, including the mechanisms for security and privacy. Still, Hohndel says, “The biggest concern that I have is that, in the excitement about the next new thing, we often ignore the underlying engineering discipline that we really need.”
Ultimately, Hohndel feels that answer will come from the open source community itself. “Open source is an engineering methodology and its a social experiment. Open source is all about people trusting each other, working with each other, collaborating across borders, between companies, amongst competitors in ways that we didnt do before,” he explains.
--------------------------------------------------------------------------------
via: https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/
作者:[Swapnil Bhartiya][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/author/swapnil/
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920-1068x801.jpg (hand-1137978_1920)
[2]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920.jpg
[3]: https://www.swapnilbhartiya.com/open-source-leaders-dirk-hohndel-brings-open-source-to-vmware/
[4]: https://techcrunch.com/2019/05/15/vmware-acquires-bitnami-to-deliver-packaged-applications-anywhere/

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (max27149)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
@ -85,7 +85,7 @@ via: https://opensource.com/article/21/2/advice-non-technical
作者:[Dawn Parzych][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
译者:[max27149](https://github.com/max27149)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,93 @@
[#]: subject: (What motivates open source software contributors?)
[#]: via: (https://opensource.com/article/21/4/motivates-open-source-contributors)
[#]: author: (Igor Steinmacher https://opensource.com/users/igorsteinmacher)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
What motivates open source software contributors?
======
New study finds people's reasons for contributing have changed since the
early 2000s.
![Practicing empathy][1]
The reasons people contribute to free and open source (FOSS) projects has been a topic of much interest. However, the research on this topic dates back 10 or more years, and much has changed in the world since then. This article shares seven insights from a recent research study that revisited old motivation studies and asked open source contributors what motivates them today.
These insights can be used by open source community managers who want to grow a community, organizations that want to understand how community members behave, or anyone working with others in open source. Understanding what motivates today's contributors helps us make impactful decisions.
### A brief history of open source motivation research
We need to look into the origins of open source and the free software movement to understand why studying what motivates contributors is so fascinating. When the free software movement started, it was in defiance of corporations using copyright and license terms to restrict user and developer freedoms. The free software movement is a story of rebellion. It was difficult for many to understand how high-quality software emerged from a movement of people who "scratched their own itch" or "volunteered" their skills. At the core of the free software movement was a collaborative way for creating software that became interesting to companies as well. The emergence of open source was a philosophical shift to make this collaboration method available and acceptable to businesses.
The state of the art of research into motivation in open source is a [publication from 2012][2] that summarizes research studies from more than a decade prior. Gordon Haff reviewed this topic in [_Why do we contribute to open source software?_][3] and Ruth Suehle in _[Drive and motivation: Daniel Pink webcast recap][4]_.
Over the last 10 years, much has changed in open source. With corporations' increasing interest in open source and having paid employees working on open source projects, it was high time to revisit motivation in open source.
### Contributors' changing motivations
In our scientific study, _[The shifting sands of motivation: Revisiting what drives contributors in open source][5]_, we investigated why people join FOSS projects and why they continue contributing. One of our goals was to study how contributors' motivations have changed since the 2000s. A second goal was to take the research to the next level and investigate how people's motivations change as they continue contributing. The research is based on a questionnaire answered by almost 300 FOSS contributors in late 2020.
### Seven key findings
Some of the study's results include:
1. **Intrinsic motivations play a key role.** The large majority of people contribute to FOSS because of fun (91%), altruism (85%), and kinship (80%). Moreover, when analyzing differences in motivations to join and continue, the study found that ideology, own-use, or education-related programs can be an impetus to join FOSS, but individuals continue for intrinsic reasons (fun, altruism, reputation, and kinship).
2. **Reputation and career motivate more than payment**. Many contributors seek reputation (68%) and career (67%), while payment was referenced by less than 30% of the participants. Compared to earlier studies, reputation is now considered more important.
3. **Social aspects have gained considerable importance since the 2000s.** Enjoying helping others (89%) and kinship (80%) rose in the rankings compared to surveys from the early 2000s.
4. **Motivation changes as people gain tenure.** A clear outcome of the paper is that current contributors often have a different motivation from what led them to join. Of the 281 respondents, 155 (55%) did not report the same motivation for joining and continuing to contribute.
The figure below shows individuals' shifts in motivation from when they joined to what leads them to keep contributing. The size of the boxes on the left represents the number of contributors with that motivation to start contributing to FOSS, and on the right, the motivation to continue contributing. The width of the connections is proportional to the number of contributors who shifted from one motivation to the other. 
![Motivations for contributing to FOSS][6]
(Source: [Gerosa, et al.][7])
5. **Scratching one's own itch is a doorway.** Own-use ("scratch own itch") has decreased in importance since the early days. The contributors who joined FOSS for own-use-related reasons often shifted to altruism, learning, fun, and reciprocity. You can see this in the figure above.
6. **Experience and age explain different motivations**. Experienced developers have higher rates of reporting altruism (5.6x), pay (5.2x), and ideology (4.6x) than novices, who report career (10x), learning (5.5x), and fun (2.5x) as greater motivations to contribute. Looking at individual shifts in motivation, there was a considerable increase (120%) in altruism for experienced respondents and a slight decrease (-16%) for novices. A few young respondents joined FOSS because of career, but many of them shifted towards altruism (100% increase).
7. **Coders and non-coders report different motivations.** The odds of a coder reporting fun is 4x higher than non-coders, who are more likely (2.5x) to report ideology as a motivator.
### Motivating contributors based on their contributor journey
Knowing how new and long-time contributors differ in motivation helps us discover how to support them better. 
For example, to attract and retain new contributors, who might become the future workforce, projects could invest in promoting career, fun, kinship, and learning, which are particularly relevant for young contributors.
Because over time altruism becomes more important to contributors, FOSS projects aiming to retain experienced contributors, who tend to be core members or maintainers, could invest in strategies and tools showing how their work benefits the community and society (altruism) and improve social interactions.
Also in response to the increased rank of altruism, hosting platforms could offer social features to pair those needing help with those willing to help, highlight when a contributor helps someone, and make it easier to show appreciation to others (similar to stars given to projects).
These are some of our ideas after reviewing the study's findings. We hope that sharing our insights helps others with different backgrounds and experiences come up with more ideas for using this data to motivate new and seasoned contributors. Please share your ideas in the comments below.
The research paper's authors are Marco A. Gerosa (Northern Arizona University), Igor Wiese (Universidade Tecnologica Federal do Paraná), Bianca Trinkenreich (Northern Arizona University), Georg Link (Bitergia), Gregorio Robles (Universidad Rey Juan Carlos), Christoph Treude (University of Adelaide), Igor Steinmacher (Universidade Tecnologica Federal do Paraná), and Anita Sarma (Oregon State University). The full [study report][7] is available, as well as the [anonymized data and artifacts][8] related to the research.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/motivates-open-source-contributors
作者:[Igor Steinmacher][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/igorsteinmacher
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/practicing-empathy.jpg?itok=-A7fj6NF (Practicing empathy)
[2]: https://www.semanticscholar.org/paper/Carrots-and-Rainbows%3A-Motivation-and-Social-in-Open-Krogh-Haefliger/52ec46a827ba5d6aeb38aaeb24b0780189c16856?p2df
[3]: https://opensource.com/article/19/11/why-contribute-open-source-software
[4]: https://opensource.com/business/11/6/today-drive-webcast-daniel-pink
[5]: https://arxiv.org/abs/2101.10291
[6]: https://opensource.com/sites/default/files/pictures/sankey_motivations.png (Motivations for contributing to FOSS)
[7]: https://arxiv.org/pdf/2101.10291.pdf
[8]: https://zenodo.org/record/4453904#.YFtFRa9KhaR

View File

@ -0,0 +1,98 @@
[#]: subject: (Microsoft Gets into the OpenJDK Business: What Does it Mean for You?)
[#]: via: (https://news.itsfoss.com/microsoft-openjdk/)
[#]: author: (John Paul Wohlscheid https://news.itsfoss.com/author/john/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Microsoft Gets into the OpenJDK Business: What Does it Mean for You?
======
Microsoft is getting into the Java business. The question is “What does this mean for the Open-Source community?” Has Microsoft learned anything from their past interactions with Java? Lets see.
### Introducing Microsoft Builds of OpenJDK
Microsoft recently announced that they would be releasing builds of OpenJDK. According to [the announcement][1], these builds will be Long-Term Support (LTS).
The builds will include Java 11 (based on OpenJDK 11.0.10+9) for “macOS, Linux, and Windows”. They will be available for both servers and desktop systems. They are also introducing Early Access builds of Java 16 for Windows on ARM (based on OpenJDK 16+36). “The Microsoft Build of OpenJDK is a simple drop-in replacement for any other OpenJDK distribution available in the Java ecosystem.”
All of the binaries available are considered “Preview”. The announcement mentions that Java 11 was released in 2018. So what call it a “Preview”? Because Microsoft wants feedback from customers on “things like the packaging and installation experience” before they make them production ready.
Since they are consider Long-Term Support, Java 11 will be supported until 2024. OpenJDK 17 will be made available when Java 17 “is finalized”. Microsoft will not be offering support for Java 8.
For those interested in the recipes Microsoft is using to bake its Java cake, they are using the “same build scripts used by the Eclipse Adoptium project and tested against the Eclipse Adoptium Quality Assurance suite (including OpenJDK project tests)”.
The binaries are licensed as “General Public License 2.0 with Classpath Exception (GPLv2+CE)”.
### Not Microsofts First Java Rodeo
![][2]
Whats interesting is that this is not the first time that Microsoft got involved with Java. Back in 1996, Microsoft introduced the imaginatively named [J++][3]. Initially, J++ got a lot of [good press][4].
However, the honeymoon didnt last. [In 2007][5], Sun Microsystems sued Microsoft. They said that Microsoft “breached its licensing agreement by adding extensions that werent Java-compatible”. The suit was settled in 2001. “Microsoft was required to pay Sun $20 million, as well as to permanently stop using “Java-compatible” trademarks.” J++ supported ended in 2004.
This was just one of [many times][6] that Microsoft enacted their [Embrace, Extent, Extinguish mantra][7]. This time it was Microsoft plans that were extinguished.
Sometimes, its hard to equate all of the underhanded tactics that Microsoft committed under Bill Gates and his philanthropy.
### So What Does This All Mean?
The burning question is why is Microsoft even bothering to create these binaries in the first place? There are at least half of a dozen organizations that offer OpenJDK binaries, including IBM, Amazon, and Eclipse.
[Mike and Chris from Coder Radio][8] has repeatedly mentioned that Microsoft is transforming itself into a company that creates tools for programmers. They dont care what platform programmers use, just that they use Microsoft tools. (In the OpenJDK announcement, Microsoft listed the available platforms as “macOS, Linux, and Windows”.) This newest announcement is the latest step in the transformation.
What does it mean for open source? If Microsoft leaves the OpenJDK binaries unchanged, probably not much. At most, they will make the binaries work better on Windows and with Visual Studio Code. However, the big concern would be if they start changing the code.
My advice: Keep your eggs out of Microsofts basket, so you dont get locked into their tooling. At least, until they have proven that they are not evil. After all, there are plenty of alternative already.
![][9]
I'm not interested
#### _Related_
* [Microsoft Makes 'Extensible Storage Engine' Open-Source, Used by Windows 10 &amp; Microsoft Exchange][10]
* ![][11] ![][12]
* [Is Google Locking Down Chrome to Resist the Rise of Chromium Based Browsers?][13]
* ![][11] ![Google Chrome][14]
* [Good News! elementary OS is Coming to Raspberry Pi 4][15]
* ![][11] ![elementary OS Raspberry Pi Build][16]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/microsoft-openjdk/
作者:[John Paul Wohlscheid][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/john/
[b]: https://github.com/lujun9972
[1]: https://devblogs.microsoft.com/java/announcing-preview-of-microsoft-build-of-openjdk/
[2]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzM3NScgd2lkdGg9JzI5NScgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[3]: https://en.wikipedia.org/wiki/Visual_J%2B%2B
[4]: https://www.drdobbs.com/microsofts-visual-j-10/184415556
[5]: https://www.informit.com/articles/article.aspx?p=101152
[6]: https://birdhouse.org/beos/byte/30-bootloader/
[7]: https://en.wikipedia.org/wiki/Embrace,_extend,_and_extinguish
[8]: https://coder.show/
[9]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[10]: https://news.itsfoss.com/microsoft-ese-open-source/
[11]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[12]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/02/ese-microsoft.jpg?fit=1200%2C675&ssl=1&resize=350%2C200
[13]: https://news.itsfoss.com/is-google-locking-down-chrome/
[14]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/02/google-chrome.jpg?fit=1200%2C675&ssl=1&resize=350%2C200
[15]: https://news.itsfoss.com/elementary-os-raspberry-pi-release/
[16]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2020/12/elementaryos-raspberry-pi-build.jpg?fit=800%2C450&ssl=1&resize=350%2C200

View File

@ -0,0 +1,179 @@
[#]: subject: (F(r)iction: Or How I Learnt to Stop Worrying and Start Loving Vim)
[#]: via: (https://news.itsfoss.com/how-i-started-loving-vim/)
[#]: author: (Theena https://news.itsfoss.com/author/theena/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
F(r)iction: Or How I Learnt to Stop Worrying and Start Loving Vim
======
It is Dec 2009, and I am ready to quit my job.
I wanted to focus on writing my first book; neither my commitments at work nor the state of technology was helping.
Writing is hard work.
Few tasks in the modern world can be as singular or as daunting a pursuit as sitting down in front of a blank piece of paper, and asking your brain to vomit out words that communicate an idea to readers. I am not suggesting that writing cant be collaborative of course, but merely illustrating how daunting it can be for writers to set off on a new piece by themselves. This is true for fiction
and non-fiction writing, but since I am a novelist Id like to focus primarily on fiction in this article.
![][1]
Remember what 2009 was like?
Smart phones were 3 years old I still hadnt gone away from feature phones. Laptops were big and bulky. Meanwhile, cloud-based web applications for productivity was in their infancy, and just not good. Technologically speaking, writers like me were using their Gmail accounts (and a very young cloud-based storage called Dropbox) as an always-available option to work on their drafts, even while away from my personal computer. While this was a nice change from what writers had to go through when working with typewriters (or god forbid, pen and paper), it wasnt much.
For one thing, version control of manuscripts was a nightmare. Further, the more tools I added to my tool kit to simplify the workflow, the more I had to switch context both from a UI and a UX sense.
I would start writing drafts on Windows Notepad, save it on a MS Word Document on my PC at home, email myself a copy, keep another copy on Dropbox (since Dropbox wasnt accessible at work), work on the copy of that file at work, email it back to myself at the end of the day, download it on the home computer, saving it under a new name and the respective date so that I would recognize the changes in the file were made at work (as opposed to home)…well you get the picture. If you think this workflow involving Windows Notepad, MS Word, Gmail, and Dropbox is insane, well now you know why I quit my job.
More soberingly, I still know writers, damn good writers too, who use variations of the workflow that I followed in 2009.
Over the next three years, I worked on the manuscript, completing the first draft in 2012. During the three years much had changed with the state of technology. Smart phones were actually pretty great, and some of the complications I had in 2009 had disappeared. I could still work on the same file that I had been working from at home, on my phone (not necessarily fresh writing, but editing had become considerably easier thanks to Dropbox on the phone.) My main writing tool remained Microsofts Windows Notepad and Word, which is how I completed the first draft.
The novel [**First Utterance**][2] was released in 2016 to critical and commercial acclaim.
The end.
Or so I thought.
As soon as I completed the manuscript and sent it to my editor, I had begun working on the second novel. I was no longer quitting my job to work on writing, but I had taken a more pragmatic approach: Id take two weeks off at the end of ever year so that I could go to a little cabin in the mountains to write.
It took me half a day to realize that the things that annoyed me about my [writing tools][3] and workflow had not disappeared, but morphed into a more complex beast. As a writer, I wasnt being productive or as efficient as I wanted.
### Linux in the time of Corona
![][4]
It is 2020 and the world is on the verge of mass hysteria.
What had started out as an isolated novel virus in China was morphing into the first global pandemic since 1911. On March 20th, Sri Lanka followed most of the rest of the world and shutdown.
April in Sri Lanka is the height of the dry season. Temperatures in concrete jungles like Colombo can reach the mid 30s, with humidity in the high 90s. It can drive most people to distraction at the best of times, but stuck at home with no always-on air conditioning while a global pandemic is underway? That is a good recipe for madness.
My madness was Linux or, as we in the open source community call it, distro-hopping.
The more I played around with *nix distros, the more enamoured I came to be with the idea of control. When nothing seems to be within our control not even the simple act of shaking hands with another person then it is only natural we lean towards things where we feel more in control.
Where better to get more control in my life than with my computing? Naturally, this extended to my writing tools and workflow too.
### The path to Vim
Theres a joke about [Vim][5] that describes perfectly my first experience with it. People are obsessive about Vim because they dont know how to close it.
I was attempting to edit a configuration file, and the [fresh install of Ubuntu Server][6] had only Vim pre-installed. First there was panic so much so I restarted the machine thinking the OS wasnt picking up my keyboard. Then when it happened again, the inevitable Google search: [How do I close vim?][7]
_Oh. Thats interesting_, I thought.
_But why?_
To understand why I was even remotely interested in a text editor that was too complex to close, you have to understand how much I adore Windows Notepad.
As a writer, I loved writing on its no-nonsense, no buttons, white-abyss like canvas. It had no spell check. It had no formatting. But I didnt care.
For the writer in me, Notepad was the best writing scratch pad ever devised. Unfortunately, it isnt powerful so even if I start writing my drafts in Notepad, I would move it to MS Word once I had passed a 1000 words Notepad wasnt built for prose, and those limitations would be glaringly obvious when I passed that word limit.
So the first thing I installed I moved all my computing away from Windows, was a good text editor.
[Kate][8] was the first replacement where I felt more comfortable than I did on Windows Notepad it was more powerful (it had spell-checker!), and hey, I could mess around with some hobbyist-type coding in the same environment.
It was love.
But then Vim happened.
The more I learnt about Vim, the more I watched developers live coding on Vim, the more I found myself opening Vim for my text editing needs. I use the phrase text editing in the traditional Unix sense: editing blocks of text in configuration files, or sometimes writing basic Bash scripts.
I still hadnt used Vim remotely for my prose writing needs.
For that I had LibreOffice.
Sort of.
While it is an adequate [replacement for MS Office][9], I found myself underwhelmed. The UI is perhaps even more distracting than MS Word, and with each distro having different packages of LibreOffice, I found myself using a hellishly fragmented tool kit and workflow, to say nothing about how different the UI can look in various distros and desktop environments.
Things had become even more complicated because I had also started my Masters. In this scenario, I was taking notes down on Kate, transferring them to LibreOffice, and then saving it on to my Dropbox.
Context switching was staring at me in the face every day.
Productivity dropped as I had to open and close a number of unrelated applications. I needed one writing tool to meet all my needs as a novelist, as a student, and as a hobbyist coder.
And thats when I realized that the solution to my context switching nightmare was also staring at me in the face at the same time.
By this point, I had used Vim often enough even used it with Termux on my Android phone to be pretty comfortable with the idea of moving everything to Vim. Since it supported markdown syntax, note-taking would also become even easier.
This was just about two months ago.
How am I doing?
It is April 2021.
I started this draft on my phone, [using Vim][10] via Termux (with the aid of a Bluetooth keyboard), while in a taxi. I pushed the file to a GitHub private repo for my writing, from which I pulled the file to my PC, wrote a few more lines, before heading out again. I pulled the new version of the file from GitHub to my phone, made changes, pushed it, repeat, until I emailed the final draft to the editor.
The context switching is now no more.
The distractions that come from writing in word processors is no more.
Editing is infinitely easier, and faster.
My wrists are no longer in pain because I hid my mouse from sight.
It is April 2021.
I am a novelist.
And I write on Vim.
How? Ill discuss the specific of this workflow in the second part of this column series on how non-tech people are using free and open source technology. Stay tuned.
![][11]
I'm not interested
#### _Related_
* [Going Against Google Analytics With Plausible's Co-Founder [Interview]][12]
* ![][13] ![Interview with Plausible founder Marco Saric][14]
* [The Progress Linux has Made in Terms of Gaming is Simply Incredible: Lutris Creator][15]
* ![][13] ![][16]
* [Multi Monitor and HiDPI Setup is Looking Better on Ubuntu 21.04 [My Experience So Far]][17]
* ![][13] ![Multimonitor setup with Ubuntu 21.04][18]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/how-i-started-loving-vim/
作者:[Theena][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/theena/
[b]: https://github.com/lujun9972
[1]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzM5MCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[2]: https://www.goodreads.com/book/show/29616237-first-utterance
[3]: https://itsfoss.com/open-source-tools-writers/
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzM5NScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[5]: https://www.vim.org/
[6]: https://itsfoss.com/install-ubuntu-server-raspberry-pi/
[7]: https://itsfoss.com/how-to-exit-vim/
[8]: https://kate-editor.org/
[9]: https://itsfoss.com/best-free-open-source-alternatives-microsoft-office/
[10]: https://linuxhandbook.com/basic-vim-commands/
[11]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzI1MCcgd2lkdGg9Jzc1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[12]: https://news.itsfoss.com/marko-saric-plausible/
[13]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[14]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/04/Interview-plausible.jpg?fit=1200%2C675&ssl=1&resize=350%2C200
[15]: https://news.itsfoss.com/lutris-creator-interview/
[16]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/lutris-interview-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[17]: https://news.itsfoss.com/ubuntu-21-04-multi-monitor-support/
[18]: https://i1.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/multi-monitor-ubuntu-21-itsfoss.jpg?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -0,0 +1,116 @@
[#]: subject: (13 ways to get involved with your favorite open source project)
[#]: via: (https://opensource.com/article/21/4/open-source-project-level)
[#]: author: (Mike Bursell https://opensource.com/users/mikecamel)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
13 ways to get involved with your favorite open source project
======
Apply GET/SET principles to connecting with open source projects.
![Looking at a map for career journey][1]
Many of my [blog][2]'s readers already know lots about open source, but I'm also aware that many know little, if anything, about it. I'm a big, big proponent of open source software (and beyond, such as open hardware), and there are lots of great resources you can find to learn more about it.
One very good starting point is the one you're now reading, Opensource.com. It's run by a bunch of brilliant people for the broader community by my current employer, Red Hat. (I should add a disclaimer that I'm not only employed by Red Hat but also a [Correspondent][3] at Opensource.com—a kind of frequent contributor/Elder Thing.) It has articles on pretty much every aspect of open source that you can imagine.
I was thinking about APIs today (they're [in the news][4] as I'm writing this, after a US Supreme Court judgment on an argument between Google and Oracle), and it occurred to me that if I were interested in understanding how to interact with open source at the project level but didn't know much about it, then a quick guide might be useful. The same goes if I were involved in an open source project (e.g., [Enarx][5]) interested in attracting contributors (particularly techie contributors) who aren't already knowledgeable about open source.
Given that most programmers will understand what GET and SET methods do (one reads data, the other writes data), I thought this might be a useful framework for considering engagement.[1][6] I'll start with GET, as that's how you're likely to be starting off—finding out more about the project—and then move to SET methods for getting involved with an open source project.
This is far from an exhaustive list, but I hope that I've hit most of the key ways you're most likely to start getting involved or encouraging others to get involved. The order I've chosen reflects what I suspect is a fairly typical approach to finding out more about a project, particularly for those who aren't open source savvy already but, as they say, YMMV.[3][7]
I've managed to stop myself from using Enarx (which I co-founded) as the sole source of examples and have tried to find a variety of projects to give you a taster. Disclaimer: their inclusion here does not mean that I am a user or contributor to the project, nor is it any guarantee of their open source credentials, code quality, up to date-ness, project maturity, or community health.[4][8]
### GET methods
* **Landing page:** The first encounter you have with a project will probably be its landing page. Some projects go for something basic, others apply more design, but you should be able to use this as the starting point for your adventures around the project. You'd generally hope to find links to various of the other resources listed below from the landing page.
* See [Sigstore][9]'s landing page.
* **Wiki:** In many cases, the project will have a wiki. This could be simple, or it could be complex. It may allow editing by anyone or only by a select band of contributors to the project, and its relevance as a source of truth may be impacted by how up to date it is. Still, the wiki is usually an excellent place to start.
* See the [Fedora Project][10] wiki.
* **Videos:** Some projects maintain a set of videos about their project. These may include introductions to the concepts, talking-head interviews with team members, conference sessions, demos, how-tos, and more. It's also worth looking for videos put up by contributors to the project but not necessarily officially owned by the project.
* See [Rust Language][11] videos.
* **Code of conduct:** Many projects insist that their project members follow a code of conduct to reduce harassment, reduce friction, and generally make the project a friendly, more inclusive, and more diverse place to be.
* See the [Linux kernel][12]'s CoC.
* **Binary downloads:** As projects get more mature, they may choose to provide precompiled binary downloads for users. More technically inclined users may choose to compile their own binaries from the codebase (see below), but binary downloads can be a quick way to try out a project and see whether it does what you want.
* See the binaries from [Chocolate Doom][13] (a Doom port).
* **Design documentation:** Without design documentation, it can be very difficult to get really into a project. (I've written about the [importance of architecture diagrams][14] before.) This documentation is likely to include everything from an API definition to complex use cases and threat models.
* See [Kubernetes][15]' design docs.
* **Codebase:** You've found out all you need to get going: It's time to look at the code! This may vary from a few lines to many thousands, include documentation in comments, or include test cases, but if the code is not there, then the project can't legitimately call itself open source.
* See [Rocket Rust web framework][16]'s code.[5][17]
* **Email/chat:** Most projects like to have a way for contributors to discuss matters asynchronously. The preferred medium varies among projects, but most will choose an email list, a chat server, or both. These are where to get to know other users and contributors, ask questions, celebrate successful compiles, and just hang out.
* See [Enarx chat][18].
* **Meetups, videoconferences, calls, etc.:** Although in-person meetings are tricky for many at the moment (I'm writing as COVID-19 still reduces travel opportunities), having ways for community members and contributors to get together synchronously can be really helpful for everybody. Sometimes these are scheduled on a daily, weekly, or monthly basis; sometimes, they coincide with other, larger meetups, sometimes a project gets big enough to have its own meetups; sometimes, it's so big that there are meetups of subprojects or internal interest groups.
* See the [Linux Security Summit Europe][19].
### PUT methods
* **Bug reports:** The first time many of us contribute anything substantive back to an open source project is when we file a bug report. Bug reports from new users can be really helpful for projects, as they not only expose bugs that may not already be known to the project, but they also give clues as to how actual users of the project are trying to use the code. If the project already publishes binary downloads (see above), you don't even need to compile the code to try it and submit a bug report. But bug reports related to compilation and build can also be extremely useful to the project. Sometimes, the mechanism for bug reporting also provides a way to ask more general questions about the project or to ask for new features.
* See the issues page for [exa][20] (a replacement for the _ls_ command).
* **Tests:** Once you've started using the project, another way to get involved (particularly once you start contributing code) can be to design and submit tests for how the project _ought_ to work. This can be a great way to unearth both your assumptions (and lack of knowledge!) about the project and the project's design assumptions (some of which may well be flawed). Tests are often part of the code repository, but not always.
* See [GNOME Shell][21]'s test repository.
* **Wiki:** A wiki can be a great way to contribute to the project, whether you're coding or not. Many projects don't have as much information available as they should, and that information may not be aimed at people coming to the project "fresh." If this is what you've done, then you're in a great position to write material that will help other "newbs" get into the project faster, as you'll know what would have helped you if it had been there.
* See the wiki for [Wine][22] (Windows Emulator for Linux).
* **Code:** Last but not least, you can write code. You may take hours, months, or years to get to this stage—or you may never reach it—but open source software is nothing without its code. If you've paid enough attention to the other steps, gotten involved in the community, understood what the project aims to do, and have the technical expertise (which you may well develop as you go!), then writing code may be the way you want to contribute.
* See [Enarx][23] (again).
* * *
1. I did consider standard RESTful verbs—GET, PUT, POST, and DELETE—but that felt rather contrived.[2][24]
2. And I don't like the idea of DELETE in this context!
3. "Your Mileage May Vary," meaning, basically, that your experience may be different, and that's to be expected.
4. That said, I do use lots of them!
5. I included this one because I've spent _far_ too much of my time looking at this over the past few months…
* * *
_This article was originally published on [Alice, Eve, and Bob][25] and is reprinted with the author's permission._
Six non-code opportunities for contributing to open source software code and communities.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/open-source-project-level
作者:[Mike Bursell][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mikecamel
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/career_journey_road_gps_path_map_520.png?itok=PpL6jJgY (Looking at a map for career journey)
[2]: https://aliceevebob.com/
[3]: https://opensource.com/correspondent-program
[4]: https://www.eff.org/deeplinks/2021/04/victory-fair-use-supreme-court-reverses-federal-circuit-oracle-v-google
[5]: https://enarx.dev/
[6]: tmp.WF7h0s934j#1
[7]: tmp.WF7h0s934j#3
[8]: tmp.WF7h0s934j#4
[9]: https://sigstore.dev/
[10]: https://fedoraproject.org/wiki/Fedora_Project_Wiki
[11]: https://www.youtube.com/channel/UCaYhcUwRBNscFNUKTjgPFiA
[12]: https://www.kernel.org/doc/html/latest/process/code-of-conduct.html
[13]: https://www.chocolate-doom.org/wiki/index.php/Downloads
[14]: https://opensource.com/article/20/5/diagrams-documentation
[15]: https://kubernetes.io/docs/reference/
[16]: https://github.com/SergioBenitez/Rocket/tree/v0.4
[17]: tmp.WF7h0s934j#5
[18]: https://chat.enarx.dev/
[19]: https://events.linuxfoundation.org/linux-security-summit-europe/
[20]: https://github.com/ogham/exa/issues
[21]: https://gitlab.gnome.org/GNOME/gnome-shell/tree/master/tests/interactive
[22]: https://wiki.winehq.org/Main_Page
[23]: https://github.com/enarx
[24]: tmp.WF7h0s934j#2
[25]: https://aliceevebob.com/2021/04/06/get-set-methods-for-open-source-projects/

View File

@ -0,0 +1,189 @@
[#]: subject: (21 reasons why I think everyone should try Linux)
[#]: via: (https://opensource.com/article/21/4/linux-reasons)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
21 reasons why I think everyone should try Linux
======
Gaming, business, budgeting, art, programming, and more. These are just
a few of the many ways anyone can use Linux.
![Linux keys on the keyboard for a desktop computer][1]
When I go on holiday, I often end up at one or more used bookstores. I always find a good book I've been meaning to read, and I always justify the inevitable purchase by saying, "I'm on vacation; I should treat myself to this book." It works well, and I've acquired some of my favorite books this way. Yet, like so many traditions in life, it doesn't hold up to scrutiny. In reality, I don't need an excuse to buy a good book. All things being equal, I can do it any time I want. But having a reason does seem to make the process more enjoyable, somehow.
In my everyday life, I get a lot of questions about Linux. When caught unaware, I sometimes awkwardly ramble on about the history of open source software or the intellectual and economic benefits of sharing resources. Sometimes, I manage to mention some of my favorite features I enjoy on Linux and then end up reverse-engineering those benefits so they can be enjoyed on another operating system. These discussions are usually enjoyable and informative, but there's just one problem: None of it answers the question that people are really asking.
When a person asks you about Linux, they're often asking you to give them a reason to try it. There are exceptions, of course. People who have never heard the term "Linux" are probably asking for a literal definition of the word. But when your friends and colleagues confide that they're a little dissatisfied with their current operating system, it's probably safe to explain why you enjoy Linux, rather than lecturing them on why Linux is a better option than proprietary systems. In other words, you don't need a sales presentation; you need vacation photos (or used books you bought on vacation, if you're a bookworm).
To that end, the links below connect to 21 reasons I enjoy Linux, given to 21 separate people on 21 separate occasions.
### Gaming
![Gaming on Linux][2]
(Seth Kenlon, [CC BY-SA 4.0][3])
When it comes to enjoying a computer, one of the most obvious activities is gaming, and when it comes to gaming, I love it all. I'm happy to spend an evening playing an 8-bit puzzler or a triple-A studio epic. Other times, I settle in for a board game or a tabletop role-playing game (RPG).
And I [do it all on a Linux computer][4].
### Office
![LibreOffice][5]
(Seth Kenlon, [CC BY-SA 4.0][3])
One size doesn't fit all. This is as true for hats as it is for office work. It pains me to see colleagues locked into a singular workflow that doesn't suit them, and I enjoy the way Linux encourages users to find tools they love. I've used office applications ranging from big suites (like LibreOffice and OpenOffice) to lightweight word processors (such as Abiword) to minimal text editors (with Pandoc for conversion).
Regardless of what users around me are locked into, I have [the freedom to use the tools that work best][6] on my computer and with the way I want to work.
### Choice
![Linux login screen][7]
(Seth Kenlon, [CC BY-SA 4.0][3])
One of open source's most valuable traits is the trust it allows users to have in the software they use. This trust is derived from a network of friends who can read the source code of the applications and operating systems they use. That means, even if you don't know good source code from bad, you can make friends within the [open source community][8] who do. These are important connections that Linux users can make as they explore the distribution they run. If you don't trust the community that builds and maintains a distribution, you can and should move to a different distribution. Many of us have done it, and it's one of the strengths of having many distros to choose from.
[Linux offers choice][9] as a feature. A strong community, filled with real human connections, combined with the freedom of choice that Linux provides all give users confidence in the software they run. Because I've read some source code, and because I trust the people who maintain the code I haven't read, [I trust Linux][10].
### Budgeting
![Skrooge][11]
(Seth Kenlon, [CC BY-SA 4.0][3])
Budgeting isn't fun, but it's important. I learned early, while working menial jobs as I learned a _free_ operating system (Linux!) in my free time, that a budget isn't meant to track your money so much as it tracks your habits. That means that whether you're living paycheck to paycheck or you're well on the way to planning your retirement, you should [maintain a budget][12].
If you're in the United States, you can even [pay your taxes on Linux][13].
### Art
![MyPaint][14]
(Dogchicken, [CC BY-SA 4.0][3])
It doesn't matter whether you paint or do pixel art, [edit video][15], or scratch records, you can create great content on Linux. Some of the best art I've seen has been casually made with tools that aren't "industry standard," and it might surprise you just how much of the content you see is made the same way. Linux is a quiet engine, but it's a powerful one that drives indie artists as well as big producers.
Try using Linux [to create some art][16].
### Programming
![NetBeans][17]
(Seth Kenlon, [CC BY-SA 4.0][3])
Look, using Linux to program is almost a foregone conclusion. Second only to server administration, open source code and Linux are an obvious combination. There are [many reasons for this][18], but the one I cite is that it's just more fun. I run into plenty of roadblocks when inventing something new, so the last thing I need is for an operating system or software development kit (SDK) to be the reason for failure. On Linux, I have access to everything. Literally everything.
### Packaging
![Packaging GNOME software][19]
(Seth Kenlon, [CC BY-SA 4.0][3])
The thing nobody talks about when they tell you about programming is _packaging_. As a developer, you have to get your code to your users, or you won't have any users. Linux makes it easy for developers [to deliver apps][20] and easy for users to [install those applications][21].
It surprises many people, but [Linux can run many Windows applications][22] as if they were native apps. You shouldn't expect a Windows application to be executable on Linux. Still, many of the major common applications either already exist natively on Linux or else can be run through a compatibility layer called Wine.
### Technology
![Data center][23]
([Taylor Vick][24], [Unsplash License][25])
If you're looking for a career in IT, Linux is a great first step. As a former art student who stumbled into Linux to render video faster, I speak from experience!
Cutting-edge technology happens on Linux. Linux drives most of the internet, most of the world's fastest supercomputers, and the cloud itself. Today, Linux drives [edge computing][26], combining the power of cloud data centers with decentralized nodes for quick response.
You don't have to start at the top, though. You can learn to [automate][27] tasks on your laptop or desktop and remotely control systems with a [good terminal][28].
Linux is open to your new ideas and [available for customization][29].
### Share files
![Beach with cloudy sky][30]
(Seth Kenlon, [CC BY-SA 4.0][3])
Whether you're a fledgling sysadmin or just a housemate with files to distribute to friends, Linux makes [file sharing a breeze][31].
### Media
![Waterfall][32]
(Seth Kenlon, [CC BY-SA 4.0][3])
With all the talk about programming and servers, people sometimes envision Linux as just a black screen filled with green 1's and 0's. Unsurprisingly to those of us who use it, Linux [plays all your media][33], too.
### Easy install
![CentOS installation][34]
(Seth Kenlon, [CC BY-SA 4.0][3])
Never installed an operating system before? Linux is shockingly easy. Step-by-step, Linux installers hold your hand through an operating system installation to make you feel like a computer expert in under an hour.
[Go install Linux][35]!
### Try Linux
![Porteus][36]
(Seth Kenlon, [CC BY-SA 4.0][3])
If you're not ready to install Linux, then you can _try_ Linux instead. No idea where to start? It's less intimidating than you may think. Here are some [things you should consider first][37]. Then take your pick, download a distro, and come up with your own 21 reasons to use Linux.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/linux-reasons
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
[2]: https://opensource.com/sites/default/files/uploads/game_0ad-egyptianpyramids.jpg (Gaming on Linux)
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://opensource.com/article/21/2/linux-gaming
[5]: https://opensource.com/sites/default/files/uploads/office_libreoffice.jpg (LibreOffice)
[6]: https://opensource.com/article/21/2/linux-workday
[7]: https://opensource.com/sites/default/files/uploads/trust_sddm.jpg (Linux login screen)
[8]: https://opensource.com/article/21/2/linux-community
[9]: https://opensource.com/article/21/2/linux-choice
[10]: https://opensource.com/article/21/2/open-source-security
[11]: https://opensource.com/sites/default/files/uploads/skrooge_1.jpg (Skrooge)
[12]: https://opensource.com/article/21/2/linux-skrooge
[13]: https://opensource.com/article/21/2/linux-tax-software
[14]: https://opensource.com/sites/default/files/uploads/art_mypaint.jpg (MyPaint)
[15]: https://opensource.com/article/21/2/linux-python-video
[16]: https://opensource.com/article/21/2/linux-art-design
[17]: https://opensource.com/sites/default/files/uploads/programming_java-netbeans.jpg (NetBeans)
[18]: https://opensource.com/article/21/2/linux-programming
[19]: https://opensource.com/sites/default/files/uploads/packaging_gnome-software.png (Packaging GNOME software)
[20]: https://opensource.com/article/21/2/linux-packaging
[21]: https://opensource.com/article/21/2/linux-package-management
[22]: https://opensource.com/article/21/2/linux-wine
[23]: https://opensource.com/sites/default/files/uploads/edge_taylorvick-unsplash.jpg (Data center)
[24]: https://unsplash.com/@tvick
[25]: https://unsplash.com/license
[26]: https://opensource.com/article/21/2/linux-edge-computing
[27]: https://opensource.com/article/21/2/linux-automation
[28]: https://opensource.com/article/21/2/linux-terminals
[29]: https://opensource.com/article/21/2/linux-technology
[30]: https://opensource.com/sites/default/files/uploads/cloud_beach-sethkenlon.jpg (Beach with cloudy sky)
[31]: https://opensource.com/article/21/3/linux-server
[32]: https://opensource.com/sites/default/files/uploads/media_waterfall.jpg (Waterfall)
[33]: https://opensource.com/article/21/2/linux-media-players
[34]: https://opensource.com/sites/default/files/uploads/install_centos8.jpg (CentOS installation)
[35]: https://opensource.com/article/21/2/linux-installation
[36]: https://opensource.com/sites/default/files/uploads/porteus_0.jpg (Porteus)
[37]: https://opensource.com/article/21/2/try-linux

View File

@ -0,0 +1,116 @@
[#]: subject: (How to take your open source project to the next level)
[#]: via: (https://opensource.com/article/21/4/open-source-saas)
[#]: author: (Stef Walter https://opensource.com/users/stefw)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
How to take your open source project to the next level
======
Merely releasing your SaaS's source code is not enough to make it open
source.
![Green graph of measurements][1]
Open sourcing the code to your software as a service (SaaS) is not sufficient to make it actually be open source. Does that sound contradictory to you? Let me explain.
Most services that espouse "open source" do so by simply throwing the code over the wall. It's better than nothing but really misses the point that powers open source: enabling users to make a change to the software they're using.
Some other popular services powered by Open Source software, do include the tools used to operate/deploy their service. Pause for applause.
But thats also insufficient to actually enable users to become contributors effectively.
Much of a service's value comes from things other than the code. It comes from the infrastructure it runs on, the operational processes, the monitoring, the backups, the metrics, the high availability, the scalability. It comes from data, from the network effect—with other users, with other interconnected services, with integrated tools, from legal agreements, and so on.
Any non-toy service is not reproducible.
Launching a clone of the service to contribute effectively is a high barrier. Certain kinds of contributions clearly are possible. But contributors are essentially asked to "fork" the non-code aspects of the service to iterate on their changes against their real-world use cases.
What's more, without true open source principles, we are missing a way to have a community develop with a center of gravity around the service itself. This leads to companies forking the service in a way that typical open source projects with a true community are resilient to.
I believe that if we enable contributions to services _rather than just the software_, we reap the advantages of true open source. That means enabling users to make a change to a running service and experience that change themselves.
You still with me?
Yes, that means opening a pull request against a running service and experiencing that change before it's merged.
This is not as insane as it sounds.
It appears that every technique we need to enable such a capability is already in use in modern deployment and operations methodology. We just have to connect the dots.
### Why should I care?
I've been part of open source for over 20 years now. Although I'm just one contributor, together, we've changed something fundamental about the world. Our lives are too short, and software is too complex to have one company or one individual invent everything from scratch. So, we work together across humanity to accomplish what no individual team could. This is our legacy, and it has become commonplace.
And yet, there's a very simple principle that drives open source:
> Open source thrives when it converts some
> small percentage of users into contributors.
If you interrupt that principle, you starve open source. SaaS does just that: When someone else runs your software for you, the intuitive mechanisms for you to change that software are not available.
![How users become contributors][2]
(Source: Stef Walter, [CC-BY-SA][3])
"But," you may say, "if the source code for that running service was _open_, then I could still change it."
Sure, you could change the code in some components. Still, for any reasonably complex service, you wouldn't be able to run your changes or experience your changes against real-world workflows, much less iterate on them, until they're good enough to share with others.
In reality, the threat here is far more fundamental: Users of services cannot readily change something in the service, not only because the processes are operated by someone else but because they have explicitly chosen not to be involved in operating the software.
If the primary way to use Postgres was "as a service," then that (fabulous) project would be starved for contributors. This is because the number of contributors in such a project is a function of some small percentage of users deciding to try to make change.
As this mechanism for using SaaS takes over the world, the pool of users who can contribute to open source shrinks dramatically.
For a long time, I saw this as a fundamental threat that would starve open source. I was unable to reconcile SaaS with a healthy open source ecosystem.
But recently, I've become convinced that if we enable an effective contribution model on a service, one that doesn't require that the users become operators of the service, then we can reconcile this threat, and open source will thrive on services instead of being starved by them.
### You want me to do what?!?
To enable contributions by users of a service, users that have explicitly chosen not to operate the software themselves, we have to set up a process by which they can make a change to a running service and experience that change before others do.
For example, a user of such a hypothetical service should be able to:
1. Discover which component of a service to contribute to
2. Make a nonsensical change (like adding a printf-style log statement) or change the spelling of a word
3. Experience that change when they use the service or when it acts on their data
After discussing this with others, I firmly believe we have all the techniques we need, whether they're canary deployments, load balancing, continuous delivery, infrastructure as code, and so on. It's been hard to find a single problem that an existing practice doesn't solve.
It turns out that many experienced engineering teams have come to that same conclusion. Rapid deployment of changes to services is a powerful capability that's highly sought after. For example, [GitHub deploys changes before they're merged][4]. Whereas [Facebook rapidly deploys changes][5] to a few canary machines and scales each change up to production. Everyone has their own version of continuous delivery. It's hard to take an engineering team seriously if they haven't figured out how their team members can get a change rapidly deployed.
Open source has all the ingredients to have a decisive advantage here. To effectively collaborate on _open source services_, with contributors working across all of humanity. 
Let's try to craft a playbook to achieve this basic capability that drives open source software and apply it to open source services: That is, the ability to change code and interact with that change… on a service.
_Note: [Thanks to the reviewers of this article!][6]_
* * *
_This originally appeared on [stef.thewalter.net][7] and is republished with the author's permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/open-source-saas
作者:[Stef Walter][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/stefw
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements)
[2]: https://opensource.com/sites/default/files/uploads/funneling-open-source-service.png (How users become contributors)
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://github.blog/2015-06-02-deploying-branches-to-github-com/
[5]: https://engineering.fb.com/2017/08/31/web/rapid-release-at-massive-scale/
[6]: https://github.com/stefwalter/blog/pull/1
[7]: http://stef.thewalter.net/open-source-services.html

View File

@ -0,0 +1,74 @@
[#]: subject: (Energy infrastructure platform uses open source to fight climate change)
[#]: via: (https://opensource.com/article/21/4/seapath-open-energy-infrastructure)
[#]: author: (Dr. Shuli Goodman https://opensource.com/users/shuligoodman)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Energy infrastructure platform uses open source to fight climate change
======
SEAPATH is a Linux Foundation project that aims to modernize the power
grid through an open energy infrastructure.
![Light bulb][1]
LF Energy is a Linux Foundation project working to accelerate the energy transition of the world's grids and transportation systems through open source. In December, our project took a major step toward achieving its mission when we and our member organizations Alliander, RTE, and Savoir-faire Linux launched [SEAPATH][2], which stands for Software Enabled Automation Platform and Artifacts.
SEAPATH is a reference design and a real-time, open source platform for grid operators to run virtualized automation and protection applications. It is the second project for LF Energy's [Digital Substation Automation Systems][3] initiative and a vital step toward adopting renewable energy on the power grid. It will accelerate the grid's decarbonization, helping lead the planet to [carbon neutrality by 2050][4]. Power system transformation [leads all efforts for decarbonization][5]; it's the _key_ enabler for fighting climate change.
### Breaking down silos
Coordinating power generation, distribution, and transmission systems is a critical component of a green grid.
Currently, the grid's infrastructure operates on a centralized, point-to-point framework, requiring a source like a gas- or coal-fired power plant to distribute electricity. Essentially, the grid was built on a foundation of silos with different systems for energy generation, transmission, and distribution. However, due to the high variability of renewable energy—power can be produced only when the sun shines or the wind blows—it's difficult to integrate clean energy sources into siloed systems. The [increasing use of electric vehicles][6] is also causing power supply and demand fluctuations.
These challenges make it difficult for grid operators to control and optimize renewable sources of energy. Furthermore, the grid's infrastructure isn't sustainable for a clean energy future. In fact, the grid of the future will not be a grid at all. Rather, power system networks will process tsunamis of data that enable the orchestration, choreography, and coordination of energy supply and demand. The future energy framework will operate like the internet, digitally connecting thousands of power systems and processing data from their substations to generate, transmit, and distribute electricity.
### Interoperability through open source
In working toward clean energy integration, grid operators use digital substations, which require a growing number of computational devices to support field sensors, applications, and automation technologies.
Typically, these components are provided by multiple proprietary solutions, making interoperability difficult due to redundant hardware requirements. This challenge largely correlates with vendor lock-in throughout the energy industry. US regulators allow utility companies to sign [50-plus year contracts][7] that secure their place in specified regions. As a result, utilities use proprietary solutions for their portion of the grid, making interoperability between substations difficult. In March 2021, we launched [FledgePOWER][8], a new project that seeks to address this problem.
Solutions do not always share the same specifications, but they often handle similar data. Implementing new solutions is costly, creates technical debt, and is time-consuming. To manage these heterogeneous environments, operators tend to run deprecated legacy systems for decades. With the speed of change increasing, network operations have become increasingly complex, less flexible, and more expensive to operate. Being able to abstract this complexity offers system and network operators new tools for interoperability in a rapidly transforming environment.
SEAPATH's goal is similar to the Linux Foundation's [OpenDaylight project][9], an open source initiative that catapulted software virtualization for telecommunication networks and set the industry standard for software-defined network infrastructure. SEAPATH aims to apply the same technology OpenDaylight uses to consolidate multi-provider systems on the grid into one platform. This aims to enable operators to digitally implement electricity distribution and transmission through data from their substations. This consolidation also supports time- and cost-efficiency, scalability, flexibility, innovation, and novel technology implementations and merging utility practices.
Through cross-industry collaboration with SEAPATH, the energy sector can build customer- and vendor-agnostic virtualization technologies required by a modern, climate-conscious grid. The more flexible and scalable the grid can be for greener energy, the faster we can reach decarbonization.
### How to get involved with SEAPATH
If you are interested in learning more about SEAPATH or joining the project, here's how you can get involved:
* **Learn about SEAPATH:** Check out LF Energy's [SEAPATH project page][2] to learn more about the initiative. We have a technical steering committee (TSC), a mailing list, open meetings, a wiki feed, and a roadmap that can help answer any questions you may have about the project.
* **Use SEAPATH:** To access SEAPATH, you must be a member of LF Energy. Organizations can join by [becoming a member][10]. LF Energy is funded through membership dues and contributions of engineering resources. Once registered, you can access SEAPATH on its [GitHub page][11]. If you can't join as an LF Energy member, we still encourage you to contribute by participating in technical projects and discussion lists.
Time is running out for the energy industry to come together and improve the grid for our future. By joining as partners, the entire energy industry—and the entire world—can benefit from a grid powered by green energy for a brighter future.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/seapath-open-energy-infrastructure
作者:[Dr. Shuli Goodman][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/shuligoodman
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bulb-light-energy-power-idea.png?itok=zTEEmTZB (Light bulb)
[2]: https://www.lfenergy.org/projects/seapath/
[3]: https://wiki.lfenergy.org/display/HOME/Digital+Substation+Automation+Systems+%28DSAS%29+Initiative
[4]: https://grist.org/climate/yes-the-u-s-can-go-carbon-neutral-by-2050-says-new-princeton-study/
[5]: https://e360.yale.edu/features/deep-decarbonization-a-realistic-way-forward-on-climate-change
[6]: https://www.iea.org/reports/global-ev-outlook-2020
[7]: https://apnews.com/article/7393a2dd5c69f590a8e7db3d19f1e240
[8]: https://www.lfenergy.org/projects/fledgepower/
[9]: https://opensource.com/business/14/10/opendaylight-helium-gets-out-gate
[10]: https://www.lfenergy.org/join/
[11]: https://github.com/seapath

View File

@ -0,0 +1,124 @@
[#]: subject: (Sustainable economic development begins with open thinking)
[#]: via: (https://opensource.com/open-organization/21/3/sustainable-development-environment)
[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Sustainable economic development begins with open thinking
======
Do our global development practices respect planetary boundaries?
Greater transparency could provide insight.
![2 cents penny money currency][1]
To be successful, open organizations must have specific purposes, address achievable goals, perform clear tasks, effectively evaluate the results of their work, and introduce countermeasures or revisions to their operations. [Open organization principles][2] serve vital functions throughout this process.
This is true no matter the scale of the problem an open organization confronts. In this three part review of [_The Age of Sustainable Development_][3] by Jeffrey Sachs, I'll examine an issue with global scope—sustainable economic development—to demonstrate how thinking openly can help us address global issues.
Specifically, in this article I'll discuss the important role of _transparency_ in assessing environmental damage and destruction some economic development programs can cause, and I'll explain how the principle of transparency also helps us think about specific actions we can take to combat destructive forces. In the next article, I will discuss human suffering on a global scale—here again stressing transparency. And in the third and last article, I will bring both these concerns together and discuss global governance. That is where we'll recognize the importance of open organization principles for making progress on these issues.
One more note: All these articles address extremely complex subjects. So at the end of each, I'll share a video presentation offering additional explanation. I'll start that discussion by introducing what I call the Open Organization Principles Loop, so you can visualize how these principles can be applied to sustainable global economic development issues.
Simply put, letting [open principles][2] guide our work creating sustainable, global economic development will help:
* Make global, environmental and human suffering problems **transparent**
* Form and unite organizations/**communities** at the local (not only global) level to tackle those problems
* Start **collaboration** within and between communities to find detailed, local solutions
* Recruit and **include** members globally to gain broad perspectives on how to achieve goals
* **Adapt** strategies to each region globally and in each local community
All this starts with exposing specific problems and making them vividly transparent. Once exposed, these problems must be broadly presented and made _immediately personal_ to every individual.
This is the discussion I hope to start in this article on global environmental issues.
The earth has what we might call "planetary boundaries." Respecting these boundaries means being prosperous, socially inclusive, and environmentally responsible.
### Stressing planetary boundaries
In a previous article entitled "[Climate challenges call for open solutions][4]," I discussed only the issue of carbon-free power generation, particularly through fourth-generation nuclear power plants that are now being developed. But reading Sach's book, _The Age of Sustainable Development_, made me realize that energy generation through nuclear power plants is an approach _too narrow_ to address the massive climate challenges the world faces (the phrase "climate challenge" might _itself_ be too narrow). "Sustainable economic development" might be a better phrase to describe what should be our most pressing concern, of which climate change is only _one_ component issue. When we use the term "sustainable," we're referring to methods that effectively avoid driving something or some species to extinction—including humankind. It is the conservation of living and mineral resources in ways that continue to make life on earth economically viable.
Sachs' book suggests a wide range of strategies on detailed concerns that could move the global society toward sustainable economic development. I will quickly review them and explain where open organization principles can play a role.
The earth has what we might call "[planetary boundaries][5]": it can only support life to the extent that life forms respect these boundaries. They are the foundations of ecosystems like forests and fisheries, for example. Respecting these boundaries means being prosperous, socially inclusive, and environmentally responsible.
We must monitor and manage our relationships with these planetary boundaries globally. Here are at least nine boundaries:
1. **Climate change**: This is directly related to [greenhouse gases][6] (GHGs).
2. **Ocean acidification**: Rising acidity threatens various marine life.
3. **Stratospheric ozone depletion**: Evidence suggests a direct link to skin cancers and other disorders.
4. **Biogeochemical flow boundaries (Nitrogen Cycle/Phosphorus Cycle)**: Chemical fertilizers are required for high crop yield, but their runoff negatively impacts the surrounding environment.
5. **Global freshwater use and water scarcity**: Groundwater is declining worldwide while demand is growing with population growth.
6. **Land degradation**: Deforestation is a major problem, as forests withdraw CO2 in the atmosphere and are the habitat of many species.
7. **Biodiversity loss**: We depend on biodiversity for our food supply, for our safety from many natural hazards like flooding, industry/construction material supply, freshwater and combating pests and pathogens.
8. **Atmospheric aerosol loading**: Simply put, smog causes problems like life-threatening lung disease.
9. **Chemical pollution**: Petrochemical production, steel production, and mining processes put deadly pollutants into their surrounding environments.
Sachs indicates that humans have stressed these boundaries in major areas around the globe, and earth's natural system can't cope with that pressure. Sachs believes that during this century human beings will stress all nine boundaries in critically dangerous ways, unless dedicated organizations and communities are formed to establish projects that execute on reversing them.
### Why can't we just save the world?
It's difficult to convince people of environmental importance and to assemble organizations, communities, neighborhoods and resources to execute action plans. Sachs cites six primary reasons for this:
1. **Global problems.** No single actor can take charge to get things started and organizing on a global scale is extremely difficult.
2. **Short-term special interests groups.** Many parties have competing goals, and no one is [speaking for the planet][7].
3. **Impact timeframe.** The greatest impact will be on those not born yet.
4. **Current economic structure.** The solutions might be incompatible with the current economic structure. But, its damage to the environment must be exposed and a new sustainable economic structure technically developed to replace it.
5. **Pace of change.** The impact is not visible on a daily, weekly, or even monthly basis.
6. **Complexity.** Environmental issues are caused by many human activities, not just one.
Reviewing these six characteristics, we see that getting solutions adopted globally requires a powerful sales job. But applying open organization principles can be significantly helpful, particularly making the problems as transparent as possible on a global scale.
Both globally and locally, communities can't continue with their current modes of economic development—not if they want to respect planetary boundaries. Business as usual, Sachs stresses, will destroy us all.
As I mentioned earlier, Sachs notes that generally addressing sustainable development directly is too vague and unhelpful. The challenge must be broken down into detailed projects and tasks for each region and community on the planet. Here are some specific examples of initiatives that are important but could vary by region:
1. Building/home energy use reduction
2. Environmentally friendly transportation
3. Secure food production to reach demand
4. Clean/efficient electrical power generation, storage and distribution
5. Environmentally friendly urban designing
6. Ocean biodiversity protection
7. Plant biodiversity protection
8. Wildlife biodiversity protection
9. Air pollution &amp; the CO2 reduction
10. Freshwater supply to satisfy future demand
### The cost of doing nothing
Both globally and locally, communities can't continue with their current modes of economic development—not if they want to respect planetary boundaries. Business as usual, Sachs stresses, will destroy us all.
At the start of this discussion, I mentioned the importance of transparency and the need to expose the environmental damage that many human economic activities cause. Information and communication technology specialists will become increasingly central to these transparency efforts, as they can effectively and cost efficiently use automated data gathering, analytics, telecommunications, and other technologies to help increase transparency. (Wondering how you might do this? Why not [ask our community][8]?)
In the next article, I will attempt to make vividly transparent the impact of unsustainable development practices on human inequality and suffering at a global level. Armed with a full understanding of both these challenges, in my last article in this series, I'll present global governance to tackle them. In that governance all open organization principles will play vital roles.
--------------------------------------------------------------------------------
via: https://opensource.com/open-organization/21/3/sustainable-development-environment
作者:[Ron McFarland][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/ron-mcfarland
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Medical%20Costs%20Transparency_1.jpg?itok=CkZ_J88m (2 cents penny money currency)
[2]: https://theopenorganization.org/definition/
[3]: https://www.goodreads.com/book/show/23215948-the-age-of-sustainable-development
[4]: https://opensource.com/open-organization/19/10/global-energy-climate-challenges
[5]: http://www.igbp.net/news/features/features/aplanetontheedge.5.1b8ae20512db692f2a680003122.html
[6]: https://en.wikipedia.org/wiki/Greenhouse_gas#/media/File:Global_GHG_Emissions_by_Sector_2016.png
[7]: https://opensource.com/open-organization/19/10/open-platform-greenpeace
[8]: http://theopenorganization.community

View File

@ -0,0 +1,145 @@
[#]: subject: (Can We Recommend Linux for Gaming in 2021?)
[#]: via: (https://news.itsfoss.com/linux-for-gaming-opinion/)
[#]: author: (Ankush Das https://news.itsfoss.com/author/ankush/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Can We Recommend Linux for Gaming in 2021?
======
You will often hear Linux enthusiasts praise about the improved gaming capabilities on Linux. Yes, we have come a long way considering the advancements made to support modern games on Linux desktop.
Even Lutris creator mentions in our interview that the [progress Linux has made in terms of gaming is simply incredible][1].
But, is it something to be hyped about? Can we recommend Linux to a gamer? Is Linux suitable for gaming?
In this article, I want to share a few things about gaming on a Linux system and share what I think about it.
### You Can Play Games on Linux: Yes!
If anyones ever told you that you cannot game on Linux, **that is not true**.
You can play a variety of games on Linux without any major hiccups. And, for the most part, it is playable and totally a good experience.
In fact, we have an ultimate guide for [Gaming on Linux][2] if you do not know where to start.
### Do I Need a Specific Linux Distro to Play Games?
Not really. It depends on how convenient you want the experience to be.
For instance, if you want a Linux distribution to work well with your graphics driver and get the latest hardware support, theres something for that. Similarly, if you just want to play native Linux indie games with an integrated GPU, any Linux distro can work.
So, there are a few variables when choosing a Linux distribution for your gaming adventures.
Fret not, to help you out, we have a useful list of the [best Linux gaming distributions][3].
### Virtual Reality Games on Linux: Uh-Oh!
![][4]
Im sure VR gaming is not something widely adopted yet. But, if you want the exciting experience on a VR headset, **choosing Linux as your preferred platform might be a bad idea**.
You do not have the necessary drivers or applications for a convenient experience on Linux. No distribution can help you solve this problem.
If you are curious, you can go through the details shed on the **state of virtual reality** in a blog post on [Boiling Steam][5] and an interesting experience with Valves VR headset on [GamingOnLinux][6].
Ive linked those blog posts for reference but long story short — avoid Linux if you want to experience VR games (feel free to experiment if you have the time though).
### Can You Play Windows Exclusive Games on Linux?
Yes and No.
You can use [Steam Play to play Windows-only games][7], **but it has its share of issues**. Not every game works.
For instance, I end up using Windows to play [Forza Horizon 4][8]. If you love car simulation or racing games, this is a masterpiece that you may not want to miss.
Maybe we will see it working through Steam Play without issues in the near future, who knows?
So, it is safe to assume that you will encounter many similar games that may not work at all. Thats the bitter truth.
And, to know if the game works on Linux, head to [ProtonDB][9] and search for the game to see if it has a “**Gold**” status at the very least.
### Multiplayer Gaming With Anti-Cheat Engines: Does It Work?
![][10]
A huge chunk of gamers prefer playing multiplayer games like [Apex Legends][11], [Rainbow Six Siege][12], and [Fortnite][13].
However, some of those popular titles that rely on anti-cheat engines do not work on Linux yet. It is still something a work in progress and can be made possible in future Linux Kernel releases — just not yet.
Do note that multiplayer games like [CS:GO][14], Dota 2, Team Fortress 2, [Valheim][15], and several more offer native Linux support and works great!
### Would I Recommend Linux for Gaming?
![][4]
Considering that you can play a lot of Windows-specific games, native indie games, and a variety of AAA games with native Linux support, I can recommend a first-time user to try gaming on Linux.
But, that comes with a **caution** — I would suggest you to make a potential list of games that you want to play to make sure that it runs on Linux without any issues. In either case, you may end up wasting a lot of time troubleshooting with no results.
Not to forget, a big no to VR gaming on Linux, I believe.
And, if you want to explore all the latest and greatest titles, I will recommend you to stick to your Windows-powered gaming machine.
**While I should encourage more users to adopt Linux as a gaming platform, but I wont be ignoring the practical side of why common consumers still prefer a Windows-powered machine to game on.**
_What do you think? Do you agree with my thoughts? Feel free to share what you feel in the comments below!_
#### Big Tech Websites Get Millions in Revenue, It's FOSS Got You!
If you like what we do here at It's FOSS, please consider making a donation to support our independent publication. Your support will help us keep publishing content focusing on desktop Linux and open source software.
I'm not interested
#### _Related_
* [The Progress Linux has Made in Terms of Gaming is Simply Incredible: Lutris Creator][1]
* ![][16] ![][17]
* [Popular Game Titles Metro Exodus and Total War: Rome Remastered Releasing for Linux in April][18]
* ![][16] ![][19]
* [Good News for Linux Gamers! An Unofficial Epic Games Store Launcher for Linux is in Works][20]
* ![][16] ![Heroic Games Launcher][21]
--------------------------------------------------------------------------------
via: https://news.itsfoss.com/linux-for-gaming-opinion/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://news.itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://news.itsfoss.com/lutris-creator-interview/
[2]: https://itsfoss.com/linux-gaming-guide/
[3]: https://itsfoss.com/linux-gaming-distributions/
[4]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzUyMScgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[5]: https://boilingsteam.com/the-state-of-virtual-reality-on-linux/
[6]: https://www.gamingonlinux.com/2020/08/my-experiences-of-valves-vr-on-linux
[7]: https://itsfoss.com/steam-play/
[8]: https://forzamotorsport.net/en-US/games/fh4
[9]: https://www.protondb.com/
[10]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzUyMCcgd2lkdGg9Jzc4MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[11]: https://www.ea.com/games/apex-legends
[12]: https://www.ubisoft.com/en-us/game/rainbow-six/siege
[13]: https://www.epicgames.com/fortnite/en-US/home
[14]: https://store.steampowered.com/app/730/CounterStrike_Global_Offensive/
[15]: https://store.steampowered.com/app/892970/Valheim/
[16]: data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9JzIwMCcgd2lkdGg9JzM1MCcgeG1sbnM9J2h0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnJyB2ZXJzaW9uPScxLjEnLz4=
[17]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/lutris-interview-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[18]: https://news.itsfoss.com/metro-exodus-total-war-rome-linux/
[19]: https://i2.wp.com/news.itsfoss.com/wp-content/uploads/2021/03/metro-total-war-ft.png?fit=1200%2C675&ssl=1&resize=350%2C200
[20]: https://news.itsfoss.com/heroic-games-launcher/
[21]: https://i0.wp.com/news.itsfoss.com/wp-content/uploads/2021/01/heroic-games-launcher.jpg?fit=1200%2C675&ssl=1&resize=350%2C200

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( chensanle )
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,298 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to handle dynamic and static libraries in Linux)
[#]: via: (https://opensource.com/article/20/6/linux-libraries)
[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99)
How to handle dynamic and static libraries in Linux
======
Knowing how Linux uses libraries, including the difference between
static and dynamic linking, can help you fix dependency problems.
![Hand putting a Linux file folder into a drawer][1]
Linux, in a way, is a series of static and dynamic libraries that depend on each other. For new users of Linux-based systems, the whole handling of libraries can be a mystery. But with experience, the massive amount of shared code built into the operating system can be an advantage when writing new applications.
To help you get in touch with this topic, I prepared a small [application example][2] that shows the most common methods that work on common Linux distributions (these have not been tested on other systems). To follow along with this hands-on tutorial using the example application, open a command prompt and type:
```
$ git clone <https://github.com/hANSIc99/library\_sample>
$ cd library_sample/
$ make
cc -c main.c -Wall -Werror
cc -c libmy_static_a.c -o libmy_static_a.o -Wall -Werror
cc -c libmy_static_b.c -o libmy_static_b.o -Wall -Werror
ar -rsv libmy_static.a libmy_static_a.o libmy_static_b.o
ar: creating libmy_static.a
a - libmy_static_a.o
a - libmy_static_b.o
cc -c -fPIC libmy_shared.c -o libmy_shared.o
cc -shared -o libmy_shared.so libmy_shared.o
$ make clean
rm *.o
```
After executing these commands, these files should be added to the directory (run `ls` to see them):
```
my_app
libmy_static.a
libmy_shared.so
```
### About static linking
When your application links against a static library, the library's code becomes part of the resulting executable. This is performed only once at linking time, and these static libraries usually end with a `.a` extension.
A static library is an archive ([ar][3]) of object files. The object files are usually in the ELF format. ELF is short for [Executable and Linkable Format][4], which is compatible with many operating systems.
The output of the `file` command tells you that the static library `libmy_static.a` is the `ar` archive type:
```
$ file libmy_static.a
libmy_static.a: current ar archive
```
With `ar -t`, you can look into this archive; it shows two object files:
```
$ ar -t libmy_static.a
libmy_static_a.o
libmy_static_b.o
```
You can extract the archive's files with `ar -x <archive-file>`. The extracted files are object files in ELF format:
```
$ ar -x libmy_static.a
$ file libmy_static_a.o
libmy_static_a.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
```
### About dynamic linking
Dynamic linking means the use of shared libraries. Shared libraries usually end with `.so` (short for "shared object").
Shared libraries are the most common way to manage dependencies on Linux systems. These shared resources are loaded into memory before the application starts, and when several processes require the same library, it will be loaded only once on the system. This feature saves on memory usage by the application.
Another thing to note is that when a bug is fixed in a shared library, every application that references this library will profit from it. This also means that if the bug remains undetected, each referencing application will suffer from it (if the application uses the affected parts).
It can be very hard for beginners when an application requires a specific version of the library, but the linker only knows the location of an incompatible version. In this case, you must help the linker find the path to the correct version.
Although this is not an everyday issue, understanding dynamic linking will surely help you in fixing such problems.
Fortunately, the mechanics for this are quite straightforward.
To detect which libraries are required for an application to start, you can use `ldd`, which will print out the shared libraries used by a given file:
```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffd1299c000)
        libmy_shared.so =&gt; not found
        libc.so.6 =&gt; /lib64/libc.so.6 (0x00007f56b869b000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f56b8881000)
```
Note that the library `libmy_shared.so` is part of the repository but is not found. This is because the dynamic linker, which is responsible for loading all dependencies into memory before executing the application, cannot find this library in the standard locations it searches.
Errors associated with linkers finding incompatible versions of common libraries (like `bzip2`, for example) can be quite confusing for a new user. One way around this is to add the repository folder to the environment variable `LD_LIBRARY_PATH` to tell the linker where to look for the correct version. In this case, the right version is in this folder, so you can export it:
```
$ LD_LIBRARY_PATH=$(pwd):$LD_LIBRARY_PATH
$ export LD_LIBRARY_PATH
```
Now the dynamic linker knows where to find the library, and the application can be executed. You can rerun `ldd` to invoke the dynamic linker, which inspects the application's dependencies and loads them into memory. The memory address is shown after the object path:
```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffd385f7000)
        libmy_shared.so =&gt; /home/stephan/library_sample/libmy_shared.so (0x00007f3fad401000)
        libc.so.6 =&gt; /lib64/libc.so.6 (0x00007f3fad21d000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f3fad408000)
```
To find out which linker is invoked, you can use `file`:
```
$ file my_app
my_app: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=26c677b771122b4c99f0fd9ee001e6c743550fa6, for GNU/Linux 3.2.0, not stripped
```
The linker `/lib64/ld-linux-x8664.so.2` is a symbolic link to `ld-2.30.so`, which is the default linker for my Linux distribution:
```
$ file /lib64/ld-linux-x86-64.so.2
/lib64/ld-linux-x86-64.so.2: symbolic link to ld-2.31.so
```
Looking back to the output of `ldd`, you can also see (next to `libmy_shared.so`) that each dependency ends with a number (e.g., `/lib64/libc.so.6`). The usual naming scheme of shared objects is:
```
`**lib** XYZ.so **.<MAJOR>** . **<MINOR>**`
```
On my system, `libc.so.6` is also a symbolic link to the shared object `libc-2.30.so` in the same folder:
```
$ file /lib64/libc.so.6
/lib64/libc.so.6: symbolic link to libc-2.31.so
```
If you are facing the issue that an application will not start because the loaded library has the wrong version, it is very likely that you can fix this issue by inspecting and rearranging the symbolic links or specifying the correct search path (see "The dynamic loader: ld.so" below).
For more information, look on the [`ldd` man page][5].
#### Dynamic loading
Dynamic loading means that a library (e.g., a `.so` file) is loaded during a program's runtime. This is done using a certain programming scheme.
Dynamic loading is applied when an application uses plugins that can be modified during runtime.
See the [`dlopen` man page][6] for more information.
#### The dynamic loader: ld.so
On Linux, you mostly are dealing with shared objects, so there must be a mechanism that detects an application's dependencies and loads them into memory.
`ld.so` looks for shared objects in these places in the following order:
1. The relative or absolute path in the application (hardcoded with the `-rpath` compiler option on GCC)
2. In the environment variable `LD_LIBRARY_PATH`
3. In the file `/etc/ld.so.cache`
Keep in mind that adding a library to the systems library archive `/usr/lib64` requires administrator privileges. You could copy `libmy_shared.so` manually to the library archive and make the application work without setting `LD_LIBRARY_PATH`:
```
unset LD_LIBRARY_PATH
sudo cp libmy_shared.so /usr/lib64/
```
When you run `ldd`, you can see the path to the library archive shows up now:
```
$ ldd my_app
        linux-vdso.so.1 (0x00007ffe82fab000)
        libmy_shared.so =&gt; /lib64/libmy_shared.so (0x00007f0a963e0000)
        libc.so.6 =&gt; /lib64/libc.so.6 (0x00007f0a96216000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0a96401000)
```
### Customize the shared library at compile time
If you want your application to use your shared libraries, you can specify an absolute or relative path during compile time.
Modify the makefile (line 10) and recompile the program by invoking `make -B` . Then, the output of `ldd` shows `libmy_shared.so` is listed with its absolute path.
Change this:
```
`CFLAGS =-Wall -Werror -Wl,-rpath,$(shell pwd)`
```
To this (be sure to edit the username):
```
`CFLAGS =/home/stephan/library_sample/libmy_shared.so`
```
Then recompile:
```
`$ make`
```
Confirm it is using the absolute path you set, which you can see on line 2 of the output:
```
$ ldd my_app
    linux-vdso.so.1 (0x00007ffe143ed000)
        libmy_shared.so =&gt; /lib64/libmy_shared.so (0x00007fe50926d000)
        /home/stephan/library_sample/libmy_shared.so (0x00007fe509268000)
        libc.so.6 =&gt; /lib64/libc.so.6 (0x00007fe50909e000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fe50928e000)
```
This is a good example, but how would this work if you were making a library for others to use? New library locations can be registered by writing them to `/etc/ld.so.conf` or creating a `<library-name>.conf` file containing the location under `/etc/ld.so.conf.d/`. Afterward, `ldconfig` must be executed to rewrite the `ld.so.cache` file. This step is sometimes necessary after you install a program that brings some special shared libraries with it.
See the [`ld.so` man page][7] for more information.
### How to handle multiple architectures
Usually, there are different libraries for the 32-bit and 64-bit versions of applications. The following list shows their standard locations for different Linux distributions:
**Red Hat family**
* 32 bit: `/usr/lib`
* 64 bit: `/usr/lib64`
**Debian family**
* 32 bit: `/usr/lib/i386-linux-gnu`
* 64 bit: `/usr/lib/x86_64-linux-gnu`
**Arch Linux family**
* 32 bit: `/usr/lib32`
* 64 bit: `/usr/lib64`
[**FreeBSD**][8] (technical not a Linux distribution)
* 32bit: `/usr/lib32`
* 64bit: `/usr/lib`
Knowing where to look for these key libraries can make broken library links a problem of the past.
While it may be confusing at first, understanding dependency management in Linux libraries is a way to feel in control of the operating system. Run through these steps with other applications to become familiar with common libraries, and continue to learn how to fix any library challenges that could come up along your way.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/linux-libraries
作者:[Stephan Avenwedde][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/hansic99
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
[2]: https://github.com/hANSIc99/library_sample
[3]: https://en.wikipedia.org/wiki/Ar_%28Unix%29
[4]: https://linuxhint.com/understanding_elf_file_format/
[5]: https://www.man7.org/linux/man-pages/man1/ldd.1.html
[6]: https://www.man7.org/linux/man-pages/man3/dlopen.3.html
[7]: https://www.man7.org/linux/man-pages/man8/ld.so.8.html
[8]: https://opensource.com/article/20/5/furybsd-linux

View File

@ -1,551 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Use systemd timers instead of cronjobs)
[#]: via: (https://opensource.com/article/20/7/systemd-timers)
[#]: author: (David Both https://opensource.com/users/dboth)
Use systemd timers instead of cronjobs
======
Timers provide finer-grained control of events than cronjobs.
![Team checklist][1]
I am in the process of converting my [cron][2] jobs to systemd timers. I have used timers for a few years, but usually, I learned just enough to perform the task I was working on. While doing research for this [systemd series][3], I learned that systemd timers have some very interesting capabilities.
Like cron jobs, systemd timers can trigger events—shell scripts and programs—at specified time intervals, such as once a day, on a specific day of the month (perhaps only if it is a Monday), or every 15 minutes during business hours from 8am to 6pm. Timers can also do some things that cron jobs cannot. For example, a timer can trigger a script or program to run a specific amount of time after an event such as boot, startup, completion of a previous task, or even the previous completion of the service unit called by the timer.
### System maintenance timers
When Fedora or any systemd-based distribution is installed on a new system, it creates several timers that are part of the system maintenance procedures that happen in the background of any Linux host. These timers trigger events necessary for common maintenance tasks, such as updating system databases, cleaning temporary directories, rotating log files, and more.
As an example, I'll look at some of the timers on my primary workstation by using the `systemctl status *timer` command to list all the timers on my host. The asterisk symbol works the same as it does for file globbing, so this command lists all systemd timer units:
```
[root@testvm1 ~]# systemctl status *timer
● mlocate-updatedb.timer - Updates mlocate database every day
     Loaded: loaded (/usr/lib/systemd/system/mlocate-updatedb.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
    Trigger: Fri 2020-06-05 00:00:00 EDT; 15h left
   Triggers: ● mlocate-updatedb.service
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Updates mlocate database every day.
● logrotate.timer - Daily rotation of log files
     Loaded: loaded (/usr/lib/systemd/system/logrotate.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
    Trigger: Fri 2020-06-05 00:00:00 EDT; 15h left
   Triggers: ● logrotate.service
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Daily rotation of log files.
● sysstat-summary.timer - Generate summary of yesterday's process accounting
     Loaded: loaded (/usr/lib/systemd/system/sysstat-summary.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
    Trigger: Fri 2020-06-05 00:07:00 EDT; 15h left
   Triggers: ● sysstat-summary.service
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Generate summary of yesterday's process accounting.
● fstrim.timer - Discard unused blocks once a week
     Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
    Trigger: Mon 2020-06-08 00:00:00 EDT; 3 days left
   Triggers: ● fstrim.service
       Docs: man:fstrim
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Discard unused blocks once a week.
● sysstat-collect.timer - Run system activity accounting tool every 10 minutes
     Loaded: loaded (/usr/lib/systemd/system/sysstat-collect.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
    Trigger: Thu 2020-06-04 08:50:00 EDT; 41s left
   Triggers: ● sysstat-collect.service
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Run system activity accounting tool every 10 minutes.
● dnf-makecache.timer - dnf makecache --timer
     Loaded: loaded (/usr/lib/systemd/system/dnf-makecache.timer; enabled; vendor preset: enabled)
     Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
    Trigger: Thu 2020-06-04 08:51:00 EDT; 1min 41s left
   Triggers: ● dnf-makecache.service
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started dnf makecache timer.
● systemd-tmpfiles-clean.timer - Daily Cleanup of Temporary Directories
     Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-clean.timer; static; vendor preset: disabled)
     Active: active (waiting) since Tue 2020-06-02 08:02:33 EDT; 2 days ago
    Trigger: Fri 2020-06-05 08:19:00 EDT; 23h left
   Triggers: ● systemd-tmpfiles-clean.service
       Docs: man:tmpfiles.d(5)
             man:systemd-tmpfiles(8)
Jun 02 08:02:33 testvm1.both.org systemd[1]: Started Daily Cleanup of Temporary Directories.
```
Each timer has at least six lines of information associated with it:
* The first line has the timer's file name and a short description of its purpose.
* The second line displays the timer's status, whether it is loaded, the full path to the timer unit file, and the vendor preset.
* The third line indicates its active status, which includes the date and time the timer became active.
* The fourth line contains the date and time the timer will be triggered next and an approximate time until the trigger occurs.
* The fifth line shows the name of the event or the service that is triggered by the timer.
* Some (but not all) systemd unit files have pointers to the relevant documentation. Three of the timers in my virtual machine's output have pointers to documentation. This is a nice (but optional) bit of data.
* The final line is the journal entry for the most recent instance of the service triggered by the timer.
Depending upon your host, you will probably have a different set of timers.
### Create a timer
Although we can deconstruct one or more of the existing timers to learn how they work, lets create our own [service unit][4] and a timer unit to trigger it. We will use a fairly trivial example in order to keep this simple. After we have finished this, it will be easier to understand how the other timers work and to determine what they are doing.
First, create a simple service that will run something basic, such as the `free` command. For example, you may want to monitor free memory at regular intervals. Create the following `myMonitor.service` unit file in the `/etc/systemd/system` directory. It does not need to be executable:
```
# This service unit is for testing timer units
# By David Both
# Licensed under GPL V2
#
[Unit]
Description=Logs system statistics to the systemd journal
Wants=myMonitor.timer
[Service]
Type=oneshot
ExecStart=/usr/bin/free
[Install]
WantedBy=multi-user.target
```
This is about the simplest service unit you can create. Now lets look at the status and test our service unit to ensure that it works as we expect it to.
```
[root@testvm1 system]# systemctl status myMonitor.service
● myMonitor.service - Logs system statistics to the systemd journal
     Loaded: loaded (/etc/systemd/system/myMonitor.service; disabled; vendor preset: disabled)
     Active: inactive (dead)
[root@testvm1 system]# systemctl start myMonitor.service
[root@testvm1 system]#
```
Where is the output? By default, the standard output (`STDOUT`) from programs run by systemd service units is sent to the systemd journal, which leaves a record you can view now or later—up to a point. (I will look at systemd journaling and retention strategies in a future article in this series.) Look at the journal specifically for your service unit and for today only. The `-S` option, which is the short version of `--since`, allows you to specify the time period that the `journalctl` tool should search for entries. This isn't because you don't care about previous results—in this case, there won't be any—it is to shorten the search time if your host has been running for a long time and has accumulated a large number of entries in the journal:
```
[root@testvm1 system]# journalctl -S today -u myMonitor.service
\-- Logs begin at Mon 2020-06-08 07:47:20 EDT, end at Thu 2020-06-11 09:40:47 EDT. --
Jun 11 09:12:09 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 11 09:12:09 testvm1.both.org free[377966]:               total        used        free      shared  buff/cache   available
Jun 11 09:12:09 testvm1.both.org free[377966]: Mem:       12635740      522868    11032860        8016     1080012    11821508
Jun 11 09:12:09 testvm1.both.org free[377966]: Swap:       8388604           0     8388604
Jun 11 09:12:09 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
[root@testvm1 system]#
```
A task triggered by a service can be a single program, a series of programs, or a script written in any scripting language. Add another task to the service by adding the following line to the end of the `[Service]` section of the `myMonitor.service` unit file:
```
`ExecStart=/usr/bin/lsblk`
```
Start the service again and check the journal for the results, which should look like this. You should see the results from both commands in the journal:
```
Jun 11 15:42:18 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 11 15:42:18 testvm1.both.org free[379961]:               total        used        free      shared  buff/cache   available
Jun 11 15:42:18 testvm1.both.org free[379961]: Mem:       12635740      531788    11019540        8024     1084412    11812272
Jun 11 15:42:18 testvm1.both.org free[379961]: Swap:       8388604           0     8388604
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: sda             8:0    0  120G  0 disk
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: ├─sda1          8:1    0    4G  0 part /boot
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: └─sda2          8:2    0  116G  0 part
Jun 11 15:42:18 testvm1.both.org lsblk[379962]:   ├─VG01-root 253:0    0    5G  0 lvm  /
Jun 11 15:42:18 testvm1.both.org lsblk[379962]:   ├─VG01-swap 253:1    0    8G  0 lvm  [SWAP]
Jun 11 15:42:18 testvm1.both.org lsblk[379962]:   ├─VG01-usr  253:2    0   30G  0 lvm  /usr
Jun 11 15:42:18 testvm1.both.org lsblk[379962]:   ├─VG01-tmp  253:3    0   10G  0 lvm  /tmp
Jun 11 15:42:18 testvm1.both.org lsblk[379962]:   ├─VG01-var  253:4    0   20G  0 lvm  /var
Jun 11 15:42:18 testvm1.both.org lsblk[379962]:   └─VG01-home 253:5    0   10G  0 lvm  /home
Jun 11 15:42:18 testvm1.both.org lsblk[379962]: sr0            11:0    1 1024M  0 rom
Jun 11 15:42:18 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
Jun 11 15:42:18 testvm1.both.org systemd[1]: Finished Logs system statistics to the systemd journal.
```
Now that you know your service works as expected, create the timer unit file, `myMonitor.timer` in `/etc/systemd/system`, and add the following:
```
# This timer unit is for testing
# By David Both
# Licensed under GPL V2
#
[Unit]
Description=Logs some system statistics to the systemd journal
Requires=myMonitor.service
[Timer]
Unit=myMonitor.service
OnCalendar=*-*-* *:*:00
[Install]
WantedBy=timers.target
```
The `OnCalendar` time specification in the `myMonitor.timer file`, `*-*-* *:*:00`, should trigger the timer to execute the `myMonitor.service` unit every minute. I will explore `OnCalendar` settings a bit later in this article.
For now, observe any journal entries pertaining to running your service when it is triggered by the timer. You could also follow the timer, but following the service allows you to see the results in near real time. Run `journalctl` with the `-f` (follow) option:
```
[root@testvm1 system]# journalctl -S today -f -u myMonitor.service
\-- Logs begin at Mon 2020-06-08 07:47:20 EDT. --
```
Start but do not enable the timer, and see what happens after it runs for a while:
```
[root@testvm1 ~]# systemctl start myMonitor.service
[root@testvm1 ~]#
```
One result shows up right away, and the next ones come at—sort of—one-minute intervals. Watch the journal for a few minutes and see if you notice the same things I did:
```
[root@testvm1 system]# journalctl -S today -f -u myMonitor.service
\-- Logs begin at Mon 2020-06-08 07:47:20 EDT. --
Jun 13 08:39:18 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 13 08:39:18 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
Jun 13 08:39:19 testvm1.both.org free[630566]:               total        used        free      shared  buff/cache   available
Jun 13 08:39:19 testvm1.both.org free[630566]: Mem:       12635740      556604    10965516        8036     1113620    11785628
Jun 13 08:39:19 testvm1.both.org free[630566]: Swap:       8388604           0     8388604
Jun 13 08:39:18 testvm1.both.org systemd[1]: Finished Logs system statistics to the systemd journal.
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: sda             8:0    0  120G  0 disk
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: ├─sda1          8:1    0    4G  0 part /boot
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: └─sda2          8:2    0  116G  0 part
Jun 13 08:39:19 testvm1.both.org lsblk[630567]:   ├─VG01-root 253:0    0    5G  0 lvm  /
Jun 13 08:39:19 testvm1.both.org lsblk[630567]:   ├─VG01-swap 253:1    0    8G  0 lvm  [SWAP]
Jun 13 08:39:19 testvm1.both.org lsblk[630567]:   ├─VG01-usr  253:2    0   30G  0 lvm  /usr
Jun 13 08:39:19 testvm1.both.org lsblk[630567]:   ├─VG01-tmp  253:3    0   10G  0 lvm  /tmp
Jun 13 08:39:19 testvm1.both.org lsblk[630567]:   ├─VG01-var  253:4    0   20G  0 lvm  /var
Jun 13 08:39:19 testvm1.both.org lsblk[630567]:   └─VG01-home 253:5    0   10G  0 lvm  /home
Jun 13 08:39:19 testvm1.both.org lsblk[630567]: sr0            11:0    1 1024M  0 rom
Jun 13 08:40:46 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 13 08:40:46 testvm1.both.org free[630572]:               total        used        free      shared  buff/cache   available
Jun 13 08:40:46 testvm1.both.org free[630572]: Mem:       12635740      555228    10966836        8036     1113676    11786996
Jun 13 08:40:46 testvm1.both.org free[630572]: Swap:       8388604           0     8388604
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: sda             8:0    0  120G  0 disk
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: ├─sda1          8:1    0    4G  0 part /boot
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: └─sda2          8:2    0  116G  0 part
Jun 13 08:40:46 testvm1.both.org lsblk[630574]:   ├─VG01-root 253:0    0    5G  0 lvm  /
Jun 13 08:40:46 testvm1.both.org lsblk[630574]:   ├─VG01-swap 253:1    0    8G  0 lvm  [SWAP]
Jun 13 08:40:46 testvm1.both.org lsblk[630574]:   ├─VG01-usr  253:2    0   30G  0 lvm  /usr
Jun 13 08:40:46 testvm1.both.org lsblk[630574]:   ├─VG01-tmp  253:3    0   10G  0 lvm  /tmp
Jun 13 08:40:46 testvm1.both.org lsblk[630574]:   ├─VG01-var  253:4    0   20G  0 lvm  /var
Jun 13 08:40:46 testvm1.both.org lsblk[630574]:   └─VG01-home 253:5    0   10G  0 lvm  /home
Jun 13 08:40:46 testvm1.both.org lsblk[630574]: sr0            11:0    1 1024M  0 rom
Jun 13 08:40:46 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
Jun 13 08:40:46 testvm1.both.org systemd[1]: Finished Logs system statistics to the systemd journal.
Jun 13 08:41:46 testvm1.both.org systemd[1]: Starting Logs system statistics to the systemd journal...
Jun 13 08:41:46 testvm1.both.org free[630580]:               total        used        free      shared  buff/cache   available
Jun 13 08:41:46 testvm1.both.org free[630580]: Mem:       12635740      553488    10968564        8036     1113688    11788744
Jun 13 08:41:46 testvm1.both.org free[630580]: Swap:       8388604           0     8388604
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: sda             8:0    0  120G  0 disk
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: ├─sda1          8:1    0    4G  0 part /boot
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: └─sda2          8:2    0  116G  0 part
Jun 13 08:41:47 testvm1.both.org lsblk[630581]:   ├─VG01-root 253:0    0    5G  0 lvm  /
Jun 13 08:41:47 testvm1.both.org lsblk[630581]:   ├─VG01-swap 253:1    0    8G  0 lvm  [SWAP]
Jun 13 08:41:47 testvm1.both.org lsblk[630581]:   ├─VG01-usr  253:2    0   30G  0 lvm  /usr
Jun 13 08:41:47 testvm1.both.org lsblk[630581]:   ├─VG01-tmp  253:3    0   10G  0 lvm  /tmp
Jun 13 08:41:47 testvm1.both.org lsblk[630581]:   ├─VG01-var  253:4    0   20G  0 lvm  /var
Jun 13 08:41:47 testvm1.both.org lsblk[630581]:   └─VG01-home 253:5    0   10G  0 lvm  /home
Jun 13 08:41:47 testvm1.both.org lsblk[630581]: sr0            11:0    1 1024M  0 rom
Jun 13 08:41:47 testvm1.both.org systemd[1]: myMonitor.service: Succeeded.
Jun 13 08:41:47 testvm1.both.org systemd[1]: Finished Logs system statistics to the systemd journal.
```
Be sure to check the status of both the timer and the service.
You probably noticed at least two things in the journal. First, you do not need to do anything special to cause the `STDOUT` from the `ExecStart` triggers in the `myMonitor.service` unit to be stored in the journal. That is all part of using systemd for running services. However, it does mean that you might need to be careful about running scripts from a service unit and how much `STDOUT` they generate.
The second thing is that the timer does not trigger exactly on the minute at :00 seconds or even exactly one minute from the previous instance. This is intentional, but it can be overridden if necessary (or if it just offends your sysadmin sensibilities).
The reason for this behavior is to prevent multiple services from triggering at exactly the same time. For example, you can use time specifications such as Weekly, Daily, and more. These shortcuts are all defined to trigger at 00:00:00 hours on the day they are triggered. When multiple timers are specified this way, there is a strong likelihood that they would attempt to start simultaneously.
systemd timers are intentionally designed to trigger somewhat randomly around the specified time to try to prevent simultaneous triggers. They trigger semi-randomly within a time window that starts at the specified trigger time and ends at the specified time plus one minute. This trigger time is maintained at a stable position with respect to all other defined timer units, according to the `systemd.timer` man page. You can see in the journal entries above that the timer triggered immediately when it started and then about 46 or 47 seconds after each minute.
Most of the time, such probabilistic trigger times are fine. When scheduling tasks such as backups to run, so long as they run during off-hours, there will be no problems. A sysadmin can select a deterministic start time, such as 01:05:00 in a typical cron job specification, to not conflict with other tasks, but there is a large range of time values that will accomplish that. A one-minute bit of randomness in a start time is usually irrelevant.
However, for some tasks, exact trigger times are an absolute requirement. For those, you can specify greater trigger time-span accuracy (to within a microsecond) by adding a statement like this to the `Timer` section of the timer unit file:
```
`AccuracySec=1us`
```
Time spans can be used to specify the desired accuracy as well as to define time spans for repeating or one-time events. It recognizes the following units:
* usec, us, µs
* msec, ms
* seconds, second, sec, s
* minutes, minute, min, m
* hours, hour, hr, h
* days, day, d
* weeks, week, w
* months, month, M (defined as 30.44 days)
* years, year, y (defined as 365.25 days)
All the default timers in `/usr/lib/systemd/system` specify a much larger range for accuracy because exact times are not critical. Look at some of the specifications in the system-created timers:
```
[root@testvm1 system]# grep Accur /usr/lib/systemd/system/*timer
/usr/lib/systemd/system/fstrim.timer:AccuracySec=1h
/usr/lib/systemd/system/logrotate.timer:AccuracySec=1h
/usr/lib/systemd/system/logwatch.timer:AccuracySec=12h
/usr/lib/systemd/system/mlocate-updatedb.timer:AccuracySec=24h
/usr/lib/systemd/system/raid-check.timer:AccuracySec=24h
/usr/lib/systemd/system/unbound-anchor.timer:AccuracySec=24h
[root@testvm1 system]#
```
View the complete contents of some of the timer unit files in the `/usr/lib/systemd/system` directory to see how they are constructed.
You do not have to enable the timer in this experiment to activate it at boot time, but the command to do so would be:
```
`[root@testvm1 system]# systemctl enable myMonitor.timer`
```
The unit files you created do not need to be executable. You also did not enable the service unit because it is triggered by the timer. You can still trigger the service unit manually from the command line, should you want to. Try that and observe the journal.
See the man pages for `systemd.timer` and `systemd.time` for more information about timer accuracy, event-time specifications, and trigger events.
### Timer types
systemd timers have other capabilities that are not found in cron, which triggers only on specific, repetitive, real-time dates and times. systemd timers can be configured to trigger based on status changes in other systemd units. For example, a timer might be configured to trigger a specific elapsed time after system boot, after startup, or after a defined service unit activates. These are called monotonic timers. Monotonic refers to a count or sequence that continually increases. These timers are not persistent because they reset after each boot.
Table 1 lists the monotonic timers along with a short definition of each, as well as the `OnCalendar` timer, which is not monotonic and is used to specify future times that may or may not be repetitive. This information is derived from the `systemd.timer` man page with a few minor changes.
Timer | Monotonic | Definition
---|---|---
`OnActiveSec=` | X | This defines a timer relative to the moment the timer is activated.
`OnBootSec=` | X | This defines a timer relative to when the machine boots up.
`OnStartupSec=` | X | This defines a timer relative to when the service manager first starts. For system timer units, this is very similar to `OnBootSec=`, as the system service manager generally starts very early at boot. It's primarily useful when configured in units running in the per-user service manager, as the user service manager generally starts on first login only, not during boot.
`OnUnitActiveSec=` | X | This defines a timer relative to when the timer that is to be activated was last activated.
`OnUnitInactiveSec=` | X | This defines a timer relative to when the timer that is to be activated was last deactivated.
`OnCalendar=` | | This defines real-time (i.e., wall clock) timers with calendar event expressions. See `systemd.time(7)` for more information on the syntax of calendar event expressions. Otherwise, the semantics are similar to `OnActiveSec=` and related settings. This timer is the one most like those used with the cron service.
_Table 1: systemd timer definitions_
The monotonic timers can use the same shortcut names for their time spans as the `AccuracySec` statement mentioned before, but systemd normalizes those names to seconds. For example, you might want to specify a timer that triggers an event one time, five days after the system boots; that might look like: `OnBootSec=5d`. If the host booted at `2020-06-15 09:45:27`, the timer would trigger at `2020-06-20 09:45:27` or within one minute after.
### Calendar event specifications
Calendar event specifications are a key part of triggering timers at desired repetitive times. Start by looking at some specifications used with the `OnCalendar` setting.
systemd and its timers use a different style for time and date specifications than the format used in crontab. It is more flexible than crontab and allows fuzzy dates and times in the manner of the `at` command. It should also be familiar enough that it will be easy to understand.
The basic format for systemd timers using `OnCalendar=` is `DOW YYYY-MM-DD HH:MM:SS`. DOW (day of week) is optional, and other fields can use an asterisk (*) to match any value for that position. All calendar time forms are converted to a normalized form. If the time is not specified, it is assumed to be 00:00:00. If the date is not specified but the time is, the next match might be today or tomorrow, depending upon the current time. Names or numbers can be used for the month and day of the week. Comma-separated lists of each unit can be specified. Unit ranges can be specified with `..` between the beginning and ending values.
There are a couple interesting options for specifying dates. The Tilde (~) can be used to specify the last day of the month or a specified number of days prior to the last day of the month. The “/” can be used to specify a day of the week as a modifier.
Here are some examples of some typical time specifications used in `OnCalendar` statements.
Calendar event specification | Description
---|---
DOW YYYY-MM-DD HH:MM:SS |
*-*-* 00:15:30 | Every day of every month of every year at 15 minutes and 30 seconds after midnight
Weekly | Every Monday at 00:00:00
Mon *-*-* 00:00:00 | Same as weekly
Mon | Same as weekly
Wed 2020-*-* | Every Wednesday in 2020 at 00:00:00
Mon..Fri 2021-*-* | Every weekday in 2021 at 00:00:00
2022-6,7,8-1,15 01:15:00 | The 1st and 15th of June, July, and August of 2022 at 01:15:00am
Mon *-05~03 | The next occurrence of a Monday in May of any year which is also the 3rd day from the end of the month.
Mon..Fri *-08~04 | The 4th day preceding the end of August for any years in which it also falls on a weekday.
*-05~03/2 | The 3rd day from the end of the month of May and then again two days later. Repeats every year. Note that this expression uses the Tilde (~).
*-05-03/2 | The third day of the month of may and then every 2nd day for the rest of May. Repeats every year. Note that this expression uses the dash (-).
_Table 2: Sample `OnCalendar` event specifications_
### Test calendar specifications
systemd provides an excellent tool for validating and examining calendar time event specifications in a timer. The `systemd-analyze calendar` tool parses a calendar time event specification and provides the normalized form as well as other interesting information such as the date and time of the next "elapse," i.e., match, and the approximate amount of time before the trigger time is reached.
First, look at a date in the future without a time (note that the times for `Next elapse` and `UTC` will differ based on your local time zone):
```
[student@studentvm1 ~]$ systemd-analyze calendar 2030-06-17
  Original form: 2030-06-17                
Normalized form: 2030-06-17 00:00:00        
    Next elapse: Mon 2030-06-17 00:00:00 EDT
       (in UTC): Mon 2030-06-17 04:00:00 UTC
       From now: 10 years 0 months left    
[root@testvm1 system]#
```
Now add a time. In this example, the date and time are analyzed separately as non-related entities:
```
[root@testvm1 system]# systemd-analyze calendar 2030-06-17 15:21:16
  Original form: 2030-06-17                
Normalized form: 2030-06-17 00:00:00        
    Next elapse: Mon 2030-06-17 00:00:00 EDT
       (in UTC): Mon 2030-06-17 04:00:00 UTC
       From now: 10 years 0 months left    
  Original form: 15:21:16                  
Normalized form: *-*-* 15:21:16            
    Next elapse: Mon 2020-06-15 15:21:16 EDT
       (in UTC): Mon 2020-06-15 19:21:16 UTC
       From now: 3h 55min left              
[root@testvm1 system]#
```
To analyze the date and time as a single unit, enclose them together in quotes. Be sure to remove the quotes when using them in the `OnCalendar=` event specification in a timer unit or you will get errors:
```
[root@testvm1 system]# systemd-analyze calendar "2030-06-17 15:21:16"
Normalized form: 2030-06-17 15:21:16        
    Next elapse: Mon 2030-06-17 15:21:16 EDT
       (in UTC): Mon 2030-06-17 19:21:16 UTC
       From now: 10 years 0 months left    
[root@testvm1 system]#
```
Now test the entries in Table 2. I like the last one, especially:
```
[root@testvm1 system]# systemd-analyze calendar "2022-6,7,8-1,15 01:15:00"
  Original form: 2022-6,7,8-1,15 01:15:00
Normalized form: 2022-06,07,08-01,15 01:15:00
    Next elapse: Wed 2022-06-01 01:15:00 EDT
       (in UTC): Wed 2022-06-01 05:15:00 UTC
       From now: 1 years 11 months left
[root@testvm1 system]#
```
Lets look at one example in which we list the next five elapses for the timestamp expression.
```
[root@testvm1 ~]# systemd-analyze calendar --iterations=5 "Mon *-05~3"
  Original form: Mon *-05~3                
Normalized form: Mon *-05~03 00:00:00      
    Next elapse: Mon 2023-05-29 00:00:00 EDT
       (in UTC): Mon 2023-05-29 04:00:00 UTC
       From now: 2 years 11 months left    
       Iter. #2: Mon 2028-05-29 00:00:00 EDT
       (in UTC): Mon 2028-05-29 04:00:00 UTC
       From now: 7 years 11 months left    
       Iter. #3: Mon 2034-05-29 00:00:00 EDT
       (in UTC): Mon 2034-05-29 04:00:00 UTC
       From now: 13 years 11 months left    
       Iter. #4: Mon 2045-05-29 00:00:00 EDT
       (in UTC): Mon 2045-05-29 04:00:00 UTC
       From now: 24 years 11 months left    
       Iter. #5: Mon 2051-05-29 00:00:00 EDT
       (in UTC): Mon 2051-05-29 04:00:00 UTC
       From now: 30 years 11 months left    
[root@testvm1 ~]#
```
This should give you enough information to start testing your `OnCalendar` time specifications. The `systemd-analyze` tool can be used for other interesting analyses, which I will begin to explore in the next article in this series.
### Summary
systemd timers can be used to perform the same kinds of tasks as the cron tool but offer more flexibility in terms of the calendar and monotonic time specifications for triggering events.
Even though the service unit you created for this experiment is usually triggered by the timer, you can also use the `systemctl start myMonitor.service` command to trigger it at any time. Multiple maintenance tasks can be scripted in a single timer; these can be Bash scripts or Linux utility programs. You can run the service triggered by the timer to run all the scripts, or you can run individual scripts as needed.
I will explore systemd's use of time and time specifications in much more detail in the next article.
I have not yet seen any indication that `cron` and `at` will be deprecated. I hope that does not happen because `at`, at least, is much easier to use for one-off task scheduling than systemd timers.
### Resources
There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup.
* The Fedora Project has a good, practical [guide to systemd][5]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd.
* The Fedora Project also has a good [cheat sheet][6] that cross-references the old SystemV commands to comparable systemd ones.
* For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][7]'s [description of systemd][8].
* [Linux.com][9]'s "More systemd fun" offers more advanced systemd [information and tips][10].
There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers.
* [Rethinking PID 1][11]
* [systemd for Administrators, Part I][12]
* [systemd for Administrators, Part II][13]
* [systemd for Administrators, Part III][14]
* [systemd for Administrators, Part IV][15]
* [systemd for Administrators, Part V][16]
* [systemd for Administrators, Part VI][17]
* [systemd for Administrators, Part VII][18]
* [systemd for Administrators, Part VIII][19]
* [systemd for Administrators, Part IX][20]
* [systemd for Administrators, Part X][21]
* [systemd for Administrators, Part XI][22]
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/7/systemd-timers
作者:[David Both][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dboth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist)
[2]: https://opensource.com/article/17/11/how-use-cron-linux
[3]: https://opensource.com/users/dboth
[4]: https://opensource.com/article/20/5/manage-startup-systemd
[5]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html
[6]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet
[7]: http://Freedesktop.org
[8]: http://www.freedesktop.org/wiki/Software/systemd
[9]: http://Linux.com
[10]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/
[11]: http://0pointer.de/blog/projects/systemd.html
[12]: http://0pointer.de/blog/projects/systemd-for-admins-1.html
[13]: http://0pointer.de/blog/projects/systemd-for-admins-2.html
[14]: http://0pointer.de/blog/projects/systemd-for-admins-3.html
[15]: http://0pointer.de/blog/projects/systemd-for-admins-4.html
[16]: http://0pointer.de/blog/projects/three-levels-of-off.html
[17]: http://0pointer.de/blog/projects/changing-roots
[18]: http://0pointer.de/blog/projects/blame-game.html
[19]: http://0pointer.de/blog/projects/the-new-configuration-files.html
[20]: http://0pointer.de/blog/projects/on-etc-sysinit.html
[21]: http://0pointer.de/blog/projects/instances.html
[22]: http://0pointer.de/blog/projects/inetd.html

View File

@ -1,224 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer)
[#]: via: (https://itsfoss.com/32-bit-linux-distributions/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
11 Linux Distributions You Can Rely on for Your Ancient 32-bit Computer
======
If youve been keeping up with the latest [Linux distributions][1], you must have noticed that 32-bit support has been dropped from [most of the popular Linux distributions][2]. Arch Linux, Ubuntu, Fedora, everyone has dropped the support for this older architecture.
But, what if you have vintage hardware with you that still needs to be revived or you want to make use of it for something? Fret not, there are still a few options left to choose from for your 32-bit system.
In this article, Ive tried to compile some of the best Linux distributions that will keep on supporting 32-bit platform for next few years.
### Top Linux distributions that still offer 32-bit support
![][3]
This list is a bit different from [our earlier list of Linux distributions for old laptops][4]. Even 64-bit computers can be considered old if they were released before 2010. This is why some suggestions listed there included distros that only support 64-bit now.
The information presented here are correct as per my knowledge and findings but if you find otherwise, please let me know in the comment section.
Before you go on, I suppose you know [how to check if you have a 32 bit or 64 bit computer][5].
#### 1\. Debian
![Image Credits: mrneilypops / Deviantart][6]
Debian is a fantastic choice for 32-bit systems because they still support it with their latest stable release. At the time of writing this, the latest stable release **Debian 10 “buster”** offers a 32-bit version and is supported until 2024.
If youre new to Debian, it is worth mentioning that you get solid documentation for everything on their [official wiki][7]. So, it shouldnt be an issue to get started.
You can browse through the [available installers][8] to get it installed. However, before you proceed, I would recommend referring to the list of [things to remember before installing Debian][9] in addition to its [installation manual][10].
[Debian][11]
#### 2\. Slax
![][12]
If you just want to quickly boot up a device for some temporary work, Slax is an impressive option.
It is based on Debian but it aims to be a portable and fast option that is meant to be run through USB devices or DVDs. You can download the 32-bit ISO file from their website for free or purchase a rewritable DVD/encrypted pendrive with Slax pre-installed.
Of course, this isnt meant to replace a traditional desktop operating system. But, yes, you do get the 32-bit support with Debian as its base.
[Slax][13]
#### 3\. AntiX
![Image Credits: Opensourcefeed][14]
Yet another impressive Debian-based distribution. AntiX is popularly known as a systemd-free distribution which focuses on performance while being a lightweight installation.
It is perfectly suitable for just about any old 32-bit system. To give you an idea, it just needs 256 MB RAM and 2.7 GB storage space at the very least. Not just easy to install, but the user experience is focused for both newbies and experienced users as well.
You should get the latest version based on Debians latest stable branch available.
[AntiX][15]
#### 4\. openSUSE
![][16]
openSUSE is an independent Linux distribution that supports 32-bit systems as well. Even though the latest regular version (Leap) does not offer 32-bit images, the rolling release edition (Tumbleweed) does provide 32-bit image.
It will be an entirely different experience if youre new. However, I suggest you to go through the [reasons why you should be using openSUSE.][17]
It is mostly focused for developers and system administrators but you can utilize it as an average desktop user as well. It is worth noting that openSUSE is not meant to run on vintage hardware — so you have to make sure that you have at least 2 GB RAM, 40+ GB storage space, and a dual core processor.
[openSUSE][18]
#### 5\. Emmabuntüs
![][19]
Emmabuntus is an interesting distribution that aims to extend the life of the hardware to reduce waste of raw materials with 32-bit support. As a group theyre also involved in providing computers and digital technologies to schools.
It offers two different editions, one based on Ubuntu and the other based on Debian. If you want a longer 32-bit support, you may want to go with the Debian edition. It may not be the best option, but with a number of pre-configured software to make the Linux learning experience easy and 32-bit support, it is a decent option if you want to support their cause in the process.
[Emmanbuntus][20]
#### 6\. NixOS
![Nixos KDE Edition \(Image Credits: Distrowatch\)][21]
NixOS is yet another independent Linux distribution that supports 32-bit systems. It focuses on providing a reliable system where packages are isolated from each other.
This may not be directly geared towards average users but it is a KDE-powered usable distribution with a unique approach to package management. You can learn more about its [features][22] from its official website.
[NixOS][23]
#### 7\. Gentoo Linux
![][24]
If youre an experienced Linux user and looking for a 32-bit Linux distributions, Gentoo Linux should be a great choice.
You can easily configure, compile, and install a kernel through package manager with Gentoo Linux if you want. Not just limited to its configurability, which it is popularly known for, you will also be able to run it without any issues on older hardware.
Even if youre not an experienced user and want to give it a try, simply read through the [installation instructions][25] and you will be in for an adventure.
[Gentoo Linux][26]
#### 8\. Devuan
![][27]
[Devuan][28] is yet another systemd-free distribution. It is technically a fork of Debian, just without systemd and encouraging [Init freedom][29].
It may not be a very popular Linux distribution for an average user but if you want a systemd-free distribution and 32-bit support, Devuan should be a good option.
[Devuan][30]
#### 9\. Void Linux
![][31]
Void Linux is an interesting distribution independently developed by volunteers. It aims to be a general purpose OS while offering a stable rolling release cycle. It features runit as the init system instead of systemd and gives you the option of several [desktop environments][32].
It has an extremely impressive minimum requirement specification with just 96 MB of RAM paired up with Pentium 4 (or equivalent) chip. Try it out!
[Void Linux][33]
#### 10\. Q4OS
![][34]
Q4OS is another Debian-based distribution that focuses on providing a minimal and fast desktop user experience. It also happens to be one of the [best lightweight Linux distributions][4] in our list. It features the [Trinity desktop][35] for its 32-bit edition and you can find KDE Plasma support on 64-bit version.
Similar to Void Linux, Q4OS also runs on a bare minimum of at least 128 MB RAM and a 300 MHz CPU with a 3 GB storage space requirement. It should be more than enough for any vintage hardware. So, Id say, you should definitely try it out!
To know more about it, you can also check out [our review of Q4OS][36].
[Q$OS][37]
#### 11: MX Linux
![][38]
If youve got a slightly decent configuration (not completely vintage but old), MX Linux would be my personal recommendation for 32-bit systems. It also happens to be one of the [best Linux distributions][2] for every type of user.
In general, MX Linux is a fantastic lightweight and customizable distribution based on Debian. You get the option to choose from KDE, XFCE or Fluxbox (which is their own desktop environment for older hardware). You can explore more about it on their official website and give it a try.
[MX Linux][39]
### Honorable Mention: Funtoo
Funtoo is a Gentoo-based community-developed Linux distribution. It focuses on giving you the best performance with Gentoo Linux along with some extra packages to make the experience complete for users. It is also interesting to note that the development is actually led by Gentoo Linuxs creator **Daniel Robbins**.
Of course, if youre new to Linux, you may not have the best experience here. But, it does support 32-bit systems and works well across many older Intel/AMD chipsets. Explore more about it on its official website to see if you want to try it out.
[Funtoo][40]
### Wrapping Up
I focused the list on Debian-based and some Independent distributions. However, if you dont mind long term support and just want to get your hands on a 32-bit supported image, you can try any Ubuntu 18.04 based distributions (or any official flavour) as well.
At the time of writing this, they just have a few more months of software support left. Hence, I avoided mentioning it as the primary options. But, if you like Ubuntu 18.04 based distros or any of its flavours, you do have options like [LXLE][41], [Linux Lite][42], [Zorin Lite 15][43], and other official flavours.
Even though most modern desktop operating systems based on Ubuntu have dropped support for 32-bit support. You still have plenty of choices to go with.
What would you prefer to have on your 32-bit system? Let me know your thoughts in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/32-bit-linux-distributions/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/what-is-linux-distribution/
[2]: https://itsfoss.com/best-linux-distributions/
[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/32-bit-linux.png?resize=800%2C450&ssl=1
[4]: https://itsfoss.com/lightweight-linux-beginners/
[5]: https://itsfoss.com/32-bit-64-bit-ubuntu/
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/08/debian-screenshot.png?resize=800%2C450&ssl=1
[7]: https://wiki.debian.org/FrontPage
[8]: https://www.debian.org/releases/buster/debian-installer/
[9]: https://itsfoss.com/before-installing-debian/
[10]: https://www.debian.org/releases/buster/installmanual
[11]: https://www.debian.org/
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/slax-screenshot.jpg?resize=800%2C600&ssl=1
[13]: https://www.slax.org
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/antiX-19-1.jpg?resize=800%2C500&ssl=1
[15]: https://antixlinux.com
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/opensuse-15-1.png?resize=800%2C500&ssl=1
[17]: https://itsfoss.com/why-use-opensuse/
[18]: https://www.opensuse.org/
[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/Emmabuntus-xfce.png?resize=800%2C500&ssl=1
[20]: https://emmabuntus.org/
[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/nixos-kde.jpg?resize=800%2C500&ssl=1
[22]: https://nixos.org/features.html
[23]: https://nixos.org/
[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/gentoo-linux.png?resize=800%2C450&ssl=1
[25]: https://www.gentoo.org/get-started/
[26]: https://www.gentoo.org
[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/devuan-beowulf.jpg?resize=800%2C600&ssl=1
[28]: https://itsfoss.com/devuan-3-release/
[29]: https://www.devuan.org/os/init-freedom
[30]: https://www.devuan.org
[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/void-linux.jpg?resize=800%2C450&ssl=1
[32]: https://itsfoss.com/best-linux-desktop-environments/
[33]: https://voidlinux.org/
[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/q4os8Debonaire.jpg?resize=800%2C500&ssl=1
[35]: https://en.wikipedia.org/wiki/Trinity_Desktop_Environment
[36]: https://itsfoss.com/q4os-linux-review/
[37]: https://q4os.org/index.html
[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/mx-linux-19-2-kde.jpg?resize=800%2C452&ssl=1
[39]: https://mxlinux.org/
[40]: https://www.funtoo.org/Welcome
[41]: https://www.lxle.net/
[42]: https://www.linuxliteos.com
[43]: https://zorinos.com/download/15/lite/32/

View File

@ -1,201 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Getting started with Stratis encryption)
[#]: via: (https://fedoramagazine.org/getting-started-with-stratis-encryption/)
[#]: author: (briansmith https://fedoramagazine.org/author/briansmith/)
Getting started with Stratis encryption
======
![][1]
Stratis is described on its [official website][2] as an “_easy to use local storage management for Linux_.” See this [short video][3] for a quick demonstration of the basics. The video was recorded on a Red Hat Enterprise Linux 8 system. The concepts shown in the video also apply to Stratis in Fedora.
Stratis version 2.1 introduces support for encryption. Continue reading to learn how to get started with encryption in Stratis.
### Prerequisites
Encryption requires Stratis version 2.1 or greater. The examples in this post use a pre-release of Fedora 33. Stratis 2.1 will be available in the final release of Fedora 33.
Youll also need at least one available block device to create an encrypted pool. The examples shown below were done on a KVM virtual machine with a 5 GB virtual disk drive _(/dev/vdb_).
### Create a key in the kernel keyring
The Linux kernel keyring is used to store the encryption key. For more information on the kernel keyring, refer to the _keyrings_ manual page (_man keyrings_).  
Use the _stratis key set_ command to set up the key within the kernel keyring.  You must specify where the key should be read from. To read the key from standard input, use the _capture-key_ option. To retrieve the key from a file, use the _keyfile-path &lt;file&gt;_ option. The last parameter is a key description. It will be used later when you create the encrypted Stratis pool.
For example, to create a key with the description _pool1key_, and to read the key from standard input, you would enter:
```
# stratis key set --capture-key pool1key
Enter desired key data followed by the return key:
```
The command prompts us to type the key data / passphrase, and the key is then created within the kernel keyring.  
To verify that the key was created, run _stratis key list_:
```
# stratis key list
Key Description
pool1key
```
This verifies that the _pool1key_ was created. Note that these keys are not persistent. If the host is rebooted, the key will need to be provided again before the encrypted Stratis pool can be accessed (this process is covered later).
If you have multiple encrypted pools, they can have a separate keys, or they can share the same key.
The keys can also be viewed using the following _keyctl_ commands:
```
# keyctl get_persistent @s
318044983
# keyctl show
Session Keyring
701701270 --alswrv 0 0 keyring: _ses
649111286 --alswrv 0 65534 \_ keyring: _uid.0
318044983 ---lswrv 0 65534 \_ keyring: _persistent.0
1051260141 --alswrv 0 0 \_ user: stratis-1-key-pool1key
```
### Create the encrypted Stratis pool
Now that a key has been created for Stratis, the next step is to create the encrypted Stratis pool. Encrypting a pool can only be done at pool creation. It isnt currently possible to encrypt an existing pool.
Use the _stratis pool create_ command to create a pool. Add _key-desc_ and the key description that you provided in the previous step (_pool1key_). This will signal to Stratis that the pool should be encrypted using the provided key. The below example creates the Stratis pool on _/dev/vdb_, and names it _pool1_. Be sure to specify an empty/available device on your system.
```
# stratis pool create --key-desc pool1key pool1 /dev/vdb
```
You can verify that the pool has been created with the _stratis pool list_ command:
```
# stratis pool list
Name Total Physical Properties
pool1 4.98 GiB / 37.63 MiB / 4.95 GiB ~Ca, Cr
```
In the sample output shown above, _~Ca_ indicates that caching is disabled (the tilde negates the property). _Cr_ indicates that encryption is enabled.  Note that caching and encryption are mutually exclusive. Both features cannot be simultaneously enabled.
Next, create a filesystem. The below example, demonstrates creating a filesystem named _filesystem1_, mounting it at the _/filesystem1_ mountpoint, and creating a test file in the new filesystem:
```
# stratis filesystem create pool1 filesystem1
# mkdir /filesystem1
# mount /stratis/pool1/filesystem1 /filesystem1
# cd /filesystem1
# echo "this is a test file" > testfile
```
### Access the encrypted pool after a reboot
When you reboot youll notice that Stratis no longer shows your encrypted pool or its block device:
```
# stratis pool list
Name Total Physical Properties
```
```
# stratis blockdev list
Pool Name Device Node Physical Size Tier
```
To access the encrypted pool, first re-create the key with the same key description and key data / passphrase that you used previously:
```
# stratis key set --capture-key pool1key
Enter desired key data followed by the return key:
```
Next, run the _stratis pool unlock_ command, and verify that you can now see the pool and its block device:
```
# stratis pool unlock
# stratis pool list
Name Total Physical Properties
pool1 4.98 GiB / 583.65 MiB / 4.41 GiB ~Ca, Cr
# stratis blockdev list
Pool Name Device Node Physical Size Tier
pool1 /dev/dm-2 4.98 GiB Data
```
Next, mount the filesystem and verify that you can access the test file you created previously:
```
# mount /stratis/pool1/filesystem1 /filesystem1/
# cat /filesystem1/testfile
this is a test file
```
### Use a systemd unit file to automatically unlock a Stratis pool at boot
It is possible to automatically unlock your Stratis pool at boot without manual intervention. However, a file containing the key must be available. Storing the key in a file might be a security concern in some environments.
The systemd unit file shown below provides a simple method to unlock a Stratis pool at boot and mount the filesystem. Feedback on a better/alternative methods is welcome. You can provide suggestions in the comment section at the end of this article.
Start by creating your key file with the following command. Be sure to substitute _passphrase_ with the same key data / passphrase you entered previously.
```
# echo -n passphrase > /root/pool1key
```
Make sure that the file is only readable by root:
```
# chmod 400 /root/pool1key
# chown root:root /root/pool1key
```
Create a systemd unit file at _/etc/systemd/system/stratis-filesystem1.service_ with the following content:
```
[Unit]
Description = stratis mount pool1 filesystem1 file system
After = stratisd.service
[Service]
ExecStartPre=sleep 2
ExecStartPre=stratis key set --keyfile-path /root/pool1key pool1key
ExecStartPre=stratis pool unlock
ExecStartPre=sleep 3
ExecStart=mount /stratis/pool1/filesystem1 /filesystem1
RemainAfterExit=yes
[Install]
WantedBy = multi-user.target
```
Next, enable the service so that it will run at boot:
```
# systemctl enable stratis-filesystem1.service
```
Now reboot and verify that the Stratis pool has been automatically unlocked and that its filesystem is mounted.
### Summary and conclusion
In todays environment, encryption is a must for many people and organizations. This post demonstrated how to enable encryption in Stratis 2.1.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/getting-started-with-stratis-encryption/
作者:[briansmith][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/briansmith/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/stratis-encryption-2-816x345.jpg
[2]: https://stratis-storage.github.io/
[3]: https://www.youtube.com/watch?v=CJu3kmY-f5o

View File

@ -1,226 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (9 Open Source Forum Software That You Can Deploy on Your Linux Servers)
[#]: via: (https://itsfoss.com/open-source-forum-software/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
9 Open Source Forum Software That You Can Deploy on Your Linux Servers
======
_**Looking to have a community forum or customer support portal? Here are some of the best open source forum software you can deploy on your servers.**_
Just like our [Its FOSS Community][1] forum, it is important to always build a platform where like-minded people can discuss, interact, and seek support.
A forum gives users (or customers) a space to reach out for something that they cannot easily find on the Internet for the most part.
If you are an enterprise, you may hire a team of developers and build your own forum the way you want but that adds a lot of cost to your budget.
Fortunately, there are several impressive open source forum software that you can deploy on your server and youre good to go! You will save a lot of money in the process and still get what you need.
Here, I have compiled a list of best open source forum software that you can install on your Linux server.
### Best open source forum software to build a community portal
![][2]
In case you havent built a website yet, you might want to take a look at [some open-source website creation tools][3] before you deploy a forum.
_**Note:** The list is in no particular order of ranking._
#### 1\. Discourse (modern and popular)
![][4]
Discourse is the most popular modern forum software that people deploy to set up their discussion platforms. In fact, our [Its FOSS community][1] forum utilizes the Discourse platform.
It offers most of the essential features that Im aware of which includes email notifications, moderation tools, style customization options, third-part integrations like Slack/WordPress, and more.
It is completely free to self-host and you can find the project on [GitHub][5] as well. If you do not need the hassle of deploying it on a self-managed server, you can always choose to opt for [managed services offered by Discourse][6] itself (which will be certainly expensive).
[Discourse][7]
#### 2\. Talkyard (inspired by Discourse and StackOverflow)
![][8]
Talkyard is completely free to use and an open-source project. It looks close to Discourse but there are distinctions if you inspect it.
You get most of the key features from StackOverflow here along with all essential features that you would expect on a forum platform. It may not be a popular forum solution but if you want something similar to Discourse along with some interesting features, this is worth trying out.
You can explore more about it in their [GitHub page][9].
[Talkyard][10]
#### 3\. NodeBB (Modern and full of features)
![][11]
NodeBB is an open-source forum software based on [Node.js][12]. It aims to be simple, elegant, and fast as well. Primarily, it is geared towards organizations and enterprises with managed hosting plans available. But, you can choose to host it yourself as well.
You get a real-time native analytics feature along with chat and notification support as well. It also offers an API, if you want to integrate it with any of your existing product. It also supports moderation tools and tools to fight spam.
You get some 3rd party integration support out of the box like WordPress, Mailchimp, etc.
Explore more about it in their [GitHub page][13] or the official website.
[NodeBB][14]
#### 4\. Vanilla Forums (enterprise focused)
![][15]
Vanilla Forums is primarily an enterprise focused forum software with essential features to brand your platform, offer a Q/A for customers, and also gives the ability to vote on posts.
The user experience is geared with a modern look and is being used by the likes of EA, Adobe, and some other big shot companies.
Of course, if you want to try the cloud-based Vanilla Forums (managed by a team of professionals) along with the access to some premium features, feel free to request a Demo. In either case, you can opt for the community edition, which is free to use with most of the latest features with the responsibility of hosting it yourself and managing it.
You can explore more about it on their official website and [GitHub page][16].
[Vanilla Forums][17]
**Recommended Read:**
![][18]
#### [Best Open Source eCommerce Platforms to Build Online Shopping Websites][19]
Want to create an online shopping website? Here are some open source ecommerce platforms you can deploy on your own Linux server.
#### 5\. bbPress (from WordPress)
![][20]
bbPress is a solid forum software built by the creators of WordPress. It aims to provide a simple and snappy forum experience.
The user interface would seem old-school but it is easy to use and offers the basic functionalities that you would normally look for in a forum software. The moderation tools are simple and easy to set up. You can extend the functionality using plugins available and choose from several themes available to tweak the look and feel of your forum.
If you just want a simple forum platform with no fancy features, bbPress should be perfect. You can also check out their [GitHub page][21] for more information.
[bbPress][22]
#### 6\. phpBB (classic forum software)
![][23]
If you want a traditional forum design and just want the basic functionalities, phpBB software is a good choice. Of course, you may not get the best user experience or the features, but it is functional and quite effective as a traditional-design forum plaform.
Especially, for users comfortable with the traditional approach, it will be a simple and effective solution.
Not just limited to the simplicity, but also it is way easier to set up with an average hosting provider. You get a 1-click installation feature on every shared hosting platform, so you do not need a lot of technical knowledge to set it up as well.
You can explore more about it in their official website or the [GitHub page][24].
[phpBB][25]
#### 7\. Simple Machines Forum (another classic)
![][26]
Similar to php BB, Simple Machines forum is yet another basic (or simple) implementation of a forum platform. You may not be able to customize the look and feel by a long extent (not easily at least) but the default look is clean and offers a good user experience.
Personally, I like it better than php BB, but you can head to their [official website][27] to explore more about it. Also, you can easily install Simple Machines Forum on any shared hosting service using the 1-click installation method.
[Simple Machines Forum][27]
#### 8\. FluxBB (old school)
![][28]
FluxBB is yet another simple and lightweight open source forum. When compared to some others, it may not be super actively maintained but if you just want to deploy a basic forum with a few users, you can easily give this a try.
You can explore more about it in their official website and the [GitHub page][29].
[FluxBB][30]
#### 9\. MyBB (less popular but worth a look)
![][31]
MyBB is a unique open-source forum software that offers a wide range of styles and includes essential features youll need.
Starting from plugin support and moderation tools, you get everything necessary needed to manage a big community. It also supports private messaging to individual users similar to Discourse and similar forum software.
It may not be a popular option but it checks out for most of the use-cases and it completely free. You might want to support and explore the project on [GitHub][32] as well.
[MyBB][33]
#### Bonus: Flarum (in beta)
![][34]
If you want something simpler and unique, have a look at Flarum. It is a lightweight forum software which aims to be mobile-first while offering a fast experience.
It supports some third-party integrations and you can extend the functionality using extensions as well. Personally, it looks beautiful to me. I havent got a chance to try it you can take a look at its [documentation][35] and it is safe to assume that it features all the necessary features for a forum.
It is worth noting that Flarum is fairly new so it is still in beta. You might want to deploy it on your test server first before taking a leap of faith on your production environment. Do check out their [GitHub page][36] for more details.
[Flarum][37]
Cant self-host? Let us help you
Deploying open source applications and managing Linux servers takes some expertise and time. If you lack either but still want to have your own instance of open source software, we can help you out.
With our new project, [High on Cloud][38], you can leave the deployment and server management part to us while you work on growing your community forum.
### Wrapping Up
Most of the open source forum software offer pretty much the same features for basic use-case. If you are looking for something specific, you might want to explore their documentations.
Personally, I recommend Discourse. It is popular, modern looking and has a significant user base.
What do you think is the best open source forum software? Did I miss any of your favorites? Let me know in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/open-source-forum-software/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.community/
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/12/open-source-forum-software.png?resize=800%2C450&ssl=1
[3]: https://itsfoss.com/open-source-cms/
[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/itsfoss-community-discourse.jpg?resize=800%2C561&ssl=1
[5]: https://github.com/discourse/discourse
[6]: https://discourse.org/buy
[7]: https://www.discourse.org/
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/talkyard-forum.jpg?resize=800%2C598&ssl=1
[9]: https://github.com/debiki/talkyard
[10]: https://www.talkyard.io/
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/nodebb.jpg?resize=800%2C369&ssl=1
[12]: https://nodejs.org/en/
[13]: https://github.com/NodeBB/NodeBB
[14]: https://nodebb.org/
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/vanilla-forums.png?resize=800%2C433&ssl=1
[16]: https://github.com/Vanilla
[17]: https://vanillaforums.com/en/
[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/open-source-eCommerce.png?fit=800%2C450&ssl=1
[19]: https://itsfoss.com/open-source-ecommerce/
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/bbpress.jpg?resize=800%2C552&ssl=1
[21]: https://github.com/bbpress
[22]: https://bbpress.org/
[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/phpBB.png?resize=798%2C600&ssl=1
[24]: https://github.com/phpbb/phpbb
[25]: https://www.phpbb.com/
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/simplemachines.jpg?resize=800%2C343&ssl=1
[27]: https://www.simplemachines.org/
[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/FluxBB.jpg?resize=800%2C542&ssl=1
[29]: https://github.com/fluxbb/fluxbb/
[30]: https://fluxbb.org/
[31]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/mybb-example.png?resize=800%2C461&ssl=1
[32]: https://github.com/mybb/mybb
[33]: https://mybb.com/
[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/flarum-screenshot.png?resize=800%2C503&ssl=1
[35]: https://docs.flarum.org/
[36]: https://github.com/flarum
[37]: https://flarum.org/
[38]: https://highoncloud.com/

View File

@ -1,141 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Program a simple game with Elixir)
[#]: via: (https://opensource.com/article/20/12/elixir)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
Program a simple game with Elixir
======
Learn Elixir by programming a "guess the number" game and comparing the
language against ones you know.
![A die with rainbow color background][1]
To you learn a new programming language, it's good to focus on the things most programming languages have in common:
* Variables
* Expressions
* Statements
These concepts are the basis of most programming languages. Because of these similarities, once you know one programming language, you can start figuring another one out by recognizing its differences.
Another good tool for learning a new language is starting with a standard program. This allows you to focus on the language, not the program's logic. We're doing that in this article series using a "guess the number" program, in which the computer picks a number between one and 100 and asks you to guess it. The program loops until you guess the number correctly.
The "guess the number" program exercises several concepts in programming languages:
* Variables
* Input
* Output
* Conditional evaluation
* Loops
It's a great practical experiment to learn a new programming language.
### Guess the number in Elixir
The [Elixir][2] programming language is a dynamically typed functional language designed for building stable and maintainable applications. It runs on top of the same virtual machine as [Erlang][3] and shares many of its strengths—but with slightly easier syntax.
You can explore Elixir by writing a version of the "guess the number" game.
Here is my implementation:
```
defmodule Guess do
  def guess() do
     random = Enum.random(1..100)
     IO.puts "Guess a number between 1 and 100"
     Guess.guess_loop(random)
  end
  def guess_loop(num) do
    data = IO.read(:stdio, :line)
    {guess, _rest} = Integer.parse(data)
    cond do
      guess &lt; num -&gt;
        IO.puts "Too low!"
        guess_loop(num)
      guess &gt; num -&gt;
        IO.puts "Too high!"
        guess_loop(num)
      true -&gt;
        IO.puts "That's right!"
    end
  end
end
Guess.guess()
```
To assign a value to a variable, list the variable's name followed by the `=` sign. For example, the statement `random = 0` assigns a zero value to the `random` variable.
The script starts by defining a **module**. In Elixir, only modules can have named functions in them.
The next line defines the function that will serve as the entry point, `guess()`, which:
* Calls the `Enum.random()` function to get a random integer
* Prints the game prompt
* Calls the function that will serve as the loop
The rest of the game logic is implemented in the `guess_loop()` function.
The `guess_loop()` function uses [tail recursion][4] to loop. There are several ways to do looping in Elixir, but using tail recursion is a common one. The last thing `guess_loop()` does is call _itself_.
The first line in `guess_loop()` reads the input from the user. The next line uses `parse()` to convert the input to an integer.
The `cond` statement is Elixir's version of a multi-branch statement. Unlike `if/elif` or `if/elsif` in other languages, Elixir does not treat the first nor the last branch in a different way.
This `cond` statement has a three-way branch: The guess can be smaller, bigger, or equal to the random number. The first two options output the inequality's direction and then tail-call `guess_loop()`, looping back to the beginning. The last option outputs `That's right`, and the function finishes.
### Sample output
Now that you've written your Elixir program, you can run it to play the "guess the number" game. Every time you run the program, Elixir will pick a different random number, and you can guess until you find the correct number:
```
$ elixir guess.exs
Guess a number between 1 and 100
50
Too high
30
Too high
20
Too high
10
Too low
15
Too high
13
Too low
14
That's right!
```
This "guess the number" game is a great introductory program for learning a new programming language because it exercises several common programming concepts in a pretty straightforward way. By implementing this simple game in different programming languages, you can demonstrate some core concepts of the languages and compare their details.
Do you have a favorite programming language? How would you write the "guess the number" game in it? Follow this article series to see examples of other programming languages that might interest you.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/12/elixir
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dice_tabletop_board_gaming_game.jpg?itok=y93eW7HN (A die with rainbow color background)
[2]: https://elixir-lang.org/
[3]: https://www.erlang.org/
[4]: https://en.wikipedia.org/wiki/Tail_call

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: (amwps290)
[#]: translator: (cooljelly)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: (MZqk)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,190 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Improve your productivity with this Linux automation tool)
[#]: via: (https://opensource.com/article/21/2/linux-autokey)
[#]: author: (Matt Bargenquast https://opensource.com/users/mbargenquast)
Improve your productivity with this Linux automation tool
======
Configure your keyboard to correct common typos, enter frequently used
phrases, and more with AutoKey.
![Linux keys on the keyboard for a desktop computer][1]
[AutoKey][2] is an open source Linux desktop automation tool that, once it's part of your workflow, you'll wonder how you ever managed without. It can be a transformative tool to improve your productivity or simply a way to reduce the physical stress associated with typing.
This article will look at how to install and start using AutoKey, cover some simple recipes you can immediately use in your workflow, and explore some of the advanced features that AutoKey power users may find attractive.
### Install and set up AutoKey
AutoKey is available as a software package on many Linux distributions. The project's [installation guide][3] contains directions for many platforms, including building from source. This article uses Fedora as the operating platform.
AutoKey comes in two variants: autokey-gtk, designed for [GTK][4]-based environments such as GNOME, and autokey-qt, which is [QT][5]-based.
You can install either variant from the command line:
```
`sudo dnf install autokey-gtk`
```
Once it's installed, run it by using `autokey-gtk` (or `autokey-qt`).
### Explore the interface
Before you set AutoKey to run in the background and automatically perform actions, you will first want to configure it. Bring up the configuration user interface (UI):
```
`autokey-gtk -c`
```
AutoKey comes preconfigured with some examples. You may wish to leave them while you're getting familiar with the UI, but you can delete them if you wish.
![AutoKey UI][6]
(Matt Bargenquast, [CC BY-SA 4.0][7])
The left pane contains a folder-based hierarchy of phrases and scripts. _Phrases_ are text that you want AutoKey to enter on your behalf. _Scripts_ are dynamic, programmatic equivalents that can be written using Python and achieve basically the same result of making the keyboard send keystrokes to an active window.
The right pane is where the phrases and scripts are built and configured.
Once you're happy with your configuration, you'll probably want to run AutoKey automatically when you log in so that you don't have to start it up every time. You can configure this in the **Preferences** menu (**Edit -&gt; Preferences**) by selecting **Automatically start AutoKey at login**.
![Automatically start AutoKey at login][8]
(Matt Bargenquast, [CC BY-SA 4.0][7])
### Correct common typos with AutoKey
Fixing common typos is an easy problem for AutoKey to fix. For example, I consistently type "gerp" instead of "grep." Here's how to configure AutoKey to fix these types of problems for you.
Create a new subfolder where you can group all your "typo correction" configurations. Select **My Phrases** in the left pane, then **File -&gt; New -&gt; Subfolder**. Name the subfolder **Typos**.
Create a new phrase in **File -&gt; New -&gt; Phrase**, and call it "grep."
Configure AutoKey to insert the correct word by highlighting the phrase "grep" then entering "grep" in the **Enter phrase contents** section (replacing the default "Enter phrase contents" text).
Next, set up how AutoKey triggers this phrase by defining an Abbreviation. Click the **Set** button next to **Abbreviations** at the bottom of the UI.
In the dialog box that pops up, click the **Add** button and add "gerp" as a new abbreviation. Leave **Remove typed abbreviation** checked; this is what instructs AutoKey to replace any typed occurrence of the word "gerp" with "grep." Leave **Trigger when typed as part of a word** unchecked so that if you type a word containing "gerp" (such as "fingerprint"), it _won't_ attempt to turn that into "fingreprint." It will work only when "gerp" is typed as an isolated word.
![Set abbreviation in AutoKey][9]
(Matt Bargenquast, [CC BY-SA 4.0][7])
### Restrict corrections to specific applications
You may want a correction to apply only when you make the typo in certain applications (such as a terminal window). You can configure this by setting a Window Filter. Click the **Set** button to define one.
The easiest way to set a Window Filter is to let AutoKey detect the window type for you:
1. Start a new terminal window.
2. Back in AutoKey, click the **Detect Window Properties** button.
3. Click on the terminal window.
This will auto-populate the Window Filter, likely with a Window class value of `gnome-terminal-server.Gnome-terminal`. This is sufficient, so click **OK**.
![AutoKey Window Filter][10]
(Matt Bargenquast, [CC BY-SA 4.0][7])
### Save and test
Once you're satisfied with your new configuration, make sure to save it. Click **File** and choose **Save** to make the change active.
Now for the grand test! In your terminal window, type "gerp" followed by a space, and it should automatically correct to "grep." To validate the Window Filter is working, try typing the word "gerp" in a browser URL bar or some other application. It should not change.
You may be thinking that this problem could have been solved just as easily with a [shell alias][11], and I'd totally agree! Unlike aliases, which are command-line oriented, AutoKey can correct mistakes regardless of what application you're using.
For example, another common typo I make is "openshfit" instead of "openshift," which I type into browsers, integrated development environments, and terminals. Aliases can't quite help with this problem, whereas AutoKey can correct it in any occasion.
### Type frequently used phrases with AutoKey
There are numerous other ways you can invoke AutoKey's phrases to help you. For example, as a site reliability engineer (SRE) working on OpenShift, I frequently type Kubernetes namespace names on the command line:
```
`oc get pods -n openshift-managed-upgrade-operator`
```
These namespaces are static, so they are ideal phrases that AutoKey can insert for me when typing ad-hoc commands.
For this, I created a phrase subfolder named **Namespaces** and added a phrase entry for each namespace I type frequently.
### Assign hotkeys
Next, and most crucially, I assign the subfolder a **hotkey**. Whenever I press that hotkey, it opens a menu where I can select (either with **Arrow key**+**Enter** or using a number) the phrase I want to insert. This cuts down on the number of keystrokes I need to enter those commands to just a few keystrokes.
AutoKey's pre-configured examples in the **My Phrases** folder are configured with a **Ctrl**+**F7** hotkey. If you kept the examples in AutoKey's default configuration, try it out. You should see a menu of all the phrases available there. Select the item you want with the number or arrow keys.
### Advanced AutoKeying
AutoKey's [scripting engine][12] allows users to run Python scripts that can be invoked through the same abbreviation and hotkey system. These scripts can do things like switching windows, sending keystrokes, or performing mouse clicks through supporting API functions.
AutoKey users have embraced this feature by publishing custom scripts for others to adopt. For example, the [NumpadIME script][13] transforms a numeric keyboard into an old cellphone-style text entry method, and [Emojis-AutoKey][14] makes it easy to insert emojis by converting phrases such as `:smile:` into their emoji equivalent.
Here's a small script I set up that enters Tmux's copy mode to copy the first word from the preceding line into the paste buffer:
```
from time import sleep
# Send the tmux command prefix (changed from b to s)
keyboard.send_keys("&lt;ctrl&gt;+s")
# Enter copy mode
keyboard.send_key("[")
sleep(0.01)
# Move cursor up one line
keyboard.send_keys("k")
sleep(0.01)
# Move cursor to start of line
keyboard.send_keys("0")
sleep(0.01)
# Start mark
keyboard.send_keys(" ")
sleep(0.01)
# Move cursor to end of word
keyboard.send_keys("e")
sleep(0.01)
# Add to copy buffer
keyboard.send_keys("&lt;ctrl&gt;+m")
```
The sleeps are there because occasionally Tmux can't keep up with how fast AutoKey sends the keystrokes, and they have a negligible effect on the overall execution time.
### Automate with AutoKey
I hope you've enjoyed this excursion into keyboard automation with AutoKey and it gives you some bright ideas about how it can improve your workflow. If you're using AutoKey in a helpful or novel way, be sure to share it in the comments below.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/2/linux-autokey
作者:[Matt Bargenquast][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mbargenquast
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
[2]: https://github.com/autokey/autokey
[3]: https://github.com/autokey/autokey/wiki/Installing
[4]: https://www.gtk.org/
[5]: https://www.qt.io/
[6]: https://opensource.com/sites/default/files/uploads/autokey-defaults.png (AutoKey UI)
[7]: https://creativecommons.org/licenses/by-sa/4.0/
[8]: https://opensource.com/sites/default/files/uploads/startautokey.png (Automatically start AutoKey at login)
[9]: https://opensource.com/sites/default/files/uploads/autokey-set_abbreviation.png (Set abbreviation in AutoKey)
[10]: https://opensource.com/sites/default/files/uploads/autokey-window_filter.png (AutoKey Window Filter)
[11]: https://opensource.com/article/19/7/bash-aliases
[12]: https://autokey.github.io/index.html
[13]: https://github.com/luziferius/autokey_scripts
[14]: https://github.com/AlienKevin/Emojis-AutoKey

View File

@ -1,101 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (scvoet)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to Add Fingerprint Login in Ubuntu and Other Linux Distributions)
[#]: via: (https://itsfoss.com/fingerprint-login-ubuntu/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
How to Add Fingerprint Login in Ubuntu and Other Linux Distributions
======
Many high-end laptops come with fingerprint readers these days. Windows and macOS have been supporting fingerprint login for some time. In desktop Linux, the support for fingerprint login was more of geeky tweaks but [GNOME][1] and [KDE][2] have started supporting it through system settings.
This means that on newer Linux distribution versions, you can easily use fingerprint reading. I am going to enable fingerprint login in Ubuntu here but you may use the steps on other distributions running GNOME 3.38.
Prerequisite
This is obvious, of course. Your computer must have a fingerprint reader.
This method works for any Linux distribution running GNOME version 3.38 or higher. If you are not certain, you may [check which desktop environment version you are using][3].
KDE 5.21 also has a fingerprint manager. The screenshots will look different, of course.
### Adding fingerprint login in Ubuntu and other Linux distributions
Go to **Settings** and the click on **Users** from left sidebar. You should see all the user account on your system here. Youll see several option including **Fingerprint Login**.
Click on the Fingerprint Login option here.
![Enable fingerprint login in Ubuntu][4]
It will immediately ask you to scan a new fingerprint. When you click the + sign to add a fingerprint, it presents a few predefined options so that you can easily identify which finger or thumb it is.
You may of course scan left thumb by clicking right index finger though I dont see a good reason why you would want to do that.
![Adding fingerprint][5]
While adding the fingerprint, rotate your finger or thumb as directed.
![Rotate your finger][6]
Once the system registers the entire finger, it will give you a green signal that the fingerprint has been added.
![Fingerprint successfully added][7]
If you want to test it right away, lock the screen by pressing Super+L keyboard shortcut in Ubuntu and then using the fingerprint for login.
![Login With Fingerprint in Ubuntu][8]
#### Experience with fingerprint login on Ubuntu
Fingerprint login is what its name suggests: login using your fingerprint. Thats it. You cannot use your finger when it asks for authentication for programs that need sudo access. Its not a replacement of your password.
One more thing. The fingerprint login allows you to log in but you cannot use your finger when your system asks for sudo password. The [keyring in Ubuntu][9] also remains locked.
Another annoying thing is because of GNOMEs GDM login screen. When you login, you have to click on your account first to get to the password screen. This is where you can use your finger. It would have been nicer to not bothered about clicking the user account ID first.
I also notice that fingerprint reading is not as smooth and quick as it is in Windows. It works, though.
If you are somewhat disappointed with the fingerprint login on Linux, you may disable it. Let me show you the steps in the next section.
### Disable fingerprint login
Disabling fingerprint login is pretty much the same as enabling it in the first place.
Go to **Settings→User** and then click on Fingerprint Login option. It will show a screen with options to add more fingerprints or delete the existing ones. You need to delete the existing fingerprints.
![Disable Fingerprint Login][10]
Fingerprint login does have some benefits, specially for lazy people like me. I dont have to type my password every time I lock the screen and I am happy with the limited usage.
Enabling sudo with fingerprint should not be entirely impossible with [PAM][11]. I remember that when I [set up face unlock in Ubuntu][12], it could be used with sudo as well. Lets see if future versions add this feature.
Do you have a laptop with fingerprint reader? Do you use it often or is it just one of things you dont care about?
--------------------------------------------------------------------------------
via: https://itsfoss.com/fingerprint-login-ubuntu/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://www.gnome.org/
[2]: https://kde.org/
[3]: https://itsfoss.com/find-desktop-environment/
[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/02/enable-fingerprint-ubuntu.png?resize=800%2C607&ssl=1
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/adding-fingerprint-login-ubuntu.png?resize=800%2C496&ssl=1
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/adding-fingerprint-ubuntu-linux.png?resize=800%2C603&ssl=1
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/fingerprint-added-ubuntu.png?resize=797%2C510&ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/02/login-with-fingerprint-ubuntu.jpg?resize=800%2C320&ssl=1
[9]: https://itsfoss.com/ubuntu-keyring/
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/02/disable-fingerprint-login.png?resize=798%2C524&ssl=1
[11]: https://tldp.org/HOWTO/User-Authentication-HOWTO/x115.html
[12]: https://itsfoss.com/face-unlock-ubuntu/

View File

@ -1,139 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (cooljelly)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Network address translation part 2 the conntrack tool)
[#]: via: (https://fedoramagazine.org/network-address-translation-part-2-the-conntrack-tool/)
[#]: author: (Florian Westphal https://fedoramagazine.org/author/strlen/)
Network address translation part 2 the conntrack tool
======
![][1]
This is the second article in a series about network address translation (NAT). The first article introduced [how to use the iptables/nftables packet tracing feature][2] to find the source of NAT-related connectivity problems. Part 2 introduces the “conntrack” command. conntrack allows you to inspect and modify tracked connections.
### Introduction
NAT configured via iptables or nftables builds on top of netfilters connection tracking facility. The _conntrack_ command is used to inspect and alter the state table. It is part of the “conntrack-tools” package.
### Conntrack state table
The connection tracking subsystem keeps track of all packet flows that it has seen. Run “_sudo conntrack -L_” to see its content:
```
tcp 6 43184 ESTABLISHED src=192.168.2.5 dst=10.25.39.80 sport=5646 dport=443 src=10.25.39.80 dst=192.168.2.5 sport=443 dport=5646 [ASSURED] mark=0 use=1
tcp 6 26 SYN_SENT src=192.168.2.5 dst=192.168.2.10 sport=35684 dport=443 [UNREPLIED] src=192.168.2.10 dst=192.168.2.5 sport=443 dport=35684 mark=0 use=1
udp 17 29 src=192.168.8.1 dst=239.255.255.250 sport=48169 dport=1900 [UNREPLIED] src=239.255.255.250 dst=192.168.8.1 sport=1900 dport=48169 mark=0 use=1
```
Each line shows one connection tracking entry. You might notice that each line shows the addresses and port numbers twice and even with inverted address and port pairs! This is because each entry is inserted into the state table twice. The first address quadruple (source and destination address and ports) are those recorded in the original direction, i.e. what the initiator sent. The second quadruple is what conntrack expects to see when a reply from the peer is received. This solves two problems:
1. If a NAT rule matches, such as IP address masquerading, this is recorded in the reply part of the connection tracking entry and can then be automatically applied to all future packets that are part of the same flow.
2. A lookup in the state table will be successful even if its a reply packet to a flow that has any form of network or port address translation applied.
The original (first shown) quadruple stored never changes: Its what the initiator sent. NAT manipulation only alters the reply (second) quadruple because that is what the receiver will see. Changes to the first quadruple would be pointless: netfilter has no control over the initiators state, it can only influence the packet as it is received/forwarded. When a packet does not map to an existing entry, conntrack may add a new state entry for it. In the case of UDP this happens automatically. In the case of TCP conntrack can be configured to only add the new entry if the TCP packet has the [SYN bit][3] set. By default conntrack allows mid-stream pickups to not cause problems for flows that existed prior to conntrack becoming active.
### Conntrack state table and NAT
As explained in the previous section, the reply tuple listed contains the NAT information. Its possible to filter the output to only show entries with source or destination nat applied. This allows to see which kind of NAT transformation is active on a given flow. _“sudo conntrack -L -p tcp src-nat_” might show something like this:
```
tcp 6 114 TIME_WAIT src=10.0.0.10 dst=10.8.2.12 sport=5536 dport=80 src=10.8.2.12 dst=192.168.1.2 sport=80 dport=5536 [ASSURED]
```
This entry shows a connection from 10.0.0.10:5536 to 10.8.2.12:80. But unlike the previous example, the reply direction is not just the inverted original direction: the source address is changed. The destination host (10.8.2.12) sends reply packets to 192.168.1.2 instead of 10.0.0.10. Whenever 10.0.0.10 sends another packet, the router with this entry replaces the source address with 192.168.1.2. When 10.8.2.12 sends a reply, it changes the destination back to 10.0.0.10. This source NAT is due to a [nft masquerade][4] rule:
```
inet nat postrouting meta oifname "veth0" masquerade
```
Other types of NAT rules, such as “dnat to” or “redirect to” would be shown in a similar fashion, with the reply tuples destination different from the original one.
### Conntrack extensions
Two useful extensions are conntrack accounting and timestamping. _“sudo sysctl net.netfilter.nf_conntrack_acct=1”_ makes _“sudo conntrack -L_” track byte and packet counters for each flow.
_“sudo sysctl net.netfilter.nf_conntrack_timestamp=1”_ records a “start timestamp” for each connection. _“sudo conntrack -L”_ then displays the seconds elapsed since the flow was first seen. Add “_output ktimestamp_” to see the absolute start date as well.
### Insert and change entries
You can add entries to the state table. For example:
```
sudo conntrack -I -s 192.168.7.10 -d 10.1.1.1 --protonum 17 --timeout 120 --sport 12345 --dport 80
```
This is used by conntrackd for state replication. Entries of an active firewall are replicated to a standby system. The standby system can then take over without breaking connectivity even on established flows. Conntrack can also store metadata not related to the packet data sent on the wire, for example the conntrack mark and connection tracking labels. Change them with the “update” (-U) option:
```
sudo conntrack -U -m 42 -p tcp
```
This changes the connmark of all tcp flows to 42.
### **Delete entries**
In some cases, you want to delete enries from the state table. For example, changes to NAT rules have no effect on packets belonging to flows that are already in the table. For long-lived UDP sessions, such as tunneling protocols like VXLAN, it might make sense to delete the entry so the new NAT transformation can take effect. Delete entries via _“sudo conntrack -D_” followed by an optional list of address and port information. The following example removes the given entry from the table:
```
sudo conntrack -D -p udp --src 10.0.12.4 --dst 10.0.0.1 --sport 1234 --dport 53
```
### Conntrack error counters
Conntrack also exports statistics:
```
# sudo conntrack -S
cpu=0 found=0 invalid=130 insert=0 insert_failed=0 drop=0 early_drop=0 error=0 search_restart=10
cpu=1 found=0 invalid=0 insert=0 insert_failed=0 drop=0 early_drop=0 error=0 search_restart=0
cpu=2 found=0 invalid=0 insert=0 insert_failed=0 drop=0 early_drop=0 error=0 search_restart=1
cpu=3 found=0 invalid=0 insert=0 insert_failed=0 drop=0 early_drop=0 error=0 search_restart=0
```
Most counters will be 0. “Found” and “insert” will always be 0, they only exist for backwards compatibility. Other errors accounted for are:
* invalid: packet does not match an existing connection and doesnt create a new connection.
* insert_failed: packet starts a new connection, but insertion into the state table failed. This can happen for example when NAT engine happened to pick identical source address and port when Masquerading.
* drop: packet starts a new connection, but no memory is available to allocate a new state entry for it.
* early_drop: conntrack table is full. In order to accept the new connection existing connections that did not see two-way communication were dropped.
* error: icmp(v6) received icmp error packet that did not match a known connection
* search_restart: lookup interrupted by an insertion or deletion on another CPU.
* clash_resolve: Several CPUs tried to insert identical conntrack entry.
These error conditions are harmless unless they occur frequently. Some can be mitigated by tuning the conntrack sysctls for the expected workload. _net.netfilter.nf_conntrack_buckets_ and _net.netfilter.nf_conntrack_max_ are typical candidates. See the [nf_conntrack-sysctl documentation][5] for a full list.
Use “_sudo sysctl_ _net.netfilter.nf_conntrack_log_invalid=255″_ to get more information when a packet is invalid. For example, when conntrack logs the following when it encounters a packet with all tcp flags cleared:
```
nf_ct_proto_6: invalid tcp flag combination SRC=10.0.2.1 DST=10.0.96.7 LEN=1040 TOS=0x00 PREC=0x00 TTL=255 ID=0 PROTO=TCP SPT=5723 DPT=443 SEQ=1 ACK=0
```
### Summary
This article gave an introduction on how to inspect the connection tracking table and the NAT information stored in tracked flows. The next part in the series will expand on the conntrack tool and the connection tracking event framework.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/network-address-translation-part-2-the-conntrack-tool/
作者:[Florian Westphal][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://fedoramagazine.org/author/strlen/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2021/02/network-address-translation-part-2-816x345.jpg
[2]: https://fedoramagazine.org/network-address-translation-part-1-packet-tracing/
[3]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure
[4]: https://wiki.nftables.org/wiki-nftables/index.php/Performing_Network_Address_Translation_(NAT)#Masquerading
[5]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/nf_conntrack-sysctl.rst

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: (Tracygcz)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,68 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (max27149)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5 benefits of choosing Linux)
[#]: via: (https://opensource.com/article/21/2/linux-choice)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
5 benefits of choosing Linux
======
One of the great things about Linux is choice, and choice inspires users
to freely share ideas and solutions. How will Linux inspire you to
contribute to this community?
![Hand putting a Linux file folder into a drawer][1]
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different reasons to use Linux. This article discusses the benefit of choice Linux brings. 
_Choice_ is one of the most misunderstood features of Linux. It starts with how many Linuxes there are to choose from. Distrowatch.org reports hundreds of available and active Linux distributions. Many of these distributions, of course, are hobby projects or extremely specific to some obscure requirement. Because it's open source, in fact, anyone can "re-spin" or "remix" an existing distribution of Linux, give it a new name, maybe a new default wallpaper, and call it their own. And while that may seem trivial, I see it as an indication of something very special.
### Inspiration
Linux, it seems, inspires people, from the very moment they learn about it, to make it their own.
There are dozens of companies spending millions of dollars to generate inspiration from their product. Commercials for technology overwhelmingly try to convince you that as long as you buy some product, you'll feel more connected to the people you care about, more creative, and more alive. Shot in 4k video with soft focus and played to the beat of cheerful and uplifting music, these advertisements are attempts to convince people to not only purchase but then also to support and advertise that company's product.
Of course, Linux has essentially no marketing budget because Linux is a diverse collection of individuals, a body _discorporate_. Yet when people discover it, they are seemingly inspired to build their own version of it.
It's difficult to quantify amounts of inspiration, but there's obvious value to it, or else companies wouldn't spend money in an attempt to create it.
### Innovation
Inspiration, however difficult it is to put a price tag on it, is valuable because of what it produces. Many Linux users have been inspired to create custom solutions to odd problems. Many of the problems we each solve seem trivial to most other people. Maybe you monitor moisture levels of your tomato plant's soil with a [Seeed micro-controller][2], or you have a script to search through an index of Python packages because you keep forgetting the names of libraries you import every day, or you've automated cleaning out your Downloads folder because dragging icons to the Trash is too much work. Whatever problem you've solved for yourself on Linux, it's a feature of the platform that you're inspired by the open technology you're running to make it work better for yourself.
### Staying out of the way
Of course, neither inspiration nor innovation are exclusive properties of Linux. Other platforms do authentically produce inspiration in us, and we do innovate in small and huge ways. Computing has largely leveled most playing fields, and anything you can do on one OS, you can likely find a way to do on another.
What many users find, however, is that the Linux operating system maintains a firm policy of staying out of your way when you have the idea of trying something that possibly nobody else has thought to try yet. This doesn't and cannot happen, by design, on a proprietary operating system because there's just no way to get into certain areas of the system because they don't happen to be open source. There are arbitrary blockades. You tend not to bump up against invisible walls when you're doing exactly what the OS expects you to do, but when you have it in mind to do something that makes sense only to you, your environment may fail to adapt.
### Small choices and why they matter
Not all innovations are big or important, but collectively they make a big difference. The crazy ideas that millions of users have had are evident today in every part of Linux. They're in the ways that the KDE and GNOME desktops work, they're in [31 different text editors][3] each of them loved by someone, and countless plugins for browsers and media applications, in file systems and extended attributes, and in the millions of lines of the Linux kernel. And if just one of these features gives you an extra hour each day to spend with your family or friends or hobby, then it's by definition, to use an over-used phrase, "life-changing."
### Connecting with a community
An important part of open source is the sharing of work. Sharing code is the obvious, prevalent transaction of open source software, but I think there's a lot more to the act of sharing than just making a commit to Gitlab. When people share their ideas with one another, with no ulterior motive aside from potentially getting useful code contributions in return, we all recognize it as a gift. It feels very different from when you purchase software from a company, and it's even different from when a company shares open source code they've produced. The reality of open source is that it's made by humans for humans. There's a connection created when knowledge and inspiration are given freely. It's not something that a marketing campaign can replicate, and I think that we recognize that.
### Choice
Linux isn't the only platform with a lot of choices. You can find several solutions to the same problem regardless of your OS, especially when you delve into open source software. However, the level of choice evident on Linux is indicative of what drives Linux forward: The invitation to collaborate. Some things created on Linux fade quickly away, others stay on your home computer for years doing whatever small mundane task you've automated, and others are so successful that they get borrowed by other platforms and become commonplace. It doesn't matter. Whatever you create on Linux, don't hesitate to add it to the cacophony of choice. You never know who it might inspire.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/2/linux-choice
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer)
[2]: https://opensource.com/article/19/12/seeeduino-nano-review
[3]: https://opensource.com/article/21/1/text-editor-roundup

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: (MjSeven)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,170 +0,0 @@
[#]: subject: (How to use the Linux anacron command)
[#]: via: (https://opensource.com/article/21/2/linux-automation)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
How to use the Linux anacron command
======
Instead of manually performing repetitive tasks, let Linux do them for
you.
![Command line prompt][1]
In 2021, there are more reasons why people love Linux than ever before. In this series, I'll share 21 different reasons to use Linux. Automation is one of the best reasons to use Linux.
One of my favorite things about Linux is its willingness to do work for me. Instead of performing repetitive tasks that eat up my time, or are prone to error, or that I'm likely to forget, I schedule Linux to do them for me.
### Preparing for automation
The term "automation" can be as intimidating as it is appealing. I find it helps to approach it modularly.
#### 1\. What do you want to make happen?
First, know what outcome you want to produce. Are you watermarking images? Removing files from a cluttered directory? Performing a backup of important data? Define the task clearly for yourself so that you know what to aim for. If there's any task you find yourself doing every day, much less more than once a day, then it could be a candidate for automation.
#### 2\. Learn the applications you need
Break down big tasks into small components and learn how to produce each result manually but in a repeatable and predictable way. Much of what can be done on Linux can be scripted, but it's important to recognize your current limitations. There's a world of difference between learning how to automate resizing several images so that they can be emailed conveniently vs. using machine learning to generate elaborate artwork for your weekly newsletter. One of these things you can learn in an afternoon and the other could take years. However, we all have to start somewhere, so just start small and always be on the lookout for ways to improve.
#### 3\. Automate it
Use an automation tool on Linux to make it happen on a regular basis. This is the step this article covers!
To automate something, you need a script that automates a task. When testing, it's best to keep things simple, so the task this article automates is the creation of a file called `hello` in the `/tmp` directory:
```
#!/bin/sh
touch /tmp/hello
```
Copy and paste that simple script into a text file and name it `example`.
### Cron
The built-in automation solution that every Linux install comes with is the cron system. Linux users tend to refer to cron generically as the method you use to schedule a task (usually called a "cron job"), but there are multiple applications that provide cron's functionality. The most versatile is [cronie][2]; its advantage is that it does _not_ assume that your computer is always on, the way historical cron applications designed for system administrators do.
Verify which cron system your Linux distribution provides. If it's anything other than cronie, you can probably install cronie from your distro's software repository. If your distribution doesn't have a package for cronie, you can use the old `anacron` package instead. The `anacron` command is included with cronie, so regardless of how you acquire it, you want to ensure that you have the `anacron` command available on your system before continuing. Anacron may require administrative root privileges, depending on your setup.
```
$ which anacron
/usr/sbin/anacron
```
Anacron's job is to ensure that your automation jobs are executed on a regular basis. To do this, anacron checks to find out when the last time a job ran and then checks how often you have told it to run jobs.
Suppose you set anacron to run a script once every five days. Every time you turn your computer on or wake it from sleep, anacron scans its logs to determine whether it needs to run the job. If a job ran five or more days ago, then anacron runs the job.
### Cron jobs
Many Linux systems come bundled with a few maintenance jobs for cron to perform. I like to keep my jobs separate from the system jobs, so I create a directory in my home directory. Specifically, there's a hidden folder called `~/.local` ("local" in the sense that it's customized for your user account rather than for your "global" computer system), so I create the subdirectory `etc/cron.daily` to mirror cron's usual home on my system. You must also create a spool directory to keep track of the last time jobs were run.
```
`$ mkdir -p ~/.local/etc/cron.daily ~/.var/spool/anacron`
```
You can place any script you want to run regularly into the `~/.local/etc/cron.daily` directory. Copy the `example` script into the directory now, and [mark it executable using the chmod command][3].
```
$ cp example ~/.local/etc/cron.daily
# chmod +x ~/.local/etc/cron.daily/example
```
Next, set up anacron to run whatever scripts are located in the `~/.local/etc/cron.daily` directory.
### Anacron
By default, much of the cron system is considered the systems administrator's domain because it's often used for important low-level tasks, like rotating log files and updating certificates. The configuration demonstrated in this article is designed for a regular user setting up personal automation tasks.
To configure anacron to run your cron jobs, create a configuration file at `/.local/etc/anacrontab`:
```
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
1  0  cron.mine    run-parts /home/tux/.local/etc/cron.daily/
```
This file tells anacron to run all executable scripts (`run-parts`) found in `~/.local/etc/cron.daily` every one day (that is, daily), with a zero-minute delay. Sometimes, a few minutes' delay is used so that your computer isn't hit with all the possible tasks right after you log in. These settings are suitable for testing, though.
The `cron.mine` value is an arbitrary name for the process. I call it `cron.mine` but you could call it `cron.personal` or `penguin` or anything you want.
Verify your `anacrontab` file's syntax:
```
$ anacron -T -t ~/.local/etc/anacrontab \
-S /home/tux/.var/spool/anacron
```
Silence means success.
### Adding anacron to .profile
Finally, you must ensure that anacron runs with your local configuration. Because you're running anacron as a regular user and not as the root user, you must direct it to your local configurations —the `anacrontab` file telling anacron what to do, and the spool directory helping anacron keep track of how many days it's been since each job was last executed:
```
anacron -fn -t /home/tux/.local/etc/anacrontab \
-S /home/tux/.var/spool/anacron
```
The `-fn` options tell anacron to _ignore_ timestamps, meaning that you're forcing it to run your cron job no matter what. This is exclusively for testing purposes.
### Testing your cron job
Now that everything's set up, you can test the job. You can technically test this without rebooting, but it makes the most sense to reboot because that's what this is designed to handle: interrupted and irregular login sessions. Take a moment to reboot your computer, log in, and then look for the test file:
```
$ ls /tmp/hello
/tmp/hello
```
Assuming the file exists, your example script has executed successfully. You can now remove the test options from `~/.profile`, leaving this as your final configuration:
```
anacron -t /home/tux/.local/etc/anacrontab \
-S /home/tux/.var/spool/anacron
```
### Using anacron
You have your personal automation infrastructure configured, so you can place any script you want your computer to manage for you into the `~/.local/etc/cron.daily` directory and it will run as scheduled.
It's up to you how often you want jobs to run. Your example script is executed once a day. Obviously, that depends on whether your computer is powered on and awake on any given day. If you use your computer on Friday but set it aside for the weekend, the script won't run on Saturday and Sunday. However, on Monday the script will execute because anacron will know that at least one day has passed. You can add weekly, fortnightly, or even monthly directories to `~/.local/etc` to schedule a wide variety of intervals.
To add a new interval:
1. Add a directory to `~/.local/etc` (for instance, `cron.weekly`).
2. Add a line to `~/.local/etc/anacrontab` to run scripts in the new directory. For a weekly interval, the configuration would be: [code]`7 0 cron.mine run-parts /home/tux/.local/etc/cron.weekly/`[/code] (with the `0` value optionally being some number of minutes to politely delay the start of the script).
3. Place your scripts in the `cron.weekly` directory.
Welcome to the automated lifestyle. It won't feel like it, but you're about to become a lot more productive.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/2/linux-automation
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt)
[2]: https://github.com/cronie-crond/cronie
[3]: https://opensource.com/article/19/8/linux-chmod-command

View File

@ -1,71 +0,0 @@
[#]: subject: (5 signs you might be a Rust programmer)
[#]: via: (https://opensource.com/article/21/3/rust-programmer)
[#]: author: (Mike Bursell https://opensource.com/users/mikecamel)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
5 signs you might be a Rust programmer
======
During my journey to learning Rust, I've noticed a few common behaviors
of fellow Rustaceans.
![name tag that says hello my name is open source][1]
I'm a fairly recent [convert to Rust][2], which I started to learn around the end of April 2020. But, like many converts, I'm an enthusiastic evangelist. I'm also not a very good Rustacean, truth be told, in that my coding style isn't great, and I don't write particularly idiomatic Rust. I suspect this is partly because I never really finished learning Rust before diving in and writing quite a lot of code (some of which is coming back to haunt me) and partly because I'm just not that good a programmer.
But I love Rust, and so should you. It's friendly—well, more friendly than C or C++; it's ready for low-level systems tasks—more so than Python, it's well-structured—more than Perl; and, best of all, it's completely open source from the design level up—much more than Java, for instance.
Despite my lack of expertise, I noticed a few things that I suspect are common to many Rust enthusiasts and programmers. If you say "yes" to the following five signs (the first of which was sparked by some exciting recent news), you, too, might be a Rust programmer.
### 1\. The word "foundation" excites you
For Rust programmers, the word "foundation" will no longer be associated first and foremost with Isaac Asimov but with the newly formed [Rust Foundation][3]. Microsoft, Huawei, Google, AWS, and Mozilla are providing the directors (and presumably most of the initial funding) for the Foundation, which will look after all aspects of the language, "heralding Rust's arrival as an enterprise production-ready technology," [according to interim executive director][4] Ashley Williams. (On a side note, it's great to see a woman heading up such a major industry initiative.)
The Foundation seems committed to safeguarding the philosophy of Rust and ensuring that everybody has the opportunity to get involved. Rust is, in many ways, a poster-child example of an open source project. Not that it's perfect (neither the language nor the community), but in that there seem to be sufficient enthusiasts who are dedicated to preserving the high-involvement, low-bar approach to community, which I think of as core to much of open source. I strongly welcome the move, which I think can only help promote Rust's adoption and maturity over the coming years and months.
### 2\. You get frustrated by newsfeed references to Rust (the game)
There's another computer-related thing out there that goes by the name "Rust," and it's a "multi-player only survival video game." It's newer than Rust the language (having been announced in 2013 and released in 2018), but I was once searching for Rust-related swag and made the mistake of searching for the game by that name. The interwebs being what they are, this meant that my news feed is now infected with this alternative Rust beast, and I now get random updates from their fandom and PR folks. This is low-key annoying, but I'm pretty sure I'm not alone in the Rust (language) community. I strongly suggest that if you _do_ want to find out more about this upstart in the computing world, you use a privacy-improving (I refuse to say "privacy-preserving") [open source browser][5] to do your research.
### 3\. The word "unsafe" makes you recoil in horror
Rust (the language, again) does a _really_ good job of helping you do the Right Thing™, certainly in terms of memory safety, which is a major concern within C and C++ (not because it's impossible but because it's really hard to get right consistently). Dave Herman wrote a post in 2016 on why safety is such a positive attribute of the Rust language: [_Safety is Rust's fireflower_][6]. Safety (memory, type safety) may not be glamourous, but it's something you become used to—and grateful for—as you write more Rust, particularly if you're involved in any systems programming, which is where Rust often excels.
Now, Rust doesn't _stop_ you from doing the Wrong Thing™, but it does make you make a conscious decision when you wish to go outside the bounds of safety by making you use the `unsafe` keyword. This is good not only for you, as it will (hopefully) make you think really, really carefully about what you're putting in any code block that uses it; it is also good for anyone reading your code. It's a trigger-word that makes any half-sane Rustacean shiver at least slightly, sit upright in their chair, and think, "hmm, what's going on here? I need to pay special attention." If you're lucky, the person reading your code may be able to think of ways of rewriting it such that it _does_ make use of Rust's safety features or at least reduces the amount of unsafe code that gets committed and released.
### 4\. You wonder why there's no emoji for `?;` or `{:?}` or `::<>`
Everybody loves (to hate) the turbofish (`::<>`) but there are other semantic constructs that you see regularly in Rust code. In particular, `{:?}` (for string formatting) and `?;` (`?` is a way of propagating errors up the calling stack, and `;` ends the line/block, so you often see them together). They're so common in Rust code that you just learn to parse them as you go, and they're also so useful that I sometimes wonder why they've not made it into normal conversation, at least as emojis. There are probably others, too. What would be your suggestions?
### 5\. Clippy is your friend (and not an animated paperclip)
Clippy, the Microsoft animated paperclip, was a "feature" that Office users learned very quickly to hate and has become the starting point for many [memes][7]. On the other hand, `cargo clippy` is one of those [amazing Cargo commands][8] that should become part of every Rust programmer's toolkit. Clippy is a language linter and helps improve your code to make it cleaner, tidier, more legible, more idiomatic, and generally less embarrassing when you share it with your colleagues or the rest of the world. Cargo has arguably rehabilitated the name "Clippy," and although it's not something I'd choose to name one of my kids, I don't feel a sense of unease whenever I come across the term on the web anymore.
* * *
_This article was originally published on [Alice, Eve, and Bob][9] and is reprinted with the author's permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/rust-programmer
作者:[Mike Bursell][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/mikecamel
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_OSDC_IntroOS_520x292_FINAL.png?itok=woiZamgj (name tag that says hello my name is open source)
[2]: https://opensource.com/article/20/6/why-rust
[3]: https://foundation.rust-lang.org/
[4]: https://foundation.rust-lang.org/posts/2021-02-08-hello-world/
[5]: https://opensource.com/article/19/7/open-source-browsers
[6]: https://www.thefeedbackloop.xyz/safety-is-rusts-fireflower/
[7]: https://knowyourmeme.com/memes/clippy
[8]: https://opensource.com/article/20/11/commands-rusts-cargo
[9]: https://aliceevebob.com/2021/02/09/5-signs-that-you-may-be-a-rust-programmer/

View File

@ -1,151 +0,0 @@
[#]: subject: (Cast your Android device with a Raspberry Pi)
[#]: via: (https://opensource.com/article/21/3/android-raspberry-pi)
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
[#]: collector: (lujun9972)
[#]: translator: ( RiaXu)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Cast your Android device with a Raspberry Pi
======
Use Scrcpy to turn your phone screen into an app running alongside your
applications on a Raspberry Pi or any other Linux-based device.
![A person looking at a phone][1]
It's hard to stay away from the gadgets we use on a daily basis. In the hustle and bustle of modern life, I want to make sure I don't miss out on the important notifications from friends and family that pop up on my phone screen. I'm also busy and do not want to get lost in distractions, and picking up a phone and replying to messages tends to be distracting.
To further complicate matters, there are a lot of devices out there. Luckily, most of them, from powerful workstations to laptops and even the humble Raspberry Pi, can run Linux. Because they run Linux, almost every solution I find for one device is a perfect fit for the others.
### One size fits all
I wanted a way to unify the different sources of data in my life on whatever screen I am staring at.
I decided to solve this problem by copying my phone's screen onto my computer. In essence, I made my phone into an app running alongside all of my other applications. This helps me keep my attention on my desktop, prevents me from mentally wandering away, and makes it easier for me to reply to urgent notifications.
Sound appealing? Here's how you can do it too.
### Set up Scrcpy
[Scrcpy][2], commonly known as Screen Copy, is an open source screen-mirroring tool that displays and controls Android devices from Linux, Windows, or macOS. Communication between the Android device and the computer is primarily done over a USB connection and Android Debug Bridge (ADB). It uses TCP/IP and does not require any root access.
Scrcpy's setup and configuration are very easy. If you're running Fedora, you can install it from a Copr repository:
```
$ sudo dnf copr enable zeno/scrcpy
$ sudo dnf install scrcpy -y
```
On Debian or Ubuntu:
```
`$ sudo apt install scrcpy`
```
You can also compile scrcpy yourself. It doesn't take long to build, even on a Raspberry Pi, using the instructions on [scrcpy's GitHub page][3].
### Set up the phone
Once scrcpy is installed, you must enable USB debugging and authorize each device (your Raspberry Pi, laptop, or workstation) as a trusted controller.
Open the **Settings** app on your Android and scroll down to **Developer options.** If Developer options is not activated, follow Android's [instructions to unlock it][4].
Next, enable **USB debugging**.
![Enable USB Debugging option][5]
(Sudeshna Sur, [CC BY-SA 4.0][6])
Then connect the phone to your Raspberry Pi or laptop (or whatever device you're using) over USB and set the mode to [PTP][7], if that's an option. If your phone doesn't use PTP, set the mode your phone uses for transferring files (rather than, for instance, serving as a tethering or MIDI device).
Your phone will probably prompt you to authorize your computer, identified by its RSA fingerprint. You only have to do this the first time you connect; after that, your phone will recognize and trust your computer.
Confirm the setting with the `lsusb` command:
```
$ lsusb
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 011 Device 004: ID 046d:c21d Logitech, Inc. F310 Gamepad
Bus 005 Device 005: ID 0951:1666 Kingston Technology DataTraveler G4
Bus 005 Device 004: ID 05e3:0608 Genesys Logic, Inc. Hub
Bus 004 Device 001: ID 18d1:4ee6 Google Inc. Nexus/Pixel Device (PTP + debug)
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
```
Then execute `$ scrcpy` to launch it with the default settings.
![Scrcpy running on a Raspberry Pi][8]
(Opensource.com, [CC BY-SA 4.0][6])
Performance and responsiveness vary depending on what device you're using to control your mobile. On a Pi, some of the animations can be slow, and even the response sometimes lags. Scrcpy provides an easy fix for this: Reducing the bitrate and resolution of the image scrcpy displays makes it easier for your computer to keep up. Do this with:
```
`$ scrcpy --bit-rate 1M --max-size 800`
```
Try different values to find the one you prefer. To make it easier to type, once you've settled on a command, consider [making your own Bash alias][9].
### Cut the cord
Once scrcpy is running, you can even connect your mobile and your computer over WiFi. The scrcpy installation process also installs `adb`, a command to communicate with Android devices. Scrcpy also uses this command to communicate with your device and `adb` can connect over TCP/IP.
![Scrcpy running on a computer][10]
(Sudeshna Sur, [CC BY-SA 4.0][6])
To try it, make sure your phone is connected over WiFi on the same wireless network your computer is using. Do NOT disconnect your phone from USB yet!
Next, get your phone's IP address by navigating to **Settings** and selecting **About phone**. Look at the **Status** option to get your address. It usually starts with 192.168 or 10.
Alternately, you can get your mobile's IP address using `adb`:
```
$ adb shell ip route | awk '{print $9}'
To connect to your device over WiFi, you must enable TCP/IP connections. This, you must do through the adb command:
$ adb tcpip 5555
Now you can disconnect your mobile from USB.
Whenever you want to connect over WiFi, first connect to the mobile with the command adb connect. For instance, assuming my mobile's IP address is 10.1.1.22, the command is:
$ adb connect 10.1.1.22:5555
```
Once it's connected, you can run scrcpy as usual.
### Remote control
Scrcpy is easy to use. You can try it in a terminal or as [a GUI application][11].
Do you use another screen-mirroring application? If so, let us know about it in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/android-raspberry-pi
作者:[Sudeshna Sur][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/ShuyRoy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/sudeshna-sur
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone)
[2]: https://github.com/Genymobile/scrcpy
[3]: https://github.com/Genymobile/scrcpy/blob/master/BUILD.md
[4]: https://developer.android.com/studio/debug/dev-options
[5]: https://opensource.com/sites/default/files/uploads/usb-debugging.jpg (Enable USB Debugging option)
[6]: https://creativecommons.org/licenses/by-sa/4.0/
[7]: https://en.wikipedia.org/wiki/Picture_Transfer_Protocol
[8]: https://opensource.com/sites/default/files/uploads/scrcpy-pi.jpg (Scrcpy running on a Raspberry Pi)
[9]: https://opensource.com/article/19/7/bash-aliases
[10]: https://opensource.com/sites/default/files/uploads/ssur-desktop.png (Scrcpy running on a computer)
[11]: https://opensource.com/article/19/9/mirror-android-screen-guiscrcpy

View File

@ -1,194 +0,0 @@
[#]: subject: (My favorite open source project management tools)
[#]: via: (https://opensource.com/article/21/3/open-source-project-management)
[#]: author: (Frank Bergmann https://opensource.com/users/fraber)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
My favorite open source project management tools
======
If you're managing large and complex projects, try replacing Microsoft
Project with an open source option.
![Kanban-style organization action][1]
Projects like building a satellite, developing a robot, or launching a new product are all expensive, involve different providers, and contain hard dependencies that must be tracked.
The approach to project management in the world of large projects is quite simple (in theory at least). You create a project plan and split it into smaller pieces until you can reasonably assign costs, duration, resources, and dependencies to the various activities. Once the project plan is approved by the people in charge of the money, you use it to track the project's execution. Drawing all of the project's activities on a timeline produces a bar chart called a [Gantt chart][2].
Gantt charts have always been used in [waterfall project methodologies][3], but they can also be used with agile. For example, large projects may use a Gantt chart for a scrum sprint and ignore other details like user stories, thereby embedding agile phases. Other large projects may include multiple product releases (e.g., minimum viable product [MVP], second version, third version, etc.). In this case, the super-structure is kind of agile, with each phase planned as a Gantt chart to deal with budgets and complex dependencies.
### Project management tools
There are literally hundreds of tools available to manage large projects with Gantt charts, and Microsoft Project is probably the most popular. It is part of the Microsoft Office family, scales to hundreds of thousands of activities, and has an incredible number of features that support almost every conceivable way to manage a project schedule. With Project, it's not always clear what is more expensive: the software license or the training courses that teach you how to use the tool.
Another drawback is that Microsoft Project is a standalone desktop application, and only one person can update a schedule. You would need to buy licenses for Microsoft Project Server, Project for the web, or Microsoft Planner if you want multiple users to collaborate.
Fortunately, there are open source alternatives to the proprietary tools, including the applications in this article. All are open source and include a Gantt for scheduling hierarchical activities based on resources and dependencies. ProjectLibre, GanttProject, and TaskJuggler are desktop applications for a single project manager; ProjeQtOr and Redmine are web applications for project teams, and ]project-open[ is a web application for managing entire organizations.
I evaluated the tools based on a single user planning and tracking a single large project. My evaluation criteria includes Gantt editor features, availability on Windows, Linux, and macOS, scalability, import/export, and reporting. (Full disclosure: I'm the founder of ]project-open[, and I've been active in several open source communities for many years. This list includes our product, so my views may be biased, but I tried to focus on each product's best features.)
### Redmine 4.1.0
![Redmine][4]
(Frank Bergmann, [CC BY-SA 4.0][5])
[Redmine][6] is a web-based project management tool with a focus on agile methodologies.
The standard installation includes a Gantt timeline view, but it lacks fundamental features like scheduling, drag-and-drop, indent and outdent, and resource assignments. You have to edit task properties individually to change the task tree's structure.
Redmine has Gantt editor plugins, but they are either outdated (e.g., [Plus Gantt][7]) or proprietary (e.g., [ANKO Gantt chart][8]). If you know of other open source Gantt editor plugins, please share them in the comments.
Redmine is written in Ruby on Rails and available for Windows, Linux, and macOS. The core is available under a GPLv2 license.
* **Best for:** IT teams working using agile methodologies
* **Unique selling proposition:** It's the original "upstream" parent project of OpenProject and EasyRedmine.
### ]project-open[ 5.1
![\]project-open\[][9]
(Frank Bergmann, [CC BY-SA 4.0][5])
[]project-open[][10] is a web-based project management system that takes the perspective of an entire organization, similar to an enterprise resource planning (ERP) system. It can also manage project portfolios, budgets, invoicing, sales, human resources, and other functional areas. Specific variants exist for professional services automation (PSA) for running a project company, project management office (PMO) for managing an enterprise's strategic projects, and enterprise project management (EPM) for managing a department's projects.
The ]po[ Gantt editor includes hierarchical tasks, dependencies, and scheduling based on planned work and assigned resources. It does not support resource calendars and non-human resources. The ]po[ system is quite complex, and the GUI might need a refresh.
]project-open[ is written in TCL and JavaScript and available for Windows and Linux. The ]po[ core is available under a GPLv2 license with proprietary extensions available for large companies.
* **Best for:** Medium to large project organizations that need a lot of financial project reporting
* **Unique selling proposition:** ]po[ is an integrated system to run an entire project company or department.
### ProjectLibre 1.9.3
![ProjectLibre][11]
(Frank Bergmann, [CC BY-SA 4.0][5])
[ProjectLibre][12] is probably the closest you can get to Microsoft Project in the open source world. It is a desktop application that supports all-important project planning features, including resource calendars, baselines, and cost management. It also allows you to import and export schedules using MS-Project's file format.
ProjectLibre is perfectly suitable for planning and executing small or midsized projects. However, it's missing some advanced features in MS-Project, and its GUI is not the prettiest.
ProjectLibre is written in Java and available for Windows, Linux, and macOS and licensed under an open source Common Public Attribution (CPAL) license. The ProjectLibre team is currently working on a Web offering called ProjectLibre Cloud under a proprietary license.
* **Best for:** An individual project manager running small to midsized projects or as a viewer for project members who don't have a full MS-Project license
* **Unique selling proposition:** It's the closest you can get to MS-Project with open source.
### GanttProject 2.8.11
![GanttProject][13]
(Frank Bergmann, [CC BY-SA 4.0][5])
[GanttProject][14] is similar to ProjectLibre as a desktop Gantt editor but with a more limited feature set. It doesn't support baselines nor non-human resources, and the reporting functionality is more limited.
GanttProject is a desktop application written in Java and available for Windows, Linux, and macOS under the GPLv3 license.
* **Best for:** Simple Gantt charts or learning Gantt-based project management techniques.
* **Unique selling proposition:** It supports program evaluation and review technique ([PERT][15]) charts and collaboration using WebDAV.
### TaskJuggler 3.7.1
![TaskJuggler][16]
(Frank Bergmann, [CC BY-SA 4.0][5])
[TaskJuggler][17] schedules multiple parallel projects in large organizations, focusing on automatically resolving resource assignment conflicts (i.e., resource leveling).
It is not an interactive Gantt editor but a command-line tool that works similarly to a compiler: It reads a list of tasks from a text file and produces a series of reports with the optimum start and end times for each task depending on the assigned resources, dependencies, priorities, and many other parameters. It supports multiple projects, baselines, resource calendars, shifts, and time zones and has been designed to scale to enterprise scenarios with many projects and resources.
Writing a TaskJuggler input file with its specific syntax may be beyond the average project manager's capabilities. However, you can use ]project-open[ as a graphical frontend for TaskJuggler to generate input, including absences, task progress, and logged hours. When used this way, TaskJuggler becomes a powerful what-if scenario planner.
TaskJuggler is written in Ruby and available for Windows, Linux, and macOS under a GPLv2 license.
* **Best for:** Medium to large departments managed by a true nerd
* **Unique selling proposition:** It excels in automatic resource-leveling.
### ProjeQtOr 9.0.4
![ProjeQtOr][18]
(Frank Bergmann, [CC BY-SA 4.0][5])
[ProjeQtOr][19] is a web-based project management application that's suitable for IT projects. It supports risks, budgets, deliverables, and financial documents in addition to projects, tickets, and activities to integrate many aspects of project management into a single system.
ProjeQtOr provides a Gantt editor with a feature set similar to ProjectLibre, including hierarchical tasks, dependencies, and scheduling based on planned work and assigned resources. However, it doesn't support in-place editing of values (e.g., task name, estimated time, etc.); users must change values in an entry form below the Gantt view and save the values.
ProjeQtOr is written in PHP and available for Windows, Linux, and macOS under the Affero GPL3 license.
* **Best for:** IT departments tracking a list of projects
* **Unique selling proposition:** Lets you store a wealth of information for every project, keeping all information in one place.
### Other tools
The following systems may be valid options for specific use cases but were excluded from the main list for various reasons.
![LIbrePlan][20]
(Frank Bergmann, [CC BY-SA 4.0][5])
* [**LibrePlan**][21] is a web-based project management application focusing on Gantt charts. It would have figured prominently in the list above due to its feature set, but there is no installation available for recent Linux versions (CentOS 7 or 8). The authors say updated instructions will be available soon.
* [**dotProject**][22] is a web-based project management system written in PHP and available under the GPLv2.x license. It includes a Gantt timeline report, but it doesn't have options to edit it, and dependencies don't work yet (they're "only partially functional").
* [**Leantime**][23] is a web-based project management system with a pretty GUI written in PHP and available under the GPLv2 license. It includes a Gantt timeline for milestones but without dependencies.
* [**Orangescrum**][24] is a web-based project-management tool. Gantt charts are available as a paid add-on or with a paid subscription.
* [**Talaia/OpenPPM**][25] is a web-based project portfolio management system. However, version 4.6.1 still says "Coming Soon: Interactive Gantt Charts."
* [**Odoo**][26] and [**OpenProject**][27] both restrict some important features to the paid enterprise edition.
In this review, I aimed to include all open source project management systems that include a Gantt editor with dependency scheduling. If I missed a project or misrepresented something, please let me know in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/open-source-project-management
作者:[Frank Bergmann][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/fraber
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kanban_trello_organize_teams_520.png?itok=ObNjCpxt (Kanban-style organization action)
[2]: https://en.wikipedia.org/wiki/Gantt_chart
[3]: https://opensource.com/article/20/3/agiles-vs-waterfall
[4]: https://opensource.com/sites/default/files/uploads/redmine.png (Redmine)
[5]: https://creativecommons.org/licenses/by-sa/4.0/
[6]: https://www.redmine.org/
[7]: https://redmine.org/plugins/plus_gantt
[8]: https://www.redmine.org/plugins/anko_gantt_chart
[9]: https://opensource.com/sites/default/files/uploads/project-open.png (]project-open[)
[10]: https://www.project-open.com
[11]: https://opensource.com/sites/default/files/uploads/projectlibre.png (ProjectLibre)
[12]: http://www.projectlibre.org
[13]: https://opensource.com/sites/default/files/uploads/ganttproject.png (GanttProject)
[14]: https://www.ganttproject.biz
[15]: https://en.wikipedia.org/wiki/Program_evaluation_and_review_technique
[16]: https://opensource.com/sites/default/files/uploads/taskjuggler.png (TaskJuggler)
[17]: https://taskjuggler.org/
[18]: https://opensource.com/sites/default/files/uploads/projeqtor.png (ProjeQtOr)
[19]: https://www.projeqtor.org
[20]: https://opensource.com/sites/default/files/uploads/libreplan.png (LIbrePlan)
[21]: https://www.libreplan.dev/
[22]: https://dotproject.net/
[23]: https://leantime.io
[24]: https://orangescrum.org/
[25]: http://en.talaia-openppm.com/
[26]: https://odoo.com
[27]: http://openproject.org

View File

@ -1,92 +0,0 @@
[#]: subject: (Plausible: Privacy-Focused Google Analytics Alternative)
[#]: via: (https://itsfoss.com/plausible/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Plausible: Privacy-Focused Google Analytics Alternative
======
[Plausible][1] is a simple, privacy-friendly analytics tool. It helps you analyze the number of unique visitors, pageviews, bounce rate and visit duration.
If you have a website you would probably understand those terms. As a website owner, it helps you know if your site is getting more visitors over the time, from where the traffic is coming and if you have some knowledge on these things, you can work on improving your website for more visits.
When it comes to website analytics, the one service that rules this domain is the Googles free tool Google Analytics. Just like Google is the de-facto search engine, Google Analytics is the de-facto analytics tool. But you dont have to live with it specially if you cannot trust Big tech with your and your site visitors data.
Plausible gives you the freedom from Google Analytics and I am going to discuss this open source project in this article.
Please mind that some technical terms in the article could be unknown to you if you have never managed a website or bothered about analytics.
### Plausible for privacy friendly website analytics
The script used by Plausible for analytics is extremely lightweight with less than 1 KB in size.
The focus is on preserving the privacy so you get valuable and actionable stats without compromising on the privacy of your visitors. Plausible is one of the rare few analytics tool that doesnt require cookie banner or GDP consent because it is already [GDPR-compliant][2] on privacy front. Thats super cool.
In terms of features, it doesnt have the same level of granularity and details of Google Analytics. Plausible banks on simplicity. It shows a graph of your traffic stats for past 30 days. You may also switch to real time view.
![][3]
You can also see where your traffic is coming from and which pages on your website gets the most visits. The sources can also show UTM campaigns.
![][4]
You also have the option to enable GeoIP to get some insights about the geographical location of your website visitors. You can also check how many visitors use desktop or mobile device to visit your website. There is also an option for operating system and as you can see, [Linux Handbook][5] gets 48% of its visitors from Windows devices. Pretty strange, right?
![][6]
Clearly, the data provided is nowhere close to what Google Analytics can do, but thats intentional. Plausible intends to provide you simple matrix.
### Using Plausible: Opt for paid managed hosting or self-host it on your server
There are two ways you can start using Plausible. Sign up for their official managed hosting. Youll have to pay for the service and this eventually helps the development of the Plausible project. They do have 30-days trial period and it doesnt even require any payment information from your side.
The pricing starts at $6 per month for 10k monthly pageviews. Pricing increases with the number of pageviews. You can calculate the pricing on Plausible website.
[Plausible Pricing][7]
You can try it for 30 days and see if you would like to pay to Plausible developers for the service and own your data.
If you think the pricing is not affordable, you can take the advantage of the fact that Plausible is open source and deploy it yourself. If you are interested, read our [in-depth guide on self-hosting a Plausible instance with Docker][8].
At Its FOSS, we self-host Plausible. Our Plausible instance has three of our websites added.
![Plausble dashboard for Its FOSS websites][9]
If you maintain the website of an open source project and would like to use Plausible, you can contact us through our [High on Cloud project][10]. With High on Cloud, we help small businesses host and use open source software on their servers.
### Conclusion
If you are not super obsessed with data and just want a quick glance on how your website is performing, Plausible is a decent choice. I like it because it is lightweight and privacy compliant. Thats the main reason why I use it on Linux Handbook, our [ethical web portal for teaching Linux server related stuff][11].
Overall, I am pretty content with Plausible and recommend it to other website owners.
Do you run or manage a website as well? What tool do you use for the analytics or do you not care about that at all?
--------------------------------------------------------------------------------
via: https://itsfoss.com/plausible/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://plausible.io/
[2]: https://gdpr.eu/compliance/
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/03/plausible-graph-lhb.png?resize=800%2C395&ssl=1
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2021/03/plausible-stats-lhb-2.png?resize=800%2C333&ssl=1
[5]: https://linuxhandbook.com/
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/plausible-geo-ip-stats.png?resize=800%2C331&ssl=1
[7]: https://plausible.io/#pricing
[8]: https://linuxhandbook.com/plausible-deployment-guide/
[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/plausible-analytics-for-itsfoss.png?resize=800%2C231&ssl=1
[10]: https://highoncloud.com/
[11]: https://linuxhandbook.com/about/#ethical-web-portal

View File

@ -1,190 +0,0 @@
[#]: subject: (Why I love using the IPython shell and Jupyter notebooks)
[#]: via: (https://opensource.com/article/21/3/ipython-shell-jupyter-notebooks)
[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Why I love using the IPython shell and Jupyter notebooks
======
Jupyter notebooks take the IPython shell to the next level.
![Computer laptop in space][1]
The Jupyter project started out as IPython and the IPython Notebook. It was originally a Python-specific interactive shell and notebook environment, which later branched out to become language-agnostic, supporting Julia, Python, and R—and potentially anything else.
![Jupyter][2]
(Ben Nuttall, [CC BY-SA 4.0][3])
IPython is a Python shell—similar to what you get when you type `python` or `python3` at the command line—but it's more clever and more helpful. If you've ever typed a multi-line command into the Python shell and wanted to repeat it, you'll understand the frustration of having to scroll through your history one line at a time. With IPython, you can scroll back through whole blocks at a time while still being able to navigate line-by-line and edit parts of those blocks.
![iPython][4]
(Ben Nuttall, [CC BY-SA 4.0][3])
It has autocompletion and provides context-aware suggestions:
![iPython offers suggestions][5]
(Ben Nuttall, [CC BY-SA 4.0][3])
It pretty-prints by default:
![iPython pretty prints][6]
(Ben Nuttall, [CC BY-SA 4.0][3])
It even allows you to run shell commands:
![IPython shell commands][7]
(Ben Nuttall, [CC BY-SA 4.0][3])
It also provides helpful features like adding `?` to an object as a shortcut for running `help()` without breaking your flow:
![IPython help][8]
(Ben Nuttall, [CC BY-SA 4.0][3])
If you're using a virtual environment (see my post on [virtualenvwrapper][9], install it with pip in the environment):
```
`pip install ipython`
```
To install it system-wide, you can use apt on Debian, Ubuntu, or Raspberry Pi:
```
`sudo apt install ipython3`
```
or with pip:
```
`sudo pip3 install ipython`
```
### Jupyter notebooks
Jupyter notebooks take the IPython shell to the next level. First of all, they're browser-based, not terminal-based. To get started, install `jupyter`.
If you're using a virtual environment, install it with pip in the environment:
```
`pip install jupyter`
```
To install it system-wide, you can use apt on Debian, Ubuntu, or Raspberry Pi:
```
`sudo apt install jupyter-notebook`
```
or with pip:
```
`sudo pip3 install jupyter`
```
Launch the notebook with:
```
`jupyter notebook`
```
This will open in your browser:
![Jupyter Notebook][10]
(Ben Nuttall, [CC BY-SA 4.0][3])
You can create a new Python 3 notebook using the **New** dropdown:
![Python 3 in Jupyter Notebook][11]
(Ben Nuttall, [CC BY-SA 4.0][3])
Now you can write and execute commands in the `In[ ]` fields. Use **Enter** for a newline within the block and **Shift+Enter** to execute:
![Executing commands in Jupyter][12]
(Ben Nuttall, [CC BY-SA 4.0][3])
You can edit and rerun blocks. You can reorder them, delete them, copy/paste, and so on. You can run blocks in any order—but be aware that any variables created will be in scope according to the time of execution, rather than the order they appear within the notebook. You can restart and clear output or restart and run all blocks from within the **Kernel** menu.
Using the `print` function will output every time. But if you only have a single statement that's not assigned or your last statement is unassigned, it will be output anyway:
![Jupyter output][13]
(Ben Nuttall, [CC BY-SA 4.0][3])
You can even refer to `In` and `Out` as indexable objects:
![Jupyter output][14]
(Ben Nuttall, [CC BY-SA 4.0][3])
All the IPython features are available and are often presented a little nicer, too:
![Jupyter supports IPython features][15]
(Ben Nuttall, [CC BY-SA 4.0][3])
You can even do inline plots using [Matplotlib][16]:
![Graphing in Jupyter Notebook][17]
(Ben Nuttall, [CC BY-SA 4.0][3])
Finally, you can save your notebooks and include them in Git repositories, and if you push to GitHub, they will render as completed notebooks—outputs, graphs, and all (as in [this example][18]):
![Saving Notebook to GitHub][19]
(Ben Nuttall, [CC BY-SA 4.0][3])
* * *
_This article originally appeared on Ben Nuttall's [Tooling Tuesday blog][20] and is reused with permission._
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/ipython-shell-jupyter-notebooks
作者:[Ben Nuttall][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/bennuttall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space)
[2]: https://opensource.com/sites/default/files/uploads/jupyterpreview.png (Jupyter)
[3]: https://creativecommons.org/licenses/by-sa/4.0/
[4]: https://opensource.com/sites/default/files/uploads/ipython-loop.png (iPython)
[5]: https://opensource.com/sites/default/files/uploads/ipython-suggest.png (iPython offers suggestions)
[6]: https://opensource.com/sites/default/files/uploads/ipython-pprint.png (iPython pretty prints)
[7]: https://opensource.com/sites/default/files/uploads/ipython-ls.png (IPython shell commands)
[8]: https://opensource.com/sites/default/files/uploads/ipython-help.png (IPython help)
[9]: https://opensource.com/article/21/2/python-virtualenvwrapper
[10]: https://opensource.com/sites/default/files/uploads/jupyter-notebook-1.png (Jupyter Notebook)
[11]: https://opensource.com/sites/default/files/uploads/jupyter-python-notebook.png (Python 3 in Jupyter Notebook)
[12]: https://opensource.com/sites/default/files/uploads/jupyter-loop.png (Executing commands in Jupyter)
[13]: https://opensource.com/sites/default/files/uploads/jupyter-cells.png (Jupyter output)
[14]: https://opensource.com/sites/default/files/uploads/jupyter-cells-2.png (Jupyter output)
[15]: https://opensource.com/sites/default/files/uploads/jupyter-help.png (Jupyter supports IPython features)
[16]: https://matplotlib.org/
[17]: https://opensource.com/sites/default/files/uploads/jupyter-graph.png (Graphing in Jupyter Notebook)
[18]: https://github.com/piwheels/stats/blob/master/2020.ipynb
[19]: https://opensource.com/sites/default/files/uploads/savenotebooks.png (Saving Notebook to GitHub)
[20]: https://tooling.bennuttall.com/the-ipython-shell-and-jupyter-notebooks/

View File

@ -2,7 +2,7 @@
[#]: via: (https://opensource.com/article/21/3/python-package-index-json-apis-requests)
[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (MjSeven)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,198 +0,0 @@
[#]: subject: (3 reasons I use the Git cherry-pick command)
[#]: via: (https://opensource.com/article/21/3/git-cherry-pick)
[#]: author: (Manaswini Das https://opensource.com/users/manaswinidas)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
3 reasons I use the Git cherry-pick command
======
Cherry-picking solves a lot of problems in Git repositories. Here are
three ways to fix your mistakes with git cherry-pick.
![Measuring and baking a cherry pie recipe][1]
Finding your way around a version control system can be tricky. It can be massively overwhelming for a newbie, but being well-versed with the terminology and the basics of a version control system like Git is one of the baby steps to start contributing to open source.
Being familiar with Git can also help you out of sticky situations in your open source journey. Git is powerful and makes you feel in control—there is not a single way in which you cannot revert to a working version.
Here is an example to help you understand the importance of cherry-picking. Suppose you have made several commits in a branch, but you realize it's the wrong branch! What do you do now? Either you repeat all your changes in the correct branch and make a fresh commit, or you merge the branch into the correct branch. Wait, the former is too tedious, and you may not want to do the latter. So, is there a way? Yes, Git's got you covered. Here is where cherry-picking comes into play. As the term suggests, you can use it to hand-pick a commit from one branch and transfer it into another branch.
There are various reasons to use cherry-picking. Here are three of them.
### Avoid redundancy of efforts
There's no need to redo the same changes in a different branch when you can just copy the same commits to the other branch. Please note that cherry-picking commits will create a fresh commit with a new hash in the other branch, so please don't be confused if you see a different commit hash.
In case you are wondering what a commit hash is and how it is generated, here is a note to help you: A commit hash is a string generated using the [SHA-1][2] algorithm. The SHA-1 algorithm takes an input and outputs a unique 40-character hash. If you are on a [POSIX][3] system, try running this in your terminal:
```
`$ echo -n "commit" | openssl sha1`
```
This outputs a unique 40-character hash, `4015b57a143aec5156fd1444a017a32137a3fd0f`. This hash represents the string `commit`.
A SHA-1 hash generated by Git when you make a commit represents much more than just a single string. It represents:
```
sha1(
    meta data
        commit message
        committer
        commit date
        author
        authoring date
    Hash of the entire tree object
)
```
This explains why you get a unique commit hash for the slightest change you make to your code. Not even a single change goes unnoticed. This is because Git has integrity.
### Undoing/restoring lost changes
Cherry-picking can be handy when you want to restore to a working version. When multiple developers are working on the same codebase, it is very likely for changes to get lost and the latest version to move to a stale or non-working version. That's where cherry-picking commits to the working version can be a savior.
#### How does it work?
Suppose there are two branches, `feature1` and `feature2`, and you want to apply commits from `feature1` to `feature2`.
On the `feature1` branch, run a `git log` command, and copy the commit hash that you want to cherry-pick. You can see a series of commits resembling the code sample below. The alphanumeric code following "commit" is the commit hash that you need to copy. You may choose to copy the first six characters (`966cf3` in this example) for the sake of convenience:
```
commit 966cf3d08b09a2da3f2f58c0818baa37184c9778 (HEAD -&gt; master)
Author: manaswinidas &lt;[me@example.com][4]&gt;
Date:   Mon Mar 8 09:20:21 2021 +1300
   add instructions
```
Then switch to `feature2` and run `git cherry-pick` on the hash you just got from the log:
```
$ git checkout feature2
$ git cherry-pick 966cf3.
```
If the branch doesn't exist, use `git checkout -b feature2` to create it.
Here's a catch: You may encounter the situation below:
```
$ git cherry-pick 966cf3
On branch feature2
You are currently cherry-picking commit 966cf3d.
nothing to commit, working tree clean
The previous cherry-pick is now empty, possibly due to conflict resolution.
If you wish to commit it anyway, use:
   git commit --allow-empty
Otherwise, please use 'git reset'
```
Do not panic. Just run `git commit --allow-empty` as suggested:
```
$ git commit --allow-empty
[feature2 afb6fcb] add instructions
Date: Mon Mar 8 09:20:21 2021 +1300
```
This opens your default editor and allows you to edit the commit message. It's acceptable to save the existing message if you have nothing to add.
There you go; you did your first cherry-pick. As discussed above, if you run a `git log` on branch `feature2`, you will see a different commit hash. Here is an example:
```
commit afb6fcb87083c8f41089cad58deb97a5380cb2c2 (HEAD -&gt; feature2)
Author: manaswinidas &lt;[me@example.com][4]&gt;
Date:   Mon Mar 8 09:20:21 2021 +1300
   add instructions
```
Don't be confused about the different commit hash. That just distinguishes between the commits in `feature1` and `feature2`.
### Cherry-pick multiple commits
But what if you want to cherry-pick multiple commits? You can use:
```
`git cherry-pick <commit-hash1> <commit-hash2>... <commit-hashn>`
```
Please note that you don't have to use the entire commit hash; you can use the first five or six characters.
Again, this is tedious. What if the commits you want to cherry-pick are a range of continuous commits? This approach is too much work. Don't worry; there's an easier way.
Assume that you have two branches:
* `feature1` includes commits you want to copy (from `commitA` (older) to `commitB`).
* `feature2` is the branch you want the commits to be transferred to from `feature1`.
Then:
1. Enter `git checkout <feature1>`.
2. Get the hashes of `commitA` and `commitB`.
3. Enter `git checkout <branchB>`.
4. Enter `git cherry-pick <commitA>^..<commitB>` (please note that this includes `commitA` and `commitB`).
5. Should you encounter a merge conflict, [solve it as usual][5] and then type `git cherry-pick --continue` to resume the cherry-pick process.
### Important cherry-pick options
Here are some useful options from the [Git documentation][6] that you can use with the `cherry-pick` command:
* `-e`, `--edit`: With this option, `git cherry-pick` lets you edit the commit message prior to committing.
* `-s`, `--signoff`: Add a "Signed-off-by" line at the end of the commit message. See the signoff option in git-commit(1) for more information.
* `-S[<keyid>]`, `--gpg-sign[=<keyid>]`: These are GPG-sign commits. The `keyid` argument is optional and defaults to the committer identity; if specified, it must be stuck to the option without a space.
* `--ff`: If the current HEAD is the same as the parent of the cherry-picked commit, then a fast-forward to this commit will be performed.
Here are some other sequencer subcommands (apart from continue):
* `--quit`: You can forget about the current operation in progress. This can be used to clear the sequencer state after a failed cherry-pick or revert.
* `--abort`: Cancel the operation and return to the presequence state.
Here are some examples of cherry-picking:
* `git cherry-pick master`: Applies the change introduced by the commit at the tip of the master branch and creates a new commit with this change
* `git cherry-pick master~4 master~2`: Applies the changes introduced by the fifth and third-last commits pointed to by master and creates two new commits with these changes
Feeling overwhelmed? You needn't remember all the commands. You can always type `git cherry-pick --help` in your terminal to look at more options or help.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/3/git-cherry-pick
作者:[Manaswini Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/manaswinidas
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/pictures/cherry-picking-recipe-baking-cooking.jpg?itok=XVwse6hw (Measuring and baking a cherry pie recipe)
[2]: https://en.wikipedia.org/wiki/SHA-1
[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains
[4]: mailto:me@example.com
[5]: https://opensource.com/article/20/4/git-merge-conflict
[6]: https://git-scm.com/docs/git-cherry-pick

View File

@ -2,7 +2,7 @@
[#]: via: (https://jvns.ca/blog/2021/03/31/dnspeep-tool/)
[#]: author: (Julia Evans https://jvns.ca/)
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (wyxplus)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,180 +0,0 @@
[#]: subject: (Use this open source tool to monitor variables in Python)
[#]: via: (https://opensource.com/article/21/4/monitor-debug-python)
[#]: author: (Tian Gao https://opensource.com/users/gaogaotiantian)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Use this open source tool to monitor variables in Python
======
Watchpoints is a simple but powerful tool to help you with monitoring
variables while debugging Python.
![Looking back with binoculars][1]
When debugging code, you're often faced with figuring out when a variable changes. Without any advanced tools, you have the option of using print statements to announce the variables when you expect them to change. However, this is a very ineffective way because the variables could change in many places, and constantly printing them to a terminal is noisy, while printing them to a log file becomes unwieldy.
This is a common issue, but now there is a simple but powerful tool to help you with monitoring variables: [watchpoints][2].
The [watchpoint concept is common in C and C++ debuggers][3] to monitor memories, but there's a lack of equivalent tools in Python. `watchpoints` fills in the gap.
### Installing
To use it, you must first install it by using `pip`:
```
`$ python3 -m pip install watchpoints`
```
### Using watchpoints in Python
For any variable you'd like to monitor, use the **watch** function on it.
```
from watchpoints import watch
a = 0
watch(a)
a = 1
```
As the variable changes, information about its value is printed to **stdout**:
```
====== Watchpoints Triggered ======
Call Stack (most recent call last):
  &lt;module&gt; (my_script.py:5):
&gt; a = 1
a:
0
-&gt;
1
```
The information includes:
* The line where the variable was changed.
* The call stack.
* The previous/current value of the variable.
It not only works with the variable itself, but it also works with object changes:
```
from watchpoints import watch
a = []
watch(a)
a = {} # Trigger
a["a"] = 2 # Trigger
```
The callback is triggered when the variable **a** is reassigned, but also when the object assigned to a is changed.
What makes it even more interesting is that the monitor is not limited by the scope. You can watch the variable/object anywhere you want, and the callback is triggered no matter what function the program is executing.
```
from watchpoints import watch
def func(var):
    var["a"] = 1
a = {}
watch(a)
func(a)
```
For example, this code prints:
```
====== Watchpoints Triggered ======
Call Stack (most recent call last):
  &lt;module&gt; (my_script.py:8):
&gt; func(a)
  func (my_script.py:4):
&gt; var["a"] = 1
a:
{}
-&gt;
{'a': 1}
```
The **watch** function can monitor more than a variable. It can also monitor the attributes and an element of a dictionary or list.
```
from watchpoints import watch
class MyObj:
    def __init__(self):
        self.a = 0
obj = MyObj()
d = {"a": 0}
watch(obj.a, d["a"]) # Yes you can do this
obj.a = 1 # Trigger
d["a"] = 1 # Trigger
```
This could help you narrow down to some specific objects that you are interested in.
If you are not happy about the format of the output, you can customize it. Just define your own callback function:
```
watch(a, callback=my_callback)
# Or set it globally
watch.config(callback=my_callback)
```
You can even bring up **pdb** when the trigger is hit:
```
`watch.config(pdb=True)`
```
This behaves similarly to **breakpoint()**, giving you a debugger-like experience.
If you dont want to import the function in every single file, you can make it global by using **install** function:
```
`watch.install() # or watch.install("func_name") and use it as func_name()`
```
Personally, I think the coolest thing about watchpoints is its intuitive usage. Are you interested in some data? Just "watch" it, and you'll know when your variable changes.
### Try watchpoints
I developed and maintain `watchpoints` on [GitHub][2], and have released it under the licensed under Apache 2.0. Install it and use it, and of course contribution is always welcome.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/monitor-debug-python
作者:[Tian Gao][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/gaogaotiantian
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/look-binoculars-sight-see-review.png?itok=NOw2cm39 (Looking back with binoculars)
[2]: https://github.com/gaogaotiantian/watchpoints
[3]: https://opensource.com/article/21/3/debug-code-gdb

View File

@ -1,136 +0,0 @@
[#]: subject: (Find what changed in a Git commit)
[#]: via: (https://opensource.com/article/21/4/git-whatchanged)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
[#]: collector: (lujun9972)
[#]: translator: (DCOLIVERSUN)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Find what changed in a Git commit
======
Git offers several ways you can quickly see which files changed in a
commit.
![Code going into a computer.][1]
If you use Git every day, you probably make a lot of commits. If you're using Git every day in a project with other people, it's safe to assume that _everyone_ is making lots of commits. Every day. And this means you're aware of how disorienting a Git log can become, with a seemingly eternal scroll of changes and no sign of what's been changed.
So how do you find out what file changed in a specific commit? It's easier than you think.
### Find what file changed in a commit
To find out which files changed in a given commit, use the `git log --raw` command. It's the fastest and simplest way to get insight into which files a commit affects. The `git log` command is underutilized in general, largely because it has so many formatting options, and many users get overwhelmed by too many choices and, in some cases, unclear documentation.
The log mechanism in Git is surprisingly flexible, though, and the `--raw` option provides a log of commits in your current branch, plus a list of each file that had changes made to it.
Here's the output of a standard `git log`:
```
$ git log
commit fbbbe083aed75b24f2c77b1825ecab10def0953c (HEAD -&gt; dev, origin/dev)
Author: tux &lt;[tux@example.com][2]&gt;
Date:   Sun Nov 5 21:40:37 2020 +1300
    exit immediately from failed download
commit 094f9948cd995acfc331a6965032ea0d38e01f03 (origin/master, master)
Author: Tux &lt;[tux@example.com][2]&gt;
Date:   Fri Aug 5 02:05:19 2020 +1200
    export makeopts from etc/example.conf
commit 76b7b46dc53ec13316abb49cc7b37914215acd47
Author: Tux &lt;[tux@example.com][2]&gt;
Date:   Sun Jul 31 21:45:24 2020 +1200
    fix typo in help message
```
Even when the author helpfully specifies in the commit message which files changed, the log is fairly terse.
Here's the output of `git log --raw`:
```
$ git log --raw
commit fbbbe083aed75b24f2c77b1825ecab10def0953c (HEAD -&gt; dev, origin/dev)
Author: tux &lt;[tux@example.com][2]&gt;
Date:   Sun Nov 5 21:40:37 2020 +1300
    exit immediately from failed download
:100755 100755 cbcf1f3 4cac92f M        src/example.lua
commit 094f9948cd995acfc331a6965032ea0d38e01f03 (origin/master, master)
Author: Tux &lt;[tux@example.com][2]&gt;
Date:   Fri Aug 5 02:05:19 2020 +1200
    export makeopts from etc/example.conf
   
:100755 100755 4c815c0 cbcf1f3 M     src/example.lua
:100755 100755 71653e1 8f5d5a6 M     src/example.spec
:100644 100644 9d21a6f e33caba R100  etc/example.conf  etc/example.conf-default
commit 76b7b46dc53ec13316abb49cc7b37914215acd47
Author: Tux &lt;[tux@example.com][2]&gt;
Date:   Sun Jul 31 21:45:24 2020 +1200
    fix typo in help message
:100755 100755 e253aaf 4c815c0 M        src/example.lua
```
This tells you exactly which file was added to the commit and how the file was changed (`A` for added, `M` for modified, `R` for renamed, and `D` for deleted).
### Git whatchanged
The `git whatchanged` command is a legacy command that predates the log function. Its documentation says you're not meant to use it in favor of `git log --raw` and implies it's essentially deprecated. However, I still find it a useful shortcut to (mostly) the same output (although merge commits are excluded), and I anticipate creating an alias for it should it ever be removed. If you don't need to merge commits in your log (and you probably don't, if you're only looking to see files that changed), try `git whatchanged` as an easy mnemonic.
### View changes
Not only can you see which files changed, but you can also make `git log` display exactly what changed in the files. Your Git log can produce an inline diff, a line-by-line display of all changes for each file, with the `--patch` option:
```
commit 62a2daf8411eccbec0af69e4736a0fcf0a469ab1 (HEAD -&gt; master)
Author: Tux &lt;[Tux@example.com][3]&gt;
Date:   Wed Mar 10 06:46:58 2021 +1300
    commit
diff --git a/hello.txt b/hello.txt
index 65a56c3..36a0a7d 100644
\--- a/hello.txt
+++ b/hello.txt
@@ -1,2 +1,2 @@
 Hello
-world
+opensource.com
```
In this example, the one-word line "world" was removed from `hello.txt` and the new line "opensource.com" was added.
These patches can be used with common Unix utilities like [diff and patch][4], should you need to make the same changes manually elsewhere. The patches are also a good way to summarize the important parts of what new information a specific commit introduces. This is an invaluable overview when you've introduced a bug during a sprint. To find the cause of the error faster, you can ignore the parts of a file that didn't change and review just the new code.
### Simple commands for complex results
You don't have to understand refs and branches and commit hashes to view what files changed in a commit. Your Git log was designed to report Git activity to you, and if you want to format it in a specific way or extract specific information, it's often a matter of wading through many screens of documentation to put together the right command. Luckily, one of the most common requests about Git history is available with just one or two options: `--raw` and `--patch`. And if you can't remember `--raw`, just think, "Git, what changed?" and type `git whatchanged`.
--------------------------------------------------------------------------------
via: https://opensource.com/article/21/4/git-whatchanged
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.)
[2]: mailto:tux@example.com
[3]: mailto:Tux@example.com
[4]: https://opensource.com/article/18/8/diffs-patches

View File

@ -1,104 +0,0 @@
[#]: subject: (Wrong Time Displayed in Windows-Linux Dual Boot Setup? Heres How to Fix it)
[#]: via: (https://itsfoss.com/wrong-time-dual-boot/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
Wrong Time Displayed in Windows-Linux Dual Boot Setup? Heres How to Fix it
======
If you [dual boot Windows and Ubuntu][1] or any other Linux distribution, you might have noticed a time difference between the two operating systems.
When you [use Linux][2], it shows the correct time. But when you boot into Windows, it shows the wrong time. Sometimes, it is the opposite and Linux shows the wrong time and Windows has the correct time.
Thats strange specially because you are connected to the internet and your date and time is set to be used automatically.
Dont worry! You are not the only one to face this issue. You can fix it by using the following command in the Linux terminal:
```
timedatectl set-local-rtc 1
```
Again, dont worry. Ill explain why you encounter a time difference in a dual boot setup. Ill show you how the above command fixes the wrong time issue in Windows after dual boot.
### Why Windows and Linux show different time in dual boot?
A computer has two main clocks: a system clock and a hardware clock.
A hardware clock which is also called RTC ([real time clock][3]) or CMOS/BIOS clock. This clock is outside the operating system, on your computers motherboard. It keeps on running even after your system is powered off.
The system clock is what you see inside your operating system.
When your computer is powered on, the hardware clock is read and used to set the system clock. Afterwards, the system clock is used for tracking time. If your operating system makes any changes to system clock, like changing time zone etc, it tries to sync this information to the hardware clock.
By default, Linux assumes that the time stored in the hardware clock is in UTC, not the local time. On the other hand, Windows thinks that the time stored on the hardware clock is local time. Thats where the trouble starts.
Let me explain with examples.
You see I am in Kolkata time zone which is UTC+5:30. After installing when I set the [timezon][4][e][4] [in Ubuntu][4] to the Kolkata time zone, Ubuntu syncs this time information to the hardware clock but with an offset of 5:30 because it has to be in UTC for Linux.
Let say the current time in Kolkata timezone is 15:00 which means that the UTC time is 09:30.
Now when I turn off the system and boot into Windows, the hardware clock has the UTC time (09:30 in this example). But Windows thinks the hardware clock has stored the local time. And thus it changes the system clock (which should have shown 15:00) to use the UTC time (09:30) as the local time. And hence, Windows shows 09:30 as the time which is 5:30 hours behind the actual time (15:00 in our example).
![][5]
Again, if I set the correct time in Windows by toggling the automatic time zone and time buttons, you know what is going to happen? Now it will show the correct time on the system (15:00) and sync this information (notice the “Synchronize your clock” option in the image) to the hardware clock.
If you boot into Linux, it reads the time from the hardware clock which is in local time (15:00) but since Linux believes it to be the UTC time, it adds an offset of 5:30 to the system clock. Now Linux shows a time of 20:30 which is 5:30 hours ahead of the actual time.
Now that you understand the root cause of the time difference issues in dual boot, its time to see how to fix the issue.
### Fixing Windows Showing Wrong Time in a Dual Boot Setup With Linux
There are two ways you can go about handling this issue:
* Make Windows use UTC time for the hardware clock
* Make Linux use local time for the hardware clock
It is easier to make the changes in Linux and hence Ill recommend going with the second method.
Ubuntu and most other Linux distributions use systemd these days and hence you can use timedatectl command to change the settings.
What you are doing is to tell your Linux system to use the local time for the hardware clock (RTC). You do that with the `set-local-rtc` (set local time for RTC) option:
```
timedatectl set-local-rtc 1
```
As you can notice in the image below, the RTC now uses the local time.
![][6]
Now if you boot into Windows, it takes the hardware clock to be as local time which is actually correct this time. When you boot into Linux, your Linux system knows that the hardware clock is using local time, not UTC. And hence, it doesnt try to add the off-set this time.
This fixes the time difference issue between Linux and Windows in dual boot.
You see a warning about not using local time for RTC. For desktop setups, it should not cause any issues. At least, I cannot think of one.
I hope I made things clear for you. If you still have questions, please leave a comment below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/wrong-time-dual-boot/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/
[2]: https://itsfoss.com/why-use-linux/
[3]: https://www.computerhope.com/jargon/r/rtc.htm
[4]: https://itsfoss.com/change-timezone-ubuntu/
[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2021/03/set-time-windows.jpg?resize=800%2C491&ssl=1
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2021/03/set-local-time-for-rtc-ubuntu.png?resize=800%2C490&ssl=1

Some files were not shown because too many files have changed in this diff Show More